能力值:
( LV2,RANK:10 )
|
-
-
2 楼
NTSTATUS GetGeometry(PDEVICE_OBJECT pDiskDevObj, PDISK_GEOMETRY pDiskGeo)
/*++
Routine Description:
Returns the Geometry of Disk
Arguments:
Target Device Object representing the disk and Pointer to geometry structure
Return Value:
STATUS
--*/
{
IO_STATUS_BLOCK IoStatusBlock;
KEVENT Event;
PIRP pIrp;
NTSTATUS status;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
pIrp = IoBuildDeviceIoControlRequest(
IOCTL_DISK_GET_DRIVE_GEOMETRY,
pDiskDevObj,
NULL,
0,
pDiskGeo,
sizeof(DISK_GEOMETRY),
FALSE,
&Event,
&IoStatusBlock);
if (!pIrp)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
status = IoCallDriver(pDiskDevObj, pIrp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
status = IoStatusBlock.Status;
}
return status;
}
用这个能获得磁盘容量 别人告诉我的
|
|
|