1 /* DirectMusicLoader Private Include
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __WINE_DMLOADER_PRIVATE_H
21 #define __WINE_DMLOADER_PRIVATE_H
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
45 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
47 /* dmloader.dll global (for DllCanUnloadNow) */
48 extern LONG dwDirectMusicLoader; /* number of DirectMusicLoader(CF) instances */
49 extern LONG dwDirectMusicContainer; /* number of DirectMusicContainer(CF) instances */
51 /*****************************************************************************
54 typedef struct IDirectMusicLoaderCF IDirectMusicLoaderCF;
55 typedef struct IDirectMusicContainerCF IDirectMusicContainerCF;
57 typedef struct IDirectMusicLoaderImpl IDirectMusicLoaderImpl;
58 typedef struct IDirectMusicContainerImpl IDirectMusicContainerImpl;
60 typedef struct IDirectMusicLoaderFileStream IDirectMusicLoaderFileStream;
61 typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream;
62 typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream;
64 /*****************************************************************************
67 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
68 extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
70 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
71 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderImpl (LPDIRECTMUSICLOADER8 iface);
72 extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
73 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicContainerImpl(LPDIRECTMUSICCONTAINER iface);
75 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj);
76 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderFileStream (LPSTREAM iface);
78 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
79 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderResourceStream (LPSTREAM iface);
81 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
82 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderGenericStream (LPSTREAM iface);
84 /*****************************************************************************
85 * IDirectMusicLoaderCF implementation structure
87 struct IDirectMusicLoaderCF {
89 const IClassFactoryVtbl *lpVtbl;
93 /* IUnknown / IClassFactory: */
94 extern HRESULT WINAPI IDirectMusicLoaderCF_QueryInterface (LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
95 extern ULONG WINAPI IDirectMusicLoaderCF_AddRef (LPCLASSFACTORY iface);
97 /*****************************************************************************
98 * IDirectMusicContainerCF implementation structure
100 struct IDirectMusicContainerCF {
101 /* IUnknown fields */
102 const IClassFactoryVtbl *lpVtbl;
106 /* IUnknown / IClassFactory: */
107 extern HRESULT WINAPI IDirectMusicContainerCF_QueryInterface (LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
108 extern ULONG WINAPI IDirectMusicContainerCF_AddRef (LPCLASSFACTORY iface);
110 /* cache/alias entry */
111 typedef struct _WINE_LOADER_ENTRY {
112 struct list entry; /* for listing elements */
113 DMUS_OBJECTDESC Desc;
114 LPDIRECTMUSICOBJECT pObject; /* pointer to object */
115 BOOL bInvalidDefaultDLS; /* my workaround for enabling caching of "faulty" default dls collection */
116 } WINE_LOADER_ENTRY, *LPWINE_LOADER_ENTRY;
118 /* cache options, search paths for specific types of objects */
119 typedef struct _WINE_LOADER_OPTION {
120 struct list entry; /* for listing elements */
121 GUID guidClass; /* ID of object type */
122 WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
123 BOOL bCache; /* cache objects of certain type */
124 } WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
126 /*****************************************************************************
127 * IDirectMusicLoaderImpl implementation structure
129 struct IDirectMusicLoaderImpl {
131 const IDirectMusicLoader8Vtbl *LoaderVtbl;
132 /* reference counter */
134 /* simple cache (linked list) */
135 struct list *pObjects;
136 /* settings for certain object classes */
137 struct list *pClassSettings;
138 /* critical section */
139 CRITICAL_SECTION CritSect;
142 /* IUnknown / IDirectMusicLoader(8): */
143 extern HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface (LPDIRECTMUSICLOADER8 iface, REFIID riid, LPVOID *ppobj);
144 extern ULONG WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_AddRef (LPDIRECTMUSICLOADER8 iface);
146 /* contained object entry */
147 typedef struct _WINE_CONTAINER_ENTRY {
148 struct list entry; /* for listing elements */
149 DMUS_OBJECTDESC Desc;
151 DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
153 LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
154 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
156 /*****************************************************************************
157 * IDirectMusicContainerImpl implementation structure
159 struct IDirectMusicContainerImpl {
161 const IDirectMusicContainerVtbl *ContainerVtbl;
162 const IDirectMusicObjectVtbl *ObjectVtbl;
163 const IPersistStreamVtbl *PersistStreamVtbl;
164 /* reference counter */
169 DMUS_IO_CONTAINER_HEADER Header;
171 struct list *pContainedObjects;
173 DMUS_OBJECTDESC Desc;
176 /* IUnknown / IDirectMusicContainer: */
177 extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface (LPDIRECTMUSICCONTAINER iface, REFIID riid, LPVOID *ppobj);
178 extern ULONG WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_AddRef (LPDIRECTMUSICCONTAINER iface);
179 /* IDirectMusicObject: */
180 extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj);
181 extern ULONG WINAPI IDirectMusicContainerImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface);
182 /* IPersistStream: */
183 extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject);
184 extern ULONG WINAPI IDirectMusicContainerImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface);
186 /*****************************************************************************
187 * IDirectMusicLoaderFileStream implementation structure
189 struct IDirectMusicLoaderFileStream {
191 const IStreamVtbl *StreamVtbl;
192 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
193 /* reference counter */
196 WCHAR wzFileName[MAX_PATH]; /* for clone */
199 LPDIRECTMUSICLOADER8 pLoader;
203 extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader);
204 extern void WINAPI IDirectMusicLoaderFileStream_Detach (LPSTREAM iface);
205 /* IUnknown/IStream: */
206 extern HRESULT WINAPI IDirectMusicLoaderFileStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj);
207 extern ULONG WINAPI IDirectMusicLoaderFileStream_IStream_AddRef (LPSTREAM iface);
208 /* IDirectMusicGetLoader: */
209 extern HRESULT WINAPI IDirectMusicLoaderFileStream_IDirectMusicGetLoader_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, void** ppobj);
210 extern ULONG WINAPI IDirectMusicLoaderFileStream_IDirectMusicGetLoader_AddRef (LPDIRECTMUSICGETLOADER iface);
212 /*****************************************************************************
213 * IDirectMusicLoaderResourceStream implementation structure
215 struct IDirectMusicLoaderResourceStream {
216 /* IUnknown fields */
217 const IStreamVtbl *StreamVtbl;
218 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
219 /* reference counter */
223 LONGLONG llMemLength;
224 /* current position */
227 LPDIRECTMUSICLOADER8 pLoader;
231 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader);
232 extern void WINAPI IDirectMusicLoaderResourceStream_Detach (LPSTREAM iface);
233 /* IUnknown/IStream: */
234 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj);
235 extern ULONG WINAPI IDirectMusicLoaderResourceStream_IStream_AddRef (LPSTREAM iface);
236 /* IDirectMusicGetLoader: */
237 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_IDirectMusicGetLoader_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, void** ppobj);
238 extern ULONG WINAPI IDirectMusicLoaderResourceStream_IDirectMusicGetLoader_AddRef (LPDIRECTMUSICGETLOADER iface);
240 /*****************************************************************************
241 * IDirectMusicLoaderGenericStream implementation structure
243 struct IDirectMusicLoaderGenericStream {
244 /* IUnknown fields */
245 const IStreamVtbl *StreamVtbl;
246 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
247 /* reference counter */
252 LPDIRECTMUSICLOADER8 pLoader;
256 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader);
257 extern void WINAPI IDirectMusicLoaderGenericStream_Detach (LPSTREAM iface);
258 /* IUnknown/IStream: */
259 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj);
260 extern ULONG WINAPI IDirectMusicLoaderGenericStream_IStream_AddRef (LPSTREAM iface);
261 /* IDirectMusicGetLoader: */
262 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_IDirectMusicGetLoader_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, void** ppobj);
263 extern ULONG WINAPI IDirectMusicLoaderGenericStream_IDirectMusicGetLoader_AddRef (LPDIRECTMUSICGETLOADER iface);
265 /*****************************************************************************
268 /* for simpler reading */
269 typedef struct _WINE_CHUNK {
270 FOURCC fccID; /* FOURCC ID of the chunk */
271 DWORD dwSize; /* size of the chunk */
272 } WINE_CHUNK, *LPWINE_CHUNK;
274 extern HRESULT WINAPI DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]);
275 extern HRESULT WINAPI DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
276 extern HRESULT WINAPI DMUSIC_SetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
277 extern HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface);
278 extern HRESULT WINAPI DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc);
279 extern BOOL WINAPI DMUSIC_IsValidLoadableClass (REFCLSID pClassID);
283 #endif /* __WINE_DMLOADER_PRIVATE_H */