[BDAPLGIN]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Fri, 26 Feb 2010 01:53:48 +0000 (01:53 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Fri, 26 Feb 2010 01:53:48 +0000 (01:53 +0000)
- Add macro to enable/disable debug output
- Query the BaseFilter for the target control pin in order to query for IKsObject interface, which is used to retrieve the real pin handle.
- Pass the NodeId to constructors of IBDA_FrequencyFilter, IBDA_SignalStatistics, IBDA_LNBInfo, IBDA_DigitalDemodulator
- Implement IBDA_DigitalDemodulator::put_ModulationType, IBDA_DigitalDemodulator::put_InnerFECMethod, IBDADigitalDemodulator::put_InnerFECRate, IBDADigitalDemodulator::put_OuterFECMethod, IBDADigitalDemodulator::put_OuterFECRate, IBDADigitalDemodulator::put_SymbolRate, IBDADigitalDemodulator::put_SpectralInversion
- Implement IBDAFrequencyFilter::put_Frequency, IBDAFrequencyFilter::put_Polarity, IBDAFrequencyFilter::put_Range, IBDAFrequencyFilter::put_Bandwidth, IBDAFrequencyFilter::put_FrequencyMultiplier
- Implement IBDALNBInfo::put_LocalOscilatorFrequencyLowBand, IBDALNBInfo::put_LocalOscilatorFrequencyHighBand, IBDALNBInfo::put_HighLowSwitchFrequency
- Implement IBDASignalStatistics::get_SignalStrength, IBDASignalStatistics::get_SignalQuality, IBDASignalStatistics::get_SignalPresent, IBDASignalStatistics::get_SignalLocked, IBDASignalStatistics::put_SampleTime, IBDASignalStatistics::get_SampleTime
- Implement IBDA_DeviceControl::StartChanges, IBDA_DeviceControl::CheckChanges, IBDA_DeviceControl::CommitChanges, IBDA_DeviceControl::GetChangeState
- IBDA_DeviceControl interface now works with SageDvbRecorder(Windows XP SP3)

svn path=/trunk/; revision=45684

reactos/dll/directx/bdaplgin/bdaplgin.cpp
reactos/dll/directx/bdaplgin/classfactory.cpp
reactos/dll/directx/bdaplgin/controlnode.cpp
reactos/dll/directx/bdaplgin/devicecontrol.cpp
reactos/dll/directx/bdaplgin/digitaldemo.cpp
reactos/dll/directx/bdaplgin/frequencyfilter.cpp
reactos/dll/directx/bdaplgin/lnbinfo.cpp
reactos/dll/directx/bdaplgin/pincontrol.cpp
reactos/dll/directx/bdaplgin/precomp.h
reactos/dll/directx/bdaplgin/signalstatistics.cpp

index abf96ff..ddc2297 100644 (file)
@@ -32,7 +32,11 @@ DllMain(
     {
         case DLL_PROCESS_ATTACH:
             CoInitialize(NULL);
+
+#ifdef BDAPLGIN_TRACE
             OutputDebugStringW(L"BDAPLGIN::DllMain()\n");
+#endif
+
             DisableThreadLibraryCalls(hInstDLL);
             break;
     default:
index 10626ee..d6aaa3e 100644 (file)
@@ -24,7 +24,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
index fb371d0..5cd98cc 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "precomp.h"
 
+const GUID IID_IKsPropertySet = {0x31efac30, 0x515c, 0x11d0, {0xa9,0xaa, 0x00,0xaa,0x00,0x61,0xbe,0x93}};
+
 class CControlNode : public IUnknown
 {
 public:
@@ -22,7 +24,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -47,9 +48,6 @@ CControlNode::QueryInterface(
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
-    WCHAR Buffer[MAX_PATH];
-    LPOLESTR lpstr;
-
     *Output = NULL;
 
     if (IsEqualGUID(refiid, IID_IUnknown))
@@ -60,25 +58,28 @@ CControlNode::QueryInterface(
     }
     else if(IsEqualGUID(refiid, IID_IBDA_FrequencyFilter))
     {
-        return CBDAFrequencyFilter_fnConstructor(m_hFile, refiid, Output);
+        return CBDAFrequencyFilter_fnConstructor(m_hFile, m_NodeType, refiid, Output);
     }
     else if(IsEqualGUID(refiid, IID_IBDA_SignalStatistics))
     {
-        return CBDASignalStatistics_fnConstructor(m_hFile, refiid, Output);
+        return CBDASignalStatistics_fnConstructor(m_hFile, m_NodeType, refiid, Output);
     }
     else if(IsEqualGUID(refiid, IID_IBDA_LNBInfo))
     {
-        return CBDALNBInfo_fnConstructor(m_hFile, refiid, Output);
+        return CBDALNBInfo_fnConstructor(m_hFile, m_NodeType, refiid, Output);
     }
     else if(IsEqualGUID(refiid, IID_IBDA_DigitalDemodulator))
     {
-        return CBDADigitalDemodulator_fnConstructor(m_hFile, refiid, Output);
+        return CBDADigitalDemodulator_fnConstructor(m_hFile, m_NodeType, refiid, Output);
     }
-
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
     StringFromCLSID(refiid, &lpstr);
     swprintf(Buffer, L"CControlNode::QueryInterface: NoInterface for %s", lpstr);
     OutputDebugStringW(Buffer);
     CoTaskMemFree(lpstr);
+#endif
 
     return E_NOINTERFACE;
 }
@@ -88,15 +89,56 @@ HRESULT
 WINAPI
 CControlNode_fnConstructor(
     HANDLE hFile,
+    IBaseFilter * pFilter,
     ULONG NodeType,
     ULONG PinId,
     REFIID riid,
     LPVOID * ppv)
 {
+    WCHAR Buffer[100];
+    HRESULT hr;
+    IPin * pPin = NULL;
+    IKsObject * pObject = NULL;
+
+    // store pin id
+    swprintf(Buffer, L"%u", PinId);
+
+    // try find target pin
+    hr = pFilter->FindPin(Buffer, &pPin);
+
+    if (FAILED(hr))
+    {
+#ifdef BDAPLGIN_TRACE
+        swprintf(Buffer, L"CControlNode_fnConstructor failed find pin %lu with %lx\n", PinId, hr);
+        OutputDebugStringW(Buffer);
+#endif
+        return hr;
+    }
+
+    // query IKsObject interface
+    hr = pPin->QueryInterface(IID_IKsObject, (void**)&pObject);
+
+#ifdef BDAPLGIN_TRACE
+    swprintf(Buffer, L"CControlNode_fnConstructor get IID_IKsObject status %lx\n", hr);
+    OutputDebugStringW(Buffer);
+#endif
+
+    if (SUCCEEDED(hr))
+    {
+        // get pin handle
+        hFile = pObject->KsGetObjectHandle();
+        // release IKsObject interface
+        pObject->Release();
+    }
+    // release IPin interface
+    pPin->Release();
+
     // construct device control
     CControlNode * handler = new CControlNode(hFile, NodeType, PinId);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CControlNode_fnConstructor\n");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;
index e64b832..3bbdfbe 100644 (file)
@@ -22,7 +22,7 @@ const GUID IID_IKsObject           = {0x423c13a2, 0x2070, 0x11d0, {0x9e, 0xf7, 0
 const GUID KSPROPSETID_BdaTopology = {0xa14ee835, 0x0a23, 0x11d3, {0x9c, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
 const GUID KSMETHODSETID_BdaDeviceConfiguration = {0x71985f45, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
 const GUID IID_IBaseFilter         = {0x56a86895, 0x0ad4, 0x11ce, {0xb0,0x3a, 0x00,0x20,0xaf,0x0b,0xa7,0x70}};
-
+const GUID KSMETHODSETID_BdaChangeSync = {0xfd0a5af3, 0xb41d, 0x11d2, {0x9c, 0x95, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
 
 class CBDADeviceControl : public IBDA_DeviceControl,
                           public IBDA_Topology
@@ -38,7 +38,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -66,13 +65,14 @@ public:
     HRESULT STDMETHODCALLTYPE CreateTopology(ULONG ulInputPinId, ULONG ulOutputPinId);
     HRESULT STDMETHODCALLTYPE GetControlNode(ULONG ulInputPinId, ULONG ulOutputPinId, ULONG ulNodeType, IUnknown **ppControlNode);
 
-    CBDADeviceControl(IUnknown * pUnkOuter, HANDLE hFile) : m_Ref(0), m_pUnkOuter(pUnkOuter), m_Handle(hFile){};
+    CBDADeviceControl(IUnknown * pUnkOuter, IBaseFilter *pFilter, HANDLE hFile) : m_Ref(0), m_pUnkOuter(pUnkOuter), m_Handle(hFile), m_pFilter(pFilter){};
     virtual ~CBDADeviceControl(){};
 
 protected:
     LONG m_Ref;
     IUnknown * m_pUnkOuter;
     HANDLE m_Handle;
+    IBaseFilter * m_pFilter;
 };
 
 HRESULT
@@ -81,9 +81,6 @@ CBDADeviceControl::QueryInterface(
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
-    WCHAR Buffer[MAX_PATH];
-    LPOLESTR lpstr;
-
     *Output = NULL;
 
     if (IsEqualGUID(refiid, IID_IUnknown))
@@ -106,47 +103,6 @@ CBDADeviceControl::QueryInterface(
         return NOERROR;
     }
 
-    if (IsEqualIID(refiid, IID_IDistributorNotify))
-    {
-        OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IDistributorNotify interface\n");
-        return E_NOINTERFACE;
-    }
-
-    if (IsEqualGUID(refiid, IID_IAMOpenProgress))
-    {
-        OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IAMOpenProgress interface\n");
-        return E_NOINTERFACE;
-    }
-
-    if (IsEqualGUID(refiid, IID_IBDA_NetworkProvider))
-    {
-        OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IID_IBDA_NetworkProvider interface\n");
-        return E_NOINTERFACE;
-    }
-
-    if (IsEqualGUID(refiid, IID_IMatrixMixer))
-    {
-        OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IID_IMatrixMixer interface\n");
-        return E_NOINTERFACE;
-    }
-
-    if (IsEqualGUID(refiid, IID_IAsyncReader))
-    {
-        OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IID_IAsyncReader interface\n");
-        return E_NOINTERFACE;
-    }
-
-    if (IsEqualGUID(refiid, IID_IAC3Filter))
-    {
-        OutputDebugStringW(L"CBDADeviceControl::QueryInterface: No IID_IAC3Filter interface\n");
-        return E_NOINTERFACE;
-    }
-
-    StringFromCLSID(refiid, &lpstr);
-    swprintf(Buffer, L"CBDADeviceControl::QueryInterface: NoInterface for %s", lpstr);
-    OutputDebugStringW(Buffer);
-    CoTaskMemFree(lpstr);
-
     return E_NOINTERFACE;
 }
 
@@ -158,8 +114,25 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::StartChanges( void)
 {
-    OutputDebugStringW(L"CBDADeviceControl::StartChanges: NotImplemented\n");
-    return E_NOTIMPL;
+    KSMETHOD Method;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    /* setup request */
+    Method.Set = KSMETHODSETID_BdaChangeSync;
+    Method.Id = KSMETHOD_BDA_START_CHANGES;
+    Method.Flags = KSMETHOD_TYPE_NONE;
+
+    /* execute request */
+    hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_METHOD, (PVOID)&Method, sizeof(KSMETHOD), NULL, 0, &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADeviceControl::StartChanges: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 
@@ -167,8 +140,25 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::CheckChanges( void)
 {
-    OutputDebugStringW(L"CBDADeviceControl::CheckChanges: NotImplemented\n");
-    return E_NOTIMPL;
+    KSMETHOD Method;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    /* setup request */
+    Method.Set = KSMETHODSETID_BdaChangeSync;
+    Method.Id = KSMETHOD_BDA_CHECK_CHANGES;
+    Method.Flags = KSMETHOD_TYPE_NONE;
+
+    /* execute request */
+    hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_METHOD, (PVOID)&Method, sizeof(KSMETHOD), NULL, 0, &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADeviceControl::CheckChanges: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 
@@ -176,16 +166,40 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::CommitChanges( void)
 {
-    OutputDebugStringW(L"CBDADeviceControl::CommitChanges: NotImplemented\n");
-    return E_NOTIMPL;
+    KSMETHOD Method;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    /* setup request */
+    Method.Set = KSMETHODSETID_BdaChangeSync;
+    Method.Id = KSMETHOD_BDA_COMMIT_CHANGES;
+    Method.Flags = KSMETHOD_TYPE_NONE;
+
+    /* execute request */
+    hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_METHOD, (PVOID)&Method, sizeof(KSMETHOD), NULL, 0, &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADeviceControl::CommitChanges: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::GetChangeState(ULONG *pState)
 {
-    OutputDebugStringW(L"CBDADeviceControl::GetChangeState: NotImplemented\n");
-    return E_NOTIMPL;
+    if (pState)
+    {
+        *pState = BDA_CHANGES_COMPLETE;
+        return S_OK;
+    }
+    else
+    {
+        return E_POINTER;
+    }
 }
 
 //-------------------------------------------------------------------
@@ -198,7 +212,6 @@ CBDADeviceControl::GetNodeTypes(ULONG *pulcNodeTypes, ULONG ulcNodeTypesMax, ULO
     KSPROPERTY Property;
     HRESULT hr;
     ULONG BytesReturned;
-    WCHAR Buffer[100];
 
     // setup request
     Property.Set = KSPROPSETID_BdaTopology;
@@ -210,9 +223,21 @@ CBDADeviceControl::GetNodeTypes(ULONG *pulcNodeTypes, ULONG ulcNodeTypesMax, ULO
 
     *pulcNodeTypes = (BytesReturned / sizeof(ULONG));
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
     swprintf(Buffer, L"CBDADeviceControl::GetNodeTypes: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
     OutputDebugStringW(Buffer);
 
+    if (SUCCEEDED(hr))
+    {
+        for(ULONG Index = 0; Index < *pulcNodeTypes; Index++)
+        {
+            swprintf(Buffer, L"CBDADeviceControl::GetPinTypes: Index %lu Value %lx\n", Index, rgulNodeTypes[Index]);
+            OutputDebugStringW(Buffer);
+        }
+    }
+#endif
+
     return hr;
 }
 
@@ -223,7 +248,7 @@ CBDADeviceControl::GetNodeDescriptors(ULONG *ulcNodeDescriptors, ULONG ulcNodeDe
     KSPROPERTY Property;
     HRESULT hr;
     ULONG BytesReturned;
-    WCHAR Buffer[100];
+
 
     // setup request
     Property.Set = KSPROPSETID_BdaTopology;
@@ -235,9 +260,28 @@ CBDADeviceControl::GetNodeDescriptors(ULONG *ulcNodeDescriptors, ULONG ulcNodeDe
 
     *ulcNodeDescriptors = (BytesReturned / sizeof(BDANODE_DESCRIPTOR));
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[1000];
     swprintf(Buffer, L"CBDADeviceControl::GetNodeDescriptors: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
     OutputDebugStringW(Buffer);
 
+
+    if (SUCCEEDED(hr))
+    {
+        for(ULONG Index = 0; Index < min(*ulcNodeDescriptors, ulcNodeDescriptorsMax); Index++)
+        {
+            LPOLESTR pGUIDFunction, pGUIDName;
+
+            StringFromCLSID(rgNodeDescriptors[Index].guidFunction, &pGUIDFunction);
+            StringFromCLSID(rgNodeDescriptors[Index].guidName, &pGUIDName);
+
+            swprintf(Buffer, L"CBDADeviceControl::GetPinTypes: Index %lu Value %lx\nFunction %s\n Name %s\n-----\n", Index, rgNodeDescriptors[Index].ulBdaNodeType, pGUIDFunction, pGUIDName);
+            OutputDebugStringW(Buffer);
+        }
+    }
+#endif
+
+
     return hr;
 }
 
@@ -248,7 +292,7 @@ CBDADeviceControl::GetNodeInterfaces(ULONG ulNodeType, ULONG *pulcInterfaces, UL
     KSP_NODE Property;
     HRESULT hr;
     ULONG BytesReturned;
-    WCHAR Buffer[100];
+
 
     // setup request
     Property.Property.Set = KSPROPSETID_BdaTopology;
@@ -262,9 +306,25 @@ CBDADeviceControl::GetNodeInterfaces(ULONG ulNodeType, ULONG *pulcInterfaces, UL
 
     *pulcInterfaces = (BytesReturned / sizeof(GUID));
 
-    swprintf(Buffer, L"CBDADeviceControl::GetNodeInterfaces: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADeviceControl::GetNodeInterfaces: hr %lx, BytesReturned %lu ulNodeType %lu\n", hr, BytesReturned, ulNodeType);
     OutputDebugStringW(Buffer);
 
+    if (SUCCEEDED(hr))
+    {
+        for(ULONG Index = 0; Index < min(*pulcInterfaces, ulcInterfacesMax); Index++)
+        {
+            LPOLESTR pstr;
+
+            StringFromCLSID(rgguidInterfaces[Index], &pstr);
+
+            swprintf(Buffer, L"CBDADeviceControl::GetNodeInterfaces: Index %lu Name %s\n", Index, pstr);
+            OutputDebugStringW(Buffer);
+        }
+    }
+#endif
+
     return hr;
 }
 
@@ -275,7 +335,6 @@ CBDADeviceControl::GetPinTypes(ULONG *pulcPinTypes, ULONG ulcPinTypesMax, ULONG
     KSPROPERTY Property;
     HRESULT hr;
     ULONG BytesReturned;
-    WCHAR Buffer[100];
 
     // setup request
     Property.Set = KSPROPSETID_BdaTopology;
@@ -287,9 +346,21 @@ CBDADeviceControl::GetPinTypes(ULONG *pulcPinTypes, ULONG ulcPinTypesMax, ULONG
 
     *pulcPinTypes = (BytesReturned / sizeof(ULONG));
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
     swprintf(Buffer, L"CBDADeviceControl::GetPinTypes: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
     OutputDebugStringW(Buffer);
 
+    if (SUCCEEDED(hr))
+    {
+        for(ULONG Index = 0; Index < *pulcPinTypes; Index++)
+        {
+            swprintf(Buffer, L"CBDADeviceControl::GetPinTypes: Index %lu Value %lx\n", Index, rgulPinTypes[Index]);
+            OutputDebugStringW(Buffer);
+        }
+    }
+#endif
+
     return hr;
 }
 
@@ -297,7 +368,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::GetTemplateConnections(ULONG *pulcConnections, ULONG ulcConnectionsMax, BDA_TEMPLATE_CONNECTION * rgConnections)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADeviceControl::GetTemplateConnections: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -305,7 +379,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::CreatePin(ULONG ulPinType, ULONG *pulPinId)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADeviceControl::CreatePin: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -313,7 +390,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::DeletePin(ULONG ulPinId)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADeviceControl::DeletePin: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -321,7 +401,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::SetMediaType(ULONG ulPinId, AM_MEDIA_TYPE *pMediaType)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADeviceControl::SetMediaType: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -329,7 +412,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::SetMedium(ULONG ulPinId, REGPINMEDIUM *pMedium)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADeviceControl::SetMedium: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -338,11 +424,10 @@ STDMETHODCALLTYPE
 CBDADeviceControl::CreateTopology(ULONG ulInputPinId, ULONG ulOutputPinId)
 {
     KSM_BDA_PIN_PAIR Method;
-    WCHAR Buffer[100];
     HRESULT hr;
     ULONG BytesReturned = 0;
 
-    Method.Method.Flags  = 0;
+    Method.Method.Flags  = KSMETHOD_TYPE_NONE;
     Method.Method.Id = KSMETHOD_BDA_CREATE_TOPOLOGY;
     Method.Method.Set = KSMETHODSETID_BdaDeviceConfiguration;
     Method.InputPinId = ulInputPinId;
@@ -350,8 +435,11 @@ CBDADeviceControl::CreateTopology(ULONG ulInputPinId, ULONG ulOutputPinId)
 
     hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_METHOD, (PVOID)&Method, sizeof(KSM_BDA_PIN_PAIR), NULL, 0, &BytesReturned);
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
     swprintf(Buffer, L"CBDADeviceControl::CreateTopology: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
     OutputDebugStringW(Buffer);
+#endif
 
     return hr;
 }
@@ -360,12 +448,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADeviceControl::GetControlNode(ULONG ulInputPinId, ULONG ulOutputPinId, ULONG ulNodeType, IUnknown **ppControlNode)
 {
-    KSP_BDA_NODE_PIN Property;
-    ULONG Dummy = 0;
     HRESULT hr;
     ULONG PinId = 0;
     ULONG BytesReturned;
-    WCHAR Buffer[100];
+    KSP_BDA_NODE_PIN Property;
 
     //setup request
     Property.Property.Set = KSPROPSETID_BdaTopology;
@@ -376,18 +462,27 @@ CBDADeviceControl::GetControlNode(ULONG ulInputPinId, ULONG ulOutputPinId, ULONG
     Property.ulNodeType = ulNodeType;
 
     // perform request
+    // WinXP SP3 expects minimum sizeof(KSP_BDA_NODE_PIN) + sizeof(ULONG)
+    // seems a driver to be a driver bug
+
     hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_BDA_NODE_PIN) + sizeof(ULONG), &PinId, sizeof(ULONG), &BytesReturned);
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
     swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx, BytesReturned %lu PinId %lu Dummy %lu\n", hr, BytesReturned, PinId, Dummy);
     OutputDebugStringW(Buffer);
+#endif
 
     if (FAILED(hr))
         return hr;
 
-    hr = CControlNode_fnConstructor(m_Handle, ulNodeType, PinId, IID_IUnknown, (LPVOID*)ppControlNode);
+    hr = CControlNode_fnConstructor(m_Handle, m_pFilter, ulNodeType, PinId, IID_IUnknown, (LPVOID*)ppControlNode);
 
+#ifdef BDAPLGIN_TRACE
     swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx\n", hr);
     OutputDebugStringW(Buffer);
+#endif
+
     return hr;
 }
 
@@ -403,6 +498,8 @@ CBDADeviceControl_fnConstructor(
     IBaseFilter *pFilter = NULL;
     HANDLE hFile;
 
+    //DebugBreak();
+
     // sanity check
     assert(pUnkOuter);
 
@@ -437,10 +534,15 @@ CBDADeviceControl_fnConstructor(
     // release IKsObject interface
     pObject->Release();
 
+    // release filter
+    pFilter->Release();
+
     // construct device control
-    CBDADeviceControl * handler = new CBDADeviceControl(pUnkOuter, hFile);
+    CBDADeviceControl * handler = new CBDADeviceControl(pUnkOuter, pFilter, hFile);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADeviceControl_fnConstructor\n");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;
index f70bd1c..2d1b7ed 100644 (file)
@@ -10,6 +10,7 @@
 #include "precomp.h"
 
 const GUID IID_IBDA_DigitalDemodulator = {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x04, 0xe1, 0xe0}};
+const GUID KSPROPSETID_BdaDigitalDemodulator = {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x4, 0xe1, 0xe0}};
 
 class CBDADigitalDemodulator : public IBDA_DigitalDemodulator
 {
@@ -24,7 +25,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -48,13 +48,13 @@ public:
     HRESULT STDMETHODCALLTYPE put_SpectralInversion(SpectralInversion *pSpectralInversion);
     HRESULT STDMETHODCALLTYPE get_SpectralInversion(SpectralInversion *pSpectralInversion);
 
-    CBDADigitalDemodulator(HANDLE hFile) : m_Ref(0), m_hFile(hFile){};
+    CBDADigitalDemodulator(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
     ~CBDADigitalDemodulator(){};
 
 protected:
     LONG m_Ref;
     HANDLE m_hFile;
-
+    ULONG m_NodeId;
 };
 
 HRESULT
@@ -63,9 +63,6 @@ CBDADigitalDemodulator::QueryInterface(
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
-    WCHAR Buffer[MAX_PATH];
-    LPOLESTR lpstr;
-
     *Output = NULL;
 
     if (IsEqualGUID(refiid, IID_IUnknown))
@@ -82,10 +79,14 @@ CBDADigitalDemodulator::QueryInterface(
         return NOERROR;
     }
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
     StringFromCLSID(refiid, &lpstr);
     swprintf(Buffer, L"CBDADigitalDemodulator::QueryInterface: NoInterface for %s", lpstr);
     OutputDebugStringW(Buffer);
     CoTaskMemFree(lpstr);
+#endif
 
     return E_NOINTERFACE;
 }
@@ -94,112 +95,234 @@ HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_ModulationType(ModulationType *pModulationType)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_ModulationType NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_MODULATION_TYPE;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pModulationType, sizeof(ModulationType), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_ModulationType: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::get_ModulationType(ModulationType *pModulationType)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_ModulationType NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_InnerFECMethod(FECMethod *pFECMethod)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_InnerFECMethod NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_INNER_FEC_TYPE;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECMethod, sizeof(FECMethod), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECMethod: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::get_InnerFECMethod(FECMethod *pFECMethod)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_InnerFECMethod NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_InnerFECRate(BinaryConvolutionCodeRate *pFECRate)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_InnerFECRate NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_INNER_FEC_RATE;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECRate, sizeof(BinaryConvolutionCodeRate), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECRate: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::get_InnerFECRate(BinaryConvolutionCodeRate *pFECRate)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_InnerFECRate NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_OuterFECMethod(FECMethod *pFECMethod)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_OuterFECMethod NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_OUTER_FEC_TYPE;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECMethod, sizeof(FECMethod), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECMethod: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 
 HRESULT
 STDMETHODCALLTYPE CBDADigitalDemodulator::get_OuterFECMethod(FECMethod *pFECMethod)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_OuterFECMethod NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_OuterFECRate(BinaryConvolutionCodeRate *pFECRate)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_OuterFECRate NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_OUTER_FEC_RATE;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECRate, sizeof(BinaryConvolutionCodeRate), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECRate: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::get_OuterFECRate(BinaryConvolutionCodeRate *pFECRate)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_OuterFECRate NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_SymbolRate(ULONG *pSymbolRate)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_SymbolRate NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_SYMBOL_RATE;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pSymbolRate, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_SymbolRate: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::get_SymbolRate(ULONG *pSymbolRate)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_SymbolRate NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::put_SpectralInversion(SpectralInversion *pSpectralInversion)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::put_SpectralInversion NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
+    Node.Property.Id = KSPROPERTY_BDA_SPECTRAL_INVERSION;
+    Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pSpectralInversion, sizeof(SpectralInversion), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDADigitalDemodulator::put_SpectralInversion: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDADigitalDemodulator::get_SpectralInversion(SpectralInversion *pSpectralInversion)
 {
-    OutputDebugStringW(L"CBDADigitalDemodulator::get_SpectralInversion NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 
@@ -207,13 +330,16 @@ HRESULT
 WINAPI
 CBDADigitalDemodulator_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv)
 {
     // construct device control
-    CBDADigitalDemodulator * handler = new CBDADigitalDemodulator(hFile);
+    CBDADigitalDemodulator * handler = new CBDADigitalDemodulator(hFile, NodeId);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDADigitalDemodulator_fnConstructor\n");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;
index 8ccb5f7..90d1e6a 100644 (file)
@@ -10,6 +10,7 @@
 #include "precomp.h"
 
 const GUID IID_IBDA_FrequencyFilter = {0x71985f47, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x00, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
+const GUID KSPROPSETID_BdaFrequencyFilter = {0x71985f47, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
 
 class CBDAFrequencyFilter : public IBDA_FrequencyFilter
 {
@@ -24,7 +25,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -46,12 +46,13 @@ public:
     HRESULT STDMETHODCALLTYPE put_FrequencyMultiplier(ULONG ulMultiplier);
     HRESULT STDMETHODCALLTYPE get_FrequencyMultiplier(ULONG *pulMultiplier);
 
-    CBDAFrequencyFilter(HANDLE hFile) : m_Ref(0), m_hFile(hFile){};
+    CBDAFrequencyFilter(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
     virtual ~CBDAFrequencyFilter(){};
 
 protected:
     LONG m_Ref;
     HANDLE m_hFile;
+    ULONG m_NodeId;
 };
 
 HRESULT
@@ -60,9 +61,6 @@ CBDAFrequencyFilter::QueryInterface(
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
-    WCHAR Buffer[MAX_PATH];
-    LPOLESTR lpstr;
-
     *Output = NULL;
 
     if (IsEqualGUID(refiid, IID_IUnknown))
@@ -79,10 +77,14 @@ CBDAFrequencyFilter::QueryInterface(
         return NOERROR;
     }
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
     StringFromCLSID(refiid, &lpstr);
     swprintf(Buffer, L"CControlNode::QueryInterface: NoInterface for %s", lpstr);
     OutputDebugStringW(Buffer);
     CoTaskMemFree(lpstr);
+#endif
 
     return E_NOINTERFACE;
 }
@@ -91,7 +93,6 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::put_Autotune(ULONG ulTransponder)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::put_Autotune: NotImplemented\n");
     return E_NOINTERFACE;
 }
 
@@ -99,7 +100,6 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::get_Autotune(ULONG *pulTransponder)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::get_Autotune\n");
     return E_NOINTERFACE;
 }
 
@@ -107,15 +107,33 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::put_Frequency(ULONG ulFrequency)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::put_Frequency: NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
+    Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_FREQUENCY;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulFrequency, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDAFrequencyFilter::put_Frequency: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::get_Frequency(ULONG *pulFrequency)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::get_Frequency\n");
     return E_NOINTERFACE;
 }
 
@@ -123,15 +141,32 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::put_Polarity(Polarisation Polarity)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::put_Polarity: NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
+    Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_POLARITY;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &Polarity, sizeof(Polarisation), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::get_Polarity(Polarisation *pPolarity)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::get_Polarity\n");
     return E_NOINTERFACE;
 }
 
@@ -139,15 +174,32 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::put_Range(ULONG ulRange)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::put_Range: NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
+    Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_RANGE;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulRange, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::get_Range(ULONG *pulRange)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::get_Range\n");
     return E_NOINTERFACE;
 }
 
@@ -155,30 +207,64 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::put_Bandwidth(ULONG ulBandwidth)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::put_Bandwidth: NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
+    Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_BANDWIDTH;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulBandwidth, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDAFrequencyFilter::put_Bandwidth: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::get_Bandwidth(ULONG *pulBandwidth)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::get_Bandwidth\n");
     return E_NOINTERFACE;
 }
 HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::put_FrequencyMultiplier(ULONG ulMultiplier)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::put_FrequencyMultiplier: NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
+    Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulMultiplier, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDAFrequencyFilter::put_FrequencyMultiplier: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDAFrequencyFilter::get_FrequencyMultiplier(ULONG *pulMultiplier)
 {
-    OutputDebugStringW(L"CBDAFrequencyFilter::get_FrequencyMultiplier\n");
     return E_NOINTERFACE;
 }
 
@@ -186,13 +272,16 @@ HRESULT
 WINAPI
 CBDAFrequencyFilter_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv)
 {
     // construct device control
-    CBDAFrequencyFilter * handler = new CBDAFrequencyFilter(hFile);
+    CBDAFrequencyFilter * handler = new CBDAFrequencyFilter(hFile, NodeId);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDAFrequencyFilter_fnConstructor\n");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;
index 5756198..a663883 100644 (file)
@@ -10,6 +10,7 @@
 #include "precomp.h"
 
 const GUID IID_IBDA_LNBInfo = {0x992cf102, 0x49f9, 0x4719, {0xa6, 0x64,  0xc4, 0xf2, 0x3e, 0x24, 0x08, 0xf4}};
+const GUID KSPROPSETID_BdaLNBInfo = {0x992cf102, 0x49f9, 0x4719, {0xa6, 0x64, 0xc4, 0xf2, 0x3e, 0x24, 0x8, 0xf4}};
 
 class CBDALNBInfo : public IBDA_LNBInfo
 {
@@ -24,7 +25,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -41,12 +41,13 @@ public:
     HRESULT STDMETHODCALLTYPE put_HighLowSwitchFrequency(ULONG ulSwitchFrequency);
     HRESULT STDMETHODCALLTYPE get_HighLowSwitchFrequency(ULONG *pulSwitchFrequency);
 
-    CBDALNBInfo(HANDLE hFile) : m_Ref(0), m_hFile(hFile){};
+    CBDALNBInfo(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
     ~CBDALNBInfo(){};
 
 protected:
     LONG m_Ref;
     HANDLE m_hFile;
+    ULONG m_NodeId;
 };
 
 HRESULT
@@ -55,9 +56,6 @@ CBDALNBInfo::QueryInterface(
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
-    WCHAR Buffer[MAX_PATH];
-    LPOLESTR lpstr;
-
     *Output = NULL;
 
     if (IsEqualGUID(refiid, IID_IUnknown))
@@ -74,10 +72,14 @@ CBDALNBInfo::QueryInterface(
         return NOERROR;
     }
 
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    LPOLESTR lpstr;
     StringFromCLSID(refiid, &lpstr);
     swprintf(Buffer, L"CBDALNBInfo::QueryInterface: NoInterface for %s", lpstr);
     OutputDebugStringW(Buffer);
     CoTaskMemFree(lpstr);
+#endif
 
     return E_NOINTERFACE;
 }
@@ -86,61 +88,115 @@ HRESULT
 STDMETHODCALLTYPE
 CBDALNBInfo::put_LocalOscilatorFrequencyLowBand(ULONG ulLOFLow)
 {
-    OutputDebugStringW(L"CBDALNBInfo::put_LocalOscilatorFrequencyLowBand NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaLNBInfo;
+    Node.Property.Id = KSPROPERTY_BDA_LNB_LOF_LOW_BAND;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulLOFLow, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyLowBand: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDALNBInfo::get_LocalOscilatorFrequencyLowBand(ULONG *pulLOFLow)
 {
-    OutputDebugStringW(L"CBDALNBInfo::get_LocalOscilatorFrequencyLowBand NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDALNBInfo::put_LocalOscilatorFrequencyHighBand(ULONG ulLOFHigh)
 {
-    OutputDebugStringW(L"CBDALNBInfo::put_LocalOscilatorFrequencyHighBand NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaLNBInfo;
+    Node.Property.Id = KSPROPERTY_BDA_LNB_LOF_HIGH_BAND;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulLOFHigh, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyHighBand: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDALNBInfo::get_LocalOscilatorFrequencyHighBand(ULONG *pulLOFHigh)
 {
-    OutputDebugStringW(L"CBDALNBInfo::get_LocalOscilatorFrequencyHighBand NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDALNBInfo::put_HighLowSwitchFrequency(ULONG ulSwitchFrequency)
 {
-    OutputDebugStringW(L"CBDALNBInfo::put_HighLowSwitchFrequency NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaLNBInfo;
+    Node.Property.Id = KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = m_NodeId;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulSwitchFrequency, sizeof(ULONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDALNBInfo::put_HighLowSwitchFrequency: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDALNBInfo::get_HighLowSwitchFrequency(ULONG *pulSwitchFrequency)
 {
-    OutputDebugStringW(L"CBDALNBInfo::get_HighLowSwitchFrequency NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 WINAPI
 CBDALNBInfo_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv)
 {
     // construct device control
-    CBDALNBInfo * handler = new CBDALNBInfo(hFile);
+    CBDALNBInfo * handler = new CBDALNBInfo(hFile, NodeId);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDALNBInfo_fnConstructor\n");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;
index 6811420..324f7a1 100644 (file)
@@ -25,7 +25,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -77,7 +76,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAPinControl::GetPinID(ULONG *pulPinID)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDAPinControl::GetPinID: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -85,7 +87,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAPinControl::GetPinType(ULONG *pulPinType)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDAPinControl::GetPinType: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -93,7 +98,10 @@ HRESULT
 STDMETHODCALLTYPE
 CBDAPinControl::RegistrationContext(ULONG *pulRegistrationCtx)
 {
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDAPinControl::RegistrationContext: NotImplemented\n");
+#endif
+
     return E_NOTIMPL;
 }
 
@@ -220,7 +228,9 @@ CBDAPinControl_fnConstructor(
 
     CBDAPinControl * handler = new CBDAPinControl(hFile, pNetworkProvider, pConnectedPin);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDAPinControl_fnConstructor");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;
index 109fd85..4365afb 100644 (file)
@@ -55,6 +55,7 @@ HRESULT
 WINAPI
 CControlNode_fnConstructor(
     HANDLE hFile,
+    IBaseFilter * pFilter,
     ULONG NodeType,
     ULONG PinId,
     REFIID riid,
@@ -66,6 +67,7 @@ HRESULT
 WINAPI
 CBDAFrequencyFilter_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv);
 
@@ -75,6 +77,7 @@ HRESULT
 WINAPI
 CBDASignalStatistics_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv);
 
@@ -84,6 +87,7 @@ HRESULT
 WINAPI
 CBDALNBInfo_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv);
 
@@ -92,6 +96,7 @@ HRESULT
 WINAPI
 CBDADigitalDemodulator_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv);
 
index c460292..ae6079e 100644 (file)
@@ -10,6 +10,7 @@
 #include "precomp.h"
 
 const GUID IID_IBDA_SignalStatistics = {0x1347d106, 0xcf3a, 0x428a, {0xa5, 0xcb, 0xac, 0x0d, 0x9a, 0x2a, 0x43, 0x38}};
+const GUID KSPROPSETID_BdaSignalStats = {0x1347d106, 0xcf3a, 0x428a, {0xa5, 0xcb, 0xac, 0xd, 0x9a, 0x2a, 0x43, 0x38}};
 
 class CBDASignalStatistics : public IBDA_SignalStatistics
 {
@@ -24,7 +25,6 @@ public:
     STDMETHODIMP_(ULONG) Release()
     {
         InterlockedDecrement(&m_Ref);
-
         if (!m_Ref)
         {
             delete this;
@@ -45,12 +45,13 @@ public:
     HRESULT STDMETHODCALLTYPE put_SampleTime(LONG lmsSampleTime);
     HRESULT STDMETHODCALLTYPE get_SampleTime(LONG *plmsSampleTime);
 
-    CBDASignalStatistics(HANDLE hFile) : m_Ref(0), m_hFile(hFile){};
+    CBDASignalStatistics(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
     ~CBDASignalStatistics(){};
 
 protected:
     LONG m_Ref;
     HANDLE m_hFile;
+    ULONG m_NodeId;
 };
 
 HRESULT
@@ -59,9 +60,6 @@ CBDASignalStatistics::QueryInterface(
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
-    WCHAR Buffer[MAX_PATH];
-    LPOLESTR lpstr;
-
     *Output = NULL;
 
     if (IsEqualGUID(refiid, IID_IUnknown))
@@ -78,11 +76,6 @@ CBDASignalStatistics::QueryInterface(
         return NOERROR;
     }
 
-    StringFromCLSID(refiid, &lpstr);
-    swprintf(Buffer, L"CBDASignalStatistics::QueryInterface: NoInterface for %s", lpstr);
-    OutputDebugStringW(Buffer);
-    CoTaskMemFree(lpstr);
-
     return E_NOINTERFACE;
 }
 
@@ -90,93 +83,205 @@ HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::put_SignalStrength(LONG lDbStrength)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::put_SignalStrength NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::get_SignalStrength(LONG *plDbStrength)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::get_SignalStrength NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaSignalStats;
+    Node.Property.Id = KSPROPERTY_BDA_SIGNAL_STRENGTH;
+    Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = (ULONG)-1;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), plDbStrength, sizeof(LONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDASignalStatistics::get_SignalStrength: m_NodeId %lu hr %lx, BytesReturned %lu plDbStrength %ld\n", m_NodeId, hr, BytesReturned, *plDbStrength);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::put_SignalQuality(LONG lPercentQuality)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::put_SignalQuality NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::get_SignalQuality(LONG *plPercentQuality)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::get_SignalQuality NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaSignalStats;
+    Node.Property.Id = KSPROPERTY_BDA_SIGNAL_QUALITY;
+    Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = (ULONG)-1;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), plPercentQuality, sizeof(LONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDASignalStatistics::get_SignalQuality: m_NodeId %lu hr %lx, BytesReturned %lu plPercentQuality %lu\n", m_NodeId, hr, BytesReturned, *plPercentQuality);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::put_SignalPresent(BOOLEAN fPresent)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::put_SignalPresent NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::get_SignalPresent(BOOLEAN *pfPresent)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::get_SignalPresent NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG Present;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaSignalStats;
+    Node.Property.Id = KSPROPERTY_BDA_SIGNAL_PRESENT;
+    Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = (ULONG)-1;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &Present, sizeof(ULONG), &BytesReturned);
+    // store result
+    *pfPresent = Present;
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDASignalStatistics::get_SignalPresent: m_NodeId %lu hr %lx, BytesReturned %lu Present %lu\n", m_NodeId, hr, BytesReturned, Present);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::put_SignalLocked(BOOLEAN fLocked)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::put_SignalLocked NotImplemented\n");
-    return E_NOTIMPL;
+    return E_NOINTERFACE;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::get_SignalLocked(BOOLEAN *pfLocked)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::get_SignalLocked NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG Locked;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaSignalStats;
+    Node.Property.Id = KSPROPERTY_BDA_SIGNAL_LOCKED;
+    Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = (ULONG)-1;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &Locked, sizeof(ULONG), &BytesReturned);
+    *pfLocked = Locked;
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDASignalStatistics::get_SignalLocked: m_NodeId %lu hr %lx, BytesReturned %lu Locked %lu\n", m_NodeId, hr, BytesReturned, Locked);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::put_SampleTime(LONG lmsSampleTime)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::put_SampleTime NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaSignalStats;
+    Node.Property.Id = KSPROPERTY_BDA_SAMPLE_TIME;
+    Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = (ULONG)-1;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &lmsSampleTime, sizeof(LONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDASignalStatistics::put_SampleTime: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 STDMETHODCALLTYPE
 CBDASignalStatistics::get_SampleTime(LONG *plmsSampleTime)
 {
-    OutputDebugStringW(L"CBDASignalStatistics::get_SampleTime NotImplemented\n");
-    return E_NOTIMPL;
+    KSP_NODE Node;
+    HRESULT hr;
+    ULONG BytesReturned;
+
+    // setup request
+    Node.Property.Set = KSPROPSETID_BdaSignalStats;
+    Node.Property.Id = KSPROPERTY_BDA_SAMPLE_TIME;
+    Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
+    Node.NodeId = (ULONG)-1;
+
+    // perform request
+    hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), plmsSampleTime, sizeof(LONG), &BytesReturned);
+
+#ifdef BDAPLGIN_TRACE
+    WCHAR Buffer[100];
+    swprintf(Buffer, L"CBDASignalStatistics::get_SampleTime: m_NodeId %lu hr %lx, BytesReturned %lu \n", m_NodeId, hr, BytesReturned);
+    OutputDebugStringW(Buffer);
+#endif
+
+    return hr;
 }
 
 HRESULT
 WINAPI
 CBDASignalStatistics_fnConstructor(
     HANDLE hFile,
+    ULONG NodeId,
     REFIID riid,
     LPVOID * ppv)
 {
     // construct device control
-    CBDASignalStatistics * handler = new CBDASignalStatistics(hFile);
+    CBDASignalStatistics * handler = new CBDASignalStatistics(hFile, NodeId);
 
+#ifdef BDAPLGIN_TRACE
     OutputDebugStringW(L"CBDASignalStatistics_fnConstructor\n");
+#endif
 
     if (!handler)
         return E_OUTOFMEMORY;