Dodal sem podporo za nastavljanje zagona sistemskih servisov.
This commit is contained in:
parent
5aabd7a036
commit
db0e2ff3b3
@ -2,7 +2,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: MSICA\n"
|
"Project-Id-Version: MSICA\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"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"
|
||||||
@ -77,6 +77,13 @@ msgstr "SUBLANG_DEFAULT"
|
|||||||
msgid "Certificate: [1]"
|
msgid "Certificate: [1]"
|
||||||
msgstr "Digitalno potrdilo: [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.Debug.ActionText-2.idtx:4
|
||||||
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:4
|
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:4
|
||||||
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:4
|
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:4
|
||||||
@ -84,22 +91,23 @@ msgstr "Digitalno potrdilo: [1]"
|
|||||||
msgid "Installing certificates"
|
msgid "Installing certificates"
|
||||||
msgstr "Nameščanje digitalnih potrdil"
|
msgstr "Nameščanje digitalnih potrdil"
|
||||||
|
|
||||||
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:5
|
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:6
|
||||||
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:5
|
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:6
|
||||||
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:5
|
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:6
|
||||||
#: MSIBuild/En.x64.Release.ActionText-2.idtx:5
|
#: MSIBuild/En.x64.Release.ActionText-2.idtx:6
|
||||||
msgid "Registering scheduled tasks"
|
msgid "Registering scheduled tasks"
|
||||||
msgstr "Registracija razporejenih opravil"
|
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.Debug.ActionText-2.idtx:5
|
||||||
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:5
|
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:5
|
||||||
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:5
|
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:5
|
||||||
#: MSIBuild/En.x64.Release.ActionText-2.idtx:5
|
#: MSIBuild/En.x64.Release.ActionText-2.idtx:5
|
||||||
msgid "Scheduled task: [1]"
|
msgid "Service: [1]"
|
||||||
msgstr "Razporejeno opravilo: [1]"
|
msgstr "Servis: [1]"
|
||||||
|
|
||||||
#~ msgid "Scheduled Task Installation Support Library"
|
|
||||||
#~ msgstr "Podporna knjižnica za nameščanje načrtovanih opravil"
|
|
||||||
|
|
||||||
#~ msgid "MSICACert"
|
|
||||||
#~ msgstr "MSICACert"
|
|
||||||
|
@ -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 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 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.
|
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 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 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).
|
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
|
s$(MSIBUILD_LENGTH_ID) L0 L0
|
||||||
1252 ActionText Action
|
1252 ActionText Action
|
||||||
InstallCertificates Installing certificates Certificate: [1]
|
InstallCertificates Installing certificates Certificate: [1]
|
||||||
|
ConfigureServices Configuring services Service: [1]
|
||||||
InstallScheduledTasks Registering scheduled tasks Scheduled task: [1]
|
InstallScheduledTasks Registering scheduled tasks Scheduled task: [1]
|
||||||
<<NOKEEP
|
<<NOKEEP
|
||||||
|
|
||||||
@ -129,10 +135,14 @@ 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 binMSICACert.dll EvaluateCertificates
|
EvaluateCertificates 1 binMSICA.dll EvaluateCertificates
|
||||||
InstallCertificates 3073 binMSICACert.dll ExecuteSequence
|
InstallCertificates 3073 binMSICA.dll ExecuteSequence
|
||||||
RollbackCertificates 3329 binMSICACert.dll ExecuteSequence
|
RollbackCertificates 3329 binMSICA.dll ExecuteSequence
|
||||||
CommitCertificates 3585 binMSICACert.dll ExecuteSequence
|
CommitCertificates 3585 binMSICA.dll ExecuteSequence
|
||||||
|
EvaluateServiceConfiguration 1 binMSICA.dll EvaluateServiceConfiguration
|
||||||
|
ConfigureServices 3073 binMSICA.dll ExecuteSequence
|
||||||
|
RollbackServiceConfiguration 3329 binMSICA.dll ExecuteSequence
|
||||||
|
CommitServiceConfiguration 3585 binMSICA.dll ExecuteSequence
|
||||||
EvaluateScheduledTasks 1 binMSICA.dll EvaluateScheduledTasks
|
EvaluateScheduledTasks 1 binMSICA.dll EvaluateScheduledTasks
|
||||||
InstallScheduledTasks 3073 binMSICA.dll ExecuteSequence
|
InstallScheduledTasks 3073 binMSICA.dll ExecuteSequence
|
||||||
RollbackScheduledTasks 3329 binMSICA.dll ExecuteSequence
|
RollbackScheduledTasks 3329 binMSICA.dll ExecuteSequence
|
||||||
@ -159,6 +169,10 @@ EvaluateScheduledTasks 6580
|
|||||||
RollbackScheduledTasks 6581
|
RollbackScheduledTasks 6581
|
||||||
InstallScheduledTasks 6582
|
InstallScheduledTasks 6582
|
||||||
CommitScheduledTasks 6583
|
CommitScheduledTasks 6583
|
||||||
|
EvaluateServiceConfiguration 6584
|
||||||
|
RollbackServiceConfiguration 6585
|
||||||
|
ConfigureServices 6586
|
||||||
|
CommitServiceConfiguration 6587
|
||||||
<<NOKEEP
|
<<NOKEEP
|
||||||
|
|
||||||
|
|
||||||
@ -176,6 +190,20 @@ ScheduledTask Task
|
|||||||
<<NOKEEP
|
<<NOKEEP
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# ServiceConfigure
|
||||||
|
|
||||||
|
All :: "$(LANG).$(PLAT).$(CFG).ServiceConfigure-1.idt"
|
||||||
|
|
||||||
|
"$(LANG).$(PLAT).$(CFG).ServiceConfigure-1.idt" : "Makefile" "..\..\..\include\MSIBuildCfg.mak"
|
||||||
|
-if exist $@ del /f /q $@
|
||||||
|
move /y << $@ > NUL
|
||||||
|
ServiceConfigure Name StartType Condition Sequence
|
||||||
|
s$(MSIBUILD_LENGTH_ID) l255 i4 S255 I2
|
||||||
|
ServiceConfigure ServiceConfigure
|
||||||
|
<<NOKEEP
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# TaskTrigger
|
# TaskTrigger
|
||||||
|
|
||||||
|
120
MSICA/MSICA.cpp
120
MSICA/MSICA.cpp
@ -5,8 +5,9 @@
|
|||||||
// Local constants
|
// Local constants
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define MSICA_CERT_TICK_SIZE (4*1024)
|
#define MSICA_CERT_TICK_SIZE (4*1024)
|
||||||
#define MSICA_TASK_TICK_SIZE (16*1024)
|
#define MSICA_SVC_SET_START_TICK_SIZE (1*1024)
|
||||||
|
#define MSICA_TASK_TICK_SIZE (16*1024)
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -28,7 +29,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
|
|||||||
|
|
||||||
UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall)
|
UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall)
|
||||||
{
|
{
|
||||||
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICACert"), MB_OK);
|
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
|
||||||
|
|
||||||
UINT uiResult;
|
UINT uiResult;
|
||||||
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
||||||
@ -177,8 +178,119 @@ UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall)
|
||||||
|
{
|
||||||
|
::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
|
||||||
|
|
||||||
|
UINT uiResult;
|
||||||
|
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
||||||
|
MSICA::COpList olExecute;
|
||||||
|
BOOL bRollbackEnabled;
|
||||||
|
PMSIHANDLE
|
||||||
|
hDatabase,
|
||||||
|
hRecordProg = ::MsiCreateRecord(3);
|
||||||
|
ATL::CAtlString sValue;
|
||||||
|
|
||||||
|
// Check and add the rollback enabled state.
|
||||||
|
uiResult = ::MsiGetProperty(hInstall, _T("RollbackDisabled"), sValue);
|
||||||
|
bRollbackEnabled = uiResult == NO_ERROR ?
|
||||||
|
_ttoi(sValue) || !sValue.IsEmpty() && _totlower(sValue.GetAt(0)) == _T('y') ? FALSE : TRUE :
|
||||||
|
TRUE;
|
||||||
|
olExecute.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
|
||||||
|
|
||||||
|
// Open MSI database.
|
||||||
|
hDatabase = ::MsiGetActiveDatabase(hInstall);
|
||||||
|
if (hDatabase) {
|
||||||
|
// Check if ServiceConfigure table exists. If it doesn't exist, there's nothing to do.
|
||||||
|
MSICONDITION condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("ServiceConfigure"));
|
||||||
|
if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) {
|
||||||
|
PMSIHANDLE hViewSC;
|
||||||
|
|
||||||
|
// Prepare a query to get a list/view of service configurations.
|
||||||
|
uiResult = ::MsiDatabaseOpenView(hDatabase, _T("SELECT Name,StartType,Condition FROM ServiceConfigure ORDER BY Sequence"), &hViewSC);
|
||||||
|
if (uiResult == NO_ERROR) {
|
||||||
|
// Execute query!
|
||||||
|
uiResult = ::MsiViewExecute(hViewSC, NULL);
|
||||||
|
if (uiResult == NO_ERROR) {
|
||||||
|
int iStartType;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
PMSIHANDLE hRecord;
|
||||||
|
|
||||||
|
// Fetch one record from the view.
|
||||||
|
uiResult = ::MsiViewFetch(hViewSC, &hRecord);
|
||||||
|
if (uiResult == ERROR_NO_MORE_ITEMS) {
|
||||||
|
uiResult = NO_ERROR;
|
||||||
|
break;
|
||||||
|
} else if (uiResult != NO_ERROR)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Read and evaluate service configuration condition.
|
||||||
|
uiResult = ::MsiRecordGetString(hRecord, 3, sValue);
|
||||||
|
if (uiResult != NO_ERROR) break;
|
||||||
|
condition = ::MsiEvaluateCondition(hInstall, sValue);
|
||||||
|
if (condition == MSICONDITION_FALSE)
|
||||||
|
continue;
|
||||||
|
else if (condition == MSICONDITION_ERROR) {
|
||||||
|
uiResult = ERROR_INVALID_FIELD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read service name.
|
||||||
|
uiResult = ::MsiRecordGetString(hRecord, 1, sValue);
|
||||||
|
if (uiResult != NO_ERROR) break;
|
||||||
|
|
||||||
|
// Read service start type.
|
||||||
|
iStartType = ::MsiRecordGetInteger(hRecord, 2);
|
||||||
|
if (iStartType == MSI_NULL_INTEGER) {
|
||||||
|
uiResult = ERROR_INVALID_FIELD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (iStartType >= 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)
|
UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||||
{
|
{
|
||||||
|
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
|
||||||
|
|
||||||
UINT uiResult;
|
UINT uiResult;
|
||||||
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
||||||
MSICA::COpList olExecute;
|
MSICA::COpList olExecute;
|
||||||
@ -313,5 +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);
|
||||||
|
|
||||||
return MSICA::ExecuteSequence(hInstall);
|
return MSICA::ExecuteSequence(hInstall);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall);
|
UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall);
|
||||||
|
UINT MSICA_API EvaluateServiceConfiguration(MSIHANDLE hInstall);
|
||||||
UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall);
|
UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall);
|
||||||
UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall);
|
UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user