diff options
| author | Rob Mensching <rob@firegiant.com> | 2024-01-11 18:26:20 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
| commit | 0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch) | |
| tree | 9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/burn/engine/core.cpp | |
| parent | 2824298d9dd817a47527c920363556b54ead5d5d (diff) | |
| download | wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2 wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip | |
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/burn/engine/core.cpp')
| -rw-r--r-- | src/burn/engine/core.cpp | 225 |
1 files changed, 20 insertions, 205 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index ca2e41c2..ae74fdfd 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
| @@ -43,11 +43,6 @@ static HRESULT EscapeAndAppendArgumentToCommandLineFormattedArgs( | |||
| 43 | __in __format_string LPCWSTR wzFormat, | 43 | __in __format_string LPCWSTR wzFormat, |
| 44 | __in va_list args | 44 | __in va_list args |
| 45 | ); | 45 | ); |
| 46 | static HRESULT AppendLayoutToCommandLine( | ||
| 47 | __in BOOTSTRAPPER_ACTION action, | ||
| 48 | __in_z LPCWSTR wzLayoutDirectory, | ||
| 49 | __deref_inout_z LPWSTR* psczCommandLine | ||
| 50 | ); | ||
| 51 | static HRESULT GetSanitizedCommandLine( | 46 | static HRESULT GetSanitizedCommandLine( |
| 52 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 47 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| 53 | __in BOOTSTRAPPER_COMMAND* pCommand, | 48 | __in BOOTSTRAPPER_COMMAND* pCommand, |
| @@ -151,18 +146,6 @@ extern "C" HRESULT CoreInitialize( | |||
| 151 | ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable."); | 146 | ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable."); |
| 152 | } | 147 | } |
| 153 | 148 | ||
| 154 | if (pEngineState->internalCommand.sczSourceProcessPath) | ||
| 155 | { | ||
| 156 | hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_PATH, pEngineState->internalCommand.sczSourceProcessPath, TRUE, FALSE); | ||
| 157 | ExitOnFailure(hr, "Failed to set source process path variable."); | ||
| 158 | |||
| 159 | hr = PathGetDirectory(pEngineState->internalCommand.sczSourceProcessPath, &sczSourceProcessFolder); | ||
| 160 | ExitOnFailure(hr, "Failed to get source process folder from path."); | ||
| 161 | |||
| 162 | hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_FOLDER, sczSourceProcessFolder, TRUE, FALSE); | ||
| 163 | ExitOnFailure(hr, "Failed to set source process folder variable."); | ||
| 164 | } | ||
| 165 | |||
| 166 | // Set BURN_BUNDLE_ORIGINAL_SOURCE, if it was passed in on the command line. | 149 | // Set BURN_BUNDLE_ORIGINAL_SOURCE, if it was passed in on the command line. |
| 167 | // Needs to be done after ManifestLoadXmlFromBuffer. | 150 | // Needs to be done after ManifestLoadXmlFromBuffer. |
| 168 | if (pEngineState->internalCommand.sczOriginalSource) | 151 | if (pEngineState->internalCommand.sczOriginalSource) |
| @@ -171,9 +154,9 @@ extern "C" HRESULT CoreInitialize( | |||
| 171 | ExitOnFailure(hr, "Failed to set original source variable."); | 154 | ExitOnFailure(hr, "Failed to set original source variable."); |
| 172 | } | 155 | } |
| 173 | 156 | ||
| 174 | if (BURN_MODE_UNTRUSTED == pEngineState->internalCommand.mode || BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) | 157 | if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) |
| 175 | { | 158 | { |
| 176 | hr = CacheInitializeSources(&pEngineState->cache, &pEngineState->registration, &pEngineState->variables, &pEngineState->internalCommand); | 159 | hr = CacheInitializeSources(&pEngineState->cache, &pEngineState->registration, &pEngineState->variables); |
| 177 | ExitOnFailure(hr, "Failed to initialize internal cache source functionality."); | 160 | ExitOnFailure(hr, "Failed to initialize internal cache source functionality."); |
| 178 | } | 161 | } |
| 179 | 162 | ||
| @@ -182,7 +165,7 @@ extern "C" HRESULT CoreInitialize( | |||
| 182 | if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) | 165 | if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) |
| 183 | { | 166 | { |
| 184 | // Extract all UX payloads to working folder. | 167 | // Extract all UX payloads to working folder. |
| 185 | hr = UserExperienceEnsureWorkingFolder(&pEngineState->cache, &pEngineState->userExperience.sczTempDirectory); | 168 | hr = BootstrapperApplicationEnsureWorkingFolder(&pEngineState->cache, &pEngineState->userExperience.sczTempDirectory); |
| 186 | ExitOnFailure(hr, "Failed to get unique temporary folder for bootstrapper application."); | 169 | ExitOnFailure(hr, "Failed to get unique temporary folder for bootstrapper application."); |
| 187 | 170 | ||
| 188 | hr = PayloadExtractUXContainer(&pEngineState->userExperience.payloads, &containerContext, pEngineState->userExperience.sczTempDirectory); | 171 | hr = PayloadExtractUXContainer(&pEngineState->userExperience.payloads, &containerContext, pEngineState->userExperience.sczTempDirectory); |
| @@ -297,7 +280,7 @@ extern "C" HRESULT CoreQueryRegistration( | |||
| 297 | } | 280 | } |
| 298 | 281 | ||
| 299 | LExit: | 282 | LExit: |
| 300 | ReleaseBuffer(pbBuffer); | 283 | ReleaseMem(pbBuffer); |
| 301 | 284 | ||
| 302 | return hr; | 285 | return hr; |
| 303 | } | 286 | } |
| @@ -324,7 +307,7 @@ extern "C" HRESULT CoreDetect( | |||
| 324 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); | 307 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); |
| 325 | 308 | ||
| 326 | fDetectBegan = TRUE; | 309 | fDetectBegan = TRUE; |
| 327 | hr = UserExperienceOnDetectBegin(&pEngineState->userExperience, pEngineState->registration.fCached, pEngineState->registration.detectedRegistrationType, pEngineState->packages.cPackages); | 310 | hr = BACallbackOnDetectBegin(&pEngineState->userExperience, pEngineState->registration.fCached, pEngineState->registration.detectedRegistrationType, pEngineState->packages.cPackages); |
| 328 | ExitOnRootFailure(hr, "UX aborted detect begin."); | 311 | ExitOnRootFailure(hr, "UX aborted detect begin."); |
| 329 | 312 | ||
| 330 | pEngineState->userExperience.hwndDetect = hwndParent; | 313 | pEngineState->userExperience.hwndDetect = hwndParent; |
| @@ -429,7 +412,7 @@ LExit: | |||
| 429 | 412 | ||
| 430 | if (fDetectBegan) | 413 | if (fDetectBegan) |
| 431 | { | 414 | { |
| 432 | UserExperienceOnDetectComplete(&pEngineState->userExperience, hr, pEngineState->registration.fEligibleForCleanup); | 415 | BACallbackOnDetectComplete(&pEngineState->userExperience, hr, pEngineState->registration.fEligibleForCleanup); |
| 433 | } | 416 | } |
| 434 | 417 | ||
| 435 | pEngineState->userExperience.hwndDetect = NULL; | 418 | pEngineState->userExperience.hwndDetect = NULL; |
| @@ -453,7 +436,7 @@ extern "C" HRESULT CorePlan( | |||
| 453 | LogId(REPORT_STANDARD, MSG_PLAN_BEGIN, pEngineState->packages.cPackages, LoggingBurnActionToString(action)); | 436 | LogId(REPORT_STANDARD, MSG_PLAN_BEGIN, pEngineState->packages.cPackages, LoggingBurnActionToString(action)); |
| 454 | 437 | ||
| 455 | fPlanBegan = TRUE; | 438 | fPlanBegan = TRUE; |
| 456 | hr = UserExperienceOnPlanBegin(&pEngineState->userExperience, pEngineState->packages.cPackages); | 439 | hr = BACallbackOnPlanBegin(&pEngineState->userExperience, pEngineState->packages.cPackages); |
| 457 | ExitOnRootFailure(hr, "BA aborted plan begin."); | 440 | ExitOnRootFailure(hr, "BA aborted plan begin."); |
| 458 | 441 | ||
| 459 | if (!pEngineState->fDetected) | 442 | if (!pEngineState->fDetected) |
| @@ -583,7 +566,7 @@ LExit: | |||
| 583 | 566 | ||
| 584 | if (fPlanBegan) | 567 | if (fPlanBegan) |
| 585 | { | 568 | { |
| 586 | UserExperienceOnPlanComplete(&pEngineState->userExperience, hr); | 569 | BACallbackOnPlanComplete(&pEngineState->userExperience, hr); |
| 587 | } | 570 | } |
| 588 | 571 | ||
| 589 | LogId(REPORT_STANDARD, MSG_PLAN_COMPLETE, hr); | 572 | LogId(REPORT_STANDARD, MSG_PLAN_COMPLETE, hr); |
| @@ -674,13 +657,13 @@ extern "C" HRESULT CoreApply( | |||
| 674 | ++dwPhaseCount; | 657 | ++dwPhaseCount; |
| 675 | } | 658 | } |
| 676 | 659 | ||
| 677 | hr = UserExperienceOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); | 660 | hr = BACallbackOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); |
| 678 | ExitOnRootFailure(hr, "BA aborted apply begin."); | 661 | ExitOnRootFailure(hr, "BA aborted apply begin."); |
| 679 | 662 | ||
| 680 | if (pEngineState->plan.fDowngrade) | 663 | if (pEngineState->plan.fDowngrade) |
| 681 | { | 664 | { |
| 682 | hr = HRESULT_FROM_WIN32(ERROR_PRODUCT_VERSION); | 665 | hr = HRESULT_FROM_WIN32(ERROR_PRODUCT_VERSION); |
| 683 | UserExperienceOnApplyDowngrade(&pEngineState->userExperience, &hr); | 666 | BACallbackOnApplyDowngrade(&pEngineState->userExperience, &hr); |
| 684 | 667 | ||
| 685 | ExitFunction(); | 668 | ExitFunction(); |
| 686 | } | 669 | } |
| @@ -767,7 +750,7 @@ extern "C" HRESULT CoreApply( | |||
| 767 | if (pEngineState->plan.cExecuteActions) | 750 | if (pEngineState->plan.cExecuteActions) |
| 768 | { | 751 | { |
| 769 | hr = ApplyExecute(pEngineState, &applyContext, &fSuspend, &restart); | 752 | hr = ApplyExecute(pEngineState, &applyContext, &fSuspend, &restart); |
| 770 | UserExperienceExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that execute completed. | 753 | BootstrapperApplicationExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that execute completed. |
| 771 | } | 754 | } |
| 772 | 755 | ||
| 773 | // Wait for cache thread to terminate, this should return immediately unless we're waiting for layout to complete. | 756 | // Wait for cache thread to terminate, this should return immediately unless we're waiting for layout to complete. |
| @@ -847,7 +830,7 @@ LExit: | |||
| 847 | 830 | ||
| 848 | if (fApplyBegan) | 831 | if (fApplyBegan) |
| 849 | { | 832 | { |
| 850 | UserExperienceOnApplyComplete(&pEngineState->userExperience, hr, restart, &applyCompleteAction); | 833 | BACallbackOnApplyComplete(&pEngineState->userExperience, hr, restart, &applyCompleteAction); |
| 851 | if (BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART == applyCompleteAction) | 834 | if (BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART == applyCompleteAction) |
| 852 | { | 835 | { |
| 853 | pEngineState->fRestart = TRUE; | 836 | pEngineState->fRestart = TRUE; |
| @@ -869,7 +852,7 @@ extern "C" HRESULT CoreLaunchApprovedExe( | |||
| 869 | 852 | ||
| 870 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_BEGIN, pLaunchApprovedExe->sczId); | 853 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_BEGIN, pLaunchApprovedExe->sczId); |
| 871 | 854 | ||
| 872 | hr = UserExperienceOnLaunchApprovedExeBegin(&pEngineState->userExperience); | 855 | hr = BACallbackOnLaunchApprovedExeBegin(&pEngineState->userExperience); |
| 873 | ExitOnRootFailure(hr, "BA aborted LaunchApprovedExe begin."); | 856 | ExitOnRootFailure(hr, "BA aborted LaunchApprovedExe begin."); |
| 874 | 857 | ||
| 875 | // Elevate. | 858 | // Elevate. |
| @@ -880,7 +863,7 @@ extern "C" HRESULT CoreLaunchApprovedExe( | |||
| 880 | hr = ElevationLaunchApprovedExe(pEngineState->companionConnection.hPipe, pLaunchApprovedExe, &dwProcessId); | 863 | hr = ElevationLaunchApprovedExe(pEngineState->companionConnection.hPipe, pLaunchApprovedExe, &dwProcessId); |
| 881 | 864 | ||
| 882 | LExit: | 865 | LExit: |
| 883 | UserExperienceOnLaunchApprovedExeComplete(&pEngineState->userExperience, hr, dwProcessId); | 866 | BACallbackOnLaunchApprovedExeComplete(&pEngineState->userExperience, hr, dwProcessId); |
| 884 | 867 | ||
| 885 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_COMPLETE, hr, dwProcessId); | 868 | LogId(REPORT_STANDARD, MSG_LAUNCH_APPROVED_EXE_COMPLETE, hr, dwProcessId); |
| 886 | 869 | ||
| @@ -888,7 +871,7 @@ LExit: | |||
| 888 | } | 871 | } |
| 889 | 872 | ||
| 890 | extern "C" void CoreQuit( | 873 | extern "C" void CoreQuit( |
| 891 | __in BOOTSTRAPPER_ENGINE_CONTEXT* pEngineContext, | 874 | __in BAENGINE_CONTEXT* pEngineContext, |
| 892 | __in DWORD dwExitCode | 875 | __in DWORD dwExitCode |
| 893 | ) | 876 | ) |
| 894 | { | 877 | { |
| @@ -942,7 +925,7 @@ extern "C" HRESULT CoreSaveEngineState( | |||
| 942 | } | 925 | } |
| 943 | 926 | ||
| 944 | LExit: | 927 | LExit: |
| 945 | ReleaseBuffer(pbBuffer); | 928 | ReleaseMem(pbBuffer); |
| 946 | 929 | ||
| 947 | return hr; | 930 | return hr; |
| 948 | } | 931 | } |
| @@ -1087,95 +1070,6 @@ LExit: | |||
| 1087 | return hr; | 1070 | return hr; |
| 1088 | } | 1071 | } |
| 1089 | 1072 | ||
| 1090 | extern "C" HRESULT CoreCreateCleanRoomCommandLine( | ||
| 1091 | __deref_inout_z LPWSTR* psczCommandLine, | ||
| 1092 | __in BURN_ENGINE_STATE* pEngineState, | ||
| 1093 | __in_z LPCWSTR wzCleanRoomBundlePath, | ||
| 1094 | __in_z LPCWSTR wzCurrentProcessPath, | ||
| 1095 | __inout HANDLE* phFileAttached, | ||
| 1096 | __inout HANDLE* phFileSelf | ||
| 1097 | ) | ||
| 1098 | { | ||
| 1099 | HRESULT hr = S_OK; | ||
| 1100 | BOOTSTRAPPER_COMMAND* pCommand = &pEngineState->command; | ||
| 1101 | BURN_ENGINE_COMMAND* pInternalCommand = &pEngineState->internalCommand; | ||
| 1102 | |||
| 1103 | // The clean room switch must always be at the front of the command line so | ||
| 1104 | // the EngineInCleanRoom function will operate correctly. | ||
| 1105 | hr = StrAllocFormatted(psczCommandLine, L"-%ls=\"%ls\"", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, wzCurrentProcessPath); | ||
| 1106 | ExitOnFailure(hr, "Failed to allocate parameters for unelevated process."); | ||
| 1107 | |||
| 1108 | // Send a file handle for the child Burn process to access the attached container. | ||
| 1109 | hr = CoreAppendFileHandleAttachedToCommandLine(pEngineState->section.hEngineFile, phFileAttached, psczCommandLine); | ||
| 1110 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED); | ||
| 1111 | |||
| 1112 | // Grab a file handle for the child Burn process. | ||
| 1113 | hr = CoreAppendFileHandleSelfToCommandLine(wzCleanRoomBundlePath, phFileSelf, psczCommandLine, NULL); | ||
| 1114 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); | ||
| 1115 | |||
| 1116 | hr = CoreAppendSplashScreenWindowToCommandLine(pCommand->hwndSplashScreen, psczCommandLine); | ||
| 1117 | ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_SPLASH_SCREEN); | ||
| 1118 | |||
| 1119 | if (pInternalCommand->sczLogFile) | ||
| 1120 | { | ||
| 1121 | LPCWSTR wzLogParameter = (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pInternalCommand->dwLoggingAttributes) ? L"xlog" : L"log"; | ||
| 1122 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls", wzLogParameter); | ||
| 1123 | ExitOnFailure(hr, "Failed to append logging switch."); | ||
| 1124 | |||
| 1125 | hr = AppAppendCommandLineArgument(psczCommandLine, pInternalCommand->sczLogFile); | ||
| 1126 | ExitOnFailure(hr, "Failed to append custom log path."); | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | hr = AppendLayoutToCommandLine(pCommand->action, pCommand->wzLayoutDirectory, psczCommandLine); | ||
| 1130 | ExitOnFailure(hr, "Failed to append layout."); | ||
| 1131 | |||
| 1132 | switch (pInternalCommand->automaticUpdates) | ||
| 1133 | { | ||
| 1134 | case BURN_AU_PAUSE_ACTION_NONE: | ||
| 1135 | hr = StrAllocConcat(psczCommandLine, L" /noaupause", 0); | ||
| 1136 | ExitOnFailure(hr, "Failed to append /noaupause."); | ||
| 1137 | break; | ||
| 1138 | case BURN_AU_PAUSE_ACTION_IFELEVATED_NORESUME: | ||
| 1139 | hr = StrAllocConcat(psczCommandLine, L" /keepaupaused", 0); | ||
| 1140 | ExitOnFailure(hr, "Failed to append /keepaupaused."); | ||
| 1141 | break; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | // TODO: This should only be added if it was enabled from the command line. | ||
| 1145 | if (pInternalCommand->fDisableSystemRestore) | ||
| 1146 | { | ||
| 1147 | hr = StrAllocConcat(psczCommandLine, L" /disablesystemrestore", 0); | ||
| 1148 | ExitOnFailure(hr, "Failed to append /disablesystemrestore."); | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | if (pInternalCommand->sczOriginalSource) | ||
| 1152 | { | ||
| 1153 | hr = StrAllocConcat(psczCommandLine, L" /originalsource", 0); | ||
| 1154 | ExitOnFailure(hr, "Failed to append /originalsource."); | ||
| 1155 | |||
| 1156 | hr = AppAppendCommandLineArgument(psczCommandLine, pInternalCommand->sczOriginalSource); | ||
| 1157 | ExitOnFailure(hr, "Failed to append original source."); | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | if (pEngineState->embeddedConnection.sczName) | ||
| 1161 | { | ||
| 1162 | hr = StrAllocConcatFormatted(psczCommandLine, L" -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_EMBEDDED, pEngineState->embeddedConnection.sczName, pEngineState->embeddedConnection.sczSecret, pEngineState->embeddedConnection.dwProcessId); | ||
| 1163 | ExitOnFailure(hr, "Failed to allocate embedded command."); | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | if (pInternalCommand->sczIgnoreDependencies) | ||
| 1167 | { | ||
| 1168 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES, pInternalCommand->sczIgnoreDependencies); | ||
| 1169 | ExitOnFailure(hr, "Failed to append ignored dependencies to command-line."); | ||
| 1170 | } | ||
| 1171 | |||
| 1172 | hr = CoreRecreateCommandLine(psczCommandLine, pCommand->action, pInternalCommand, pCommand, pCommand->relationType, pCommand->fPassthrough); | ||
| 1173 | ExitOnFailure(hr, "Failed to recreate clean room command-line."); | ||
| 1174 | |||
| 1175 | LExit: | ||
| 1176 | return hr; | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | extern "C" HRESULT CoreCreatePassthroughBundleCommandLine( | 1073 | extern "C" HRESULT CoreCreatePassthroughBundleCommandLine( |
| 1180 | __deref_inout_z LPWSTR* psczCommandLine, | 1074 | __deref_inout_z LPWSTR* psczCommandLine, |
| 1181 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 1075 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| @@ -1201,9 +1095,6 @@ extern "C" HRESULT CoreCreateResumeCommandLine( | |||
| 1201 | { | 1095 | { |
| 1202 | HRESULT hr = S_OK; | 1096 | HRESULT hr = S_OK; |
| 1203 | 1097 | ||
| 1204 | hr = StrAllocFormatted(psczCommandLine, L"/%ls", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); | ||
| 1205 | ExitOnFailure(hr, "Failed to alloc resume command-line."); | ||
| 1206 | |||
| 1207 | if (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pPlan->pInternalCommand->dwLoggingAttributes) | 1098 | if (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pPlan->pInternalCommand->dwLoggingAttributes) |
| 1208 | { | 1099 | { |
| 1209 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_LOG_MODE, L"x"); | 1100 | hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_LOG_MODE, L"x"); |
| @@ -1694,40 +1585,6 @@ extern "C" HRESULT CoreParseCommandLine( | |||
| 1694 | 1585 | ||
| 1695 | i += 2; | 1586 | i += 2; |
| 1696 | } | 1587 | } |
| 1697 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM), BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM))) | ||
| 1698 | { | ||
| 1699 | if (0 != i) | ||
| 1700 | { | ||
| 1701 | fInvalidCommandLine = TRUE; | ||
| 1702 | TraceLog(E_INVALIDARG, "Clean room command-line switch must be first argument on command-line."); | ||
| 1703 | } | ||
| 1704 | |||
| 1705 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) | ||
| 1706 | { | ||
| 1707 | pInternalCommand->mode = BURN_MODE_NORMAL; | ||
| 1708 | } | ||
| 1709 | else | ||
| 1710 | { | ||
| 1711 | fInvalidCommandLine = TRUE; | ||
| 1712 | TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided."); | ||
| 1713 | } | ||
| 1714 | |||
| 1715 | // Get a pointer to the next character after the switch. | ||
| 1716 | LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM)]; | ||
| 1717 | if (L'\0' != wzParam[0]) | ||
| 1718 | { | ||
| 1719 | if (L'=' != wzParam[0]) | ||
| 1720 | { | ||
| 1721 | fInvalidCommandLine = TRUE; | ||
| 1722 | TraceLog(E_INVALIDARG, "Invalid switch: %ls", argv[i]); | ||
| 1723 | } | ||
| 1724 | else if (L'\0' != wzParam[1]) | ||
| 1725 | { | ||
| 1726 | hr = PathExpand(&pInternalCommand->sczSourceProcessPath, wzParam + 1, PATH_EXPAND_FULLPATH); | ||
| 1727 | ExitOnFailure(hr, "Failed to copy source process path."); | ||
| 1728 | } | ||
| 1729 | } | ||
| 1730 | } | ||
| 1731 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT), BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT, lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT))) | 1588 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT), BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT, lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT))) |
| 1732 | { | 1589 | { |
| 1733 | // Get a pointer to the next character after the switch. | 1590 | // Get a pointer to the next character after the switch. |
| @@ -1762,13 +1619,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
| 1762 | switch (pInternalCommand->mode) | 1619 | switch (pInternalCommand->mode) |
| 1763 | { | 1620 | { |
| 1764 | case BURN_MODE_UNKNOWN: | 1621 | case BURN_MODE_UNKNOWN: |
| 1765 | // Set mode to UNTRUSTED to ensure multiple modes weren't specified. | ||
| 1766 | pInternalCommand->mode = BURN_MODE_UNTRUSTED; | ||
| 1767 | break; | ||
| 1768 | case BURN_MODE_NORMAL: | 1622 | case BURN_MODE_NORMAL: |
| 1769 | // The initialization code already assumes that the | ||
| 1770 | // clean room switch is at the beginning of the command line, | ||
| 1771 | // so it's safe to assume that the mode is NORMAL in the clean room. | ||
| 1772 | pInternalCommand->mode = BURN_MODE_EMBEDDED; | 1623 | pInternalCommand->mode = BURN_MODE_EMBEDDED; |
| 1773 | break; | 1624 | break; |
| 1774 | default: | 1625 | default: |
| @@ -2012,7 +1863,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
| 2012 | 1863 | ||
| 2013 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) | 1864 | if (BURN_MODE_UNKNOWN == pInternalCommand->mode) |
| 2014 | { | 1865 | { |
| 2015 | pInternalCommand->mode = BURN_MODE_UNTRUSTED; | 1866 | pInternalCommand->mode = BURN_MODE_NORMAL; |
| 2016 | } | 1867 | } |
| 2017 | 1868 | ||
| 2018 | LExit: | 1869 | LExit: |
| @@ -2132,18 +1983,6 @@ LExit: | |||
| 2132 | return hr; | 1983 | return hr; |
| 2133 | } | 1984 | } |
| 2134 | 1985 | ||
| 2135 | extern "C" void DAPI CoreBootstrapperEngineActionUninitialize( | ||
| 2136 | __in BOOTSTRAPPER_ENGINE_ACTION* pAction | ||
| 2137 | ) | ||
| 2138 | { | ||
| 2139 | switch (pAction->dwMessage) | ||
| 2140 | { | ||
| 2141 | case WM_BURN_LAUNCH_APPROVED_EXE: | ||
| 2142 | ApprovedExesUninitializeLaunch(&pAction->launchApprovedExe); | ||
| 2143 | break; | ||
| 2144 | } | ||
| 2145 | } | ||
| 2146 | |||
| 2147 | // internal helper functions | 1986 | // internal helper functions |
| 2148 | 1987 | ||
| 2149 | static HRESULT AppendEscapedArgumentToCommandLine( | 1988 | static HRESULT AppendEscapedArgumentToCommandLine( |
| @@ -2219,30 +2058,6 @@ LExit: | |||
| 2219 | return hr; | 2058 | return hr; |
| 2220 | } | 2059 | } |
| 2221 | 2060 | ||
| 2222 | static HRESULT AppendLayoutToCommandLine( | ||
| 2223 | __in BOOTSTRAPPER_ACTION action, | ||
| 2224 | __in_z LPCWSTR wzLayoutDirectory, | ||
| 2225 | __deref_inout_z LPWSTR* psczCommandLine | ||
| 2226 | ) | ||
| 2227 | { | ||
| 2228 | HRESULT hr = S_OK; | ||
| 2229 | |||
| 2230 | if (BOOTSTRAPPER_ACTION_LAYOUT == action || wzLayoutDirectory) | ||
| 2231 | { | ||
| 2232 | hr = StrAllocConcat(psczCommandLine, L" /layout", 0); | ||
| 2233 | ExitOnFailure(hr, "Failed to append layout switch."); | ||
| 2234 | |||
| 2235 | if (wzLayoutDirectory) | ||
| 2236 | { | ||
| 2237 | hr = AppAppendCommandLineArgument(psczCommandLine, wzLayoutDirectory); | ||
| 2238 | ExitOnFailure(hr, "Failed to append layout directory."); | ||
| 2239 | } | ||
| 2240 | } | ||
| 2241 | |||
| 2242 | LExit: | ||
| 2243 | return hr; | ||
| 2244 | } | ||
| 2245 | |||
| 2246 | static HRESULT GetSanitizedCommandLine( | 2061 | static HRESULT GetSanitizedCommandLine( |
| 2247 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 2062 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
| 2248 | __in BOOTSTRAPPER_COMMAND* pCommand, | 2063 | __in BOOTSTRAPPER_COMMAND* pCommand, |
| @@ -2347,7 +2162,7 @@ static HRESULT DetectPackage( | |||
| 2347 | BOOL fBegan = FALSE; | 2162 | BOOL fBegan = FALSE; |
| 2348 | 2163 | ||
| 2349 | fBegan = TRUE; | 2164 | fBegan = TRUE; |
| 2350 | hr = UserExperienceOnDetectPackageBegin(&pEngineState->userExperience, pPackage->sczId); | 2165 | hr = BACallbackOnDetectPackageBegin(&pEngineState->userExperience, pPackage->sczId); |
| 2351 | ExitOnRootFailure(hr, "BA aborted detect package begin."); | 2166 | ExitOnRootFailure(hr, "BA aborted detect package begin."); |
| 2352 | 2167 | ||
| 2353 | // Detect the cache state of the package. | 2168 | // Detect the cache state of the package. |
| @@ -2389,7 +2204,7 @@ LExit: | |||
| 2389 | 2204 | ||
| 2390 | if (fBegan) | 2205 | if (fBegan) |
| 2391 | { | 2206 | { |
| 2392 | UserExperienceOnDetectPackageComplete(&pEngineState->userExperience, pPackage->sczId, hr, pPackage->currentState, pPackage->fCached); | 2207 | BACallbackOnDetectPackageComplete(&pEngineState->userExperience, pPackage->sczId, hr, pPackage->currentState, pPackage->fCached); |
| 2393 | } | 2208 | } |
| 2394 | 2209 | ||
| 2395 | return hr; | 2210 | return hr; |
| @@ -2465,7 +2280,7 @@ static DWORD WINAPI CacheThreadProc( | |||
| 2465 | hr = ApplyCache(pEngineState->section.hSourceEngineFile, &pEngineState->userExperience, &pEngineState->variables, &pEngineState->plan, pEngineState->companionConnection.hCachePipe, pContext->pApplyContext); | 2280 | hr = ApplyCache(pEngineState->section.hSourceEngineFile, &pEngineState->userExperience, &pEngineState->variables, &pEngineState->plan, pEngineState->companionConnection.hCachePipe, pContext->pApplyContext); |
| 2466 | 2281 | ||
| 2467 | LExit: | 2282 | LExit: |
| 2468 | UserExperienceExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that cache completed. | 2283 | BootstrapperApplicationExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that cache completed. |
| 2469 | 2284 | ||
| 2470 | if (fComInitialized) | 2285 | if (fComInitialized) |
| 2471 | { | 2286 | { |
