For ShellExecuteExA we need to copy out the hProcess value from the W
[wine] / dlls / amstream / amstream.c
1 /*
2  * Implementation of IAMMultiMediaStream Interface
3  *
4  * Copyright 2004 Christian Costa
5  *
6  * This file contains the (internal) driver registration functions,
7  * driver enumeration APIs and DirectDraw creation functions.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include "config.h"
25 #include "wine/debug.h"
26
27 #define COBJMACROS
28
29 #include "winbase.h"
30 #include "wingdi.h"
31
32 #include "amstream_private.h"
33 #include "amstream.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
36
37 typedef struct {
38     IAMMultiMediaStream lpVtbl;
39     ULONG ref;
40 } IAMMultiMediaStreamImpl;
41
42 static struct IAMMultiMediaStreamVtbl AM_Vtbl;
43
44 HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
45 {
46     IAMMultiMediaStreamImpl* object; 
47
48     FIXME("(%p,%p)\n", pUnkOuter, ppObj);
49
50     if( pUnkOuter )
51       return CLASS_E_NOAGGREGATION;
52       
53     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMultiMediaStreamImpl));
54     
55     object->lpVtbl.lpVtbl = &AM_Vtbl;
56     object->ref = 1;
57
58     *ppObj = object;
59     
60     return S_OK;
61 }
62
63 /*** IUnknown methods ***/
64 static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream* iface, REFIID riid, void** ppvObject)
65 {
66   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
67
68   FIXME("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
69
70   if (IsEqualGUID(riid, &IID_IUnknown)
71       || IsEqualGUID(riid, &IID_IAMMultiMediaStream))
72   {
73     IClassFactory_AddRef(iface);
74     *ppvObject = This;
75     return S_OK;
76   }
77
78   ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
79   return E_NOINTERFACE;
80 }
81
82 static ULONG WINAPI IAMMultiMediaStreamImpl_AddRef(IAMMultiMediaStream* iface)
83 {
84   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
85
86   TRACE("(%p/%p)\n", iface, This);
87   return InterlockedIncrement(&This->ref);
88 }
89
90 static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
91 {
92   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
93   ULONG ref = InterlockedDecrement(&This->ref);
94
95   TRACE("(%p/%p)\n", iface, This);
96
97   if (!ref)
98     HeapFree(GetProcessHeap(), 0, This);
99
100   return ref;
101 }
102
103 /*** IMultiMediaStream methods ***/
104 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream* iface, char* pdwFlags, STREAM_TYPE* pStreamType)
105 {
106   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
107
108   FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pdwFlags, pStreamType); 
109
110   return S_FALSE;
111 }
112
113 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream* iface, REFMSPID idPurpose, IMediaStream** ppMediaStream)
114 {
115   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
116
117   FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, idPurpose, ppMediaStream); 
118
119   return S_FALSE;
120 }
121
122 static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStream* iface, long Index, IMediaStream** ppMediaStream)
123 {
124   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
125
126   FIXME("(%p/%p)->(%ld,%p) stub!\n", This, iface, Index, ppMediaStream); 
127
128   return S_FALSE;
129 }
130
131 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* iface, STREAM_STATE* pCurrentState)
132 {
133   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
134
135   FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState); 
136
137   return S_FALSE;
138 }
139
140 static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface, STREAM_STATE NewState)
141 {
142   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
143   
144   FIXME("(%p/%p)->() stub!\n", This, iface); 
145
146   return S_FALSE;
147 }
148
149 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface, STREAM_TIME* pCurrentTime)
150 {
151   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
152
153   FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime); 
154
155   return S_FALSE;
156 }
157
158 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* iface, STREAM_TIME* pDuration)
159 {
160   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
161
162   FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration); 
163
164   return S_FALSE;
165 }
166
167 static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, STREAM_TIME SeekTime)
168 {
169   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
170
171   FIXME("(%p/%p)->() stub!\n", This, iface); 
172
173   return S_FALSE;
174 }
175
176 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface, HANDLE* phEOS)
177 {
178   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
179
180   FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS); 
181
182   return S_FALSE;
183 }
184
185 /*** IAMMultiMediaStream methods ***/
186 static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* iface, STREAM_TYPE StreamType, DWORD dwFlags, IGraphBuilder* pFilterGraph)
187 {
188   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
189
190   FIXME("(%p/%p)->(%lx,%lx,%p) stub!\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph); 
191
192   return S_FALSE;
193 }
194
195 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream* iface, IGraphBuilder** ppGraphBuilder)
196 {
197   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
198
199   FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppGraphBuilder); 
200
201   return S_FALSE;
202 }
203
204 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
205 {
206   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
207
208   FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppFilter); 
209
210   return S_FALSE;
211 }
212
213 static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* pStreamObject, const MSPID* PurposeId,
214                                           DWORD dwFlags, IMediaStream** ppNewStream)
215 {
216   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
217
218   FIXME("(%p/%p)->(%p,%p,%lx,%p) stub!\n", This, iface, pStreamObject, PurposeId, dwFlags, ppNewStream); 
219
220   return S_FALSE;
221 }
222
223 static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags)
224 {
225   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
226
227   FIXME("(%p/%p)->(%p,%lx) stub!\n", This, iface, pszFileName, dwFlags); 
228
229   return S_FALSE;
230 }
231
232 static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenMoniker(IAMMultiMediaStream* iface, IBindCtx* pCtx, IMoniker* pMoniker, DWORD dwFlags)
233 {
234   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
235
236   FIXME("(%p/%p)->(%p,%p,%lx) stub!\n", This, iface, pCtx, pMoniker, dwFlags); 
237
238   return S_FALSE;
239 }
240
241 static HRESULT WINAPI IAMMultiMediaStreamImpl_Render(IAMMultiMediaStream* iface, DWORD dwFlags)
242 {
243   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
244
245   FIXME("(%p/%p)->(%lx) stub!\n", This, iface, dwFlags); 
246
247   return S_FALSE;
248 }
249
250 static IAMMultiMediaStreamVtbl AM_Vtbl =
251 {
252     IAMMultiMediaStreamImpl_QueryInterface,
253     IAMMultiMediaStreamImpl_AddRef,
254     IAMMultiMediaStreamImpl_Release,
255     IAMMultiMediaStreamImpl_GetInformation,
256     IAMMultiMediaStreamImpl_GetMediaStream,
257     IAMMultiMediaStreamImpl_EnumMediaStreams,
258     IAMMultiMediaStreamImpl_GetState,
259     IAMMultiMediaStreamImpl_SetState,
260     IAMMultiMediaStreamImpl_GetTime,
261     IAMMultiMediaStreamImpl_GetDuration,
262     IAMMultiMediaStreamImpl_Seek,
263     IAMMultiMediaStreamImpl_GetEndOfStream,
264     IAMMultiMediaStreamImpl_Initialize,
265     IAMMultiMediaStreamImpl_GetFilterGraph,
266     IAMMultiMediaStreamImpl_GetFilter,
267     IAMMultiMediaStreamImpl_AddMediaStream,
268     IAMMultiMediaStreamImpl_OpenFile,
269     IAMMultiMediaStreamImpl_OpenMoniker,
270     IAMMultiMediaStreamImpl_Render
271 };