diff options
Diffstat (limited to 'src/burn/engine/elevation.cpp')
-rw-r--r-- | src/burn/engine/elevation.cpp | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp index eafc08ee..75679acd 100644 --- a/src/burn/engine/elevation.cpp +++ b/src/burn/engine/elevation.cpp | |||
@@ -1305,7 +1305,8 @@ LExit: | |||
1305 | 1305 | ||
1306 | extern "C" HRESULT ElevationExecutePackageProviderAction( | 1306 | extern "C" HRESULT ElevationExecutePackageProviderAction( |
1307 | __in HANDLE hPipe, | 1307 | __in HANDLE hPipe, |
1308 | __in BURN_EXECUTE_ACTION* pExecuteAction | 1308 | __in BURN_EXECUTE_ACTION* pExecuteAction, |
1309 | __in BOOL fRollback | ||
1309 | ) | 1310 | ) |
1310 | { | 1311 | { |
1311 | HRESULT hr = S_OK; | 1312 | HRESULT hr = S_OK; |
@@ -1318,8 +1319,17 @@ extern "C" HRESULT ElevationExecutePackageProviderAction( | |||
1318 | hr = BuffWriteString(&pbData, &cbData, pExecuteAction->packageProvider.pPackage->sczId); | 1319 | hr = BuffWriteString(&pbData, &cbData, pExecuteAction->packageProvider.pPackage->sczId); |
1319 | ExitOnFailure(hr, "Failed to write package id to message buffer."); | 1320 | ExitOnFailure(hr, "Failed to write package id to message buffer."); |
1320 | 1321 | ||
1321 | hr = BuffWriteNumber(&pbData, &cbData, pExecuteAction->packageProvider.action); | 1322 | hr = BuffWriteNumber(&pbData, &cbData, (DWORD)fRollback); |
1322 | ExitOnFailure(hr, "Failed to write action to message buffer."); | 1323 | ExitOnFailure(hr, "Failed to write rollback flag to message buffer."); |
1324 | |||
1325 | // Provider actions. | ||
1326 | for (DWORD i = 0; i < pExecuteAction->packageProvider.pPackage->cDependencyProviders; ++i) | ||
1327 | { | ||
1328 | BURN_DEPENDENCY_PROVIDER* pProvider = pExecuteAction->packageProvider.pPackage->rgDependencyProviders + i; | ||
1329 | BURN_DEPENDENCY_ACTION* pAction = fRollback ? &pProvider->providerRollback : &pProvider->providerExecute; | ||
1330 | hr = BuffWriteNumber(&pbData, &cbData, (DWORD)*pAction); | ||
1331 | ExitOnFailure(hr, "Failed to write provider action to message buffer."); | ||
1332 | } | ||
1323 | 1333 | ||
1324 | // Send the message. | 1334 | // Send the message. |
1325 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_PACKAGE_PROVIDER, pbData, cbData, NULL, NULL, &dwResult); | 1335 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_EXECUTE_PACKAGE_PROVIDER, pbData, cbData, NULL, NULL, &dwResult); |
@@ -2840,7 +2850,7 @@ static HRESULT OnExecuteMsiPackage( | |||
2840 | SIZE_T iData = 0; | 2850 | SIZE_T iData = 0; |
2841 | LPWSTR sczPackage = NULL; | 2851 | LPWSTR sczPackage = NULL; |
2842 | HWND hwndParent = NULL; | 2852 | HWND hwndParent = NULL; |
2843 | BOOL fRollback = 0; | 2853 | BOOL fRollback = FALSE; |
2844 | BURN_EXECUTE_ACTION executeAction = { }; | 2854 | BURN_EXECUTE_ACTION executeAction = { }; |
2845 | BOOTSTRAPPER_APPLY_RESTART msiRestart = BOOTSTRAPPER_APPLY_RESTART_NONE; | 2855 | BOOTSTRAPPER_APPLY_RESTART msiRestart = BOOTSTRAPPER_APPLY_RESTART_NONE; |
2846 | 2856 | ||
@@ -2946,7 +2956,7 @@ static HRESULT OnExecuteMspPackage( | |||
2946 | SIZE_T iData = 0; | 2956 | SIZE_T iData = 0; |
2947 | LPWSTR sczPackage = NULL; | 2957 | LPWSTR sczPackage = NULL; |
2948 | HWND hwndParent = NULL; | 2958 | HWND hwndParent = NULL; |
2949 | BOOL fRollback = 0; | 2959 | BOOL fRollback = FALSE; |
2950 | BURN_EXECUTE_ACTION executeAction = { }; | 2960 | BURN_EXECUTE_ACTION executeAction = { }; |
2951 | BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; | 2961 | BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; |
2952 | 2962 | ||
@@ -3117,7 +3127,7 @@ static HRESULT OnUninstallMsiCompatiblePackage( | |||
3117 | LPWSTR sczPackageId = NULL; | 3127 | LPWSTR sczPackageId = NULL; |
3118 | LPWSTR sczCompatiblePackageId = NULL; | 3128 | LPWSTR sczCompatiblePackageId = NULL; |
3119 | HWND hwndParent = NULL; | 3129 | HWND hwndParent = NULL; |
3120 | BOOL fRollback = 0; | 3130 | BOOL fRollback = FALSE; |
3121 | BURN_EXECUTE_ACTION executeAction = { }; | 3131 | BURN_EXECUTE_ACTION executeAction = { }; |
3122 | BURN_PACKAGE* pPackage = NULL; | 3132 | BURN_PACKAGE* pPackage = NULL; |
3123 | BURN_COMPATIBLE_PACKAGE* pCompatiblePackage = NULL; | 3133 | BURN_COMPATIBLE_PACKAGE* pCompatiblePackage = NULL; |
@@ -3195,6 +3205,7 @@ static HRESULT OnExecutePackageProviderAction( | |||
3195 | HRESULT hr = S_OK; | 3205 | HRESULT hr = S_OK; |
3196 | SIZE_T iData = 0; | 3206 | SIZE_T iData = 0; |
3197 | LPWSTR sczPackage = NULL; | 3207 | LPWSTR sczPackage = NULL; |
3208 | BOOL fRollback = FALSE; | ||
3198 | BURN_EXECUTE_ACTION executeAction = { }; | 3209 | BURN_EXECUTE_ACTION executeAction = { }; |
3199 | 3210 | ||
3200 | executeAction.type = BURN_EXECUTE_ACTION_TYPE_PACKAGE_PROVIDER; | 3211 | executeAction.type = BURN_EXECUTE_ACTION_TYPE_PACKAGE_PROVIDER; |
@@ -3203,9 +3214,6 @@ static HRESULT OnExecutePackageProviderAction( | |||
3203 | hr = BuffReadString(pbData, cbData, &iData, &sczPackage); | 3214 | hr = BuffReadString(pbData, cbData, &iData, &sczPackage); |
3204 | ExitOnFailure(hr, "Failed to read package id from message buffer."); | 3215 | ExitOnFailure(hr, "Failed to read package id from message buffer."); |
3205 | 3216 | ||
3206 | hr = BuffReadNumber(pbData, cbData, &iData, reinterpret_cast<DWORD*>(&executeAction.packageProvider.action)); | ||
3207 | ExitOnFailure(hr, "Failed to read action."); | ||
3208 | |||
3209 | // Find the package again. | 3217 | // Find the package again. |
3210 | hr = PackageFindById(pPackages, sczPackage, &executeAction.packageProvider.pPackage); | 3218 | hr = PackageFindById(pPackages, sczPackage, &executeAction.packageProvider.pPackage); |
3211 | if (E_NOTFOUND == hr) | 3219 | if (E_NOTFOUND == hr) |
@@ -3214,8 +3222,25 @@ static HRESULT OnExecutePackageProviderAction( | |||
3214 | } | 3222 | } |
3215 | ExitOnFailure(hr, "Failed to find package: %ls", sczPackage); | 3223 | ExitOnFailure(hr, "Failed to find package: %ls", sczPackage); |
3216 | 3224 | ||
3225 | hr = BuffReadNumber(pbData, cbData, &iData, (DWORD*)&fRollback); | ||
3226 | ExitOnFailure(hr, "Failed to read rollback flag."); | ||
3227 | |||
3228 | // Read provider actions. | ||
3229 | for (DWORD i = 0; i < executeAction.packageProvider.pPackage->cDependencyProviders; ++i) | ||
3230 | { | ||
3231 | BURN_DEPENDENCY_PROVIDER* pProvider = executeAction.packageProvider.pPackage->rgDependencyProviders + i; | ||
3232 | BURN_DEPENDENCY_ACTION* pAction = fRollback ? &pProvider->providerRollback : &pProvider->providerExecute; | ||
3233 | hr = BuffReadNumber(pbData, cbData, &iData, (DWORD*)pAction); | ||
3234 | ExitOnFailure(hr, "Failed to read provider action."); | ||
3235 | } | ||
3236 | |||
3237 | if (!executeAction.packageProvider.pPackage->fPerMachine) | ||
3238 | { | ||
3239 | ExitWithRootFailure(hr, E_INVALIDARG, "ExecutePackageProviderAction called for per-user package."); | ||
3240 | } | ||
3241 | |||
3217 | // Execute the package provider action. | 3242 | // Execute the package provider action. |
3218 | hr = DependencyExecutePackageProviderAction(&executeAction); | 3243 | hr = DependencyExecutePackageProviderAction(&executeAction, fRollback); |
3219 | ExitOnFailure(hr, "Failed to execute package provider action."); | 3244 | ExitOnFailure(hr, "Failed to execute package provider action."); |
3220 | 3245 | ||
3221 | LExit: | 3246 | LExit: |