Creating Child PDOs With no actual Bus underlying

Folks,

Let’s say I have a normal kernel module (not a driver).

When it gets loaded, I create a named (say \Device\MyConfig) device object
(using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).

Now I have a user mode routine which send some IOCTLs to this device
(\Device\MyConfig).
Some of these IOCTLs signify creating child devices. These devices represent
child PDOs (you can say some virtual devices) for which I have a functional
driver.
So after I create these devices, I would call IoInvalidateDeviceRelations
providing it the pointer of my named device object (\Device\MyConfig).

In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for
\Device\MyConfig I will return those child PDOs.

My questions are:–

  1. Will it work
  2. Can it be a standard way if i want to create some virtual devices.

Any comments.

Regards
Deepak

How do you have a kernel module that is not a driver?

d

Sent from my phone with no t9, all spilling mistakes are not intentional.


From: Deepak Gupta
Sent: Wednesday, February 04, 2009 6:44 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Creating Child PDOs With no actual Bus underlying

Folks,

Let’s say I have a normal kernel module (not a driver).

When it gets loaded, I create a named (say \Device\MyConfig) device object (using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).

Now I have a user mode routine which send some IOCTLs to this device (\Device\MyConfig).
Some of these IOCTLs signify creating child devices. These devices represent child PDOs (you can say some virtual devices) for which I have a functional driver.
So after I create these devices, I would call IoInvalidateDeviceRelations providing it the pointer of my named device object (\Device\MyConfig).

In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for \Device\MyConfig I will return those child PDOs.

My questions are:–

1) Will it work
2) Can it be a standard way if i want to create some virtual devices.

Any comments.

Regards
Deepak
— 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

By kernel module I meant a kernel service driver (not acting as a function
driver for any device).
It will be loaded by SCM of Windows.

On Wed, Feb 4, 2009 at 8:53 PM, Doron Holan wrote:

> How do you have a kernel module that is not a driver?
>
> d
>
> Sent from my phone with no t9, all spilling mistakes are not intentional.
>
> ------------------------------
> From: Deepak Gupta
> Sent: Wednesday, February 04, 2009 6:44 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Creating Child PDOs With no actual Bus underlying
>
> Folks,
>
>
> Let’s say I have a normal kernel module (not a driver).
>
> When it gets loaded, I create a named (say \Device\MyConfig) device object
> (using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).
>
> Now I have a user mode routine which send some IOCTLs to this device
> (\Device\MyConfig).
> Some of these IOCTLs signify creating child devices. These devices
> represent child PDOs (you can say some virtual devices) for which I have a
> functional driver.
> So after I create these devices, I would call IoInvalidateDeviceRelations
> providing it the pointer of my named device object (\Device\MyConfig).
>
> In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for
> \Device\MyConfig I will return those child PDOs.
>
> My questions are:–
>
> 1) Will it work
> 2) Can it be a standard way if i want to create some virtual devices.
>
> Any comments.
>
> Regards
> Deepak
> — 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
>

If you are loaded by service start/stop commands you do not get to be a pnp driver. You need a PDO to even get a QDR/BusRelations sent to you, you can only get one by being a pnp driver.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.


From: Deepak Gupta
Sent: Wednesday, February 04, 2009 7:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Creating Child PDOs With no actual Bus underlying

By kernel module I meant a kernel service driver (not acting as a function driver for any device).
It will be loaded by SCM of Windows.

On Wed, Feb 4, 2009 at 8:53 PM, Doron Holan > wrote:
How do you have a kernel module that is not a driver?

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

________________________________
From: Deepak Gupta >
Sent: Wednesday, February 04, 2009 6:44 AM
To: Windows System Software Devs Interest List >
Subject: [ntdev] Creating Child PDOs With no actual Bus underlying

Folks,

Let’s say I have a normal kernel module (not a driver).

When it gets loaded, I create a named (say \Device\MyConfig) device object (using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).

Now I have a user mode routine which send some IOCTLs to this device (\Device\MyConfig).
Some of these IOCTLs signify creating child devices. These devices represent child PDOs (you can say some virtual devices) for which I have a functional driver.
So after I create these devices, I would call IoInvalidateDeviceRelations providing it the pointer of my named device object (\Device\MyConfig).

In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for \Device\MyConfig I will return those child PDOs.

My questions are:–

1) Will it work
2) Can it be a standard way if i want to create some virtual devices.

Any comments.

Regards
Deepak
— 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

please see in inline

On Wed, Feb 4, 2009 at 9:27 PM, Doron Holan wrote:

> If you are loaded by service start/stop commands you do not get to be a
> pnp driver. You need a PDO to even get a QDR/BusRelations sent to you, you
> can only get one by being a pnp driver.
>

Doron,

Thanks for the clear response.
Ok Let’s say this is a PnP driver.
But still my basic question is, I will create a named device object
(\Device\MyConfig) in DriverEntry.
This device object won’t attach to any PDO in AddDevice routine.
I will create my FDO’s (which will attach to PDOs) that will be separate
than this device object (\Device\MyConfig).

So when I create some child Devices, Can we give \Device\MyConfig device’s
pointer to IoInvalidateDeviceRelations?
I will handle IRP_MN_QUERY_DEVICE_RELATIONS for \Device\MyConfig.

>
>
> d
>
> Sent from my phone with no t9, all spilling mistakes are not intentional.
>
> ------------------------------
> From: Deepak Gupta
> Sent: Wednesday, February 04, 2009 7:36 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Creating Child PDOs With no actual Bus underlying
>
> By kernel module I meant a kernel service driver (not acting as a
> function driver for any device).
> It will be loaded by SCM of Windows.
>
> On Wed, Feb 4, 2009 at 8:53 PM, Doron Holan wrote:
>
>> How do you have a kernel module that is not a driver?
>>
>> d
>>
>> Sent from my phone with no t9, all spilling mistakes are not intentional.
>>
>> ------------------------------
>> From: Deepak Gupta
>> Sent: Wednesday, February 04, 2009 6:44 AM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] Creating Child PDOs With no actual Bus underlying
>>
>> Folks,
>>
>>
>> Let’s say I have a normal kernel module (not a driver).
>>
>> When it gets loaded, I create a named (say \Device\MyConfig) device object
>> (using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).
>>
>> Now I have a user mode routine which send some IOCTLs to this device
>> (\Device\MyConfig).
>> Some of these IOCTLs signify creating child devices. These devices
>> represent child PDOs (you can say some virtual devices) for which I have a
>> functional driver.
>> So after I create these devices, I would call IoInvalidateDeviceRelations
>> providing it the pointer of my named device object (\Device\MyConfig).
>>
>> In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for
>> \Device\MyConfig I will return those child PDOs.
>>
>> My questions are:–
>>
>> 1) Will it work
>> 2) Can it be a standard way if i want to create some virtual devices.
>>
>> Any comments.
>>
>> Regards
>> Deepak
>> — 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
>
> —
> 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
>

If you are creating a devobj in DriverEntry you are not a pnp driver. If you are not attaching to a PDO in AddDevice you are not a pnp driver. You cannot pass a legacy NT4 style devobj as the parameter to IoInvalidateDeviceRelations, I don’t know how I can be more clear here. You need to opt into PnP entirely, not in bits and pieces.

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Deepak Gupta
Sent: Wednesday, February 04, 2009 8:19 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Creating Child PDOs With no actual Bus underlying

please see in inline
On Wed, Feb 4, 2009 at 9:27 PM, Doron Holan > wrote:
If you are loaded by service start/stop commands you do not get to be a pnp driver. You need a PDO to even get a QDR/BusRelations sent to you, you can only get one by being a pnp driver.

Doron,

Thanks for the clear response.
Ok Let’s say this is a PnP driver.
But still my basic question is, I will create a named device object (\Device\MyConfig) in DriverEntry.
This device object won’t attach to any PDO in AddDevice routine.
I will create my FDO’s (which will attach to PDOs) that will be separate than this device object (\Device\MyConfig).

So when I create some child Devices, Can we give \Device\MyConfig device’s pointer to IoInvalidateDeviceRelations?
I will handle IRP_MN_QUERY_DEVICE_RELATIONS for \Device\MyConfig.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

From: Deepak Gupta >
Sent: Wednesday, February 04, 2009 7:36 AM

To: Windows System Software Devs Interest List >
Subject: Re: [ntdev] Creating Child PDOs With no actual Bus underlying
By kernel module I meant a kernel service driver (not acting as a function driver for any device).
It will be loaded by SCM of Windows.
On Wed, Feb 4, 2009 at 8:53 PM, Doron Holan > wrote:
How do you have a kernel module that is not a driver?

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

From: Deepak Gupta >
Sent: Wednesday, February 04, 2009 6:44 AM
To: Windows System Software Devs Interest List >
Subject: [ntdev] Creating Child PDOs With no actual Bus underlying
Folks,

Let’s say I have a normal kernel module (not a driver).

When it gets loaded, I create a named (say \Device\MyConfig) device object (using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).

Now I have a user mode routine which send some IOCTLs to this device (\Device\MyConfig).
Some of these IOCTLs signify creating child devices. These devices represent child PDOs (you can say some virtual devices) for which I have a functional driver.
So after I create these devices, I would call IoInvalidateDeviceRelations providing it the pointer of my named device object (\Device\MyConfig).

