[wdmaudiodev] Re: I need to use my driver instead of wdmaud.drv

  • From: Eugene Muzychenko <emuzychenko@xxxxxxxxx>
  • To: Igor Galchuk <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Tue, 22 Sep 2009 20:21:24 +0300

Hello Igor,

> But my very important client demands support of Windows 2000 and XP only.
> I have very specific USB device and have written WDM driver (not
> audio) for it. My client demands support of waveAPI. Therefore, I
> need to translate waveAPI calls to specific IRPs for my device. I
> has looked in mmsystem.h and MSDN (and Google   ), and I have
> written simple installable driver.

A legacy multimedia driver (a user-mode DLL) should be
installed/uninstalled by special ways.

A first way is to use Windows' multimedia installation feature. You
need the "oemsetup.inf" file containing the following text:

[Source Media Descriptions]
1 = "an installation disk description"

SomeLabel = 1:driver.dll, "wave,mixer", "driver description", , ,


If your kernel-mode driver is installed by the PNP Manager, simply
omit last section ("[SomeLabel]").

Windows will copy your UMD/KMD modules to their appropriate locations
and calls UMD DLL with the DRV_INSTALL message. But Windows does not
install a service for a KMD (it usually is performed in DRV_INSTALL

Driver should be removed using the Sound and Multimedia applet of the
Control Panel (not the Device Manager). When you remove the driver,
Windows calls UMD with the DRV_REMOVE message.

A second way is to install/remove the driver programmatically. To
perform that under 2k/XP/2k3, you need to register/unregister
user-mode driver part (a DLL) by modifying three registry keys in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion:

Drivers32, Userinstallable.drivers - "waveN" and "mixerN" values;
drivers.desc - driver description string.

These entries can be manipulated via common registry functions or via
system.ini and control.ini files that are mapped to the registry:

system.ini - [Drivers32] section;
control.ini - [Userinstallable.drivers], [drivers.desc] sections.

To access driver lists via INI files, use
GetPrivateProfileXXX/WritePrivateProfileXXX functions. Using
ReadFile/WriteFile, you won't access mapped values.

Drivers32/Userinstallable.drivers keys aren't used by the Remote
Desktop and devices registered this way won't visible from the remote
computer. To make a device visible from a remote computer, you also
need to add waveN/mixerN entries to the Drivers32\Terminal Server\RDP
key. This key can be accessed through registry functions only.

Installation sequence:

- Copy UMD/KMD binaries to the appropriate Windows directories:
.dll - to the System32, .sys - to the System32\Drivers.

- Add proper values to driver keys/sections mentioned above.

If your UMD supports DRV_INSTALL, perform the following:

- Load UMD DLL module using OpenDriver function.

- Send DRV_INSTALL message using SendDriverMessage function.

- If the driver has successfully processed DRV_INSTALL message, it
should return DRV_OK.

- Close user-mode driver using CloseDriver function.

Uninstallation sequence:

If your UMD supports DRV_REMOVE message:

- Load UMD DLL module using OpenDriver function;

- Send DRV_REMOVE message using SendDriverMessage function.

- If the driver has successfully processed DRV_REMOVE message, it
returns DRV_OK.

- Close user-mode driver using CloseDriver function.

- Remove driver values from driver keys/sections mentioned above.

- Delete UMD/KMD binaries in Windows directories.

Please note that user-mode driver DLL unregistration doesn't
automatically unload it from processes previously loaded it. If there
are active applications that use audio functions, user-mode driver DLL
might be loaded and locked by them. In general, any application that
uses winmm.dll loads and locks all Wave and Mixer user-mode driver
DLLs. For example, Explorer and some other system processes will
load/lock audio driver DLLs at Windows boot.

Since loaded/locked DLL can't be deleted immediately, you need to wait
until all processes that have loaded the DLL will terminate. If Windows
was rebooted since the driver was installed, you need another reboot to
be able to delete user-mode DLL file. As another way, you can use
MoveFileEx to place the file into a system deletion queue.



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


Other related posts: