msvcrt: Don't add '\r' character in fputws function.
[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 module_ref DECLSPEC_HIDDEN;
49 static inline void lock_module(void) { InterlockedIncrement( &module_ref ); }
50 static inline void unlock_module(void) { InterlockedDecrement( &module_ref ); }
51
52 /*****************************************************************************
53  * Interfaces
54  */
55 typedef struct IDirectMusicLoaderCF             IDirectMusicLoaderCF;
56 typedef struct IDirectMusicContainerCF          IDirectMusicContainerCF;
57
58 typedef struct IDirectMusicLoaderImpl           IDirectMusicLoaderImpl;
59 typedef struct IDirectMusicContainerImpl        IDirectMusicContainerImpl;
60
61 typedef struct IDirectMusicLoaderFileStream     IDirectMusicLoaderFileStream;
62 typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream;
63 typedef struct IDirectMusicLoaderGenericStream  IDirectMusicLoaderGenericStream;
64
65 /*****************************************************************************
66  * Creation helpers
67  */
68 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
69 extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
70 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
71 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
72 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
73
74 /* cache/alias entry */
75 typedef struct _WINE_LOADER_ENTRY {
76         struct list entry; /* for listing elements */
77         DMUS_OBJECTDESC Desc;
78     LPDIRECTMUSICOBJECT pObject; /* pointer to object */
79         BOOL bInvalidDefaultDLS; /* my workaround for enabling caching of "faulty" default dls collection */
80 } WINE_LOADER_ENTRY, *LPWINE_LOADER_ENTRY;
81
82 /* cache options, search paths for specific types of objects */
83 typedef struct _WINE_LOADER_OPTION {
84         struct list entry; /* for listing elements */
85         GUID guidClass; /* ID of object type */
86         WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
87         BOOL bCache; /* cache objects of certain type */
88 } WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
89
90 /*****************************************************************************
91  * IDirectMusicLoaderImpl implementation structure
92  */
93 struct IDirectMusicLoaderImpl {
94     IDirectMusicLoader8 IDirectMusicLoader8_iface;
95     LONG ref;
96     /* simple cache (linked list) */
97     struct list *pObjects;
98     /* settings for certain object classes */
99     struct list *pClassSettings;
100 };
101
102 /* contained object entry */
103 typedef struct _WINE_CONTAINER_ENTRY {
104         struct list entry; /* for listing elements */
105         DMUS_OBJECTDESC Desc;
106         BOOL bIsRIFF;
107         DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
108         WCHAR* wszAlias;
109         LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
110 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
111
112 /*****************************************************************************
113  * IDirectMusicContainerImpl implementation structure
114  */
115 struct IDirectMusicContainerImpl {
116         /* VTABLEs */
117         const IDirectMusicContainerVtbl *ContainerVtbl;
118         const IDirectMusicObjectVtbl *ObjectVtbl;
119         const IPersistStreamVtbl *PersistStreamVtbl;
120         /* reference counter */
121         LONG dwRef;
122         /* stream */
123         LPSTREAM pStream;
124         /* header */
125         DMUS_IO_CONTAINER_HEADER Header;
126         /* data */
127         struct list *pContainedObjects; 
128         /* descriptor */
129         DMUS_OBJECTDESC Desc;
130 };
131
132 /*****************************************************************************
133  * IDirectMusicLoaderFileStream implementation structure
134  */
135 struct IDirectMusicLoaderFileStream {
136         /* VTABLEs */
137         const IStreamVtbl *StreamVtbl;
138         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
139         /* reference counter */
140         LONG dwRef;
141         /* file */
142         WCHAR wzFileName[MAX_PATH]; /* for clone */
143         HANDLE hFile;
144         /* loader */
145         LPDIRECTMUSICLOADER8 pLoader;
146 };
147
148 /* Custom: */
149 extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
150
151 /*****************************************************************************
152  * IDirectMusicLoaderResourceStream implementation structure
153  */
154 struct IDirectMusicLoaderResourceStream {
155         /* IUnknown fields */
156         const IStreamVtbl *StreamVtbl;
157         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
158         /* reference counter */
159         LONG dwRef;
160         /* data */
161         LPBYTE pbMemData;
162         LONGLONG llMemLength;
163         /* current position */
164         LONGLONG llPos; 
165         /* loader */
166         LPDIRECTMUSICLOADER8 pLoader;
167 };
168
169 /* Custom: */
170 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
171
172 /*****************************************************************************
173  * IDirectMusicLoaderGenericStream implementation structure
174  */
175 struct IDirectMusicLoaderGenericStream {
176         /* IUnknown fields */
177         const IStreamVtbl *StreamVtbl;
178         const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
179         /* reference counter */
180         LONG dwRef;
181         /* stream */
182         LPSTREAM pStream;
183         /* loader */
184         LPDIRECTMUSICLOADER8 pLoader;
185 };
186
187 /* Custom: */
188 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
189
190 /*****************************************************************************
191  * Misc.
192  */
193 /* for simpler reading */
194 typedef struct _WINE_CHUNK {
195         FOURCC fccID; /* FOURCC ID of the chunk */
196         DWORD dwSize; /* size of the chunk */
197 } WINE_CHUNK, *LPWINE_CHUNK;
198
199 #include "debug.h"
200
201 #endif  /* __WINE_DMLOADER_PRIVATE_H */