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

Function Ext2ReadSync

Ext4Fsd/block.c:459–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459NTSTATUS
460Ext2ReadSync(
461 IN PEXT2_VCB Vcb,
462 IN ULONGLONG Offset,
463 IN ULONG Length,
464 OUT PVOID Buffer,
465 BOOLEAN bVerify
466)
467{
468 PKEVENT Event = NULL;
469
470 PIRP Irp;
471 IO_STATUS_BLOCK IoStatus;
472 NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;
473
474
475 ASSERT(Vcb != NULL);
476 ASSERT(Vcb->TargetDeviceObject != NULL);
477 ASSERT(Buffer != NULL);
478
479 __try {
480
481 Event = Ext2AllocatePool(NonPagedPool, sizeof(KEVENT), 'EK2E');
482
483 if (NULL == Event) {
484 DEBUG(DL_ERR, ( "Ex2ReadSync: failed to allocate Event.\n"));
485 __leave;
486 }
487
488 INC_MEM_COUNT(PS_DISK_EVENT, Event, sizeof(KEVENT));
489
490 KeInitializeEvent(Event, NotificationEvent, FALSE);
491
492 Irp = IoBuildSynchronousFsdRequest(
493 IRP_MJ_READ,
494 Vcb->TargetDeviceObject,
495 Buffer,
496 Length,
497 (PLARGE_INTEGER)(&Offset),
498 Event,
499 &IoStatus
500 );
501
502 if (!Irp) {
503 Status = STATUS_INSUFFICIENT_RESOURCES;
504 __leave;
505 }
506
507 if (bVerify) {
508 SetFlag( IoGetNextIrpStackLocation(Irp)->Flags,
509 SL_OVERRIDE_VERIFY_VOLUME );
510 }
511
512 Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
513
514 if (Status == STATUS_PENDING) {
515 KeWaitForSingleObject(
516 Event,

Callers 1

Ext2ReadDiskFunction · 0.85

Calls 2

Ext2AllocatePoolFunction · 0.85
Ext2FreePoolFunction · 0.85

Tested by

no test coverage detected