MCPcopy Create free account
hub / github.com/Apache553/SubtitleFontHelper / OpenPipe

Function OpenPipe

FontLoadInterceptor/RpcClient.cpp:219–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217 }
218
219 wil::unique_hfile OpenPipe()
220 {
221 std::wstring pipeName = LR"_(\\.\pipe\SubtitleFontAutoLoaderRpc-)_";
222 pipeName += GetCurrentProcessUserSid();
223 wil::unique_hfile pipe(CreateFileW(
224 pipeName.c_str(),
225 GENERIC_READ | GENERIC_WRITE,
226 0,
227 nullptr,
228 OPEN_EXISTING,
229 0,
230 nullptr));
231 if (!pipe.is_valid())
232 {
233 if (GetLastError() == ERROR_PIPE_BUSY)
234 {
235 // wait previous request finish
236 THROW_LAST_ERROR_IF(WaitNamedPipeW(pipeName.c_str(), NMPWAIT_USE_DEFAULT_WAIT) == FALSE);
237 pipe.reset(CreateFileW(
238 pipeName.c_str(),
239 GENERIC_READ | GENERIC_WRITE,
240 0,
241 nullptr,
242 OPEN_EXISTING,
243 0,
244 nullptr));
245 }
246 THROW_LAST_ERROR_IF(!pipe.is_valid());
247 }
248
249 return pipe;
250 }
251
252 void SendRequst(wil::unique_hfile& pipe, const FontQueryRequest& request)
253 {

Callers 1

MakeRequestFunction · 0.85

Calls 1

GetCurrentProcessUserSidFunction · 0.85

Tested by

no test coverage detected