aboutsummaryrefslogtreecommitdiff
path: root/src/ca/CloseApps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ca/CloseApps.cpp')
-rw-r--r--src/ca/CloseApps.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/ca/CloseApps.cpp b/src/ca/CloseApps.cpp
index a3f28ed3..63be353c 100644
--- a/src/ca/CloseApps.cpp
+++ b/src/ca/CloseApps.cpp
@@ -4,10 +4,8 @@
4 4
5#define DEFAULT_PROCESS_EXIT_WAIT_TIME 5000 5#define DEFAULT_PROCESS_EXIT_WAIT_TIME 5000
6 6
7// WixCloseApplication Target Description Condition Attributes Sequence
8
9// structs 7// structs
10LPCWSTR wzQUERY_CLOSEAPPS = L"SELECT `WixCloseApplication`, `Target`, `Description`, `Condition`, `Attributes`, `Property`, `TerminateExitCode`, `Timeout` FROM `WixCloseApplication` ORDER BY `Sequence`"; 8LPCWSTR wzQUERY_CLOSEAPPS = L"SELECT `Wix4CloseApplication`, `Target`, `Description`, `Condition`, `Attributes`, `Property`, `TerminateExitCode`, `Timeout` FROM `Wix4CloseApplication` ORDER BY `Sequence`";
11enum eQUERY_CLOSEAPPS { QCA_ID = 1, QCA_TARGET, QCA_DESCRIPTION, QCA_CONDITION, QCA_ATTRIBUTES, QCA_PROPERTY, QCA_TERMINATEEXITCODE, QCA_TIMEOUT }; 9enum eQUERY_CLOSEAPPS { QCA_ID = 1, QCA_TARGET, QCA_DESCRIPTION, QCA_CONDITION, QCA_ATTRIBUTES, QCA_PROPERTY, QCA_TERMINATEEXITCODE, QCA_TIMEOUT };
12 10
13// CloseApplication.Attributes 11// CloseApplication.Attributes
@@ -294,14 +292,14 @@ extern "C" UINT __stdcall WixCloseApplications(
294 // loop through all the objects to be secured 292 // loop through all the objects to be secured
295 // 293 //
296 hr = WcaOpenExecuteView(wzQUERY_CLOSEAPPS, &hView); 294 hr = WcaOpenExecuteView(wzQUERY_CLOSEAPPS, &hView);
297 ExitOnFailure(hr, "failed to open view on WixCloseApplication table"); 295 ExitOnFailure(hr, "failed to open view on Wix4CloseApplication table");
298 while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) 296 while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
299 { 297 {
300 hr = WcaGetRecordString(hRec, QCA_ID, &pwzId); 298 hr = WcaGetRecordString(hRec, QCA_ID, &pwzId);
301 ExitOnFailure(hr, "failed to get id from WixCloseApplication table"); 299 ExitOnFailure(hr, "failed to get id from Wix4CloseApplication table");
302 300
303 hr = WcaGetRecordString(hRec, QCA_CONDITION, &pwzCondition); 301 hr = WcaGetRecordString(hRec, QCA_CONDITION, &pwzCondition);
304 ExitOnFailure(hr, "failed to get condition from WixCloseApplication table"); 302 ExitOnFailure(hr, "failed to get condition from Wix4CloseApplication table");
305 303
306 if (pwzCondition && *pwzCondition) 304 if (pwzCondition && *pwzCondition)
307 { 305 {
@@ -309,7 +307,7 @@ extern "C" UINT __stdcall WixCloseApplications(
309 if (MSICONDITION_ERROR == condition) 307 if (MSICONDITION_ERROR == condition)
310 { 308 {
311 hr = E_INVALIDARG; 309 hr = E_INVALIDARG;
312 ExitOnFailure(hr, "failed to process condition for WixCloseApplication '%ls'", pwzId); 310 ExitOnFailure(hr, "failed to process condition for Wix4CloseApplication '%ls'", pwzId);
313 } 311 }
314 else if (MSICONDITION_FALSE == condition) 312 else if (MSICONDITION_FALSE == condition)
315 { 313 {
@@ -318,16 +316,16 @@ extern "C" UINT __stdcall WixCloseApplications(
318 } 316 }
319 317
320 hr = WcaGetRecordFormattedString(hRec, QCA_TARGET, &pwzTarget); 318 hr = WcaGetRecordFormattedString(hRec, QCA_TARGET, &pwzTarget);
321 ExitOnFailure(hr, "failed to get target from WixCloseApplication table"); 319 ExitOnFailure(hr, "failed to get target from Wix4CloseApplication table");
322 320
323 hr = WcaGetRecordFormattedString(hRec, QCA_DESCRIPTION, &pwzDescription); 321 hr = WcaGetRecordFormattedString(hRec, QCA_DESCRIPTION, &pwzDescription);
324 ExitOnFailure(hr, "failed to get description from WixCloseApplication table"); 322 ExitOnFailure(hr, "failed to get description from Wix4CloseApplication table");
325 323
326 hr = WcaGetRecordInteger(hRec, QCA_ATTRIBUTES, reinterpret_cast<int*>(&dwAttributes)); 324 hr = WcaGetRecordInteger(hRec, QCA_ATTRIBUTES, reinterpret_cast<int*>(&dwAttributes));
327 ExitOnFailure(hr, "failed to get attributes from WixCloseApplication table"); 325 ExitOnFailure(hr, "failed to get attributes from Wix4CloseApplication table");
328 326
329 hr = WcaGetRecordFormattedString(hRec, QCA_PROPERTY, &pwzProperty); 327 hr = WcaGetRecordFormattedString(hRec, QCA_PROPERTY, &pwzProperty);
330 ExitOnFailure(hr, "failed to get property from WixCloseApplication table"); 328 ExitOnFailure(hr, "failed to get property from Wix4CloseApplication table");
331 329
332 hr = WcaGetRecordInteger(hRec, QCA_TERMINATEEXITCODE, reinterpret_cast<int*>(&dwTerminateExitCode)); 330 hr = WcaGetRecordInteger(hRec, QCA_TERMINATEEXITCODE, reinterpret_cast<int*>(&dwTerminateExitCode));
333 if (S_FALSE == hr) 331 if (S_FALSE == hr)
@@ -335,7 +333,7 @@ extern "C" UINT __stdcall WixCloseApplications(
335 dwTerminateExitCode = 0; 333 dwTerminateExitCode = 0;
336 hr = S_OK; 334 hr = S_OK;
337 } 335 }
338 ExitOnFailure(hr, "failed to get timeout from WixCloseApplication table"); 336 ExitOnFailure(hr, "failed to get timeout from Wix4CloseApplication table");
339 337
340 hr = WcaGetRecordInteger(hRec, QCA_TIMEOUT, reinterpret_cast<int*>(&dwTimeout)); 338 hr = WcaGetRecordInteger(hRec, QCA_TIMEOUT, reinterpret_cast<int*>(&dwTimeout));
341 if (S_FALSE == hr) 339 if (S_FALSE == hr)
@@ -343,7 +341,7 @@ extern "C" UINT __stdcall WixCloseApplications(
343 dwTimeout = DEFAULT_PROCESS_EXIT_WAIT_TIME; 341 dwTimeout = DEFAULT_PROCESS_EXIT_WAIT_TIME;
344 hr = S_OK; 342 hr = S_OK;
345 } 343 }
346 ExitOnFailure(hr, "failed to get timeout from WixCloseApplication table"); 344 ExitOnFailure(hr, "failed to get timeout from Wix4CloseApplication table");
347 345
348 // Before trying any changes to the machine, prompt if requested. 346 // Before trying any changes to the machine, prompt if requested.
349 if (dwAttributes & CLOSEAPP_ATTRIBUTE_PROMPTTOCONTINUE) 347 if (dwAttributes & CLOSEAPP_ATTRIBUTE_PROMPTTOCONTINUE)
@@ -433,8 +431,8 @@ extern "C" UINT __stdcall WixCloseApplications(
433 { 431 {
434 Assert(0 < cCloseApps); 432 Assert(0 < cCloseApps);
435 433
436 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"WixCloseApplicationsDeferred"), pwzCustomActionData, cCloseApps * COST_CLOSEAPP); 434 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CloseApplicationsDeferred"), pwzCustomActionData, cCloseApps * COST_CLOSEAPP);
437 ExitOnFailure(hr, "failed to schedule WixCloseApplicationsDeferred action"); 435 ExitOnFailure(hr, "failed to schedule CloseApplicationsDeferred action");
438 } 436 }
439 437
440LExit: 438LExit: