1c2c66affSColin Finck /*
2c2c66affSColin Finck * COPYRIGHT: See COPYING in the top level directory
3c2c66affSColin Finck * PROJECT: ReactOS BDA Proxy
4c2c66affSColin Finck * FILE: dll/directx/msvidctl/tuningspace_container.cpp
5c2c66affSColin Finck * PURPOSE: ITuningSpaceContainer interface
6c2c66affSColin Finck *
7c2c66affSColin Finck * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8c2c66affSColin Finck */
9c2c66affSColin Finck #define _FORCENAMELESSUNION
10c2c66affSColin Finck #include "precomp.h"
11c2c66affSColin Finck
12c2c66affSColin Finck
13c2c66affSColin Finck class CTuningSpaceContainer : public ITuningSpaceContainer
14c2c66affSColin Finck {
15c2c66affSColin Finck public:
16c2c66affSColin Finck
17c2c66affSColin Finck STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
18c2c66affSColin Finck
AddRef()19c2c66affSColin Finck STDMETHODIMP_(ULONG) AddRef()
20c2c66affSColin Finck {
21c2c66affSColin Finck InterlockedIncrement(&m_Ref);
22c2c66affSColin Finck return m_Ref;
23c2c66affSColin Finck }
Release()24c2c66affSColin Finck STDMETHODIMP_(ULONG) Release()
25c2c66affSColin Finck {
26c2c66affSColin Finck InterlockedDecrement(&m_Ref);
27c2c66affSColin Finck if (!m_Ref)
28c2c66affSColin Finck {
29c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::Release : delete\n");
30c2c66affSColin Finck //delete this;
31c2c66affSColin Finck return 0;
32c2c66affSColin Finck }
33c2c66affSColin Finck return m_Ref;
34c2c66affSColin Finck }
35c2c66affSColin Finck
36c2c66affSColin Finck // IDispatch methods
37c2c66affSColin Finck HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
38c2c66affSColin Finck HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
39c2c66affSColin Finck HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
40c2c66affSColin Finck HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
41c2c66affSColin Finck
42c2c66affSColin Finck //ITuningSpaceContainer methods
43c2c66affSColin Finck HRESULT STDMETHODCALLTYPE get_Count(long *Count);
44c2c66affSColin Finck HRESULT STDMETHODCALLTYPE get__NewEnum(IEnumVARIANT **NewEnum);
45c2c66affSColin Finck HRESULT STDMETHODCALLTYPE get_Item(VARIANT varIndex, ITuningSpace **TuningSpace);
46c2c66affSColin Finck HRESULT STDMETHODCALLTYPE put_Item(VARIANT varIndex, ITuningSpace *TuningSpace);
47c2c66affSColin Finck HRESULT STDMETHODCALLTYPE TuningSpacesForCLSID(BSTR SpaceCLSID, ITuningSpaces **NewColl);
48c2c66affSColin Finck HRESULT STDMETHODCALLTYPE _TuningSpacesForCLSID(REFCLSID SpaceCLSID, ITuningSpaces **NewColl);
49c2c66affSColin Finck HRESULT STDMETHODCALLTYPE TuningSpacesForName(BSTR Name, ITuningSpaces **NewColl);
50c2c66affSColin Finck HRESULT STDMETHODCALLTYPE FindID(ITuningSpace *TuningSpace, long *ID);
51c2c66affSColin Finck HRESULT STDMETHODCALLTYPE Add(ITuningSpace *TuningSpace, VARIANT *NewIndex);
52c2c66affSColin Finck HRESULT STDMETHODCALLTYPE get_EnumTuningSpaces(IEnumTuningSpaces **ppEnum);
53c2c66affSColin Finck HRESULT STDMETHODCALLTYPE Remove(VARIANT Index);
54c2c66affSColin Finck HRESULT STDMETHODCALLTYPE get_MaxCount(long *MaxCount);
55c2c66affSColin Finck HRESULT STDMETHODCALLTYPE put_MaxCount(long MaxCount);
56c2c66affSColin Finck
CTuningSpaceContainer()57c2c66affSColin Finck CTuningSpaceContainer() : m_Ref(0){};
58c2c66affSColin Finck
~CTuningSpaceContainer()59c2c66affSColin Finck virtual ~CTuningSpaceContainer(){};
60c2c66affSColin Finck
61c2c66affSColin Finck protected:
62c2c66affSColin Finck LONG m_Ref;
63c2c66affSColin Finck
64c2c66affSColin Finck };
65c2c66affSColin Finck
66c2c66affSColin Finck HRESULT
67c2c66affSColin Finck STDMETHODCALLTYPE
QueryInterface(IN REFIID refiid,OUT PVOID * Output)68c2c66affSColin Finck CTuningSpaceContainer::QueryInterface(
69c2c66affSColin Finck IN REFIID refiid,
70c2c66affSColin Finck OUT PVOID* Output)
71c2c66affSColin Finck {
72c2c66affSColin Finck if (IsEqualGUID(refiid, IID_IUnknown))
73c2c66affSColin Finck {
74c2c66affSColin Finck *Output = PVOID(this);
75c2c66affSColin Finck reinterpret_cast<IUnknown*>(*Output)->AddRef();
76c2c66affSColin Finck return NOERROR;
77c2c66affSColin Finck }
78c2c66affSColin Finck
79c2c66affSColin Finck if (IsEqualGUID(refiid, IID_ITuningSpaceContainer))
80c2c66affSColin Finck {
81c2c66affSColin Finck *Output = (ITuningSpaceContainer*)this;
82c2c66affSColin Finck reinterpret_cast<ITuningSpaceContainer*>(*Output)->AddRef();
83c2c66affSColin Finck return NOERROR;
84c2c66affSColin Finck }
85c2c66affSColin Finck
86c2c66affSColin Finck WCHAR Buffer[MAX_PATH];
87c2c66affSColin Finck LPOLESTR lpstr;
88c2c66affSColin Finck StringFromCLSID(refiid, &lpstr);
89c2c66affSColin Finck swprintf(Buffer, L"CTuningSpaceContainer::QueryInterface: NoInterface for %s", lpstr);
90c2c66affSColin Finck OutputDebugStringW(Buffer);
91c2c66affSColin Finck CoTaskMemFree(lpstr);
92c2c66affSColin Finck
93c2c66affSColin Finck
94c2c66affSColin Finck return E_NOINTERFACE;
95c2c66affSColin Finck }
96c2c66affSColin Finck
97c2c66affSColin Finck //-------------------------------------------------------------------
98c2c66affSColin Finck // IDispatch methods
99c2c66affSColin Finck //
100c2c66affSColin Finck HRESULT
101c2c66affSColin Finck STDMETHODCALLTYPE
GetTypeInfoCount(UINT * pctinfo)102c2c66affSColin Finck CTuningSpaceContainer::GetTypeInfoCount(UINT *pctinfo)
103c2c66affSColin Finck {
104c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::GetTypeInfoCount : NotImplemented\n");
105c2c66affSColin Finck return E_NOTIMPL;
106c2c66affSColin Finck }
107c2c66affSColin Finck
108c2c66affSColin Finck HRESULT
109c2c66affSColin Finck STDMETHODCALLTYPE
GetTypeInfo(UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)110c2c66affSColin Finck CTuningSpaceContainer::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
111c2c66affSColin Finck {
112c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::GetTypeInfo : NotImplemented\n");
113c2c66affSColin Finck return E_NOTIMPL;
114c2c66affSColin Finck }
115c2c66affSColin Finck HRESULT
116c2c66affSColin Finck STDMETHODCALLTYPE
GetIDsOfNames(REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)117c2c66affSColin Finck CTuningSpaceContainer::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
118c2c66affSColin Finck {
119c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::GetIDsOfNames : NotImplemented\n");
120c2c66affSColin Finck return E_NOTIMPL;
121c2c66affSColin Finck }
122c2c66affSColin Finck HRESULT
123c2c66affSColin Finck STDMETHODCALLTYPE
Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)124c2c66affSColin Finck CTuningSpaceContainer::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
125c2c66affSColin Finck {
126c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::Invoke : NotImplemented\n");
127c2c66affSColin Finck return E_NOTIMPL;
128c2c66affSColin Finck }
129c2c66affSColin Finck
130c2c66affSColin Finck //-------------------------------------------------------------------
131c2c66affSColin Finck // ITuningSpaceContainer methods
132c2c66affSColin Finck //
133c2c66affSColin Finck
134c2c66affSColin Finck HRESULT
135c2c66affSColin Finck STDMETHODCALLTYPE
get_Count(long * Count)136c2c66affSColin Finck CTuningSpaceContainer::get_Count(long *Count)
137c2c66affSColin Finck {
138c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::get_Count : NotImplemented\n");
139c2c66affSColin Finck return E_NOTIMPL;
140c2c66affSColin Finck }
141c2c66affSColin Finck HRESULT
142c2c66affSColin Finck STDMETHODCALLTYPE
get__NewEnum(IEnumVARIANT ** NewEnum)143c2c66affSColin Finck CTuningSpaceContainer::get__NewEnum(IEnumVARIANT **NewEnum)
144c2c66affSColin Finck {
145c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::get__NewEnum : NotImplemented\n");
146c2c66affSColin Finck return E_NOTIMPL;
147c2c66affSColin Finck }
148c2c66affSColin Finck
149c2c66affSColin Finck HRESULT
150c2c66affSColin Finck STDMETHODCALLTYPE
get_Item(VARIANT varIndex,ITuningSpace ** TuningSpace)151c2c66affSColin Finck CTuningSpaceContainer::get_Item(VARIANT varIndex, ITuningSpace **TuningSpace)
152c2c66affSColin Finck {
153c2c66affSColin Finck #ifdef MSVIDCTL_TRACE
154c2c66affSColin Finck WCHAR Buffer[100];
155c2c66affSColin Finck swprintf(Buffer, L"CTuningSpaceContainer::get_Item : type %x value %s stub\n", varIndex.vt, varIndex.bstrVal);
156c2c66affSColin Finck OutputDebugStringW(Buffer);
157c2c66affSColin Finck #endif
158c2c66affSColin Finck
159c2c66affSColin Finck return CTuningSpace_fnConstructor(NULL, IID_ITuningSpace, (void**)TuningSpace);
160c2c66affSColin Finck }
161c2c66affSColin Finck HRESULT
162c2c66affSColin Finck STDMETHODCALLTYPE
put_Item(VARIANT varIndex,ITuningSpace * TuningSpace)163c2c66affSColin Finck CTuningSpaceContainer::put_Item(VARIANT varIndex, ITuningSpace *TuningSpace)
164c2c66affSColin Finck {
165c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::put_Item : NotImplemented\n");
166c2c66affSColin Finck return E_NOTIMPL;
167c2c66affSColin Finck }
168c2c66affSColin Finck
169c2c66affSColin Finck HRESULT
170c2c66affSColin Finck STDMETHODCALLTYPE
TuningSpacesForCLSID(BSTR SpaceCLSID,ITuningSpaces ** NewColl)171c2c66affSColin Finck CTuningSpaceContainer::TuningSpacesForCLSID(BSTR SpaceCLSID, ITuningSpaces **NewColl)
172c2c66affSColin Finck {
173c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::TuningSpacesForCLSID : NotImplemented\n");
174c2c66affSColin Finck return E_NOTIMPL;
175c2c66affSColin Finck }
176c2c66affSColin Finck HRESULT
177c2c66affSColin Finck STDMETHODCALLTYPE
_TuningSpacesForCLSID(REFCLSID SpaceCLSID,ITuningSpaces ** NewColl)178c2c66affSColin Finck CTuningSpaceContainer::_TuningSpacesForCLSID(REFCLSID SpaceCLSID, ITuningSpaces **NewColl)
179c2c66affSColin Finck {
180c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::_TuningSpacesForCLSID : NotImplemented\n");
181c2c66affSColin Finck return E_NOTIMPL;
182c2c66affSColin Finck }
183c2c66affSColin Finck
184c2c66affSColin Finck HRESULT
185c2c66affSColin Finck STDMETHODCALLTYPE
TuningSpacesForName(BSTR Name,ITuningSpaces ** NewColl)186c2c66affSColin Finck CTuningSpaceContainer::TuningSpacesForName(BSTR Name, ITuningSpaces **NewColl)
187c2c66affSColin Finck {
188c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::TuningSpacesForName : NotImplemented\n");
189c2c66affSColin Finck return E_NOTIMPL;
190c2c66affSColin Finck }
191c2c66affSColin Finck
192c2c66affSColin Finck HRESULT
193c2c66affSColin Finck STDMETHODCALLTYPE
FindID(ITuningSpace * TuningSpace,long * ID)194c2c66affSColin Finck CTuningSpaceContainer::FindID(ITuningSpace *TuningSpace, long *ID)
195c2c66affSColin Finck {
196c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::FindID : NotImplemented\n");
197c2c66affSColin Finck return E_NOTIMPL;
198c2c66affSColin Finck }
199c2c66affSColin Finck
200c2c66affSColin Finck HRESULT
201c2c66affSColin Finck STDMETHODCALLTYPE
Add(ITuningSpace * TuningSpace,VARIANT * NewIndex)202c2c66affSColin Finck CTuningSpaceContainer::Add(ITuningSpace *TuningSpace, VARIANT *NewIndex)
203c2c66affSColin Finck {
204c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::Add : stub\n");
205c2c66affSColin Finck TuningSpace->AddRef();
206c2c66affSColin Finck NewIndex->vt = VT_BSTR;
207c2c66affSColin Finck InterlockedIncrement(&m_Ref);
208*d7fd62d4SKyle Katarn return TuningSpace->get_FriendlyName(&NewIndex->bstrVal);
209c2c66affSColin Finck }
210c2c66affSColin Finck HRESULT
211c2c66affSColin Finck STDMETHODCALLTYPE
get_EnumTuningSpaces(IEnumTuningSpaces ** ppEnum)212c2c66affSColin Finck CTuningSpaceContainer::get_EnumTuningSpaces(IEnumTuningSpaces **ppEnum)
213c2c66affSColin Finck {
214c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::get_EnumTuningSpaces : stub\n");
215c2c66affSColin Finck return CEnumTuningSpaces_fnConstructor(NULL, IID_IEnumTuningSpaces, (void**)ppEnum);
216c2c66affSColin Finck }
217c2c66affSColin Finck
218c2c66affSColin Finck HRESULT
219c2c66affSColin Finck STDMETHODCALLTYPE
Remove(VARIANT Index)220c2c66affSColin Finck CTuningSpaceContainer::Remove(VARIANT Index)
221c2c66affSColin Finck {
222c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::Remove: NotImplemented\n");
223c2c66affSColin Finck return E_NOTIMPL;
224c2c66affSColin Finck }
225c2c66affSColin Finck
226c2c66affSColin Finck HRESULT
227c2c66affSColin Finck STDMETHODCALLTYPE
get_MaxCount(long * MaxCount)228c2c66affSColin Finck CTuningSpaceContainer::get_MaxCount(long *MaxCount)
229c2c66affSColin Finck {
230c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::get_MaxCount : NotImplemented\n");
231c2c66affSColin Finck return E_NOTIMPL;
232c2c66affSColin Finck }
233c2c66affSColin Finck
234c2c66affSColin Finck HRESULT
235c2c66affSColin Finck STDMETHODCALLTYPE
put_MaxCount(long MaxCount)236c2c66affSColin Finck CTuningSpaceContainer::put_MaxCount(long MaxCount)
237c2c66affSColin Finck {
238c2c66affSColin Finck OutputDebugStringW(L"CTuningSpaceContainer::put_MaxCount : NotImplemented\n");
239c2c66affSColin Finck return E_NOTIMPL;
240c2c66affSColin Finck }
241c2c66affSColin Finck
242c2c66affSColin Finck
243c2c66affSColin Finck HRESULT
244c2c66affSColin Finck WINAPI
CTuningSpaceContainer_fnConstructor(IUnknown * pUnknown,REFIID riid,LPVOID * ppv)245c2c66affSColin Finck CTuningSpaceContainer_fnConstructor(
246c2c66affSColin Finck IUnknown *pUnknown,
247c2c66affSColin Finck REFIID riid,
248c2c66affSColin Finck LPVOID * ppv)
249c2c66affSColin Finck {
250c2c66affSColin Finck // construct device control
251c2c66affSColin Finck CTuningSpaceContainer * provider = new CTuningSpaceContainer();
252c2c66affSColin Finck
253c2c66affSColin Finck #ifdef MSVIDCTL_TRACE
254c2c66affSColin Finck WCHAR Buffer[MAX_PATH];
255c2c66affSColin Finck LPOLESTR lpstr;
256c2c66affSColin Finck StringFromCLSID(riid, &lpstr);
257c2c66affSColin Finck swprintf(Buffer, L"CTuningSpaceContainer_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
258c2c66affSColin Finck OutputDebugStringW(Buffer);
259c2c66affSColin Finck #endif
260c2c66affSColin Finck
261c2c66affSColin Finck if (!provider)
262c2c66affSColin Finck return E_OUTOFMEMORY;
263c2c66affSColin Finck
264c2c66affSColin Finck if (FAILED(provider->QueryInterface(riid, ppv)))
265c2c66affSColin Finck {
266c2c66affSColin Finck /* not supported */
267c2c66affSColin Finck delete provider;
268c2c66affSColin Finck return E_NOINTERFACE;
269c2c66affSColin Finck }
270c2c66affSColin Finck
271c2c66affSColin Finck return NOERROR;
272c2c66affSColin Finck }
273