[wdmaudiodev] WDM Audio Subdevice registration and unregistration

  • From: "Lee Laborczfalvi" <labor.lg@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Wed, 25 Jun 2008 16:57:34 +1000

I am working on modifying the MSVAD sample driver (simple) running on
Windows Vista in order to allow the Wave and Topology subdevices to be
registered in response to an IOCTL sent from a user mode process.  This is
to provide dynamic subdevice creation functionality.  I am also adding
functionality to unregister the devices when a second IOCTL is received.

I have deferred the call to PcRegisterSubdevice to the IOCTL handler I have
created at which point the topology and wave filters are registered.  This
works fine and in response to the IOCTL the playback device list contains
the MSVAD device.  To unregister the device my unregistration code has the
following sequence:

   1. PcUnregisterSubdevice on the topology miniport (Succeeds)
   2. PcUnregisterSubdevice on the wave miniport  (Succeeds)
   3. UnregisterPhysicalConnection between topology and wave miniports
   (succeeds)
   4. UnregisterPhysicalConnection between wave and topology miniports
   (succeeds)

All of these calls succeed and after the unregistration the playback device
list contains no entries.  This is as expected.  Next I perform the
registration again in order to have the playback device appear.

The second pass registration also succeeds but immediately after the second
set of PcRegisterSubdevice calls have completed the system traps with the
stack trace shown below.  It appears that what has happened is that the
minports have been registered again but then when the device is opened the
topology port init function is called which then traps the machine.

I've tried to get more information about dynamic subdevice creation but the
documentation on this area is pretty scarce (just a few APIs described but
no ordering of events etc).  Does anyone have insight into how to
successfully register, then unregister and then re-register subdevices in a
WDM audio driver making use of waveCyclic?

Specifically --> Is it neccessary to have the StartDevice function of the
WDM audio driver called again so that the miniports can be created from
scratch along with the ports?

Thanks for any help that you may provide on this topic.

Lee Laborczfalvi

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx"
referenced memory at "0x%08lx". The memory could not be "%s".



FAULTING_IP:

portcls!CPortFilterTopology::Init+30

fffff980`0414d880 488b01          mov     rax,qword ptr [rcx]



CONTEXT:  fffff980113c5010 -- (.cxr 0xfffff980113c5010)

rax=0000000000000005 rbx=fffffa800120a3d0 rcx=0000000000000000

rdx=fffffa8002021d10 rsi=fffffa8003a9a470 rdi=fffffa800120a3d0

rip=fffff9800414d880 rsp=fffff980113c5870 rbp=fffffa8003a9a468

 r8=fffff980113c5908  r9=11d05791b4c90a60 r10=fffffa8000c05000

r11=fffffa8002021d10 r12=fffffa8002021d20 r13=0000000000000001

r14=0000000000000000 r15=fffffa8001cef910

iopl=0         nv up ei pl nz na po nc

cs=0010  ss=0018  ds=002b  es=002b  fs=0053  gs=002b
efl=00010206

portcls!CPortFilterTopology::Init+0x30:

fffff980`0414d880 488b01          mov     rax,qword ptr [rcx]
ds:002b:00000000`00000000=????????????????

Resetting default scope



DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT



BUGCHECK_STR:  0x3B



PROCESS_NAME:  svchost.exe



CURRENT_IRQL:  2



LAST_CONTROL_TRANSFER:  from fffff9800414d804 to fffff9800414d880



STACK_TEXT:

fffff980`113c5870 fffff980`0414d804 : fffffa80`0120a3d0 fffffa80`03a9a468
fffffa80`03a9a470 00000000`00000801 : portcls!CPortFilterTopology::Init+0x30

fffff980`113c58a0 fffff980`0414af4a : 00000000`00000000 fffffa80`01cefa60
fffffa80`03a9a460 fffffa80`0120a010 :
portcls!CPortTopology::NewIrpTarget+0xd4

fffff980`113c58d0 fffff980`03c5131c : fffffa80`0120a010 fffffa80`01ce37a0
00000000`00000000 fffffa80`00000000 : portcls!xDispatchCreate+0xfa

fffff980`113c5950 fffff980`03c4b5f8 : fffffa80`0120a010 00000000`00000000
fffffa80`01cef910 fffff800`01eb46e0 : ks!DispatchCreate+0xfc

fffff980`113c59a0 fffff980`0414b1b7 : fffffa80`0120a010 fffffa80`01cef910
00000000`00000000 fffff800`01d3dae3 : ks!KsDispatchIrp+0xc8

fffff980`113c59d0 fffff980`04149064 : 00000000`c000000d fffffa80`0120a290
fffffa80`01cedcf0 fffffa80`00c9b501 : portcls!DispatchCreate+0x67

fffff980`113c5a00 fffff980`03c19c6d : fffff980`000000d8 fffff980`113c5a50
00000000`00000000 fffffa80`011faf20 : portcls!PcDispatchIrp+0x54

fffff980`113c5a30 fffff980`027287dd : fffffa80`01cef910 fffffa80`0120a010
fffff980`00000040 fffffa80`01cedcf0 : vadSimpl!CtxAudioCreate+0x8d
[u:\src\sys\dynamicdevice\sys\adapter.cpp @ 706]

fffff980`113c5a70 fffff800`01e91213 : 00000000`000000a5 fffff800`01e90990
fffffa80`00000000 fffffa80`0120a010 :
ksthunk!CKernelFilterDevice::DispatchIrp+0x11d

fffff980`113c5ad0 fffff800`01e8fbc1 : fffffa80`00c4aa10 fffff980`113c5cf0
fffffa80`01c6b4e0 00000000`00000001 : nt!IopParseDevice+0x883

fffff980`113c5c50 fffff800`01e9bfc1 : 00000000`00000000 fffff980`113c5dd8
fffffa80`00000040 00000000`00000000 : nt!ObpLookupObjectName+0xa9f

fffff980`113c5d60 fffff800`01ebc771 : 00000000`c0100080 00000000`00000000
00000000`00000001 00000000`0180f200 : nt!ObOpenObjectByName+0x421

fffff980`113c5e30 fffff800`01e98e98 : fffffa80`01286a70 00000000`c0100080
00000000`0180f258 00000000`0180f188 : nt!IopCreateFile+0x93b

fffff980`113c5ed0 fffff800`01c4d733 : 00000000`00000000 fffff980`113c5ff0
fffff980`00000000 fffffa80`00cb1de0 : nt!NtCreateFile+0x78

fffff980`113c5f60 00000000`779007ca : 00000000`777adfd9 00000000`016174c8
00000000`00000000 00000000`00000000 : nt!KiSystemServiceCopyEnd+0x13

00000000`0180f168 00000000`777adfd9 : 00000000`016174c8 00000000`00000000
00000000`00000000 00000000`008f0000 : ntdll!ZwCreateFile+0xa

00000000`0180f170 000007fe`fce33841 : 00000000`00000000 00000000`c0000000
00000000`00000000 000007fe`ff9824f9 : kernel32!CreateFileW+0x279

00000000`0180f2d0 000007fe`fce33992 : 00000000`0234a360 00000000`0180f6b0
00000000`00000000 00000000`00000001 :
MMDevAPI!CKsDeviceTopology::OnDeviceAdded+0x61

00000000`0180f320 000007fe`fce26120 : 00000000`00000000 00000000`0234a360
00000000`00000000 00000000`00000008 :
MMDevAPI!CKsDeviceTopologyNotificationWrapper::OnDeviceAdded+0x12

00000000`0180f350 000007fe`fce1eacf : 00000000`00326b70 00000000`0234a360
00000000`0180f6cc 00000000`00000000 :
MMDevAPI!CDeviceEnumerator::OnDeviceChange+0x3e7

00000000`0180f3e0 00000000`776be25a : 00000000`0180f6b0 00000000`00000000
00000000`00000000 00000000`00000001 :
MMDevAPI!CDeviceEnumerator::DeviceEnumeratorWindowProc+0x83

00000000`0180f420 00000000`776bcbaf : 00000000`0180f648 000007fe`fce117c0
00000000`00000000 00000000`00000000 : USER32!UserCallWinProcCheckWow+0x1ad

00000000`0180f4e0 00000000`776a5a92 : 00000000`00040052 00000000`00000000
00000000`00000000 00000000`0000c080 : USER32!DispatchClientMessage+0xc3

00000000`0180f540 00000000`77902016 : 00000000`00000000 fffffa80`01286a70
00000000`00000000 fffff980`113c6c20 : USER32!_fnINDEVICECHANGE+0x302

00000000`0180f5f0 00000000`776be6aa : 00000000`776be6ea 00000000`00000000
00000000`00000000 00000000`00000000 : ntdll!KiUserCallbackDispatcherContinue

00000000`0180f758 00000000`776be6ea : 00000000`00000000 00000000`00000000
00000000`00000000 000007fe`fce3d138 : USER32!ZwUserGetMessage+0xa

00000000`0180f760 000007fe`fce119f2 : 000007fe`fce22bc8 00000000`0234a300
000007fe`fce117c0 00000000`00000000 : USER32!GetMessageW+0x34

00000000`0180f790 00000000`777acdcd : 00000000`00000000 00000000`00000000
00000000`00000000 00000000`00000000 :
MMDevAPI!CDeviceEnumerator::PnpNotificationThread+0x25d

00000000`0180f8b0 00000000`778fc6e1 : 00000000`00000000 00000000`00000000
00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0xd

00000000`0180f8e0 00000000`00000000 : 00000000`00000000 00000000`00000000
00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x1d





FOLLOWUP_IP:

portcls!CPortFilterTopology::Init+30

fffff980`0414d880 488b01          mov     rax,qword ptr [rcx]



SYMBOL_STACK_INDEX:  0



SYMBOL_NAME:  portcls!CPortFilterTopology::Init+30



FOLLOWUP_NAME:  MachineOwner



MODULE_NAME: portcls



IMAGE_NAME:  portcls.sys



DEBUG_FLR_IMAGE_TIMESTAMP:  4549bdce



STACK_COMMAND:  .cxr 0xfffff980113c5010 ; kb



FAILURE_BUCKET_ID:  X64_0x3B_portcls!CPortFilterTopology::Init+30



BUCKET_ID:  X64_0x3B_portcls!CPortFilterTopology::Init+30



Followup: MachineOwner

---------

Other related posts: