[wdmaudiodev] Re: Virtual Audio Driver: Interacting with user-space application

  • From: Oleg Vorobiov <isnullxbh@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Wed, 17 Jun 2020 14:46:16 +0700

I have made the required changes:
1. IoCreateDevice, IoRegisterDeviceInterface, and other related things have
been removed from the DriverEntry function.
2. In the AddDevice function (after the PcAddAdapterDevice function call) I
call IoRegisterDeviceInterface and IoSetDeviceInterfaceState, as follows:

ntStatus =
    IoRegisterDeviceInterface(PhysicalDeviceObject
        , static_cast<LPCGUID>(&PID_MSVAD)
        , &DeviceRef
        , &DeviceName);

// Where DeviceRef is "CUSTOM_DEV", DeviceName is "\\Devices\\CUSTOM_DEV".

ntStatus = IoSetDeviceInterfaceState(&DeviceName, TRUE);

After that, I got a symbolic link using CM_Get_Device_Interface_List:
*\\?\ROOT#MEDIA#0000#{5b722bf8-f0ab-47ee-b9c8-8d61d31375a1}\CUSTOM_DEV*

Unfortunately, I couldn't open the file via the symbolic link mentioned
above (error description: "The system cannot find the file specified").

I'm sorry If I got something wrong from your previous explanations.

P.S. In this article, I found an example of adding the IO device as an
extension:
http://pcovington.blogspot.com/2005/07/vsound-progress-vcom-info.html. What
do you think about this? Is it the wrong way?

On Tue, Jun 16, 2020 at 10:57 AM Tim Roberts <timr@xxxxxxxxx> wrote:

On Jun 15, 2020, at 8:32 PM, Oleg Vorobiov <isnullxbh@xxxxxxxxx> wrote:


 I usually register my own device interface in the audio driver
Are you talking about the IoRegisterDeviceInterface function?


Yes.

I thought that I could register an additional IO device and use it for
writing audio data to the driver. I was trying to register an IO device as
follows (after PcInitializeAdapterDriver call in the DriverEntry function):

1. IoCreateDevice(DriverObject, ...)
2. IoRegisterDeviceInterface(DeviceObject, &PID_MSVAD, ...)
3. IoSetDeviceInterfaceState
4. IoCreateSymbolicLink(&DosDeviceName, $DeviceName)

but I got a failure in step 2.


It is not necessary to create another device.  In fact, it will cause
problems.  Remember, you need the device context from the original device
in order to get access to the data.  (I assume you aren’t using globals.)
 You really want the same device.

IoRegisterDeviceInterface only works with PnP devices.  Your
IoCreateDevice call is creating a non-PnP device.  That’s why it failed.
Also remember that IoRegisterDeviceInterface needs to be passed a PDO, not
an FDO, for reasons that aren’t clear to me.  You get your PDO in AddDevice.


In summary, I'm not sure that I understand correctly how to write data
from a user-space application to the driver based on 'micarray’.




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


Other related posts: