About PhysicalDeviceObject in AddDevice

I’m new to driver development with WIN2K, so I have a few questions:

Should I write :

NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
PhysicalDeviceObject)
{
NTSTATUS Status;
PDEVICE_OBJECT DeviceObject;
Status =
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
_PORT,

FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
&DeviceObject);

}

or

NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
PhysicalDeviceObject)
{
NTSTATUS Status;
PDEVICE_OBJECT DeviceObject;
Status =
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
_PORT,

FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
&PhysicalDeviceObject);

}

If the first solution is the good one, then what is the difference between
“PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
“PhysicalDeviceObject”. I read about it in MSDN but I think it is not clear.

Thanks for any answer

You want the DeviceObject. The PhysicalDeviceObject is needed for Plug and
Play and power operations where you need to let the parent of your device
(for instance if this is a PCI device, there is a PCI driver that is the
parent of these devices and creates the PhysicalDeviceObject) be involved in
an operation. After you create you DeviceObject you need to attach it to
the PhysicalDeviceObject to form a stack of devices.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Nicolas Mugnier”
Newsgroups: ntdev
To: “Windows System Software Developers Interest List”
Sent: Friday, August 08, 2003 9:57 AM
Subject: [ntdev] About PhysicalDeviceObject in AddDevice

> I’m new to driver development with WIN2K, so I have a few questions:
>
> Should I write :
>
> NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> PhysicalDeviceObject)
> {
> NTSTATUS Status;
> PDEVICE_OBJECT DeviceObject;
> Status =
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> _PORT,
>
> FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> &DeviceObject);
> …
> }
>
> or
>
> NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> PhysicalDeviceObject)
> {
> NTSTATUS Status;
> PDEVICE_OBJECT DeviceObject;
> Status =
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> _PORT,
>
> FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> &PhysicalDeviceObject);
> …
> }
>
> If the first solution is the good one, then what is the difference between
> “PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
> “PhysicalDeviceObject”. I read about it in MSDN but I think it is not
clear.
>
> Thanks for any answer
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com

OK but is AddDevice called (or even to be defined in DriverEntry) for a bus
driver ?
If yes, since a bus driver is the lowest driver in a chain, how is created
the PDO for the Bus driver ?
If not, where are created the device objects sent to DispatchXXXX functions
?

“Don Burn” a écrit dans le message de news:xxxxx@ntdev…
>
> You want the DeviceObject. The PhysicalDeviceObject is needed for Plug
and
> Play and power operations where you need to let the parent of your device
> (for instance if this is a PCI device, there is a PCI driver that is the
> parent of these devices and creates the PhysicalDeviceObject) be involved
in
> an operation. After you create you DeviceObject you need to attach it to
> the PhysicalDeviceObject to form a stack of devices.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Nicolas Mugnier”
> Newsgroups: ntdev
> To: “Windows System Software Developers Interest List”

> Sent: Friday, August 08, 2003 9:57 AM
> Subject: [ntdev] About PhysicalDeviceObject in AddDevice
>
>
> > I’m new to driver development with WIN2K, so I have a few questions:
> >
> > Should I write :
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &DeviceObject);
> > …
> > }
> >
> > or
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &PhysicalDeviceObject);
> > …
> > }
> >
> > If the first solution is the good one, then what is the difference
between
> > “PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
> > “PhysicalDeviceObject”. I read about it in MSDN but I think it is not
> clear.
> >
> > Thanks for any answer
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>

Bus drivers are ‘dual role’ WDM drivers. They function as normal function
drivers for their parent bus, and as bus drivers for the PDOs they create on
the bus they manage. So a bus driver must have an AddDevice routine in order
to create FDOs for its parent bus PDOs as appropriate. See the toaster
sample in the DDK.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Tuesday, August 12, 2003 10:48 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

OK but is AddDevice called (or even to be defined in DriverEntry) for a bus
driver ? If yes, since a bus driver is the lowest driver in a chain, how is
created the PDO for the Bus driver ? If not, where are created the device
objects sent to DispatchXXXX functions ?

“Don Burn” a ?crit dans le message de news:xxxxx@ntdev…
>
> You want the DeviceObject. The PhysicalDeviceObject is needed for
> Plug
and
> Play and power operations where you need to let the parent of your
> device (for instance if this is a PCI device, there is a PCI driver
> that is the parent of these devices and creates the
> PhysicalDeviceObject) be involved
in
> an operation. After you create you DeviceObject you need to attach it
> to the PhysicalDeviceObject to form a stack of devices.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Nicolas Mugnier”
> Newsgroups: ntdev
> To: “Windows System Software Developers Interest List”

> Sent: Friday, August 08, 2003 9:57 AM
> Subject: [ntdev] About PhysicalDeviceObject in AddDevice
>
>
> > I’m new to driver development with WIN2K, so I have a few questions:
> >
> > Should I write :
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &DeviceObject);
> > …
> > }
> >
> > or
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &PhysicalDeviceObject); …
> > }
> >
> > If the first solution is the good one, then what is the difference
between
> > “PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
> > “PhysicalDeviceObject”. I read about it in MSDN but I think it is
> > not
> clear.
> >
> > Thanks for any answer
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > 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@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

