diff options
Diffstat (limited to 'src/burn/engine/engine.cpp')
| -rw-r--r-- | src/burn/engine/engine.cpp | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index f9dd2184..1314ddc6 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
| @@ -321,10 +321,8 @@ static HRESULT InitializeEngineState( | |||
| 321 | ) | 321 | ) |
| 322 | { | 322 | { |
| 323 | HRESULT hr = S_OK; | 323 | HRESULT hr = S_OK; |
| 324 | LPCWSTR wzParam = NULL; | ||
| 325 | HANDLE hSectionFile = hEngineFile; | 324 | HANDLE hSectionFile = hEngineFile; |
| 326 | HANDLE hSourceEngineFile = INVALID_HANDLE_VALUE; | 325 | HANDLE hSourceEngineFile = INVALID_HANDLE_VALUE; |
| 327 | DWORD64 qw = 0; | ||
| 328 | 326 | ||
| 329 | pEngineState->automaticUpdates = BURN_AU_PAUSE_ACTION_IFELEVATED; | 327 | pEngineState->automaticUpdates = BURN_AU_PAUSE_ACTION_IFELEVATED; |
| 330 | pEngineState->dwElevatedLoggingTlsId = TLS_OUT_OF_INDEXES; | 328 | pEngineState->dwElevatedLoggingTlsId = TLS_OUT_OF_INDEXES; |
| @@ -332,56 +330,9 @@ static HRESULT InitializeEngineState( | |||
| 332 | PipeConnectionInitialize(&pEngineState->companionConnection); | 330 | PipeConnectionInitialize(&pEngineState->companionConnection); |
| 333 | PipeConnectionInitialize(&pEngineState->embeddedConnection); | 331 | PipeConnectionInitialize(&pEngineState->embeddedConnection); |
| 334 | 332 | ||
| 335 | for (int i = 0; i < pEngineState->argc; ++i) | 333 | // Parse command line. |
| 336 | { | 334 | hr = CoreParseCommandLine(pEngineState->argc, pEngineState->argv, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &pEngineState->mode, &pEngineState->automaticUpdates, &pEngineState->fDisableSystemRestore, &pEngineState->internalCommand.sczSourceProcessPath, &pEngineState->internalCommand.sczOriginalSource, &hSectionFile, &hSourceEngineFile, &pEngineState->fDisableUnelevate, &pEngineState->log.dwAttributes, &pEngineState->log.sczPath, &pEngineState->registration.sczActiveParent, &pEngineState->sczIgnoreDependencies, &pEngineState->registration.sczAncestors, &pEngineState->fInvalidCommandLine, &pEngineState->cUnknownArgs, &pEngineState->rgUnknownArgs); |
| 337 | if (pEngineState->argv[i][0] == L'-') | 335 | ExitOnFailure(hr, "Fatal error while parsing command line."); |
| 338 | { | ||
| 339 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &pEngineState->argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED), BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED))) | ||
| 340 | { | ||
| 341 | wzParam = &pEngineState->argv[i][2 + lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED)]; | ||
| 342 | if (L'=' != wzParam[-1] || L'\0' == wzParam[0]) | ||
| 343 | { | ||
| 344 | pEngineState->fInvalidCommandLine = TRUE; | ||
| 345 | TraceLog(E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED); | ||
| 346 | } | ||
| 347 | else | ||
| 348 | { | ||
| 349 | hr = StrStringToUInt64(wzParam, 0, &qw); | ||
| 350 | if (FAILED(hr)) | ||
| 351 | { | ||
| 352 | TraceLog(hr, "Failed to parse file handle: '%ls'", wzParam); | ||
| 353 | hr = S_OK; | ||
| 354 | } | ||
| 355 | else | ||
| 356 | { | ||
| 357 | hSourceEngineFile = (HANDLE)qw; | ||
| 358 | } | ||
| 359 | } | ||
| 360 | } | ||
| 361 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &pEngineState->argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF), BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF))) | ||
| 362 | { | ||
| 363 | wzParam = &pEngineState->argv[i][2 + lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF)]; | ||
| 364 | if (L'=' != wzParam[-1] || L'\0' == wzParam[0]) | ||
| 365 | { | ||
| 366 | pEngineState->fInvalidCommandLine = TRUE; | ||
| 367 | TraceLog(E_INVALIDARG, "Missing required parameter for switch: %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF); | ||
| 368 | } | ||
| 369 | else | ||
| 370 | { | ||
| 371 | hr = StrStringToUInt64(wzParam, 0, &qw); | ||
| 372 | if (FAILED(hr)) | ||
| 373 | { | ||
| 374 | TraceLog(hr, "Failed to parse file handle: '%ls'", wzParam); | ||
| 375 | hr = S_OK; | ||
| 376 | } | ||
| 377 | else | ||
| 378 | { | ||
| 379 | hSectionFile = (HANDLE)qw; | ||
| 380 | } | ||
| 381 | } | ||
| 382 | } | ||
| 383 | } | ||
| 384 | } | ||
| 385 | 336 | ||
| 386 | hr = SectionInitialize(&pEngineState->section, hSectionFile, hSourceEngineFile); | 337 | hr = SectionInitialize(&pEngineState->section, hSectionFile, hSourceEngineFile); |
| 387 | ExitOnFailure(hr, "Failed to initialize engine section."); | 338 | ExitOnFailure(hr, "Failed to initialize engine section."); |
| @@ -399,6 +350,8 @@ static void UninitializeEngineState( | |||
| 399 | AppFreeCommandLineArgs(pEngineState->argv); | 350 | AppFreeCommandLineArgs(pEngineState->argv); |
| 400 | } | 351 | } |
| 401 | 352 | ||
| 353 | ReleaseMem(pEngineState->rgUnknownArgs); | ||
| 354 | |||
| 402 | ReleaseStr(pEngineState->sczIgnoreDependencies); | 355 | ReleaseStr(pEngineState->sczIgnoreDependencies); |
| 403 | 356 | ||
| 404 | PipeConnectionUninitialize(&pEngineState->embeddedConnection); | 357 | PipeConnectionUninitialize(&pEngineState->embeddedConnection); |
| @@ -427,6 +380,9 @@ static void UninitializeEngineState( | |||
| 427 | ReleaseStr(pEngineState->command.wzLayoutDirectory); | 380 | ReleaseStr(pEngineState->command.wzLayoutDirectory); |
| 428 | ReleaseStr(pEngineState->command.wzCommandLine); | 381 | ReleaseStr(pEngineState->command.wzCommandLine); |
| 429 | 382 | ||
| 383 | ReleaseStr(pEngineState->internalCommand.sczOriginalSource); | ||
| 384 | ReleaseStr(pEngineState->internalCommand.sczSourceProcessPath); | ||
| 385 | |||
| 430 | ReleaseStr(pEngineState->log.sczExtension); | 386 | ReleaseStr(pEngineState->log.sczExtension); |
| 431 | ReleaseStr(pEngineState->log.sczPrefix); | 387 | ReleaseStr(pEngineState->log.sczPrefix); |
| 432 | ReleaseStr(pEngineState->log.sczPath); | 388 | ReleaseStr(pEngineState->log.sczPath); |
