Usposobil sem nastavljanje sistemskih servisov med namestitvijo.

Uredil sem nomenklaturo akcij po meri.
This commit is contained in:
Simon Rozman 2014-03-20 18:18:43 +00:00
parent db0e2ff3b3
commit ed18da4ebb
5 changed files with 96 additions and 91 deletions

View File

@ -72,9 +72,9 @@ All :: "$(LANG).$(PLAT).$(CFG).ActionText-2.idt"
Action Description Template Action Description Template
s$(MSIBUILD_LENGTH_ID) L0 L0 s$(MSIBUILD_LENGTH_ID) L0 L0
1252 ActionText Action 1252 ActionText Action
InstallCertificates Installing certificates Certificate: [1] CertificatesExec Installing certificates Certificate: [1]
ConfigureServices Configuring services Service: [1] ServiceConfigExec Configuring services Service: [1]
InstallScheduledTasks Registering scheduled tasks Scheduled task: [1] ScheduledTasksExec Registering scheduled tasks Scheduled task: [1]
<<NOKEEP <<NOKEEP
"De.$(PLAT).$(CFG).ActionText-2.idt" : "En.$(PLAT).$(CFG).ActionText-2.idtx" "..\L10N\de_DE.po" "De.$(PLAT).$(CFG).ActionText-2.idt" : "En.$(PLAT).$(CFG).ActionText-2.idtx" "..\L10N\de_DE.po"
@ -135,18 +135,18 @@ All :: "$(LANG).$(PLAT).$(CFG).CustomAction-1.idt"
Action Type Source Target Action Type Source Target
s$(MSIBUILD_LENGTH_ID) i2 S$(MSIBUILD_LENGTH_ID) S255 s$(MSIBUILD_LENGTH_ID) i2 S$(MSIBUILD_LENGTH_ID) S255
CustomAction Action CustomAction Action
EvaluateCertificates 1 binMSICA.dll EvaluateCertificates CertificatesEval 1 binMSICA.dll CertificatesEval
InstallCertificates 3073 binMSICA.dll ExecuteSequence CertificatesExec 3073 binMSICA.dll ExecuteSequence
RollbackCertificates 3329 binMSICA.dll ExecuteSequence CertificatesRollback 3329 binMSICA.dll ExecuteSequence
CommitCertificates 3585 binMSICA.dll ExecuteSequence CertificatesCommit 3585 binMSICA.dll ExecuteSequence
EvaluateServiceConfiguration 1 binMSICA.dll EvaluateServiceConfiguration ServiceConfigEval 1 binMSICA.dll ServiceConfigEval
ConfigureServices 3073 binMSICA.dll ExecuteSequence ServiceConfigExec 3073 binMSICA.dll ExecuteSequence
RollbackServiceConfiguration 3329 binMSICA.dll ExecuteSequence ServiceConfigRollback 3329 binMSICA.dll ExecuteSequence
CommitServiceConfiguration 3585 binMSICA.dll ExecuteSequence ServiceConfigCommit 3585 binMSICA.dll ExecuteSequence
EvaluateScheduledTasks 1 binMSICA.dll EvaluateScheduledTasks ScheduledTasksEval 1 binMSICA.dll ScheduledTasksEval
InstallScheduledTasks 3073 binMSICA.dll ExecuteSequence ScheduledTasksExec 3073 binMSICA.dll ExecuteSequence
RollbackScheduledTasks 3329 binMSICA.dll ExecuteSequence ScheduledTasksRollback 3329 binMSICA.dll ExecuteSequence
CommitScheduledTasks 3585 binMSICA.dll ExecuteSequence ScheduledTasksCommit 3585 binMSICA.dll ExecuteSequence
<<NOKEEP <<NOKEEP
@ -161,18 +161,18 @@ All :: "$(LANG).$(PLAT).$(CFG).InstallExecuteSequence-1.idt"
Action Condition Sequence Action Condition Sequence
s$(MSIBUILD_LENGTH_ID) S255 I2 s$(MSIBUILD_LENGTH_ID) S255 I2
InstallExecuteSequence Action InstallExecuteSequence Action
EvaluateCertificates 6577 CertificatesEval 6576
RollbackCertificates 6576 CertificatesRollback 6577
InstallCertificates 6578 CertificatesExec 6578
CommitCertificates 6579 CertificatesCommit 6579
EvaluateScheduledTasks 6580 ScheduledTasksEval 6580
RollbackScheduledTasks 6581 ScheduledTasksRollback 6581
InstallScheduledTasks 6582 ScheduledTasksExec 6582
CommitScheduledTasks 6583 ScheduledTasksCommit 6583
EvaluateServiceConfiguration 6584 ServiceConfigEval 6584
RollbackServiceConfiguration 6585 ServiceConfigRollback 6585
ConfigureServices 6586 ServiceConfigExec 6586
CommitServiceConfiguration 6587 ServiceConfigCommit 6587
<<NOKEEP <<NOKEEP

View File

@ -27,7 +27,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
// Exported functions // Exported functions
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall) UINT MSICA_API CertificatesEval(MSIHANDLE hInstall)
{ {
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
@ -151,7 +151,7 @@ UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall)
if (uiResult == NO_ERROR) { if (uiResult == NO_ERROR) {
// Save the sequences. // Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("InstallCertificates"), _T("CommitCertificates"), _T("RollbackCertificates"), olExecute); uiResult = MSICA::SaveSequence(hInstall, _T("CertificatesExec"), _T("CertificatesCommit"), _T("CertificatesRollback"), olExecute);
} else if (uiResult != ERROR_INSTALL_USEREXIT) { } else if (uiResult != ERROR_INSTALL_USEREXIT) {
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE); ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE);
::MsiRecordSetInteger(hRecordProg, 2, uiResult ); ::MsiRecordSetInteger(hRecordProg, 2, uiResult );
@ -178,9 +178,9 @@ UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall)
} }
UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall) UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall)
{ {
::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
UINT uiResult; UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL)); BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
@ -260,7 +260,7 @@ UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall)
if (uiResult == NO_ERROR) { if (uiResult == NO_ERROR) {
// Save the sequences. // Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("ConfigureServices"), _T("CommitServiceConfiguration"), _T("RollbackServiceConfiguration"), olExecute); uiResult = MSICA::SaveSequence(hInstall, _T("ServiceConfigExec"), _T("ServiceConfigCommit"), _T("ServiceConfigRollback"), olExecute);
} else if (uiResult != ERROR_INSTALL_USEREXIT) { } else if (uiResult != ERROR_INSTALL_USEREXIT) {
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE); ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE);
::MsiRecordSetInteger(hRecordProg, 2, uiResult ); ::MsiRecordSetInteger(hRecordProg, 2, uiResult );
@ -287,7 +287,7 @@ UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall)
} }
UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall) UINT MSICA_API ScheduledTasksEval(MSIHANDLE hInstall)
{ {
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
@ -396,7 +396,7 @@ UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
if (uiResult == NO_ERROR) { if (uiResult == NO_ERROR) {
// Save the sequences. // Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("InstallScheduledTasks"), _T("CommitScheduledTasks"), _T("RollbackScheduledTasks"), olExecute); uiResult = MSICA::SaveSequence(hInstall, _T("ScheduledTasksExec"), _T("ScheduledTasksCommit"), _T("ScheduledTasksRollback"), olExecute);
} else if (uiResult != ERROR_INSTALL_USEREXIT) { } else if (uiResult != ERROR_INSTALL_USEREXIT) {
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE); ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE);
::MsiRecordSetInteger(hRecordProg, 2, uiResult ); ::MsiRecordSetInteger(hRecordProg, 2, uiResult );
@ -425,7 +425,7 @@ UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall) UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall)
{ {
::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
return MSICA::ExecuteSequence(hInstall); return MSICA::ExecuteSequence(hInstall);
} }

View File

