Be very precise in the terminology you use, what you wrote is mixing
terminology between a disk filter and a volume filter.
As far as I read what you wrote, you have installed a disk filter and
from within the PnP StartDevice you try to attach to a volume ? This
is bound to fail, volumes don’t exist until after the disk is started.
By the sound of it you seem to have some architecture in mind whereby
you think you need to filter both disks and volumes. If this is the
case, then write both a disk filter and a volume filter, don’t try to
do both in the same driver.
Tell us what you’re trying to achieve and we may be able to help more.
Mark.
At 04:12 14/07/2008, xxxxx@gmail.com wrote:
Thank Michael Zhu and Maxim S. Shatskih
To Maxim S. Shatskih
Because i want to use diskperf driver filter two types IRP[1: Disk
offset’s IRP 2: Partition offset’s IRP], So, I install diskperf
driver use register as PnP disk filter,and then my diskperf driver
start, this driver will Attach to volume .But I use this code attach
to volume device is failed .
NTSTATUS func_Status = STATUS_SUCCESS ;
WCHAR wchar_DHV1 = L"\Device\HarddiskVolume1" ;
RtlInitUnicodeString(&ustring_DHV1,
wchar_DHV1) ;
func_Status = IoGetDeviceObjectPointer(&ustring_DHV1,
FILE_ALL_ACCESS,
&pfileobject_DHV1,
&pdeviceobject_DHV1) ;
if (!NT_SUCCESS(func_Status))
{
return FALSE ;
}
else
{
func_Status = IoCreateDevice(pdeviceobject_DHV1->DriverObject,
DEVICE_EXTENSION_SIZE,
NULL,
FILE_DEVICE_DISK,
FILE_DEVICE_SECURE_OPEN,
FALSE,
&pdevobj_FilterDeviceObject) ;
if (!NT_SUCCESS(func_Status))
{
DISK_KDPRINT((“Cannot create Par filterDeviceObject\n”)) ;
return FALSE ;
}
else
{
g_pdevobj_PartitionDeviceObject =
pdevobj_FilterDeviceObject ;
DISK_KDPRINT((“pdevobj_PartitionDeviceObject %p\n”,
pstruct_DeviceExtension->pdevobj_PartitionDeviceObject)) ;
}
pdevobj_FilterDeviceObject->Flags |= DO_DIRECT_IO ;
pstruct_DeviceExtension->pdevobj_TargetPartitionDeviceObject =
IoAttachDeviceToDeviceStack(pdevobj_FilterDeviceObject,
pdeviceobject_DHV1) ;
// default to DO_POWER_PAGABLE
pdevobj_FilterDeviceObject->Flags |= DO_POWER_PAGABLE ;
// Clear the DO_DEVICE_INITIALIZING flag
pdevobj_FilterDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING ;
}
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer