diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-30 17:05:56 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-01 22:06:11 -0500 |
| commit | ae3a31795614000207470e6824887c414366a681 (patch) | |
| tree | 7c3c659ee5efdbc7b4c7c93108221b229c26fd2d /src/burn/engine/msuengine.cpp | |
| parent | e7a208587389a17fa5ff3654d533e023268bfddf (diff) | |
| download | wix-ae3a31795614000207470e6824887c414366a681.tar.gz wix-ae3a31795614000207470e6824887c414366a681.tar.bz2 wix-ae3a31795614000207470e6824887c414366a681.zip | |
Minimize chance of user arguments messing up the command line
to avoid variations of issue 3890
Diffstat (limited to 'src/burn/engine/msuengine.cpp')
| -rw-r--r-- | src/burn/engine/msuengine.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/burn/engine/msuengine.cpp b/src/burn/engine/msuengine.cpp index 2591973f..de8e8c38 100644 --- a/src/burn/engine/msuengine.cpp +++ b/src/burn/engine/msuengine.cpp | |||
| @@ -273,6 +273,7 @@ extern "C" HRESULT MsuEngineExecutePackage( | |||
| 273 | LPWSTR sczSystemPath = NULL; | 273 | LPWSTR sczSystemPath = NULL; |
| 274 | LPWSTR sczWusaPath = NULL; | 274 | LPWSTR sczWusaPath = NULL; |
| 275 | LPWSTR sczCommand = NULL; | 275 | LPWSTR sczCommand = NULL; |
| 276 | LPWSTR sczEscapedKB = NULL; | ||
| 276 | SC_HANDLE schWu = NULL; | 277 | SC_HANDLE schWu = NULL; |
| 277 | BOOL fWuWasDisabled = FALSE; | 278 | BOOL fWuWasDisabled = FALSE; |
| 278 | STARTUPINFOW si = { }; | 279 | STARTUPINFOW si = { }; |
| @@ -328,8 +329,11 @@ extern "C" HRESULT MsuEngineExecutePackage( | |||
| 328 | break; | 329 | break; |
| 329 | 330 | ||
| 330 | case BOOTSTRAPPER_ACTION_STATE_UNINSTALL: | 331 | case BOOTSTRAPPER_ACTION_STATE_UNINSTALL: |
| 332 | hr = AppEscapeCommandLineArgumentFormatted(&sczEscapedKB, L"%ls", pPackage->Msu.sczKB); | ||
| 333 | ExitOnFailure(hr, "Failed to escape MSU KB."); | ||
| 334 | |||
| 331 | // format command | 335 | // format command |
| 332 | hr = StrAllocFormatted(&sczCommand, L"\"%ls\" /uninstall /kb:%ls /quiet /norestart", sczWusaPath, pPackage->Msu.sczKB); | 336 | hr = StrAllocFormatted(&sczCommand, L"\"%ls\" /uninstall /kb:%ls /quiet /norestart", sczWusaPath, sczEscapedKB); |
| 333 | ExitOnFailure(hr, "Failed to format MSU uninstall command."); | 337 | ExitOnFailure(hr, "Failed to format MSU uninstall command."); |
| 334 | break; | 338 | break; |
| 335 | 339 | ||
| @@ -352,7 +356,7 @@ extern "C" HRESULT MsuEngineExecutePackage( | |||
| 352 | hr = EnsureWUServiceEnabled(fStopWusaService, &schWu, &fWuWasDisabled); | 356 | hr = EnsureWUServiceEnabled(fStopWusaService, &schWu, &fWuWasDisabled); |
| 353 | ExitOnFailure(hr, "Failed to ensure WU service was enabled to install MSU package."); | 357 | ExitOnFailure(hr, "Failed to ensure WU service was enabled to install MSU package."); |
| 354 | 358 | ||
| 355 | hr = ExeEngineRunProcess(pfnGenericMessageHandler, pvContext, pPackage, sczWusaPath, sczCommand, NULL, &dwExitCode); | 359 | hr = ExeEngineRunProcess(pfnGenericMessageHandler, pvContext, pPackage, sczWusaPath, sczCommand, NULL, NULL, &dwExitCode); |
| 356 | ExitOnFailure(hr, "Failed to run MSU process"); | 360 | ExitOnFailure(hr, "Failed to run MSU process"); |
| 357 | 361 | ||
| 358 | // We'll normalize the restart required error code from wusa.exe just in case. Most likely | 362 | // We'll normalize the restart required error code from wusa.exe just in case. Most likely |
| @@ -389,6 +393,7 @@ LExit: | |||
| 389 | ReleaseStr(sczWindowsPath); | 393 | ReleaseStr(sczWindowsPath); |
| 390 | ReleaseStr(sczWusaPath); | 394 | ReleaseStr(sczWusaPath); |
| 391 | ReleaseStr(sczCommand); | 395 | ReleaseStr(sczCommand); |
| 396 | ReleaseStr(sczEscapedKB); | ||
| 392 | 397 | ||
| 393 | ReleaseHandle(pi.hProcess); | 398 | ReleaseHandle(pi.hProcess); |
| 394 | ReleaseHandle(pi.hThread); | 399 | ReleaseHandle(pi.hThread); |
