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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
77 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
79 /*****************************************************************************
80 * IDirectMusicLoaderCF implementation structure
82 struct IDirectMusicLoaderCF {
84 const IClassFactoryVtbl *lpVtbl;
88 /*****************************************************************************
89 * IDirectMusicContainerCF implementation structure
91 struct IDirectMusicContainerCF {
93 const IClassFactoryVtbl *lpVtbl;
97 /* cache/alias entry */
98 typedef struct _WINE_LOADER_ENTRY {
99 struct list entry; /* for listing elements */
100 DMUS_OBJECTDESC Desc;
101 LPDIRECTMUSICOBJECT pObject; /* pointer to object */
102 BOOL bInvalidDefaultDLS; /* my workaround for enabling caching of "faulty" default dls collection */
103 } WINE_LOADER_ENTRY, *LPWINE_LOADER_ENTRY;
105 /* cache options, search paths for specific types of objects */
106 typedef struct _WINE_LOADER_OPTION {
107 struct list entry; /* for listing elements */
108 GUID guidClass; /* ID of object type */
109 WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
110 BOOL bCache; /* cache objects of certain type */
111 } WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
113 /*****************************************************************************
114 * IDirectMusicLoaderImpl implementation structure
116 struct IDirectMusicLoaderImpl {
118 const IDirectMusicLoader8Vtbl *LoaderVtbl;
119 /* reference counter */
121 /* simple cache (linked list) */
122 struct list *pObjects;
123 /* settings for certain object classes */
124 struct list *pClassSettings;
125 /* critical section */
126 CRITICAL_SECTION CritSect;
129 /* contained object entry */
130 typedef struct _WINE_CONTAINER_ENTRY {
131 struct list entry; /* for listing elements */
132 DMUS_OBJECTDESC Desc;
134 DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
136 LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
137 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
139 /*****************************************************************************
140 * IDirectMusicContainerImpl implementation structure
142 struct IDirectMusicContainerImpl {
144 const IDirectMusicContainerVtbl *ContainerVtbl;
145 const IDirectMusicObjectVtbl *ObjectVtbl;
146 const IPersistStreamVtbl *PersistStreamVtbl;
147 /* reference counter */
152 DMUS_IO_CONTAINER_HEADER Header;
154 struct list *pContainedObjects;
156 DMUS_OBJECTDESC Desc;
159 /*****************************************************************************
160 * IDirectMusicLoaderFileStream implementation structure
162 struct IDirectMusicLoaderFileStream {
164 const IStreamVtbl *StreamVtbl;
165 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
166 /* reference counter */
169 WCHAR wzFileName[MAX_PATH]; /* for clone */
172 LPDIRECTMUSICLOADER8 pLoader;
176 extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader);
177 extern void WINAPI IDirectMusicLoaderFileStream_Detach (LPSTREAM iface);
179 /*****************************************************************************
180 * IDirectMusicLoaderResourceStream implementation structure
182 struct IDirectMusicLoaderResourceStream {
183 /* IUnknown fields */
184 const IStreamVtbl *StreamVtbl;
185 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
186 /* reference counter */
190 LONGLONG llMemLength;
191 /* current position */
194 LPDIRECTMUSICLOADER8 pLoader;
198 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader);
199 extern void WINAPI IDirectMusicLoaderResourceStream_Detach (LPSTREAM iface);
201 /*****************************************************************************
202 * IDirectMusicLoaderGenericStream implementation structure
204 struct IDirectMusicLoaderGenericStream {
205 /* IUnknown fields */
206 const IStreamVtbl *StreamVtbl;
207 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
208 /* reference counter */
213 LPDIRECTMUSICLOADER8 pLoader;
217 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader);
218 extern void WINAPI IDirectMusicLoaderGenericStream_Detach (LPSTREAM iface);
220 /*****************************************************************************
223 /* for simpler reading */
224 typedef struct _WINE_CHUNK {
225 FOURCC fccID; /* FOURCC ID of the chunk */
226 DWORD dwSize; /* size of the chunk */
227 } WINE_CHUNK, *LPWINE_CHUNK;
229 extern HRESULT WINAPI DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]);
230 extern HRESULT WINAPI DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
231 extern HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface);
232 extern HRESULT WINAPI DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc);
233 extern BOOL WINAPI DMUSIC_IsValidLoadableClass (REFCLSID pClassID);
237 #endif /* __WINE_DMLOADER_PRIVATE_H */