ReactOS  0.4.15-dev-1201-gb2cf5a4
tunerequest.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/msvidctl/tunerequest.cpp
5  * PURPOSE: ITuningRequest interface
6  *
7  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8  */
9 #include "precomp.h"
10 
12 {
13 public:
15 
17  {
19  return m_Ref;
20  }
22  {
24  if (!m_Ref)
25  {
26  OutputDebugStringW(L"CTuneRequest::Release : delete\n");
27 
28  WCHAR Buffer[100];
29  swprintf(Buffer, L"CTuneRequest::Release : m_TuningSpace %p delete\n", m_TuningSpace);
31 
32 
34  //delete this;
35  return 0;
36  }
37  return m_Ref;
38  }
39 
40  //IDispatch methods
42  HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
43  HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
44  HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
45 
46  //ITuneRequest methods
49  HRESULT STDMETHODCALLTYPE Clone(ITuneRequest **NewTuneRequest);
52 
53  //IDVBTuneRequest methods
60 
61  CTuneRequest(ITuningSpace * TuningSpace) : m_Ref(0), m_ONID(-1), m_TSID(-1), m_SID(-1), m_Locator(0), m_TuningSpace(TuningSpace)
62  {
64  };
65 
66  CTuneRequest(ITuningSpace * TuningSpace, LONG ONID, LONG TSID, LONG SID, ILocator * Locator) : m_Ref(1), m_ONID(ONID), m_TSID(TSID), m_SID(SID), m_Locator(Locator), m_TuningSpace(TuningSpace)
67  {
68  if (m_Locator)
69  m_Locator->AddRef();
70 
72  };
73 
74  virtual ~CTuneRequest(){};
75 
76 protected:
77  LONG m_Ref;
83 };
84 
85 
86 HRESULT
89  IN REFIID refiid,
90  OUT PVOID* Output)
91 {
92  if (IsEqualGUID(refiid, IID_IUnknown))
93  {
94  *Output = PVOID(this);
95  reinterpret_cast<IUnknown*>(*Output)->AddRef();
96  return NOERROR;
97  }
98 
99  if (IsEqualGUID(refiid, IID_ITuneRequest))
100  {
101  *Output = (ITuneRequest*)this;
102  reinterpret_cast<ITuneRequest*>(*Output)->AddRef();
103  return NOERROR;
104  }
105 
106  if (IsEqualGUID(refiid, IID_IDVBTuneRequest))
107  {
108  *Output = (IDVBTuneRequest*)this;
109  reinterpret_cast<IDVBTuneRequest*>(*Output)->AddRef();
110  return NOERROR;
111  }
112 
114  LPOLESTR lpstr;
115  StringFromCLSID(refiid, &lpstr);
116  swprintf(Buffer, L"CTuneRequest::QueryInterface: NoInterface for %s", lpstr);
119 
120 
121  return E_NOINTERFACE;
122 }
123 
124 //-------------------------------------------------------------------
125 // IDispatch methods
126 //
127 HRESULT
130 {
131  OutputDebugStringW(L"CTuneRequest::GetTypeInfoCount : NotImplemented\n");
132  return E_NOTIMPL;
133 }
134 
135 HRESULT
138 {
139  OutputDebugStringW(L"CTuneRequest::GetTypeInfo : NotImplemented\n");
140  return E_NOTIMPL;
141 }
142 HRESULT
144 CTuneRequest::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
145 {
146  OutputDebugStringW(L"CTuneRequest::GetIDsOfNames : NotImplemented\n");
147  return E_NOTIMPL;
148 }
149 HRESULT
151 CTuneRequest::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
152 {
153  OutputDebugStringW(L"CTuneRequest::Invoke : NotImplemented\n");
154  return E_NOTIMPL;
155 }
156 
157 //-------------------------------------------------------------------
158 // ITuneRequest interface
159 //
160 
161 HRESULT
164 {
165 #ifdef MSVIDCTL_TRACE
166  OutputDebugStringW(L"CTuneRequest::get_TuningSpace\n");
167 #endif
168 
169  *TuningSpace = m_TuningSpace;
171 
172  return S_OK;
173 }
174 
175 HRESULT
178 {
179  OutputDebugStringW(L"CTuneRequest::get_Components : NotImplemented\n");
180  return E_NOTIMPL;
181 }
182 
183 HRESULT
186 {
187 #ifdef MSVIDCTL_TRACE
188  WCHAR Buffer[100];
189  swprintf(Buffer, L"CTuneRequest::Clone %p\n", NewTuneRequest);
191 #endif
192 
193  *NewTuneRequest = new CTuneRequest(m_TuningSpace, m_ONID, m_TSID, m_SID, m_Locator);
194 
195  if (!*NewTuneRequest)
196  return E_OUTOFMEMORY;
197 
198  return S_OK;
199 }
200 
201 HRESULT
204 {
205  OutputDebugStringW(L"CTuneRequest::get_Locator : NotImplemented\n");
206  return E_NOTIMPL;
207 }
208 
209 HRESULT
212 {
213  OutputDebugStringW(L"CTuneRequest::put_Locator : stub\n");
214  m_Locator = Locator;
215 
216  return S_OK;
217 }
218 
219 //-------------------------------------------------------------------
220 // IDVBTuneRequest interface
221 //
222 
223 HRESULT
226 {
227 #ifdef MSVIDCTL_TRACE
228  OutputDebugStringW(L"CTuneRequest::get_ONID\n");
229 #endif
230 
231  *ONID = m_ONID;
232  return S_OK;
233 }
234 
235 HRESULT
238 {
239 #ifdef MSVIDCTL_TRACE
240  WCHAR Buffer[100];
241  swprintf(Buffer, L"CTuneRequest::put_ONID : %lu\n", ONID);
243 #endif
244 
245  m_ONID = ONID;
246  return S_OK;
247 }
248 
249 HRESULT
252 {
253 #ifdef MSVIDCTL_TRACE
254  OutputDebugStringW(L"CTuneRequest::get_TSID\n");
255 #endif
256 
257  *TSID = m_TSID;
258  return S_OK;
259 }
260 
261 HRESULT
264 {
265 #ifdef MSVIDCTL_TRACE
266  WCHAR Buffer[100];
267  swprintf(Buffer, L"CTuneRequest::put_TSID : %lu\n", TSID);
269 #endif
270 
271  m_TSID = TSID;
272  return S_OK;
273 }
274 
275 HRESULT
278 {
279 #ifdef MSVIDCTL_TRACE
280  OutputDebugStringW(L"CTuneRequest::get_SID\n");
281 #endif
282 
283  *SID = m_SID;
284  return S_OK;
285 }
286 
287 HRESULT
290 {
291 #ifdef MSVIDCTL_TRACE
292  WCHAR Buffer[100];
293  swprintf(Buffer, L"CTuneRequest::put_SID : %lu\n", SID);
295 #endif
296 
297  m_SID = SID;
298  return S_OK;
299 }
300 
301 HRESULT
302 WINAPI
305  ITuningSpace * TuningSpace,
306  REFIID riid,
307  LPVOID * ppv)
308 {
309  // construct device control
310  CTuneRequest * request = new CTuneRequest(TuningSpace);
311 
312 #ifdef MSVIDCTL_TRACE
314  LPOLESTR lpstr;
316  swprintf(Buffer, L"CTuneRequest_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
318 #endif
319 
320  if (!request)
321  return E_OUTOFMEMORY;
322 
323  if (FAILED(request->QueryInterface(riid, ppv)))
324  {
325  /* not supported */
326  delete request;
327  return E_NOINTERFACE;
328  }
329 
330  return NOERROR;
331 }
#define IN
Definition: typedefs.h:39
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define NOERROR
Definition: winerror.h:2354
ITuningSpace * m_TuningSpace
Definition: tunerequest.cpp:82
struct _SID SID
REFIID riid
Definition: precomp.h:44
HRESULT STDMETHODCALLTYPE get_TuningSpace(ITuningSpace **TuningSpace)
REFIID LPVOID * ppv
Definition: atlbase.h:39
CTuneRequest(ITuningSpace *TuningSpace, LONG ONID, LONG TSID, LONG SID, ILocator *Locator)
Definition: tunerequest.cpp:66
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: tunerequest.cpp:88
HRESULT STDMETHODCALLTYPE put_SID(long SID)
HRESULT STDMETHODCALLTYPE get_ONID(long *ONID)
DWORD LCID
Definition: nls.h:13
HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
static LPOLESTR
Definition: stg_prop.c:27
HRESULT STDMETHODCALLTYPE put_ONID(long ONID)
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
#define STDMETHODIMP
Definition: basetyps.h:43
HRESULT STDMETHODCALLTYPE put_Locator(ILocator *Locator)
ULONG Release()
CTuneRequest(ITuningSpace *TuningSpace)
Definition: tunerequest.cpp:61
STDMETHODIMP_(ULONG) AddRef()
Definition: tunerequest.cpp:16
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
HRESULT STDMETHODCALLTYPE get_SID(long *SID)
HRESULT STDMETHODCALLTYPE get_Locator(ILocator **Locator)
STDMETHODIMP_(ULONG) Release()
Definition: tunerequest.cpp:21
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define MAX_PATH
Definition: compat.h:34
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:6
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
unsigned short WORD
Definition: ntddk_ex.h:93
ULONG AddRef()
HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
HRESULT STDMETHODCALLTYPE get_Components(IComponents **Components)
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
ILocator * m_Locator
Definition: tunerequest.cpp:81
virtual ~CTuneRequest()
Definition: tunerequest.cpp:74
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534
struct stdole::EXCEPINFO EXCEPINFO
#define S_OK
Definition: intsafe.h:51
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define InterlockedIncrement
Definition: armddk.h:53
HRESULT STDMETHODCALLTYPE put_TSID(long TSID)
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: tftpd.h:85
HRESULT WINAPI CTuneRequest_fnConstructor(IUnknown *pUnknown, ITuningSpace *TuningSpace, REFIID riid, LPVOID *ppv)
HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
#define OUT
Definition: typedefs.h:40
struct stdole::DISPPARAMS DISPPARAMS
HRESULT STDMETHODCALLTYPE Clone(ITuneRequest **NewTuneRequest)
unsigned int ULONG
Definition: retypes.h:1
static LPCSTR lpstr
Definition: font.c:51
HRESULT STDMETHODCALLTYPE get_TSID(long *TSID)
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412