Can can an IoTarget be opened by name?

Hi all.

I have two WDFDEVICEs that need to hold a reference to each other (dev1 and
dev2). The (maybe wrong) approach I’m trying to use is having each device
keeping an I/O target opened against the other device and registering an
EvtIoTargetQueryRemove on the I/O target to know when the remote target is
getting removed.

This is how I’m implementing it.
When the second WDFDEVICE (Dev2) is started, it creates an I/O target
against Dev1, opens it and sends Dev1 the Symbolic Link to Dev1 via an
internal IOCTL request (synchronously). This works.
When Dev1 serves the internal IOCTL request, it creates an I/O target
against Dev2 and opens it.
This WdfIoTargetOpen fails with error code 0xc0000034 (Object Name not
found).

This “binding” procedure is done in the EvtDeviceSelfManagedIoInit callback.

Is the approach I’m using completely brain-damaged?
What am I missing?

Thanks!
GV

You cannot open a device stack until the start irp has completed back to the io manager. EvtDeviceSelfManagedIoInit is called in the context of the start irp which is why the create fails. Have both dev1 and dev2 publish a device interface. Dev1 opens Dev2 when it finds it/is told that it arrived and vice versa. This works b/c device interface arrival notifications for a device’s interface(s) occur after the device has been started

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Gianluca Varenni
Sent: Thursday, October 18, 2007 3:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Can can an IoTarget be opened by name?

Hi all.

I have two WDFDEVICEs that need to hold a reference to each other (dev1 and
dev2). The (maybe wrong) approach I’m trying to use is having each device
keeping an I/O target opened against the other device and registering an
EvtIoTargetQueryRemove on the I/O target to know when the remote target is
getting removed.

This is how I’m implementing it.
When the second WDFDEVICE (Dev2) is started, it creates an I/O target
against Dev1, opens it and sends Dev1 the Symbolic Link to Dev1 via an
internal IOCTL request (synchronously). This works.
When Dev1 serves the internal IOCTL request, it creates an I/O target
against Dev2 and opens it.
This WdfIoTargetOpen fails with error code 0xc0000034 (Object Name not
found).

This “binding” procedure is done in the EvtDeviceSelfManagedIoInit callback.

Is the approach I’m using completely brain-damaged?
What am I missing?

Thanks!
GV


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

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Thursday, October 18, 2007 3:51 PM
Subject: RE: [ntdev] Can can an IoTarget be opened by name?

You cannot open a device stack until the start irp has completed back to the
io manager.

–GV–
This is exactly what I tought.
–GV–

EvtDeviceSelfManagedIoInit is called in the context of the start irp which
is why the create fails. Have both dev1 and dev2 publish a device
interface. Dev1 opens Dev2 when it finds it/is told that it arrived and
vice versa. This works b/c device interface arrival notifications for a
device’s interface(s) occur after the device has been started

–GV–
Ouch! I missed your blog post on it…

I’ve just implemented a notification handler with
IoRegisterPlugPlayNotification and so far it works like a charm.

Thanks!!

Have a nice day
GV

–GV–

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gianluca Varenni
Sent: Thursday, October 18, 2007 3:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Can can an IoTarget be opened by name?

Hi all.

I have two WDFDEVICEs that need to hold a reference to each other (dev1 and
dev2). The (maybe wrong) approach I’m trying to use is having each device
keeping an I/O target opened against the other device and registering an
EvtIoTargetQueryRemove on the I/O target to know when the remote target is
getting removed.

This is how I’m implementing it.
When the second WDFDEVICE (Dev2) is started, it creates an I/O target
against Dev1, opens it and sends Dev1 the Symbolic Link to Dev1 via an
internal IOCTL request (synchronously). This works.
When Dev1 serves the internal IOCTL request, it creates an I/O target
against Dev2 and opens it.
This WdfIoTargetOpen fails with error code 0xc0000034 (Object Name not
found).

This “binding” procedure is done in the EvtDeviceSelfManagedIoInit callback.

Is the approach I’m using completely brain-damaged?
What am I missing?

Thanks!
GV


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


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