diff options
author | Rob Mensching <rob@firegiant.com> | 2024-01-11 18:26:20 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
commit | 0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch) | |
tree | 9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h | |
parent | 2824298d9dd817a47527c920363556b54ead5d5d (diff) | |
download | wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2 wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip |
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h | 115 |
1 files changed, 112 insertions, 3 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h b/src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h index d16d768c..e92462d2 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/pipeutil.h | |||
@@ -6,7 +6,9 @@ | |||
6 | extern "C" { | 6 | extern "C" { |
7 | #endif | 7 | #endif |
8 | 8 | ||
9 | #define ReleasePipeHandle(h) if (h != INVALID_HANDLE_VALUE) { ::CloseHandle(h); } | 9 | // macro definitions |
10 | |||
11 | #define ReleasePipeHandle(h) if (h != INVALID_HANDLE_VALUE) { ::CloseHandle(h); h = INVALID_HANDLE_VALUE; } | ||
10 | #define ReleasePipeMessage(pMsg) if (pMsg) { PipeFreeMessage(pMsg); } | 12 | #define ReleasePipeMessage(pMsg) if (pMsg) { PipeFreeMessage(pMsg); } |
11 | 13 | ||
12 | 14 | ||
@@ -27,6 +29,23 @@ typedef struct _PIPE_MESSAGE | |||
27 | LPVOID pvData; | 29 | LPVOID pvData; |
28 | } PIPE_MESSAGE; | 30 | } PIPE_MESSAGE; |
29 | 31 | ||
32 | typedef struct _PIPE_RPC_HANDLE | ||
33 | { | ||
34 | HANDLE hPipe; | ||
35 | CRITICAL_SECTION cs; | ||
36 | |||
37 | BOOL fInitialized; | ||
38 | BOOL fOwnHandle; | ||
39 | } PIPE_RPC_HANDLE; | ||
40 | |||
41 | typedef struct _PIPE_RPC_RESULT | ||
42 | { | ||
43 | HRESULT hr; | ||
44 | |||
45 | DWORD cbData; | ||
46 | LPBYTE pbData; | ||
47 | } PIPE_RPC_RESULT; | ||
48 | |||
30 | 49 | ||
31 | // functions | 50 | // functions |
32 | 51 | ||
@@ -72,17 +91,87 @@ DAPI_(HRESULT) PipeReadMessage( | |||
72 | ); | 91 | ); |
73 | 92 | ||
74 | /******************************************************************* | 93 | /******************************************************************* |
75 | PipeWriteMessage - writes a message to the pipe. | 94 | PipeRpcInitiailize - initializes a RPC pipe handle from a pipe handle. |
76 | 95 | ||
77 | *******************************************************************/ | 96 | *******************************************************************/ |
78 | DAPI_(HRESULT) PipeWriteMessage( | 97 | DAPI_(void) PipeRpcInitialize( |
98 | __in PIPE_RPC_HANDLE* phRpcPipe, | ||
79 | __in HANDLE hPipe, | 99 | __in HANDLE hPipe, |
100 | __in BOOL fTakeHandleOwnership | ||
101 | ); | ||
102 | |||
103 | /******************************************************************* | ||
104 | PipeRpcInitialized - checks if a RPC pipe handle is initialized. | ||
105 | |||
106 | *******************************************************************/ | ||
107 | DAPI_(BOOL) PipeRpcInitialized( | ||
108 | __in PIPE_RPC_HANDLE* phRpcPipe | ||
109 | ); | ||
110 | |||
111 | /******************************************************************* | ||
112 | PipeRpcUninitiailize - uninitializes a RPC pipe handle. | ||
113 | |||
114 | *******************************************************************/ | ||
115 | DAPI_(void) PipeRpcUninitiailize( | ||
116 | __in PIPE_RPC_HANDLE* phRpcPipe | ||
117 | ); | ||
118 | |||
119 | /******************************************************************* | ||
120 | PipeRpcReadMessage - reads a message from the pipe. Free with | ||
121 | PipeFreeMessage(). | ||
122 | |||
123 | *******************************************************************/ | ||
124 | DAPI_(HRESULT) PipeRpcReadMessage( | ||
125 | __in PIPE_RPC_HANDLE* phRpcPipe, | ||
126 | __in PIPE_MESSAGE* pMsg | ||
127 | ); | ||
128 | |||
129 | /******************************************************************* | ||
130 | PipeRpcRequest - sends message and reads a response over the pipe. | ||
131 | Free with PipeFreeRpcResult(). | ||
132 | |||
133 | *******************************************************************/ | ||
134 | DAPI_(HRESULT) PipeRpcRequest( | ||
135 | __in PIPE_RPC_HANDLE* phRpcPipe, | ||
136 | __in DWORD dwMessageType, | ||
137 | __in_bcount(cbArgs) LPVOID pbArgs, | ||
138 | __in SIZE_T cbArgs, | ||
139 | __in PIPE_RPC_RESULT* pResult | ||
140 | ); | ||
141 | |||
142 | /******************************************************************* | ||
143 | PipeRpcResponse - sends response over the pipe. | ||
144 | |||
145 | *******************************************************************/ | ||
146 | DAPI_(HRESULT) PipeRpcResponse( | ||
147 | __in PIPE_RPC_HANDLE* phPipe, | ||
148 | __in DWORD dwMessageType, | ||
149 | __in HRESULT hrResult, | ||
150 | __in_bcount(cbResult) LPVOID pvResult, | ||
151 | __in SIZE_T cbResult | ||
152 | ); | ||
153 | |||
154 | /******************************************************************* | ||
155 | PipeRpcWriteMessage - writes a message to the pipe. | ||
156 | |||
157 | *******************************************************************/ | ||
158 | DAPI_(HRESULT) PipeRpcWriteMessage( | ||
159 | __in PIPE_RPC_HANDLE* phPipe, | ||
80 | __in DWORD dwMessageType, | 160 | __in DWORD dwMessageType, |
81 | __in_bcount_opt(cbData) LPVOID pvData, | 161 | __in_bcount_opt(cbData) LPVOID pvData, |
82 | __in SIZE_T cbData | 162 | __in SIZE_T cbData |
83 | ); | 163 | ); |
84 | 164 | ||
85 | /******************************************************************* | 165 | /******************************************************************* |
166 | PipeWriteDisconnect - writes a message to the pipe indicating the | ||
167 | client should disconnect. | ||
168 | |||
169 | *******************************************************************/ | ||
170 | DAPI_(HRESULT) PipeWriteDisconnect( | ||
171 | __in HANDLE hPipe | ||
172 | ); | ||
173 | |||
174 | /******************************************************************* | ||
86 | PipeFreeMessage - frees any memory allocated in PipeReadMessage. | 175 | PipeFreeMessage - frees any memory allocated in PipeReadMessage. |
87 | 176 | ||
88 | *******************************************************************/ | 177 | *******************************************************************/ |
@@ -91,14 +180,34 @@ DAPI_(void) PipeFreeMessage( | |||
91 | ); | 180 | ); |
92 | 181 | ||
93 | /******************************************************************* | 182 | /******************************************************************* |
183 | PipeFreeRpcResult - frees any memory allocated in PipeRpcRequest. | ||
184 | |||
185 | *******************************************************************/ | ||
186 | DAPI_(void) PipeFreeRpcResult( | ||
187 | __in PIPE_RPC_RESULT* pResult | ||
188 | ); | ||
189 | |||
190 | /******************************************************************* | ||
94 | PipeServerWaitForClientConnect - Called from the server process to | 191 | PipeServerWaitForClientConnect - Called from the server process to |
95 | wait for a client to connect back to the provided pipe. | 192 | wait for a client to connect back to the provided pipe. |
96 | 193 | ||
97 | *******************************************************************/ | 194 | *******************************************************************/ |
98 | DAPI_(HRESULT) PipeServerWaitForClientConnect( | 195 | DAPI_(HRESULT) PipeServerWaitForClientConnect( |
196 | __in HANDLE hClientProcess, | ||
99 | __in HANDLE hPipe | 197 | __in HANDLE hPipe |
100 | ); | 198 | ); |
101 | 199 | ||
200 | /******************************************************************* | ||
201 | PipeWriteMessage - writes a message to the pipe. | ||
202 | |||
203 | *******************************************************************/ | ||
204 | DAPI_(HRESULT) PipeWriteMessage( | ||
205 | __in HANDLE hPipe, | ||
206 | __in DWORD dwMessageType, | ||
207 | __in_bcount_opt(cbData) LPVOID pvData, | ||
208 | __in SIZE_T cbData | ||
209 | ); | ||
210 | |||
102 | #ifdef __cplusplus | 211 | #ifdef __cplusplus |
103 | } | 212 | } |
104 | #endif | 213 | #endif |