Akcije za nameščanje certifiktov, razporejenih opravil, profilov WLAN in nastavljanje sistemskih servisov sem razbil v več faz, da se zdaj določena opravila izvedejo v bolj primernih trenutkih namestitve/odstranitve. Pripravo seznama opravil pa sem združil v centralni akciji MSICAInitialize().

This commit is contained in:
Simon Rozman 2014-03-24 13:11:47 +00:00
parent 2d0a99755f
commit 480b9c53e8
4 changed files with 202 additions and 252 deletions

View File

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: MSICA\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-22 13:34+0100\n"
"POT-Creation-Date: 2014-03-24 13:54+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n"
@ -70,80 +70,116 @@ msgstr "MSICA"
msgid "SUBLANG_DEFAULT"
msgstr "SUBLANG_DEFAULT"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:4
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:4
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:4
#: MSIBuild/En.x64.Release.ActionText-2.idtx:4
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:7
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:8
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:7
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:8
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:7
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:8
#: MSIBuild/En.x64.Release.ActionText-2.idtx:7
#: MSIBuild/En.x64.Release.ActionText-2.idtx:8
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
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:10
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:10
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:10
#: MSIBuild/En.x64.Release.ActionText-2.idtx:10
msgid "Configuring services"
msgstr "Nastavljanje servisov"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:7
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:7
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:7
#: MSIBuild/En.x64.Release.ActionText-2.idtx:7
msgid "Evaluating WLAN profiles"
msgstr "Pregled profilov WLAN"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:4
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:4
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:4
#: MSIBuild/En.x64.Release.ActionText-2.idtx:4
msgid "Installing certificates"
msgstr "Nameščanje digitalnih potrdil"
#: 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:8
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:8
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:8
#: MSIBuild/En.x64.Release.ActionText-2.idtx:8
msgid "Removing WLAN profiles"
msgstr "Odstranjevanje profilov WLAN"
msgid "Installing certificates"
msgstr "Nameščanje digitalnih potrdil"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:12
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:12
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:12
#: MSIBuild/En.x64.Release.ActionText-2.idtx:12
msgid "Installing scheduled tasks"
msgstr "Nameščanje razporejenih opravil"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:9
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:9
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:9
#: MSIBuild/En.x64.Release.ActionText-2.idtx:9
msgid "Installing WLAN profiles"
msgstr "Nameščanje profilov WLAN"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:7
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:7
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:7
#: MSIBuild/En.x64.Release.ActionText-2.idtx:7
msgid "Removing certificates"
msgstr "Odstranjevanje digitalnih potrdil"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:4
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:4
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:4
#: MSIBuild/En.x64.Release.ActionText-2.idtx:4
msgid "Removing scheduled tasks"
msgstr "Odstranjevanje 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 "Removing WLAN profiles"
msgstr "Odstranjevanje profilov WLAN"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:12
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:4
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:12
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:4
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:12
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:4
#: MSIBuild/En.x64.Release.ActionText-2.idtx:12
#: MSIBuild/En.x64.Release.ActionText-2.idtx:4
msgid "Scheduled task: [1]"
msgstr "Razporejeno opravilo: [1]"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:10
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:11
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:5
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:10
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:11
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:5
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:10
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:11
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:5
#: MSIBuild/En.x64.Release.ActionText-2.idtx:10
#: MSIBuild/En.x64.Release.ActionText-2.idtx:11
#: MSIBuild/En.x64.Release.ActionText-2.idtx:5
msgid "Service: [1]"
msgstr "Servis: [1]"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:9
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:9
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:9
#: MSIBuild/En.x64.Release.ActionText-2.idtx:9
msgid "Setting WLAN profiles"
msgstr "Nastavljanje profilov WLAN"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:11
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:11
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:11
#: MSIBuild/En.x64.Release.ActionText-2.idtx:11
msgid "Starting services"
msgstr "Zagon servisov"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:7
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:8
#: 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 "Stopping services"
msgstr "Zaustavitev servisov"
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:6
#: MSIBuild/En.Win32.Debug.ActionText-2.idtx:9
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:7
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:8
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:6
#: MSIBuild/En.Win32.Release.ActionText-2.idtx:9
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:7
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:8
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:6
#: MSIBuild/En.x64.Debug.ActionText-2.idtx:9
#: MSIBuild/En.x64.Release.ActionText-2.idtx:7
#: MSIBuild/En.x64.Release.ActionText-2.idtx:8
#: MSIBuild/En.x64.Release.ActionText-2.idtx:6
#: MSIBuild/En.x64.Release.ActionText-2.idtx:9
msgid "WLAN profile: [1]"
msgstr "Profil WLAN: [1]"
#~ msgid "Evaluating WLAN profiles"
#~ msgstr "Pregled profilov WLAN"

View File

@ -78,12 +78,15 @@ All :: "$(LANG).$(PLAT).$(CFG).ActionText-2.idt"
Action Description Template
s$(MSIBUILD_LENGTH_ID) L0 L0
1252 ActionText Action
CertificatesExec Installing certificates Certificate: [1]
ServiceConfigExec Configuring services Service: [1]
ScheduledTasksExec Registering scheduled tasks Scheduled task: [1]
EvaluateWLANProfiles Evaluating WLAN profiles WLAN profile: [1]
RemoveScheduledTasksExec Removing scheduled tasks Scheduled task: [1]
StopServicesExec Stopping services Service: [1]
RemoveWLANProfilesExec Removing WLAN profiles WLAN profile: [1]
SetWLANProfilesExec Setting WLAN profiles WLAN profile: [1]
RemoveCertificatesExec Removing certificates Certificate: [1]
InstallCertificatesExec Installing certificates Certificate: [1]
InstallWLANProfilesExec Installing WLAN profiles WLAN profile: [1]
SetServiceStartExec Configuring services Service: [1]
StartServicesExec Starting services Service: [1]
InstallScheduledTasksExec Installing scheduled tasks Scheduled task: [1]
<<NOKEEP
"De.$(PLAT).$(CFG).ActionText-2.idt" : "En.$(PLAT).$(CFG).ActionText-2.idtx" "..\L10N\de_DE.po"
@ -144,25 +147,34 @@ All :: "$(LANG).$(PLAT).$(CFG).CustomAction-1.idt"
Action Type Source Target
s$(MSIBUILD_LENGTH_ID) i2 S$(MSIBUILD_LENGTH_ID) S255
CustomAction Action
CertificatesEval 1 binMSICA.dll CertificatesEval
CertificatesExec 3073 binMSICA.dll ExecuteSequence
CertificatesRollback 3329 binMSICA.dll ExecuteSequence
CertificatesCommit 3585 binMSICA.dll ExecuteSequence
ServiceConfigEval 1 binMSICA.dll ServiceConfigEval
ServiceConfigExec 3073 binMSICA.dll ExecuteSequence
ServiceConfigRollback 3329 binMSICA.dll ExecuteSequence
ServiceConfigCommit 3585 binMSICA.dll ExecuteSequence
ScheduledTasksEval 1 binMSICA.dll ScheduledTasksEval
ScheduledTasksExec 3073 binMSICA.dll ExecuteSequence
ScheduledTasksRollback 3329 binMSICA.dll ExecuteSequence
ScheduledTasksCommit 3585 binMSICA.dll ExecuteSequence
EvaluateWLANProfiles 1 binMSICA.dll EvaluateWLANProfiles
RemoveWLANProfilesExec 3073 binMSICA.dll ExecuteSequence
MSICAInitialize 1 binMSICA.dll MSICAInitialize
RemoveScheduledTasksRollback 3329 binMSICA.dll ExecuteSequence
RemoveScheduledTasksExec 3073 binMSICA.dll ExecuteSequence
RemoveScheduledTasksCommit 3585 binMSICA.dll ExecuteSequence
StopServicesRollback 3329 binMSICA.dll ExecuteSequence
StopServicesExec 3073 binMSICA.dll ExecuteSequence
StopServicesCommit 3585 binMSICA.dll ExecuteSequence
RemoveWLANProfilesRollback 3329 binMSICA.dll ExecuteSequence
RemoveWLANProfilesExec 3073 binMSICA.dll ExecuteSequence
RemoveWLANProfilesCommit 3585 binMSICA.dll ExecuteSequence
SetWLANProfilesExec 3073 binMSICA.dll ExecuteSequence
SetWLANProfilesRollback 3329 binMSICA.dll ExecuteSequence
SetWLANProfilesCommit 3585 binMSICA.dll ExecuteSequence
RemoveCertificatesRollback 3329 binMSICA.dll ExecuteSequence
RemoveCertificatesExec 3073 binMSICA.dll ExecuteSequence
RemoveCertificatesCommit 3585 binMSICA.dll ExecuteSequence
InstallCertificatesRollback 3329 binMSICA.dll ExecuteSequence
InstallCertificatesExec 3073 binMSICA.dll ExecuteSequence
InstallCertificatesCommit 3585 binMSICA.dll ExecuteSequence
InstallWLANProfilesRollback 3329 binMSICA.dll ExecuteSequence
InstallWLANProfilesExec 3073 binMSICA.dll ExecuteSequence
InstallWLANProfilesCommit 3585 binMSICA.dll ExecuteSequence
SetServiceStartRollback 3329 binMSICA.dll ExecuteSequence
SetServiceStartExec 3073 binMSICA.dll ExecuteSequence
SetServiceStartCommit 3585 binMSICA.dll ExecuteSequence
StartServicesRollback 3329 binMSICA.dll ExecuteSequence
StartServicesExec 3073 binMSICA.dll ExecuteSequence
StartServicesCommit 3585 binMSICA.dll ExecuteSequence
InstallScheduledTasksRollback 3329 binMSICA.dll ExecuteSequence
InstallScheduledTasksExec 3073 binMSICA.dll ExecuteSequence
InstallScheduledTasksCommit 3585 binMSICA.dll ExecuteSequence
<<NOKEEP
@ -177,25 +189,34 @@ All :: "$(LANG).$(PLAT).$(CFG).InstallExecuteSequence-1.idt"
Action Condition Sequence
s$(MSIBUILD_LENGTH_ID) S255 I2
InstallExecuteSequence Action
EvaluateWLANProfiles 1650
RemoveWLANProfilesRollback 1850
RemoveWLANProfilesExec 1851
RemoveWLANProfilesCommit 1852
SetWLANProfilesRollback 6150
SetWLANProfilesExec 6151
SetWLANProfilesCommit 6152
CertificatesEval 6576
CertificatesRollback 6577
CertificatesExec 6578
CertificatesCommit 6579
ScheduledTasksEval 6580
ScheduledTasksRollback 6581
ScheduledTasksExec 6582
ScheduledTasksCommit 6583
ServiceConfigEval 6584
ServiceConfigRollback 6585
ServiceConfigExec 6586
ServiceConfigCommit 6587
MSICAInitialize 1510
RemoveScheduledTasksRollback 1850
RemoveScheduledTasksExec 1851
RemoveScheduledTasksCommit 1852
StopServicesRollback 1853
StopServicesExec 1854
StopServicesCommit 1855
RemoveWLANProfilesRollback 1856
RemoveWLANProfilesExec 1857
RemoveWLANProfilesCommit 1858
RemoveCertificatesRollback 1859
RemoveCertificatesExec 1860
RemoveCertificatesCommit 1861
InstallCertificatesRollback 6150
InstallCertificatesExec 6151
InstallCertificatesCommit 6152
InstallWLANProfilesRollback 6153
InstallWLANProfilesExec 6154
InstallWLANProfilesCommit 6155
SetServiceStartRollback 6156
SetServiceStartExec 6157
SetServiceStartCommit 6158
StartServicesRollback 6159
StartServicesExec 6160
StartServicesCommit 6161
InstallScheduledTasksRollback 6162
InstallScheduledTasksExec 6163
InstallScheduledTasksCommit 6164
<<NOKEEP

View File

@ -32,13 +32,17 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
// Exported functions
////////////////////////////////////////////////////////////////////
UINT MSICA_API CertificatesEval(MSIHANDLE hInstall)
UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
{
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
MSICA::COpList olExecute;
MSICA::COpList
olInstallCertificates, olRemoveCertificates,
olInstallWLANProfiles, olRemoveWLANProfiles,
olInstallScheduledTask, olRemoveScheduledTask,
olStopServices, olSetServiceStarts, olStartServices;
BOOL bRollbackEnabled;
PMSIHANDLE
hDatabase,
@ -50,13 +54,23 @@ UINT MSICA_API CertificatesEval(MSIHANDLE hInstall)
bRollbackEnabled = uiResult == NO_ERROR ?
_ttoi(sValue) || !sValue.IsEmpty() && _totlower(sValue.GetAt(0)) == _T('y') ? FALSE : TRUE :
TRUE;
olExecute.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olRemoveScheduledTask.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olStopServices.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olRemoveWLANProfiles.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olRemoveCertificates.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olInstallCertificates.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olInstallWLANProfiles.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olSetServiceStarts.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olStartServices.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olInstallScheduledTask.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
// Open MSI database.
hDatabase = ::MsiGetActiveDatabase(hInstall);
if (hDatabase) {
MSICONDITION condition;
// Check if Certificate table exists. If it doesn't exist, there's nothing to do.
MSICONDITION condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("Certificate"));
condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("Certificate"));
if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) {
PMSIHANDLE hViewCert;
@ -140,10 +154,10 @@ UINT MSICA_API CertificatesEval(MSIHANDLE hInstall)
if (iAction >= INSTALLSTATE_LOCAL) {
// Component is or should be installed. Install the certificate.
olExecute.AddTail(new MSICA::COpCertInstall(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICA_CERT_TICK_SIZE));
olInstallCertificates.AddTail(new MSICA::COpCertInstall(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICA_CERT_TICK_SIZE));
} else if (iAction >= INSTALLSTATE_REMOVED) {
// Component is installed, but should be degraded to advertised/removed. Delete the certificate.
olExecute.AddTail(new MSICA::COpCertRemove(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICA_CERT_TICK_SIZE));
olRemoveCertificates.AddTail(new MSICA::COpCertRemove(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICA_CERT_TICK_SIZE));
}
// The amount of tick space to add for each certificate to progress indicator.
@ -152,15 +166,6 @@ UINT MSICA_API CertificatesEval(MSIHANDLE hInstall)
if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; }
}
::MsiViewClose(hViewCert);
if (uiResult == NO_ERROR) {
// Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("CertificatesExec"), _T("CertificatesCommit"), _T("CertificatesRollback"), 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);
@ -170,43 +175,9 @@ UINT MSICA_API CertificatesEval(MSIHANDLE hInstall)
::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 ServiceConfigEval(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"));
condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("ServiceConfigure"));
if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) {
PMSIHANDLE hViewSC;
@ -252,7 +223,7 @@ UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall)
}
if (iValue >= 0) {
// Set service start type.
olExecute.AddTail(new MSICA::COpSvcSetStart(sValue, iValue, MSICA_SVC_SET_START_TICK_SIZE));
olSetServiceStarts.AddTail(new MSICA::COpSvcSetStart(sValue, iValue, MSICA_SVC_SET_START_TICK_SIZE));
// The amount of tick space to add to progress indicator.
::MsiRecordSetInteger(hRecordProg, 1, 3 );
@ -268,7 +239,7 @@ UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall)
}
if ((iValue & 4) != 0) {
// Stop service.
olExecute.AddTail(new MSICA::COpSvcStop(sValue, (iValue & 1) ? TRUE : FALSE, MSICA_SVC_STOP_TICK_SIZE));
olStopServices.AddTail(new MSICA::COpSvcStop(sValue, (iValue & 1) ? TRUE : FALSE, MSICA_SVC_STOP_TICK_SIZE));
// The amount of tick space to add to progress indicator.
::MsiRecordSetInteger(hRecordProg, 1, 3 );
@ -276,7 +247,7 @@ UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall)
if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; }
} else if ((iValue & 2) != 0) {
// Start service.
olExecute.AddTail(new MSICA::COpSvcStart(sValue, (iValue & 1) ? TRUE : FALSE, MSICA_SVC_START_TICK_SIZE));
olStartServices.AddTail(new MSICA::COpSvcStart(sValue, (iValue & 1) ? TRUE : FALSE, MSICA_SVC_START_TICK_SIZE));
// The amount of tick space to add to progress indicator.
::MsiRecordSetInteger(hRecordProg, 1, 3 );
@ -285,15 +256,6 @@ UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall)
}
}
::MsiViewClose(hViewSC);
if (uiResult == NO_ERROR) {
// Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("ServiceConfigExec"), _T("ServiceConfigCommit"), _T("ServiceConfigRollback"), 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);
@ -303,43 +265,9 @@ UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall)
::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 ScheduledTasksEval(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 ScheduledTask table exists. If it doesn't exist, there's nothing to do.
MSICONDITION condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("ScheduledTask"));
condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("ScheduledTask"));
if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) {
PMSIHANDLE hViewST;
@ -409,10 +337,10 @@ UINT MSICA_API ScheduledTasksEval(MSIHANDLE hInstall)
} else
break;
olExecute.AddTail(opCreateTask);
olInstallScheduledTask.AddTail(opCreateTask);
} else if (iAction >= INSTALLSTATE_REMOVED) {
// Component is installed, but should be degraded to advertised/removed. Delete the task.
olExecute.AddTail(new MSICA::COpTaskDelete(sDisplayName, MSICA_TASK_TICK_SIZE));
olRemoveScheduledTask.AddTail(new MSICA::COpTaskDelete(sDisplayName, MSICA_TASK_TICK_SIZE));
}
// The amount of tick space to add for each task to progress indicator.
@ -421,15 +349,6 @@ UINT MSICA_API ScheduledTasksEval(MSIHANDLE hInstall)
if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; }
}
::MsiViewClose(hViewST);
if (uiResult == NO_ERROR) {
// Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("ScheduledTasksExec"), _T("ScheduledTasksCommit"), _T("ScheduledTasksRollback"), 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);
@ -439,44 +358,9 @@ UINT MSICA_API ScheduledTasksEval(MSIHANDLE hInstall)
::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 EvaluateWLANProfiles(MSIHANDLE hInstall)
{
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
MSICA::COpList olExecuteInstall, olExecuteRemove;
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;
olExecuteInstall.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
olExecuteRemove.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled));
// Open MSI database.
hDatabase = ::MsiGetActiveDatabase(hInstall);
if (hDatabase) {
// Check if WLANProfile table exists. If it doesn't exist, there's nothing to do.
MSICONDITION condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("WLANProfile"));
condition = ::MsiDatabaseIsTablePersistent(hDatabase, _T("WLANProfile"));
if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) {
PMSIHANDLE hViewProfile;
@ -573,7 +457,7 @@ UINT MSICA_API EvaluateWLANProfiles(MSIHANDLE hInstall)
for (i = 0; i < pInterfaceList->dwNumberOfItems; i++) {
// Check for not ready state in interface.
if (pInterfaceList->InterfaceInfo[i].isState != wlan_interface_state_not_ready) {
olExecuteInstall.AddTail(new MSICA::COpWLANProfileSet(pInterfaceList->InterfaceInfo[i].InterfaceGuid, 0, sName, sProfileXML, MSICA_WLAN_PROFILE_TICK_SIZE));
olInstallWLANProfiles.AddTail(new MSICA::COpWLANProfileSet(pInterfaceList->InterfaceInfo[i].InterfaceGuid, 0, sName, sProfileXML, MSICA_WLAN_PROFILE_TICK_SIZE));
iTick += MSICA_WLAN_PROFILE_TICK_SIZE;
}
}
@ -587,7 +471,7 @@ UINT MSICA_API EvaluateWLANProfiles(MSIHANDLE hInstall)
for (i = 0; i < pInterfaceList->dwNumberOfItems; i++) {
// Check for not ready state in interface.
if (pInterfaceList->InterfaceInfo[i].isState != wlan_interface_state_not_ready) {
olExecuteRemove.AddTail(new MSICA::COpWLANProfileDelete(pInterfaceList->InterfaceInfo[i].InterfaceGuid, sName, MSICA_WLAN_PROFILE_TICK_SIZE));
olRemoveWLANProfiles.AddTail(new MSICA::COpWLANProfileDelete(pInterfaceList->InterfaceInfo[i].InterfaceGuid, sName, MSICA_WLAN_PROFILE_TICK_SIZE));
iTick += MSICA_WLAN_PROFILE_TICK_SIZE;
}
}
@ -608,16 +492,6 @@ UINT MSICA_API EvaluateWLANProfiles(MSIHANDLE hInstall)
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
}
::MsiViewClose(hViewProfile);
if (uiResult == NO_ERROR) {
// Save the sequences.
uiResult = MSICA::SaveSequence(hInstall, _T("SetWLANProfilesExec"), _T("SetWLANProfilesCommit"), _T("SetWLANProfilesRollback"), olExecuteInstall);
uiResult = MSICA::SaveSequence(hInstall, _T("RemoveWLANProfilesExec"), _T("RemoveWLANProfilesCommit"), _T("RemoveWLANProfilesRollback"), olExecuteRemove);
} 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);
@ -627,14 +501,38 @@ UINT MSICA_API EvaluateWLANProfiles(MSIHANDLE hInstall)
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
}
}
// Save the sequences.
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("RemoveScheduledTasksExec"), _T("RemoveScheduledTasksCommit"), _T("RemoveScheduledTasksRollback"), olRemoveScheduledTask);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("StopServicesExec"), _T("StopServicesCommit"), _T("StopServicesRollback"), olStopServices);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("RemoveWLANProfilesExec"), _T("RemoveWLANProfilesCommit"), _T("RemoveWLANProfilesRollback"), olRemoveWLANProfiles);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("RemoveCertificatesExec"), _T("RemoveCertificatesCommit"), _T("RemoveCertificatesRollback"), olRemoveCertificates);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("InstallCertificatesExec"), _T("InstallCertificatesCommit"), _T("InstallCertificatesRollback"), olInstallCertificates);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("InstallWLANProfilesExec"), _T("InstallWLANProfilesCommit"), _T("InstallWLANProfilesRollback"), olInstallWLANProfiles);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("SetServiceStartExec"), _T("SetServiceStartCommit"), _T("SetServiceStartRollback"), olSetServiceStarts);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("StartServicesExec"), _T("StartServicesCommit"), _T("StartServicesRollback"), olStartServices);
if (uiResult == NO_ERROR) uiResult = MSICA::SaveSequence(hInstall, _T("InstallScheduledTasksExec"), _T("InstallScheduledTasksCommit"), _T("InstallScheduledTasksRollback"), olInstallScheduledTask);
if (uiResult != NO_ERROR && uiResult != ERROR_INSTALL_USEREXIT) {
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_OPLIST_CREATE);
::MsiRecordSetInteger(hRecordProg, 2, uiResult );
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
}
} else {
uiResult = ERROR_INSTALL_DATABASE_OPEN;
::MsiRecordSetInteger(hRecordProg, 1, uiResult);
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
}
olExecuteInstall.Free();
olExecuteRemove.Free();
olInstallScheduledTask.Free();
olStartServices.Free();
olSetServiceStarts.Free();
olInstallWLANProfiles.Free();
olInstallCertificates.Free();
olRemoveCertificates.Free();
olRemoveWLANProfiles.Free();
olStopServices.Free();
olRemoveScheduledTask.Free();
if (bIsCoInitialized) ::CoUninitialize();
return uiResult;
@ -643,7 +541,7 @@ UINT MSICA_API EvaluateWLANProfiles(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);
}

View File

@ -24,12 +24,7 @@
extern "C" {
#endif
UINT MSICA_API CertificatesEval(MSIHANDLE hInstall);
UINT MSICA_API ServiceConfigEval(MSIHANDLE hInstall);
UINT MSICA_API ScheduledTasksEval(MSIHANDLE hInstall);
UINT MSICA_API EvaluateWLANProfiles(MSIHANDLE hInstall);
UINT MSICA_API RemoveWLANProfiles(MSIHANDLE hInstall);
UINT MSICA_API SetWLANProfiles(MSIHANDLE hInstall);
UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall);
UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall);
#ifdef __cplusplus