void CatalanitzadorPerAWindows::Run(wstring commandLine)
{
	Registry registry;
	CommandLine commandLineProcessor(&m_actions);

	_initLog();
	commandLineProcessor.Process(commandLine);
	
	if (commandLineProcessor.GetRunningCheck() == true)
	{
		if (_isAlreadyRunning() == true)
			return;	
	}

	Guid guid(&registry);
	guid.Get();

	m_serializer.OpenHeader();
	m_serializer.Serialize(&guid);
	guid.Store();
	
	if (_supportedOS() == true && _hasAdminPermissionsDialog() == true)
	{
		OleInitialize(0);
		AXRegister();
		_createWizard();
	}
}
Exemplo n.º 2
0
int CatalanitzadorPerAWindows::Run(wstring commandLine)
{
	bool impersonated;
	Registry registry;
	ApplicationExecutor applicationExecutor;
	CommandLine commandLineProcessor(applicationExecutor.GetActionsObject());

	_initLog();
	commandLineProcessor.Process(commandLine);

	if (commandLineProcessor.GetRunningCheck() == true)
	{
		if (_isAlreadyRunning() == true)
			return RETURN_ERROR;
	}

	Guid guid(&registry);
	guid.Get();

	m_serializer.OpenHeader();
	m_serializer.Serialize(&guid);
	guid.Store();
	
	if (_supportedOS() == false || _hasAdminPermissionsDialog() == false)
		return RETURN_ERROR;

	impersonated = _warnImpersonateUser();

	OleInitialize(0);

	applicationExecutor.SetSerializer(&m_serializer);
	Option optionShowSecDlg(OptionSilentInstall, commandLineProcessor.GetSilent());
	applicationExecutor.SetOption(optionShowSecDlg);

	Option optionShowImpersonatedDlg(OptionShowImpersonatedDlg, impersonated);
	applicationExecutor.SetOption(optionShowImpersonatedDlg);

	if (commandLineProcessor.GetSilent())
	{
		SilentInstallation silentInstallation;
		silentInstallation.Run(applicationExecutor);
	}
	else
	{		
		AXRegister();
		UIInstallation uiInstallation;
		uiInstallation.Run(m_hInstance, applicationExecutor);
	}

	return applicationExecutor.HasErrors() ?  RETURN_ERROR :  RETURN_OK;
}