[wdmaudiodev] Re: PcAddAdapterDevice & Device Extensions

  • From: "Van Mieghem, Dirk" <dvm@xxxxxxxx>
  • To: "'wdmaudiodev@xxxxxxxxxxxxx'" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 4 Dec 2002 20:56:28 +0100

Hi Art,
it looks like the documentation is wrong on this one. Normally, you would
create a device in your AddDevice routine given the PDO. After that you can
use the Functional Device Object to access your private extension.
PcAddAdapterDevice creates the necessary device for you but you have to wait
until the StartDevice routine is called to access your extension.

Is there any specific reason why you want to use an extension? You can
allocate your own object and associate it to the port returned from
PcNewPort. You can store whatever you need in this object.

IoGetAttachedDeviceReference does not necessarily return your deviceobject
because a filter driver could be loaded on top of yours.

Best regards,
Dirk

> -----Original Message-----
> From: Art Edwards [mailto:snowdog0@xxxxxxxxxxxx]
> Sent: Wednesday, December 04, 2002 8:25 PM
> To: wdmaudiodev@xxxxxxxxxxxxx
> Subject: [wdmaudiodev] PcAddAdapterDevice & Device Extensions
> 
> 
> There's a fragment of sample code in the DDK description of 
> PcAddAdapterDevice.  The fragment describes how an adapter 
> driver can access its device extension after the call to 
> PcAddAdapterDevice returns.  The fragment is:
> 
>    PDEVICE_CONTEXT pDeviceContext = 
> (PDEVICE_CONTEXT)(PhysicalDeviceObject->DeviceExtension);
>    PVOID pMyExtensionData = (PVOID)((PCHAR)pDeviceContext + 
> PORT_CLASS_DEVICE_EXTENSION_SIZE);
> 
> 
> My understanding of this is that referencing pMyExtensionData 
> will access the PDO's device extension.  That extension is 
> owned by the bus driver right ?  If so, the above fragment won't work.
> 
> To access my device extension, I think it would be more 
> appropriate to call IoGetAttachedDeviceReference and access 
> its device extension pointer.  
> 
> Does anyone out there know about this ?
> 
> 
> ******************
> 
> WDMAUDIODEV addresses:
> Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
> Subscribe:    
> mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
> Unsubscribe:  
> mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
> Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
> 
> URL to WDMAUDIODEV page:
> http://www.wdmaudiodev.de/
> 
******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.de/

Other related posts: