From 5aabd7a036a6abec0de33babcad11c23b3ee5e03 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 20 Mar 2014 12:45:03 +0000 Subject: [PATCH] =?UTF-8?q?Projekta=20MSICATS=20in=20MSICACert=20sem=20zdr?= =?UTF-8?q?u=C5=BEil=20v=20MSICA,=20ker=20sta=20tako=20ali=20tako=20vsebov?= =?UTF-8?q?ala=20kodo=20drug=20od=20drugega=20(95=C2=A0%=20kode=20je=20bil?= =?UTF-8?q?o=20iz=20skupne=20knji=C5=BEnice=20MSICALib.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 36 ++-- .gitignore | 36 ++-- MSICA.sln | 12 +- {MSICATS => MSICA}/L10N/sl_SI.po | 58 +++--- {MSICATS => MSICA}/MSIBuild/Makefile | 44 ++++- {MSICACert => MSICA}/MSIBuild/build_all.bat | 0 {MSICACert => MSICA}/MSIBuild/clean_all.bat | 0 MSICACert/MSICACert.cpp => MSICA/MSICA.cpp | 149 ++++++++++++++- MSICATS/MSICATS.h => MSICA/MSICA.h | 21 ++- .../MSICATS.vcxproj => MSICA/MSICA.vcxproj | 8 +- .../MSICA.vcxproj.filters | 8 +- MSICA/res/MSICA.rc | Bin 0 -> 46 bytes .../res/MSICACert.rcx => MSICA/res/MSICA.rcx | Bin 5168 -> 5136 bytes {MSICACert => MSICA}/stdafx.cpp | 0 {MSICATS => MSICA}/stdafx.h | 4 +- MSICACert/L10N/sl_SI.po | 95 ---------- MSICACert/MSIBuild/Makefile | 128 ------------- MSICACert/MSICACert.h | 34 ---- MSICACert/MSICACert.vcxproj | 171 ------------------ MSICACert/MSICACert.vcxproj.filters | 48 ----- MSICACert/res/MSICACert.rc | Bin 54 -> 0 bytes MSICACert/stdafx.h | 37 ---- MSICATS/MSIBuild/build_all.bat | 9 - MSICATS/MSIBuild/clean_all.bat | 9 - MSICATS/MSICATS.cpp | 165 ----------------- MSICATS/res/MSICATS.rc | Bin 50 -> 0 bytes MSICATS/res/MSICATS.rcx | Bin 5170 -> 0 bytes MSICATS/stdafx.cpp | 1 - 28 files changed, 261 insertions(+), 812 deletions(-) rename {MSICATS => MSICA}/L10N/sl_SI.po (70%) rename {MSICATS => MSICA}/MSIBuild/Makefile (78%) rename {MSICACert => MSICA}/MSIBuild/build_all.bat (100%) rename {MSICACert => MSICA}/MSIBuild/clean_all.bat (100%) rename MSICACert/MSICACert.cpp => MSICA/MSICA.cpp (51%) rename MSICATS/MSICATS.h => MSICA/MSICA.h (50%) rename MSICATS/MSICATS.vcxproj => MSICA/MSICA.vcxproj (95%) rename MSICATS/MSICATS.vcxproj.filters => MSICA/MSICA.vcxproj.filters (86%) create mode 100644 MSICA/res/MSICA.rc rename MSICACert/res/MSICACert.rcx => MSICA/res/MSICA.rcx (96%) rename {MSICACert => MSICA}/stdafx.cpp (100%) rename {MSICATS => MSICA}/stdafx.h (87%) delete mode 100644 MSICACert/L10N/sl_SI.po delete mode 100644 MSICACert/MSIBuild/Makefile delete mode 100644 MSICACert/MSICACert.h delete mode 100644 MSICACert/MSICACert.vcxproj delete mode 100644 MSICACert/MSICACert.vcxproj.filters delete mode 100644 MSICACert/res/MSICACert.rc delete mode 100644 MSICACert/stdafx.h delete mode 100644 MSICATS/MSIBuild/build_all.bat delete mode 100644 MSICATS/MSIBuild/clean_all.bat delete mode 100644 MSICATS/MSICATS.cpp delete mode 100644 MSICATS/res/MSICATS.rc delete mode 100644 MSICATS/res/MSICATS.rcx delete mode 100644 MSICATS/stdafx.cpp diff --git a/.gitattributes b/.gitattributes index 83a31cd..ca03562 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,17 +1,17 @@ * text=auto !eol /MSICA.sln svneol=CRLF#text/plain eol=crlf -MSICACert/L10N/sl_SI.po -text -MSICACert/MSIBuild/Makefile -text -MSICACert/MSIBuild/build_all.bat -text -MSICACert/MSIBuild/clean_all.bat -text -MSICACert/MSICACert.cpp -text -MSICACert/MSICACert.h -text -MSICACert/MSICACert.vcxproj -text svneol=unset#text/xml -MSICACert/MSICACert.vcxproj.filters -text svneol=unset#text/xml -MSICACert/res/MSICACert.rc -text svneol=unset#unset -MSICACert/res/MSICACert.rcx -text svneol=unset#unset -MSICACert/stdafx.cpp -text -MSICACert/stdafx.h -text +MSICA/L10N/sl_SI.po -text +MSICA/MSIBuild/Makefile -text +MSICA/MSIBuild/build_all.bat -text +MSICA/MSIBuild/clean_all.bat -text +MSICA/MSICA.cpp -text +MSICA/MSICA.h -text +MSICA/MSICA.vcxproj -text svneol=unset#text/xml +MSICA/MSICA.vcxproj.filters -text svneol=unset#text/xml +MSICA/res/MSICA.rc -text svneol=unset#unset +MSICA/res/MSICA.rcx -text svneol=unset#unset +MSICA/stdafx.cpp -text +MSICA/stdafx.h -text MSICALib/L10N/sl_SI.po -text MSICALib/MSIBuild/Makefile -text MSICALib/MSIBuild/build_all.bat -text @@ -27,18 +27,6 @@ MSICALib/OpSvc.cpp -text MSICALib/OpTS.cpp -text MSICALib/stdafx.cpp -text MSICALib/stdafx.h -text -MSICATS/L10N/sl_SI.po -text -MSICATS/MSIBuild/Makefile -text -MSICATS/MSIBuild/build_all.bat -text -MSICATS/MSIBuild/clean_all.bat -text -MSICATS/MSICATS.cpp -text -MSICATS/MSICATS.h -text -MSICATS/MSICATS.vcxproj -text svneol=unset#text/xml -MSICATS/MSICATS.vcxproj.filters -text svneol=unset#text/xml -MSICATS/res/MSICATS.rc -text svneol=unset#unset -MSICATS/res/MSICATS.rcx -text svneol=unset#unset -MSICATS/stdafx.cpp -text -MSICATS/stdafx.h -text include/Debug.props -text svneol=unset#text/xml include/Release.props -text svneol=unset#text/xml include/Win32.props -text svneol=unset#text/xml diff --git a/.gitignore b/.gitignore index f5039cb..587a6e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,18 @@ /*.opensdf /*.sdf /*.suo -MSICACert/*.user -MSICACert/L10N/*.mo -MSICACert/MSIBuild/*-1.idt -MSICACert/MSIBuild/*-2.idt -MSICACert/MSIBuild/*-2.idtx -MSICACert/MSIBuild/*.Binary-1 -MSICACert/MSIBuild/*.Binary-2 -MSICACert/MSIBuild/*.Icon-1 -MSICACert/MSIBuild/*.Icon-2 -MSICACert/MSIBuild/*.lst -MSICACert/MSIBuild/*.msm -MSICACert/temp +MSICA/*.user +MSICA/L10N/*.mo +MSICA/MSIBuild/*-1.idt +MSICA/MSIBuild/*-2.idt +MSICA/MSIBuild/*-2.idtx +MSICA/MSIBuild/*.Binary-1 +MSICA/MSIBuild/*.Binary-2 +MSICA/MSIBuild/*.Icon-1 +MSICA/MSIBuild/*.Icon-2 +MSICA/MSIBuild/*.lst +MSICA/MSIBuild/*.msm +MSICA/temp MSICALib/*.user MSICALib/L10N/*.mo MSICALib/MSIBuild/*-1.idt @@ -25,17 +25,5 @@ MSICALib/MSIBuild/*.Icon-2 MSICALib/MSIBuild/*.lst MSICALib/MSIBuild/*.msm MSICALib/temp -MSICATS/*.user -MSICATS/L10N/*.mo -MSICATS/MSIBuild/*-1.idt -MSICATS/MSIBuild/*-2.idt -MSICATS/MSIBuild/*-2.idtx -MSICATS/MSIBuild/*.Binary-1 -MSICATS/MSIBuild/*.Binary-2 -MSICATS/MSIBuild/*.Icon-1 -MSICATS/MSIBuild/*.Icon-2 -MSICATS/MSIBuild/*.lst -MSICATS/MSIBuild/*.msm -MSICATS/temp /ipch /output diff --git a/MSICA.sln b/MSICA.sln index dde0f03..6e9f31c 100644 --- a/MSICA.sln +++ b/MSICA.sln @@ -3,15 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICALib", "MSICALib\MSICALib.vcxproj", "{8552EE55-177E-4F51-B51B-BAF7D6462CDE}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICATS", "MSICATS\MSICATS.vcxproj", "{A7D9EBC1-1E64-4399-9C88-6692F8742153}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICA", "MSICA\MSICA.vcxproj", "{A7D9EBC1-1E64-4399-9C88-6692F8742153}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F3D5C008-7728-49CA-84F1-12C186FC87F8}" ProjectSection(SolutionItems) = preProject include\version.h = include\version.h EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICACert", "MSICACert\MSICACert.vcxproj", "{0379563D-9835-44AC-928E-24D4E316CE5D}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -36,14 +34,6 @@ Global {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|Win32.Build.0 = Release|Win32 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|x64.ActiveCfg = Release|x64 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|x64.Build.0 = Release|x64 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Debug|Win32.ActiveCfg = Debug|Win32 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Debug|Win32.Build.0 = Debug|Win32 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Debug|x64.ActiveCfg = Debug|x64 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Debug|x64.Build.0 = Debug|x64 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Release|Win32.ActiveCfg = Release|Win32 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Release|Win32.Build.0 = Release|Win32 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Release|x64.ActiveCfg = Release|x64 - {0379563D-9835-44AC-928E-24D4E316CE5D}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MSICATS/L10N/sl_SI.po b/MSICA/L10N/sl_SI.po similarity index 70% rename from MSICATS/L10N/sl_SI.po rename to MSICA/L10N/sl_SI.po index b9f084e..9dd08be 100644 --- a/MSICATS/L10N/sl_SI.po +++ b/MSICA/L10N/sl_SI.po @@ -1,8 +1,8 @@ msgid "" msgstr "" -"Project-Id-Version: MSICATS\n" +"Project-Id-Version: MSICA\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-14 11:12+0100\n" +"POT-Creation-Date: 2014-03-20 13:36+0100\n" "PO-Revision-Date: \n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" @@ -20,19 +20,19 @@ msgstr "" # Language Code and Windows Charset (hexadecimal) # If we do not intend to provide different localization of same base language (like merging Portugal Portugeese and Brasil Portugese into the same Portugeese), use the code of Microsoft defined default sublanguage. # For example: Use LANG_PORTUGUESE + SUBLANG_DEFAULT = 0x416, although 0x416 represents Brasil Portugese (too). -#: res/MSICATS.rcx:42 +#: res/MSICA.rcx:42 msgid "040904e4" msgstr "042404e2" # Language Code (hexadecimal) # If we do not intend to provide different localization of same base language (like merging Portugal Portugeese and Brasil Portugese into the same Portugeese), use the code of Microsoft defined default sublanguage. # For example: Use LANG_PORTUGUESE + SUBLANG_DEFAULT = 0x416, although 0x416 represents Brasil Portugese (too). -#: res/MSICATS.rcx:60 +#: res/MSICA.rcx:60 msgid "0x409" msgstr "0x424" # Windows charset for this language (decimal) -#: res/MSICATS.rcx:60 MSIBuild/En.Win32.Debug.ActionText-2.idtx:3 +#: res/MSICA.rcx:60 MSIBuild/En.Win32.Debug.ActionText-2.idtx:3 #: MSIBuild/En.Win32.Release.ActionText-2.idtx:3 #: MSIBuild/En.x64.Debug.ActionText-2.idtx:3 #: MSIBuild/En.x64.Release.ActionText-2.idtx:3 @@ -40,37 +40,33 @@ msgid "1252" msgstr "1250" # The name of the constant in RC to include the resources in this language. -#: res/MSICATS.rcx:41 res/MSICATS.rcx:59 res/MSICATS.rcx:75 +#: res/MSICA.rcx:41 res/MSICA.rcx:59 res/MSICA.rcx:75 msgid "AFX_TARG_ENU" msgstr "AFX_TARG_SLV" -#: res/MSICATS.rcx:44 +#: res/MSICA.rcx:44 msgid "Amebis, d. o. o., Kamnik" msgstr "Amebis, d. o. o., Kamnik" -#: res/MSICATS.rcx:48 +#: res/MSICA.rcx:48 msgid "Copyright © Amebis, d. o. o., Kamnik, 2012" msgstr "Vse pravice pridržane © Amebis, d. o. o., Kamnik, 2012" +#: res/MSICA.rcx:45 +msgid "Installation Support Library" +msgstr "Podporna knjižnica za namestitve" + # Language Identifier (see http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx) -#: res/MSICATS.rcx:77 +#: res/MSICA.rcx:77 msgid "LANG_ENGLISH" msgstr "LANG_SLOVENIAN" -#: res/MSICATS.rcx:49 +#: res/MSICA.rcx:47 res/MSICA.rcx:49 msgid "MSICA" msgstr "MSICA" -#: res/MSICATS.rcx:47 -msgid "MSICATS" -msgstr "MSICATS" - -#: res/MSICATS.rcx:45 -msgid "Scheduled Task Installation Support Library" -msgstr "Podporna knjižnica za nameščanje načrtovanih opravil" - # Sublanguage Identifier (see http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx) -#: res/MSICATS.rcx:77 +#: res/MSICA.rcx:77 msgid "SUBLANG_DEFAULT" msgstr "SUBLANG_DEFAULT" @@ -78,12 +74,32 @@ msgstr "SUBLANG_DEFAULT" #: 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 "Registering scheduled tasks" -msgstr "Registracija razporejenih opravil" +msgid "Certificate: [1]" +msgstr "Digitalno potrdilo: [1]" #: 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: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 "Registering scheduled tasks" +msgstr "Registracija razporejenih opravil" + +#: 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" diff --git a/MSICATS/MSIBuild/Makefile b/MSICA/MSIBuild/Makefile similarity index 78% rename from MSICATS/MSIBuild/Makefile rename to MSICA/MSIBuild/Makefile index 1669f61..8394b54 100644 --- a/MSICATS/MSIBuild/Makefile +++ b/MSICA/MSIBuild/Makefile @@ -14,6 +14,13 @@ All :: "$(LANG).$(PLAT).$(CFG)._Validation-1.idt" Table Column Nullable MinValue MaxValue KeyTable KeyColumn Category Set Description s32 s32 s4 I4 I4 S255 I2 S32 S255 S255 _Validation Table Column +Certificate Certificate N Identifier Primary key, non-localized token. +Certificate Store N Formatted MY;Root;Trust;CA Certificate store name for CertOpenStore() function call. The store provider is always CERT_STORE_PROV_SYSTEM. Therefore, possible values are: MY, Root, Trust, or CA. +Certificate Flags N DoubleInteger Flags for CertOpenStore() function call. +Certificate Encoding N DoubleInteger 0;1;65536;65537 Certificate encoding (combination of X509_ASN_ENCODING(1) and PKCS_7_ASN_ENCODING(65536) flags). +Certificate Binary_ N Binary 1 Identifier The certificate file. The binary information is looked up from the Binary Table. +Certificate Condition Y Condition Optional expression which skips the certificate if evaluates to expFalse. If the expression syntax is invalid, the engine will terminate, returning iesBadActionData. +Certificate Component_ N Component 1 Identifier Component the certificate is part of. ScheduledTask Task N Identifier Primary key, non-localized token. ScheduledTask DisplayName N Formatted Task name. ScheduledTask Application N Formatted Task application name. @@ -60,6 +67,7 @@ All :: "$(LANG).$(PLAT).$(CFG).ActionText-2.idt" Action Description Template s$(MSIBUILD_LENGTH_ID) L0 L0 1252 ActionText Action +InstallCertificates Installing certificates Certificate: [1] InstallScheduledTasks Registering scheduled tasks Scheduled task: [1] < NUL +###################################################################### +# Certificate + +All :: "$(LANG).$(PLAT).$(CFG).Certificate-1.idt" + +"$(LANG).$(PLAT).$(CFG).Certificate-1.idt" : "Makefile" "..\..\..\include\MSIBuildCfg.mak" + -if exist $@ del /f /q $@ + move /y << $@ > NUL +Certificate Store Flags Encoding Binary_ Condition Component_ +s$(MSIBUILD_LENGTH_ID) s255 i4 i4 s$(MSIBUILD_LENGTH_ID) S255 s$(MSIBUILD_LENGTH_ID) +Certificate Certificate +<= INSTALLSTATE_LOCAL) { // Component is or should be installed. Install the certificate. - olExecute.AddTail(new MSICA::COpCertInstall(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICACERT_CERT_TICK_SIZE)); + olExecute.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, MSICACERT_CERT_TICK_SIZE)); + olExecute.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. - ::MsiRecordSetInteger(hRecordProg, 1, 3 ); - ::MsiRecordSetInteger(hRecordProg, 2, MSICACERT_CERT_TICK_SIZE); + ::MsiRecordSetInteger(hRecordProg, 1, 3 ); + ::MsiRecordSetInteger(hRecordProg, 2, MSICA_CERT_TICK_SIZE); if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; } } ::MsiViewClose(hViewCert); @@ -176,9 +177,141 @@ UINT MSICACERT_API EvaluateSequence(MSIHANDLE hInstall) } -UINT MSICACERT_API ExecuteSequence(MSIHANDLE hInstall) +UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall) { - //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICACert"), 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")); + if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) { + PMSIHANDLE hViewST; + + // Prepare a query to get a list/view of tasks. + uiResult = ::MsiDatabaseOpenView(hDatabase, _T("SELECT Task,DisplayName,Application,Parameters,Directory_,Flags,Priority,User,Password,Author,Description,IdleMin,IdleDeadline,MaxRuntime,Condition,Component_ FROM ScheduledTask"), &hViewST); + if (uiResult == NO_ERROR) { + // Execute query! + uiResult = ::MsiViewExecute(hViewST, NULL); + if (uiResult == NO_ERROR) { + //ATL::CAtlString sComponent; + ATL::CAtlStringW sDisplayName; + + for (;;) { + PMSIHANDLE hRecord; + INSTALLSTATE iInstalled, iAction; + + // Fetch one record from the view. + uiResult = ::MsiViewFetch(hViewST, &hRecord); + if (uiResult == ERROR_NO_MORE_ITEMS) { + uiResult = NO_ERROR; + break; + } else if (uiResult != NO_ERROR) + break; + + // Read and evaluate task's condition. + uiResult = ::MsiRecordGetString(hRecord, 15, 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 task's Component ID. + uiResult = ::MsiRecordGetString(hRecord, 16, sValue); + if (uiResult != NO_ERROR) break; + + // Get the component state. + uiResult = ::MsiGetComponentState(hInstall, sValue, &iInstalled, &iAction); + if (uiResult != NO_ERROR) break; + + // Get task's DisplayName. + uiResult = ::MsiRecordFormatStringW(hInstall, hRecord, 2, sDisplayName); + + if (iAction >= INSTALLSTATE_LOCAL) { + // Component is or should be installed. Create the task. + PMSIHANDLE hViewTT; + MSICA::COpTaskCreate *opCreateTask = new MSICA::COpTaskCreate(sDisplayName, MSICA_TASK_TICK_SIZE); + + // Populate the operation with task's data. + uiResult = opCreateTask->SetFromRecord(hInstall, hRecord); + if (uiResult != NO_ERROR) break; + + // Perform another query to get task's triggers. + uiResult = ::MsiDatabaseOpenView(hDatabase, _T("SELECT Trigger,BeginDate,EndDate,StartTime,StartTimeRand,MinutesDuration,MinutesInterval,Flags,Type,DaysInterval,WeeksInterval,DaysOfTheWeek,DaysOfMonth,WeekOfMonth,MonthsOfYear FROM TaskTrigger WHERE Task_=?"), &hViewTT); + if (uiResult != NO_ERROR) break; + + // Execute query! + uiResult = ::MsiViewExecute(hViewTT, hRecord); + if (uiResult == NO_ERROR) { + // Populate trigger list. + uiResult = opCreateTask->SetTriggersFromView(hViewTT); + ::MsiViewClose(hViewTT); + if (uiResult != NO_ERROR) break; + } else + break; + + olExecute.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)); + } + + // The amount of tick space to add for each task to progress indicator. + ::MsiRecordSetInteger(hRecordProg, 1, 3 ); + ::MsiRecordSetInteger(hRecordProg, 2, MSICA_TASK_TICK_SIZE); + 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("InstallScheduledTasks"), _T("CommitScheduledTasks"), _T("RollbackScheduledTasks"), 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 ExecuteSequence(MSIHANDLE hInstall) +{ return MSICA::ExecuteSequence(hInstall); } diff --git a/MSICATS/MSICATS.h b/MSICA/MSICA.h similarity index 50% rename from MSICATS/MSICATS.h rename to MSICA/MSICA.h index 4f3fb9a..1a96f92 100644 --- a/MSICATS/MSICATS.h +++ b/MSICA/MSICA.h @@ -1,5 +1,5 @@ -#ifndef __MSICATS_H__ -#define __MSICATS_H__ +#ifndef __MSICA_H__ +#define __MSICA_H__ #include @@ -8,12 +8,12 @@ // Calling declaration //////////////////////////////////////////////////////////////////// -#if defined(MSICATS_DLL) -#define MSICATS_API __declspec(dllexport) -#elif defined(MSICATS_DLLIMP) -#define MSICATS_API __declspec(dllimport) +#if defined(MSICA_DLL) +#define MSICA_API __declspec(dllexport) +#elif defined(MSICA_DLLIMP) +#define MSICA_API __declspec(dllimport) #else -#define MSICATS_API +#define MSICA_API #endif //////////////////////////////////////////////////////////////////// @@ -24,11 +24,12 @@ extern "C" { #endif - UINT MSICATS_API EvaluateSequence(MSIHANDLE hInstall); - UINT MSICATS_API ExecuteSequence(MSIHANDLE hInstall); + UINT MSICA_API EvaluateCertificates(MSIHANDLE hInstall); + UINT MSICA_API EvaluateScheduledTasks(MSIHANDLE hInstall); + UINT MSICA_API ExecuteSequence(MSIHANDLE hInstall); #ifdef __cplusplus } #endif -#endif // __MSICATS_H__ +#endif // __MSICA_H__ diff --git a/MSICATS/MSICATS.vcxproj b/MSICA/MSICA.vcxproj similarity index 95% rename from MSICATS/MSICATS.vcxproj rename to MSICA/MSICA.vcxproj index c323c1d..13b1bfd 100644 --- a/MSICATS/MSICATS.vcxproj +++ b/MSICA/MSICA.vcxproj @@ -138,7 +138,7 @@ - + Create Create @@ -147,14 +147,14 @@ - + - + - + diff --git a/MSICATS/MSICATS.vcxproj.filters b/MSICA/MSICA.vcxproj.filters similarity index 86% rename from MSICATS/MSICATS.vcxproj.filters rename to MSICA/MSICA.vcxproj.filters index 318df94..f30cae1 100644 --- a/MSICATS/MSICATS.vcxproj.filters +++ b/MSICA/MSICA.vcxproj.filters @@ -15,7 +15,7 @@ - + Source Files @@ -23,7 +23,7 @@ - + Header Files @@ -31,12 +31,12 @@ - + Resource Files - + Resource Files diff --git a/MSICA/res/MSICA.rc b/MSICA/res/MSICA.rc new file mode 100644 index 0000000000000000000000000000000000000000..b2f24d6e790181648f2048c3322d9b7fc4f49870 GIT binary patch literal 46 zcmezWPnjW;A&()MA%~%qA%!88L4iSu!IvSJ!IQz6!I43ap$I5v1Qg?C;9>v(`uqqY literal 0 HcmV?d00001 diff --git a/MSICACert/res/MSICACert.rcx b/MSICA/res/MSICA.rcx similarity index 96% rename from MSICACert/res/MSICACert.rcx rename to MSICA/res/MSICA.rcx index 57e0e43fc7938c4f081dc2d6061de4bbb4c8a12b..3ca07983b81c83e903efcc1959aaeb7b58b0039f 100644 GIT binary patch delta 21 dcmdm>F+pPk57%ZDE+NLrJv\n" -"Language-Team: Amebis, d. o. o., Kamnik \n" -"Language: sl\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: __\n" -"X-Poedit-Basepath: ..\n" -"X-Generator: Poedit 1.5.7\n" -"X-Poedit-SearchPath-0: MSIBuild\n" -"X-Poedit-SearchPath-1: res\n" - -# Language Code and Windows Charset (hexadecimal) -# If we do not intend to provide different localization of same base language (like merging Portugal Portugeese and Brasil Portugese into the same Portugeese), use the code of Microsoft defined default sublanguage. -# For example: Use LANG_PORTUGUESE + SUBLANG_DEFAULT = 0x416, although 0x416 represents Brasil Portugese (too). -#: res/MSICACert.rcx:42 -msgid "040904e4" -msgstr "042404e2" - -# Language Code (hexadecimal) -# If we do not intend to provide different localization of same base language (like merging Portugal Portugeese and Brasil Portugese into the same Portugeese), use the code of Microsoft defined default sublanguage. -# For example: Use LANG_PORTUGUESE + SUBLANG_DEFAULT = 0x416, although 0x416 represents Brasil Portugese (too). -#: res/MSICACert.rcx:60 -msgid "0x409" -msgstr "0x424" - -# Windows charset for this language (decimal) -#: res/MSICACert.rcx:60 MSIBuild/En.Win32.Debug.ActionText-2.idtx:3 -#: MSIBuild/En.Win32.Release.ActionText-2.idtx:3 -#: MSIBuild/En.x64.Debug.ActionText-2.idtx:3 -#: MSIBuild/En.x64.Release.ActionText-2.idtx:3 -msgid "1252" -msgstr "1250" - -# The name of the constant in RC to include the resources in this language. -#: res/MSICACert.rcx:41 res/MSICACert.rcx:59 res/MSICACert.rcx:75 -msgid "AFX_TARG_ENU" -msgstr "AFX_TARG_SLV" - -#: res/MSICACert.rcx:44 -msgid "Amebis, d. o. o., Kamnik" -msgstr "Amebis, d. o. o., Kamnik" - -#: res/MSICACert.rcx:45 -msgid "Certificate Installation Support Library" -msgstr "Podporna knjižnica za nameščanje certifikatov" - -#: res/MSICACert.rcx:48 -msgid "Copyright © Amebis, d. o. o., Kamnik, 2012" -msgstr "Vse pravice pridržane © Amebis, d. o. o., Kamnik, 2012" - -# Language Identifier (see http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx) -#: res/MSICACert.rcx:77 -msgid "LANG_ENGLISH" -msgstr "LANG_SLOVENIAN" - -#: res/MSICACert.rcx:49 -msgid "MSICA" -msgstr "MSICA" - -#: res/MSICACert.rcx:47 -msgid "MSICACert" -msgstr "MSICACert" - -# Sublanguage Identifier (see http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx) -#: res/MSICACert.rcx:77 -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 -msgid "Certificate: [1]" -msgstr "Digitalno potrdilo: [1]" - -#: 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" - -#~ msgid "Scheduled task: [1]" -#~ msgstr "Razporejeno opravilo: [1]" - -#~ msgid "Registering scheduled tasks" -#~ msgstr "Registracija razporejenih opravil" diff --git a/MSICACert/MSIBuild/Makefile b/MSICACert/MSIBuild/Makefile deleted file mode 100644 index fd6f7ad..0000000 --- a/MSICACert/MSIBuild/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -!INCLUDE "..\..\..\include\MSIBuildCfg.mak" - -MSIBUILD_IS_LOCALIZEABLE=1 - - -###################################################################### -# _Validation - -All :: "$(LANG).$(PLAT).$(CFG)._Validation-1.idt" - -"$(LANG).$(PLAT).$(CFG)._Validation-1.idt" : "Makefile" "..\..\..\include\MSIBuildCfg.mak" - -if exist $@ del /f /q $@ - move /y << $@ > NUL -Table Column Nullable MinValue MaxValue KeyTable KeyColumn Category Set Description -s32 s32 s4 I4 I4 S255 I2 S32 S255 S255 -_Validation Table Column -Certificate Certificate N Identifier Primary key, non-localized token. -Certificate Store N Formatted MY;Root;Trust;CA Certificate store name for CertOpenStore() function call. The store provider is always CERT_STORE_PROV_SYSTEM. Therefore, possible values are: MY, Root, Trust, or CA. -Certificate Flags N DoubleInteger Flags for CertOpenStore() function call. -Certificate Encoding N DoubleInteger 0;1;65536;65537 Certificate encoding (combination of X509_ASN_ENCODING(1) and PKCS_7_ASN_ENCODING(65536) flags). -Certificate Binary_ N Binary 1 Identifier The certificate file. The binary information is looked up from the Binary Table. -Certificate Condition Y Condition Optional expression which skips the certificate if evaluates to expFalse. If the expression syntax is invalid, the engine will terminate, returning iesBadActionData. -Certificate Component_ N Component 1 Identifier Component the certificate is part of. -< NUL -Action Description Template -s$(MSIBUILD_LENGTH_ID) L0 L0 -1252 ActionText Action -InstallCertificates Installing certificates Certificate: [1] -< NUL - -"It.$(PLAT).$(CFG).ActionText-2.idt" : "En.$(PLAT).$(CFG).ActionText-2.idtx" "..\L10N\it_IT.po" - rcxgettext.exe idtp $@ $** - -"Sl.$(PLAT).$(CFG).ActionText-2.idt" : "En.$(PLAT).$(CFG).ActionText-2.idtx" "..\L10N\sl_SI.po" - rcxgettext.exe idtp $@ $** - - -###################################################################### -# Binary - -All :: \ - "$(LANG).$(PLAT).$(CFG).Binary-1.idt" \ - "$(LANG).$(PLAT).$(CFG).Binary-1\MSICACert.dll" - -"$(LANG).$(PLAT).$(CFG).Binary-1.idt" : "Makefile" "..\..\..\include\MSIBuildCfg.mak" "$(LANG).$(PLAT).$(CFG).Binary-1" - -if exist $@ del /f /q $@ - move /y << $@ > NUL -Name Data -s$(MSIBUILD_LENGTH_ID) v0 -Binary Name -binMSICACert.dll MSICACert.dll -< NUL - - -###################################################################### -# Certificate - -All :: "$(LANG).$(PLAT).$(CFG).Certificate-1.idt" - -"$(LANG).$(PLAT).$(CFG).Certificate-1.idt" : "Makefile" "..\..\..\include\MSIBuildCfg.mak" - -if exist $@ del /f /q $@ - move /y << $@ > NUL -Certificate Store Flags Encoding Binary_ Condition Component_ -s$(MSIBUILD_LENGTH_ID) s255 i4 i4 s$(MSIBUILD_LENGTH_ID) S255 s$(MSIBUILD_LENGTH_ID) -Certificate Certificate -< NUL -Action Type Source Target -s$(MSIBUILD_LENGTH_ID) i2 S$(MSIBUILD_LENGTH_ID) S255 -CustomAction Action -EvaluateCertificates 1 binMSICACert.dll EvaluateSequence -InstallCertificates 3073 binMSICACert.dll ExecuteSequence -RollbackCertificates 3329 binMSICACert.dll ExecuteSequence -CommitCertificates 3585 binMSICACert.dll ExecuteSequence -< NUL -Action Condition Sequence -s$(MSIBUILD_LENGTH_ID) S255 I2 -InstallExecuteSequence Action -EvaluateCertificates 6577 -RollbackCertificates 6576 -InstallCertificates 6578 -CommitCertificates 6579 -< - - -//////////////////////////////////////////////////////////////////// -// Calling declaration -//////////////////////////////////////////////////////////////////// - -#if defined(MSICACERT_DLL) -#define MSICACERT_API __declspec(dllexport) -#elif defined(MSICACERT_DLLIMP) -#define MSICACERT_API __declspec(dllimport) -#else -#define MSICACERT_API -#endif - -//////////////////////////////////////////////////////////////////// -// Exported functions -//////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -extern "C" { -#endif - - UINT MSICACERT_API EvaluateSequence(MSIHANDLE hInstall); - UINT MSICACERT_API ExecuteSequence(MSIHANDLE hInstall); - -#ifdef __cplusplus -} -#endif - -#endif // __MSICACERT_H__ diff --git a/MSICACert/MSICACert.vcxproj b/MSICACert/MSICACert.vcxproj deleted file mode 100644 index e9fa613..0000000 --- a/MSICACert/MSICACert.vcxproj +++ /dev/null @@ -1,171 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0379563D-9835-44AC-928E-24D4E316CE5D} - v4.0 - - - - DynamicLibrary - Static - Unicode - true - - - DynamicLibrary - Static - Unicode - - - DynamicLibrary - Static - Unicode - true - - - DynamicLibrary - Static - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\output\$(Platform).$(Configuration)\ - true - ..\output\$(Platform).$(Configuration)\ - true - ..\output\$(Platform).$(Configuration)\ - true - ..\output\$(Platform).$(Configuration)\ - true - - - - Windows - - - %(Filename)_h.h - - - - L10N\sl_SI.po - - - - - - Windows - - - %(Filename)_h.h - - - - L10N\sl_SI.po - - - - - - Windows - - - %(Filename)_h.h - - - - L10N\sl_SI.po - - - - - - Windows - - - %(Filename)_h.h - - - - L10N\sl_SI.po - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - {8552ee55-177e-4f51-b51b-baf7d6462cde} - - - - - - - \ No newline at end of file diff --git a/MSICACert/MSICACert.vcxproj.filters b/MSICACert/MSICACert.vcxproj.filters deleted file mode 100644 index 89a6b03..0000000 --- a/MSICACert/MSICACert.vcxproj.filters +++ /dev/null @@ -1,48 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;rcx;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;po - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Resource Files - - - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/MSICACert/res/MSICACert.rc b/MSICACert/res/MSICACert.rc deleted file mode 100644 index f4a1999b277e549c369d520d791a8ea92ec54cc6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54 zcmezWPnjW;A&()MA%~%qA%!88L4iSu!IvSJ!IQz6!4Zg48HyN681#T-GJ_FNj+cRp F0RT;v39tYF diff --git a/MSICACert/stdafx.h b/MSICACert/stdafx.h deleted file mode 100644 index 3580a17..0000000 --- a/MSICACert/stdafx.h +++ /dev/null @@ -1,37 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - -#if defined(_UNICODE) && !defined(UNICODE) -#define UNICODE -#endif - -#if defined(_WIN32) && !defined(WIN32) -#define WIN32 -#endif - -#ifndef STRICT -#define STRICT -#endif - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers -#define _WIN32_WINNT 0x0501 // Include Windows XP symbols -#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h -#ifdef _WINDLL -#define MSICACERT_DLL // This is a DLL -#endif -#define _ATL_APARTMENT_THREADED - -#include -#include -#include - -#include -#include -#include - -#include "..\MSICALib\MSICALib.h" - -#include "MSICACert.h" diff --git a/MSICATS/MSIBuild/build_all.bat b/MSICATS/MSIBuild/build_all.bat deleted file mode 100644 index 16b8bc7..0000000 --- a/MSICATS/MSIBuild/build_all.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -nmake.exe /ls All LANG=En CFG=Debug PLAT=Win32 -nmake.exe /ls All LANG=Sl CFG=Debug PLAT=Win32 -nmake.exe /ls All LANG=En CFG=Debug PLAT=x64 -nmake.exe /ls All LANG=Sl CFG=Debug PLAT=x64 -nmake.exe /ls All LANG=En CFG=Release PLAT=Win32 -nmake.exe /ls All LANG=Sl CFG=Release PLAT=Win32 -nmake.exe /ls All LANG=En CFG=Release PLAT=x64 -nmake.exe /ls All LANG=Sl CFG=Release PLAT=x64 diff --git a/MSICATS/MSIBuild/clean_all.bat b/MSICATS/MSIBuild/clean_all.bat deleted file mode 100644 index b1ff08a..0000000 --- a/MSICATS/MSIBuild/clean_all.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -nmake.exe /ls Clean LANG=En CFG=Debug PLAT=Win32 -nmake.exe /ls Clean LANG=Sl CFG=Debug PLAT=Win32 -nmake.exe /ls Clean LANG=En CFG=Debug PLAT=x64 -nmake.exe /ls Clean LANG=Sl CFG=Debug PLAT=x64 -nmake.exe /ls Clean LANG=En CFG=Release PLAT=Win32 -nmake.exe /ls Clean LANG=Sl CFG=Release PLAT=Win32 -nmake.exe /ls Clean LANG=En CFG=Release PLAT=x64 -nmake.exe /ls Clean LANG=Sl CFG=Release PLAT=x64 diff --git a/MSICATS/MSICATS.cpp b/MSICATS/MSICATS.cpp deleted file mode 100644 index 802e212..0000000 --- a/MSICATS/MSICATS.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include "stdafx.h" - - -//////////////////////////////////////////////////////////////////////////// -// Local constants -//////////////////////////////////////////////////////////////////////////// - -#define MSICATS_TASK_TICK_SIZE (16*1024) - - -//////////////////////////////////////////////////////////////////////////// -// Global functions -//////////////////////////////////////////////////////////////////////////// - -extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) -{ - UNREFERENCED_PARAMETER(hInstance); - UNREFERENCED_PARAMETER(lpReserved); - - return TRUE; -} - - -//////////////////////////////////////////////////////////////////// -// Exported functions -//////////////////////////////////////////////////////////////////// - -UINT MSICATS_API EvaluateSequence(MSIHANDLE hInstall) -{ - 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")); - if (condition == MSICONDITION_FALSE || condition == MSICONDITION_TRUE) { - PMSIHANDLE hViewST; - - // Prepare a query to get a list/view of tasks. - uiResult = ::MsiDatabaseOpenView(hDatabase, _T("SELECT Task,DisplayName,Application,Parameters,Directory_,Flags,Priority,User,Password,Author,Description,IdleMin,IdleDeadline,MaxRuntime,Condition,Component_ FROM ScheduledTask"), &hViewST); - if (uiResult == NO_ERROR) { - // Execute query! - uiResult = ::MsiViewExecute(hViewST, NULL); - if (uiResult == NO_ERROR) { - //ATL::CAtlString sComponent; - ATL::CAtlStringW sDisplayName; - - for (;;) { - PMSIHANDLE hRecord; - INSTALLSTATE iInstalled, iAction; - - // Fetch one record from the view. - uiResult = ::MsiViewFetch(hViewST, &hRecord); - if (uiResult == ERROR_NO_MORE_ITEMS) { - uiResult = NO_ERROR; - break; - } else if (uiResult != NO_ERROR) - break; - - // Read and evaluate task's condition. - uiResult = ::MsiRecordGetString(hRecord, 15, 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 task's Component ID. - uiResult = ::MsiRecordGetString(hRecord, 16, sValue); - if (uiResult != NO_ERROR) break; - - // Get the component state. - uiResult = ::MsiGetComponentState(hInstall, sValue, &iInstalled, &iAction); - if (uiResult != NO_ERROR) break; - - // Get task's DisplayName. - uiResult = ::MsiRecordFormatStringW(hInstall, hRecord, 2, sDisplayName); - - if (iAction >= INSTALLSTATE_LOCAL) { - // Component is or should be installed. Create the task. - PMSIHANDLE hViewTT; - MSICA::COpTaskCreate *opCreateTask = new MSICA::COpTaskCreate(sDisplayName, MSICATS_TASK_TICK_SIZE); - - // Populate the operation with task's data. - uiResult = opCreateTask->SetFromRecord(hInstall, hRecord); - if (uiResult != NO_ERROR) break; - - // Perform another query to get task's triggers. - uiResult = ::MsiDatabaseOpenView(hDatabase, _T("SELECT Trigger,BeginDate,EndDate,StartTime,StartTimeRand,MinutesDuration,MinutesInterval,Flags,Type,DaysInterval,WeeksInterval,DaysOfTheWeek,DaysOfMonth,WeekOfMonth,MonthsOfYear FROM TaskTrigger WHERE Task_=?"), &hViewTT); - if (uiResult != NO_ERROR) break; - - // Execute query! - uiResult = ::MsiViewExecute(hViewTT, hRecord); - if (uiResult == NO_ERROR) { - // Populate trigger list. - uiResult = opCreateTask->SetTriggersFromView(hViewTT); - ::MsiViewClose(hViewTT); - if (uiResult != NO_ERROR) break; - } else - break; - - olExecute.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, MSICATS_TASK_TICK_SIZE)); - } - - // The amount of tick space to add for each task to progress indicator. - ::MsiRecordSetInteger(hRecordProg, 1, 3 ); - ::MsiRecordSetInteger(hRecordProg, 2, MSICATS_TASK_TICK_SIZE); - 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("InstallScheduledTasks"), _T("CommitScheduledTasks"), _T("RollbackScheduledTasks"), 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 MSICATS_API ExecuteSequence(MSIHANDLE hInstall) -{ - return MSICA::ExecuteSequence(hInstall); -} diff --git a/MSICATS/res/MSICATS.rc b/MSICATS/res/MSICATS.rc deleted file mode 100644 index a2c23e93121cb4785676eb3a9adaac9ce7710fd5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50 zcmezWPnjW;A&()MA%~%qA%!88L4iSu!IvSJ!IQz6!I2>Z$kJmd0?Hc!#d#UH7yuyi B2+05d diff --git a/MSICATS/res/MSICATS.rcx b/MSICATS/res/MSICATS.rcx deleted file mode 100644 index 48fe20f3f2188ff5dd4e7fae0b8de44a30612ccd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5170 zcmdUzYj4|R6vxkNB))@5-%tt081MpwkkaNtw=Ah*rvp?eY8x+$C{5I~unqV?d`aN< zf1VuKPSQ&XlQLQH;~t;;-Tmk99UED0FKuEMoQc)#&{E56U=2I4o(-*UO`r{)yVkKE zfu!7@+a8b(&mYj?A)#czrer&%Y<+iaw6|C<~1^+eGj!P>Q?p95FdPuX1n<7b>!e>M7O}vhJQmBG4kn;#_{? za8V|Us|9uktSV-L4Ds7X(kg$+e@et|$C0$#anz@d?!eh2C!}E`*y~y!Vs8)F01dPE zOn3KqD`a{bKg*w~Jqz(tJX>6<%O=$@pl(!|ie>Rm_A9c@5Ia$;wpOv~cxT_f=WS!{ z`#!!sLV5;9;ptUQDKn-Crvq?1B}`?~atA2%UYBQu)m4kCR6A6}IWr`$M19qBi9M#D zKSrmhNzonF$?oANN!6+TlW~vzO0)6>Q14rwXD%^ge#!%)ZUws7HP=arU96xeYq$rG zHeT#j>{8F`;az1w4K38^HQmR^n&5{ViVOPsbTN5dyDB&JlHa)^FU9G=enMW{2g*HP z)@x%>KhNw>uIRo0e|E&V>$9hrAWb}=2@+?B+v8{1ACW_i7=Ov{>u}~g*KVX;=V9mU zr*gi728w76&rj_an=xH4>FKYlFME`tGal^8)z_Rx+@cAWJKJ)syd~-e+Ax%O+Z;PLWc|;=EzS%&dj0I&T!7% zd1%gF!*hoAmq0a>Cw9v73BNc0S@Y^NiyGfHDU^wQwAkENs){S@zT}jZ>mygl&ahm0 z^AK4b@Q?)nnB|EgzWj8yKDU^Pu1C6bnPKMN_&5Q zQQZ&o=^=JaLq?rp*o_su5U?Yv~2|F%;@X(bJHYKBdjhMEEsd&_ysQw}`-FJj%dvgqE= zeQ9~)zU!MiR#Wlit(&h}m#oGv3Hy%V3IEg3cH^6J!m~%+H?#?m cbMj&g<}RC>>!q`7g=f+Iv!OZ_w!1$51#=9bF8}}l diff --git a/MSICATS/stdafx.cpp b/MSICATS/stdafx.cpp deleted file mode 100644 index a27b824..0000000 --- a/MSICATS/stdafx.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "stdafx.h"