[wdmaudiodev] Re: Device naming ... ?

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Fri, 1 May 2015 10:00:21 -0700

jerry@xxxxxxxxxxx wrote:

...

A userland enumeration of the devices matching KSCATEGORY_RENDER gives
me this:



\\?\root#media#0000#{65e8773e-8f56-11d0-a3b9-00a0c9223196} => matches
string returned by IoRegisterDeviceInterface()

\\?\root#media#0000#{65e8773e-8f56-11d0-a3b9-00a0c9223196}\wave



Now, if I try and open using the first name, CreateFile() fails. If I
use the second variety, all is OK and things are accessible via
DeviceIoControl().



Finally, then, returning to the IRP origin check. When a userland app
opens the device, the stack->fileobject->filename contains ‘\wave’.
That’s all, no GUID string in the name.


Correct. That's the design. Consider a disk file system, for example.
If you open C:\tmp\xxx.mp3, the file system driver doesn't care one bit
about the C: part. It is the driver for C:, no matter how you got
there. So, the I/O system strips that part off. You're seeing the same
mechanism at work here.

This is why the KS interface requires the \wave name -- so it can tell
the difference.


If you are still reading, thanks! Questions arising then are:



1. What is adding the \wave to the devicename?


In the device interface context, that string is called the "reference
string". Please note the third parameter to IoRegisterDeviceInterface.
In the case of audio, the string to be used comes out of the registry.
The "root#media" in that name points to
HKLM\System\CurrentControlSet\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318},
and you are looking at device 0000 within that key. Under the "Drivers"
key, you'll see the types of devices it will create. Mine creates four:
aux, midi, mixer, wave.


2. Can this controlled by what is specified in the
AddInterface section of .INF file? A quick experiment indicates not …


Sort of. Look for HKR,Drivers in an AddReg section.


3. If not, can this naming be relied on … ?


For a given device, yes. For all devices everywhere? No.

--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

Other related posts: