Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 1 | /* DirectMusicLoader Private Include |
| 2 | * |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 3 | * Copyright (C) 2003-2004 Rok Mandeljc |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (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 |
| 13 | * GNU Library General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __WINE_DMLOADER_PRIVATE_H |
| 21 | #define __WINE_DMLOADER_PRIVATE_H |
| 22 | |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 23 | #include <stdarg.h> |
| 24 | |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 25 | #include "windef.h" |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 26 | #include "winbase.h" |
| 27 | #include "winnt.h" |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 28 | #include "wingdi.h" |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 29 | #include "winuser.h" |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 30 | |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 31 | #include "wine/debug.h" |
| 32 | #include "wine/list.h" |
| 33 | #include "wine/unicode.h" |
| 34 | #include "winreg.h" |
| 35 | |
| 36 | #include "dmusici.h" |
| 37 | #include "dmusicf.h" |
| 38 | #include "dmusics.h" |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 39 | |
Rok Mandeljc | 1d0585c | 2003-09-22 19:37:33 +0000 | [diff] [blame] | 40 | /***************************************************************************** |
| 41 | * Auxiliary definitions |
| 42 | */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 43 | /* cache entry */ |
Rok Mandeljc | 1d0585c | 2003-09-22 19:37:33 +0000 | [diff] [blame] | 44 | typedef struct _DMUS_PRIVATE_CACHE_ENTRY { |
| 45 | struct list entry; /* for listing elements */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 46 | BOOL bIsFaultyDLS; /* my workaround for enabling caching of "faulty" dls collections */ |
| 47 | LPDIRECTMUSICOBJECT pObject; /* pointer to object */ |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 48 | } DMUS_PRIVATE_CACHE_ENTRY, *LPDMUS_PRIVATE_CACHE_ENTRY; |
| 49 | |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 50 | /* alias entry */ |
| 51 | typedef struct _DMUS_PRIVATE_ALIAS_ENTRY { |
| 52 | struct list entry; /* for listing elements */ |
| 53 | LPDMUS_OBJECTDESC pDesc; /* descriptor, containing info */ |
| 54 | } DMUS_PRIVATE_ALIAS_ENTRY, *LPDMUS_PRIVATE_ALIAS_ENTRY; |
| 55 | |
| 56 | /* contained object entry */ |
| 57 | typedef struct _DMUS_PRIVATE_CONTAINED_OBJECT_ENTRY { |
| 58 | struct list entry; /* for listing elements */ |
| 59 | WCHAR* wszAlias; |
| 60 | LPDMUS_OBJECTDESC pDesc; |
| 61 | } DMUS_PRIVATE_CONTAINED_OBJECT_ENTRY, *LPDMUS_PRIVATE_CONTAINED_OBJECT_ENTRY; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 62 | |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 63 | /***************************************************************************** |
| 64 | * Interfaces |
| 65 | */ |
| 66 | typedef struct IDirectMusicLoader8Impl IDirectMusicLoader8Impl; |
| 67 | typedef struct IDirectMusicContainerImpl IDirectMusicContainerImpl; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 68 | |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 69 | typedef struct ILoaderStream ILoaderStream; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 70 | |
| 71 | /***************************************************************************** |
| 72 | * Predeclare the interface implementation structures |
| 73 | */ |
| 74 | extern ICOM_VTABLE(IDirectMusicLoader8) DirectMusicLoader8_Vtbl; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 75 | |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 76 | extern ICOM_VTABLE(IUnknown) DirectMusicContainer_Unknown_Vtbl; |
| 77 | extern ICOM_VTABLE(IDirectMusicContainer) DirectMusicContainer_Container_Vtbl; |
| 78 | extern ICOM_VTABLE(IDirectMusicObject) DirectMusicContainer_Object_Vtbl; |
| 79 | extern ICOM_VTABLE(IPersistStream) DirectMusicContainer_PersistStream_Vtbl; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 80 | |
| 81 | extern ICOM_VTABLE(IUnknown) LoaderStream_Unknown_Vtbl; |
| 82 | extern ICOM_VTABLE(IStream) LoaderStream_Stream_Vtbl; |
| 83 | extern ICOM_VTABLE(IDirectMusicGetLoader) LoaderStream_GetLoader_Vtbl; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 84 | |
| 85 | /***************************************************************************** |
| 86 | * ClassFactory |
| 87 | */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 88 | extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter); |
| 89 | extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 90 | |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 91 | extern HRESULT WINAPI DMUSIC_CreateLoaderStream (LPVOID *ppobj); |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 92 | |
| 93 | /***************************************************************************** |
| 94 | * IDirectMusicLoader8Impl implementation structure |
| 95 | */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 96 | struct IDirectMusicLoader8Impl { |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 97 | /* IUnknown fields */ |
| 98 | ICOM_VFIELD(IDirectMusicLoader8); |
| 99 | DWORD ref; |
| 100 | |
| 101 | /* IDirectMusicLoaderImpl fields */ |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 102 | WCHAR wzSearchPath[MAX_PATH]; |
| 103 | |
Rok Mandeljc | 1d0585c | 2003-09-22 19:37:33 +0000 | [diff] [blame] | 104 | /* simple cache (linked list) */ |
| 105 | struct list CacheList; |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 106 | struct list AliasList; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | /* IUnknown: */ |
| 110 | extern HRESULT WINAPI IDirectMusicLoader8Impl_QueryInterface (LPDIRECTMUSICLOADER8 iface, REFIID riid, LPVOID *ppobj); |
| 111 | extern ULONG WINAPI IDirectMusicLoader8Impl_AddRef (LPDIRECTMUSICLOADER8 iface); |
| 112 | extern ULONG WINAPI IDirectMusicLoader8Impl_Release (LPDIRECTMUSICLOADER8 iface); |
| 113 | /* IDirectMusicLoader: */ |
| 114 | extern HRESULT WINAPI IDirectMusicLoader8Impl_GetObject (LPDIRECTMUSICLOADER8 iface, LPDMUS_OBJECTDESC pDesc, REFIID riid, LPVOID*ppv); |
| 115 | extern HRESULT WINAPI IDirectMusicLoader8Impl_SetObject (LPDIRECTMUSICLOADER8 iface, LPDMUS_OBJECTDESC pDesc); |
| 116 | extern HRESULT WINAPI IDirectMusicLoader8Impl_SetSearchDirectory (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass, WCHAR* pwzPath, BOOL fClear); |
| 117 | extern HRESULT WINAPI IDirectMusicLoader8Impl_ScanDirectory (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass, WCHAR* pwzFileExtension, WCHAR* pwzScanFileName); |
| 118 | extern HRESULT WINAPI IDirectMusicLoader8Impl_CacheObject (LPDIRECTMUSICLOADER8 iface, IDirectMusicObject* pObject); |
| 119 | extern HRESULT WINAPI IDirectMusicLoader8Impl_ReleaseObject (LPDIRECTMUSICLOADER8 iface, IDirectMusicObject* pObject); |
| 120 | extern HRESULT WINAPI IDirectMusicLoader8Impl_ClearCache (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass); |
| 121 | extern HRESULT WINAPI IDirectMusicLoader8Impl_EnableCache (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass, BOOL fEnable); |
| 122 | extern HRESULT WINAPI IDirectMusicLoader8Impl_EnumObject (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClass, DWORD dwIndex, LPDMUS_OBJECTDESC pDesc); |
| 123 | /* IDirectMusicLoader8: */ |
| 124 | extern void WINAPI IDirectMusicLoader8Impl_CollectGarbage (LPDIRECTMUSICLOADER8 iface); |
| 125 | extern HRESULT WINAPI IDirectMusicLoader8Impl_ReleaseObjectByUnknown (LPDIRECTMUSICLOADER8 iface, IUnknown* pObject); |
| 126 | extern HRESULT WINAPI IDirectMusicLoader8Impl_LoadObjectFromFile (LPDIRECTMUSICLOADER8 iface, REFGUID rguidClassID, REFIID iidInterfaceID, WCHAR* pwzFilePath, void** ppObject); |
| 127 | |
| 128 | /***************************************************************************** |
| 129 | * IDirectMusicContainerImpl implementation structure |
| 130 | */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 131 | struct IDirectMusicContainerImpl { |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 132 | /* IUnknown fields */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 133 | ICOM_VTABLE(IUnknown) *UnknownVtbl; |
| 134 | ICOM_VTABLE(IDirectMusicContainer) *ContainerVtbl; |
| 135 | ICOM_VTABLE(IDirectMusicObject) *ObjectVtbl; |
| 136 | ICOM_VTABLE(IPersistStream) *PersistStreamVtbl; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 137 | DWORD ref; |
| 138 | |
| 139 | /* IDirectMusicContainerImpl fields */ |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 140 | LPDMUS_OBJECTDESC pDesc; |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 141 | DMUS_IO_CONTAINER_HEADER* pHeader; |
| 142 | |
| 143 | /* list of objects */ |
| 144 | struct list ObjectsList; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | /* IUnknown: */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 148 | extern HRESULT WINAPI IDirectMusicContainerImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj); |
| 149 | extern ULONG WINAPI IDirectMusicContainerImpl_IUnknown_AddRef (LPUNKNOWN iface); |
| 150 | extern ULONG WINAPI IDirectMusicContainerImpl_IUnknown_Release (LPUNKNOWN iface); |
| 151 | /* IDirectMusicContainer: */ |
| 152 | extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface (LPDIRECTMUSICCONTAINER iface, REFIID riid, LPVOID *ppobj); |
| 153 | extern ULONG WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_AddRef (LPDIRECTMUSICCONTAINER iface); |
| 154 | extern ULONG WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_Release (LPDIRECTMUSICCONTAINER iface); |
| 155 | extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_EnumObject (LPDIRECTMUSICCONTAINER iface, REFGUID rguidClass, DWORD dwIndex, LPDMUS_OBJECTDESC pDesc, WCHAR* pwszAlias); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 156 | /* IDirectMusicObject: */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 157 | extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj); |
| 158 | extern ULONG WINAPI IDirectMusicContainerImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface); |
| 159 | extern ULONG WINAPI IDirectMusicContainerImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface); |
| 160 | extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); |
| 161 | extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc); |
| 162 | extern HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 163 | |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 164 | /* IPersistStream: */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 165 | extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, void** ppvObject); |
| 166 | extern ULONG WINAPI IDirectMusicContainerImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface); |
| 167 | extern ULONG WINAPI IDirectMusicContainerImpl_IPersistStream_Release (LPPERSISTSTREAM iface); |
| 168 | extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID); |
| 169 | extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface); |
| 170 | extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm); |
| 171 | extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); |
| 172 | extern HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 173 | |
| 174 | |
| 175 | /***************************************************************************** |
| 176 | * ILoaderStream implementation structure |
| 177 | */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 178 | struct ILoaderStream { |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 179 | /* IUnknown fields */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 180 | ICOM_VTABLE(IUnknown) *UnknownVtbl; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 181 | ICOM_VTABLE(IStream) *StreamVtbl; |
| 182 | ICOM_VTABLE(IDirectMusicGetLoader) *GetLoaderVtbl; |
| 183 | DWORD ref; |
| 184 | |
| 185 | /* ILoaderStream fields */ |
| 186 | IDirectMusicLoader8Impl* pLoader; |
| 187 | HANDLE hFile; |
| 188 | WCHAR wzFileName[MAX_PATH]; /* for clone */ |
| 189 | }; |
| 190 | |
| 191 | /* Custom: */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 192 | extern HRESULT WINAPI ILoaderStream_Attach (LPSTREAM iface, LPCWSTR wzFile, IDirectMusicLoader *pLoader); |
| 193 | extern void WINAPI ILoaderStream_Detach (LPSTREAM iface); |
| 194 | /* IUnknown: */ |
| 195 | extern HRESULT WINAPI ILoaderStream_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, void** ppobj); |
| 196 | extern ULONG WINAPI ILoaderStream_IUnknown_AddRef (LPUNKNOWN iface); |
| 197 | extern ULONG WINAPI ILoaderStream_IUnknown_Release (LPUNKNOWN iface); |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 198 | /* IDirectMusicGetLoader: */ |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 199 | extern HRESULT WINAPI ILoaderStream_IDirectMusicGetLoader_QueryInterface (LPDIRECTMUSICGETLOADER iface, REFIID riid, void** ppobj); |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 200 | extern ULONG WINAPI ILoaderStream_IDirectMusicGetLoader_AddRef (LPDIRECTMUSICGETLOADER iface); |
| 201 | extern ULONG WINAPI ILoaderStream_IDirectMusicGetLoader_Release (LPDIRECTMUSICGETLOADER iface); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 202 | extern HRESULT WINAPI ILoaderStream_IDirectMusicGetLoader_GetLoader (LPDIRECTMUSICGETLOADER iface, IDirectMusicLoader **ppLoader); |
| 203 | /* IStream: */ |
| 204 | extern HRESULT WINAPI ILoaderStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj); |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 205 | extern ULONG WINAPI ILoaderStream_IStream_AddRef (LPSTREAM iface); |
| 206 | extern ULONG WINAPI ILoaderStream_IStream_Release (LPSTREAM iface);extern HRESULT WINAPI ILoaderStream_IStream_Read (IStream* iface, void* pv, ULONG cb, ULONG* pcbRead); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 207 | extern HRESULT WINAPI ILoaderStream_IStream_Write (LPSTREAM iface, const void* pv, ULONG cb, ULONG* pcbWritten); |
| 208 | extern HRESULT WINAPI ILoaderStream_IStream_Seek (LPSTREAM iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition); |
| 209 | extern HRESULT WINAPI ILoaderStream_IStream_SetSize (LPSTREAM iface, ULARGE_INTEGER libNewSize); |
| 210 | extern HRESULT WINAPI ILoaderStream_IStream_CopyTo (LPSTREAM iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten); |
| 211 | extern HRESULT WINAPI ILoaderStream_IStream_Commit (LPSTREAM iface, DWORD grfCommitFlags); |
| 212 | extern HRESULT WINAPI ILoaderStream_IStream_Revert (LPSTREAM iface); |
| 213 | extern HRESULT WINAPI ILoaderStream_IStream_LockRegion (LPSTREAM iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); |
| 214 | extern HRESULT WINAPI ILoaderStream_IStream_UnlockRegion (LPSTREAM iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); |
| 215 | extern HRESULT WINAPI ILoaderStream_IStream_Stat (LPSTREAM iface, STATSTG* pstatstg, DWORD grfStatFlag); |
| 216 | extern HRESULT WINAPI ILoaderStream_IStream_Clone (LPSTREAM iface, IStream** ppstm); |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 217 | |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame^] | 218 | |
| 219 | /***************************************************************************** |
| 220 | * Misc. |
| 221 | */ |
| 222 | /* for simpler reading */ |
| 223 | typedef struct _DMUS_PRIVATE_CHUNK { |
| 224 | FOURCC fccID; /* FOURCC ID of the chunk */ |
| 225 | DWORD dwSize; /* size of the chunk */ |
| 226 | } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK; |
| 227 | |
| 228 | /* check whether the given DWORD is even (return 0) or odd (return 1) */ |
| 229 | static inline int even_or_odd (DWORD number) { |
| 230 | return (number & 0x1); /* basically, check if bit 0 is set ;) */ |
| 231 | } |
| 232 | |
| 233 | /* translate STREAM_SEEK flag to string */ |
| 234 | static inline const char *resolve_STREAM_SEEK (DWORD flag) { |
| 235 | switch (flag) { |
| 236 | case STREAM_SEEK_SET: |
| 237 | return wine_dbg_sprintf ("STREAM_SEEK_SET"); |
| 238 | case STREAM_SEEK_CUR: |
| 239 | return wine_dbg_sprintf ("STREAM_SEEK_CUR"); |
| 240 | case STREAM_SEEK_END: |
| 241 | return wine_dbg_sprintf ("STREAM_SEEK_END"); |
| 242 | default: |
| 243 | return wine_dbg_sprintf ("()"); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /* FOURCC to string conversion for debug messages */ |
| 248 | static inline const char *debugstr_fourcc (DWORD fourcc) { |
| 249 | if (!fourcc) return "'null'"; |
| 250 | return wine_dbg_sprintf ("\'%c%c%c%c\'", |
| 251 | (char)(fourcc), (char)(fourcc >> 8), |
| 252 | (char)(fourcc >> 16), (char)(fourcc >> 24)); |
| 253 | } |
| 254 | |
| 255 | /* DMUS_VERSION struct to string conversion for debug messages */ |
| 256 | static inline const char *debugstr_dmversion (LPDMUS_VERSION version) { |
| 257 | if (!version) return "'null'"; |
| 258 | return wine_dbg_sprintf ("\'%i,%i,%i,%i\'", |
| 259 | (int)((version->dwVersionMS && 0xFFFF0000) >> 8), (int)(version->dwVersionMS && 0x0000FFFF), |
| 260 | (int)((version->dwVersionLS && 0xFFFF0000) >> 8), (int)(version->dwVersionLS && 0x0000FFFF)); |
| 261 | } |
| 262 | |
| 263 | /* used for initialising structs (primarily for DMUS_OBJECTDESC) */ |
| 264 | #define DM_STRUCT_INIT(x) \ |
| 265 | do { \ |
| 266 | memset((x), 0, sizeof(*(x))); \ |
| 267 | (x)->dwSize = sizeof(*x); \ |
| 268 | } while (0) |
| 269 | |
| 270 | |
| 271 | /* used for generic dumping (copied from ddraw) */ |
| 272 | typedef struct { |
| 273 | DWORD val; |
| 274 | const char* name; |
| 275 | } flag_info; |
| 276 | |
| 277 | #define FE(x) { x, #x } |
| 278 | #define DMUSIC_dump_flags(flags,names,num_names) DMUSIC_dump_flags_(flags, names, num_names, 1) |
| 279 | |
| 280 | /* generic dump function */ |
| 281 | static inline void DMUSIC_dump_flags_ (DWORD flags, const flag_info* names, size_t num_names, int newline) { |
| 282 | unsigned int i; |
| 283 | |
| 284 | for (i=0; i < num_names; i++) { |
| 285 | if ((flags & names[i].val) || /* standard flag value */ |
| 286 | ((!flags) && (!names[i].val))) /* zero value only */ |
| 287 | DPRINTF("%s ", names[i].name); |
| 288 | } |
| 289 | |
| 290 | if (newline) DPRINTF("\n"); |
| 291 | } |
| 292 | |
| 293 | static inline void DMUSIC_dump_DMUS_OBJ_FLAGS (DWORD flagmask) { |
| 294 | static const flag_info flags[] = { |
| 295 | FE(DMUS_OBJ_OBJECT), |
| 296 | FE(DMUS_OBJ_CLASS), |
| 297 | FE(DMUS_OBJ_NAME), |
| 298 | FE(DMUS_OBJ_CATEGORY), |
| 299 | FE(DMUS_OBJ_FILENAME), |
| 300 | FE(DMUS_OBJ_FULLPATH), |
| 301 | FE(DMUS_OBJ_URL), |
| 302 | FE(DMUS_OBJ_VERSION), |
| 303 | FE(DMUS_OBJ_DATE), |
| 304 | FE(DMUS_OBJ_LOADED), |
| 305 | FE(DMUS_OBJ_MEMORY), |
| 306 | FE(DMUS_OBJ_STREAM) |
| 307 | }; |
| 308 | DMUSIC_dump_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0])); |
| 309 | } |
| 310 | |
| 311 | static inline void DMUSIC_dump_DMUS_CONTAINER_FLAGS (DWORD flagmask) { |
| 312 | static const flag_info flags[] = { |
| 313 | FE(DMUS_CONTAINER_NOLOADS) |
| 314 | }; |
| 315 | DMUSIC_dump_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0])); |
| 316 | } |
| 317 | |
| 318 | static inline void DMUSIC_dump_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) { |
| 319 | if (pDesc) { |
| 320 | DPRINTF("DMUS_OBJECTDESC (%p)\n", pDesc); |
| 321 | DPRINTF(" - dwSize = %ld\n", pDesc->dwSize); |
| 322 | DPRINTF(" - dwValidData = "); |
| 323 | DMUSIC_dump_DMUS_OBJ_FLAGS (pDesc->dwValidData); |
| 324 | if (pDesc->dwValidData & DMUS_OBJ_CLASS) DPRINTF(" - guidClass = %s\n", debugstr_guid(&pDesc->guidClass)); |
| 325 | if (pDesc->dwValidData & DMUS_OBJ_OBJECT) DPRINTF(" - guidObject = %s\n", debugstr_guid(&pDesc->guidObject)); |
| 326 | if (pDesc->dwValidData & DMUS_OBJ_DATE) DPRINTF(" - ftDate = FIXME\n"); |
| 327 | if (pDesc->dwValidData & DMUS_OBJ_VERSION) DPRINTF(" - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion)); |
| 328 | if (pDesc->dwValidData & DMUS_OBJ_NAME) DPRINTF(" - wszName = %s\n", debugstr_w(pDesc->wszName)); |
| 329 | if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) DPRINTF(" - wszCategory = %s\n", debugstr_w(pDesc->wszCategory)); |
| 330 | if (pDesc->dwValidData & DMUS_OBJ_FILENAME) DPRINTF(" - wszFileName = %s\n", debugstr_w(pDesc->wszFileName)); |
| 331 | if (pDesc->dwValidData & DMUS_OBJ_MEMORY) DPRINTF(" - llMemLength = %lli\n - pbMemData = %p\n", pDesc->llMemLength, pDesc->pbMemData); |
| 332 | if (pDesc->dwValidData & DMUS_OBJ_STREAM) DPRINTF(" - pStream = %p\n", pDesc->pStream); |
| 333 | } else { |
| 334 | DPRINTF("(NULL)\n"); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | /* check whether chunkID is valid dmobject form chunk */ |
| 339 | static inline BOOL IS_VALID_DMFORM(chunkID) { |
| 340 | if ((chunkID == DMUS_FOURCC_AUDIOPATH_FORM) || (chunkID == DMUS_FOURCC_BAND_FORM) || (chunkID == DMUS_FOURCC_CHORDMAP_FORM) |
| 341 | || (chunkID == DMUS_FOURCC_CONTAINER_FORM) || (chunkID == FOURCC_DLS) || (chunkID == DMUS_FOURCC_SCRIPT_FORM) |
| 342 | || (chunkID == DMUS_FOURCC_SEGMENT_FORM) || (chunkID == DMUS_FOURCC_STYLE_FORM) || (chunkID == DMUS_FOURCC_TOOLGRAPH_FORM) |
| 343 | || (chunkID == DMUS_FOURCC_TRACK_FORM) || (chunkID == mmioFOURCC('W','A','V','E'))) return TRUE; |
| 344 | else return FALSE; |
| 345 | } |
| 346 | |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 347 | #endif /* __WINE_DMLOADER_PRIVATE_H */ |