diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 10:18:08 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 12:50:09 -0500 |
| commit | f43d176f95601ff7524e06247166d4f3b6e61c05 (patch) | |
| tree | 2e3580ca60c85e1d07a0ab4a2b1279d25fd41f6c /src/api/burn/balutil/balinfo.cpp | |
| parent | 9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2 (diff) | |
| download | wix-f43d176f95601ff7524e06247166d4f3b6e61c05.tar.gz wix-f43d176f95601ff7524e06247166d4f3b6e61c05.tar.bz2 wix-f43d176f95601ff7524e06247166d4f3b6e61c05.zip | |
Make the BA responsible for parsing restart prompt behavior.
Fixes #4975
Diffstat (limited to 'src/api/burn/balutil/balinfo.cpp')
| -rw-r--r-- | src/api/burn/balutil/balinfo.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/api/burn/balutil/balinfo.cpp b/src/api/burn/balutil/balinfo.cpp index f71784a5..2746f49e 100644 --- a/src/api/burn/balutil/balinfo.cpp +++ b/src/api/burn/balutil/balinfo.cpp | |||
| @@ -19,7 +19,7 @@ static HRESULT ParseOverridableVariablesFromXml( | |||
| 19 | 19 | ||
| 20 | DAPI_(HRESULT) BalInfoParseCommandLine( | 20 | DAPI_(HRESULT) BalInfoParseCommandLine( |
| 21 | __in BAL_INFO_COMMAND* pCommand, | 21 | __in BAL_INFO_COMMAND* pCommand, |
| 22 | __in LPCWSTR wzCommandLine | 22 | __in const BOOTSTRAPPER_COMMAND* pBootstrapperCommand |
| 23 | ) | 23 | ) |
| 24 | { | 24 | { |
| 25 | HRESULT hr = S_OK; | 25 | HRESULT hr = S_OK; |
| @@ -29,13 +29,13 @@ DAPI_(HRESULT) BalInfoParseCommandLine( | |||
| 29 | 29 | ||
| 30 | BalInfoUninitializeCommandLine(pCommand); | 30 | BalInfoUninitializeCommandLine(pCommand); |
| 31 | 31 | ||
| 32 | if (!wzCommandLine || !*wzCommandLine) | 32 | if (!pBootstrapperCommand->wzCommandLine || !*pBootstrapperCommand->wzCommandLine) |
| 33 | { | 33 | { |
| 34 | ExitFunction(); | 34 | ExitFunction(); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | hr = AppParseCommandLine(wzCommandLine, &argc, &argv); | 37 | hr = AppParseCommandLine(pBootstrapperCommand->wzCommandLine, &argc, &argv); |
| 38 | ExitOnFailure(hr, "Failed to parse command line."); | 38 | BalExitOnFailure(hr, "Failed to parse command line."); |
| 39 | 39 | ||
| 40 | for (int i = 0; i < argc; ++i) | 40 | for (int i = 0; i < argc; ++i) |
| 41 | { | 41 | { |
| @@ -43,7 +43,24 @@ DAPI_(HRESULT) BalInfoParseCommandLine( | |||
| 43 | 43 | ||
| 44 | if (argv[i][0] == L'-' || argv[i][0] == L'/') | 44 | if (argv[i][0] == L'-' || argv[i][0] == L'/') |
| 45 | { | 45 | { |
| 46 | fUnknownArg = TRUE; | 46 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"norestart", -1)) |
| 47 | { | ||
| 48 | if (BAL_INFO_RESTART_UNKNOWN == pCommand->restart) | ||
| 49 | { | ||
| 50 | pCommand->restart = BAL_INFO_RESTART_NEVER; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"forcerestart", -1)) | ||
| 54 | { | ||
| 55 | if (BAL_INFO_RESTART_UNKNOWN == pCommand->restart) | ||
| 56 | { | ||
| 57 | pCommand->restart = BAL_INFO_RESTART_ALWAYS; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | else | ||
| 61 | { | ||
| 62 | fUnknownArg = TRUE; | ||
| 63 | } | ||
| 47 | } | 64 | } |
| 48 | else | 65 | else |
| 49 | { | 66 | { |
| @@ -55,10 +72,10 @@ DAPI_(HRESULT) BalInfoParseCommandLine( | |||
| 55 | else | 72 | else |
| 56 | { | 73 | { |
| 57 | hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(&pCommand->rgVariableNames), pCommand->cVariables, 1, sizeof(LPWSTR), 5); | 74 | hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(&pCommand->rgVariableNames), pCommand->cVariables, 1, sizeof(LPWSTR), 5); |
| 58 | ExitOnFailure(hr, "Failed to ensure size for variable names."); | 75 | BalExitOnFailure(hr, "Failed to ensure size for variable names."); |
| 59 | 76 | ||
| 60 | hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(&pCommand->rgVariableValues), pCommand->cVariables, 1, sizeof(LPWSTR), 5); | 77 | hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(&pCommand->rgVariableValues), pCommand->cVariables, 1, sizeof(LPWSTR), 5); |
| 61 | ExitOnFailure(hr, "Failed to ensure size for variable values."); | 78 | BalExitOnFailure(hr, "Failed to ensure size for variable values."); |
| 62 | 79 | ||
| 63 | LPWSTR* psczVariableName = pCommand->rgVariableNames + pCommand->cVariables; | 80 | LPWSTR* psczVariableName = pCommand->rgVariableNames + pCommand->cVariables; |
| 64 | LPWSTR* psczVariableValue = pCommand->rgVariableValues + pCommand->cVariables; | 81 | LPWSTR* psczVariableValue = pCommand->rgVariableValues + pCommand->cVariables; |
| @@ -86,6 +103,11 @@ DAPI_(HRESULT) BalInfoParseCommandLine( | |||
| 86 | } | 103 | } |
| 87 | 104 | ||
| 88 | LExit: | 105 | LExit: |
| 106 | if (BAL_INFO_RESTART_UNKNOWN == pCommand->restart) | ||
| 107 | { | ||
| 108 | pCommand->restart = BOOTSTRAPPER_DISPLAY_FULL > pBootstrapperCommand->display ? BAL_INFO_RESTART_AUTOMATIC : BAL_INFO_RESTART_PROMPT; | ||
| 109 | } | ||
| 110 | |||
| 89 | if (argv) | 111 | if (argv) |
| 90 | { | 112 | { |
| 91 | AppFreeCommandLineArgs(argv); | 113 | AppFreeCommandLineArgs(argv); |
