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

Wine Cross Reference
wine/dlls/dmloader/classfactory.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  /* IDirectMusicLoaderCF
  2  *  IDirectMusicContainerCF
  3  *
  4  * Copyright (C) 2004 Rok Mandeljc
  5  *
  6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This program is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this program; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include "dmloader_private.h"
 22 
 23 WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
 24 
 25 /*****************************************************************************
 26  * IDirectMusicLoaderCF implementation
 27  */
 28 static ULONG WINAPI IDirectMusicLoaderCF_AddRef (LPCLASSFACTORY iface);
 29 
 30 static HRESULT WINAPI IDirectMusicLoaderCF_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj) {
 31         IDirectMusicLoaderCF *This = (IDirectMusicLoaderCF *)iface;
 32         
 33         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
 34         if (IsEqualIID (riid, &IID_IUnknown) || 
 35             IsEqualIID (riid, &IID_IClassFactory)) {
 36                 IDirectMusicLoaderCF_AddRef (iface);
 37                 *ppobj = This;
 38                 return S_OK;
 39         }
 40         
 41         WARN(": not found\n");
 42         return E_NOINTERFACE;
 43 }
 44 
 45 static ULONG WINAPI IDirectMusicLoaderCF_AddRef (LPCLASSFACTORY iface) {
 46         IDirectMusicLoaderCF *This = (IDirectMusicLoaderCF *)iface;
 47         TRACE("(%p): AddRef from %d\n", This, This->dwRef);
 48         return InterlockedIncrement (&This->dwRef);
 49 }
 50 
 51 static ULONG WINAPI IDirectMusicLoaderCF_Release (LPCLASSFACTORY iface) {
 52         IDirectMusicLoaderCF *This = (IDirectMusicLoaderCF *)iface;
 53         
 54         DWORD dwRef = InterlockedDecrement (&This->dwRef);
 55         TRACE("(%p): ReleaseRef to %d\n", This, dwRef);
 56         if (dwRef == 0) {
 57                 HeapFree(GetProcessHeap (), 0, This);
 58                 /* decrease number of instances */
 59                 InterlockedDecrement(&dwDirectMusicLoader);
 60         }
 61         
 62         return dwRef;   
 63 }
 64 
 65 static HRESULT WINAPI IDirectMusicLoaderCF_CreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
 66         IDirectMusicLoaderCF *This = (IDirectMusicLoaderCF *)iface;
 67         
 68         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
 69         if (pOuter) {
 70                 ERR(": pOuter should be NULL\n");
 71                 return CLASS_E_NOAGGREGATION;
 72         }
 73         
 74         return DMUSIC_CreateDirectMusicLoaderImpl (riid, ppobj, pOuter);
 75 }
 76 
 77 static HRESULT WINAPI IDirectMusicLoaderCF_LockServer (LPCLASSFACTORY iface, BOOL dolock) {
 78         IDirectMusicLoaderCF *This = (IDirectMusicLoaderCF *)iface;
 79         TRACE("(%p, %d)\n", This, dolock);
 80         if (dolock)
 81                 InterlockedIncrement (&dwDirectMusicLoader);
 82         else
 83                 InterlockedDecrement (&dwDirectMusicLoader);
 84         return S_OK;
 85 }
 86 
 87 static const IClassFactoryVtbl DirectMusicLoaderCF_Vtbl = {
 88         IDirectMusicLoaderCF_QueryInterface,
 89         IDirectMusicLoaderCF_AddRef,
 90         IDirectMusicLoaderCF_Release,
 91         IDirectMusicLoaderCF_CreateInstance,
 92         IDirectMusicLoaderCF_LockServer
 93 };
 94 
 95 HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
 96         IDirectMusicLoaderCF *obj;
 97 
 98         TRACE("(%s, %p, %p)\n", debugstr_dmguid(lpcGUID), ppobj, pUnkOuter);
 99         obj = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLoaderCF));
100         if (NULL == obj) {
101                 *ppobj = NULL;
102                 return E_OUTOFMEMORY;
103         }
104         obj->lpVtbl = &DirectMusicLoaderCF_Vtbl;
105         obj->dwRef = 0; /* will be inited with QueryInterface */
106 
107         /* increase number of instances */
108         InterlockedIncrement (&dwDirectMusicLoader);    
109         
110         return IDirectMusicLoaderCF_QueryInterface ((LPCLASSFACTORY)obj, lpcGUID, ppobj);
111 }
112 
113 
114 /*****************************************************************************
115  * IDirectMusicContainerCF implementation
116  */
117 static ULONG WINAPI IDirectMusicContainerCF_AddRef (LPCLASSFACTORY iface);
118 
119 static HRESULT WINAPI IDirectMusicContainerCF_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj) {
120         IDirectMusicContainerCF *This = (IDirectMusicContainerCF *)iface;
121         
122         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
123         if (IsEqualIID (riid, &IID_IUnknown) || 
124             IsEqualIID (riid, &IID_IClassFactory)) {
125                 IDirectMusicContainerCF_AddRef (iface);
126                 *ppobj = This;
127                 return S_OK;
128         }
129         
130         WARN(": not found\n");
131         return E_NOINTERFACE;
132 }
133 
134 static ULONG WINAPI IDirectMusicContainerCF_AddRef (LPCLASSFACTORY iface) {
135         IDirectMusicContainerCF *This = (IDirectMusicContainerCF *)iface;
136         TRACE("(%p): AddRef from %d\n", This, This->dwRef);
137         return InterlockedIncrement (&This->dwRef);
138 }
139 
140 static ULONG WINAPI IDirectMusicContainerCF_Release (LPCLASSFACTORY iface) {
141         IDirectMusicContainerCF *This = (IDirectMusicContainerCF *)iface;
142         
143         DWORD dwRef = InterlockedDecrement (&This->dwRef);
144         TRACE("(%p): ReleaseRef to %d\n", This, dwRef);
145         if (dwRef == 0) {
146                 HeapFree(GetProcessHeap (), 0, This);
147                 /* decrease number of instances */
148                 InterlockedDecrement(&dwDirectMusicContainer);
149         }
150         
151         return dwRef;
152 }
153 
154 static HRESULT WINAPI IDirectMusicContainerCF_CreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
155         IDirectMusicContainerCF *This = (IDirectMusicContainerCF *)iface;
156 
157         TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
158         if (pOuter) {
159                 ERR(": pOuter should be NULL\n");
160                 return CLASS_E_NOAGGREGATION;
161         }
162 
163         return DMUSIC_CreateDirectMusicContainerImpl (riid, ppobj, pOuter);
164 }
165 
166 static HRESULT WINAPI IDirectMusicContainerCF_LockServer (LPCLASSFACTORY iface, BOOL dolock) {
167         IDirectMusicContainerCF *This = (IDirectMusicContainerCF *)iface;
168         TRACE("(%p, %d)\n", This, dolock);
169         if (dolock)
170                 InterlockedIncrement (&dwDirectMusicContainer);
171         else
172                 InterlockedDecrement (&dwDirectMusicContainer);
173         return S_OK;
174 }
175 
176 static const IClassFactoryVtbl DirectMusicContainerCF_Vtbl = {
177         IDirectMusicContainerCF_QueryInterface,
178         IDirectMusicContainerCF_AddRef,
179         IDirectMusicContainerCF_Release,
180         IDirectMusicContainerCF_CreateInstance,
181         IDirectMusicContainerCF_LockServer
182 };
183 
184 HRESULT WINAPI DMUSIC_CreateDirectMusicContainerCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
185         IDirectMusicContainerCF *obj;
186 
187         TRACE("(%s, %p, %p)\n", debugstr_dmguid(lpcGUID), ppobj, pUnkOuter);
188         obj = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerCF));
189         if (NULL == obj) {
190                 *ppobj = NULL;
191                 return E_OUTOFMEMORY;
192         }
193         obj->lpVtbl = &DirectMusicContainerCF_Vtbl;
194         obj->dwRef = 0; /* will be inited with QueryInterface */
195 
196         /* increase number of instances */
197         InterlockedIncrement (&dwDirectMusicContainer);
198         
199         return IDirectMusicContainerCF_QueryInterface ((LPCLASSFACTORY)obj, lpcGUID, ppobj);
200 }
201 

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