jscript: Make String_toUpperCase generic.
[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
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
72 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj);
73 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
74 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
75
76 /*****************************************************************************
77  * IDirectMusicLoaderCF implementation structure
78  */
79 struct IDirectMusicLoaderCF {
80         /* IUnknown fields */
81         const IClassFactoryVtbl *lpVtbl;
82         LONG dwRef;
83 };
84
85 /*****************************************************************************
86  * IDirectMusicContainerCF implementation structure
87  */
88 struct IDirectMusicContainerCF {
89         /* IUnknown fields */
90         const IClassFactoryVtbl *lpVtbl;
91         LONG dwRef;
92 };
93
94 /* cache/alias entry */
95 typedef struct _WINE_LOADER_ENTRY {
96         struct list entry; /* for listing elements */
97         DMUS_OBJECTDESC Desc;
98     LPDIRECTMUSICOBJECT pObject; /* pointer to object */
99         BOOL bInvalidDefaultDLS; /* my workaround for enabling caching of "faulty" default dls collection */
100 } WINE_LOADER_ENTRY, *LPWINE_LOADER_ENTRY;
101
102 /* cache options, search paths for specific types of objects */
103 typedef struct _WINE_LOADER_OPTION {
104         struct list entry; /* for listing elements */
105         GUID guidClass; /* ID of object type */
106         WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
107         BOOL bCache; /* cache objects of certain type */
108 } WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
109
110 /*****************************************************************************
111  * IDirectMusicLoaderImpl implementation structure
112  */
113 struct IDirectMusicLoaderImpl {
114         /* VTABLEs */
115         const IDirectMusicLoader8Vtbl *LoaderVtbl;
116         /* reference counter */
117         LONG dwRef;     
118         /* simple cache (linked list) */
119         struct list *pObjects;
120         /* settings for certain object classes */
121         struct list *pClassSettings;
122         /* critical section */
123         CRITICAL_SECTION CritSect;
124 };
125
126 /* contained object entry */
127 typedef struct _WINE_CONTAINER_ENTRY {
128         struct list entry; /* for listing elements */
129         DMUS_OBJECTDESC Desc;
130         BOOL bIsRIFF;
131         DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
132         WCHAR* wszAlias;
133         LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
134 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
135
136 /*****************************************************************************
137  * IDirectMusicContainerImpl implementation structure
138  */
139 struct IDirectMusicContainerImpl {
140         /* VTABLEs */
141         const IDirectMusicContainerVtbl *ContainerVtbl;
142         const IDirectMusicObjectVtbl *ObjectVtbl;
143         const IPersistStreamVtbl *PersistStreamVtbl;
144         /* reference counter */
145         LONG dwRef;
146         /* stream */
147         LPSTREAM pStream;
148         /* header */
149         DMUS_IO_CONTAINER_HEADER Header;
150         /* data */
151         struct list *pContainedObjects; 
152         /* descriptor */
153         DMUS_OBJECTDESC Desc;
154 };
155
156 /*****************************************************************************
157  * IDirectMusicLoaderFileStream implementation structure
158  */
159 struct IDirectMusicLoaderFileStream {
160         /* VTABLEs */
161         const IStreamVtbl *StreamVtbl;
162         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
163         /* reference counter */
164         LONG dwRef;
165         /* file */
166         WCHAR wzFileName[MAX_PATH]; /* for clone */
167         HANDLE hFile;
168         /* loader */
169         LPDIRECTMUSICLOADER8 pLoader;
170 };
171
172 /* Custom: */
173 extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader);
174
175 /*****************************************************************************
176  * IDirectMusicLoaderResourceStream implementation structure
177  */
178 struct IDirectMusicLoaderResourceStream {
179         /* IUnknown fields */
180         const IStreamVtbl *StreamVtbl;
181         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
182         /* reference counter */
183         LONG dwRef;
184         /* data */
185         LPBYTE pbMemData;
186         LONGLONG llMemLength;
187         /* current position */
188         LONGLONG llPos; 
189         /* loader */
190         LPDIRECTMUSICLOADER8 pLoader;
191 };
192
193 /* Custom: */
194 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader);
195
196 /*****************************************************************************
197  * IDirectMusicLoaderGenericStream implementation structure
198  */
199 struct IDirectMusicLoaderGenericStream {
200         /* IUnknown fields */
201         const IStreamVtbl *StreamVtbl;
202         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
203         /* reference counter */
204         LONG dwRef;
205         /* stream */
206         LPSTREAM pStream;
207         /* loader */
208         LPDIRECTMUSICLOADER8 pLoader;
209 };
210
211 /* Custom: */
212 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader);
213
214 /*****************************************************************************
215  * Misc.
216  */
217 /* for simpler reading */
218 typedef struct _WINE_CHUNK {
219         FOURCC fccID; /* FOURCC ID of the chunk */
220         DWORD dwSize; /* size of the chunk */
221 } WINE_CHUNK, *LPWINE_CHUNK;
222
223 #include "debug.h"
224
225 #endif  /* __WINE_DMLOADER_PRIVATE_H */