wined3d: Store sub-resource map counts in the sub-resource structure.
[wine.git] / dlls / dmloader / dmloader_private.h
blobff22604cd1e066f5d0c52ff8f9174f97edf184fa
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
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <string.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnt.h"
32 #include "wingdi.h"
33 #include "winuser.h"
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
38 #include "winreg.h"
39 #include "objbase.h"
41 #include "dmusici.h"
42 #include "dmusicf.h"
43 #include "dmusics.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 /*****************************************************************************
53 * Interfaces
55 typedef struct IDirectMusicLoaderCF IDirectMusicLoaderCF;
56 typedef struct IDirectMusicContainerCF IDirectMusicContainerCF;
58 typedef struct IDirectMusicLoaderImpl IDirectMusicLoaderImpl;
60 typedef struct IDirectMusicLoaderFileStream IDirectMusicLoaderFileStream;
61 typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream;
62 typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream;
64 /*****************************************************************************
65 * Creation helpers
67 extern HRESULT WINAPI create_dmloader(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
68 extern HRESULT WINAPI create_dmcontainer(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
69 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
70 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
71 extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
73 /* cache/alias entry */
74 typedef struct _WINE_LOADER_ENTRY {
75 struct list entry; /* for listing elements */
76 DMUS_OBJECTDESC Desc;
77 LPDIRECTMUSICOBJECT pObject; /* pointer to object */
78 BOOL bInvalidDefaultDLS; /* my workaround for enabling caching of "faulty" default dls collection */
79 } WINE_LOADER_ENTRY, *LPWINE_LOADER_ENTRY;
81 /* cache options, search paths for specific types of objects */
82 typedef struct _WINE_LOADER_OPTION {
83 struct list entry; /* for listing elements */
84 GUID guidClass; /* ID of object type */
85 WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
86 BOOL bCache; /* cache objects of certain type */
87 } WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
89 /*****************************************************************************
90 * IDirectMusicLoaderImpl implementation structure
92 struct IDirectMusicLoaderImpl {
93 IDirectMusicLoader8 IDirectMusicLoader8_iface;
94 LONG ref;
95 /* simple cache (linked list) */
96 struct list *pObjects;
97 /* settings for certain object classes */
98 struct list *pClassSettings;
101 /* contained object entry */
102 typedef struct _WINE_CONTAINER_ENTRY {
103 struct list entry; /* for listing elements */
104 DMUS_OBJECTDESC Desc;
105 BOOL bIsRIFF;
106 DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
107 WCHAR* wszAlias;
108 LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
109 } WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
111 /*****************************************************************************
112 * IDirectMusicLoaderFileStream implementation structure
114 struct IDirectMusicLoaderFileStream {
115 /* VTABLEs */
116 const IStreamVtbl *StreamVtbl;
117 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
118 /* reference counter */
119 LONG dwRef;
120 /* file */
121 WCHAR wzFileName[MAX_PATH]; /* for clone */
122 HANDLE hFile;
123 /* loader */
124 LPDIRECTMUSICLOADER8 pLoader;
127 /* Custom: */
128 extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
130 /*****************************************************************************
131 * IDirectMusicLoaderResourceStream implementation structure
133 struct IDirectMusicLoaderResourceStream {
134 /* IUnknown fields */
135 const IStreamVtbl *StreamVtbl;
136 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
137 /* reference counter */
138 LONG dwRef;
139 /* data */
140 LPBYTE pbMemData;
141 LONGLONG llMemLength;
142 /* current position */
143 LONGLONG llPos;
144 /* loader */
145 LPDIRECTMUSICLOADER8 pLoader;
148 /* Custom: */
149 extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
151 /*****************************************************************************
152 * IDirectMusicLoaderGenericStream implementation structure
154 struct IDirectMusicLoaderGenericStream {
155 /* IUnknown fields */
156 const IStreamVtbl *StreamVtbl;
157 const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
158 /* reference counter */
159 LONG dwRef;
160 /* stream */
161 LPSTREAM pStream;
162 /* loader */
163 LPDIRECTMUSICLOADER8 pLoader;
166 /* Custom: */
167 extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
169 /*****************************************************************************
170 * Misc.
172 /* for simpler reading */
173 typedef struct _WINE_CHUNK {
174 FOURCC fccID; /* FOURCC ID of the chunk */
175 DWORD dwSize; /* size of the chunk */
176 } WINE_CHUNK, *LPWINE_CHUNK;
178 #include "debug.h"
180 #endif /* __WINE_DMLOADER_PRIVATE_H */