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 module_ref DECLSPEC_HIDDEN
;
49 static inline void lock_module(void) { InterlockedIncrement( &module_ref
); }
50 static inline void unlock_module(void) { InterlockedDecrement( &module_ref
); }
52 /*****************************************************************************
55 typedef struct IDirectMusicLoaderCF IDirectMusicLoaderCF
;
56 typedef struct IDirectMusicContainerCF IDirectMusicContainerCF
;
58 typedef struct IDirectMusicLoaderImpl IDirectMusicLoaderImpl
;
59 typedef struct IDirectMusicContainerImpl IDirectMusicContainerImpl
;
61 typedef struct IDirectMusicLoaderFileStream IDirectMusicLoaderFileStream
;
62 typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream
;
63 typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream
;
65 /*****************************************************************************
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
;
74 /* cache/alias entry */
75 typedef struct _WINE_LOADER_ENTRY
{
76 struct list entry
; /* for listing elements */
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
;
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
;
90 /*****************************************************************************
91 * IDirectMusicLoaderImpl implementation structure
93 struct IDirectMusicLoaderImpl
{
95 const IDirectMusicLoader8Vtbl
*LoaderVtbl
;
96 /* reference counter */
98 /* simple cache (linked list) */
99 struct list
*pObjects
;
100 /* settings for certain object classes */
101 struct list
*pClassSettings
;
104 /* contained object entry */
105 typedef struct _WINE_CONTAINER_ENTRY
{
106 struct list entry
; /* for listing elements */
107 DMUS_OBJECTDESC Desc
;
109 DWORD dwFlags
; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
111 LPDIRECTMUSICOBJECT pObject
; /* needed when releasing from loader's cache on container release */
112 } WINE_CONTAINER_ENTRY
, *LPWINE_CONTAINER_ENTRY
;
114 /*****************************************************************************
115 * IDirectMusicContainerImpl implementation structure
117 struct IDirectMusicContainerImpl
{
119 const IDirectMusicContainerVtbl
*ContainerVtbl
;
120 const IDirectMusicObjectVtbl
*ObjectVtbl
;
121 const IPersistStreamVtbl
*PersistStreamVtbl
;
122 /* reference counter */
127 DMUS_IO_CONTAINER_HEADER Header
;
129 struct list
*pContainedObjects
;
131 DMUS_OBJECTDESC Desc
;
134 /*****************************************************************************
135 * IDirectMusicLoaderFileStream implementation structure
137 struct IDirectMusicLoaderFileStream
{
139 const IStreamVtbl
*StreamVtbl
;
140 const IDirectMusicGetLoaderVtbl
*GetLoaderVtbl
;
141 /* reference counter */
144 WCHAR wzFileName
[MAX_PATH
]; /* for clone */
147 LPDIRECTMUSICLOADER8 pLoader
;
151 extern HRESULT WINAPI
IDirectMusicLoaderFileStream_Attach (LPSTREAM iface
, LPCWSTR wzFile
, LPDIRECTMUSICLOADER8 pLoader
) DECLSPEC_HIDDEN
;
153 /*****************************************************************************
154 * IDirectMusicLoaderResourceStream implementation structure
156 struct IDirectMusicLoaderResourceStream
{
157 /* IUnknown fields */
158 const IStreamVtbl
*StreamVtbl
;
159 const IDirectMusicGetLoaderVtbl
*GetLoaderVtbl
;
160 /* reference counter */
164 LONGLONG llMemLength
;
165 /* current position */
168 LPDIRECTMUSICLOADER8 pLoader
;
172 extern HRESULT WINAPI
IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface
, LPBYTE pbMemData
, LONGLONG llMemLength
, LONGLONG llPos
, LPDIRECTMUSICLOADER8 pLoader
) DECLSPEC_HIDDEN
;
174 /*****************************************************************************
175 * IDirectMusicLoaderGenericStream implementation structure
177 struct IDirectMusicLoaderGenericStream
{
178 /* IUnknown fields */
179 const IStreamVtbl
*StreamVtbl
;
180 const IDirectMusicGetLoaderVtbl
*GetLoaderVtbl
;
181 /* reference counter */
186 LPDIRECTMUSICLOADER8 pLoader
;
190 extern HRESULT WINAPI
IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface
, LPSTREAM pStream
, LPDIRECTMUSICLOADER8 pLoader
) DECLSPEC_HIDDEN
;
192 /*****************************************************************************
195 /* for simpler reading */
196 typedef struct _WINE_CHUNK
{
197 FOURCC fccID
; /* FOURCC ID of the chunk */
198 DWORD dwSize
; /* size of the chunk */
199 } WINE_CHUNK
, *LPWINE_CHUNK
;
203 #endif /* __WINE_DMLOADER_PRIVATE_H */