[wdmaudiodev] Re: Obtaining unique identifier of Filter from its DispatchRoutines

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 19 Feb 2009 10:50:30 -0800

swapnil kamble wrote:
> I got the wave name of filter from Filter's dispatch routines. But can
> I get this name from Pin's Dispatch routines too, like
> PinDispatchSetState or PinDispatchCreate. Here I tried using obtained
> IRP from Pin's Dispatch function but that FileObject's FileName gives
> some GUID like this way,
>
> {146F1A80-4791-11D0-A5D6-28DB04C10000}\???????.

Right.  The filters and the pins are all opened using separate file
handles.  If you have a filter with one input pin and two output pins,
ksproxy will make four CreateFile calls to create file handles for
communication.  Filter ioctls are sent to the filter handle, and pin
ioctls are sent to the pin file handles.


> Instead, I want Wave name of Filter to which this Pin belongs.

Really, Swapnil, you ought to be able to figure this out on your own. 
The KSFILTER dispatches are the only ones that get filter IRPs, so
clearly you are going to have to grab the file name within a KSFILTER
dispatch.  Then, when a pin is created, it is handed the KSFILTER to
which it belongs.  Usually, you will save the KSFILTER somewhere in the
context structure for your pin.  That should be all you need.

By the way, I would advise that you not just store the raw file name. 
It's inefficient to keep doing string comparisons all over the place,
and if you store it in Unicode, you can't do the comparison at a raised
IRQL anyway.  Instead, when you fetch the file name in your filter
Create dispatch, parse it at that point and store some kind of code or
enumeration.  Then, assuming you write in C++, your filter object can
just offer something like "GetFilterType()" or "GetFilterNumber()"
functions to the pins.

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

******************

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

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: