From db0e2ff3b376cec3868b09758712fe8b8acc2d3b Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 20 Mar 2014 13:46:43 +0000 Subject: [PATCH] Dodal sem podporo za nastavljanje zagona sistemskih servisov. --- MSICA/L10N/sl_SI.po | 34 +++++++----- MSICA/MSIBuild/Makefile | 36 ++++++++++-- MSICA/MSICA.cpp | 120 +++++++++++++++++++++++++++++++++++++++- MSICA/MSICA.h | 1 + 4 files changed, 171 insertions(+), 20 deletions(-) diff --git a/MSICA/L10N/sl_SI.po b/MSICA/L10N/sl_SI.po index 9dd08be..c4953bf 100644 --- a/MSICA/L10N/sl_SI.po +++ b/MSICA/L10N/sl_SI.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: MSICA\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-20 13:36+0100\n" +"POT-Creation-Date: 2014-03-20 14:44+0100\n" "PO-Revision-Date: \n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" @@ -77,6 +77,13 @@ msgstr "SUBLANG_DEFAULT" msgid "Certificate: [1]" msgstr "Digitalno potrdilo: [1]" +#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:5 +#: MSIBuild/En.Win32.Release.ActionText-2.idtx:5 +#: MSIBuild/En.x64.Debug.ActionText-2.idtx:5 +#: MSIBuild/En.x64.Release.ActionText-2.idtx:5 +msgid "Configuring services" +msgstr "Nastavljanje servisov" + #: MSIBuild/En.Win32.Debug.ActionText-2.idtx:4 #: MSIBuild/En.Win32.Release.ActionText-2.idtx:4 #: MSIBuild/En.x64.Debug.ActionText-2.idtx:4 @@ -84,22 +91,23 @@ msgstr "Digitalno potrdilo: [1]" msgid "Installing certificates" msgstr "Nameščanje digitalnih potrdil" -#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:5 -#: MSIBuild/En.Win32.Release.ActionText-2.idtx:5 -#: MSIBuild/En.x64.Debug.ActionText-2.idtx:5 -#: MSIBuild/En.x64.Release.ActionText-2.idtx:5 +#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:6 +#: MSIBuild/En.Win32.Release.ActionText-2.idtx:6 +#: MSIBuild/En.x64.Debug.ActionText-2.idtx:6 +#: MSIBuild/En.x64.Release.ActionText-2.idtx:6 msgid "Registering scheduled tasks" msgstr "Registracija razporejenih opravil" +#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:6 +#: MSIBuild/En.Win32.Release.ActionText-2.idtx:6 +#: MSIBuild/En.x64.Debug.ActionText-2.idtx:6 +#: MSIBuild/En.x64.Release.ActionText-2.idtx:6 +msgid "Scheduled task: [1]" +msgstr "Razporejeno opravilo: [1]" + #: MSIBuild/En.Win32.Debug.ActionText-2.idtx:5 #: MSIBuild/En.Win32.Release.ActionText-2.idtx:5 #: MSIBuild/En.x64.Debug.ActionText-2.idtx:5 #: MSIBuild/En.x64.Release.ActionText-2.idtx:5 -msgid "Scheduled task: [1]" -msgstr "Razporejeno opravilo: [1]" - -#~ msgid "Scheduled Task Installation Support Library" -#~ msgstr "Podporna knjižnica za nameščanje načrtovanih opravil" - -#~ msgid "MSICACert" -#~ msgstr "MSICACert" +msgid "Service: [1]" +msgstr "Servis: [1]" diff --git a/MSICA/MSIBuild/Makefile b/MSICA/MSIBuild/Makefile index 8394b54..b904e8d 100644 --- a/MSICA/MSIBuild/Makefile +++ b/MSICA/MSIBuild/Makefile @@ -37,6 +37,11 @@ ScheduledTask IdleDeadline Y Integer A value that specifies the maximum num ScheduledTask MaxRuntime N DoubleInteger Specifies the maximum run time (in milliseconds), for the task. This parameter may be set to -1 to specify an unlimited time. ScheduledTask Condition Y Condition Optional expression which skips the task if evaluates to expFalse. If the expression syntax is invalid, the engine will terminate, returning iesBadActionData. ScheduledTask Component_ N Component 1 Identifier Component the task is part of. +ServiceConfigure ServiceConfigure N Identifier Primary key, non-localized token. +ServiceConfigure Name N Formatted Name of a service. /, \, comma and space are invalid +ServiceConfigure StartType N DoubleInteger -1;0;1;2;3;4 Start type: -1=don't change, 0=boot, 1=system, 2=auto, 3=demand, 4=disabled +ServiceConfigure Condition Y Condition Optional expression which skips the service configuration if evaluates to expFalse. If the expression syntax is invalid, the engine will terminate, returning iesBadActionData. +ServiceConfigure Sequence Y Number that determines the sort order in which the configurations are to be executed. TaskTrigger Trigger N Identifier Primary key, non-localized token. TaskTrigger BeginDate N DoubleInteger Date that the task trigger activates (counted in days from January 1st, 1980). The beginning date must be specified when setting a task. TaskTrigger EndDate Y DoubleInteger Date that the task trigger deactivates (counted in days from January 1st, 1980). @@ -68,6 +73,7 @@ Action Description Template s$(MSIBUILD_LENGTH_ID) L0 L0 1252 ActionText Action InstallCertificates Installing certificates Certificate: [1] +ConfigureServices Configuring services Service: [1] InstallScheduledTasks Registering scheduled tasks Scheduled task: [1] < NUL +ServiceConfigure Name StartType Condition Sequence +s$(MSIBUILD_LENGTH_ID) l255 i4 S255 I2 +ServiceConfigure ServiceConfigure +<= 0) { + // Set service start type. + olExecute.AddTail(new MSICA::COpSvcSetStart(sValue, iStartType, MSICA_SVC_SET_START_TICK_SIZE)); + + // The amount of tick space to add to progress indicator. + ::MsiRecordSetInteger(hRecordProg, 1, 3 ); + ::MsiRecordSetInteger(hRecordProg, 2, MSICA_SVC_SET_START_TICK_SIZE); + if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; } + } + } + ::MsiViewClose(hViewSC); + + if (uiResult == NO_ERROR) { + // Save the sequences. + uiResult = MSICA::SaveSequence(hInstall, _T("ConfigureServices"), _T("CommitServiceConfiguration"), _T("RollbackServiceConfiguration"), olExecute); + } else if (uiResult != ERROR_INSTALL_USEREXIT) { + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE); + ::MsiRecordSetInteger(hRecordProg, 2, uiResult ); + ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); + } + } else { + ::MsiRecordSetInteger(hRecordProg, 1, uiResult); + ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); + } + } else { + ::MsiRecordSetInteger(hRecordProg, 1, uiResult); + ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); + } + } + } else { + uiResult = ERROR_INSTALL_DATABASE_OPEN; + ::MsiRecordSetInteger(hRecordProg, 1, uiResult); + ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); + } + + olExecute.Free(); + if (bIsCoInitialized) ::CoUninitialize(); + return uiResult; +} + + UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall) { + //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); + UINT uiResult; BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL)); MSICA::COpList olExecute; @@ -313,5 +425,7 @@ UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall) UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall) { + ::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); + return MSICA::ExecuteSequence(hInstall); } diff --git a/MSICA/MSICA.h b/MSICA/MSICA.h index 1a96f92..9180723 100644 --- a/MSICA/MSICA.h +++ b/MSICA/MSICA.h @@ -25,6 +25,7 @@ extern "C" { #endif UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall); + UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall); UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall); UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall);