aboutsummaryrefslogtreecommitdiff
path: root/src/ca
diff options
context:
space:
mode:
authorBob Arnson <bob@joyofsetup.com>2020-05-25 21:49:38 -0400
committerBob Arnson <bob@firegiant.com>2020-05-25 21:57:21 -0400
commit3aa4f95a7ac23567efbaebdae57007636e7f6058 (patch)
treea6985084bc89fc842b0869c8cbbf8aece9bb1b67 /src/ca
parent27afde67e4bb9ad06f8722a83984a09236516f69 (diff)
downloadwix-3aa4f95a7ac23567efbaebdae57007636e7f6058.tar.gz
wix-3aa4f95a7ac23567efbaebdae57007636e7f6058.tar.bz2
wix-3aa4f95a7ac23567efbaebdae57007636e7f6058.zip
Support platform-specific CAs (including ARM64).
Diffstat (limited to 'src/ca')
-rw-r--r--src/ca/XmlConfig.cpp19
-rw-r--r--src/ca/XmlFile.cpp23
-rw-r--r--src/ca/qtexecca.cpp4
-rw-r--r--src/ca/scaperfexec.cpp6
-rw-r--r--src/ca/utilca.vcxproj26
5 files changed, 61 insertions, 17 deletions
diff --git a/src/ca/XmlConfig.cpp b/src/ca/XmlConfig.cpp
index 8c60979d..afd3dafb 100644
--- a/src/ca/XmlConfig.cpp
+++ b/src/ca/XmlConfig.cpp
@@ -588,8 +588,9 @@ extern "C" UINT __stdcall ExecXmlConfig(
588 HRESULT hrOpenFailure = S_OK; 588 HRESULT hrOpenFailure = S_OK;
589 UINT er = ERROR_SUCCESS; 589 UINT er = ERROR_SUCCESS;
590 590
591 BOOL fIsWow64Process = FALSE; 591#ifndef _WIN64
592 BOOL fIsFSRedirectDisabled = FALSE; 592 BOOL fIsFSRedirectDisabled = FALSE;
593#endif
593 BOOL fPreserveDate = FALSE; 594 BOOL fPreserveDate = FALSE;
594 595
595 LPWSTR pwzCustomActionData = NULL; 596 LPWSTR pwzCustomActionData = NULL;
@@ -635,10 +636,12 @@ extern "C" UINT __stdcall ExecXmlConfig(
635 hr = WcaReadIntegerFromCaData(&pwz, (int*) &xa); 636 hr = WcaReadIntegerFromCaData(&pwz, (int*) &xa);
636 ExitOnFailure(hr, "failed to process CustomActionData"); 637 ExitOnFailure(hr, "failed to process CustomActionData");
637 638
639#ifndef _WIN64
638 // Initialize the Wow64 API - store the result in fWow64APIPresent 640 // Initialize the Wow64 API - store the result in fWow64APIPresent
639 // If it fails, this doesn't warrant an error yet, because we only need the Wow64 API in some cases 641 // If it fails, this doesn't warrant an error yet, because we only need the Wow64 API in some cases
640 WcaInitializeWow64(); 642 WcaInitializeWow64();
641 fIsWow64Process = WcaIsWow64Process(); 643 BOOL fIsWow64Process = WcaIsWow64Process();
644#endif
642 645
643 if (xaOpenFile != xa && xaOpenFilex64 != xa) 646 if (xaOpenFile != xa && xaOpenFilex64 != xa)
644 { 647 {
@@ -657,6 +660,7 @@ extern "C" UINT __stdcall ExecXmlConfig(
657 // Open the file 660 // Open the file
658 ReleaseNullObject(pixd); 661 ReleaseNullObject(pixd);
659 662
663#ifndef _WIN64
660 if (xaOpenFilex64 == xa) 664 if (xaOpenFilex64 == xa)
661 { 665 {
662 if (!fIsWow64Process) 666 if (!fIsWow64Process)
@@ -670,6 +674,7 @@ extern "C" UINT __stdcall ExecXmlConfig(
670 674
671 fIsFSRedirectDisabled = TRUE; 675 fIsFSRedirectDisabled = TRUE;
672 } 676 }
677#endif
673 678
674 hr = XmlLoadDocumentFromFileEx(pwzFile, XML_LOAD_PRESERVE_WHITESPACE, &pixd); 679 hr = XmlLoadDocumentFromFileEx(pwzFile, XML_LOAD_PRESERVE_WHITESPACE, &pixd);
675 if (FAILED(hr)) 680 if (FAILED(hr))
@@ -945,15 +950,18 @@ extern "C" UINT __stdcall ExecXmlConfig(
945 ExitOnFailure(hr, "failed to set modified time of file : %ls", pwzFile); 950 ExitOnFailure(hr, "failed to set modified time of file : %ls", pwzFile);
946 } 951 }
947 952
953#ifndef _WIN64
948 if (fIsFSRedirectDisabled) 954 if (fIsFSRedirectDisabled)
949 { 955 {
950 fIsFSRedirectDisabled = FALSE; 956 fIsFSRedirectDisabled = FALSE;
951 WcaRevertWow64FSRedirection(); 957 WcaRevertWow64FSRedirection();
952 } 958 }
959#endif
953 } 960 }
954 } 961 }
955 962
956LExit: 963LExit:
964#ifndef _WIN64
957 // Make sure we revert FS Redirection if necessary before exiting 965 // Make sure we revert FS Redirection if necessary before exiting
958 if (fIsFSRedirectDisabled) 966 if (fIsFSRedirectDisabled)
959 { 967 {
@@ -961,6 +969,7 @@ LExit:
961 WcaRevertWow64FSRedirection(); 969 WcaRevertWow64FSRedirection();
962 } 970 }
963 WcaFinalizeWow64(); 971 WcaFinalizeWow64();
972#endif
964 973
965 ReleaseStr(pwzCustomActionData); 974 ReleaseStr(pwzCustomActionData);
966 ReleaseStr(pwzData); 975 ReleaseStr(pwzData);
@@ -1001,7 +1010,9 @@ extern "C" UINT __stdcall ExecXmlConfigRollback(
1001 UINT er = ERROR_SUCCESS; 1010 UINT er = ERROR_SUCCESS;
1002 1011
1003 int iIs64Bit; 1012 int iIs64Bit;
1013#ifndef _WIN64
1004 BOOL fIs64Bit = FALSE; 1014 BOOL fIs64Bit = FALSE;
1015#endif
1005 1016
1006 LPWSTR pwzCustomActionData = NULL; 1017 LPWSTR pwzCustomActionData = NULL;
1007 LPWSTR pwz = NULL; 1018 LPWSTR pwz = NULL;
@@ -1035,6 +1046,7 @@ extern "C" UINT __stdcall ExecXmlConfigRollback(
1035 hr = WcaReadStreamFromCaData(&pwz, &pbData, &cbData); 1046 hr = WcaReadStreamFromCaData(&pwz, &pbData, &cbData);
1036 ExitOnFailure(hr, "failed to read file contents from custom action data"); 1047 ExitOnFailure(hr, "failed to read file contents from custom action data");
1037 1048
1049#ifndef _WIN64
1038 fIs64Bit = (BOOL)iIs64Bit; 1050 fIs64Bit = (BOOL)iIs64Bit;
1039 1051
1040 if (fIs64Bit) 1052 if (fIs64Bit)
@@ -1055,6 +1067,7 @@ extern "C" UINT __stdcall ExecXmlConfigRollback(
1055 hr = WcaDisableWow64FSRedirection(); 1067 hr = WcaDisableWow64FSRedirection();
1056 ExitOnFailure(hr, "Custom action was told to rollback a 64-bit component, but was unable to Disable Filesystem Redirection through the Wow64 API."); 1068 ExitOnFailure(hr, "Custom action was told to rollback a 64-bit component, but was unable to Disable Filesystem Redirection through the Wow64 API.");
1057 } 1069 }
1070#endif
1058 1071
1059 hr = FileGetTime(pwzFileName, NULL, NULL, &ft); 1072 hr = FileGetTime(pwzFileName, NULL, NULL, &ft);
1060 ExitOnFailure(hr, "Failed to get modified date of file %ls.", pwzFileName); 1073 ExitOnFailure(hr, "Failed to get modified date of file %ls.", pwzFileName);
@@ -1082,11 +1095,13 @@ LExit:
1082 1095
1083 ReleaseFile(hFile); 1096 ReleaseFile(hFile);
1084 1097
1098#ifndef _WIN64
1085 if (fIs64Bit) 1099 if (fIs64Bit)
1086 { 1100 {
1087 WcaRevertWow64FSRedirection(); 1101 WcaRevertWow64FSRedirection();
1088 WcaFinalizeWow64(); 1102 WcaFinalizeWow64();
1089 } 1103 }
1104#endif
1090 1105
1091 ReleaseMem(pbData); 1106 ReleaseMem(pbData);
1092 1107
diff --git a/src/ca/XmlFile.cpp b/src/ca/XmlFile.cpp
index 95449126..71c9a390 100644
--- a/src/ca/XmlFile.cpp
+++ b/src/ca/XmlFile.cpp
@@ -464,9 +464,7 @@ LExit:
464 ReleaseStr(pwzCurrentFile); 464 ReleaseStr(pwzCurrentFile);
465 ReleaseStr(pwzCustomActionData); 465 ReleaseStr(pwzCustomActionData);
466 466
467 if (FAILED(hr)) 467 return WcaFinalize(FAILED(hr) ? ERROR_INSTALL_FAILURE : er);
468 er = ERROR_INSTALL_FAILURE;
469 return WcaFinalize(er);
470} 468}
471 469
472 470
@@ -483,7 +481,6 @@ extern "C" UINT __stdcall ExecXmlFile(
483 HRESULT hrOpenFailure = S_OK; 481 HRESULT hrOpenFailure = S_OK;
484 UINT er = ERROR_SUCCESS; 482 UINT er = ERROR_SUCCESS;
485 483
486 BOOL fIsWow64Process = FALSE;
487 BOOL fIsFSRedirectDisabled = FALSE; 484 BOOL fIsFSRedirectDisabled = FALSE;
488 BOOL fPreserveDate = FALSE; 485 BOOL fPreserveDate = FALSE;
489 486
@@ -533,10 +530,12 @@ extern "C" UINT __stdcall ExecXmlFile(
533 hr = WcaReadIntegerFromCaData(&pwz, (int*) &xa); 530 hr = WcaReadIntegerFromCaData(&pwz, (int*) &xa);
534 ExitOnFailure(hr, "failed to process CustomActionData"); 531 ExitOnFailure(hr, "failed to process CustomActionData");
535 532
533#ifndef _WIN64
536 // Initialize the Wow64 API - store the result in fWow64APIPresent 534 // Initialize the Wow64 API - store the result in fWow64APIPresent
537 // If it fails, this doesn't warrant an error yet, because we only need the Wow64 API in some cases 535 // If it fails, this doesn't warrant an error yet, because we only need the Wow64 API in some cases
538 WcaInitializeWow64(); 536 WcaInitializeWow64();
539 fIsWow64Process = WcaIsWow64Process(); 537 BOOL fIsWow64Process = WcaIsWow64Process();
538#endif
540 539
541 if (xaOpenFile != xa && xaOpenFilex64 != xa) 540 if (xaOpenFile != xa && xaOpenFilex64 != xa)
542 ExitOnFailure(hr = E_INVALIDARG, "invalid custom action data"); 541 ExitOnFailure(hr = E_INVALIDARG, "invalid custom action data");
@@ -558,6 +557,7 @@ extern "C" UINT __stdcall ExecXmlFile(
558 557
559 if (xaOpenFilex64 == xa) 558 if (xaOpenFilex64 == xa)
560 { 559 {
560#ifndef _WIN64
561 if (!fIsWow64Process) 561 if (!fIsWow64Process)
562 { 562 {
563 hr = E_NOTIMPL; 563 hr = E_NOTIMPL;
@@ -568,6 +568,7 @@ extern "C" UINT __stdcall ExecXmlFile(
568 ExitOnFailure(hr, "Custom action was told to act on a 64-bit component, but was unable to disable filesystem redirection through the Wow64 API."); 568 ExitOnFailure(hr, "Custom action was told to act on a 64-bit component, but was unable to disable filesystem redirection through the Wow64 API.");
569 569
570 fIsFSRedirectDisabled = TRUE; 570 fIsFSRedirectDisabled = TRUE;
571#endif
571 } 572 }
572 573
573 hr = XmlLoadDocumentFromFileEx(pwzFile, XML_LOAD_PRESERVE_WHITESPACE, &pixd); 574 hr = XmlLoadDocumentFromFileEx(pwzFile, XML_LOAD_PRESERVE_WHITESPACE, &pixd);
@@ -810,7 +811,9 @@ LExit:
810 fIsFSRedirectDisabled = FALSE; 811 fIsFSRedirectDisabled = FALSE;
811 WcaRevertWow64FSRedirection(); 812 WcaRevertWow64FSRedirection();
812 } 813 }
814#ifndef _WIN64
813 WcaFinalizeWow64(); 815 WcaFinalizeWow64();
816#endif
814 817
815 ReleaseStr(pwzCustomActionData); 818 ReleaseStr(pwzCustomActionData);
816 ReleaseStr(pwzData); 819 ReleaseStr(pwzData);
@@ -829,9 +832,7 @@ LExit:
829 832
830 XmlUninitialize(); 833 XmlUninitialize();
831 834
832 if (FAILED(hr)) 835 return WcaFinalize(FAILED(hr) ? ERROR_INSTALL_FAILURE : er);
833 er = ERROR_INSTALL_FAILURE;
834 return WcaFinalize(er);
835} 836}
836 837
837 838
@@ -882,6 +883,7 @@ extern "C" UINT __stdcall ExecXmlFileRollback(
882 hr = WcaReadStreamFromCaData(&pwz, &pbData, &cbData); 883 hr = WcaReadStreamFromCaData(&pwz, &pbData, &cbData);
883 ExitOnFailure(hr, "failed to read file contents from custom action data"); 884 ExitOnFailure(hr, "failed to read file contents from custom action data");
884 885
886#ifndef _WIN64
885 fIs64Bit = (BOOL)iIs64Bit; 887 fIs64Bit = (BOOL)iIs64Bit;
886 888
887 if (fIs64Bit) 889 if (fIs64Bit)
@@ -902,6 +904,7 @@ extern "C" UINT __stdcall ExecXmlFileRollback(
902 hr = WcaDisableWow64FSRedirection(); 904 hr = WcaDisableWow64FSRedirection();
903 ExitOnFailure(hr, "Custom action was told to rollback a 64-bit component, but was unable to Disable Filesystem Redirection through the Wow64 API."); 905 ExitOnFailure(hr, "Custom action was told to rollback a 64-bit component, but was unable to Disable Filesystem Redirection through the Wow64 API.");
904 } 906 }
907#endif
905 908
906 // Always preserve the modified date on rollback 909 // Always preserve the modified date on rollback
907 hr = FileGetTime(pwzFileName, NULL, NULL, &ft); 910 hr = FileGetTime(pwzFileName, NULL, NULL, &ft);
@@ -937,8 +940,6 @@ LExit:
937 940
938 ReleaseMem(pbData); 941 ReleaseMem(pbData);
939 942
940 if (FAILED(hr)) 943 return WcaFinalize(FAILED(hr) ? ERROR_INSTALL_FAILURE : er);
941 er = ERROR_INSTALL_FAILURE;
942 return WcaFinalize(er);
943} 944}
944 945
diff --git a/src/ca/qtexecca.cpp b/src/ca/qtexecca.cpp
index 6acad0bb..ddcc812f 100644
--- a/src/ca/qtexecca.cpp
+++ b/src/ca/qtexecca.cpp
@@ -131,6 +131,7 @@ HRESULT ExecCommon64(
131 HRESULT hr = S_OK; 131 HRESULT hr = S_OK;
132 LPWSTR pwzCommand = NULL; 132 LPWSTR pwzCommand = NULL;
133 DWORD dwTimeout = 0; 133 DWORD dwTimeout = 0;
134#ifndef _WIN64
134 BOOL fIsWow64Initialized = FALSE; 135 BOOL fIsWow64Initialized = FALSE;
135 BOOL fRedirected = FALSE; 136 BOOL fRedirected = FALSE;
136 137
@@ -145,6 +146,7 @@ HRESULT ExecCommon64(
145 hr = WcaDisableWow64FSRedirection(); 146 hr = WcaDisableWow64FSRedirection();
146 ExitOnFailure(hr, "Failed to enable filesystem redirection."); 147 ExitOnFailure(hr, "Failed to enable filesystem redirection.");
147 fRedirected = TRUE; 148 fRedirected = TRUE;
149#endif
148 150
149 hr = BuildCommandLine(wzArgumentsProperty, &pwzCommand); 151 hr = BuildCommandLine(wzArgumentsProperty, &pwzCommand);
150 ExitOnFailure(hr, "Failed to get Command Line"); 152 ExitOnFailure(hr, "Failed to get Command Line");
@@ -157,6 +159,7 @@ HRESULT ExecCommon64(
157LExit: 159LExit:
158 ReleaseStr(pwzCommand); 160 ReleaseStr(pwzCommand);
159 161
162#ifndef _WIN64
160 if (fRedirected) 163 if (fRedirected)
161 { 164 {
162 WcaRevertWow64FSRedirection(); 165 WcaRevertWow64FSRedirection();
@@ -166,6 +169,7 @@ LExit:
166 { 169 {
167 WcaFinalizeWow64(); 170 WcaFinalizeWow64();
168 } 171 }
172#endif
169 173
170 return hr; 174 return hr;
171} 175}
diff --git a/src/ca/scaperfexec.cpp b/src/ca/scaperfexec.cpp
index 04c0648a..c5425754 100644
--- a/src/ca/scaperfexec.cpp
+++ b/src/ca/scaperfexec.cpp
@@ -87,10 +87,10 @@ extern "C" UINT __stdcall RegisterPerfmon(
87 87
88 HMODULE hMod = NULL; 88 HMODULE hMod = NULL;
89 PFNPERFCOUNTERTEXTSTRINGS pfnPerfCounterTextString; 89 PFNPERFCOUNTERTEXTSTRINGS pfnPerfCounterTextString;
90 DWORD_PTR dwRet; 90 DWORD dwRet;
91 LPWSTR pwzShortPath = NULL; 91 LPWSTR pwzShortPath = NULL;
92 DWORD_PTR cchShortPath = MAX_PATH; 92 DWORD cchShortPath = MAX_PATH;
93 DWORD_PTR cchShortPathLength = 0; 93 DWORD cchShortPathLength = 0;
94 94
95 LPWSTR pwzCommand = NULL; 95 LPWSTR pwzCommand = NULL;
96 96
diff --git a/src/ca/utilca.vcxproj b/src/ca/utilca.vcxproj
index a2391880..38d209b2 100644
--- a/src/ca/utilca.vcxproj
+++ b/src/ca/utilca.vcxproj
@@ -6,6 +6,30 @@
6 <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.11\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.11\build\WixToolset.WcaUtil.props')" /> 6 <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.11\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.11\build\WixToolset.WcaUtil.props')" />
7 7
8 <ItemGroup Label="ProjectConfigurations"> 8 <ItemGroup Label="ProjectConfigurations">
9 <ProjectConfiguration Include="Debug|ARM">
10 <Configuration>Debug</Configuration>
11 <Platform>ARM</Platform>
12 </ProjectConfiguration>
13 <ProjectConfiguration Include="Release|ARM">
14 <Configuration>Release</Configuration>
15 <Platform>ARM</Platform>
16 </ProjectConfiguration>
17 <ProjectConfiguration Include="Debug|ARM64">
18 <Configuration>Debug</Configuration>
19 <Platform>ARM64</Platform>
20 </ProjectConfiguration>
21 <ProjectConfiguration Include="Release|ARM64">
22 <Configuration>Release</Configuration>
23 <Platform>ARM64</Platform>
24 </ProjectConfiguration>
25 <ProjectConfiguration Include="Debug|X64">
26 <Configuration>Debug</Configuration>
27 <Platform>X64</Platform>
28 </ProjectConfiguration>
29 <ProjectConfiguration Include="Release|X64">
30 <Configuration>Release</Configuration>
31 <Platform>X64</Platform>
32 </ProjectConfiguration>
9 <ProjectConfiguration Include="Debug|Win32"> 33 <ProjectConfiguration Include="Debug|Win32">
10 <Configuration>Debug</Configuration> 34 <Configuration>Debug</Configuration>
11 <Platform>Win32</Platform> 35 <Platform>Win32</Platform>
@@ -20,7 +44,7 @@
20 <ProjectGuid>{076018F7-19BD-423A-ABBF-229273DA08D8}</ProjectGuid> 44 <ProjectGuid>{076018F7-19BD-423A-ABBF-229273DA08D8}</ProjectGuid>
21 <ConfigurationType>DynamicLibrary</ConfigurationType> 45 <ConfigurationType>DynamicLibrary</ConfigurationType>
22 <TargetName>utilca</TargetName> 46 <TargetName>utilca</TargetName>
23 <PlatformToolset>v141</PlatformToolset> 47 <PlatformToolset>v142</PlatformToolset>
24 <CharacterSet>Unicode</CharacterSet> 48 <CharacterSet>Unicode</CharacterSet>
25 <ProjectModuleDefinitionFile>utilca.def</ProjectModuleDefinitionFile> 49 <ProjectModuleDefinitionFile>utilca.def</ProjectModuleDefinitionFile>
26 <Description>WiX Toolset Util CustomAction</Description> 50 <Description>WiX Toolset Util CustomAction</Description>