diff options
author | Rob Mensching <rob@firegiant.com> | 2024-07-17 11:09:34 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-07-17 12:15:00 -0700 |
commit | 8fb5d579e8cf5eb0f93d07a73bf318a8969c6b10 (patch) | |
tree | b9640c71b55bf81d63b9978b8583ac5d839bf6ee /src/ext | |
parent | bb975d370a6a7398c4d28d23601b20ada7a7cdfe (diff) | |
download | wix-8fb5d579e8cf5eb0f93d07a73bf318a8969c6b10.tar.gz wix-8fb5d579e8cf5eb0f93d07a73bf318a8969c6b10.tar.bz2 wix-8fb5d579e8cf5eb0f93d07a73bf318a8969c6b10.zip |
Initialize WOW64 in TouchFile custom action
Fixes 8638
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/Util/ca/TouchFile.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/ext/Util/ca/TouchFile.cpp b/src/ext/Util/ca/TouchFile.cpp index 2c3918af..4a3b57b4 100644 --- a/src/ext/Util/ca/TouchFile.cpp +++ b/src/ext/Util/ca/TouchFile.cpp | |||
@@ -23,6 +23,7 @@ static HRESULT SetExistingFileModifiedTime( | |||
23 | ) | 23 | ) |
24 | { | 24 | { |
25 | HRESULT hr = S_OK; | 25 | HRESULT hr = S_OK; |
26 | #ifndef _WIN64 | ||
26 | BOOL fReenableFileSystemRedirection = FALSE; | 27 | BOOL fReenableFileSystemRedirection = FALSE; |
27 | 28 | ||
28 | if (f64Bit) | 29 | if (f64Bit) |
@@ -32,14 +33,20 @@ static HRESULT SetExistingFileModifiedTime( | |||
32 | 33 | ||
33 | fReenableFileSystemRedirection = TRUE; | 34 | fReenableFileSystemRedirection = TRUE; |
34 | } | 35 | } |
36 | #else | ||
37 | UNREFERENCED_PARAMETER(wzId); | ||
38 | UNREFERENCED_PARAMETER(f64Bit); | ||
39 | #endif | ||
35 | 40 | ||
36 | hr = FileSetTime(wzPath, NULL, NULL, pftModified); | 41 | hr = FileSetTime(wzPath, NULL, NULL, pftModified); |
37 | 42 | ||
43 | #ifndef _WIN64 | ||
38 | LExit: | 44 | LExit: |
39 | if (fReenableFileSystemRedirection) | 45 | if (fReenableFileSystemRedirection) |
40 | { | 46 | { |
41 | WcaRevertWow64FSRedirection(); | 47 | WcaRevertWow64FSRedirection(); |
42 | } | 48 | } |
49 | #endif | ||
43 | 50 | ||
44 | return hr; | 51 | return hr; |
45 | } | 52 | } |
@@ -83,6 +90,7 @@ static BOOL TryGetExistingFileModifiedTime( | |||
83 | ) | 90 | ) |
84 | { | 91 | { |
85 | HRESULT hr = S_OK; | 92 | HRESULT hr = S_OK; |
93 | #ifndef _WIN64 | ||
86 | BOOL fReenableFileSystemRedirection = FALSE; | 94 | BOOL fReenableFileSystemRedirection = FALSE; |
87 | 95 | ||
88 | if (f64Bit) | 96 | if (f64Bit) |
@@ -92,6 +100,10 @@ static BOOL TryGetExistingFileModifiedTime( | |||
92 | 100 | ||
93 | fReenableFileSystemRedirection = TRUE; | 101 | fReenableFileSystemRedirection = TRUE; |
94 | } | 102 | } |
103 | #else | ||
104 | UNREFERENCED_PARAMETER(wzId); | ||
105 | UNREFERENCED_PARAMETER(f64Bit); | ||
106 | #endif | ||
95 | 107 | ||
96 | hr = FileGetTime(wzPath, NULL, NULL, pftModified); | 108 | hr = FileGetTime(wzPath, NULL, NULL, pftModified); |
97 | if (E_PATHNOTFOUND == hr || E_FILENOTFOUND == hr) | 109 | if (E_PATHNOTFOUND == hr || E_FILENOTFOUND == hr) |
@@ -104,11 +116,13 @@ static BOOL TryGetExistingFileModifiedTime( | |||
104 | WcaLog(LOGMSG_STANDARD, "Cannot access modified timestamp for file: '%ls' due to error: 0x%x. Continuing with out rollback for: %ls", wzPath, hr, wzId); | 116 | WcaLog(LOGMSG_STANDARD, "Cannot access modified timestamp for file: '%ls' due to error: 0x%x. Continuing with out rollback for: %ls", wzPath, hr, wzId); |
105 | } | 117 | } |
106 | 118 | ||
119 | #ifndef _WIN64 | ||
107 | LExit: | 120 | LExit: |
108 | if (fReenableFileSystemRedirection) | 121 | if (fReenableFileSystemRedirection) |
109 | { | 122 | { |
110 | WcaRevertWow64FSRedirection(); | 123 | WcaRevertWow64FSRedirection(); |
111 | } | 124 | } |
125 | #endif | ||
112 | 126 | ||
113 | return SUCCEEDED(hr); | 127 | return SUCCEEDED(hr); |
114 | } | 128 | } |
@@ -217,9 +231,17 @@ extern "C" UINT WINAPI WixTouchFileDuringInstall( | |||
217 | hr = WcaInitialize(hInstall, "WixTouchFileDuringInstall"); | 231 | hr = WcaInitialize(hInstall, "WixTouchFileDuringInstall"); |
218 | ExitOnFailure(hr, "Failed to initialize WixTouchFileDuringInstall."); | 232 | ExitOnFailure(hr, "Failed to initialize WixTouchFileDuringInstall."); |
219 | 233 | ||
234 | #ifndef _WIN64 | ||
235 | WcaInitializeWow64(); | ||
236 | #endif | ||
237 | |||
220 | hr = ProcessTouchFileTable(TRUE); | 238 | hr = ProcessTouchFileTable(TRUE); |
221 | 239 | ||
222 | LExit: | 240 | LExit: |
241 | #ifndef _WIN64 | ||
242 | WcaFinalizeWow64(); | ||
243 | #endif | ||
244 | |||
223 | DWORD er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; | 245 | DWORD er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; |
224 | return WcaFinalize(er); | 246 | return WcaFinalize(er); |
225 | } | 247 | } |
@@ -236,9 +258,17 @@ extern "C" UINT WINAPI WixTouchFileDuringUninstall( | |||
236 | hr = WcaInitialize(hInstall, "WixTouchFileDuringUninstall"); | 258 | hr = WcaInitialize(hInstall, "WixTouchFileDuringUninstall"); |
237 | ExitOnFailure(hr, "Failed to initialize WixTouchFileDuringUninstall."); | 259 | ExitOnFailure(hr, "Failed to initialize WixTouchFileDuringUninstall."); |
238 | 260 | ||
261 | #ifndef _WIN64 | ||
262 | WcaInitializeWow64(); | ||
263 | #endif | ||
264 | |||
239 | hr = ProcessTouchFileTable(FALSE); | 265 | hr = ProcessTouchFileTable(FALSE); |
240 | 266 | ||
241 | LExit: | 267 | LExit: |
268 | #ifndef _WIN64 | ||
269 | WcaFinalizeWow64(); | ||
270 | #endif | ||
271 | |||
242 | DWORD er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; | 272 | DWORD er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; |
243 | return WcaFinalize(er); | 273 | return WcaFinalize(er); |
244 | } | 274 | } |
@@ -261,6 +291,10 @@ extern "C" UINT WINAPI WixExecuteTouchFile( | |||
261 | hr = WcaInitialize(hInstall, "WixExecuteTouchFile"); | 291 | hr = WcaInitialize(hInstall, "WixExecuteTouchFile"); |
262 | ExitOnFailure(hr, "Failed to initialize WixExecuteTouchFile."); | 292 | ExitOnFailure(hr, "Failed to initialize WixExecuteTouchFile."); |
263 | 293 | ||
294 | #ifndef _WIN64 | ||
295 | WcaInitializeWow64(); | ||
296 | #endif | ||
297 | |||
264 | hr = WcaGetProperty(L"CustomActionData", &sczData); | 298 | hr = WcaGetProperty(L"CustomActionData", &sczData); |
265 | ExitOnFailure(hr, "Failed to get custom action data for WixExecuteTouchFile."); | 299 | ExitOnFailure(hr, "Failed to get custom action data for WixExecuteTouchFile."); |
266 | 300 | ||
@@ -299,6 +333,10 @@ extern "C" UINT WINAPI WixExecuteTouchFile( | |||
299 | } | 333 | } |
300 | 334 | ||
301 | LExit: | 335 | LExit: |
336 | #ifndef _WIN64 | ||
337 | WcaFinalizeWow64(); | ||
338 | #endif | ||
339 | |||
302 | ReleaseStr(sczPath); | 340 | ReleaseStr(sczPath); |
303 | ReleaseStr(sczId); | 341 | ReleaseStr(sczId); |
304 | ReleaseStr(sczData); | 342 | ReleaseStr(sczData); |