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

~ [ 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.