You say ‘function as normal function drivers for their parent bus’ but what
is the parent bus if this bus is the lower bus in the chain ? I already read
the toaster sample and did’nt find the answer to this question.
Sorry if this question seems… dummy… but I think the DDK documentation
is not very explicit about this point.

“Roddy, Mark” a écrit dans le message de
news:xxxxx@ntdev…

Bus drivers are ‘dual role’ WDM drivers. They function as normal function
drivers for their parent bus, and as bus drivers for the PDOs they create on
the bus they manage. So a bus driver must have an AddDevice routine in order
to create FDOs for its parent bus PDOs as appropriate. See the toaster
sample in the DDK.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Tuesday, August 12, 2003 10:48 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

OK but is AddDevice called (or even to be defined in DriverEntry) for a bus
driver ? If yes, since a bus driver is the lowest driver in a chain, how is
created the PDO for the Bus driver ? If not, where are created the device
objects sent to DispatchXXXX functions ?

“Don Burn” a écrit dans le message de news:xxxxx@ntdev…
>
> You want the DeviceObject. The PhysicalDeviceObject is needed for
> Plug
and
> Play and power operations where you need to let the parent of your
> device (for instance if this is a PCI device, there is a PCI driver
> that is the parent of these devices and creates the
> PhysicalDeviceObject) be involved
in
> an operation. After you create you DeviceObject you need to attach it
> to the PhysicalDeviceObject to form a stack of devices.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Nicolas Mugnier”
> Newsgroups: ntdev
> To: “Windows System Software Developers Interest List”

> Sent: Friday, August 08, 2003 9:57 AM
> Subject: [ntdev] About PhysicalDeviceObject in AddDevice
>
>
> > I’m new to driver development with WIN2K, so I have a few questions:
> >
> > Should I write :
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &DeviceObject);
> > …
> > }
> >
> > or
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &PhysicalDeviceObject); …
> > }
> >
> > If the first solution is the good one, then what is the difference
between
> > “PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
> > “PhysicalDeviceObject”. I read about it in MSDN but I think it is
> > not
> clear.
> >
> > Thanks for any answer
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > 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@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

The DDK documentation is not explicit on this point, since for almost any
case there your device will be on some bus, even if it is only the root
enumeration. Technically, it is possible to build an NT 4.0 style driver
that acts as a bus driver, but this is not something you should do if it all
possible.
This is why Microsoft gives you the lowest layer of bus drivers.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Nicolas Mugnier”
Newsgroups: ntdev
To: “Windows System Software Developers Interest List”
Sent: Tuesday, August 12, 2003 11:11 AM
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

> You say ‘function as normal function drivers for their parent bus’ but
what
> is the parent bus if this bus is the lower bus in the chain ? I already
read
> the toaster sample and did’nt find the answer to this question.
> Sorry if this question seems… dummy… but I think the DDK documentation
> is not very explicit about this point.
>

The short answer is that you are never the lowest bus in the chain. There is
always a root bus. Obviously there is *some* bus driver, call it the root
bus driver, that has some unique characteristics, but lets just ignore that
case. If your bus driver is a virtual device, then you are enumerated by the
root bus driver, and AddDevice will be called as usual, supplying your bus
driver with a root-enumerated PDO for your bus driver’s ‘function driver’
role to deal with.

If your bus driver is instead a bus driver for a real hardware device, then
that hardware device is plugged into some other bus, and that bus has a bus
driver associated with it. For example if you have a non-comformant
multifunction PCI device (doesn’t use multiple PCI functions,) you might use
Mf.sys as the bus driver for this device. Mf would be registered as the
Function Driver for a standard PCI device (your hardware.) It would create
PDOs for virtual devices enumerated off of this device, based on some
partitioning of the single-function resources enumerated by the PCI bus
driver.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Tuesday, August 12, 2003 11:11 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

You say ‘function as normal function drivers for their parent bus’ but what
is the parent bus if this bus is the lower bus in the chain ? I already read
the toaster sample and did’nt find the answer to this question. Sorry if
this question seems… dummy… but I think the DDK documentation is not
very explicit about this point.

“Roddy, Mark” a ?crit dans le message de
news:xxxxx@ntdev…

Bus drivers are ‘dual role’ WDM drivers. They function as normal function
drivers for their parent bus, and as bus drivers for the PDOs they create on
the bus they manage. So a bus driver must have an AddDevice routine in order
to create FDOs for its parent bus PDOs as appropriate. See the toaster
sample in the DDK.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Tuesday, August 12, 2003 10:48 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

OK but is AddDevice called (or even to be defined in DriverEntry) for a bus
driver ? If yes, since a bus driver is the lowest driver in a chain, how is
created the PDO for the Bus driver ? If not, where are created the device
objects sent to DispatchXXXX functions ?

