From ee41358bb583619ef4fe6707958dc3c6c62cd13f Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Sun, 28 Jul 2024 00:12:25 +1000 Subject: Fix up COM+ to be back in working order under Wix4+ Table names updated for Wix4 prefix. Custom action names similarly updated. Table names Wix4ComPlusUserInApplicationRole, Wix4ComPlusGroupInApplicationRole and Wix4ComPlusApplicationRoleProperty had to be shortened to fit within MSI 31 character table name limit. Migrated from fixed GUID for RegistrationHelper to use CLSIDFromProgID in an attempt to fix behaviour under .NET 4+ DLLs. Added setting of Partition enable if a Partition is configured in authoring, new Windows config has Partitions disabled by default, and they don't work at all under Windows workstation (non-server) versions. Added a new Runtime condition for `RequireWindowsServer` which will skip execution of Runtime test on workstation/desktop OSes, since COM+ Partitions only work correctly under Windows Server. Quite a lot of basic typos fixed also. Signed-off-by: Bevan Weiss --- src/ext/ComPlus/ca/cpapproleexec.cpp | 4 +- src/ext/ComPlus/ca/cpapprolesched.cpp | 20 +++--- src/ext/ComPlus/ca/cpappsched.cpp | 2 +- src/ext/ComPlus/ca/cpasmexec.cpp | 50 ++++++++++--- src/ext/ComPlus/ca/cpasmsched.cpp | 2 +- src/ext/ComPlus/ca/cpexec.cpp | 10 +-- src/ext/ComPlus/ca/cppartexec.cpp | 71 +++++++++++++++++- src/ext/ComPlus/ca/cppartroleexec.cpp | 2 +- src/ext/ComPlus/ca/cppartrolesched.cpp | 4 +- src/ext/ComPlus/ca/cppartsched.cpp | 14 ++-- src/ext/ComPlus/ca/cpsched.cpp | 80 +++++++++------------ src/ext/ComPlus/ca/cpsubsexec.cpp | 4 +- src/ext/ComPlus/ca/cputilsched.cpp | 52 +++++++------- src/ext/ComPlus/ca/precomp.h | 2 + src/ext/ComPlus/wixext/ComPlusTableDefinitions.cs | 6 +- .../SetBuildNumber/Directory.Packages.props.pp | 1 + src/test/burn/WixTestTools/RuntimeFactAttribute.cs | 30 ++++++++ .../Components/TestComponentNET3.dll | Bin 0 -> 16384 bytes .../Components/TestComponentNET3.tlb | Bin 0 -> 2088 bytes .../Components/TestComponentNET4.dll | Bin 0 -> 16384 bytes .../Components/TestComponentNET4.tlb | Bin 0 -> 2088 bytes .../Components/TestComponentNative.dll | Bin 0 -> 56832 bytes .../InstallUninstallNET3WithoutPartitions.wixproj | 15 ++++ .../product.wxs | 24 +++++++ .../InstallUninstallNET4WithoutPartitions.wixproj | 15 ++++ .../product.wxs | 24 +++++++ ...InstallUninstallNativeWithoutPartitions.wixproj | 15 ++++ .../product.wxs | 24 +++++++ .../InstallUninstallWithPartitions.wixproj | 15 ++++ .../InstallUninstallWithPartitions/product.wxs | 30 ++++++++ .../WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs | 50 +++++++++++++ 31 files changed, 446 insertions(+), 120 deletions(-) create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj create mode 100644 src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs create mode 100644 src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs diff --git a/src/ext/ComPlus/ca/cpapproleexec.cpp b/src/ext/ComPlus/ca/cpapproleexec.cpp index e3b71e93..4b38b23c 100644 --- a/src/ext/ComPlus/ca/cpapproleexec.cpp +++ b/src/ext/ComPlus/ca/cpapproleexec.cpp @@ -74,7 +74,7 @@ HRESULT CpiConfigureApplicationRoles( hr = CpiActionStartMessage(ppwzData, FALSE); ExitOnFailure(hr, "Failed to send action start message"); - // ger count + // get count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); @@ -218,7 +218,7 @@ HRESULT CpiConfigureUsersInApplicationRoles( hr = CpiActionStartMessage(ppwzData, FALSE); ExitOnFailure(hr, "Failed to send action start message"); - // ger count + // get count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); diff --git a/src/ext/ComPlus/ca/cpapprolesched.cpp b/src/ext/ComPlus/ca/cpapprolesched.cpp index 04de6b65..a92c340c 100644 --- a/src/ext/ComPlus/ca/cpapprolesched.cpp +++ b/src/ext/ComPlus/ca/cpapprolesched.cpp @@ -10,13 +10,13 @@ LPCWSTR vcsApplicationRoleQuery = enum eApplicationRoleQuery { arqApplicationRole = 1, arqApplication, arqComponent, arqName }; LPCWSTR vcsUserInApplicationRoleQuery = - L"SELECT `UserInApplicationRole`, `ApplicationRole_`, `ComPlusUserInApplicationRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusUserInApplicationRole`, `Wix4User` WHERE `User_` = `User`"; + L"SELECT `UserInApplicationRole`, `ApplicationRole_`, `Wix4ComPlusUserInAppRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusUserInAppRole`, `Wix4User` WHERE `User_` = `User`"; LPCWSTR vcsGroupInApplicationRoleQuery = - L"SELECT `GroupInApplicationRole`, `ApplicationRole_`, `ComPlusGroupInApplicationRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusGroupInApplicationRole`, `Wix4Group` WHERE `Group_` = `Group`"; + L"SELECT `GroupInApplicationRole`, `ApplicationRole_`, `Wix4ComPlusGroupInAppRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusGroupInAppRole`, `Wix4Group` WHERE `Group_` = `Group`"; enum eTrusteeInApplicationRoleQuery { tiarqUserInApplicationRole = 1, tiarqApplicationRole, tiarqComponent, tiarqDomain, tiarqName }; LPCWSTR vcsApplicationRolePropertyQuery = - L"SELECT `Name`, `Value` FROM `Wix4ComPlusApplicationRoleProperty` WHERE `ApplicationRole_` = ?"; + L"SELECT `Name`, `Value` FROM `Wix4ComPlusAppRoleProperty` WHERE `ApplicationRole_` = ?"; // property definitions @@ -95,7 +95,7 @@ HRESULT CpiApplicationRolesRead( // loop through all application roles hr = WcaOpenExecuteView(vcsApplicationRoleQuery, &hView); - ExitOnFailure(hr, "Failed to execute view on ComPlusApplicationRole table"); + ExitOnFailure(hr, "Failed to execute view on Wix4ComPlusApplicationRole table"); while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) { @@ -205,7 +205,7 @@ HRESULT CpiApplicationRolesVerifyInstall( if (!pItm->fReferencedForInstall && !(pItm->fHasComponent && WcaIsInstalling(pItm->isInstalled, pItm->isAction))) continue; - // if the role is referensed and is not a locater, it must be installed + // if the role is referenced and is not a locater, it must be installed if (pItm->fReferencedForInstall && pItm->fHasComponent && !CpiWillBeInstalled(pItm->isInstalled, pItm->isAction)) MessageExitOnFailure(hr = E_FAIL, msierrComPlusApplicationRoleDependency, "An application role is used by another entity being installed, but is not installed itself, key: %S", pItm->wzKey); @@ -235,7 +235,7 @@ HRESULT CpiApplicationRolesVerifyInstall( switch (er) { case IDABORT: - ExitOnFailure(hr = E_FAIL, "An application with a conflictiong name exists, key: %S", pItm->wzKey); + ExitOnFailure(hr = E_FAIL, "An application with a conflicting name exists, key: %S", pItm->wzKey); break; case IDRETRY: break; @@ -319,7 +319,7 @@ HRESULT CpiApplicationRolesInstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"CreateComPlusApplicationRoles", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"CreateComPlusApplicationRoles"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add count to action data @@ -371,7 +371,7 @@ HRESULT CpiApplicationRolesUninstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"RemoveComPlusApplicationRoles", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"RemoveComPlusApplicationRoles"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add count to action data @@ -477,7 +477,7 @@ HRESULT CpiUsersInApplicationRolesInstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"AddUsersToComPlusApplicationRoles", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"AddUsersToComPlusApplicationRoles"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add count to action data @@ -529,7 +529,7 @@ HRESULT CpiUsersInApplicationRolesUninstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"RemoveUsersFromComPlusAppRoles", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"RemoveUsersFromComPlusAppRoles"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add count to action data diff --git a/src/ext/ComPlus/ca/cpappsched.cpp b/src/ext/ComPlus/ca/cpappsched.cpp index 4d867f6b..bcd3bb75 100644 --- a/src/ext/ComPlus/ca/cpappsched.cpp +++ b/src/ext/ComPlus/ca/cpappsched.cpp @@ -255,7 +255,7 @@ HRESULT CpiApplicationsVerifyInstall( if (!pItm->fReferencedForInstall && !(pItm->fHasComponent && WcaIsInstalling(pItm->isInstalled, pItm->isAction))) continue; - // if the application is referensed and is not a locater, it must be installed + // if the application is referenced and is not a locater, it must be installed if (pItm->fReferencedForInstall && pItm->fHasComponent && !CpiWillBeInstalled(pItm->isInstalled, pItm->isAction)) MessageExitOnFailure(hr = E_FAIL, msierrComPlusApplicationDependency, "An application is used by another entity being installed, but is not installed itself, key: %S", pItm->wzKey); diff --git a/src/ext/ComPlus/ca/cpasmexec.cpp b/src/ext/ComPlus/ca/cpasmexec.cpp index 3d140027..af6c7eff 100644 --- a/src/ext/ComPlus/ca/cpasmexec.cpp +++ b/src/ext/ComPlus/ca/cpasmexec.cpp @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. #include "precomp.h" - +#include // GAC related declarations @@ -61,13 +61,11 @@ public: typedef HRESULT (__stdcall *LoadLibraryShimFunc)(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll); typedef HRESULT (__stdcall *CreateAssemblyCacheFunc)(IAssemblyCache **ppAsmCache, DWORD dwReserved); +typedef HRESULT (__stdcall *GetFileVersionFnPtr)(LPCWSTR szFilename, _Out_writes_to_opt_(cchBuffer, *dwLength) LPWSTR szBuffer, DWORD cchBuffer, DWORD* dwLength); +typedef HRESULT (__stdcall *CorBindToRuntimeExFnPtr)(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, DWORD startupFlags, REFCLSID rclsid, REFIID riid, LPVOID FAR* ppv); // RegistrationHelper related declarations - -static const GUID CLSID_RegistrationHelper = - { 0x89a86e7b, 0xc229, 0x4008, { 0x9b, 0xaa, 0x2f, 0x5c, 0x84, 0x11, 0xd7, 0xe0 } }; - enum eInstallationFlags { ifConfigureComponentsOnly = 16, ifFindOrCreateTargetApplication = 4, @@ -156,7 +154,8 @@ static HRESULT UnregisterAssembly( static void InitAssemblyExec(); static void UninitAssemblyExec(); static HRESULT GetRegistrationHelper( - IDispatch** ppiRegHlp + IDispatch** ppiRegHlp, + LPCWSTR pwzAssemblyPath ); static HRESULT GetAssemblyCacheObject( IAssemblyCache** ppAssemblyCache @@ -722,15 +721,44 @@ static void UninitAssemblyExec() } static HRESULT GetRegistrationHelper( - IDispatch** ppiRegHlp + IDispatch** ppiRegHlp, + LPCWSTR pwzAssemblyPath ) { HRESULT hr = S_OK; + wchar_t pwzVersion[MAX_PATH]; + DWORD pcchVersionLen = MAX_PATH; + ICLRRuntimeHost* runtimeHost = NULL; + + if (!ghMscoree) + { + ghMscoree = ::LoadLibraryW(L"mscoree.dll"); + ExitOnNull(ghMscoree, hr, E_FAIL, "Failed to load mscoree.dll"); + } + GetFileVersionFnPtr GetFileVersion = (GetFileVersionFnPtr)::GetProcAddress(ghMscoree, "GetFileVersion"); + ExitOnNull(GetFileVersion, hr, E_FAIL, "Failed to GetProcAddress for 'GetFileVersion' from 'mscoree.dll'"); + hr = GetFileVersion(pwzAssemblyPath, pwzVersion, pcchVersionLen, &pcchVersionLen); if (!gpiRegHlp) { + CLSID CLSID_RegistrationHelper{}; + hr = ::CLSIDFromProgID(OLESTR("System.EnterpriseServices.RegistrationHelper"), &CLSID_RegistrationHelper); + ExitOnFailure(hr, "Failed to identify CLSID for 'System.EnterpriseServices.RegistrationHelper'"); + + // NOTE: The 'CoreBindToRuntimeEx' method is DEPRECATED in .NET v4. + // HOWEVER, we might be running in an earlier context at this point so we don't want to rely upon stuff that is particularly v4 dependent. + // Even if we are about to try to fire up a v4 runtime. + // The .NET v4 runtime with STARTUP_LOADER_SAFEMODE flag (to disable version checking of loaded assemblies) is what lets us launch the + // RegistrationHelper. The v4 RegistrationHelper is able to register both v4 and v3 assemblies however, so if we can get it, we most as well + // use it. + CorBindToRuntimeExFnPtr CorBindToRuntimeEx = (CorBindToRuntimeExFnPtr)::GetProcAddress(ghMscoree, "CorBindToRuntimeEx"); + hr = CorBindToRuntimeEx(L"v4.0.30319", L"wks", STARTUP_LOADER_SAFEMODE, CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, (LPVOID*)&runtimeHost); + // we ignore the HRESULT here. If it worked, great, we'll use it moving forward. If it didn't work, we'll end up trying to resort to legacy .NET FW + // when we just try the COM Create below + // create registration helper object - hr = ::CoCreateInstance(CLSID_RegistrationHelper, NULL, CLSCTX_ALL, IID_IDispatch, (void**)&gpiRegHlp); + // This will be created in the .NET FW 4 version if we managed to launch it above, or in the .NET FW <4 version based on the COM dispatch otherwise + hr = ::CoCreateInstance(CLSID_RegistrationHelper, NULL, CLSCTX_ALL, IID_IDispatch, (void**)&gpiRegHlp); ExitOnFailure(hr, "Failed to create registration helper object"); } @@ -883,7 +911,7 @@ static HRESULT RegisterDotNetAssembly( } // get registration helper object - hr = GetRegistrationHelper(&piRegHlp); + hr = GetRegistrationHelper(&piRegHlp, pAttrs->pwzDllPath); ExitOnFailure(hr, "Failed to get registration helper object"); // get dispatch id of InstallAssembly() method @@ -979,7 +1007,7 @@ static HRESULT RegisterNativeAssembly( ExitOnNull(bstrTlbPath, hr, E_OUTOFMEMORY, "Failed to allocate BSTR for tlb path"); bstrPSDllPath = ::SysAllocString(pAttrs->pwzPSDllPath ? pAttrs->pwzPSDllPath : L""); - ExitOnNull(bstrPSDllPath, hr, E_OUTOFMEMORY, "Failed to allocate BSTR for tlb path"); + ExitOnNull(bstrPSDllPath, hr, E_OUTOFMEMORY, "Failed to allocate BSTR for proxy/stub dll path"); // get catalog hr = CpiExecGetAdminCatalog(&piCatalog); @@ -1089,7 +1117,7 @@ static HRESULT UnregisterDotNetAssembly( ExitOnNull(bstrDllPath, hr, E_OUTOFMEMORY, "Failed to allocate BSTR for dll path"); // get registration helper object - hr = GetRegistrationHelper(&piRegHlp); + hr = GetRegistrationHelper(&piRegHlp, pAttrs->pwzDllPath); ExitOnFailure(hr, "Failed to get registration helper object"); // get dispatch id of UninstallAssembly() method diff --git a/src/ext/ComPlus/ca/cpasmsched.cpp b/src/ext/ComPlus/ca/cpasmsched.cpp index 325808de..044b2ef8 100644 --- a/src/ext/ComPlus/ca/cpasmsched.cpp +++ b/src/ext/ComPlus/ca/cpasmsched.cpp @@ -408,7 +408,7 @@ HRESULT CpiAssembliesVerifyInstall( if (!pItm->fReferencedForInstall && !pItm->iRoleAssignmentsInstallCount && !WcaIsInstalling(pItm->isInstalled, pItm->isAction)) continue; - // if the assembly is referensed, it must be installed + // if the assembly is referenced, it must be installed if ((pItm->fReferencedForInstall || pItm->iRoleAssignmentsInstallCount) && !CpiWillBeInstalled(pItm->isInstalled, pItm->isAction)) MessageExitOnFailure(hr = E_FAIL, msierrComPlusAssemblyDependency, "An assembly is used by another entity being installed, but is not installed itself, key: %S", pItm->wzKey); } diff --git a/src/ext/ComPlus/ca/cpexec.cpp b/src/ext/ComPlus/ca/cpexec.cpp index 9b1691fc..a915dd34 100644 --- a/src/ext/ComPlus/ca/cpexec.cpp +++ b/src/ext/ComPlus/ca/cpexec.cpp @@ -180,7 +180,7 @@ LExit: if (INVALID_HANDLE_VALUE != hRollbackFile) ::CloseHandle(hRollbackFile); - // unitialize + // uninitialize CpiExecFinalize(); if (fInitializedCom) @@ -258,7 +258,7 @@ LExit: if (INVALID_HANDLE_VALUE != hRollbackFile) ::CloseHandle(hRollbackFile); - // unitialize + // uninitialize CpiExecFinalize(); if (fInitializedCom) @@ -415,7 +415,7 @@ LExit: if (prdSubscriptions) CpiFreeRollbackDataList(prdSubscriptions); - // unitialize + // uninitialize CpiExecFinalize(); if (fInitializedCom) @@ -521,7 +521,7 @@ LExit: if (INVALID_HANDLE_VALUE != hRollbackFile) ::CloseHandle(hRollbackFile); - // unitialize + // uninitialize CpiExecFinalize(); if (fInitializedCom) @@ -670,7 +670,7 @@ LExit: if (prdSubscriptions) CpiFreeRollbackDataList(prdSubscriptions); - // unitialize + // uninitialize CpiExecFinalize(); if (fInitializedCom) diff --git a/src/ext/ComPlus/ca/cppartexec.cpp b/src/ext/ComPlus/ca/cppartexec.cpp index 673bdaf9..06aa16f4 100644 --- a/src/ext/ComPlus/ca/cppartexec.cpp +++ b/src/ext/ComPlus/ca/cppartexec.cpp @@ -34,6 +34,7 @@ static HRESULT ReadPartitionAttributes( static void FreePartitionAttributes( CPI_PARTITION_ATTRIBUTES* pAttrs ); +static HRESULT CpiEnsurePartitionsEnabled(); static HRESULT CreatePartition( CPI_PARTITION_ATTRIBUTES* pAttrs ); @@ -71,7 +72,7 @@ HRESULT CpiConfigurePartitions( hr = CpiActionStartMessage(ppwzData, FALSE); ExitOnFailure(hr, "Failed to send action start message"); - // ger partition count + // get partition count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); @@ -215,7 +216,7 @@ HRESULT CpiConfigurePartitionUsers( hr = CpiActionStartMessage(ppwzData, FALSE); ExitOnFailure(hr, "Failed to send action start message"); - // ger partition count + // get partition count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); @@ -384,6 +385,69 @@ static void FreePartitionAttributes( CpiFreePropertyList(pAttrs->pPropList); } +static HRESULT CpiEnsurePartitionsEnabled() +{ + HRESULT hr = S_OK; + + ICatalogCollection* piLocalComputerColl = NULL; + IDispatch* piDisp = NULL; + ICatalogObject* piLocalComputerObj = NULL; + VARIANT vtVal; + BSTR bsPartitionsEnabledName = ::SysAllocString(L"PartitionsEnabled"); + long numChanges = 0; + + ::VariantInit(&vtVal); + + // get collection + hr = CpiExecGetCatalogCollection(L"LocalComputer", &piLocalComputerColl); + ExitOnFailure(hr, "Failed to get catalog collection"); + + // find object, there will be only one in the LocalComputer collection + hr = piLocalComputerColl->get_Item(0, &piDisp); + ExitOnFailure(hr, "Failed to get object from collection"); + + hr = piDisp->QueryInterface(IID_ICatalogObject, (void**)&piLocalComputerObj); + ExitOnFailure(hr, "Failed to get IID_ICatalogObject interface"); + + // and then we get the value of the PartitionsEnabled property + hr = piLocalComputerObj->get_Value(bsPartitionsEnabledName, &vtVal); + if (!vtVal.boolVal) + { + vtVal.boolVal = true; + hr = piLocalComputerObj->put_Value(bsPartitionsEnabledName, vtVal); + ExitOnFailure(hr, "Failed to put value to Enable COM+ PartitionsEnabled property"); + hr = piLocalComputerColl->SaveChanges(&numChanges); + ExitOnFailure(hr, "Failed to save PartitionsEnabled property"); + + // we'll read back the hopefully updated values of the PartitionsEnabled property + // if it's still False, then we're on a Windows Desktop that doesn't allow Partitions + // (as of Windows Server2003 Microsoft limited Partitions to only ServerOS platforms) + hr = piLocalComputerObj->get_Value(bsPartitionsEnabledName, &vtVal); + ExitOnFailure(hr, "Failed to read PartitionsEnabled property"); + } + + if (vtVal.boolVal) + { + // everything went well, we have the Partitioning available + hr = S_OK; + } + else + { + // we're on a Desktop OS, or couldn't otherwise enable partitioning + WcaLog(LOGMSG_STANDARD, "Failed to Enable COM+ PartitionEnabled property. This suggests Partitioning was attempted on a Desktop OS, which is not supported"); + hr = S_FALSE; + } + +LExit: + // clean up + ReleaseObject(piLocalComputerColl); + ReleaseObject(piLocalComputerObj); + ReleaseBSTR(bsPartitionsEnabledName); + ::VariantClear(&vtVal); + + return hr; +} + static HRESULT CreatePartition( CPI_PARTITION_ATTRIBUTES* pAttrs ) @@ -408,6 +472,9 @@ static HRESULT CreatePartition( if (S_FALSE == hr) { + hr = CpiEnsurePartitionsEnabled(); + ExitOnFailure(hr, "Failed to enable partitions"); + // create partition hr = CpiAddCollectionObject(piPartColl, &piPartObj); ExitOnFailure(hr, "Failed to add partition to collection"); diff --git a/src/ext/ComPlus/ca/cppartroleexec.cpp b/src/ext/ComPlus/ca/cppartroleexec.cpp index 4a503c79..910473e0 100644 --- a/src/ext/ComPlus/ca/cppartroleexec.cpp +++ b/src/ext/ComPlus/ca/cppartroleexec.cpp @@ -49,7 +49,7 @@ HRESULT CpiConfigureUsersInPartitionRoles( hr = CpiActionStartMessage(ppwzData, FALSE); ExitOnFailure(hr, "Failed to send action start message"); - // ger count + // get count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); diff --git a/src/ext/ComPlus/ca/cppartrolesched.cpp b/src/ext/ComPlus/ca/cppartrolesched.cpp index 0ca4bf0c..b2fb5118 100644 --- a/src/ext/ComPlus/ca/cppartrolesched.cpp +++ b/src/ext/ComPlus/ca/cppartrolesched.cpp @@ -10,9 +10,9 @@ LPCWSTR vcsPartitionRoleQuery = enum ePartitionRoleQuery { prqPartitionRole = 1, prqPartition, prqComponent, prqName }; LPCWSTR vcsUserInPartitionRoleQuery = - L"SELECT `UserInPartitionRole`, `PartitionRole_`, `ComPlusUserInPartitionRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusUserInPartitionRole`, `Wix4User` WHERE `User_` = `User`"; + L"SELECT `UserInPartitionRole`, `PartitionRole_`, `Wix4ComPlusUserInPartitionRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusUserInPartitionRole`, `Wix4User` WHERE `User_` = `User`"; LPCWSTR vcsGroupInPartitionRoleQuery = - L"SELECT `GroupInPartitionRole`, `PartitionRole_`, `ComPlusGroupInPartitionRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusGroupInPartitionRole`, `Wix4Group` WHERE `Group_` = `Group`"; + L"SELECT `GroupInPartitionRole`, `PartitionRole_`, `Wix4ComPlusGroupInPartitionRole`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusGroupInPartitionRole`, `Wix4Group` WHERE `Group_` = `Group`"; enum eTrusteeInPartitionRoleQuery { tiprqUserInPartitionRole = 1, tiprqPartitionRole, tiprqComponent, tiprqDomain, tiprqName }; diff --git a/src/ext/ComPlus/ca/cppartsched.cpp b/src/ext/ComPlus/ca/cppartsched.cpp index d4065d34..b4c1c314 100644 --- a/src/ext/ComPlus/ca/cppartsched.cpp +++ b/src/ext/ComPlus/ca/cppartsched.cpp @@ -13,7 +13,7 @@ LPCWSTR vcsPartitionPropertyQuery = L"SELECT `Name`, `Value` FROM `Wix4ComPlusPartitionProperty` WHERE `Partition_` = ?"; LPCWSTR vcsPartitionUserQuery = - L"SELECT `PartitionUser`, `Partition_`, `ComPlusPartitionUser`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusPartitionUser`, `Wix4User` WHERE `User_` = `User`"; + L"SELECT `PartitionUser`, `Partition_`, `Wix4ComPlusPartitionUser`.`Component_`, `Domain`, `Name` FROM `Wix4ComPlusPartitionUser`, `Wix4User` WHERE `User_` = `User`"; enum ePartitionUserQuery { puqPartitionUser = 1, puqPartition, puqComponent, puqDomain, puqName }; @@ -192,7 +192,7 @@ HRESULT CpiPartitionsVerifyInstall( if (!pItm->fReferencedForInstall && !(pItm->fHasComponent && WcaIsInstalling(pItm->isInstalled, pItm->isAction))) continue; - // if the partition is referensed and is not a locater, it must be installed + // if the partition is referenced and is not a locater, it must be installed if (pItm->fReferencedForInstall && pItm->fHasComponent && !CpiWillBeInstalled(pItm->isInstalled, pItm->isAction)) MessageExitOnFailure(hr = E_FAIL, msierrComPlusPartitionDependency, "A partition is used by another entity being installed, but is not installed itself, key: %S", pItm->wzKey); @@ -281,7 +281,7 @@ HRESULT CpiPartitionsVerifyInstall( { case IDCANCEL: case IDABORT: - ExitOnFailure(hr = E_FAIL, "A partition with a conflictiong name or id exists, key: %S", pItm->wzKey); + ExitOnFailure(hr = E_FAIL, "A partition with a conflicting name or id exists, key: %S", pItm->wzKey); break; case IDRETRY: break; @@ -403,7 +403,7 @@ HRESULT CpiPartitionsInstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"CreateComPlusPartitions", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"CreateComPlusPartitions"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add partition count to action data @@ -455,7 +455,7 @@ HRESULT CpiPartitionsUninstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"RemoveComPlusPartitions", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"RemoveComPlusPartitions"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add partition count to action data @@ -735,7 +735,7 @@ HRESULT CpiPartitionUsersInstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"AddComPlusPartitionUsers", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"AddComPlusPartitionUsers"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add partition count to action data @@ -787,7 +787,7 @@ HRESULT CpiPartitionUsersUninstall( int iActionType; // add action text - hr = CpiAddActionTextToActionData(L"RemoveComPlusPartitionUsers", ppwzActionData); + hr = CpiAddActionTextToActionData(CUSTOM_ACTION_DECORATION(L"RemoveComPlusPartitionUsers"), ppwzActionData); ExitOnFailure(hr, "Failed to add action text to custom action data"); // add partition count to action data diff --git a/src/ext/ComPlus/ca/cpsched.cpp b/src/ext/ComPlus/ca/cpsched.cpp index ebc547ae..acde3cd3 100644 --- a/src/ext/ComPlus/ca/cpsched.cpp +++ b/src/ext/ComPlus/ca/cpsched.cpp @@ -3,31 +3,17 @@ #include "precomp.h" -#ifdef _WIN64 -#define CP_COMPLUSROLLBACKINSTALLPREPARE L"ComPlusRollbackInstallPrepare_64" -#define CP_COMPLUSINSTALLPREPARE L"ComPlusInstallPrepare_64" -#define CP_COMPLUSROLLBACKINSTALLEXECUTE L"ComPlusRollbackInstallExecute_64" -#define CP_COMPLUSINSTALLEXECUTE L"ComPlusInstallExecute_64" -#define CP_COMPLUSINSTALLEXECUTECOMMIT L"ComPlusInstallExecuteCommit_64" -#define CP_COMPLUSINSTALLCOMMIT L"ComPlusInstallCommit_64" -#define CP_COMPLUSROLLBACKINSTALLPREPARE L"ComPlusRollbackInstallPrepare_64" -#define CP_COMPLUSINSTALLPREPARE L"ComPlusInstallPrepare_64" -#define CP_COMPLUSROLLBACKUNINSTALLEXECUTE L"ComPlusRollbackUninstallExecute_64" -#define CP_COMPLUSUNINSTALLEXECUTE L"ComPlusUninstallExecute_64" -#define CP_COMPLUSINSTALLCOMMIT L"ComPlusInstallCommit_64" -#else -#define CP_COMPLUSROLLBACKINSTALLPREPARE L"ComPlusRollbackInstallPrepare" -#define CP_COMPLUSINSTALLPREPARE L"ComPlusInstallPrepare" -#define CP_COMPLUSROLLBACKINSTALLEXECUTE L"ComPlusRollbackInstallExecute" -#define CP_COMPLUSINSTALLEXECUTE L"ComPlusInstallExecute" -#define CP_COMPLUSINSTALLEXECUTECOMMIT L"ComPlusInstallExecuteCommit" -#define CP_COMPLUSINSTALLCOMMIT L"ComPlusInstallCommit" -#define CP_COMPLUSROLLBACKINSTALLPREPARE L"ComPlusRollbackInstallPrepare" -#define CP_COMPLUSINSTALLPREPARE L"ComPlusInstallPrepare" -#define CP_COMPLUSROLLBACKUNINSTALLEXECUTE L"ComPlusRollbackUninstallExecute" -#define CP_COMPLUSUNINSTALLEXECUTE L"ComPlusUninstallExecute" -#define CP_COMPLUSINSTALLCOMMIT L"ComPlusInstallCommit" -#endif +#define CP_COMPLUSROLLBACKINSTALLPREPARE CUSTOM_ACTION_DECORATION(L"ComPlusRollbackInstallPrepare") +#define CP_COMPLUSINSTALLPREPARE CUSTOM_ACTION_DECORATION(L"ComPlusInstallPrepare") +#define CP_COMPLUSROLLBACKINSTALLEXECUTE CUSTOM_ACTION_DECORATION(L"ComPlusRollbackInstallExecute") +#define CP_COMPLUSINSTALLEXECUTE CUSTOM_ACTION_DECORATION(L"ComPlusInstallExecute") +#define CP_COMPLUSINSTALLEXECUTECOMMIT CUSTOM_ACTION_DECORATION(L"ComPlusInstallExecuteCommit") +#define CP_COMPLUSINSTALLCOMMIT CUSTOM_ACTION_DECORATION(L"ComPlusInstallCommit") +#define CP_COMPLUSROLLBACKINSTALLPREPARE CUSTOM_ACTION_DECORATION(L"ComPlusRollbackInstallPrepare") +#define CP_COMPLUSINSTALLPREPARE CUSTOM_ACTION_DECORATION(L"ComPlusInstallPrepare") +#define CP_COMPLUSROLLBACKUNINSTALLEXECUTE CUSTOM_ACTION_DECORATION(L"ComPlusRollbackUninstallExecute") +#define CP_COMPLUSUNINSTALLEXECUTE CUSTOM_ACTION_DECORATION(L"ComPlusUninstallExecute") +#define CP_COMPLUSINSTALLCOMMIT CUSTOM_ACTION_DECORATION(L"ComPlusInstallCommit") /******************************************************************** ConfigureComPlusInstall - CUSTOM ACTION ENTRY POINT for installing COM+ components @@ -81,7 +67,7 @@ extern "C" UINT __stdcall ConfigureComPlusInstall(MSIHANDLE hInstall) CpiSchedInitialize(); - // check for the prerequsite tables + // check for the prerequisite tables if (!CpiTableExists(cptComPlusPartition) && !CpiTableExists(cptComPlusApplication) && !CpiTableExists(cptComPlusAssembly)) { WcaLog(LOGMSG_VERBOSE, "skipping install COM+ CustomAction, no ComPlusPartition, ComPlusApplication or ComPlusAssembly table present"); @@ -117,55 +103,55 @@ extern "C" UINT __stdcall ConfigureComPlusInstall(MSIHANDLE hInstall) if (502 <= iVersionNT && CpiTableExists(cptComPlusPartition)) { hr = CpiPartitionsRead(&partList); - MessageExitOnFailure(hr, msierrComPlusPartitionReadFailed, "Failed to read ComPlusPartitions table"); + MessageExitOnFailure(hr, msierrComPlusPartitionReadFailed, "Failed to read Wix4ComPlusPartitions table"); } if (502 <= iVersionNT && CpiTableExists(cptComPlusPartitionRole)) { hr = CpiPartitionRolesRead(&partList, &partRoleList); - MessageExitOnFailure(hr, msierrComPlusPartitionRoleReadFailed, "Failed to read ComPlusPartitionRole table"); + MessageExitOnFailure(hr, msierrComPlusPartitionRoleReadFailed, "Failed to read Wix4ComPlusPartitionRole table"); } if (502 <= iVersionNT && (CpiTableExists(cptComPlusUserInPartitionRole) || CpiTableExists(cptComPlusGroupInPartitionRole))) { hr = CpiUsersInPartitionRolesRead(&partRoleList, &usrInPartRoleList); - MessageExitOnFailure(hr, msierrComPlusUserInPartitionRoleReadFailed, "Failed to read ComPlusUserInPartitionRole table"); + MessageExitOnFailure(hr, msierrComPlusUserInPartitionRoleReadFailed, "Failed to read Wix4ComPlusUserInPartitionRole table"); } if (502 <= iVersionNT && CpiTableExists(cptComPlusPartitionUser)) { hr = CpiPartitionUsersRead(&partList, &partUsrList); - MessageExitOnFailure(hr, msierrComPlusPartitionUserReadFailed, "Failed to read ComPlusPartitionUser table"); + MessageExitOnFailure(hr, msierrComPlusPartitionUserReadFailed, "Failed to read Wix4ComPlusPartitionUser table"); } if (CpiTableExists(cptComPlusApplication)) { hr = CpiApplicationsRead(&partList, &appList); - MessageExitOnFailure(hr, msierrComPlusApplicationReadFailed, "Failed to read ComPlusApplication table"); + MessageExitOnFailure(hr, msierrComPlusApplicationReadFailed, "Failed to read Wix4ComPlusApplication table"); } if (CpiTableExists(cptComPlusApplicationRole)) { hr = CpiApplicationRolesRead(&appList, &appRoleList); - MessageExitOnFailure(hr, msierrComPlusApplicationRoleReadFailed, "Failed to read ComPlusApplicationRole table"); + MessageExitOnFailure(hr, msierrComPlusApplicationRoleReadFailed, "Failed to read Wix4ComPlusApplicationRole table"); } if (CpiTableExists(cptComPlusUserInApplicationRole) || CpiTableExists(cptComPlusGroupInApplicationRole)) { hr = CpiUsersInApplicationRolesRead(&appRoleList, &usrInAppRoleList); - MessageExitOnFailure(hr, msierrComPlusUserInApplicationRoleReadFailed, "Failed to read ComPlusUserInApplicationRole table"); + MessageExitOnFailure(hr, msierrComPlusUserInApplicationRoleReadFailed, "Failed to read Wix4ComPlusUserInApplicationRole table"); } if (CpiTableExists(cptComPlusAssembly)) { hr = CpiAssembliesRead(&appList, &appRoleList, &asmList); - MessageExitOnFailure(hr, msierrComPlusAssembliesReadFailed, "Failed to read ComPlusAssembly table"); + MessageExitOnFailure(hr, msierrComPlusAssembliesReadFailed, "Failed to read Wix4ComPlusAssembly table"); } if (CpiTableExists(cptComPlusSubscription)) { hr = CpiSubscriptionsRead(&asmList, &subList); - MessageExitOnFailure(hr, msierrComPlusSubscriptionReadFailed, "Failed to read ComPlusSubscription table"); + MessageExitOnFailure(hr, msierrComPlusSubscriptionReadFailed, "Failed to read Wix4ComPlusSubscription table"); } // verify elements @@ -295,7 +281,7 @@ LExit: CpiAssemblyListFree(&asmList); CpiSubscriptionListFree(&subList); - // unitialize + // uninitialize CpiSchedFinalize(); if (fInitializedCom) @@ -359,7 +345,7 @@ extern "C" UINT __stdcall ConfigureComPlusUninstall(MSIHANDLE hInstall) // check for the prerequsite tables if (!CpiTableExists(cptComPlusPartition) && !CpiTableExists(cptComPlusApplication) && !CpiTableExists(cptComPlusAssembly)) { - WcaLog(LOGMSG_VERBOSE, "skipping uninstall COM+ CustomAction, no ComPlusPartition, ComPlusApplication or ComPlusAssembly table present"); + WcaLog(LOGMSG_VERBOSE, "skipping uninstall COM+ CustomAction, no Wix4ComPlusPartition, Wix4ComPlusApplication or Wix4ComPlusAssembly table present"); ExitFunction1(hr = S_FALSE); } @@ -392,55 +378,55 @@ extern "C" UINT __stdcall ConfigureComPlusUninstall(MSIHANDLE hInstall) if (502 <= iVersionNT && CpiTableExists(cptComPlusPartition)) { hr = CpiPartitionsRead(&partList); - MessageExitOnFailure(hr, msierrComPlusPartitionReadFailed, "Failed to read ComPlusPartitions table"); + MessageExitOnFailure(hr, msierrComPlusPartitionReadFailed, "Failed to read Wix4ComPlusPartitions table"); } if (502 <= iVersionNT && CpiTableExists(cptComPlusPartitionRole)) { hr = CpiPartitionRolesRead(&partList, &partRoleList); - MessageExitOnFailure(hr, msierrComPlusPartitionRoleReadFailed, "Failed to read ComPlusPartitionRole table"); + MessageExitOnFailure(hr, msierrComPlusPartitionRoleReadFailed, "Failed to read Wix4ComPlusPartitionRole table"); } if (502 <= iVersionNT && (CpiTableExists(cptComPlusUserInPartitionRole) || CpiTableExists(cptComPlusGroupInPartitionRole))) { hr = CpiUsersInPartitionRolesRead(&partRoleList, &usrInPartRoleList); - MessageExitOnFailure(hr, msierrComPlusUserInPartitionRoleReadFailed, "Failed to read ComPlusUserInPartitionRole table"); + MessageExitOnFailure(hr, msierrComPlusUserInPartitionRoleReadFailed, "Failed to read Wix4ComPlusUserInPartitionRole table"); } if (502 <= iVersionNT && CpiTableExists(cptComPlusPartitionUser)) { hr = CpiPartitionUsersRead(&partList, &partUsrList); - MessageExitOnFailure(hr, msierrComPlusPartitionUserReadFailed, "Failed to read ComPlusPartitionUser table"); + MessageExitOnFailure(hr, msierrComPlusPartitionUserReadFailed, "Failed to read Wix4ComPlusPartitionUser table"); } if (CpiTableExists(cptComPlusApplication)) { hr = CpiApplicationsRead(&partList, &appList); - MessageExitOnFailure(hr, msierrComPlusApplicationReadFailed, "Failed to read ComPlusApplication table"); + MessageExitOnFailure(hr, msierrComPlusApplicationReadFailed, "Failed to read Wix4ComPlusApplication table"); } if (CpiTableExists(cptComPlusApplicationRole)) { hr = CpiApplicationRolesRead(&appList, &appRoleList); - MessageExitOnFailure(hr, msierrComPlusApplicationRoleReadFailed, "Failed to read ComPlusApplicationRole table"); + MessageExitOnFailure(hr, msierrComPlusApplicationRoleReadFailed, "Failed to read Wix4ComPlusApplicationRole table"); } if (CpiTableExists(cptComPlusUserInApplicationRole) || CpiTableExists(cptComPlusGroupInApplicationRole)) { hr = CpiUsersInApplicationRolesRead(&appRoleList, &usrInAppRoleList); - MessageExitOnFailure(hr, msierrComPlusUserInApplicationRoleReadFailed, "Failed to read ComPlusUserInApplicationRole table"); + MessageExitOnFailure(hr, msierrComPlusUserInApplicationRoleReadFailed, "Failed to read Wix4ComPlusUserInApplicationRole table"); } if (CpiTableExists(cptComPlusAssembly)) { hr = CpiAssembliesRead(&appList, &appRoleList, &asmList); - MessageExitOnFailure(hr, msierrComPlusAssembliesReadFailed, "Failed to read ComPlusAssembly table"); + MessageExitOnFailure(hr, msierrComPlusAssembliesReadFailed, "Failed to read Wix4ComPlusAssembly table"); } if (CpiTableExists(cptComPlusSubscription)) { hr = CpiSubscriptionsRead(&asmList, &subList); - MessageExitOnFailure(hr, msierrComPlusSubscriptionReadFailed, "Failed to read ComPlusSubscription table"); + MessageExitOnFailure(hr, msierrComPlusSubscriptionReadFailed, "Failed to read Wix4ComPlusSubscription table"); } // verify elements @@ -555,7 +541,7 @@ LExit: CpiAssemblyListFree(&asmList); CpiSubscriptionListFree(&subList); - // unitialize + // uninitialize CpiSchedFinalize(); if (fInitializedCom) diff --git a/src/ext/ComPlus/ca/cpsubsexec.cpp b/src/ext/ComPlus/ca/cpsubsexec.cpp index bbcf9853..ab32b856 100644 --- a/src/ext/ComPlus/ca/cpsubsexec.cpp +++ b/src/ext/ComPlus/ca/cpsubsexec.cpp @@ -54,7 +54,7 @@ HRESULT CpiConfigureSubscriptions( hr = CpiActionStartMessage(ppwzData, FALSE); ExitOnFailure(hr, "Failed to send action start message"); - // ger count + // get count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); @@ -127,7 +127,7 @@ HRESULT CpiRollbackConfigureSubscriptions( hr = CpiActionStartMessage(ppwzData, NULL == pRollbackDataList); ExitOnFailure(hr, "Failed to send action start message"); - // ger count + // get count int iCnt = 0; hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); diff --git a/src/ext/ComPlus/ca/cputilsched.cpp b/src/ext/ComPlus/ca/cputilsched.cpp index 4a2fdfc6..760b5ec9 100644 --- a/src/ext/ComPlus/ca/cputilsched.cpp +++ b/src/ext/ComPlus/ca/cputilsched.cpp @@ -53,31 +53,31 @@ void CpiSchedInitialize() // tables giTables = 0; - if (S_OK == WcaTableExists(L"ComPlusPartition")) giTables |= cptComPlusPartition; - if (S_OK == WcaTableExists(L"ComPlusPartitionProperty")) giTables |= cptComPlusPartitionProperty; - if (S_OK == WcaTableExists(L"ComPlusPartitionRole")) giTables |= cptComPlusPartitionRole; - if (S_OK == WcaTableExists(L"ComPlusUserInPartitionRole")) giTables |= cptComPlusUserInPartitionRole; - if (S_OK == WcaTableExists(L"ComPlusGroupInPartitionRole")) giTables |= cptComPlusGroupInPartitionRole; - if (S_OK == WcaTableExists(L"ComPlusPartitionUser")) giTables |= cptComPlusPartitionUser; - if (S_OK == WcaTableExists(L"ComPlusApplication")) giTables |= cptComPlusApplication; - if (S_OK == WcaTableExists(L"ComPlusApplicationProperty")) giTables |= cptComPlusApplicationProperty; - if (S_OK == WcaTableExists(L"ComPlusApplicationRole")) giTables |= cptComPlusApplicationRole; - if (S_OK == WcaTableExists(L"ComPlusApplicationRoleProperty")) giTables |= cptComPlusApplicationRoleProperty; - if (S_OK == WcaTableExists(L"ComPlusUserInApplicationRole")) giTables |= cptComPlusUserInApplicationRole; - if (S_OK == WcaTableExists(L"ComPlusGroupInApplicationRole")) giTables |= cptComPlusGroupInApplicationRole; - if (S_OK == WcaTableExists(L"ComPlusAssembly")) giTables |= cptComPlusAssembly; - if (S_OK == WcaTableExists(L"ComPlusAssemblyDependency")) giTables |= cptComPlusAssemblyDependency; - if (S_OK == WcaTableExists(L"ComPlusComponent")) giTables |= cptComPlusComponent; - if (S_OK == WcaTableExists(L"ComPlusComponentProperty")) giTables |= cptComPlusComponentProperty; - if (S_OK == WcaTableExists(L"ComPlusRoleForComponent")) giTables |= cptComPlusRoleForComponent; - if (S_OK == WcaTableExists(L"ComPlusInterface")) giTables |= cptComPlusInterface; - if (S_OK == WcaTableExists(L"ComPlusInterfaceProperty")) giTables |= cptComPlusInterfaceProperty; - if (S_OK == WcaTableExists(L"ComPlusRoleForInterface")) giTables |= cptComPlusRoleForInterface; - if (S_OK == WcaTableExists(L"ComPlusMethod")) giTables |= cptComPlusMethod; - if (S_OK == WcaTableExists(L"ComPlusMethodProperty")) giTables |= cptComPlusMethodProperty; - if (S_OK == WcaTableExists(L"ComPlusRoleForMethod")) giTables |= cptComPlusRoleForMethod; - if (S_OK == WcaTableExists(L"ComPlusSubscription")) giTables |= cptComPlusSubscription; - if (S_OK == WcaTableExists(L"ComPlusSubscriptionProperty")) giTables |= cptComPlusSubscriptionProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusPartition")) giTables |= cptComPlusPartition; + if (S_OK == WcaTableExists(L"Wix4ComPlusPartitionProperty")) giTables |= cptComPlusPartitionProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusPartitionRole")) giTables |= cptComPlusPartitionRole; + if (S_OK == WcaTableExists(L"Wix4ComPlusUserInPartitionRole")) giTables |= cptComPlusUserInPartitionRole; + if (S_OK == WcaTableExists(L"Wix4ComPlusGroupInPartitionRole")) giTables |= cptComPlusGroupInPartitionRole; + if (S_OK == WcaTableExists(L"Wix4ComPlusPartitionUser")) giTables |= cptComPlusPartitionUser; + if (S_OK == WcaTableExists(L"Wix4ComPlusApplication")) giTables |= cptComPlusApplication; + if (S_OK == WcaTableExists(L"Wix4ComPlusApplicationProperty")) giTables |= cptComPlusApplicationProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusApplicationRole")) giTables |= cptComPlusApplicationRole; + if (S_OK == WcaTableExists(L"Wix4ComPlusAppRoleProperty")) giTables |= cptComPlusApplicationRoleProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusUserInAppRole")) giTables |= cptComPlusUserInApplicationRole; + if (S_OK == WcaTableExists(L"Wix4ComPlusGroupInAppRole")) giTables |= cptComPlusGroupInApplicationRole; + if (S_OK == WcaTableExists(L"Wix4ComPlusAssembly")) giTables |= cptComPlusAssembly; + if (S_OK == WcaTableExists(L"Wix4ComPlusAssemblyDependency")) giTables |= cptComPlusAssemblyDependency; + if (S_OK == WcaTableExists(L"Wix4ComPlusComponent")) giTables |= cptComPlusComponent; + if (S_OK == WcaTableExists(L"Wix4ComPlusComponentProperty")) giTables |= cptComPlusComponentProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusRoleForComponent")) giTables |= cptComPlusRoleForComponent; + if (S_OK == WcaTableExists(L"Wix4ComPlusInterface")) giTables |= cptComPlusInterface; + if (S_OK == WcaTableExists(L"Wix4ComPlusInterfaceProperty")) giTables |= cptComPlusInterfaceProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusRoleForInterface")) giTables |= cptComPlusRoleForInterface; + if (S_OK == WcaTableExists(L"Wix4ComPlusMethod")) giTables |= cptComPlusMethod; + if (S_OK == WcaTableExists(L"Wix4ComPlusMethodProperty")) giTables |= cptComPlusMethodProperty; + if (S_OK == WcaTableExists(L"Wix4ComPlusRoleForMethod")) giTables |= cptComPlusRoleForMethod; + if (S_OK == WcaTableExists(L"Wix4ComPlusSubscription")) giTables |= cptComPlusSubscription; + if (S_OK == WcaTableExists(L"Wix4ComPlusSubscriptionProperty")) giTables |= cptComPlusSubscriptionProperty; } void CpiSchedFinalize() @@ -137,7 +137,7 @@ HRESULT CpiSchedGetCatalogCollection( hr = CpiSchedGetAdminCatalog(&piCatalog); ExitOnFailure(hr, "Failed to get COM+ admin catalog"); - // get collecton from catalog + // get collection from catalog hr = piCatalog->GetCollection(bstrName, &piDisp); ExitOnFailure(hr, "Failed to get collection"); diff --git a/src/ext/ComPlus/ca/precomp.h b/src/ext/ComPlus/ca/precomp.h index 74c328d2..97aa8e97 100644 --- a/src/ext/ComPlus/ca/precomp.h +++ b/src/ext/ComPlus/ca/precomp.h @@ -31,3 +31,5 @@ #include "cpapprolesched.h" #include "cpasmsched.h" #include "cpsubssched.h" + +#include "..\..\caDecor.h" diff --git a/src/ext/ComPlus/wixext/ComPlusTableDefinitions.cs b/src/ext/ComPlus/wixext/ComPlusTableDefinitions.cs index 6af5045c..cffaff0d 100644 --- a/src/ext/ComPlus/wixext/ComPlusTableDefinitions.cs +++ b/src/ext/ComPlus/wixext/ComPlusTableDefinitions.cs @@ -123,7 +123,7 @@ namespace WixToolset.ComPlus ); public static readonly TableDefinition ComPlusApplicationRoleProperty = new TableDefinition( - "Wix4ComPlusApplicationRoleProperty", + "Wix4ComPlusAppRoleProperty", ComPlusSymbolDefinitions.ComPlusApplicationRoleProperty, new[] { @@ -135,7 +135,7 @@ namespace WixToolset.ComPlus ); public static readonly TableDefinition ComPlusUserInApplicationRole = new TableDefinition( - "Wix4ComPlusUserInApplicationRole", + "Wix4ComPlusUserInAppRole", ComPlusSymbolDefinitions.ComPlusUserInApplicationRole, new[] { @@ -148,7 +148,7 @@ namespace WixToolset.ComPlus ); public static readonly TableDefinition ComPlusGroupInApplicationRole = new TableDefinition( - "Wix4ComPlusGroupInApplicationRole", + "Wix4ComPlusGroupInAppRole", ComPlusSymbolDefinitions.ComPlusGroupInApplicationRole, new[] { diff --git a/src/internal/SetBuildNumber/Directory.Packages.props.pp b/src/internal/SetBuildNumber/Directory.Packages.props.pp index 552aab87..4085568f 100644 --- a/src/internal/SetBuildNumber/Directory.Packages.props.pp +++ b/src/internal/SetBuildNumber/Directory.Packages.props.pp @@ -33,6 +33,7 @@ + diff --git a/src/test/burn/WixTestTools/RuntimeFactAttribute.cs b/src/test/burn/WixTestTools/RuntimeFactAttribute.cs index f73c87a2..573a9de2 100644 --- a/src/test/burn/WixTestTools/RuntimeFactAttribute.cs +++ b/src/test/burn/WixTestTools/RuntimeFactAttribute.cs @@ -5,6 +5,7 @@ namespace WixTestTools using System; using System.Security.Principal; using WixInternal.TestSupport.XunitExtensions; + using System.Runtime.InteropServices; public class RuntimeFactAttribute : SkippableFactAttribute { @@ -12,6 +13,16 @@ namespace WixTestTools public static bool RuntimeTestsEnabled { get; } public static bool RunningAsAdministrator { get; } + public static bool RunningOnWindowsServer { get; } + + [DllImport("shlwapi.dll", SetLastError = true, EntryPoint = "#437")] + private static extern bool IsOS(int os); + private static bool IsWindowsServer() + { + const int OS_ANYSERVER = 29; + return IsOS(OS_ANYSERVER); + } + static RuntimeFactAttribute() { @@ -21,6 +32,25 @@ namespace WixTestTools var testsEnabledString = Environment.GetEnvironmentVariable(RequiredEnvironmentVariableName); RuntimeTestsEnabled = Boolean.TryParse(testsEnabledString, out var testsEnabled) && testsEnabled; + + RunningOnWindowsServer = IsWindowsServer(); + } + + private bool _RequireWindowsServer; + public bool RequireWindowsServer + { + get + { + return _RequireWindowsServer; + } + set + { + _RequireWindowsServer = value; + if (_RequireWindowsServer && !RunningOnWindowsServer) + { + this.Skip = $"These tests are only run on Windows Server"; + } + } } public RuntimeFactAttribute() diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll new file mode 100644 index 00000000..b46be649 Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.dll differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb new file mode 100644 index 00000000..87419ee1 Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET3.tlb differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll new file mode 100644 index 00000000..e0fd3dee Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.dll differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb new file mode 100644 index 00000000..63647bdc Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNET4.tlb differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll new file mode 100644 index 00000000..dbcb5807 Binary files /dev/null and b/src/test/msi/TestData/ComPlusExtensionTests/Components/TestComponentNative.dll differ diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/InstallUninstallNET3WithoutPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs new file mode 100644 index 00000000..129669cc --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET3WithoutPartitions/product.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/InstallUninstallNET4WithoutPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs new file mode 100644 index 00000000..eabd7794 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNET4WithoutPartitions/product.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/InstallUninstallNativeWithoutPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs new file mode 100644 index 00000000..ee3c4d8f --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallNativeWithoutPartitions/product.wxs @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj new file mode 100644 index 00000000..19382c83 --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/InstallUninstallWithPartitions.wixproj @@ -0,0 +1,15 @@ + + + + + {A3E0B539-63F9-4B43-9E34-F33AE1C6E06D} + true + + + + + + + + + diff --git a/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs new file mode 100644 index 00000000..92dc892b --- /dev/null +++ b/src/test/msi/TestData/ComPlusExtensionTests/InstallUninstallWithPartitions/product.wxs @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs new file mode 100644 index 00000000..b143c19d --- /dev/null +++ b/src/test/msi/WixToolsetTest.MsiE2E/ComPlusExtensionTests.cs @@ -0,0 +1,50 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolsetTest.MsiE2E +{ + using System; + using WixTestTools; + using Xunit; + using Xunit.Abstractions; + + public class ComPlusExtensionTests : MsiE2ETests + { + public ComPlusExtensionTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } + + [RuntimeFact] + public void CanInstallUninstallNativeWithoutPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallNativeWithoutPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + + [RuntimeFact] + public void CanInstallUninstallNET3WithoutPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallNET3WithoutPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + + [RuntimeFact] + public void CanInstallUninstallNET4WithoutPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallNET4WithoutPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + + [RuntimeFact(RequireWindowsServer = true)] + public void CanInstallAndUninstallWithPartitions() + { + var product = this.CreatePackageInstaller("InstallUninstallWithPartitions"); + product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + + product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); + } + } +} -- cgit v1.2.3-55-g6feb