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

Function Ext2PipeControl

Ext2Mgr/Ext2Pipe.cpp:116–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115
116DWORD Ext2PipeControl(PPIPE_REQ *pr, ULONG *len)
117{
118 PPIPE_REQ p;
119 PREQ_QUERY_DRV q;
120 PIPE_REQ ac;
121 DWORD le;
122 DWORD bytes = 0;
123 DWORD rc = 0;
124 int tries = 0;
125
126 p = *pr;
127 q = (PREQ_QUERY_DRV)p->data;
128
129Reopen_try:
130
131 /* just try to connect pipe anyway */
132 if (NULL == Ext2OpenPipe(EXT2_MGR_SRV)) {
133 printf("failed to connect to server.\n");
134 if (Ext2StartExt2Srv()) {
135 goto Reopen_try;
136 }
137 goto errorout;
138 }
139
140 // send a message to srv
141 rc = Ext2WritePipe(g_hPipe, p, p->len, &bytes);
142 if (!rc || bytes != p->len) {
143 le = GetLastError();
144 if (le == ERROR_NO_DATA && tries++ < 10) {
145 Ext2ClosePipe();
146 Sleep(500 * tries);
147 goto Reopen_try;
148 }
149 goto errorout;
150 }
151
152 bytes = 0;
153 memset(&ac, 0, sizeof(ac));
154 rc = Ext2ReadPipe(g_hPipe, &ac, sizeof(ac), &bytes);
155 if (!rc || bytes != sizeof(ac)) {
156 le = GetLastError();
157 goto errorout;
158 }
159 if (*len < ac.len) {
160 if (p) {
161 delete [] p;
162 }
163 *len = ac.len;
164 p = (PIPE_REQ *) new CHAR[*len];
165 *pr = p;
166 if (!p) {
167 goto errorout;
168 }
169 }
170
171 memset(p, 0, *len);
172 memcpy(p, &ac, sizeof(ac));
173 rc = Ext2ReadPipe(g_hPipe, &p->data[0],

Callers 2

Ext2DefineDosDevicePipeFunction · 0.85
Ext2QueryDrivePipeFunction · 0.85

Calls 5

Ext2OpenPipeFunction · 0.85
Ext2StartExt2SrvFunction · 0.85
Ext2ClosePipeFunction · 0.85
Ext2WritePipeFunction · 0.70
Ext2ReadPipeFunction · 0.70

Tested by

no test coverage detected