“Don Burn” a ?crit dans le message de news:xxxxx@ntdev…
>
> You want the DeviceObject. The PhysicalDeviceObject is needed for
> Plug
and
> Play and power operations where you need to let the parent of your
> device (for instance if this is a PCI device, there is a PCI driver
> that is the parent of these devices and creates the
> PhysicalDeviceObject) be involved
in
> an operation. After you create you DeviceObject you need to attach it
> to the PhysicalDeviceObject to form a stack of devices.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Nicolas Mugnier”
> Newsgroups: ntdev
> To: “Windows System Software Developers Interest List”

> Sent: Friday, August 08, 2003 9:57 AM
> Subject: [ntdev] About PhysicalDeviceObject in AddDevice
>
>
> > I’m new to driver development with WIN2K, so I have a few questions:
> >
> > Should I write :
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &DeviceObject);
> > …
> > }
> >
> > or
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &PhysicalDeviceObject); … }
> >
> > If the first solution is the good one, then what is the difference
between
> > “PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
> > “PhysicalDeviceObject”. I read about it in MSDN but I think it is
> > not
> clear.
> >
> > Thanks for any answer
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > 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@stratus.com 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@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

It’s now more clearer. Don and Roddy, thank you for your answers.

“Roddy, Mark” a écrit dans le message de
news:xxxxx@ntdev…

The short answer is that you are never the lowest bus in the chain. There is
always a root bus. Obviously there is some bus driver, call it the root
bus driver, that has some unique characteristics, but lets just ignore that
case. If your bus driver is a virtual device, then you are enumerated by the
root bus driver, and AddDevice will be called as usual, supplying your bus
driver with a root-enumerated PDO for your bus driver’s ‘function driver’
role to deal with.

If your bus driver is instead a bus driver for a real hardware device, then
that hardware device is plugged into some other bus, and that bus has a bus
driver associated with it. For example if you have a non-comformant
multifunction PCI device (doesn’t use multiple PCI functions,) you might use
Mf.sys as the bus driver for this device. Mf would be registered as the
Function Driver for a standard PCI device (your hardware.) It would create
PDOs for virtual devices enumerated off of this device, based on some
partitioning of the single-function resources enumerated by the PCI bus
driver.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Tuesday, August 12, 2003 11:11 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

You say ‘function as normal function drivers for their parent bus’ but what
is the parent bus if this bus is the lower bus in the chain ? I already read
the toaster sample and did’nt find the answer to this question. Sorry if
this question seems… dummy… but I think the DDK documentation is not
very explicit about this point.

“Roddy, Mark” a écrit dans le message de
news:xxxxx@ntdev…

Bus drivers are ‘dual role’ WDM drivers. They function as normal function
drivers for their parent bus, and as bus drivers for the PDOs they create on
the bus they manage. So a bus driver must have an AddDevice routine in order
to create FDOs for its parent bus PDOs as appropriate. See the toaster
sample in the DDK.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Tuesday, August 12, 2003 10:48 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Re: About PhysicalDeviceObject in AddDevice

OK but is AddDevice called (or even to be defined in DriverEntry) for a bus
driver ? If yes, since a bus driver is the lowest driver in a chain, how is
created the PDO for the Bus driver ? If not, where are created the device
objects sent to DispatchXXXX functions ?

“Don Burn” a écrit dans le message de news:xxxxx@ntdev…
>
> You want the DeviceObject. The PhysicalDeviceObject is needed for
> Plug
and
> Play and power operations where you need to let the parent of your
> device (for instance if this is a PCI device, there is a PCI driver
> that is the parent of these devices and creates the
> PhysicalDeviceObject) be involved
in
> an operation. After you create you DeviceObject you need to attach it
> to the PhysicalDeviceObject to form a stack of devices.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Nicolas Mugnier”
> Newsgroups: ntdev
> To: “Windows System Software Developers Interest List”

> Sent: Friday, August 08, 2003 9:57 AM
> Subject: [ntdev] About PhysicalDeviceObject in AddDevice
>
>
> > I’m new to driver development with WIN2K, so I have a few questions:
> >
> > Should I write :
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &DeviceObject);
> > …
> > }
> >
> > or
> >
> > NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject,IN PDEVICE_OBJECT
> > PhysicalDeviceObject)
> > {
> > NTSTATUS Status;
> > PDEVICE_OBJECT DeviceObject;
> > Status =
> >
>
IoCreateDevice(DriverObject,sizeof(DEVICE_EXTENSION),NULL,FILE_DEVICE_SERIAL
> > _PORT,
> >
> > FILE_AUTOGENERATED_DEVICE_NAME|FILE_DEVICE_SECURE_OPEN,FALSE,
> > &PhysicalDeviceObject); … }
> >
> > If the first solution is the good one, then what is the difference
between
> > “PhysicalDeviceObject” and “DeviceObject” ? And what is the need for
> > “PhysicalDeviceObject”. I read about it in MSDN but I think it is
> > not
> clear.
> >
> > Thanks for any answer
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > 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@stratus.com 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@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com