@ -24,9 +24,9 @@
extern "C" { extern "C" {
#endif #endif
UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall); UINT MSICA_API CertificatesEval(MSIHANDLE hInstall);
UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall); UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall);
UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall); UINT MSICA_API ScheduledTasksEval(MSIHANDLE hInstall);
UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall); UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: MSICALib\n" "Project-Id-Version: MSICALib\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-14 11:11+0100\n" "POT-Creation-Date: 2014-03-20 18:56+0100\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n" "Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n" "Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n"
@ -17,15 +17,11 @@ msgstr ""
"X-Poedit-SearchPath-0: MSIBuild\n" "X-Poedit-SearchPath-0: MSIBuild\n"
# Windows charset for this language (decimal) # Windows charset for this language (decimal)
#: MSIBuild/En.Win32.Debug.Error-2.idtx:3 #: MSIBuild/En.Win32.Debug.Error-2.idtx:3 MSIBuild/En.x64.Debug.Error-2.idtx:3
#: MSIBuild/En.Win32.Release.Error-2.idtx:3
#: MSIBuild/En.x64.Debug.Error-2.idtx:3 MSIBuild/En.x64.Release.Error-2.idtx:3
msgid "1252" msgid "1252"
msgstr "1250" msgstr "1250"
#: MSIBuild/En.Win32.Debug.Error-2.idtx:5 #: MSIBuild/En.Win32.Debug.Error-2.idtx:5 MSIBuild/En.x64.Debug.Error-2.idtx:5
#: MSIBuild/En.Win32.Release.Error-2.idtx:5
#: MSIBuild/En.x64.Debug.Error-2.idtx:5 MSIBuild/En.x64.Release.Error-2.idtx:5
msgid "" msgid ""
"Error [2] creating scheduled task list. Please, contact your support " "Error [2] creating scheduled task list. Please, contact your support "
"personnel." "personnel."
@ -33,10 +29,17 @@ msgstr ""
"Pri pripravi seznama razvrščenih opravil je prišlo do napake [2]. Obrnite se " "Pri pripravi seznama razvrščenih opravil je prišlo do napake [2]. Obrnite se "
"na svojo tehnično službo." "na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:17
#: MSIBuild/En.x64.Debug.Error-2.idtx:17
msgid ""
"Error [3] changing service \"[2]\" start type. Please, contact your support "
"personnel."
msgstr ""
"Pri nastavljanju servisa »[2]« je prišlo do napake [3]. Obrnite se na svojo "
"tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:11 #: MSIBuild/En.Win32.Debug.Error-2.idtx:11
#: MSIBuild/En.Win32.Release.Error-2.idtx:11
#: MSIBuild/En.x64.Debug.Error-2.idtx:11 #: MSIBuild/En.x64.Debug.Error-2.idtx:11
#: MSIBuild/En.x64.Release.Error-2.idtx:11
msgid "" msgid ""
"Error [3] creating \"[2]\" scheduled task. Please, contact your support " "Error [3] creating \"[2]\" scheduled task. Please, contact your support "
"personnel." "personnel."
@ -44,9 +47,7 @@ msgstr ""
"Pri stvaritvi razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite " "Pri stvaritvi razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite "
"se na svojo tehnično službo." "se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:9 #: MSIBuild/En.Win32.Debug.Error-2.idtx:9 MSIBuild/En.x64.Debug.Error-2.idtx:9
#: MSIBuild/En.Win32.Release.Error-2.idtx:9
#: MSIBuild/En.x64.Debug.Error-2.idtx:9 MSIBuild/En.x64.Release.Error-2.idtx:9
msgid "" msgid ""
"Error [3] deleting \"[2]\" file. Please, contact your support personnel." "Error [3] deleting \"[2]\" file. Please, contact your support personnel."
msgstr "" msgstr ""
@ -54,9 +55,7 @@ msgstr ""
"tehnično službo." "tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:12 #: MSIBuild/En.Win32.Debug.Error-2.idtx:12
#: MSIBuild/En.Win32.Release.Error-2.idtx:12
#: MSIBuild/En.x64.Debug.Error-2.idtx:12 #: MSIBuild/En.x64.Debug.Error-2.idtx:12
#: MSIBuild/En.x64.Release.Error-2.idtx:12
msgid "" msgid ""
"Error [3] deleting \"[2]\" scheduled task. Please, contact your support " "Error [3] deleting \"[2]\" scheduled task. Please, contact your support "
"personnel." "personnel."
@ -65,9 +64,7 @@ msgstr ""
"se na svojo tehnično službo." "se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:13 #: MSIBuild/En.Win32.Debug.Error-2.idtx:13
#: MSIBuild/En.Win32.Release.Error-2.idtx:13
#: MSIBuild/En.x64.Debug.Error-2.idtx:13 #: MSIBuild/En.x64.Debug.Error-2.idtx:13
#: MSIBuild/En.x64.Release.Error-2.idtx:13
msgid "" msgid ""
"Error [3] enabling/disabling \"[2]\" scheduled task. Please, contact your " "Error [3] enabling/disabling \"[2]\" scheduled task. Please, contact your "
"support personnel." "support personnel."
@ -76,9 +73,7 @@ msgstr ""
"Obrnite se na svojo tehnično službo." "Obrnite se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:15 #: MSIBuild/En.Win32.Debug.Error-2.idtx:15
#: MSIBuild/En.Win32.Release.Error-2.idtx:15
#: MSIBuild/En.x64.Debug.Error-2.idtx:15 #: MSIBuild/En.x64.Debug.Error-2.idtx:15
#: MSIBuild/En.x64.Release.Error-2.idtx:15
msgid "" msgid ""
"Error [3] installing certificate to certificate store \"[2]\". Please, " "Error [3] installing certificate to certificate store \"[2]\". Please, "
"contact your support personnel." "contact your support personnel."
@ -86,9 +81,7 @@ msgstr ""
"Pri nameščanju digitalnega potrdila v shrambo »[2]« je prišlo do napake [3]. " "Pri nameščanju digitalnega potrdila v shrambo »[2]« je prišlo do napake [3]. "
"Obrnite se na svojo tehnično službo." "Obrnite se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:7 #: MSIBuild/En.Win32.Debug.Error-2.idtx:7 MSIBuild/En.x64.Debug.Error-2.idtx:7
#: MSIBuild/En.Win32.Release.Error-2.idtx:7
#: MSIBuild/En.x64.Debug.Error-2.idtx:7 MSIBuild/En.x64.Release.Error-2.idtx:7
msgid "" msgid ""
"Error [3] reading from \"[2]\" task list file. Please, contact your support " "Error [3] reading from \"[2]\" task list file. Please, contact your support "
"personnel." "personnel."
@ -97,9 +90,7 @@ msgstr ""
"Obrnite se na svojo tehnično službo." "Obrnite se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:16 #: MSIBuild/En.Win32.Debug.Error-2.idtx:16
#: MSIBuild/En.Win32.Release.Error-2.idtx:16
#: MSIBuild/En.x64.Debug.Error-2.idtx:16 #: MSIBuild/En.x64.Debug.Error-2.idtx:16
#: MSIBuild/En.x64.Release.Error-2.idtx:16
msgid "" msgid ""
"Error [3] removing certificate from certificate store \"[2]\". Please, " "Error [3] removing certificate from certificate store \"[2]\". Please, "
"contact your support personnel." "contact your support personnel."
@ -107,18 +98,30 @@ msgstr ""
"Pri odstranjevanju digitalnega potrdila iz shrambe »[2]« je prišlo do napake " "Pri odstranjevanju digitalnega potrdila iz shrambe »[2]« je prišlo do napake "
"[3]. Obrnite se na svojo tehnično službo." "[3]. Obrnite se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:8 #: MSIBuild/En.Win32.Debug.Error-2.idtx:8 MSIBuild/En.x64.Debug.Error-2.idtx:8
#: MSIBuild/En.Win32.Release.Error-2.idtx:8
#: MSIBuild/En.x64.Debug.Error-2.idtx:8 MSIBuild/En.x64.Release.Error-2.idtx:8
msgid "" msgid ""
"Error [3] setting \"[2]\" parameter. Please, contact your support personnel." "Error [3] setting \"[2]\" parameter. Please, contact your support personnel."
msgstr "" msgstr ""
"Pri nastavljanju parametra »[2]« je prišlo do napake [3]. Obrnite se na " "Pri nastavljanju parametra »[2]« je prišlo do napake [3]. Obrnite se na "
"svojo tehnično službo." "svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:6 #: MSIBuild/En.Win32.Debug.Error-2.idtx:18
#: MSIBuild/En.Win32.Release.Error-2.idtx:6 #: MSIBuild/En.x64.Debug.Error-2.idtx:18
#: MSIBuild/En.x64.Debug.Error-2.idtx:6 MSIBuild/En.x64.Release.Error-2.idtx:6 msgid ""
"Error [3] starting service \"[2]\". Please, contact your support personnel."
msgstr ""
"Pri zagonu servisa »[2]« je prišlo do napake [3]. Obrnite se na svojo "
"tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:19
#: MSIBuild/En.x64.Debug.Error-2.idtx:19
msgid ""
"Error [3] stopping service \"[2]\". Please, contact your support personnel."
msgstr ""
"Pri zaustavitvi servisa »[2]« je prišlo do napake [3]. Obrnite se na svojo "
"tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:6 MSIBuild/En.x64.Debug.Error-2.idtx:6
msgid "" msgid ""
"Error [3] writing to \"[2]\" task list file. Please, contact your support " "Error [3] writing to \"[2]\" task list file. Please, contact your support "
"personnel." "personnel."
@ -127,9 +130,7 @@ msgstr ""
"Obrnite se na svojo tehnično službo." "Obrnite se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:14 #: MSIBuild/En.Win32.Debug.Error-2.idtx:14
#: MSIBuild/En.Win32.Release.Error-2.idtx:14
#: MSIBuild/En.x64.Debug.Error-2.idtx:14 #: MSIBuild/En.x64.Debug.Error-2.idtx:14
#: MSIBuild/En.x64.Release.Error-2.idtx:14
msgid "" msgid ""
"Error [4] copying \"[2]\" scheduled task to \"[3]\". Please, contact your " "Error [4] copying \"[2]\" scheduled task to \"[3]\". Please, contact your "
"support personnel." "support personnel."
@ -138,9 +139,7 @@ msgstr ""
"Obrnite se na svojo tehnično službo." "Obrnite se na svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:10 #: MSIBuild/En.Win32.Debug.Error-2.idtx:10
#: MSIBuild/En.Win32.Release.Error-2.idtx:10
#: MSIBuild/En.x64.Debug.Error-2.idtx:10 #: MSIBuild/En.x64.Debug.Error-2.idtx:10
#: MSIBuild/En.x64.Release.Error-2.idtx:10
msgid "" msgid ""
"Error [4] moving \"[2]\" file to \"[3]\". Please, contact your support " "Error [4] moving \"[2]\" file to \"[3]\". Please, contact your support "
"personnel." "personnel."
@ -148,9 +147,7 @@ msgstr ""
"Pri premikanju datoteke »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na " "Pri premikanju datoteke »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na "
"svojo tehnično službo." "svojo tehnično službo."
#: MSIBuild/En.Win32.Debug.Error-2.idtx:4 #: MSIBuild/En.Win32.Debug.Error-2.idtx:4 MSIBuild/En.x64.Debug.Error-2.idtx:4
#: MSIBuild/En.Win32.Release.Error-2.idtx:4
#: MSIBuild/En.x64.Debug.Error-2.idtx:4 MSIBuild/En.x64.Release.Error-2.idtx:4
msgid "" msgid ""
"Error opening installation package. Please, contact your support personnel." "Error opening installation package. Please, contact your support personnel."
msgstr "" msgstr ""

