1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS BDA Proxy
4 * FILE: dll/directx/msvidctl/tuningspace.cpp
5 * PURPOSE: ITuningSpace interface
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9 #include "precomp.h"
10
11 const GUID CLSID_DVBTNetworkProvider = {0x216c62df, 0x6d7f, 0x4e9a, {0x85, 0x71, 0x5, 0xf1, 0x4e, 0xdb, 0x76, 0x6a}};
12
13 class CTuningSpace : public IDVBTuningSpace
14 {
15 public:
16 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
17
AddRef()18 STDMETHODIMP_(ULONG) AddRef()
19 {
20 InterlockedIncrement(&m_Ref);
21 return m_Ref;
22 }
Release()23 STDMETHODIMP_(ULONG) Release()
24 {
25 InterlockedDecrement(&m_Ref);
26
27 WCHAR Buffer[100];
28 swprintf(Buffer, L"CTuningSpace::Release : %p Ref %lu\n", this, m_Ref);
29 OutputDebugStringW(Buffer);
30
31 if (!m_Ref)
32 {
33 //delete this;
34 return 0;
35 }
36 return m_Ref;
37 }
38
39 // IDispatch methods
40 HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
41 HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
42 HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
43 HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
44
45
46 //ITuningSpace methods
47 HRESULT STDMETHODCALLTYPE get_UniqueName(BSTR *Name);
48 HRESULT STDMETHODCALLTYPE put_UniqueName(BSTR Name);
49 HRESULT STDMETHODCALLTYPE get_FriendlyName(BSTR *Name);
50 HRESULT STDMETHODCALLTYPE put_FriendlyName(BSTR Name);
51 HRESULT STDMETHODCALLTYPE get_CLSID(BSTR *SpaceCLSID);
52 HRESULT STDMETHODCALLTYPE get_NetworkType(BSTR *NetworkTypeGuid);
53 HRESULT STDMETHODCALLTYPE put_NetworkType(BSTR NetworkTypeGuid);
54 HRESULT STDMETHODCALLTYPE get__NetworkType(GUID *NetworkTypeGuid);
55 HRESULT STDMETHODCALLTYPE put__NetworkType(REFCLSID NetworkTypeGuid);
56 HRESULT STDMETHODCALLTYPE CreateTuneRequest(ITuneRequest **TuneRequest);
57 HRESULT STDMETHODCALLTYPE EnumCategoryGUIDs(IEnumGUID **ppEnum);
58 HRESULT STDMETHODCALLTYPE EnumDeviceMonikers(IEnumMoniker **ppEnum);
59 HRESULT STDMETHODCALLTYPE get_DefaultPreferredComponentTypes(IComponentTypes **ComponentTypes);
60 HRESULT STDMETHODCALLTYPE put_DefaultPreferredComponentTypes(IComponentTypes *NewComponentTypes);
61 HRESULT STDMETHODCALLTYPE get_FrequencyMapping(BSTR *pMapping);
62 HRESULT STDMETHODCALLTYPE put_FrequencyMapping(BSTR Mapping);
63 HRESULT STDMETHODCALLTYPE get_DefaultLocator(ILocator **LocatorVal);
64 HRESULT STDMETHODCALLTYPE put_DefaultLocator(ILocator *LocatorVal);
65 HRESULT STDMETHODCALLTYPE Clone(ITuningSpace **NewTS);
66 // IDVBTuningSpace
67 HRESULT STDMETHODCALLTYPE get_SystemType(DVBSystemType *SysType);
68 HRESULT STDMETHODCALLTYPE put_SystemType(DVBSystemType SysType);
69
CTuningSpace()70 CTuningSpace() : m_Ref(0){};
71
~CTuningSpace()72 virtual ~CTuningSpace(){};
73
74 protected:
75 LONG m_Ref;
76 };
77
78 HRESULT
79 STDMETHODCALLTYPE
QueryInterface(IN REFIID refiid,OUT PVOID * Output)80 CTuningSpace::QueryInterface(
81 IN REFIID refiid,
82 OUT PVOID* Output)
83 {
84 if (IsEqualGUID(refiid, IID_IUnknown))
85 {
86 *Output = PVOID(this);
87 reinterpret_cast<IUnknown*>(*Output)->AddRef();
88 return NOERROR;
89 }
90
91 if (IsEqualGUID(refiid, IID_ITuningSpace))
92 {
93 *Output = (ITuningSpace*)this;
94 reinterpret_cast<ITuningSpace*>(*Output)->AddRef();
95 return NOERROR;
96 }
97
98 if (IsEqualGUID(refiid, IID_IDVBTuningSpace))
99 {
100 *Output = (IDVBTuningSpace*)this;
101 reinterpret_cast<IDVBTuningSpace*>(*Output)->AddRef();
102 return NOERROR;
103 }
104
105
106 WCHAR Buffer[MAX_PATH];
107 LPOLESTR lpstr;
108 StringFromCLSID(refiid, &lpstr);
109 swprintf(Buffer, L"CTuningSpace::QueryInterface: NoInterface for %s", lpstr);
110 OutputDebugStringW(Buffer);
111 CoTaskMemFree(lpstr);
112
113
114 return E_NOINTERFACE;
115 }
116
117 //-------------------------------------------------------------------
118 // IDispatch methods
119 //
120 HRESULT
121 STDMETHODCALLTYPE
GetTypeInfoCount(UINT * pctinfo)122 CTuningSpace::GetTypeInfoCount(UINT *pctinfo)
123 {
124 OutputDebugStringW(L"CTuningSpace::GetTypeInfoCount : NotImplemented\n");
125 return E_NOTIMPL;
126 }
127
128 HRESULT
129 STDMETHODCALLTYPE
GetTypeInfo(UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)130 CTuningSpace::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
131 {
132 OutputDebugStringW(L"CTuningSpace::GetTypeInfo : NotImplemented\n");
133 return E_NOTIMPL;
134 }
135 HRESULT
136 STDMETHODCALLTYPE
GetIDsOfNames(REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)137 CTuningSpace::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
138 {
139 OutputDebugStringW(L"CTuningSpace::GetIDsOfNames : NotImplemented\n");
140 return E_NOTIMPL;
141 }
142 HRESULT
143 STDMETHODCALLTYPE
Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)144 CTuningSpace::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
145 {
146 OutputDebugStringW(L"CTuningSpace::Invoke : NotImplemented\n");
147 return E_NOTIMPL;
148 }
149
150
151 //-------------------------------------------------------------------
152 // ITuningSpace interface
153 //
154
155 HRESULT
156 STDMETHODCALLTYPE
get_UniqueName(BSTR * Name)157 CTuningSpace::get_UniqueName(BSTR *Name)
158 {
159 OutputDebugStringW(L"CTuningSpace::get_UniqueName : NotImplemented\n");
160 return E_NOTIMPL;
161 }
162
163 HRESULT
164 STDMETHODCALLTYPE
put_UniqueName(BSTR Name)165 CTuningSpace::put_UniqueName(BSTR Name)
166 {
167 OutputDebugStringW(L"CTuningSpace::put_UniqueName : NotImplemented\n");
168 return E_NOTIMPL;
169 }
170
171 HRESULT
172 STDMETHODCALLTYPE
get_FriendlyName(BSTR * Name)173 CTuningSpace::get_FriendlyName(BSTR *Name)
174 {
175 OutputDebugStringW(L"CTuningSpace::get_FriendlyName : NotImplemented\n");
176 return E_NOTIMPL;
177 }
178
179 HRESULT
180 STDMETHODCALLTYPE
put_FriendlyName(BSTR Name)181 CTuningSpace::put_FriendlyName(BSTR Name)
182 {
183 OutputDebugStringW(L"CTuningSpace::put_FriendlyName : NotImplemented\n");
184 return E_NOTIMPL;
185 }
186
187 HRESULT
188 STDMETHODCALLTYPE
get_CLSID(BSTR * SpaceCLSID)189 CTuningSpace::get_CLSID(BSTR *SpaceCLSID)
190 {
191 OutputDebugStringW(L"CTuningSpace::get_CLSID : NotImplemented\n");
192 return E_NOTIMPL;
193 }
194
195 HRESULT
196 STDMETHODCALLTYPE
get_NetworkType(BSTR * NetworkTypeGuid)197 CTuningSpace::get_NetworkType(BSTR *NetworkTypeGuid)
198 {
199 OutputDebugStringW(L"CTuningSpace::get_NetworkType : stub\n");
200 return StringFromCLSID(CLSID_DVBTNetworkProvider, (LPOLESTR*)NetworkTypeGuid);
201
202 }
203
204 HRESULT
205 STDMETHODCALLTYPE
put_NetworkType(BSTR NetworkTypeGuid)206 CTuningSpace::put_NetworkType(BSTR NetworkTypeGuid)
207 {
208 OutputDebugStringW(L"CTuningSpace::put_NetworkType : NotImplemented\n");
209 return E_NOTIMPL;
210 }
211
212 HRESULT
213 STDMETHODCALLTYPE
get__NetworkType(GUID * NetworkTypeGuid)214 CTuningSpace::get__NetworkType(GUID *NetworkTypeGuid)
215 {
216 #ifdef MSVIDCTL_TRACE
217 WCHAR Buffer[100];
218 swprintf(Buffer, L"CTuningSpace::get__NetworkType : %p stub\n", NetworkTypeGuid);
219 OutputDebugStringW(Buffer);
220 #endif
221
222 CopyMemory(NetworkTypeGuid, &CLSID_DVBTNetworkProvider, sizeof(GUID));
223 OutputDebugStringW(L"CTuningSpace::get__NetworkType : done\n");
224 return S_OK;
225 }
226
227 HRESULT
228 STDMETHODCALLTYPE
put__NetworkType(REFCLSID NetworkTypeGuid)229 CTuningSpace::put__NetworkType(REFCLSID NetworkTypeGuid)
230 {
231 OutputDebugStringW(L"CTuningSpace::put__NetworkType : NotImplemented\n");
232 return E_NOTIMPL;
233 }
234
235 HRESULT
236 STDMETHODCALLTYPE
CreateTuneRequest(ITuneRequest ** TuneRequest)237 CTuningSpace::CreateTuneRequest(ITuneRequest **TuneRequest)
238 {
239 OutputDebugStringW(L"CTuningSpace::CreateTuneRequest : stub\n");
240 return CTuneRequest_fnConstructor(NULL, (ITuningSpace*)this, IID_ITuneRequest, (void**)TuneRequest);
241 }
242
243 HRESULT
244 STDMETHODCALLTYPE
EnumCategoryGUIDs(IEnumGUID ** ppEnum)245 CTuningSpace::EnumCategoryGUIDs(IEnumGUID **ppEnum)
246 {
247 OutputDebugStringW(L"CTuningSpace::EnumCategoryGUIDs : NotImplemented\n");
248 return E_NOTIMPL;
249 }
250
251 HRESULT
252 STDMETHODCALLTYPE
EnumDeviceMonikers(IEnumMoniker ** ppEnum)253 CTuningSpace::EnumDeviceMonikers(IEnumMoniker **ppEnum)
254 {
255 OutputDebugStringW(L"CTuningSpace::EnumDeviceMonikers : NotImplemented\n");
256 return E_NOTIMPL;
257 }
258
259 HRESULT
260 STDMETHODCALLTYPE
get_DefaultPreferredComponentTypes(IComponentTypes ** ComponentTypes)261 CTuningSpace::get_DefaultPreferredComponentTypes(IComponentTypes **ComponentTypes)
262 {
263 OutputDebugStringW(L"CTuningSpace::get_DefaultPreferredComponentTypes : NotImplemented\n");
264 return E_NOTIMPL;
265 }
266
267 HRESULT
268 STDMETHODCALLTYPE
put_DefaultPreferredComponentTypes(IComponentTypes * NewComponentTypes)269 CTuningSpace::put_DefaultPreferredComponentTypes(IComponentTypes *NewComponentTypes)
270 {
271 OutputDebugStringW(L"CTuningSpace::put_DefaultPreferredComponentTypes : NotImplemented\n");
272 return E_NOTIMPL;
273 }
274
275 HRESULT
276 STDMETHODCALLTYPE
get_FrequencyMapping(BSTR * pMapping)277 CTuningSpace::get_FrequencyMapping(BSTR *pMapping)
278 {
279 OutputDebugStringW(L"CTuningSpace::get_FrequencyMapping : NotImplemented\n");
280 return E_NOTIMPL;
281 }
282
283 HRESULT
284 STDMETHODCALLTYPE
put_FrequencyMapping(BSTR Mapping)285 CTuningSpace::put_FrequencyMapping(BSTR Mapping)
286 {
287 OutputDebugStringW(L"CTuningSpace::put_FrequencyMapping : NotImplemented\n");
288 return E_NOTIMPL;
289 }
290
291 HRESULT
292 STDMETHODCALLTYPE
get_DefaultLocator(ILocator ** LocatorVal)293 CTuningSpace::get_DefaultLocator(ILocator **LocatorVal)
294 {
295 OutputDebugStringW(L"CTuningSpace::get_DefaultLocator : NotImplemented\n");
296 return E_NOTIMPL;
297 }
298
299 HRESULT
300 STDMETHODCALLTYPE
put_DefaultLocator(ILocator * LocatorVal)301 CTuningSpace::put_DefaultLocator(ILocator *LocatorVal)
302 {
303 OutputDebugStringW(L"CTuningSpace::put_DefaultLocator : NotImplemented\n");
304 return E_NOTIMPL;
305 }
306
307 HRESULT
308 STDMETHODCALLTYPE
Clone(ITuningSpace ** NewTS)309 CTuningSpace::Clone(ITuningSpace **NewTS)
310 {
311 OutputDebugStringW(L"CTuningSpace::Clone : NotImplemented\n");
312 return E_NOTIMPL;
313 }
314
315 //-------------------------------------------------------------------
316 // IDVBTuningSpace
317 //
318 HRESULT
319 STDMETHODCALLTYPE
get_SystemType(DVBSystemType * SysType)320 CTuningSpace::get_SystemType(DVBSystemType *SysType)
321 {
322 OutputDebugStringW(L"CTuningSpace::get_SystemType : NotImplemented\n");
323 return E_NOTIMPL;
324 }
325
326 HRESULT
327 STDMETHODCALLTYPE
put_SystemType(DVBSystemType SysType)328 CTuningSpace::put_SystemType(DVBSystemType SysType)
329 {
330 OutputDebugStringW(L"CTuningSpace::put_SystemType : NotImplemented\n");
331 return E_NOTIMPL;
332 }
333
334 HRESULT
335 WINAPI
CTuningSpace_fnConstructor(IUnknown * pUnknown,REFIID riid,LPVOID * ppv)336 CTuningSpace_fnConstructor(
337 IUnknown *pUnknown,
338 REFIID riid,
339 LPVOID * ppv)
340 {
341 // construct device control
342 CTuningSpace * space = new CTuningSpace();
343
344 #ifdef MSVIDCTL_TRACE
345 WCHAR Buffer[MAX_PATH];
346 LPOLESTR lpstr;
347 StringFromCLSID(riid, &lpstr);
348 swprintf(Buffer, L"CTuningSpace_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
349 OutputDebugStringW(Buffer);
350 #endif
351
352 if (!space)
353 return E_OUTOFMEMORY;
354
355 if (FAILED(space->QueryInterface(riid, ppv)))
356 {
357 /* not supported */
358 delete space;
359 return E_NOINTERFACE;
360 }
361
362 return NOERROR;
363 }
364
365
366