Hi,

Recently I went thru' a source code that uses IoAttachDevice function
to get the target device object.

status = IoAttachDevice (DeviceObject, TargetDeviceName,
&pDevExt->AttachedDeviceObject); // TargetDeviceName is set to
\\Device\\Video0

pDevExt->TargetDeviceObject = pDevExt->AttachedDeviceObject;

IoDetachDevice (pDevExt->AttachedDeviceObject);
IoCallDriver (pDevExt->TargetDeviceObject, ....)

But is this the right way to do that?

2. Moreover, what's the difference between

pDevExt->AttachedDeviceObject and
pDevExt->AttachedDeviceObject->DriverObject->DeviceObject in this
context?

Could someone please explain me?

Thanks
VK

Re: IoAttachDevice problem by Maxim

Maxim
Thu May 18 09:06:50 CDT 2006

> Recently I went thru' a source code that uses IoAttachDevice function
> to get the target device object.
>
> status = IoAttachDevice (DeviceObject, TargetDeviceName,

IoAttachDevice is obsolete, use IoAttachDeviceToDeviceStackSafe instead.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com