Multiple device object per driver (again)

Hi all,
after the your precious advises about multiple DevObj in a driver i'm modifying
my driver to support more than one DevObj and i have new problems.

When i will create multiple virtual ports then i will see some icons into the
Device Manager.
When i will want to update the driver, how can i do it ?
Now, with a single DevObj, i disable the port, substitute the file sys and
enable the port. But what if i have some ports ?

After the IoCreateDevice() i must know the PortName, returned by the Kernel, to
create a SymbolicName with the same name. Now i access the registry as follow:
status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
STANDARD_RIGHTS_READ,
&hReg);
that ok for the first time i call it (for the first virtual port i'm creating).
Second time i call the function (for the second virtual port i want to create),
it returns the same PortName as the first time ! I think this is because this
call is related with the pPhysicalDevObj ....?!?!?
How can i obtain the wanted name, related with the last IoCreateDevice() done ?

Thanks, regards

Ing. Stefano Mora
EOS S.r.l.
via Lega dei carrettieri, 1
43038 Sala Baganza (Parma) IT
email: xxxxx@eos.pr.it

  1. If you disable all device instances your driver should be unloaded.

PaoloC

– Messaggio originale –
Reply-To: “Windows System Software Devs Interest List”
>From: “Stefano Mora - EOS S.r.l.”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Multiple device object per driver (again)
>Date: Fri, 17 Sep 2004 13:15:32 +0200
>
>
>Hi all,
>after the your precious advises about multiple DevObj in a driver i’m modifying
>my driver to support more than one DevObj and i have new problems.
>
>1.
>When i will create multiple virtual ports then i will see some icons into
>the
>Device Manager.
>When i will want to update the driver, how can i do it ?
>Now, with a single DevObj, i disable the port, substitute the file sys
and
>enable the port. But what if i have some ports ?
>
>2.
>After the IoCreateDevice() i must know the PortName, returned by the Kernel,
>to
>create a SymbolicName with the same name. Now i access the registry as
follow:
> status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
> PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
> STANDARD_RIGHTS_READ,
> &hReg);
>that ok for the first time i call it (for the first virtual port i’m creating).
>Second time i call the function (for the second virtual port i want to
create),
>it returns the same PortName as the first time ! I think this is because
>this
>call is related with the pPhysicalDevObj …???
>How can i obtain the wanted name, related with the last IoCreateDevice()
>done ?
>
>Thanks, regards
>–
>Ing. Stefano Mora
>EOS S.r.l.
>via Lega dei carrettieri, 1
>43038 Sala Baganza (Parma) IT
>email: xxxxx@eos.pr.it
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@tin.it
>To unsubscribe send a blank email to xxxxx@lists.osr.com

From DDK documentation:

IoGetDeviceProperty retrieves information about a device such as configuration
information and the name of its PDO.
DevicePropertyFriendlyName requests a string that can be used to distinguish
between two similar devices, typically defined by the class installer.
PropertyBuffer points to a NUL-terminated array of WCHAR.

Hope this can help you,

PaoloC

– Messaggio originale –
Reply-To: “Windows System Software Devs Interest List”
>From: “Stefano Mora - EOS S.r.l.”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Multiple device object per driver (again)
>Date: Fri, 17 Sep 2004 13:15:32 +0200
>
>
>Hi all,
>after the your precious advises about multiple DevObj in a driver i’m modifying
>my driver to support more than one DevObj and i have new problems.
>
>1.
>When i will create multiple virtual ports then i will see some icons into
>the
>Device Manager.
>When i will want to update the driver, how can i do it ?
>Now, with a single DevObj, i disable the port, substitute the file sys
and
>enable the port. But what if i have some ports ?
>
>2.
>After the IoCreateDevice() i must know the PortName, returned by the Kernel,
>to
>create a SymbolicName with the same name. Now i access the registry as
follow:
> status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
> PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
> STANDARD_RIGHTS_READ,
> &hReg);
>that ok for the first time i call it (for the first virtual port i’m creating).
>Second time i call the function (for the second virtual port i want to
create),
>it returns the same PortName as the first time ! I think this is because
>this
>call is related with the pPhysicalDevObj …???
>How can i obtain the wanted name, related with the last IoCreateDevice()
>done ?
>
>Thanks, regards
>–
>Ing. Stefano Mora
>EOS S.r.l.
>via Lega dei carrettieri, 1
>43038 Sala Baganza (Parma) IT
>email: xxxxx@eos.pr.it
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@tin.it
>To unsubscribe send a blank email to xxxxx@lists.osr.com

