| 1 | #pragma once |
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 3 | |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | typedef struct _BURN_PIPE_CONNECTION |
| 10 | { |
| 11 | LPWSTR sczName; |
| 12 | LPWSTR sczSecret; |
| 13 | DWORD dwProcessId; |
| 14 | |
| 15 | HANDLE hProcess; |
| 16 | HANDLE hPipe; |
| 17 | HANDLE hCachePipe; |
| 18 | HANDLE hLoggingPipe; |
| 19 | } BURN_PIPE_CONNECTION; |
| 20 | |
| 21 | typedef enum _BURN_PIPE_MESSAGE_TYPE : DWORD |
| 22 | { |
| 23 | BURN_PIPE_MESSAGE_TYPE_LOG = 0xF0000001, |
| 24 | BURN_PIPE_MESSAGE_TYPE_COMPLETE = 0xF0000002, |
| 25 | BURN_PIPE_MESSAGE_TYPE_TERMINATE = 0xF0000003, |
| 26 | } BURN_PIPE_MESSAGE_TYPE; |
| 27 | |
| 28 | typedef struct _BURN_PIPE_RESULT |
| 29 | { |
| 30 | DWORD dwResult; |
| 31 | BOOL fRestart; |
| 32 | } BURN_PIPE_RESULT; |
| 33 | |
| 34 | |
| 35 | typedef HRESULT (*PFN_PIPE_MESSAGE_CALLBACK)( |
| 36 | __in PIPE_MESSAGE* pMsg, |
| 37 | __in_opt LPVOID pvContext, |
| 38 | __out DWORD* pdwResult |
| 39 | ); |
| 40 | |
| 41 | |
| 42 | // Common functions. |
| 43 | void BurnPipeConnectionInitialize( |
| 44 | __in BURN_PIPE_CONNECTION* pConnection |
| 45 | ); |
| 46 | void BurnPipeConnectionUninitialize( |
| 47 | __in BURN_PIPE_CONNECTION* pConnection |
| 48 | ); |
| 49 | HRESULT BurnPipeSendMessage( |
| 50 | __in HANDLE hPipe, |
| 51 | __in DWORD dwMessage, |
| 52 | __in_bcount_opt(cbData) LPVOID pvData, |
| 53 | __in SIZE_T cbData, |
| 54 | __in_opt PFN_PIPE_MESSAGE_CALLBACK pfnCallback, |
| 55 | __in_opt LPVOID pvContext, |
| 56 | __out DWORD* pdwResult |
| 57 | ); |
| 58 | HRESULT BurnPipePumpMessages( |
| 59 | __in HANDLE hPipe, |
| 60 | __in_opt PFN_PIPE_MESSAGE_CALLBACK pfnCallback, |
| 61 | __in_opt LPVOID pvContext, |
| 62 | __in BURN_PIPE_RESULT* pResult |
| 63 | ); |
| 64 | |
| 65 | // Parent functions. |
| 66 | HRESULT BurnPipeCreateNameAndSecret( |
| 67 | __out_z LPWSTR *psczConnectionName, |
| 68 | __out_z LPWSTR *psczSecret |
| 69 | ); |
| 70 | HRESULT BurnPipeCreatePipes( |
| 71 | __in BURN_PIPE_CONNECTION* pConnection, |
| 72 | __in BOOL fCompanion |
| 73 | ); |
| 74 | HRESULT BurnPipeWaitForChildConnect( |
| 75 | __in BURN_PIPE_CONNECTION* pConnection |
| 76 | ); |
| 77 | HRESULT BurnPipeTerminateLoggingPipe( |
| 78 | __in HANDLE hLoggingPipe, |
| 79 | __in DWORD dwParentExitCode |
| 80 | ); |
| 81 | HRESULT BurnPipeTerminateChildProcess( |
| 82 | __in BURN_PIPE_CONNECTION* pConnection, |
| 83 | __in DWORD dwParentExitCode, |
| 84 | __in BOOL fRestart |
| 85 | ); |
| 86 | |
| 87 | // Child functions. |
| 88 | HRESULT BurnPipeChildConnect( |
| 89 | __in BURN_PIPE_CONNECTION* pConnection, |
| 90 | __in BOOL fCompanion |
| 91 | ); |
| 92 | |
| 93 | #ifdef __cplusplus |
| 94 | } |
| 95 | #endif |