Hello,
I want to obtain the disk geometry and need help with an error I am
seeing.
The code snippet is as follows:
RtlInitUnicodeString ( &uName, L"\\Device\\Harddisk1\\DR2" );
dStatus = IoGetDeviceObjectPointer ( &uName,
FILE_ALL_ACCESS,
&pFileObject,
&pDeviceObject );
..........
irp = IoBuildDeviceIoControlRequest
( IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
pDeviceObject,
NULL,
0,
(PVOID)pOutputBuffer,
*pdOutputBufferSize,
FALSE,
&event,
&IoStatus );
if (!irp) {
return STATUS_INSUFFICIENT_RESOURCES;
}
status = IoCallDriver (pDeviceObject, irp);
The IoCallDriver returns NT_SUCCESS but the disk geometry
(pOutputBuffer) is all zero's.
What am I missing? I tried RtlInitUnicodeString ( &uName, L"\\\\.\
\PhysicalDrive0" ) but got the same result.
Thanks,
..Ram