Paolo,
it returns always the same name ... but maybe the problem is my method ...

Into the driver's AddDevice() function i call twice a function. This function
creates a device by IoCreateDevice() function and it calls IoGetDeviceProperty()
to get the friendly name. This last function has the same pPhysicalDevObj
parameter for each call and then, i think, it returns always the first name.
Is there a method to trigger more than one time the AddDevice() or the
pPhysicalDevObj are incorrect ....

Thanks, ciao

Ing. Stefano Mora

----- Original Message -----
From:
Newsgroups: ntdev
To: "Windows System Software Devs Interest List"
Sent: Friday, September 17, 2004 3:05 PM
Subject: RE: Multiple device object per driver (again)

2.

From DDK documentation:

IoGetDeviceProperty retrieves information about a device such as configuration
information and the name of its PDO.
DevicePropertyFriendlyName requests a string that can be used to distinguish
between two similar devices, typically defined by the class installer.
PropertyBuffer points to a NUL-terminated array of WCHAR.

Hope this can help you,

PaoloC

>-- Messaggio originale --
>Reply-To: "Windows System Software Devs Interest List"
>From: "Stefano Mora - EOS S.r.l."
>To: "Windows System Software Devs Interest List"
>Subject: [ntdev] Multiple device object per driver (again)
>Date: Fri, 17 Sep 2004 13:15:32 +0200
>
>
>Hi all,
>after the your precious advises about multiple DevObj in a driver i'm modifying
>my driver to support more than one DevObj and i have new problems.
>
>1.
>When i will create multiple virtual ports then i will see some icons into
>the
>Device Manager.
>When i will want to update the driver, how can i do it ?
>Now, with a single DevObj, i disable the port, substitute the file sys
and
>enable the port. But what if i have some ports ?
>
>2.
>After the IoCreateDevice() i must know the PortName, returned by the Kernel,
>to
>create a SymbolicName with the same name. Now i access the registry as
follow:
> status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
> PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
> STANDARD_RIGHTS_READ,
> &hReg);
>that ok for the first time i call it (for the first virtual port i'm creating).
>Second time i call the function (for the second virtual port i want to
create),
>it returns the same PortName as the first time ! I think this is because
>this
>call is related with the pPhysicalDevObj ....?!?!?
>How can i obtain the wanted name, related with the last IoCreateDevice()
>done ?
>
>Thanks, regards
>--
>Ing. Stefano Mora
>EOS S.r.l.
>via Lega dei carrettieri, 1
>43038 Sala Baganza (Parma) IT
>email: xxxxx@eos.pr.it
>
>
>
>---
>Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@tin.it
>To unsubscribe send a blank email to xxxxx@lists.osr.com

AddDevice should only create one device to attach to the lower driver.

You can use the add hardware wizard or devcon to install additional
instances of your device on the machine. Each time you do this, a new
fake physical-device object is created in the system. Each one of those
will be configured to have your driver attach to it.

This will cause multiple virtual ports to show up in the device manager.
You’ll be able to enable and disable each of them, and when the last one
is disabled your driver should unload.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
Stefano Mora - EOS S.r.l.
Sent: Friday, September 17, 2004 7:24 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Multiple device object per driver (again)

Paolo,
it returns always the same name … but maybe the problem is
my method …

Into the driver’s AddDevice() function i call twice a
function. This function creates a device by IoCreateDevice()
function and it calls IoGetDeviceProperty() to get the
friendly name. This last function has the same
pPhysicalDevObj parameter for each call and then, i think, it
returns always the first name.
Is there a method to trigger more than one time the
AddDevice() or the pPhysicalDevObj are incorrect …

Thanks, ciao

Ing. Stefano Mora

----- Original Message -----
From:
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Friday, September 17, 2004 3:05 PM
> Subject: RE: Multiple device object per driver (again)
>
>
> 2.
>
> From DDK documentation:
>
> IoGetDeviceProperty retrieves information about a device such
> as configuration
> information and the name of its PDO.
> DevicePropertyFriendlyName requests a string that can be used
> to distinguish
> between two similar devices, typically defined by the class installer.
> PropertyBuffer points to a NUL-terminated array of WCHAR.
>
> Hope this can help you,
>
> PaoloC
>
> >– Messaggio originale –
> >Reply-To: “Windows System Software Devs Interest List”
>
> >From: “Stefano Mora - EOS S.r.l.”
> >To: “Windows System Software Devs Interest List”
>
> >Subject: [ntdev] Multiple device object per driver (again)
> >Date: Fri, 17 Sep 2004 13:15:32 +0200
> >
> >
> >Hi all,
> >after the your precious advises about multiple DevObj in a
> driver i’m modifying
> >my driver to support more than one DevObj and i have new problems.
> >
> >1.
> >When i will create multiple virtual ports then i will see
> some icons into
> >the
> >Device Manager.
> >When i will want to update the driver, how can i do it ?
> >Now, with a single DevObj, i disable the port, substitute
> the file sys
> and
> >enable the port. But what if i have some ports ?
> >
> >2.
> >After the IoCreateDevice() i must know the PortName,
> returned by the Kernel,
> >to
> >create a SymbolicName with the same name. Now i access the
> registry as
> follow:
> > status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
> > PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
> > STANDARD_RIGHTS_READ,
> > &hReg);
> >that ok for the first time i call it (for the first virtual
> port i’m creating).
> >Second time i call the function (for the second virtual port
> i want to
> create),
> >it returns the same PortName as the first time ! I think
> this is because
> >this
> >call is related with the pPhysicalDevObj …???
> >How can i obtain the wanted name, related with the last
> IoCreateDevice()
> >done ?
> >
> >Thanks, regards
> >–
> >Ing. Stefano Mora
> >EOS S.r.l.
> >via Lega dei carrettieri, 1
> >43038 Sala Baganza (Parma) IT
> >email: xxxxx@eos.pr.it
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@tin.it
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

IoGetDeviceProperty retrieves the name of its PDO.
One AddDevice() is inwoked for each PDO, so you will get the same PDO name
if you call twice IoGetDeviceProperty in the same AddDevice().

Ciao,
PaoloC

– Messaggio originale –
Reply-To: “Windows System Software Devs Interest List”
>From: “Stefano Mora - EOS S.r.l.”
>To: “Windows System Software Devs Interest List”
>Subject: Re:[ntdev] Multiple device object per driver (again)
>Date: Fri, 17 Sep 2004 16:23:47 +0200
>
>
>Paolo,
>it returns always the same name … but maybe the problem is my method

>
>Into the driver’s AddDevice() function i call twice a function. This function
>creates a device by IoCreateDevice() function and it calls IoGetDeviceProperty()
>to get the friendly name. This last function has the same pPhysicalDevObj
>parameter for each call and then, i think, it returns always the first
name.
>Is there a method to trigger more than one time the AddDevice() or the
>pPhysicalDevObj are incorrect …
>
>Thanks, ciao
>–
>Ing. Stefano Mora
>
>
>----- Original Message -----
>From:
>Newsgroups: ntdev
>To: “Windows System Software Devs Interest List”
>Sent: Friday, September 17, 2004 3:05 PM
>Subject: RE: Multiple device object per driver (again)
>
>
>2.
>
>From DDK documentation:
>
>IoGetDeviceProperty retrieves information about a device such as configuration
>information and the name of its PDO.
>DevicePropertyFriendlyName requests a string that can be used to distinguish
>between two similar devices, typically defined by the class installer.
>PropertyBuffer points to a NUL-terminated array of WCHAR.
>
>Hope this can help you,
>
>PaoloC
>
>>– Messaggio originale –
>>Reply-To: “Windows System Software Devs Interest List”
>>From: “Stefano Mora - EOS S.r.l.”
>>To: “Windows System Software Devs Interest List”
>>Subject: [ntdev] Multiple device object per driver (again)
>>Date: Fri, 17 Sep 2004 13:15:32 +0200
>>
>>
>>Hi all,
>>after the your precious advises about multiple DevObj in a driver i’m
modifying
>>my driver to support more than one DevObj and i have new problems.
>>
>>1.
>>When i will create multiple virtual ports then i will see some icons into
>>the
>>Device Manager.
>>When i will want to update the driver, how can i do it ?
>>Now, with a single DevObj, i disable the port, substitute the file sys
>and
>>enable the port. But what if i have some ports ?
>>
>>2.
>>After the IoCreateDevice() i must know the PortName, returned by the Kernel,
>>to
>>create a SymbolicName with the same name. Now i access the registry as
>follow:
>> status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
>> PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
>> STANDARD_RIGHTS_READ,
>> &hReg);
>>that ok for the first time i call it (for the first virtual port i’m creating).
>>Second time i call the function (for the second virtual port i want to
>create),
>>it returns the same PortName as the first time ! I think this is because
>>this
>>call is related with the pPhysicalDevObj …???
>>How can i obtain the wanted name, related with the last IoCreateDevice()
>>done ?
>>
>>Thanks, regards
>>–
>>Ing. Stefano Mora
>>EOS S.r.l.
>>via Lega dei carrettieri, 1
>>43038 Sala Baganza (Parma) IT
>>email: xxxxx@eos.pr.it
>>
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>>
>>You are currently subscribed to ntdev as: xxxxx@tin.it
>>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@tin.it
>To unsubscribe send a blank email to xxxxx@lists.osr.com

