Additional device interface

I have a VAD WDM device (built on MSVAD) and I’d like to be able to register/unregister Wave/Topology miniports on demand, so I’d need an
extra entry to the device, so I can open it like:

HANDLE hDev = CreateFile(L"\\.\MyOwnDevice"… )

How would I go about doing that (with regard to the stuff already in AddDevice/StartDevice) ?

TIA
/Rob

Robert Bielik skrev 2010-11-18 15:29:

I have a VAD WDM device (built on MSVAD) and I’d like to be able to register/unregister Wave/Topology miniports on demand, so I’d need an
extra entry to the device, so I can open it like:

HANDLE hDev = CreateFile(L"\\.\MyOwnDevice"… )

How would I go about doing that (with regard to the stuff already in AddDevice/StartDevice) ?

Ok, I’m trying to create an additional device object in AddDevice ála OSR example OsrMemDrv, and it does not fail anyway.

However I have 2 problems:

  1. I cannot access the device from UM via the symbolic link given in IoCreateSymbolicLink, GetLastError is 2 (file not found) ??

  2. The device object created should be deleted at some point, should I then handle IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE for the created
    device object ?

During development, I just disable the device, copy driver file to system32/drivers and then enable the device again. However I fear
that since I don’t handle device removal for the new device, IO manager won’t unload my driver file… (?)

TIA
/Rob

Did you clear DO_DEVICE_INITIALIZING on your control devobj?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Robert Bielik
Sent: Thursday, November 18, 2010 11:32 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Additional device interface

Robert Bielik skrev 2010-11-18 15:29:

I have a VAD WDM device (built on MSVAD) and I’d like to be able to
register/unregister Wave/Topology miniports on demand, so I’d need an extra entry to the device, so I can open it like:

HANDLE hDev = CreateFile(L"\\.\MyOwnDevice"… )

How would I go about doing that (with regard to the stuff already in AddDevice/StartDevice) ?

Ok, I’m trying to create an additional device object in AddDevice ?la OSR example OsrMemDrv, and it does not fail anyway.

However I have 2 problems:

  1. I cannot access the device from UM via the symbolic link given in IoCreateSymbolicLink, GetLastError is 2 (file not found) ??

  2. The device object created should be deleted at some point, should I then handle IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE for the created
    device object ?

During development, I just disable the device, copy driver file to system32/drivers and then enable the device again. However I fear that since I don’t handle device removal for the new device, IO manager won’t unload my driver file… (?)

TIA
/Rob


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

Doron Holan skrev 2010-11-19 08:39:

Did you clear DO_DEVICE_INITIALIZING on your control devobj?

Ehm… no. The OsrMemDrv example doesn’t either… thanks, I’ll try this. If this is the problem, I reckon the device will get
IRP_MN_REMOVE_DEVICE requests ?

/Rob

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Robert Bielik
Sent: Thursday, November 18, 2010 11:32 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Additional device interface

Robert Bielik skrev 2010-11-18 15:29:
> I have a VAD WDM device (built on MSVAD) and I’d like to be able to
> register/unregister Wave/Topology miniports on demand, so I’d need an extra entry to the device, so I can open it like:
>
> HANDLE hDev = CreateFile(L"\\.\MyOwnDevice"… )
>
> How would I go about doing that (with regard to the stuff already in AddDevice/StartDevice) ?

Ok, I’m trying to create an additional device object in AddDevice ála OSR example OsrMemDrv, and it does not fail anyway.

However I have 2 problems:

  1. I cannot access the device from UM via the symbolic link given in IoCreateSymbolicLink, GetLastError is 2 (file not found) ??

  2. The device object created should be deleted at some point, should I then handle IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE for the created
    device object ?

During development, I just disable the device, copy driver file to system32/drivers and then enable the device again. However I fear that since I don’t handle device removal for the new device, IO manager won’t unload my driver file… (?)

TIA
/Rob


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

Robert Bielik skrev 2010-11-19 09:09:

Doron Holan skrev 2010-11-19 08:39:
> Did you clear DO_DEVICE_INITIALIZING on your control devobj?

Ehm… no. The OsrMemDrv example doesn’t either… thanks, I’ll try this. If this is the problem, I reckon the device will get
IRP_MN_REMOVE_DEVICE requests ?

Nope. Didn’t help, I still get “0x00000002 The system cannot find the file specified.” :frowning:

Also, the second time I get AddDevice, IoCreateDevice says STATUS_OBJECT_NAME_COLLISION, since I never get any IRP_MN_REMOVE_DEVICE when
disabling the driver (devcon disable).

/Rob

Only pnp devices get IRP_MN_REMOVE irps. Control devices do not. If this is a 2ndary device you are creating in AddDevice that you are not attaching to the PDO, it is a control dev obj. you need to monitor IRP_MN_REMOVE on your pnp device objects and when the last one is removed, delete the control devobj

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Robert Bielik
Sent: Friday, November 19, 2010 12:10 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Additional device interface

Doron Holan skrev 2010-11-19 08:39:

Did you clear DO_DEVICE_INITIALIZING on your control devobj?

Ehm… no. The OsrMemDrv example doesn’t either… thanks, I’ll try this. If this is the problem, I reckon the device will get IRP_MN_REMOVE_DEVICE requests ?

/Rob

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Robert Bielik
Sent: Thursday, November 18, 2010 11:32 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Additional device interface

Robert Bielik skrev 2010-11-18 15:29:
> I have a VAD WDM device (built on MSVAD) and I’d like to be able to
> register/unregister Wave/Topology miniports on demand, so I’d need an extra entry to the device, so I can open it like:
>
> HANDLE hDev = CreateFile(L"\\.\MyOwnDevice"… )
>
> How would I go about doing that (with regard to the stuff already in AddDevice/StartDevice) ?

Ok, I’m trying to create an additional device object in AddDevice ?la OSR example OsrMemDrv, and it does not fail anyway.

However I have 2 problems:

  1. I cannot access the device from UM via the symbolic link given in IoCreateSymbolicLink, GetLastError is 2 (file not found) ??

  2. The device object created should be deleted at some point, should I then handle IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE for the created
    device object ?

During development, I just disable the device, copy driver file to
system32/drivers and then enable the device again. However I fear that
since I don’t handle device removal for the new device, IO manager
won’t unload my driver file… (?)

TIA
/Rob


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


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

Doron Holan skrev 2010-11-19 09:18:

Only pnp devices get IRP_MN_REMOVE irps. Control devices do not. If this is a 2ndary device you are creating in AddDevice that you are not attaching to the PDO, it is a control dev obj. you need to monitor IRP_MN_REMOVE on your pnp device objects and when the last one is removed, delete the control devobj

Thanks Doron, everything works fine now :slight_smile:

/Rob