阅读:1715回复:3
向vpb的realDevice发送IOCTL_STORAGE_QUERY_PROPERTY返回结果不对,高手请帮忙
目前向realDevice发送查询请求,能正常返回,但是返回的结果中busType是一个不合法的值
代码和之前的帖子是一致的,如下: OOLEAN QueryStorageDeviceDescriptor( IN PDEVICE_OBJECT pStorageDevice, OUT PSTORAGE_DEVICE_DESCRIPTOR pStorageDeviceDescriptor ) { KEVENT myEvent; STORAGE_PROPERTY_QUERY query; IO_STATUS_BLOCK iostatus; PIRP Irp = NULL; NTSTATUS status; // KIRQL CurrentIRQL; CurrentIRQL = KeGetCurrentIrql(); if(CurrentIRQL >= DISPATCH_LEVEL) { KdPrint(("CurrentIRQL != PASSIVE_LEVEL\n")); return FALSE; } // first set the query properties query.PropertyId = StorageDeviceProperty; query.QueryType = PropertyStandardQuery; KeInitializeEvent(&myEvent, NotificationEvent, FALSE); Irp = IoBuildDeviceIoControlRequest( IOCTL_STORAGE_QUERY_PROPERTY, pStorageDevice, (PVOID)(&query), sizeof(STORAGE_PROPERTY_QUERY), (PVOID)pStorageDeviceDescriptor, sizeof(STORAGE_DEVICE_DESCRIPTOR), FALSE, &myEvent, &iostatus ); if( !Irp ) { KdPrint(("Error in build IRP!")); return FALSE; } status = IoCallDriver(pStorageDevice, Irp); if (status == STATUS_PENDING) { KeWaitForSingleObject(&myEvent, Executive, KernelMode, FALSE, NULL); status = iostatus.Status; } if( NT_SUCCESS(status) ) { KdPrint(("The BusType is %x", &(pStorageDeviceDescriptor->BusType))); return TRUE; } else return FALSE; } |
|
沙发#
发布于:2009-09-29 16:52
status状态值返回是正确的
高手帮帮忙啊! |
|
板凳#
发布于:2009-09-29 22:25
KdPrint(("The BusType is %x", &(pStorageDeviceDescriptor->BusType)));
You are printing address, not value. :) |
|
地板#
发布于:2009-09-30 11:02
竟然是这个原因 谢谢版主了! |
|