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

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 15 Jun 2020 10:34:38 -0700

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.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Other related posts: