diff options
Diffstat (limited to '')
| -rw-r--r-- | src/burn/engine/embedded.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/burn/engine/embedded.cpp b/src/burn/engine/embedded.cpp index 4c3de98e..ac4c76d0 100644 --- a/src/burn/engine/embedded.cpp +++ b/src/burn/engine/embedded.cpp | |||
| @@ -40,6 +40,7 @@ static HRESULT OnEmbeddedProgress( | |||
| 40 | 40 | ||
| 41 | *******************************************************************/ | 41 | *******************************************************************/ |
| 42 | extern "C" HRESULT EmbeddedRunBundle( | 42 | extern "C" HRESULT EmbeddedRunBundle( |
| 43 | __in BURN_PIPE_CONNECTION* pConnection, | ||
| 43 | __in_z LPCWSTR wzExecutablePath, | 44 | __in_z LPCWSTR wzExecutablePath, |
| 44 | __in_z LPWSTR sczBaseCommand, | 45 | __in_z LPWSTR sczBaseCommand, |
| 45 | __in_z_opt LPCWSTR wzUserArgs, | 46 | __in_z_opt LPCWSTR wzUserArgs, |
| @@ -55,20 +56,19 @@ extern "C" HRESULT EmbeddedRunBundle( | |||
| 55 | PROCESS_INFORMATION pi = { }; | 56 | PROCESS_INFORMATION pi = { }; |
| 56 | BURN_PIPE_RESULT result = { }; | 57 | BURN_PIPE_RESULT result = { }; |
| 57 | 58 | ||
| 58 | BURN_PIPE_CONNECTION connection = { }; | 59 | PipeConnectionInitialize(pConnection); |
| 59 | PipeConnectionInitialize(&connection); | ||
| 60 | 60 | ||
| 61 | BURN_EMBEDDED_CALLBACK_CONTEXT context = { }; | 61 | BURN_EMBEDDED_CALLBACK_CONTEXT context = { }; |
| 62 | context.pfnGenericMessageHandler = pfnGenericMessageHandler; | 62 | context.pfnGenericMessageHandler = pfnGenericMessageHandler; |
| 63 | context.pvContext = pvContext; | 63 | context.pvContext = pvContext; |
| 64 | 64 | ||
| 65 | hr = PipeCreateNameAndSecret(&connection.sczName, &connection.sczSecret); | 65 | hr = PipeCreateNameAndSecret(&pConnection->sczName, &pConnection->sczSecret); |
| 66 | ExitOnFailure(hr, "Failed to create embedded pipe name and client token."); | 66 | ExitOnFailure(hr, "Failed to create embedded pipe name and client token."); |
| 67 | 67 | ||
| 68 | hr = PipeCreatePipes(&connection, FALSE, &hCreatedPipesEvent); | 68 | hr = PipeCreatePipes(pConnection, FALSE, &hCreatedPipesEvent); |
| 69 | ExitOnFailure(hr, "Failed to create embedded pipe."); | 69 | ExitOnFailure(hr, "Failed to create embedded pipe."); |
| 70 | 70 | ||
| 71 | hr = StrAllocFormatted(&sczCommand, L"%ls -%ls %ls %ls %u", sczBaseCommand, BURN_COMMANDLINE_SWITCH_EMBEDDED, connection.sczName, connection.sczSecret, dwCurrentProcessId); | 71 | hr = StrAllocFormatted(&sczCommand, L"%ls -%ls %ls %ls %u", sczBaseCommand, BURN_COMMANDLINE_SWITCH_EMBEDDED, pConnection->sczName, pConnection->sczSecret, dwCurrentProcessId); |
| 72 | ExitOnFailure(hr, "Failed to append embedded args."); | 72 | ExitOnFailure(hr, "Failed to append embedded args."); |
| 73 | 73 | ||
| 74 | // Always add user supplied arguments last. | 74 | // Always add user supplied arguments last. |
| @@ -81,18 +81,18 @@ extern "C" HRESULT EmbeddedRunBundle( | |||
| 81 | hr = CoreCreateProcess(wzExecutablePath, sczCommand, TRUE, CREATE_NO_WINDOW, NULL, 0, &pi); | 81 | hr = CoreCreateProcess(wzExecutablePath, sczCommand, TRUE, CREATE_NO_WINDOW, NULL, 0, &pi); |
| 82 | ExitOnFailure(hr, "Failed to create embedded process at path: %ls", wzExecutablePath); | 82 | ExitOnFailure(hr, "Failed to create embedded process at path: %ls", wzExecutablePath); |
| 83 | 83 | ||
| 84 | connection.dwProcessId = ::GetProcessId(pi.hProcess); | 84 | pConnection->dwProcessId = ::GetProcessId(pi.hProcess); |
| 85 | connection.hProcess = pi.hProcess; | 85 | pConnection->hProcess = pi.hProcess; |
| 86 | pi.hProcess = NULL; | 86 | pi.hProcess = NULL; |
| 87 | 87 | ||
| 88 | hr = PipeWaitForChildConnect(&connection); | 88 | hr = PipeWaitForChildConnect(pConnection); |
| 89 | ExitOnFailure(hr, "Failed to wait for embedded process to connect to pipe."); | 89 | ExitOnFailure(hr, "Failed to wait for embedded process to connect to pipe."); |
| 90 | 90 | ||
| 91 | hr = PipePumpMessages(connection.hPipe, ProcessEmbeddedMessages, &context, &result); | 91 | hr = PipePumpMessages(pConnection->hPipe, ProcessEmbeddedMessages, &context, &result); |
| 92 | ExitOnFailure(hr, "Failed to process messages from embedded message."); | 92 | ExitOnFailure(hr, "Failed to process messages from embedded message."); |
| 93 | 93 | ||
| 94 | // Get the return code from the embedded process. | 94 | // Get the return code from the embedded process. |
| 95 | hr = CoreWaitForProcCompletion(connection.hProcess, INFINITE, pdwExitCode); | 95 | hr = CoreWaitForProcCompletion(pConnection->hProcess, INFINITE, pdwExitCode); |
| 96 | ExitOnFailure(hr, "Failed to wait for embedded executable: %ls", wzExecutablePath); | 96 | ExitOnFailure(hr, "Failed to wait for embedded executable: %ls", wzExecutablePath); |
| 97 | 97 | ||
| 98 | LExit: | 98 | LExit: |
| @@ -101,7 +101,7 @@ LExit: | |||
| 101 | 101 | ||
| 102 | StrSecureZeroFreeString(sczCommand); | 102 | StrSecureZeroFreeString(sczCommand); |
| 103 | ReleaseHandle(hCreatedPipesEvent); | 103 | ReleaseHandle(hCreatedPipesEvent); |
| 104 | PipeConnectionUninitialize(&connection); | 104 | PipeConnectionUninitialize(pConnection); |
| 105 | 105 | ||
| 106 | return hr; | 106 | return hr; |
| 107 | } | 107 | } |
| @@ -133,8 +133,8 @@ static HRESULT ProcessEmbeddedMessages( | |||
| 133 | break; | 133 | break; |
| 134 | 134 | ||
| 135 | default: | 135 | default: |
| 136 | hr = E_INVALIDARG; | 136 | LogStringLine(REPORT_DEBUG, "Unexpected embedded message received from child process, msg: %u", pMsg->dwMessage); |
| 137 | ExitOnRootFailure(hr, "Unexpected embedded message sent to child process, msg: %u", pMsg->dwMessage); | 137 | dwResult = (DWORD)E_NOTIMPL; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | *pdwResult = dwResult; | 140 | *pdwResult = dwResult; |
