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

  • From: Oleg Vorobiov <isnullxbh@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 16 Jun 2020 10:32:54 +0700

Thank you for helping, Mr. Roberts!

 I assume you mean IRP_MJ_CREATE.
Yes, sure, I was wrong.

 Did you also change
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK to
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK?
No, I didn't do that. Thanks.

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

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.

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'.

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

Oleg Vorobiov wrote:


I need help in the implementation of the virtual audio driver with the
goal of providing a virtual microphone which receives data from the
user-space application.
I started from Microsoft Virtual Audio Device Driver Sample (MSVAD),
project - 'micarray', with the following modifications:
1. Added handler for IRP_MJ_OPEN for the driver object

I assume you mean IRP_MJ_CREATE.


2. Added handler for IRP_MJ_WRITE for the driver object

Next, I was tried to get a symlink to the virtual device using Microsoft
Media Foundation like described in this article -
https://docs.microsoft.com/en-us/windows/win32/medfound/audio-video-capture-in-media-foundation
(I changed MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID to
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_GUID), but I got an empty string.

Did you also change
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK to
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK?  With AUDCAP_GUID,
that gets me a list of the symbolic links for my audio devices:

C:\tmp>x
Name: Microphone (3- Hercules Dualpix Exchange Mic)
Link:
\\?\SWD#MMDEVAPI#{0.0.1.00000000}.{a147c371-75ab-41fe-86dd-2bcdaca4c909}#{2eef81be-33fa-4800-9670-1cd474972c3f}
Name: Microphone (2- Samson Go Mic Connect)
Link:
\\?\SWD#MMDEVAPI#{0.0.1.00000000}.{dab83dcf-d6c5-4dd6-a12e-2f5183132b72}#{2eef81be-33fa-4800-9670-1cd474972c3f}

HOWEVER, the symbolic links you get there are to the Audio Engine, not to
the actual device.  I assume that you are trying to open your device
directly, in order to access your back door interface, and not to access it
as a regular audio device.  I don't think these symbolic links will do that.

It is possible to use CM_Get_Device_Interface_List to get direct symbolic
links to the device file, using the audio device interface.   I usually
register my own device interface in the audio driver, so I can assign a
suffix reference string, which allows me to tell within the IRP_MJ_CREATE
handler whether it is my backdoor app opening the device, or the audio
system.

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


Other related posts: