void ProcessComponent::ExecCmd(const std::wstring& command, DVLib::CommandExecutionMethod executionMethod, bool disableWow64FsRedirection, const std::wstring& working_directory, int nShow)
{
	if (disableWow64FsRedirection)
	{
		auto_any<Wow64NativeFS *, close_delete> wow64_native_fs(new Wow64NativeFS());
		ExecCmdCore(command, executionMethod, working_directory, nShow);
	}
	else
	{
		ExecCmdCore(command, executionMethod, working_directory, nShow);
	}
}
Ejemplo n.º 2
0
void MspComponent::Exec()
{
	std::wstring command = GetCommandLine();
    LOG(L"Executing: " << command);
	if (disable_wow64_fs_redirection)
	{
		auto_any<Wow64NativeFS *, close_delete> wow64_native_fs(new Wow64NativeFS());
		DVLib::RunCmd(command, & m_process_info);
	}
	else
	{
		DVLib::RunCmd(command, & m_process_info);
	}
}
void OpenFileComponent::Exec()
{
    std::wstring l_file = file;
    l_file = InstallerSession::Instance->ExpandUserVariables(l_file);
    LOG(L"Opening: " << l_file);
    if (disable_wow64_fs_redirection)
    {
        auto_any<Wow64NativeFS *, close_delete> wow64_native_fs(new Wow64NativeFS());
        DVLib::ShellCmd(l_file, & m_rc, NULL, main_window);
    }
    else
    {
        DVLib::ShellCmd(l_file, & m_rc, NULL, main_window);
    }
}
Ejemplo n.º 4
0
void MsuComponent::Exec()
{
	std::wstring l_command = L"wusa.exe ";

	switch(InstallerSession::Instance->sequence)
	{
	case SequenceInstall:
		break;
	default:
		THROW_EX(L"Unsupported install sequence: " << InstallerSession::Instance->sequence << L".");
	}

	l_command.append(L"\"");
	l_command += DVLib::DirectoryCombine(DVLib::GetCurrentDirectoryW(), package);
	l_command.append(L"\"");

	std::wstring l_cmdparameters = InstallUILevelSetting::Instance->GetCommand(
		cmdparameters, cmdparameters_basic, cmdparameters_silent);
	
	if (! l_cmdparameters.empty())
	{
		LOG(L"-- Additional command-line parameters: " << l_cmdparameters);
		l_command.append(L" ");
		l_command.append(l_cmdparameters);
	}
	
	std::wstring additional_cmd = GetAdditionalCmd();
	if (! additional_cmd.empty())
    {
		l_command.append(L" ");
		l_command.append(additional_cmd);
    }

	l_command = InstallerSession::Instance->ExpandUserVariables(l_command);

    LOG(L"Executing: " << l_command);

	if (disable_wow64_fs_redirection)
	{
		auto_any<Wow64NativeFS *, close_delete> wow64_native_fs(new Wow64NativeFS());
		DVLib::RunCmd(l_command, & m_process_info);
	}
	else
	{
		DVLib::RunCmd(l_command, & m_process_info);
	}
}
Ejemplo n.º 5
0
void ExeComponent::Exec()
{
	std::wstring l_command;
	std::wstring l_exeparameters;
	std::wstring l_responsefile_source;
	std::wstring l_responsefile_target;
	std::wstring l_responsefile_processed;
	
	// make executable executable
	switch(InstallerSession::Instance->sequence)
	{
	case SequenceInstall:
		l_command = InstallUILevelSetting::Instance->GetCommand(
			executable, executable_basic, executable_silent);
		l_exeparameters = InstallUILevelSetting::Instance->GetCommand(
			exeparameters, exeparameters_basic, exeparameters_silent);
		l_responsefile_source = responsefile_source;
		l_responsefile_target = responsefile_target;
		break;
	case SequenceUninstall:
		l_command = InstallUILevelSetting::Instance->GetCommand(
			uninstall_executable, uninstall_executable_basic, uninstall_executable_silent);
		l_exeparameters = InstallUILevelSetting::Instance->GetCommand(
			uninstall_exeparameters, uninstall_exeparameters_basic, uninstall_exeparameters_silent);
		l_responsefile_source = uninstall_responsefile_source;
		l_responsefile_target = uninstall_responsefile_target;
		break;
	default:
		THROW_EX(L"Unsupported install sequence: " << InstallerSession::Instance->sequence << L".");
	}

	LOG(L"-- Executable: " << l_command);

	// install_dir
	std::wstring installdir = InstallerSession::Instance->ExpandUserVariables(install_directory.GetValue());
	if (InstallerSession::Instance->sequence == SequenceInstall && ! installdir.empty())
	{
		bool installdir_exists = DVLib::DirectoryExists(installdir);
		if (! installdir_exists)
		{
			LOG(L"-- Creating install_directory directory '" << installdir << L"'");
			DVLib::DirectoryCreate(installdir);
		}
		else
		{
			LOG(L"-- Directory '" << installdir << L"' exists");
		}
	}

	// response file
	if (! l_responsefile_source.empty() && ! l_responsefile_target.empty()) 
	{
		LOG(L"-- Response file source: " << l_responsefile_source << L" (" << responsefile_format << L")");
		LOG(L"-- Response file target: " << l_responsefile_target);
		ResponseFilePtr r;
		ResponseFileFormat l_responsefile_format = ResponseFile::string2responsefileformat(responsefile_format);
		switch(l_responsefile_format)
		{
		case ResponseFileFormatNone:
			reset(r, new ResponseFileNone(l_responsefile_source, l_responsefile_target));
			break;
		case ResponseFileFormatIni:
			reset(r, new ResponseFileIni(l_responsefile_source, l_responsefile_target));
			break;
		case ResponseFileFormatText:
			reset(r, new ResponseFileText(l_responsefile_source, l_responsefile_target));
			break;
		default:
			THROW_EX(L"Unsupported response file format: " << responsefile_format); 
		}

		r->Exec();
	}

	if (! l_exeparameters.empty())
	{
		LOG(L"-- Additional command-line parameters: " << l_exeparameters);
		l_command.append(L" ");
		l_command.append(l_exeparameters);
	}

	std::wstring additional_cmd = GetAdditionalCmd();
	if (! additional_cmd.empty())
    {
		l_command.append(L" ");
		l_command.append(additional_cmd);
    }

	l_command = InstallerSession::Instance->ExpandUserVariables(l_command);

	LOG(L"Executing: " << l_command);

	CHECK_BOOL(! l_command.empty(), L"Component command is empty");

	if (disable_wow64_fs_redirection)
	{
		auto_any<Wow64NativeFS *, close_delete> wow64_native_fs(new Wow64NativeFS());
		DVLib::RunCmd(l_command, & m_process_info);
	}
	else
	{
		DVLib::RunCmd(l_command, & m_process_info);
	}
	
};