From e67d7e6f14c199f4f2b918ea5fdf6a661b6a2b24 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 31 Aug 2018 14:15:36 +0200 Subject: [PATCH] Split the project files to versions for VC2010 and VC2017 --- .gitignore | 1 + MSICALib.sln => MSICALib-10.0.sln | 2 +- MSICALib-15.0.sln | 41 ++++++++++ ...MSICALib.vcxproj => MSICALib-10.0.vcxproj} | 0 ....filters => MSICALib-10.0.vcxproj.filters} | 0 build/MSICALib-15.0.vcxproj | 75 +++++++++++++++++ build/MSICALib-15.0.vcxproj.filters | 47 +++++++++++ build/MSICALib.props | 5 +- src/OpReg.cpp | 82 +++++++++---------- 9 files changed, 207 insertions(+), 46 deletions(-) rename MSICALib.sln => MSICALib-10.0.sln (91%) create mode 100644 MSICALib-15.0.sln rename build/{MSICALib.vcxproj => MSICALib-10.0.vcxproj} (100%) rename build/{MSICALib.vcxproj.filters => MSICALib-10.0.vcxproj.filters} (100%) create mode 100644 build/MSICALib-15.0.vcxproj create mode 100644 build/MSICALib-15.0.vcxproj.filters diff --git a/.gitignore b/.gitignore index 97c23ac..3ba61b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /*.opensdf /*.sdf /*.suo +/.vs /ipch *.user temp diff --git a/MSICALib.sln b/MSICALib-10.0.sln similarity index 91% rename from MSICALib.sln rename to MSICALib-10.0.sln index 83fa133..10928ba 100644 --- a/MSICALib.sln +++ b/MSICALib-10.0.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICALib", "build\MSICALib.vcxproj", "{8552EE55-177E-4F51-B51B-BAF7D6462CDE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICALib-10.0", "build\MSICALib-10.0.vcxproj", "{8552EE55-177E-4F51-B51B-BAF7D6462CDE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStd-10.0", "..\WinStd\build\WinStd-10.0.vcxproj", "{47399D91-7EB9-41DE-B521-514BA5DB0C43}" EndProject diff --git a/MSICALib-15.0.sln b/MSICALib-15.0.sln new file mode 100644 index 0000000..6167d78 --- /dev/null +++ b/MSICALib-15.0.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2016 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICALib", "build\MSICALib-15.0.vcxproj", "{8552EE55-177E-4F51-B51B-BAF7D6462CDE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStd", "..\WinStd\build\WinStd-15.0.vcxproj", "{47399D91-7EB9-41DE-B521-514BA5DB0C43}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x64.ActiveCfg = Debug|x64 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x64.Build.0 = Debug|x64 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x86.ActiveCfg = Debug|Win32 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x86.Build.0 = Debug|Win32 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x64.ActiveCfg = Release|x64 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x64.Build.0 = Release|x64 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x86.ActiveCfg = Release|Win32 + {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x86.Build.0 = Release|Win32 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x64.ActiveCfg = Debug|x64 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x64.Build.0 = Debug|x64 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x86.ActiveCfg = Debug|Win32 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x86.Build.0 = Debug|Win32 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.ActiveCfg = Release|x64 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.Build.0 = Release|x64 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x86.ActiveCfg = Release|Win32 + {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FD46612E-A0D9-4E88-9A26-38DE0813EF45} + EndGlobalSection +EndGlobal diff --git a/build/MSICALib.vcxproj b/build/MSICALib-10.0.vcxproj similarity index 100% rename from build/MSICALib.vcxproj rename to build/MSICALib-10.0.vcxproj diff --git a/build/MSICALib.vcxproj.filters b/build/MSICALib-10.0.vcxproj.filters similarity index 100% rename from build/MSICALib.vcxproj.filters rename to build/MSICALib-10.0.vcxproj.filters diff --git a/build/MSICALib-15.0.vcxproj b/build/MSICALib-15.0.vcxproj new file mode 100644 index 0000000..945055b --- /dev/null +++ b/build/MSICALib-15.0.vcxproj @@ -0,0 +1,75 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {8552EE55-177E-4F51-B51B-BAF7D6462CDE} + Win32Proj + MSICALib + MSICALib + 10.0.17134.0 + + + + StaticLibrary + Unicode + v141 + + + StaticLibrary + Unicode + v141 + + + StaticLibrary + Unicode + v141 + + + StaticLibrary + Unicode + v141 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + + + + + \ No newline at end of file diff --git a/build/MSICALib-15.0.vcxproj.filters b/build/MSICALib-15.0.vcxproj.filters new file mode 100644 index 0000000..86c100c --- /dev/null +++ b/build/MSICALib-15.0.vcxproj.filters @@ -0,0 +1,47 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/build/MSICALib.props b/build/MSICALib.props index c4db279..e415d28 100644 --- a/build/MSICALib.props +++ b/build/MSICALib.props @@ -23,10 +23,7 @@ - - temp\$(ProjectName).$(Platform).$(Configuration)\ - temp\$(ProjectName).$(Platform).$(Configuration)\ - + MultiThreadedDebug diff --git a/src/OpReg.cpp b/src/OpReg.cpp index 379e57a..0bcdfd2 100644 --- a/src/OpReg.cpp +++ b/src/OpReg.cpp @@ -105,10 +105,10 @@ HRESULT COpRegKeyCreate::Execute(CSession *pSession) return S_OK; else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(4); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_CREATE ); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 4, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_CREATE ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 4, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); } @@ -156,11 +156,11 @@ HRESULT COpRegKeyCopy::Execute(CSession *pSession) return S_OK; else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(5); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPY ); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue1.c_str() ); - ::MsiRecordSetStringW(hRecordProg, 4, m_sValue2.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 5, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPY ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue1.c_str() ); + ::MsiRecordSetStringW(hRecordProg, 4, m_sValue2.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 5, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); } @@ -322,11 +322,11 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession) while (iLength && m_sValue[iLength - 1] == L'\\') iLength--; for (;;) { - HKEY hKey; + HKEY hKeyTest; sprintf(sBackupName, L"%.*ls (orig %u)", iLength, m_sValue.c_str(), ++uiCount); - lResult = ::RegOpenKeyExW(m_hKeyRoot, sBackupName.c_str(), 0, KEY_ENUMERATE_SUB_KEYS | samAdditional, &hKey); + lResult = ::RegOpenKeyExW(m_hKeyRoot, sBackupName.c_str(), 0, KEY_ENUMERATE_SUB_KEYS | samAdditional, &hKeyTest); if (lResult != NO_ERROR) break; - ::RegCloseKey(hKey); + ::RegCloseKey(hKeyTest); } if (lResult == ERROR_FILE_NOT_FOUND) { // Since copying registry key is a complicated job (when rollback/commit support is required), and we do have an operation just for that, we use it. @@ -341,10 +341,10 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession) pSession->m_olCommit.push_back(new COpRegKeyDelete(m_hKeyRoot, sBackupName.c_str())); } else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(4); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBING ); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff); - ::MsiRecordSetStringW(hRecordProg, 3, sBackupName.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 4, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBING ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, sBackupName.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 4, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); } @@ -358,10 +358,10 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession) return S_OK; else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(4); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETE ); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 4, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETE ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 4, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); } @@ -549,11 +549,11 @@ HRESULT COpRegValueCreate::Execute(CSession *pSession) return S_OK; else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(5); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_SETVALUE); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); - ::MsiRecordSetStringW(hRecordProg, 4, m_sValueName.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 5, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_SETVALUE ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); + ::MsiRecordSetStringW(hRecordProg, 4, m_sValueName.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 5, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); } @@ -623,12 +623,12 @@ HRESULT COpRegValueCopy::Execute(CSession *pSession) return S_OK; else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(6); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPYVALUE); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); - ::MsiRecordSetStringW(hRecordProg, 4, m_sValueName1.c_str() ); - ::MsiRecordSetStringW(hRecordProg, 5, m_sValueName2.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 6, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPYVALUE ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); + ::MsiRecordSetStringW(hRecordProg, 4, m_sValueName1.c_str() ); + ::MsiRecordSetStringW(hRecordProg, 5, m_sValueName2.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 6, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); } @@ -691,11 +691,11 @@ HRESULT COpRegValueDelete::Execute(CSession *pSession) pSession->m_olCommit.push_back(new COpRegValueDelete(m_hKeyRoot, m_sValue.c_str(), sBackupName.c_str())); } else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(5); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBINGVAL); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); - ::MsiRecordSetStringW(hRecordProg, 3, sBackupName.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 4, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBINGVAL ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); + ::MsiRecordSetStringW(hRecordProg, 3, sBackupName.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 4, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); ::RegCloseKey(hKey); return HRESULT_FROM_WIN32(lResult); @@ -713,11 +713,11 @@ HRESULT COpRegValueDelete::Execute(CSession *pSession) return S_OK; else { PMSIHANDLE hRecordProg = ::MsiCreateRecord(5); - ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETEVALUE); - ::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ); - ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); - ::MsiRecordSetStringW(hRecordProg, 4, m_sValueName.c_str() ); - ::MsiRecordSetInteger(hRecordProg, 5, lResult ); + ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETEVALUE ); + ::MsiRecordSetInteger(hRecordProg, 2, (int)(UINT_PTR)m_hKeyRoot & 0x7fffffff); + ::MsiRecordSetStringW(hRecordProg, 3, m_sValue.c_str() ); + ::MsiRecordSetStringW(hRecordProg, 4, m_sValueName.c_str() ); + ::MsiRecordSetInteger(hRecordProg, 5, lResult ); ::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg); return HRESULT_FROM_WIN32(lResult); }