1 /* DirectMusicLoader Private Include
3 * Copyright (C) 2003-2004 Rok Mandeljc
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.
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.
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
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_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
);
76 /*****************************************************************************
77 * IDirectMusicLoaderCF implementation structure
79 struct IDirectMusicLoaderCF
{
81 const IClassFactoryVtbl
*lpVtbl
;
85 /*****************************************************************************
86 * IDirectMusicContainerCF implementation structure
88 struct IDirectMusicContainerCF
{
90 const IClassFactoryVtbl
*lpVtbl
;
94 /* cache/alias entry */
95 typedef struct _WINE_LOADER_ENTRY
{
96 struct list entry
; /* for listing elements */
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
;
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
;
110 /*****************************************************************************
111 * IDirectMusicLoaderImpl implementation structure
113 struct IDirectMusicLoaderImpl
{
115 const IDirectMusicLoader8Vtbl
*LoaderVtbl
;
116 /* reference counter */
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
;
126 /* contained object entry */
127 typedef struct _WINE_CONTAINER_ENTRY
{
128 struct list entry
; /* for listing elements */
129 DMUS_OBJECTDESC Desc
;
131 DWORD dwFlags
; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
133 LPDIRECTMUSICOBJECT pObject
; /* needed when releasing from loader's cache on container release */
134 } WINE_CONTAINER_ENTRY
, *LPWINE_CONTAINER_ENTRY
;
136 /*****************************************************************************
137 * IDirectMusicContainerImpl implementation structure
139 struct IDirectMusicContainerImpl
{
141 const IDirectMusicContainerVtbl
*ContainerVtbl
;
142 const IDirectMusicObjectVtbl
*ObjectVtbl
;
143 const IPersistStreamVtbl
*PersistStreamVtbl
;
144 /* reference counter */
149 DMUS_IO_CONTAINER_HEADER Header
;
151 struct list
*pContainedObjects
;
153 DMUS_OBJECTDESC Desc
;
156 /*****************************************************************************
157 * IDirectMusicLoaderFileStream implementation structure
159 struct IDirectMusicLoaderFileStream
{
161 const IStreamVtbl
*StreamVtbl
;
162 const IDirectMusicGetLoaderVtbl
*GetLoaderVtbl
;
163 /* reference counter */
166 WCHAR wzFileName
[MAX_PATH
]; /* for clone */
169 LPDIRECTMUSICLOADER8 pLoader
;
173 extern HRESULT WINAPI
IDirectMusicLoaderFileStream_Attach (LPSTREAM iface
, LPCWSTR wzFile
, LPDIRECTMUSICLOADER8 pLoader
);
175 /*****************************************************************************
176 * IDirectMusicLoaderResourceStream implementation structure
178 struct IDirectMusicLoaderResourceStream
{
179 /* IUnknown fields */
180 const IStreamVtbl
*StreamVtbl
;
181 const IDirectMusicGetLoaderVtbl
*GetLoaderVtbl
;
182 /* reference counter */
186 LONGLONG llMemLength
;
187 /* current position */
190 LPDIRECTMUSICLOADER8 pLoader
;
194 extern HRESULT WINAPI
IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface
, LPBYTE pbMemData
, LONGLONG llMemLength
, LONGLONG llPos
, LPDIRECTMUSICLOADER8 pLoader
);
196 /*****************************************************************************
197 * IDirectMusicLoaderGenericStream implementation structure
199 struct IDirectMusicLoaderGenericStream
{
200 /* IUnknown fields */
201 const IStreamVtbl
*StreamVtbl
;
202 const IDirectMusicGetLoaderVtbl
*GetLoaderVtbl
;
203 /* reference counter */
208 LPDIRECTMUSICLOADER8 pLoader
;
212 extern HRESULT WINAPI
IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface
, LPSTREAM pStream
, LPDIRECTMUSICLOADER8 pLoader
);
214 /*****************************************************************************
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
;
225 #endif /* __WINE_DMLOADER_PRIVATE_H */