ReactOS  0.4.13-dev-259-g5ca9c9c
controlnode.cpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS BDA Proxy
4  * FILE: dll/directx/bdaplgin/controlnode.cpp
5  * PURPOSE: ControlNode interface
6  *
7  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8  */
9 
10 #include "precomp.h"
11 
12 #ifndef _MSC_VER
13 const GUID IID_IKsPropertySet = {0x31efac30, 0x515c, 0x11d0, {0xa9,0xaa, 0x00,0xaa,0x00,0x61,0xbe,0x93}};
14 #endif
15 
16 class CControlNode : public IUnknown
17 {
18 public:
20 
22  {
24  return m_Ref;
25  }
27  {
29  if (!m_Ref)
30  {
31  delete this;
32  return 0;
33  }
34  return m_Ref;
35  }
36 
38  virtual ~CControlNode(){};
39 
40 protected:
41  LONG m_Ref;
45 };
46 
47 HRESULT
50  IN REFIID refiid,
51  OUT PVOID* Output)
52 {
53  *Output = NULL;
54 
55  if (IsEqualGUID(refiid, IID_IUnknown))
56  {
57  *Output = PVOID(this);
58  reinterpret_cast<IUnknown*>(*Output)->AddRef();
59  return NOERROR;
60  }
61  else if(IsEqualGUID(refiid, IID_IBDA_FrequencyFilter))
62  {
64  }
65  else if(IsEqualGUID(refiid, IID_IBDA_SignalStatistics))
66  {
68  }
69  else if(IsEqualGUID(refiid, IID_IBDA_LNBInfo))
70  {
72  }
74  {
76  }
77 #ifdef BDAPLGIN_TRACE
80  StringFromCLSID(refiid, &lpstr);
81  swprintf(Buffer, L"CControlNode::QueryInterface: NoInterface for %s", lpstr);
84 #endif
85 
86  return E_NOINTERFACE;
87 }
88 
89 
90 HRESULT
91 WINAPI
93  IBaseFilter * pFilter,
95  ULONG PinId,
96  REFIID riid,
97  LPVOID * ppv)
98 {
99  WCHAR Buffer[100];
100  HRESULT hr;
101  IPin * pPin = NULL;
103 
104  // store pin id
105  swprintf(Buffer, L"%u", PinId);
106 
107  // try find target pin
108  hr = pFilter->FindPin(Buffer, &pPin);
109 
110  if (FAILED(hr))
111  {
112 #ifdef BDAPLGIN_TRACE
113  swprintf(Buffer, L"CControlNode_fnConstructor failed find pin %lu with %lx\n", PinId, hr);
115 #endif
116  return hr;
117  }
118 
119  // query for IKsPropertySet interface
120  hr = pPin->QueryInterface(IID_IKsPropertySet, (void**)&pProperty);
121  if (FAILED(hr))
122  return hr;
123 
124 #ifdef BDAPLGIN_TRACE
125  swprintf(Buffer, L"CControlNode_fnConstructor get IID_IKsObject status %lx\n", hr);
127 #endif
128 
129  // release IPin interface
130  pPin->Release();
131 
132  // construct device control
134 
135 #ifdef BDAPLGIN_TRACE
136  OutputDebugStringW(L"CControlNode_fnConstructor\n");
137 #endif
138 
139  if (!handler)
140  return E_OUTOFMEMORY;
141 
142  if (FAILED(handler->QueryInterface(riid, ppv)))
143  {
144  /* not supported */
145  delete handler;
146  return E_NOINTERFACE;
147  }
148 
149  return NOERROR;
150 }
HRESULT FindPin([in, string] LPCWSTR Id, [out] IPin **ppPin)
#define IN
Definition: typedefs.h:38
#define REFIID
Definition: guiddef.h:113
HRESULT WINAPI CBDASignalStatistics_fnConstructor(IKsPropertySet *pProperty, ULONG NodeId, REFIID riid, LPVOID *ppv)
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CBDAFrequencyFilter_fnConstructor(IKsPropertySet *pProperty, ULONG NodeId, REFIID riid, LPVOID *ppv)
#define NOERROR
Definition: winerror.h:2354
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static LPOLESTR
Definition: stg_prop.c:27
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
STDMETHODIMP_(ULONG) AddRef()
Definition: controlnode.cpp:21
#define STDMETHODIMP
Definition: basetyps.h:43
ULONG Release()
CControlNode(IKsPropertySet *pProperty, ULONG NodeType, ULONG PinId)
Definition: controlnode.cpp:37
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
NodeType
Definition: Node.h:5
HRESULT WINAPI CBDALNBInfo_fnConstructor(IKsPropertySet *pProperty, ULONG NodeId, REFIID riid, LPVOID *ppv)
Definition: lnbinfo.cpp:181
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
_Must_inspect_result_ _In_ KSP_BDA_NODE_PIN * pProperty
Definition: bdasup.h:156
const GUID IID_IBDA_DigitalDemodulator
Definition: digitaldemo.cpp:13
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:8
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
ULONG AddRef()
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
const GUID IID_IBDA_LNBInfo
Definition: lnbinfo.cpp:13
const GUID IID_IBDA_FrequencyFilter
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
#define InterlockedIncrement
Definition: armddk.h:53
const GUID IID_IBDA_SignalStatistics
Definition: axcore.idl:91
STDMETHODIMP_(ULONG) Release()
Definition: controlnode.cpp:26
HRESULT WINAPI CBDADigitalDemodulator_fnConstructor(IKsPropertySet *pProperty, ULONG NodeId, REFIID riid, LPVOID *ppv)
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: controlnode.cpp:49
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
IKsPropertySet * m_pKsProperty
Definition: controlnode.cpp:42
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define OUT
Definition: typedefs.h:39
ULONG m_NodeType
Definition: controlnode.cpp:43
unsigned int ULONG
Definition: retypes.h:1
static LPCSTR lpstr
Definition: font.c:51
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
HRESULT WINAPI CControlNode_fnConstructor(IBaseFilter *pFilter, ULONG NodeType, ULONG PinId, REFIID riid, LPVOID *ppv)
Definition: controlnode.cpp:92
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2321
virtual ~CControlNode()
Definition: controlnode.cpp:38