In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for \Device\MyConfig I will return those child PDOs.

My questions are:–

1) Will it work
2) Can it be a standard way if i want to create some virtual devices.

Any comments.

Regards
Deepak
— 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


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

What you’re saying is you are a legacy driver. Legacy drivers can’t create
PnP children (there can be exceptions, like a self root-enumerating driver).

You should read the message I send here on NTDEV a week or two ago on root
enumerated drivers 101. You should make you driver a root enumerated PnP bus
driver. I’d suggest using KMDF, it will make your job of creating a PnP bus
driver immensly easier.

Jan


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Deepak Gupta
Sent: Wednesday, February 04, 2009 6:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Creating Child PDOs With no actual Bus underlying

Folks,

Let’s say I have a normal kernel module (not a driver).

When it gets loaded, I create a named (say \Device\MyConfig) device object
(using IoCreateDevice with FILE_DEVICE_BUS_EXTENDER flag).

Now I have a user mode routine which send some IOCTLs to this device
(\Device\MyConfig).
Some of these IOCTLs signify creating child devices. These devices represent
child PDOs (you can say some virtual devices) for which I have a functional
driver.
So after I create these devices, I would call IoInvalidateDeviceRelations
providing it the pointer of my named device object (\Device\MyConfig).

In my kernel module on receiving IRP_MN_QUERY_DEVICE_RELATONS for
\Device\MyConfig I will return those child PDOs.

My questions are:–

  1. Will it work
  2. Can it be a standard way if i want to create some virtual devices.

Any comments.

Regards
Deepak
— 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

>If you are loaded by service start/stop commands you do not get to be a pnp driver.

IoReportDetectedDevice with all 0s/NULLs in parameters was OK in older Windows.

Is it still so in Win7?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

That gets the device enumerated, but if the OP wants the same driver to be the FDO for it, that won’t work

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Wednesday, February 04, 2009 1:26 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Creating Child PDOs With no actual Bus underlying

If you are loaded by service start/stop commands you do not get to be a pnp driver.

IoReportDetectedDevice with all 0s/NULLs in parameters was OK in older Windows.

Is it still so in Win7?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


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

On Thu, Feb 5, 2009 at 3:53 AM, Doron Holan wrote:

> That gets the device enumerated, but if the OP wants the same driver to be
> the FDO for it, that won’t work

You mean to say that drivers which create devices using
IoReportDetectedDevice can’t act as function driver for them.
According to this link
http://msdn.microsoft.com/en-us/library/ms801235.aspx(see comments),
same driver can attach a FDO to this created PDO and I/O
manager won’t send IRP_MN_START but all other PnP IRP’s need to be handled.

I am confused, Did I get you wrong (or I am missing something)?

>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: Wednesday, February 04, 2009 1:26 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Creating Child PDOs With no actual Bus underlying
>
> >If you are loaded by service start/stop commands you do not get to be a
> pnp driver.
>
> IoReportDetectedDevice with all 0s/NULLs in parameters was OK in older
> Windows.
>
> Is it still so in Win7?
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>

>You mean to say that drivers which create devices using IoReportDetectedDevice can’t act as function

IIRC IoReportDetectedDevice creates a PDO whose driver object and dispatch routines belong to the kernel itself (to root enumerator?).

Then the driver must create a FDO using the usual IoCreateDevice and attach it to this PDO.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Sorry for bugging again.

On Fri, Feb 6, 2009 at 6:37 PM, Maxim S. Shatskih wrote:

> >You mean to say that drivers which create devices using
> IoReportDetectedDevice can’t act as function
>
> IIRC IoReportDetectedDevice creates a PDO whose driver object and dispatch
> routines belong to the kernel itself (to root enumerator?).

What if create my own Device Object and handle all it’s dispatch routines
(along with minor PnPs and query devids and hwids).
It will be a fake PDO.
And then pass pointer to it in IoReportDetectedDevice.
I am sure that I am missing something here.
Will it be necessary to give CM Resource lists and bus information in this
case?

>
>
> Then the driver must create a FDO using the usual IoCreateDevice and attach
> it to this PDO.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>

>Will it be necessary to give CM Resource lists and bus information in this case?

No, you have no hardware, thus no CmResLists.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks a lot Maxim.Your help is really appreciated.

Regards
Deepak

On Fri, Feb 6, 2009 at 11:43 PM, Maxim S. Shatskih
wrote:

> >Will it be necessary to give CM Resource lists and bus information in this
> case?
>
> No, you have no hardware, thus no CmResLists.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>