wintrust: Use path in WIN_TRUST_SUBJECT_FILE structure rather than assuming a 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
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_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_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
77 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
78
79 /*****************************************************************************
80  * IDirectMusicLoaderCF implementation structure
81  */
82 struct IDirectMusicLoaderCF {
83         /* IUnknown fields */
84         const IClassFactoryVtbl *lpVtbl;
85         LONG dwRef;
86 };
87
88 /*****************************************************************************
89  * IDirectMusicContainerCF implementation structure
90  */
91 struct IDirectMusicContainerCF {
92         /* IUnknown fields */
93         const IClassFactoryVtbl *lpVtbl;
94         LONG dwRef;
95 };
96
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;
104
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;
112
113 /*****************************************************************************
114  * IDirectMusicLoaderImpl implementation structure
115  */
116 struct IDirectMusicLoaderImpl {
117         /* VTABLEs */
118         const IDirectMusicLoader8Vtbl *LoaderVtbl;
119         /* reference counter */
120         LONG dwRef;     
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;
127 };
128
129 /* contained object entry */
130 typedef struct _WINE_CONTAINER_ENTRY {
131         struct list entry; /* for listing elements */
132         DMUS_OBJECTDESC Desc;
133         BOOL bIsRIFF;
134         DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
135         WCHAR* wszAlias;
136         LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
137 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
138
139 /*****************************************************************************
140  * IDirectMusicContainerImpl implementation structure
141  */
142 struct IDirectMusicContainerImpl {
143         /* VTABLEs */
144         const IDirectMusicContainerVtbl *ContainerVtbl;
145         const IDirectMusicObjectVtbl *ObjectVtbl;
146         const IPersistStreamVtbl *PersistStreamVtbl;
147         /* reference counter */
148         LONG dwRef;
149         /* stream */
150         LPSTREAM pStream;
151         /* header */
152         DMUS_IO_CONTAINER_HEADER Header;
153         /* data */
154         struct list *pContainedObjects; 
155         /* descriptor */
156         DMUS_OBJECTDESC Desc;
157 };
158
159 /*****************************************************************************
160  * IDirectMusicLoaderFileStream implementation structure
161  */
162 struct IDirectMusicLoaderFileStream {
163         /* VTABLEs */
164         const IStreamVtbl *StreamVtbl;
165         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
166         /* reference counter */
167         LONG dwRef;
168         /* file */
169         WCHAR wzFileName[MAX_PATH]; /* for clone */
170         HANDLE hFile;
171         /* loader */
172         LPDIRECTMUSICLOADER8 pLoader;
173 };
174
175 /* Custom: */
176 extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader);
177 extern void    WINAPI IDirectMusicLoaderFileStream_Detach (LPSTREAM iface);
178
179 /*****************************************************************************
180  * IDirectMusicLoaderResourceStream implementation structure
181  */
182 struct IDirectMusicLoaderResourceStream {
183         /* IUnknown fields */
184         const IStreamVtbl *StreamVtbl;
185         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
186         /* reference counter */
187         LONG dwRef;
188         /* data */
189         LPBYTE pbMemData;
190         LONGLONG llMemLength;
191         /* current position */
192         LONGLONG llPos; 
193         /* loader */
194         LPDIRECTMUSICLOADER8 pLoader;
195 };
196
197 /* Custom: */
198 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader);
199 extern void    WINAPI IDirectMusicLoaderResourceStream_Detach (LPSTREAM iface);
200
201 /*****************************************************************************
202  * IDirectMusicLoaderGenericStream implementation structure
203  */
204 struct IDirectMusicLoaderGenericStream {
205         /* IUnknown fields */
206         const IStreamVtbl *StreamVtbl;
207         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
208         /* reference counter */
209         LONG dwRef;
210         /* stream */
211         LPSTREAM pStream;
212         /* loader */
213         LPDIRECTMUSICLOADER8 pLoader;
214 };
215
216 /* Custom: */
217 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader);
218 extern void    WINAPI IDirectMusicLoaderGenericStream_Detach (LPSTREAM iface);
219
220 /*****************************************************************************
221  * Misc.
222  */
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;
228
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);
234
235 #include "debug.h"
236
237 #endif  /* __WINE_DMLOADER_PRIVATE_H */