aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/core.cpp')
-rw-r--r--src/burn/engine/core.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp
index 6d6d99d5..ca2e41c2 100644
--- a/src/burn/engine/core.cpp
+++ b/src/burn/engine/core.cpp
@@ -1301,6 +1301,66 @@ LExit:
1301 return hr; 1301 return hr;
1302} 1302}
1303 1303
1304HRESULT CoreAppendLogToCommandLine(
1305 __deref_inout_z LPWSTR* psczCommandLine,
1306 __deref_inout_z_opt LPWSTR* psczObfuscatedCommandLine,
1307 __in BOOL fRollback,
1308 __in BURN_VARIABLES* pVariables,
1309 __in BURN_PACKAGE *pPackage
1310 )
1311{
1312 HRESULT hr = S_OK;
1313 INT ccArgs = 0;
1314 LPWSTR* rgszArgs = nullptr;
1315 LPWSTR szLogArg = nullptr;
1316 LPWSTR szLogArgFormatted = nullptr;
1317 LPCWSTR szLogVar = fRollback ? pPackage->sczRollbackLogPathVariable : pPackage->sczLogPathVariable;
1318
1319 if (!szLogVar || !*szLogVar)
1320 {
1321 ExitFunction1(hr = S_FALSE);
1322 }
1323
1324 hr = AppParseCommandLine(*psczCommandLine, &ccArgs, &rgszArgs);
1325 ExitOnFailure(hr, "Failed parsing command line");
1326
1327 // Log flag already present?
1328 for (INT i = 0; i < ccArgs; ++i)
1329 {
1330 if (rgszArgs[i][0] == L'-' || rgszArgs[i][0] == L'/')
1331 {
1332 // Now looking for 'log' or 'l'
1333 if ((CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &rgszArgs[i][1], -1, L"log", -1))
1334 || (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &rgszArgs[i][1], -1, L"l", -1)))
1335 {
1336 ExitFunction1(hr = S_FALSE);
1337 }
1338 }
1339 }
1340
1341 hr = StrAllocFormatted(&szLogArg, L" -log \"[%ls]\"", szLogVar);
1342 ExitOnFailure(hr, "Failed creating log argument");
1343
1344 hr = VariableFormatString(pVariables, szLogArg, &szLogArgFormatted, NULL);
1345 ExitOnFailure(hr, "Failed to format argument string.");
1346
1347 hr = StrAllocConcat(psczCommandLine, szLogArgFormatted, 0);
1348 ExitOnFailure(hr, "Failed concatenating '-log' to command line");
1349
1350 hr = StrAllocConcat(psczObfuscatedCommandLine, szLogArgFormatted, 0);
1351 ExitOnFailure(hr, "Failed concatenating '-log' to obfuscated command line");
1352
1353LExit:
1354 if (rgszArgs)
1355 {
1356 AppFreeCommandLineArgs(rgszArgs);
1357 }
1358 ReleaseStr(szLogArg);
1359 ReleaseStr(szLogArgFormatted);
1360
1361 return hr;
1362}
1363
1304extern "C" HRESULT CoreAppendSplashScreenWindowToCommandLine( 1364extern "C" HRESULT CoreAppendSplashScreenWindowToCommandLine(
1305 __in_opt HWND hwndSplashScreen, 1365 __in_opt HWND hwndSplashScreen,
1306 __deref_inout_z LPWSTR* psczCommandLine 1366 __deref_inout_z LPWSTR* psczCommandLine