View File

@ -29,27 +29,35 @@ HRESULT COpSvcSetStart::Execute(CSession *pSession)
// Open the specified service. // Open the specified service.
hService = ::OpenServiceW(hSCM, m_sValue, SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG); hService = ::OpenServiceW(hSCM, m_sValue, SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG);
if (hService) { if (hService) {
QUERY_SERVICE_CONFIG sc; QUERY_SERVICE_CONFIG *sc;
DWORD dwSize; DWORD dwSize;
HANDLE hHeap = ::GetProcessHeap();
// Query current service config. ::QueryServiceConfig(hService, NULL, 0, &dwSize);
if (::QueryServiceConfig(hService, &sc, sizeof(sc), &dwSize)) { sc = (QUERY_SERVICE_CONFIG*)::HeapAlloc(hHeap, 0, dwSize);
if (sc.dwStartType != m_dwStartType) { if (sc) {
// Set requested service start. // Query current service config.
if (::ChangeServiceConfig(hService, SERVICE_NO_CHANGE, m_dwStartType, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { if (::QueryServiceConfig(hService, sc, dwSize, &dwSize)) {
if (pSession->m_bRollbackEnabled) { if (sc->dwStartType != m_dwStartType) {
// Order rollback action to revert the service start change. // Set requested service start.
pSession->m_olRollback.AddHead(new COpSvcSetStart(m_sValue, sc.dwStartType)); if (::ChangeServiceConfig(hService, SERVICE_NO_CHANGE, m_dwStartType, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) {
} if (pSession->m_bRollbackEnabled) {
// Order rollback action to revert the service start change.
pSession->m_olRollback.AddHead(new COpSvcSetStart(m_sValue, sc->dwStartType));
}
dwError = NO_ERROR;
} else
dwError = ::GetLastError();
} else {
// Service is already configured to start the requested way.
dwError = NO_ERROR; dwError = NO_ERROR;
} else }
dwError = ::GetLastError(); } else
} else { dwError = ::GetLastError();
// Service is already configured to start the requested way.
dwError = NO_ERROR; ::HeapFree(hHeap, 0, sc);
}
} else } else
dwError = ::GetLastError(); dwError = ERROR_OUTOFMEMORY;
} else } else
dwError = ::GetLastError(); dwError = ::GetLastError();
} else } else