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

Function Ext2QueryDrivePipe

Ext2Mgr/Ext2Pipe.cpp:291–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289
290
291DWORD Ext2QueryDrivePipe(CHAR drive, CHAR *symlink)
292{
293 PPIPE_REQ p = NULL;
294 PREQ_QUERY_DRV q;
295 ULONG len = REQ_BODY_SIZE;
296 DWORD rc = 0;
297
298 p = (PPIPE_REQ) new CHAR[len];
299 if (NULL == p)
300 goto errorout;
301
302 /* do query */
303 memset(p, 0, len);
304 p->magic = PIPE_REQ_MAGIC;
305 p->len = sizeof(PIPE_REQ) + sizeof(REQ_QUERY_DRV);
306 p->cmd = CMD_QUERY_DRV;
307 q = (PREQ_QUERY_DRV)&p->data[0];
308 q->drive = (UCHAR)toupper(drive);
309 rc = Ext2PipeControl(&p, &len);
310 if ( !rc) {
311 printf("pipe communication failed.\n");
312 goto errorout;
313 }
314
315 rc = q->type;
316 if (q->result) {
317 printf("%C: -> %s\n", q->drive, &q->name[0]);
318 strcpy(symlink, &q->name[0]);
319 } else {
320 printf("failed to queyr %C:\n", q->drive);
321 goto errorout;
322 }
323
324errorout:
325
326 if (p)
327 delete []p;
328
329 return rc;
330}
331
332DWORD Ext2QueryDriveLocal(CHAR drive, CHAR *symlink)
333{

Callers 1

Ext2QueryDriveFunction · 0.85

Calls 1

Ext2PipeControlFunction · 0.85

Tested by

no test coverage detected