[wdmaudiodev] Re: IKsControl

  • From: Mark Walker <furface@xxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 04 Feb 2010 08:43:33 -0800

Tim, yes I'm using the Windows SDK. I think I need to get a copy of VC++ with ATL before I try this any further. Express seems to have a history of weird definition and include problems. I mainly use Express because people I deal with use Express and I don't want to be out of sync.

For what it's worth this is my code. It builds if I kludge it, but it fails at pBaseFilter->QueryInterface returning hr = E_NOINTERFACE for all my devices. It's not that big a deal in my project at this point, so I'm not too worried about it.


    HRESULT hr;
    ICreateDevEnum *pDeviceEnum = NULL;

    hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
        CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void **)&pDeviceEnum);

void enumDevices(GUID DEVICE_CLSID,ICreateDevEnum *pDeviceEnum )
        HRESULT hr;
        IMoniker *pDeviceMonik = NULL;
        IEnumMoniker *pEnumCat = NULL;
        VARIANT varName;

hr = pDeviceEnum->CreateClassEnumerator(DEVICE_CLSID, &pEnumCat, 0);
        if (hr == S_OK)
            ULONG cFetched;
            while (pEnumCat->Next(1, &pDeviceMonik, &cFetched) == S_OK)
                IPropertyBag *pPropBag = NULL;
hr = pDeviceMonik->BindToStorage(0, 0, IID_IPropertyBag,(void **)&pPropBag);
                if (SUCCEEDED(hr))
                    hr = pPropBag->Read(L"FriendlyName", &varName, 0);
                      if (SUCCEEDED(hr))
                        IBaseFilter * pBaseFilter;
hr = pDeviceMonik->BindToObject(NULL, NULL, IID_IBaseFilter,(void**)&pBaseFilter);
                        IKsControl *pControl;
hr = pBaseFilter->QueryInterface(IID_IKsControl, (void **) &pControl);
                else HR_Failed(hr);
        else HR_Failed(hr);


On 2/3/2010 10:30 AM, Tim Roberts wrote:
Mark Walker wrote:
Thanks Tim & Matthew for responding.
In reference to NTDDI_VERSION >= NTDDI_WINXP I'm writing a user mode application that us attempting to access special features of an audio driver. Is NTDDI_VERSION relevant for user mode applications? The driver I'm trying to reach targets XP and above, though.

I tried ksproxy.h as well, but it doesn't build. I kludged ksproxy.h to get rid of some defines and it built, but it still doesn't give me a good pointer when I run it. Do I have to explicitly expose IKsControl to user mode applications in my driver?

You should not need to kludge it.  This compiles for me as-is:

    #include <windows.h>
    #include <initguid.h>
    #include <ks.h>
    #include <ksmedia.h>
    #include <ksproxy.h>
    int main() { IKsControl * ptr = NULL;  return 0; }

You are using the SDK and not the DDK, right?

You do not need to expose IKsControl. Ksproxy will do that for you. How are you acquiring the device? Are you using CLSID_SystemDeviceEnum to get the IBaseFilter instance?
Tim Roberts,timr@xxxxxxxxx
Providenza&  Boekelheide, Inc.

Other related posts: