winspool: Remove cross calls W->A for the "Printers" registry path.
[wine] / dlls / dmloader / dmloader_private.h
1 /* DirectMusicLoader Private Include
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 #ifndef __WINE_DMLOADER_PRIVATE_H
21 #define __WINE_DMLOADER_PRIVATE_H
22
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <string.h>
26
27 #define COBJMACROS
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnt.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
38 #include "winreg.h"
39 #include "objbase.h"
40
41 #include "dmusici.h"
42 #include "dmusicf.h"
43 #include "dmusics.h"
44
45 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
46
47 /* dmloader.dll global (for DllCanUnloadNow) */
48 extern LONG dwDirectMusicLoader; /* number of DirectMusicLoader(CF) instances */
49 extern LONG dwDirectMusicContainer; /* number of DirectMusicContainer(CF) instances */
50
51 /*****************************************************************************
52  * Interfaces
53  */
54 typedef struct IDirectMusicLoaderCF             IDirectMusicLoaderCF;
55 typedef struct IDirectMusicContainerCF          IDirectMusicContainerCF;
56
57 typedef struct IDirectMusicLoaderImpl           IDirectMusicLoaderImpl;
58 typedef struct IDirectMusicContainerImpl        IDirectMusicContainerImpl;
59
60 typedef struct IDirectMusicLoaderFileStream     IDirectMusicLoaderFileStream;
61 typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream;
62 typedef struct IDirectMusicLoaderGenericStream  IDirectMusicLoaderGenericStream;
63
64 /*****************************************************************************
65  * Creation helpers
66  */
67 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
68 extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
69
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);
74
75 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj);
76 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderFileStream (LPSTREAM iface);
77
78 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
79 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderResourceStream (LPSTREAM iface);
80
81 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
82 extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderGenericStream (LPSTREAM iface);
83
84 /*****************************************************************************
85  * IDirectMusicLoaderCF implementation structure
86  */
87 struct IDirectMusicLoaderCF {
88         /* IUnknown fields */
89         const IClassFactoryVtbl *lpVtbl;
90         LONG dwRef;
91 };
92
93 /* IUnknown / IClassFactory: */
94 extern HRESULT WINAPI IDirectMusicLoaderCF_QueryInterface (LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
95 extern ULONG   WINAPI IDirectMusicLoaderCF_AddRef (LPCLASSFACTORY iface);
96
97 /*****************************************************************************
98  * IDirectMusicContainerCF implementation structure
99  */
100 struct IDirectMusicContainerCF {
101         /* IUnknown fields */
102         const IClassFactoryVtbl *lpVtbl;
103         LONG dwRef;
104 };
105
106 /* IUnknown / IClassFactory: */
107 extern HRESULT WINAPI IDirectMusicContainerCF_QueryInterface (LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
108 extern ULONG   WINAPI IDirectMusicContainerCF_AddRef (LPCLASSFACTORY iface);
109
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;
117
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;
125
126 /*****************************************************************************
127  * IDirectMusicLoaderImpl implementation structure
128  */
129 struct IDirectMusicLoaderImpl {
130         /* VTABLEs */
131         const IDirectMusicLoader8Vtbl *LoaderVtbl;
132         /* reference counter */
133         LONG dwRef;     
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;
140 };
141
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);
145
146 /* contained object entry */
147 typedef struct _WINE_CONTAINER_ENTRY {
148         struct list entry; /* for listing elements */
149         DMUS_OBJECTDESC Desc;
150         BOOL bIsRIFF;
151         DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
152         WCHAR* wszAlias;
153         LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
154 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
155
156 /*****************************************************************************
157  * IDirectMusicContainerImpl implementation structure
158  */
159 struct IDirectMusicContainerImpl {
160         /* VTABLEs */
161         const IDirectMusicContainerVtbl *ContainerVtbl;
162         const IDirectMusicObjectVtbl *ObjectVtbl;
163         const IPersistStreamVtbl *PersistStreamVtbl;
164         /* reference counter */
165         LONG dwRef;
166         /* stream */
167         LPSTREAM pStream;
168         /* header */
169         DMUS_IO_CONTAINER_HEADER Header;
170         /* data */
171         struct list *pContainedObjects; 
172         /* descriptor */
173         DMUS_OBJECTDESC Desc;
174 };
175
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);
185
186 /*****************************************************************************
187  * IDirectMusicLoaderFileStream implementation structure
188  */
189 struct IDirectMusicLoaderFileStream {
190         /* VTABLEs */
191         const IStreamVtbl *StreamVtbl;
192         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
193         /* reference counter */
194         LONG dwRef;
195         /* file */
196         WCHAR wzFileName[MAX_PATH]; /* for clone */
197         HANDLE hFile;
198         /* loader */
199         LPDIRECTMUSICLOADER8 pLoader;
200 };
201
202 /* Custom: */
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);
211
212 /*****************************************************************************
213  * IDirectMusicLoaderResourceStream implementation structure
214  */
215 struct IDirectMusicLoaderResourceStream {
216         /* IUnknown fields */
217         const IStreamVtbl *StreamVtbl;
218         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
219         /* reference counter */
220         LONG dwRef;
221         /* data */
222         LPBYTE pbMemData;
223         LONGLONG llMemLength;
224         /* current position */
225         LONGLONG llPos; 
226         /* loader */
227         LPDIRECTMUSICLOADER8 pLoader;
228 };
229
230 /* Custom: */
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);
239
240 /*****************************************************************************
241  * IDirectMusicLoaderGenericStream implementation structure
242  */
243 struct IDirectMusicLoaderGenericStream {
244         /* IUnknown fields */
245         const IStreamVtbl *StreamVtbl;
246         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
247         /* reference counter */
248         LONG dwRef;
249         /* stream */
250         LPSTREAM pStream;
251         /* loader */
252         LPDIRECTMUSICLOADER8 pLoader;
253 };
254
255 /* Custom: */
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);
264
265 /*****************************************************************************
266  * Misc.
267  */
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;
273
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);
280
281 #include "debug.h"
282
283 #endif  /* __WINE_DMLOADER_PRIVATE_H */