diff options
Diffstat (limited to '')
| -rw-r--r-- | src/burn/engine/cabextract.cpp | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/burn/engine/cabextract.cpp b/src/burn/engine/cabextract.cpp index 5a02ff8a..56146a39 100644 --- a/src/burn/engine/cabextract.cpp +++ b/src/burn/engine/cabextract.cpp | |||
| @@ -262,10 +262,8 @@ extern "C" HRESULT CabExtractClose( | |||
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | // wait for thread to terminate | 264 | // wait for thread to terminate |
| 265 | if (WAIT_OBJECT_0 != ::WaitForSingleObject(pContext->Cabinet.hThread, INFINITE)) | 265 | hr = AppWaitForSingleObject(pContext->Cabinet.hThread, INFINITE); |
| 266 | { | 266 | ExitOnFailure(hr, "Failed to wait for thread to terminate."); |
| 267 | ExitWithLastError(hr, "Failed to wait for thread to terminate."); | ||
| 268 | } | ||
| 269 | } | 267 | } |
| 270 | 268 | ||
| 271 | LExit: | 269 | LExit: |
| @@ -306,29 +304,31 @@ static HRESULT WaitForOperation( | |||
| 306 | { | 304 | { |
| 307 | HRESULT hr = S_OK; | 305 | HRESULT hr = S_OK; |
| 308 | HANDLE rghWait[2] = { }; | 306 | HANDLE rghWait[2] = { }; |
| 307 | DWORD dwSignaledIndex = 0; | ||
| 309 | 308 | ||
| 310 | // wait for operation complete event | 309 | // wait for operation complete event |
| 311 | rghWait[0] = pContext->Cabinet.hOperationCompleteEvent; | 310 | rghWait[0] = pContext->Cabinet.hOperationCompleteEvent; |
| 312 | rghWait[1] = pContext->Cabinet.hThread; | 311 | rghWait[1] = pContext->Cabinet.hThread; |
| 313 | switch (::WaitForMultipleObjects(countof(rghWait), rghWait, FALSE, INFINITE)) | 312 | |
| 313 | hr = AppWaitForMultipleObjects(countof(rghWait), rghWait, FALSE, INFINITE, &dwSignaledIndex); | ||
| 314 | ExitOnFailure(hr, "Failed to wait for operation complete event."); | ||
| 315 | |||
| 316 | switch (dwSignaledIndex) | ||
| 314 | { | 317 | { |
| 315 | case WAIT_OBJECT_0: | 318 | case 0: |
| 316 | if (!::ResetEvent(pContext->Cabinet.hOperationCompleteEvent)) | 319 | if (!::ResetEvent(pContext->Cabinet.hOperationCompleteEvent)) |
| 317 | { | 320 | { |
| 318 | ExitWithLastError(hr, "Failed to reset operation complete event."); | 321 | ExitWithLastError(hr, "Failed to reset operation complete event."); |
| 319 | } | 322 | } |
| 320 | break; | ||
| 321 | 323 | ||
| 322 | case WAIT_OBJECT_0 + 1: | 324 | break; |
| 325 | case 1: | ||
| 323 | if (!::GetExitCodeThread(pContext->Cabinet.hThread, (DWORD*)&hr)) | 326 | if (!::GetExitCodeThread(pContext->Cabinet.hThread, (DWORD*)&hr)) |
| 324 | { | 327 | { |
| 325 | ExitWithLastError(hr, "Failed to get extraction thread exit code."); | 328 | ExitWithLastError(hr, "Failed to get extraction thread exit code."); |
| 326 | } | 329 | } |
| 327 | ExitFunction(); | ||
| 328 | 330 | ||
| 329 | case WAIT_FAILED: __fallthrough; | 331 | ExitFunction(); |
| 330 | default: | ||
| 331 | ExitWithLastError(hr, "Failed to wait for operation complete event."); | ||
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | // clear operation | 334 | // clear operation |
| @@ -430,10 +430,8 @@ static DWORD WINAPI ExtractThreadProc( | |||
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | // wait for begin operation event | 432 | // wait for begin operation event |
| 433 | if (WAIT_FAILED == ::WaitForSingleObject(pContext->Cabinet.hBeginOperationEvent, INFINITE)) | 433 | hr = AppWaitForSingleObject(pContext->Cabinet.hBeginOperationEvent, INFINITE); |
| 434 | { | 434 | ExitOnFailure(hr, "Failed to wait for begin operation event."); |
| 435 | ExitWithLastError(hr, "Failed to wait for begin operation event."); | ||
| 436 | } | ||
| 437 | 435 | ||
| 438 | if (!::ResetEvent(pContext->Cabinet.hBeginOperationEvent)) | 436 | if (!::ResetEvent(pContext->Cabinet.hBeginOperationEvent)) |
| 439 | { | 437 | { |
| @@ -517,10 +515,8 @@ static INT_PTR CopyFileCallback( | |||
| 517 | } | 515 | } |
| 518 | 516 | ||
| 519 | // wait for begin operation event | 517 | // wait for begin operation event |
| 520 | if (WAIT_FAILED == ::WaitForSingleObject(pContext->Cabinet.hBeginOperationEvent, INFINITE)) | 518 | hr = AppWaitForSingleObject(pContext->Cabinet.hBeginOperationEvent, INFINITE); |
| 521 | { | 519 | ExitOnFailure(hr, "Failed to wait for begin operation event."); |
| 522 | ExitWithLastError(hr, "Failed to wait for begin operation event."); | ||
| 523 | } | ||
| 524 | 520 | ||
| 525 | if (!::ResetEvent(pContext->Cabinet.hBeginOperationEvent)) | 521 | if (!::ResetEvent(pContext->Cabinet.hBeginOperationEvent)) |
| 526 | { | 522 | { |
| @@ -552,10 +548,8 @@ static INT_PTR CopyFileCallback( | |||
| 552 | } | 548 | } |
| 553 | 549 | ||
| 554 | // wait for begin operation event | 550 | // wait for begin operation event |
| 555 | if (WAIT_FAILED == ::WaitForSingleObject(pContext->Cabinet.hBeginOperationEvent, INFINITE)) | 551 | hr = AppWaitForSingleObject(pContext->Cabinet.hBeginOperationEvent, INFINITE); |
| 556 | { | 552 | ExitOnFailure(hr, "Failed to wait for begin operation event."); |
| 557 | ExitWithLastError(hr, "Failed to wait for begin operation event."); | ||
| 558 | } | ||
| 559 | 553 | ||
| 560 | if (!::ResetEvent(pContext->Cabinet.hBeginOperationEvent)) | 554 | if (!::ResetEvent(pContext->Cabinet.hBeginOperationEvent)) |
| 561 | { | 555 | { |
