diff options
Diffstat (limited to 'src/ca/scamanifest.cpp')
-rw-r--r-- | src/ca/scamanifest.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/ca/scamanifest.cpp b/src/ca/scamanifest.cpp index 58b4054d..adb8d3d3 100644 --- a/src/ca/scamanifest.cpp +++ b/src/ca/scamanifest.cpp | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | LPCWSTR vcsPerfmonManifestQuery = L"SELECT `Component_`, `File`, `ResourceFileDirectory` FROM `PerfmonManifest`"; | 5 | LPCWSTR vcsPerfmonManifestQuery = L"SELECT `Component_`, `File`, `ResourceFileDirectory` FROM `Wix4PerfmonManifest`"; |
6 | LPCWSTR vcsEventManifestQuery = L"SELECT `Component_`, `File` FROM `EventManifest`"; | 6 | LPCWSTR vcsEventManifestQuery = L"SELECT `Component_`, `File` FROM `Wix4EventManifest`"; |
7 | enum ePerfMonManifestQuery { pfmComponent = 1, pfmFile, pfmResourceFileDir }; | 7 | enum ePerfMonManifestQuery { pfmComponent = 1, pfmFile, pfmResourceFileDir }; |
8 | enum eEventManifestQuery { emComponent = 1, emFile}; | 8 | enum eEventManifestQuery { emComponent = 1, emFile}; |
9 | 9 | ||
@@ -46,9 +46,9 @@ extern "C" UINT __stdcall ConfigurePerfmonManifestRegister( | |||
46 | ExitFunction1(hr = S_FALSE); | 46 | ExitFunction1(hr = S_FALSE); |
47 | } | 47 | } |
48 | // check to see if necessary tables are specified | 48 | // check to see if necessary tables are specified |
49 | if (S_OK != WcaTableExists(L"PerfmonManifest")) | 49 | if (S_OK != WcaTableExists(L"Wix4PerfmonManifest")) |
50 | { | 50 | { |
51 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigurePerfmonManifestRegister() because PerfmonManifest table not present"); | 51 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigurePerfmonManifestRegister() because Wix4PerfmonManifest table not present"); |
52 | ExitFunction1(hr = S_FALSE); | 52 | ExitFunction1(hr = S_FALSE); |
53 | } | 53 | } |
54 | 54 | ||
@@ -79,7 +79,7 @@ extern "C" UINT __stdcall ConfigurePerfmonManifestRegister( | |||
79 | hr = StrAllocFormatted(&pwzCommand, L"\"unlodctr.exe\" /m:\"%s\"", pwzFile); | 79 | hr = StrAllocFormatted(&pwzCommand, L"\"unlodctr.exe\" /m:\"%s\"", pwzFile); |
80 | ExitOnFailure(hr, "failed to copy string in PerfMonManifest"); | 80 | ExitOnFailure(hr, "failed to copy string in PerfMonManifest"); |
81 | 81 | ||
82 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackRegisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); | 82 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackRegisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); |
83 | ExitOnFailure(hr, "failed to schedule RollbackRegisterPerfmonManifest action"); | 83 | ExitOnFailure(hr, "failed to schedule RollbackRegisterPerfmonManifest action"); |
84 | 84 | ||
85 | if ( *pwzResourceFilePath ) | 85 | if ( *pwzResourceFilePath ) |
@@ -95,7 +95,7 @@ extern "C" UINT __stdcall ConfigurePerfmonManifestRegister( | |||
95 | 95 | ||
96 | WcaLog(LOGMSG_VERBOSE, "RegisterPerfmonManifest's CustomActionData: '%ls'", pwzCommand); | 96 | WcaLog(LOGMSG_VERBOSE, "RegisterPerfmonManifest's CustomActionData: '%ls'", pwzCommand); |
97 | 97 | ||
98 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RegisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_REGISTER); | 98 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RegisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_REGISTER); |
99 | ExitOnFailure(hr, "failed to schedule RegisterPerfmonManifest action"); | 99 | ExitOnFailure(hr, "failed to schedule RegisterPerfmonManifest action"); |
100 | } | 100 | } |
101 | 101 | ||
@@ -143,40 +143,40 @@ extern "C" UINT __stdcall ConfigurePerfmonManifestUnregister( | |||
143 | ExitFunction1(hr = S_FALSE); | 143 | ExitFunction1(hr = S_FALSE); |
144 | } | 144 | } |
145 | // check to see if necessary tables are specified | 145 | // check to see if necessary tables are specified |
146 | if (WcaTableExists(L"PerfmonManifest") != S_OK) | 146 | if (WcaTableExists(L"Wix4PerfmonManifest") != S_OK) |
147 | { | 147 | { |
148 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigurePerfmonManifestUnregister() because PerfmonManifest table not present"); | 148 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigurePerfmonManifestUnregister() because Wix4PerfmonManifest table not present"); |
149 | ExitFunction1(hr = S_FALSE); | 149 | ExitFunction1(hr = S_FALSE); |
150 | } | 150 | } |
151 | 151 | ||
152 | hr = WcaOpenExecuteView(vcsPerfmonManifestQuery, &hView); | 152 | hr = WcaOpenExecuteView(vcsPerfmonManifestQuery, &hView); |
153 | ExitOnFailure(hr, "failed to open view on PerfMonManifest table"); | 153 | ExitOnFailure(hr, "failed to open view on Wix4PerfmonManifest table"); |
154 | while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK) | 154 | while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK) |
155 | { | 155 | { |
156 | // get component install state | 156 | // get component install state |
157 | hr = WcaGetRecordString(hRec, pfmComponent, &pwzData); | 157 | hr = WcaGetRecordString(hRec, pfmComponent, &pwzData); |
158 | ExitOnFailure(hr, "failed to get Component for PerfMonManifest"); | 158 | ExitOnFailure(hr, "failed to get Component for Wix4PerfmonManifest"); |
159 | er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction); | 159 | er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction); |
160 | hr = HRESULT_FROM_WIN32(er); | 160 | hr = HRESULT_FROM_WIN32(er); |
161 | ExitOnFailure(hr, "failed to get Component state for PerfMonManifest"); | 161 | ExitOnFailure(hr, "failed to get Component state for Wix4PerfmonManifest"); |
162 | if (!WcaIsUninstalling(isInstalled, isAction)) | 162 | if (!WcaIsUninstalling(isInstalled, isAction)) |
163 | { | 163 | { |
164 | continue; | 164 | continue; |
165 | } | 165 | } |
166 | 166 | ||
167 | hr = WcaGetRecordFormattedString(hRec, pfmFile, &pwzFile); | 167 | hr = WcaGetRecordFormattedString(hRec, pfmFile, &pwzFile); |
168 | ExitOnFailure(hr, "failed to get File for PerfMonManifest"); | 168 | ExitOnFailure(hr, "failed to get File for Wix4PerfmonManifest"); |
169 | 169 | ||
170 | hr = WcaGetRecordFormattedString(hRec, pfmResourceFileDir, &pwzResourceFilePath); | 170 | hr = WcaGetRecordFormattedString(hRec, pfmResourceFileDir, &pwzResourceFilePath); |
171 | ExitOnFailure(hr, "failed to get ApplicationIdentity for PerfMonManifest"); | 171 | ExitOnFailure(hr, "failed to get ApplicationIdentity for Wix4PerfmonManifest"); |
172 | size_t iResourcePath = lstrlenW(pwzResourceFilePath); | 172 | size_t iResourcePath = lstrlenW(pwzResourceFilePath); |
173 | if ( iResourcePath > 0 && *(pwzResourceFilePath + iResourcePath -1) == L'\\') | 173 | if ( iResourcePath > 0 && *(pwzResourceFilePath + iResourcePath -1) == L'\\') |
174 | *(pwzResourceFilePath + iResourcePath -1) = 0; //remove the trailing '\' | 174 | *(pwzResourceFilePath + iResourcePath -1) = 0; //remove the trailing '\' |
175 | 175 | ||
176 | hr = StrAllocFormatted(&pwzCommand, L"\"lodctr.exe\" /m:\"%s\" \"%s\"", pwzFile, pwzResourceFilePath); | 176 | hr = StrAllocFormatted(&pwzCommand, L"\"lodctr.exe\" /m:\"%s\" \"%s\"", pwzFile, pwzResourceFilePath); |
177 | ExitOnFailure(hr, "failed to copy string in PerfMonManifest"); | 177 | ExitOnFailure(hr, "failed to copy string in Wix4PerfmonManifest"); |
178 | 178 | ||
179 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackUnregisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_REGISTER); | 179 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackUnregisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_REGISTER); |
180 | ExitOnFailure(hr, "failed to schedule RollbackUnregisterPerfmonManifest action"); | 180 | ExitOnFailure(hr, "failed to schedule RollbackUnregisterPerfmonManifest action"); |
181 | 181 | ||
182 | hr = StrAllocFormatted(&pwzCommand, L"\"unlodctr.exe\" /m:\"%s\"", pwzFile); | 182 | hr = StrAllocFormatted(&pwzCommand, L"\"unlodctr.exe\" /m:\"%s\"", pwzFile); |
@@ -184,7 +184,7 @@ extern "C" UINT __stdcall ConfigurePerfmonManifestUnregister( | |||
184 | 184 | ||
185 | WcaLog(LOGMSG_VERBOSE, "UnRegisterPerfmonManifest's CustomActionData: '%ls'", pwzCommand); | 185 | WcaLog(LOGMSG_VERBOSE, "UnRegisterPerfmonManifest's CustomActionData: '%ls'", pwzCommand); |
186 | 186 | ||
187 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"UnregisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); | 187 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"UnregisterPerfmonManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); |
188 | ExitOnFailure(hr, "failed to schedule UnregisterPerfmonManifest action"); | 188 | ExitOnFailure(hr, "failed to schedule UnregisterPerfmonManifest action"); |
189 | } | 189 | } |
190 | 190 | ||
@@ -231,41 +231,41 @@ extern "C" UINT __stdcall ConfigureEventManifestRegister( | |||
231 | ExitFunction1(hr = S_FALSE); | 231 | ExitFunction1(hr = S_FALSE); |
232 | } | 232 | } |
233 | // check to see if necessary tables are specified | 233 | // check to see if necessary tables are specified |
234 | if (S_OK != WcaTableExists(L"EventManifest")) | 234 | if (S_OK != WcaTableExists(L"Wix4EventManifest")) |
235 | { | 235 | { |
236 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigureEventManifestRegister() because EventManifest table not present"); | 236 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigureEventManifestRegister() because Wix4EventManifest table not present"); |
237 | ExitFunction1(hr = S_FALSE); | 237 | ExitFunction1(hr = S_FALSE); |
238 | } | 238 | } |
239 | 239 | ||
240 | hr = WcaOpenExecuteView(vcsEventManifestQuery, &hView); | 240 | hr = WcaOpenExecuteView(vcsEventManifestQuery, &hView); |
241 | ExitOnFailure(hr, "failed to open view on EventManifest table"); | 241 | ExitOnFailure(hr, "failed to open view on Wix4EventManifest table"); |
242 | while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK) | 242 | while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK) |
243 | { | 243 | { |
244 | // get component install state | 244 | // get component install state |
245 | hr = WcaGetRecordString(hRec, emComponent, &pwzData); | 245 | hr = WcaGetRecordString(hRec, emComponent, &pwzData); |
246 | ExitOnFailure(hr, "failed to get Component for EventManifest"); | 246 | ExitOnFailure(hr, "failed to get Component for Wix4EventManifest"); |
247 | er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction); | 247 | er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction); |
248 | hr = HRESULT_FROM_WIN32(er); | 248 | hr = HRESULT_FROM_WIN32(er); |
249 | ExitOnFailure(hr, "failed to get Component state for EventManifest"); | 249 | ExitOnFailure(hr, "failed to get Component state for Wix4EventManifest"); |
250 | if (!WcaIsInstalling(isInstalled, isAction)) | 250 | if (!WcaIsInstalling(isInstalled, isAction)) |
251 | { | 251 | { |
252 | continue; | 252 | continue; |
253 | } | 253 | } |
254 | 254 | ||
255 | hr = WcaGetRecordFormattedString(hRec, emFile, &pwzFile); | 255 | hr = WcaGetRecordFormattedString(hRec, emFile, &pwzFile); |
256 | ExitOnFailure(hr, "failed to get File for EventManifest"); | 256 | ExitOnFailure(hr, "failed to get File for Wix4EventManifest"); |
257 | 257 | ||
258 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" um \"%s\"", pwzFile); | 258 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" um \"%s\"", pwzFile); |
259 | ExitOnFailure(hr, "failed to copy string in EventManifest"); | 259 | ExitOnFailure(hr, "failed to copy string in Wix4EventManifest"); |
260 | 260 | ||
261 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackRegisterEventManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); | 261 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackRegisterEventManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); |
262 | ExitOnFailure(hr, "failed to schedule RollbackRegisterEventManifest action"); | 262 | ExitOnFailure(hr, "failed to schedule RollbackRegisterEventManifest action"); |
263 | 263 | ||
264 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" im \"%s\"", pwzFile); | 264 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" im \"%s\"", pwzFile); |
265 | ExitOnFailure(hr, "failed to copy string in EventManifest"); | 265 | ExitOnFailure(hr, "failed to copy string in Wix4EventManifest"); |
266 | WcaLog(LOGMSG_VERBOSE, "RegisterEventManifest's CustomActionData: '%ls'", pwzCommand); | 266 | WcaLog(LOGMSG_VERBOSE, "RegisterEventManifest's CustomActionData: '%ls'", pwzCommand); |
267 | 267 | ||
268 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RegisterEventManifest"), pwzCommand, COST_EVENTMANIFEST_REGISTER); | 268 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RegisterEventManifest"), pwzCommand, COST_EVENTMANIFEST_REGISTER); |
269 | ExitOnFailure(hr, "failed to schedule RegisterEventManifest action"); | 269 | ExitOnFailure(hr, "failed to schedule RegisterEventManifest action"); |
270 | } | 270 | } |
271 | 271 | ||
@@ -273,7 +273,7 @@ extern "C" UINT __stdcall ConfigureEventManifestRegister( | |||
273 | { | 273 | { |
274 | hr = S_OK; | 274 | hr = S_OK; |
275 | } | 275 | } |
276 | ExitOnFailure(hr, "Failure while processing EventManifest"); | 276 | ExitOnFailure(hr, "Failure while processing Wix4EventManifest"); |
277 | 277 | ||
278 | hr = S_OK; | 278 | hr = S_OK; |
279 | 279 | ||
@@ -313,22 +313,22 @@ extern "C" UINT __stdcall ConfigureEventManifestUnregister( | |||
313 | ExitFunction1(hr = S_FALSE); | 313 | ExitFunction1(hr = S_FALSE); |
314 | } | 314 | } |
315 | // check to see if necessary tables are specified | 315 | // check to see if necessary tables are specified |
316 | if (S_OK != WcaTableExists(L"EventManifest")) | 316 | if (S_OK != WcaTableExists(L"Wix4EventManifest")) |
317 | { | 317 | { |
318 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigureEventManifestUnregister() because EventManifest table not present"); | 318 | WcaLog(LOGMSG_VERBOSE, "Skipping ConfigureEventManifestUnregister() because Wix4EventManifest table not present"); |
319 | ExitFunction1(hr = S_FALSE); | 319 | ExitFunction1(hr = S_FALSE); |
320 | } | 320 | } |
321 | 321 | ||
322 | hr = WcaOpenExecuteView(vcsEventManifestQuery, &hView); | 322 | hr = WcaOpenExecuteView(vcsEventManifestQuery, &hView); |
323 | ExitOnFailure(hr, "failed to open view on EventManifest table"); | 323 | ExitOnFailure(hr, "failed to open view on Wix4EventManifest table"); |
324 | while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK) | 324 | while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK) |
325 | { | 325 | { |
326 | // get component install state | 326 | // get component install state |
327 | hr = WcaGetRecordString(hRec, emComponent, &pwzData); | 327 | hr = WcaGetRecordString(hRec, emComponent, &pwzData); |
328 | ExitOnFailure(hr, "failed to get Component for EventManifest"); | 328 | ExitOnFailure(hr, "failed to get Component for Wix4EventManifest"); |
329 | er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction); | 329 | er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction); |
330 | hr = HRESULT_FROM_WIN32(er); | 330 | hr = HRESULT_FROM_WIN32(er); |
331 | ExitOnFailure(hr, "failed to get Component state for EventManifest"); | 331 | ExitOnFailure(hr, "failed to get Component state for Wix4EventManifest"); |
332 | 332 | ||
333 | // nothing to do on an install | 333 | // nothing to do on an install |
334 | // schedule the rollback action when reinstalling to re-register pre-patch manifest | 334 | // schedule the rollback action when reinstalling to re-register pre-patch manifest |
@@ -338,22 +338,22 @@ extern "C" UINT __stdcall ConfigureEventManifestUnregister( | |||
338 | } | 338 | } |
339 | 339 | ||
340 | hr = WcaGetRecordFormattedString(hRec, emFile, &pwzFile); | 340 | hr = WcaGetRecordFormattedString(hRec, emFile, &pwzFile); |
341 | ExitOnFailure(hr, "failed to get File for EventManifest"); | 341 | ExitOnFailure(hr, "failed to get File for Wix4EventManifest"); |
342 | 342 | ||
343 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" im \"%s\"", pwzFile); | 343 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" im \"%s\"", pwzFile); |
344 | ExitOnFailure(hr, "failed to copy string in EventManifest"); | 344 | ExitOnFailure(hr, "failed to copy string in Wix4EventManifest"); |
345 | 345 | ||
346 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackUnregisterEventManifest"), pwzCommand, COST_PERFMONMANIFEST_REGISTER); | 346 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackUnregisterEventManifest"), pwzCommand, COST_PERFMONMANIFEST_REGISTER); |
347 | ExitOnFailure(hr, "failed to schedule RollbackUnregisterEventManifest action"); | 347 | ExitOnFailure(hr, "failed to schedule RollbackUnregisterEventManifest action"); |
348 | 348 | ||
349 | // no need to uninstall on a repair/patch. Register action will re-register and update the manifest. | 349 | // no need to uninstall on a repair/patch. Register action will re-register and update the manifest. |
350 | if (!WcaIsReInstalling(isInstalled, isAction)) | 350 | if (!WcaIsReInstalling(isInstalled, isAction)) |
351 | { | 351 | { |
352 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" um \"%s\"", pwzFile); | 352 | hr = StrAllocFormatted(&pwzCommand, L"\"wevtutil.exe\" um \"%s\"", pwzFile); |
353 | ExitOnFailure(hr, "failed to copy string in EventManifest"); | 353 | ExitOnFailure(hr, "failed to copy string in Wix4EventManifest"); |
354 | WcaLog(LOGMSG_VERBOSE, "UnregisterEventManifest's CustomActionData: '%ls'", pwzCommand); | 354 | WcaLog(LOGMSG_VERBOSE, "UnregisterEventManifest's CustomActionData: '%ls'", pwzCommand); |
355 | 355 | ||
356 | hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"UnregisterEventManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); | 356 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"UnregisterEventManifest"), pwzCommand, COST_PERFMONMANIFEST_UNREGISTER); |
357 | ExitOnFailure(hr, "failed to schedule UnregisterEventManifest action"); | 357 | ExitOnFailure(hr, "failed to schedule UnregisterEventManifest action"); |
358 | } | 358 | } |
359 | } | 359 | } |
@@ -362,7 +362,7 @@ extern "C" UINT __stdcall ConfigureEventManifestUnregister( | |||
362 | { | 362 | { |
363 | hr = S_OK; | 363 | hr = S_OK; |
364 | } | 364 | } |
365 | ExitOnFailure(hr, "Failure while processing EventManifest"); | 365 | ExitOnFailure(hr, "Failure while processing Wix4EventManifest"); |
366 | 366 | ||
367 | hr = S_OK; | 367 | hr = S_OK; |
368 | 368 | ||