Hi,
I have a disk filter driver placed after partmgr and i need to get the partition table.
I know that creating IOCTL_DISK_GET_DRIVE_LAYOUT_EX, or using IoReadPartitionTableEx() and sending them down the stack isn’t working anymore because i’m after partmgr.
After reading other posts regarding this topic i found 2 solutions:
- Send the IOCTL to the top of the stack
- Get the partition table the hard way ( RAW )
I’m currently trying the first solution but i have a problem. Every time i try to send the IOCTL, windows just freezes.
this is the sample code:
topStack = IoGetAttachedDeviceReference( pDeviceObject );
// IoReadPartitionTableEx() mode
status = IoReadPartitionTableEx( topStack, &pDriveLayoutInformation ); ( windows freeze )
if( STATUS_SUCCESS != status )
return status;
// IoBuildDeviceIoControlRequest mode
/*pIrp = IoBuildDeviceIoControlRequest(
IOCTL_DISK_GET_DRIVE_LAYOUT_EX,
topStack,
NULL,
0,
pDriveLayoutInformation,
DriveLayoutInformationSize,
FALSE,
&event,
&ioStatus);
if (NULL == pIrp)
{
core_memory_free( pDriveLayoutInformation );
return STATUS_UNSUCCESSFUL;
}
status = IoCallDriver(topStack, pIrp); //( windows freeze )
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = ioStatus.Status;
}*/
core_memory_free( pDriveLayoutInformation );
ObDereferenceObject( topStack );
I’ve also tried zwCreateFile and ZwDeviceIoControlFile method and got the same result.
Can you please tell me if this is the right way to go, or if there is something wrong with the code, or why is windows freezing?
Thanks,
Radu Vornicu