~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/amstream/main.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  *     MultiMedia Streams Base Functions (AMSTREAM.DLL)
  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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 22  */
 23 
 24 #include <stdarg.h>
 25 #include <string.h>
 26 
 27 #define COBJMACROS
 28 
 29 #include "windef.h"
 30 #include "winbase.h"
 31 #include "winuser.h"
 32 #include "winerror.h"
 33 
 34 #include "ole2.h"
 35 #include "rpcproxy.h"
 36 
 37 #include "amstream_private.h"
 38 #include "amstream.h"
 39 
 40 #include "wine/debug.h"
 41 
 42 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
 43 
 44 static HINSTANCE instance;
 45 static DWORD dll_ref = 0;
 46 
 47 /* For the moment, do nothing here. */
 48 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 49 {
 50     switch(fdwReason) {
 51         case DLL_PROCESS_ATTACH:
 52             instance = hInstDLL;
 53             DisableThreadLibraryCalls(hInstDLL);
 54             break;
 55         case DLL_PROCESS_DETACH:
 56             break;
 57     }
 58     return TRUE;
 59 }
 60 
 61 /******************************************************************************
 62  * Multimedia Streams ClassFactory
 63  */
 64 typedef struct {
 65     IClassFactory ITF_IClassFactory;
 66 
 67     LONG ref;
 68     HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
 69 } IClassFactoryImpl;
 70 
 71 struct object_creation_info
 72 {
 73     const CLSID *clsid;
 74     HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
 75 };
 76 
 77 static const struct object_creation_info object_creation[] =
 78 {
 79     { &CLSID_AMMultiMediaStream, AM_create },
 80     { &CLSID_AMDirectDrawStream, AM_create },
 81     { &CLSID_MediaStreamFilter, MediaStreamFilter_create }
 82 };
 83 
 84 static HRESULT WINAPI
 85 AMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
 86 {
 87     IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
 88 
 89     if (IsEqualGUID(riid, &IID_IUnknown)
 90         || IsEqualGUID(riid, &IID_IClassFactory))
 91     {
 92         IClassFactory_AddRef(iface);
 93         *ppobj = This;
 94         return S_OK;
 95     }
 96 
 97     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
 98     return E_NOINTERFACE;
 99 }
100 
101 static ULONG WINAPI AMCF_AddRef(LPCLASSFACTORY iface)
102 {
103     IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
104     return InterlockedIncrement(&This->ref);
105 }
106 
107 static ULONG WINAPI AMCF_Release(LPCLASSFACTORY iface)
108 {
109     IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
110 
111     ULONG ref = InterlockedDecrement(&This->ref);
112 
113     if (ref == 0)
114         HeapFree(GetProcessHeap(), 0, This);
115 
116     return ref;
117 }
118 
119 
120 static HRESULT WINAPI AMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
121                                           REFIID riid, LPVOID *ppobj)
122 {
123     IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
124     HRESULT hres;
125     LPUNKNOWN punk;
126     
127     TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
128 
129     *ppobj = NULL;
130     hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk);
131     if (SUCCEEDED(hres)) {
132         hres = IUnknown_QueryInterface(punk, riid, ppobj);
133         IUnknown_Release(punk);
134     }
135     return hres;
136 }
137 
138 static HRESULT WINAPI AMCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
139 {
140     IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
141     FIXME("(%p)->(%d),stub!\n",This,dolock);
142     return S_OK;
143 }
144 
145 static const IClassFactoryVtbl DSCF_Vtbl =
146 {
147     AMCF_QueryInterface,
148     AMCF_AddRef,
149     AMCF_Release,
150     AMCF_CreateInstance,
151     AMCF_LockServer
152 };
153 
154 /*******************************************************************************
155  * DllGetClassObject [AMSTREAM.@]
156  * Retrieves class object from a DLL object
157  *
158  * NOTES
159  *    Docs say returns STDAPI
160  *
161  * PARAMS
162  *    rclsid [I] CLSID for the class object
163  *    riid   [I] Reference to identifier of interface for class object
164  *    ppv    [O] Address of variable to receive interface pointer for riid
165  *
166  * RETURNS
167  *    Success: S_OK
168  *    Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
169  *             E_UNEXPECTED
170  */
171 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
172 {
173     unsigned int i;
174     IClassFactoryImpl *factory;
175     
176     TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
177     
178     if ( !IsEqualGUID( &IID_IClassFactory, riid )
179          && ! IsEqualGUID( &IID_IUnknown, riid) )
180         return E_NOINTERFACE;
181 
182     for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
183     {
184         if (IsEqualGUID(object_creation[i].clsid, rclsid))
185             break;
186     }
187 
188     if (i == sizeof(object_creation)/sizeof(object_creation[0]))
189     {
190         FIXME("%s: no class found.\n", debugstr_guid(rclsid));
191         return CLASS_E_CLASSNOTAVAILABLE;
192     }
193 
194     factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
195     if (factory == NULL) return E_OUTOFMEMORY;
196 
197     factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl;
198     factory->ref = 1;
199 
200     factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
201 
202     *ppv = &(factory->ITF_IClassFactory);
203     return S_OK;
204 }
205 
206 /***********************************************************************
207  *              DllCanUnloadNow (AMSTREAM.@)
208  */
209 HRESULT WINAPI DllCanUnloadNow(void)
210 {
211     return dll_ref != 0 ? S_FALSE : S_OK;
212 }
213 
214 /***********************************************************************
215  *              DllRegisterServer (AMSTREAM.@)
216  */
217 HRESULT WINAPI DllRegisterServer(void)
218 {
219     return __wine_register_resources( instance, NULL );
220 }
221 
222 /***********************************************************************
223  *              DllUnregisterServer (AMSTREAM.@)
224  */
225 HRESULT WINAPI DllUnregisterServer(void)
226 {
227     return __wine_unregister_resources( instance, NULL );
228 }
229 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.