xref: /reactos/sdk/include/dxsdk/dxfile.h (revision c2c66aff)
1 /*
2  * Copyright 2004 Christian Costa
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef __WINE_DXFILE_H
20 #define __WINE_DXFILE_H
21 
22 #include <objbase.h>
23 #include <winnt.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* defined(__cplusplus) */
28 
29 typedef DWORD DXFILEFORMAT;
30 
31 #define DXFILEFORMAT_BINARY     0
32 #define DXFILEFORMAT_TEXT       1
33 #define DXFILEFORMAT_COMPRESSED 2
34 
35 typedef DWORD DXFILELOADOPTIONS;
36 
37 #define DXFILELOAD_FROMFILE     0x00L
38 #define DXFILELOAD_FROMRESOURCE 0x01L
39 #define DXFILELOAD_FROMMEMORY   0x02L
40 #define DXFILELOAD_FROMSTREAM   0x04L
41 #define DXFILELOAD_FROMURL      0x08L
42 
43 typedef struct _DXFILELOADRESOURCE {
44     HMODULE hModule;
45     LPCSTR /*LPCTSTR*/ lpName;
46     LPCSTR /*LPCTSTR*/ lpType;
47 } DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE;
48 
49 typedef struct _DXFILELOADMEMORY {
50     LPVOID lpMemory;
51     DWORD dSize;
52 } DXFILELOADMEMORY, *LPDXFILELOADMEMORY;
53 
54 typedef struct IDirectXFile *LPDIRECTXFILE;
55 typedef struct IDirectXFileEnumObject *LPDIRECTXFILEENUMOBJECT;
56 typedef struct IDirectXFileSaveObject *LPDIRECTXFILESAVEOBJECT;
57 typedef struct IDirectXFileObject *LPDIRECTXFILEOBJECT;
58 typedef struct IDirectXFileData *LPDIRECTXFILEDATA;
59 typedef struct IDirectXFileDataReference *LPDIRECTXFILEDATAREFERENCE;
60 typedef struct IDirectXFileBinary *LPDIRECTXFILEBINARY;
61 
62 STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile);
63 
64 #define INTERFACE IDirectXFile
DECLARE_INTERFACE_(IDirectXFile,IUnknown)65 DECLARE_INTERFACE_(IDirectXFile,IUnknown)
66 {
67     /*** IUnknown methods ***/
68     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
69     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
70     STDMETHOD_(ULONG,Release)(THIS) PURE;
71     /*** IDirectXFile methods ***/
72     STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, LPDIRECTXFILEENUMOBJECT *) PURE;
73     STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, LPDIRECTXFILESAVEOBJECT *) PURE;
74     STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE;
75 };
76 #undef INTERFACE
77 
78 #if !defined(__cplusplus) || defined(CINTERFACE)
79     /*** IUnknown methods ***/
80 #define IDirectXFile_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
81 #define IDirectXFile_AddRef(p)             (p)->lpVtbl->AddRef(p)
82 #define IDirectXFile_Release(p)            (p)->lpVtbl->Release(p)
83     /*** IDirectXFile methods ***/
84 #define IDirectXFile_CreateEnumObject(p,a,b,c) (p)->lpVtbl->CreateEnumObject(p,a,b,c)
85 #define IDirectXFile_CreateSaveObject(p,a,b,c) (p)->lpVtbl->CreateSaveObject(p,a,b,c)
86 #define IDirectXFile_RegisterTemplates(p,a,b)  (p)->lpVtbl->RegisterTemplates(p,a,b)
87 #endif
88 
89 #define INTERFACE IDirectXFileEnumObject
DECLARE_INTERFACE_(IDirectXFileEnumObject,IUnknown)90 DECLARE_INTERFACE_(IDirectXFileEnumObject,IUnknown)
91 {
92     /*** IUnknown methods ***/
93     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
94     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
95     STDMETHOD_(ULONG,Release)(THIS) PURE;
96     /*** IDirectXFileEnumObject methods ***/
97     STDMETHOD(GetNextDataObject)    (THIS_ LPDIRECTXFILEDATA *) PURE;
98     STDMETHOD(GetDataObjectById)    (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE;
99     STDMETHOD(GetDataObjectByName)  (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE;
100 };
101 #undef INTERFACE
102 
103 #if !defined(__cplusplus) || defined(CINTERFACE)
104     /*** IUnknown methods ***/
105 #define IDirectXFileEnumObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
106 #define IDirectXFileEnumObject_AddRef(p)             (p)->lpVtbl->AddRef(p)
107 #define IDirectXFileEnumObject_Release(p)            (p)->lpVtbl->Release(p)
108     /*** IDirectXFileEnumObject methods ***/
109 #define IDirectXFileEnumObject_GetNextDataObject(p,a)     (p)->lpVtbl->GetNextDataObject(p,a)
110 #define IDirectXFileEnumObject_GetDataObjectById(p,a,b)   (p)->lpVtbl->GetDataObjectById(p,a,b)
111 #define IDirectXFileEnumObject_GetDataObjectByName(p,a,b) (p)->lpVtbl->GetDataObjectByName(p,a,b)
112 #endif
113 
114 #define INTERFACE IDirectXFileSaveObject
DECLARE_INTERFACE_(IDirectXFileSaveObject,IUnknown)115 DECLARE_INTERFACE_(IDirectXFileSaveObject,IUnknown)
116 {
117     /*** IUnknown methods ***/
118     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
119     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
120     STDMETHOD_(ULONG,Release)(THIS) PURE;
121     /*** IDirectXFileSaveObject methods ***/
122     STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE;
123     STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE;
124     STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE;
125 };
126 #undef INTERFACE
127 
128 #if !defined(__cplusplus) || defined(CINTERFACE)
129     /*** IUnknown methods ***/
130 #define IDirectXFileSaveObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
131 #define IDirectXFileSaveObject_AddRef(p)             (p)->lpVtbl->AddRef(p)
132 #define IDirectXFileSaveObject_Release(p)            (p)->lpVtbl->Release(p)
133     /*** IDirectXFileSaveObject methods ***/
134 #define IDirectXFileSaveObject_SaveTemplates(p,a,b)            (p)->lpVtbl->SaveTemplates(p,a,b)
135 #define IDirectXFileSaveObject_CreateDataObject(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDataObject(p,a,b,c,d,e,f)
136 #define IDirectXFileSaveObject_SaveData(p,a)                   (p)->lpVtbl->SaveData(p,a)
137 #endif
138 
139 #define IUNKNOWN_METHODS(kind) \
140     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) kind; \
141     STDMETHOD_(ULONG,AddRef)(THIS) kind; \
142     STDMETHOD_(ULONG,Release)(THIS) kind
143 
144 #define IDIRECTXFILEOBJECT_METHODS(kind) \
145     STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \
146     STDMETHOD(GetId) (THIS_ LPGUID) kind
147 
148 #define INTERFACE IDirectXFileObject
DECLARE_INTERFACE_(IDirectXFileObject,IUnknown)149 DECLARE_INTERFACE_(IDirectXFileObject,IUnknown)
150 {
151     IUNKNOWN_METHODS(PURE);
152     IDIRECTXFILEOBJECT_METHODS(PURE);
153 };
154 #undef INTERFACE
155 
156 #if !defined(__cplusplus) || defined(CINTERFACE)
157     /*** IUnknown methods ***/
158 #define IDirectXFileObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
159 #define IDirectXFileObject_AddRef(p)             (p)->lpVtbl->AddRef(p)
160 #define IDirectXFileObject_Release(p)            (p)->lpVtbl->Release(p)
161     /*** IDirectXFileObject methods ***/
162 #define IDirectXFileObject_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
163 #define IDirectXFileObject_GetId(p,a)     (p)->lpVtbl->GetId(p,a)
164 #endif
165 
166 #define INTERFACE IDirectXFileData
DECLARE_INTERFACE_(IDirectXFileData,IDirectXFileObject)167 DECLARE_INTERFACE_(IDirectXFileData,IDirectXFileObject)
168 {
169     IUNKNOWN_METHODS(PURE);
170     IDIRECTXFILEOBJECT_METHODS(PURE);
171     /*** IDirectXFileData methods ***/
172     STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE;
173     STDMETHOD(GetType) (THIS_ const GUID **) PURE;
174     STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE;
175     STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE;
176     STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE;
177     STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE;
178 };
179 #undef INTERFACE
180 
181 #if !defined(__cplusplus) || defined(CINTERFACE)
182     /*** IUnknown methods ***/
183 #define IDirectXFileData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
184 #define IDirectXFileData_AddRef(p)             (p)->lpVtbl->AddRef(p)
185 #define IDirectXFileData_Release(p)            (p)->lpVtbl->Release(p)
186     /*** IDirectXFileObject methods ***/
187 #define IDirectXFileData_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
188 #define IDirectXFileData_GetId(p,a)     (p)->lpVtbl->GetId(p,a)
189     /*** IDirectXFileData methods ***/
190 #define IDirectXFileData_GetData(p,a,b,c)             (p)->lpVtbl->GetData(p,a,b,c)
191 #define IDirectXFileData_GetType(p,a)                 (p)->lpVtbl->GetType(p,a)
192 #define IDirectXFileData_GetNextObject(p,a)           (p)->lpVtbl->GetNextObject(p,a)
193 #define IDirectXFileData_AddDataObject(p,a)           (p)->lpVtbl->AddDataObject(p,a)
194 #define IDirectXFileData_AddDataReference(p,a,b)      (p)->lpVtbl->AddDataReference(p,a,b)
195 #define IDirectXFileData_AddBinaryObject(p,a,b,c,d,e) (p)->lpVtbl->AddBinaryObject(p,a,b,c,d,e)
196 #endif
197 
198 #define INTERFACE IDirectXFileDataReference
DECLARE_INTERFACE_(IDirectXFileDataReference,IDirectXFileObject)199 DECLARE_INTERFACE_(IDirectXFileDataReference,IDirectXFileObject)
200 {
201     IUNKNOWN_METHODS(PURE);
202     IDIRECTXFILEOBJECT_METHODS(PURE);
203     /*** IDirectXFileDataReference methods ***/
204     STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE;
205 };
206 #undef INTERFACE
207 
208 #if !defined(__cplusplus) || defined(CINTERFACE)
209     /*** IUnknown methods ***/
210 #define IDirectXFileDataReference_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
211 #define IDirectXFileDataReference_AddRef(p)             (p)->lpVtbl->AddRef(p)
212 #define IDirectXFileDataReference_Release(p)            (p)->lpVtbl->Release(p)
213     /*** IDirectXFileObject methods ***/
214 #define IDirectXFileDataReference_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
215 #define IDirectXFileDataReference_GetId(p,a)     (p)->lpVtbl->GetId(p,a)
216     /*** IDirectXFileDataReference methods ***/
217 #define IDirectXFileDataReference_Resolve(p,a) (p)->lpVtbl->Resolve(p,a)
218 #endif
219 
220 #define INTERFACE IDirectXFileBinary
DECLARE_INTERFACE_(IDirectXFileBinary,IDirectXFileObject)221 DECLARE_INTERFACE_(IDirectXFileBinary,IDirectXFileObject)
222 {
223     IUNKNOWN_METHODS(PURE);
224     IDIRECTXFILEOBJECT_METHODS(PURE);
225     /*** IDirectXFileBinary methods ***/
226     STDMETHOD(GetSize)      (THIS_ DWORD *) PURE;
227     STDMETHOD(GetMimeType)  (THIS_ LPCSTR *) PURE;
228     STDMETHOD(Read)         (THIS_ LPVOID, DWORD, LPDWORD) PURE;
229 };
230 #undef INTERFACE
231 
232 #if !defined(__cplusplus) || defined(CINTERFACE)
233     /*** IUnknown methods ***/
234 #define IDirectXFileBinary_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
235 #define IDirectXFileBinary_AddRef(p)             (p)->lpVtbl->AddRef(p)
236 #define IDirectXFileBinary_Release(p)            (p)->lpVtbl->Release(p)
237     /*** IDirectXFileObject methods ***/
238 #define IDirectXFileBinary_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
239 #define IDirectXFileBinary_GetId(p,a)     (p)->lpVtbl->GetId(p,a)
240     /*** IDirectXFileBinary methods ***/
241 #define IDirectXFileBinary_GetSize(p,a)     (p)->lpVtbl->GetSize(p,a)
242 #define IDirectXFileBinary_GetMimeType(p,a) (p)->lpVtbl->GetMimeType(p,a)
243 #define IDirectXFileBinary_Read(p,a,b,c)    (p)->lpVtbl->Read(p,a,b,c)
244 #endif
245 
246 /* DirectXFile Object CLSID */
247 DEFINE_GUID(CLSID_CDirectXFile,             0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
248 
249 /* DirectX File Interface GUIDs */
250 DEFINE_GUID(IID_IDirectXFile,               0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
251 DEFINE_GUID(IID_IDirectXFileEnumObject,     0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
252 DEFINE_GUID(IID_IDirectXFileSaveObject,     0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
253 DEFINE_GUID(IID_IDirectXFileObject,         0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
254 DEFINE_GUID(IID_IDirectXFileData,           0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
255 DEFINE_GUID(IID_IDirectXFileDataReference,  0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
256 DEFINE_GUID(IID_IDirectXFileBinary,         0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
257 
258 /* DirectX File Header template's GUID */
259 DEFINE_GUID(TID_DXFILEHeader,               0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
260 
261 /* DirectX File errors */
262 #define _FACDD  0x876
263 
264 #ifndef MAKE_DDHRESULT
265 #define MAKE_DDHRESULT( code )  MAKE_HRESULT( 1, _FACDD, code )
266 #endif
267 
268 #define DXFILE_OK   0
269 
270 #define DXFILEERR_BADOBJECT                 MAKE_DDHRESULT(850)
271 #define DXFILEERR_BADVALUE                  MAKE_DDHRESULT(851)
272 #define DXFILEERR_BADTYPE                   MAKE_DDHRESULT(852)
273 #define DXFILEERR_BADSTREAMHANDLE           MAKE_DDHRESULT(853)
274 #define DXFILEERR_BADALLOC                  MAKE_DDHRESULT(854)
275 #define DXFILEERR_NOTFOUND                  MAKE_DDHRESULT(855)
276 #define DXFILEERR_NOTDONEYET                MAKE_DDHRESULT(856)
277 #define DXFILEERR_FILENOTFOUND              MAKE_DDHRESULT(857)
278 #define DXFILEERR_RESOURCENOTFOUND          MAKE_DDHRESULT(858)
279 #define DXFILEERR_URLNOTFOUND               MAKE_DDHRESULT(859)
280 #define DXFILEERR_BADRESOURCE               MAKE_DDHRESULT(860)
281 #define DXFILEERR_BADFILETYPE               MAKE_DDHRESULT(861)
282 #define DXFILEERR_BADFILEVERSION            MAKE_DDHRESULT(862)
283 #define DXFILEERR_BADFILEFLOATSIZE          MAKE_DDHRESULT(863)
284 #define DXFILEERR_BADFILECOMPRESSIONTYPE    MAKE_DDHRESULT(864)
285 #define DXFILEERR_BADFILE                   MAKE_DDHRESULT(865)
286 #define DXFILEERR_PARSEERROR                MAKE_DDHRESULT(866)
287 #define DXFILEERR_NOTEMPLATE                MAKE_DDHRESULT(867)
288 #define DXFILEERR_BADARRAYSIZE              MAKE_DDHRESULT(868)
289 #define DXFILEERR_BADDATAREFERENCE          MAKE_DDHRESULT(869)
290 #define DXFILEERR_INTERNALERROR             MAKE_DDHRESULT(870)
291 #define DXFILEERR_NOMOREOBJECTS             MAKE_DDHRESULT(871)
292 #define DXFILEERR_BADINTRINSICS             MAKE_DDHRESULT(872)
293 #define DXFILEERR_NOMORESTREAMHANDLES       MAKE_DDHRESULT(873)
294 #define DXFILEERR_NOMOREDATA                MAKE_DDHRESULT(874)
295 #define DXFILEERR_BADCACHEFILE              MAKE_DDHRESULT(875)
296 #define DXFILEERR_NOINTERNET                MAKE_DDHRESULT(876)
297 
298 #ifdef __cplusplus
299 } /* extern "C" */
300 #endif /* defined(__cplusplus) */
301 
302 #endif /* __WINE_DXFILE_H */
303