[BROWSEUI] SHExplorerParseCmdLine: Fix parsing of /root (#6752)
[reactos.git] / dll / directx / msvidctl / enumtuningspaces.cpp
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS BDA Proxy
4 * FILE: dll/directx/msvidctl/enumtuningspaces.cpp
5 * PURPOSE: ITuningSpace interface
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9 #include "precomp.h"
10
11 class CEnumTuningSpaces : public IEnumTuningSpaces
12 {
13 public:
14 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
15
16 STDMETHODIMP_(ULONG) AddRef()
17 {
18 InterlockedIncrement(&m_Ref);
19 return m_Ref;
20 }
21 STDMETHODIMP_(ULONG) Release()
22 {
23 InterlockedDecrement(&m_Ref);
24 if (!m_Ref)
25 {
26 //delete this;
27 return 0;
28 }
29 return m_Ref;
30 }
31
32 // IEnumTuningSpaces methods
33 HRESULT STDMETHODCALLTYPE Next(ULONG celt, ITuningSpace **rgelt, ULONG *pceltFetched);
34 HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
35 HRESULT STDMETHODCALLTYPE Reset();
36 HRESULT STDMETHODCALLTYPE Clone(IEnumTuningSpaces **ppEnum);
37
38 CEnumTuningSpaces() : m_Ref(0){};
39
40 virtual ~CEnumTuningSpaces(){};
41
42 protected:
43 LONG m_Ref;
44 };
45
46 HRESULT
47 STDMETHODCALLTYPE
48 CEnumTuningSpaces::QueryInterface(
49 IN REFIID refiid,
50 OUT PVOID* Output)
51 {
52 if (IsEqualGUID(refiid, IID_IUnknown))
53 {
54 *Output = PVOID(this);
55 reinterpret_cast<IUnknown*>(*Output)->AddRef();
56 return NOERROR;
57 }
58
59 if (IsEqualGUID(refiid, IID_IEnumTuningSpaces))
60 {
61 *Output = (IEnumTuningSpaces*)this;
62 reinterpret_cast<IEnumTuningSpaces*>(*Output)->AddRef();
63 return NOERROR;
64 }
65
66 WCHAR Buffer[MAX_PATH];
67 LPOLESTR lpstr;
68 StringFromCLSID(refiid, &lpstr);
69 swprintf(Buffer, L"CEnumTuningSpaces::QueryInterface: NoInterface for %s\n", lpstr);
70 OutputDebugStringW(Buffer);
71 CoTaskMemFree(lpstr);
72
73 return E_NOINTERFACE;
74 }
75
76 //-------------------------------------------------------------------
77 // IEnumTuningSpaces
78 //
79 HRESULT
80 STDMETHODCALLTYPE
81 CEnumTuningSpaces::Next(ULONG celt, ITuningSpace **rgelt, ULONG *pceltFetched)
82 {
83 OutputDebugStringW(L"CEnumTuningSpaces::Next : stub\n");
84 return CTuningSpace_fnConstructor(NULL, IID_ITuningSpace, (void**)rgelt);
85
86 }
87
88 HRESULT
89 STDMETHODCALLTYPE
90 CEnumTuningSpaces::Skip(ULONG celt)
91 {
92 OutputDebugStringW(L"CEnumTuningSpaces::Skip : NotImplemented\n");
93 return E_NOTIMPL;
94 }
95
96 HRESULT
97 STDMETHODCALLTYPE
98 CEnumTuningSpaces::Reset()
99 {
100 OutputDebugStringW(L"CEnumTuningSpaces::Reset : NotImplemented\n");
101 return E_NOTIMPL;
102 }
103
104 HRESULT
105 STDMETHODCALLTYPE
106 CEnumTuningSpaces::Clone(IEnumTuningSpaces **ppEnum)
107 {
108 OutputDebugStringW(L"CEnumTuningSpaces::Clone : NotImplemented\n");
109 return E_NOTIMPL;
110 }
111
112 HRESULT
113 WINAPI
114 CEnumTuningSpaces_fnConstructor(
115 IUnknown *pUnknown,
116 REFIID riid,
117 LPVOID * ppv)
118 {
119 // construct device control
120 CEnumTuningSpaces * tuningspaces = new CEnumTuningSpaces();
121
122 #ifdef MSVIDCTL_TRACE
123 WCHAR Buffer[MAX_PATH];
124 LPOLESTR lpstr;
125 StringFromCLSID(riid, &lpstr);
126 swprintf(Buffer, L"CEnumTuningSpaces_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
127 OutputDebugStringW(Buffer);
128 #endif
129
130 if (!tuningspaces)
131 return E_OUTOFMEMORY;
132
133 if (FAILED(tuningspaces->QueryInterface(riid, ppv)))
134 {
135 /* not supported */
136 delete tuningspaces;
137 return E_NOINTERFACE;
138 }
139
140 return NOERROR;
141 }
142