MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2OpenPipe

Function Ext2OpenPipe

Ext2Mgr/Ext2Pipe.cpp:31–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29int Ext2StartSrv();
30
31HANDLE Ext2OpenPipe(CHAR *PipeName)
32{
33 DWORD rc;
34
35 if (g_hPipe != NULL && g_hPipe != INVALID_HANDLE_VALUE) {
36 return g_hPipe;
37 }
38
39retry:
40
41 // open pipe (created by Ext2Srv)
42 g_hPipe = CreateFile(PipeName,
43 GENERIC_READ | GENERIC_WRITE,
44 0, NULL, OPEN_EXISTING, 0, NULL);
45
46 // exit if the pipe handle is valid.
47 if (g_hPipe == INVALID_HANDLE_VALUE) {
48
49 // exit if an error other than ERROR_PIPE_BUSY occurs.
50 rc = GetLastError();
51 if (rc != ERROR_PIPE_BUSY) {
52 return NULL;
53 }
54
55 // all pipe instances are busy, so wait for 20 seconds.
56 if (!WaitNamedPipe(PipeName, 20000)) {
57 return NULL;
58 }
59
60 Ext2StartSrv();
61
62 goto retry;
63 }
64
65 return g_hPipe;
66}
67
68void Ext2ClosePipe()
69{

Callers 1

Ext2PipeControlFunction · 0.85

Calls 1

Ext2StartSrvFunction · 0.85

Tested by

no test coverage detected