May I also suggest reading the article on OSR describing how to write a Bus
Driver, Because that is what you are writing to create multiple FDOs in a
hierarchical fashion. Also the toaster sample.
Sincerely;
William Michael Jones

“Peter Wieland” wrote in message
news:xxxxx@ntdev…
AddDevice should only create one device to attach to the lower driver.

You can use the add hardware wizard or devcon to install additional
instances of your device on the machine. Each time you do this, a new
fake physical-device object is created in the system. Each one of those
will be configured to have your driver attach to it.

This will cause multiple virtual ports to show up in the device manager.
You’ll be able to enable and disable each of them, and when the last one
is disabled your driver should unload.

-p

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> Stefano Mora - EOS S.r.l.
> Sent: Friday, September 17, 2004 7:24 AM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Multiple device object per driver (again)
>
> Paolo,
> it returns always the same name … but maybe the problem is
> my method …
>
> Into the driver’s AddDevice() function i call twice a
> function. This function creates a device by IoCreateDevice()
> function and it calls IoGetDeviceProperty() to get the
> friendly name. This last function has the same
> pPhysicalDevObj parameter for each call and then, i think, it
> returns always the first name.
> Is there a method to trigger more than one time the
> AddDevice() or the pPhysicalDevObj are incorrect …
>
> Thanks, ciao
> –
> Ing. Stefano Mora
>
>
> ----- Original Message -----
> From:
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Friday, September 17, 2004 3:05 PM
> Subject: RE: Multiple device object per driver (again)
>
>
> 2.
>
> From DDK documentation:
>
> IoGetDeviceProperty retrieves information about a device such
> as configuration
> information and the name of its PDO.
> DevicePropertyFriendlyName requests a string that can be used
> to distinguish
> between two similar devices, typically defined by the class installer.
> PropertyBuffer points to a NUL-terminated array of WCHAR.
>
> Hope this can help you,
>
> PaoloC
>
> >– Messaggio originale –
> >Reply-To: “Windows System Software Devs Interest List”
>
> >From: “Stefano Mora - EOS S.r.l.”
> >To: “Windows System Software Devs Interest List”
>
> >Subject: [ntdev] Multiple device object per driver (again)
> >Date: Fri, 17 Sep 2004 13:15:32 +0200
> >
> >
> >Hi all,
> >after the your precious advises about multiple DevObj in a
> driver i’m modifying
> >my driver to support more than one DevObj and i have new problems.
> >
> >1.
> >When i will create multiple virtual ports then i will see
> some icons into
> >the
> >Device Manager.
> >When i will want to update the driver, how can i do it ?
> >Now, with a single DevObj, i disable the port, substitute
> the file sys
> and
> >enable the port. But what if i have some ports ?
> >
> >2.
> >After the IoCreateDevice() i must know the PortName,
> returned by the Kernel,
> >to
> >create a SymbolicName with the same name. Now i access the
> registry as
> follow:
> > status = IoOpenDeviceRegistryKey( pPhysicalDevObj,
> > PLUGPLAY_REGKEY_DEVICE, //Hardware subkey of the Enum key
> > STANDARD_RIGHTS_READ,
> > &hReg);
> >that ok for the first time i call it (for the first virtual
> port i’m creating).
> >Second time i call the function (for the second virtual port
> i want to
> create),
> >it returns the same PortName as the first time ! I think
> this is because
> >this
> >call is related with the pPhysicalDevObj …???
> >How can i obtain the wanted name, related with the last
> IoCreateDevice()
> >done ?
> >
> >Thanks, regards
> >–
> >Ing. Stefano Mora
> >EOS S.r.l.
> >via Lega dei carrettieri, 1
> >43038 Sala Baganza (Parma) IT
> >email: xxxxx@eos.pr.it
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@tin.it
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>