Subversion Repositories Games.Chess Giants

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
/***************************************************************************
2
 *
3
 *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
4
 *
5
 *  File:       dxfile.h
6
 *
7
 *  Content:    DirectX File public header file
8
 *
9
 ***************************************************************************/
10
 
11
#ifndef __DXFILE_H__
12
#define __DXFILE_H__
13
 
14
#ifdef __cplusplus
15
extern "C" {
16
#endif
17
 
18
typedef DWORD DXFILEFORMAT;
19
 
20
#define DXFILEFORMAT_BINARY     0
21
#define DXFILEFORMAT_TEXT       1
22
#define DXFILEFORMAT_COMPRESSED 2
23
 
24
typedef DWORD DXFILELOADOPTIONS;
25
 
26
#define DXFILELOAD_FROMFILE  0x00L
27
#define DXFILELOAD_FROMRESOURCE 0x01L
28
#define DXFILELOAD_FROMMEMORY 0x02L
29
#define DXFILELOAD_FROMSTREAM 0x04L
30
#define DXFILELOAD_FROMURL 0x08L
31
 
32
typedef struct _DXFILELOADRESOURCE {
33
    HMODULE hModule;
34
    LPCTSTR lpName;
35
    LPCTSTR lpType;
36
}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE;
37
 
38
typedef struct _DXFILELOADMEMORY {
39
    LPVOID lpMemory;
40
    DWORD dSize;
41
}DXFILELOADMEMORY, *LPDXFILELOADMEMORY;
42
 
43
/*
44
 * DirectX File object types.
45
 */
46
 
47
#ifndef WIN_TYPES
48
#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype
49
#endif
50
 
51
WIN_TYPES(IDirectXFile,                 DIRECTXFILE);
52
WIN_TYPES(IDirectXFileEnumObject,       DIRECTXFILEENUMOBJECT);
53
WIN_TYPES(IDirectXFileSaveObject,       DIRECTXFILESAVEOBJECT);
54
WIN_TYPES(IDirectXFileObject,           DIRECTXFILEOBJECT);
55
WIN_TYPES(IDirectXFileData,             DIRECTXFILEDATA);
56
WIN_TYPES(IDirectXFileDataReference,    DIRECTXFILEDATAREFERENCE);
57
WIN_TYPES(IDirectXFileBinary,           DIRECTXFILEBINARY);
58
 
59
/*
60
 * API for creating IDirectXFile interface.
61
 */
62
 
63
STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile);
64
 
65
/*
66
 * The methods for IUnknown
67
 */
68
 
69
#define IUNKNOWN_METHODS(kind) \
70
    STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID *ppvObj) kind; \
71
    STDMETHOD_(ULONG, AddRef)       (THIS) kind; \
72
    STDMETHOD_(ULONG, Release)      (THIS) kind
73
 
74
/*
75
 * The methods for IDirectXFileObject
76
 */
77
 
78
#define IDIRECTXFILEOBJECT_METHODS(kind) \
79
    STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \
80
    STDMETHOD(GetId) (THIS_ LPGUID) kind
81
 
82
/*
83
 * DirectX File interfaces.
84
 */
85
 
86
#undef INTERFACE
87
#define INTERFACE IDirectXFile
88
 
89
DECLARE_INTERFACE_(IDirectXFile, IUnknown)
90
{
91
    IUNKNOWN_METHODS(PURE);
92
    STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS,
93
                                 LPDIRECTXFILEENUMOBJECT *) PURE;
94
    STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT,
95
                                 LPDIRECTXFILESAVEOBJECT *) PURE;
96
    STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE;
97
};
98
 
99
#undef INTERFACE
100
#define INTERFACE IDirectXFileEnumObject
101
 
102
DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown)
103
{
104
    IUNKNOWN_METHODS(PURE);
105
    STDMETHOD(GetNextDataObject)    (THIS_ LPDIRECTXFILEDATA *) PURE;
106
    STDMETHOD(GetDataObjectById)    (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE;
107
    STDMETHOD(GetDataObjectByName)  (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE;
108
};
109
 
110
#undef INTERFACE
111
#define INTERFACE IDirectXFileSaveObject
112
 
113
DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown)
114
{
115
    IUNKNOWN_METHODS(PURE);
116
    STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE;
117
    STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *,
118
                                 DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE;
119
    STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE;
120
};
121
 
122
 
123
#undef INTERFACE
124
#define INTERFACE IDirectXFileObject
125
 
126
DECLARE_INTERFACE_(IDirectXFileObject, IUnknown)
127
{
128
    IUNKNOWN_METHODS(PURE);
129
    IDIRECTXFILEOBJECT_METHODS(PURE);
130
};
131
 
132
#undef INTERFACE
133
#define INTERFACE IDirectXFileData
134
 
135
DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject)
136
{
137
    IUNKNOWN_METHODS(PURE);
138
    IDIRECTXFILEOBJECT_METHODS(PURE);
139
 
140
    STDMETHOD(GetData)          (THIS_ LPCSTR, DWORD *, void **) PURE;
141
    STDMETHOD(GetType)          (THIS_ const GUID **) PURE;
142
    STDMETHOD(GetNextObject)    (THIS_ LPDIRECTXFILEOBJECT *) PURE;
143
    STDMETHOD(AddDataObject)    (THIS_ LPDIRECTXFILEDATA) PURE;
144
    STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE;
145
    STDMETHOD(AddBinaryObject)  (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE;
146
};
147
 
148
#undef INTERFACE
149
#define INTERFACE IDirectXFileDataReference
150
 
151
DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject)
152
{
153
    IUNKNOWN_METHODS(PURE);
154
    IDIRECTXFILEOBJECT_METHODS(PURE);
155
 
156
    STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE;
157
};
158
 
159
#undef INTERFACE
160
#define INTERFACE IDirectXFileBinary
161
 
162
DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject)
163
{
164
    IUNKNOWN_METHODS(PURE);
165
    IDIRECTXFILEOBJECT_METHODS(PURE);
166
 
167
    STDMETHOD(GetSize)      (THIS_ DWORD *) PURE;
168
    STDMETHOD(GetMimeType)  (THIS_ LPCSTR *) PURE;
169
    STDMETHOD(Read)         (THIS_ LPVOID, DWORD, LPDWORD) PURE;
170
};
171
 
172
/*
173
 * DirectXFile Object Class Id (for CoCreateInstance())
174
 */
175
 
176
DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
177
 
178
/*
179
 * DirectX File Interface GUIDs.
180
 */
181
 
182
DEFINE_GUID(IID_IDirectXFile,               0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
183
DEFINE_GUID(IID_IDirectXFileEnumObject,     0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
184
DEFINE_GUID(IID_IDirectXFileSaveObject,     0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
185
DEFINE_GUID(IID_IDirectXFileObject,         0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
186
DEFINE_GUID(IID_IDirectXFileData,           0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
187
DEFINE_GUID(IID_IDirectXFileDataReference,  0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
188
DEFINE_GUID(IID_IDirectXFileBinary,         0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
189
 
190
/*
191
 * DirectX File Header template's GUID.
192
 */
193
 
194
DEFINE_GUID(TID_DXFILEHeader,   0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
195
 
196
 
197
/*
198
 * DirectX File errors.
199
 */
200
 
201
#define _FACDD  0x876
202
#define MAKE_DDHRESULT( code )  MAKE_HRESULT( 1, _FACDD, code )
203
 
204
#define DXFILE_OK   0
205
 
206
#define DXFILEERR_BADOBJECT                 MAKE_DDHRESULT(850)
207
#define DXFILEERR_BADVALUE                  MAKE_DDHRESULT(851)
208
#define DXFILEERR_BADTYPE                   MAKE_DDHRESULT(852)
209
#define DXFILEERR_BADSTREAMHANDLE           MAKE_DDHRESULT(853)
210
#define DXFILEERR_BADALLOC                  MAKE_DDHRESULT(854)
211
#define DXFILEERR_NOTFOUND                  MAKE_DDHRESULT(855)
212
#define DXFILEERR_NOTDONEYET                MAKE_DDHRESULT(856)
213
#define DXFILEERR_FILENOTFOUND              MAKE_DDHRESULT(857)
214
#define DXFILEERR_RESOURCENOTFOUND          MAKE_DDHRESULT(858)
215
#define DXFILEERR_URLNOTFOUND               MAKE_DDHRESULT(859)
216
#define DXFILEERR_BADRESOURCE               MAKE_DDHRESULT(860)
217
#define DXFILEERR_BADFILETYPE               MAKE_DDHRESULT(861)
218
#define DXFILEERR_BADFILEVERSION            MAKE_DDHRESULT(862)
219
#define DXFILEERR_BADFILEFLOATSIZE          MAKE_DDHRESULT(863)
220
#define DXFILEERR_BADFILECOMPRESSIONTYPE    MAKE_DDHRESULT(864)
221
#define DXFILEERR_BADFILE                   MAKE_DDHRESULT(865)
222
#define DXFILEERR_PARSEERROR                MAKE_DDHRESULT(866)
223
#define DXFILEERR_NOTEMPLATE                MAKE_DDHRESULT(867)
224
#define DXFILEERR_BADARRAYSIZE              MAKE_DDHRESULT(868)
225
#define DXFILEERR_BADDATAREFERENCE          MAKE_DDHRESULT(869)
226
#define DXFILEERR_INTERNALERROR             MAKE_DDHRESULT(870)
227
#define DXFILEERR_NOMOREOBJECTS             MAKE_DDHRESULT(871)
228
#define DXFILEERR_BADINTRINSICS             MAKE_DDHRESULT(872)
229
#define DXFILEERR_NOMORESTREAMHANDLES       MAKE_DDHRESULT(873)
230
#define DXFILEERR_NOMOREDATA                MAKE_DDHRESULT(874)
231
#define DXFILEERR_BADCACHEFILE              MAKE_DDHRESULT(875)
232
#define DXFILEERR_NOINTERNET                MAKE_DDHRESULT(876)
233
 
234
 
235
#ifdef __cplusplus
236
};
237
#endif
238
 
239
#endif /* _DXFILE_H_ */
240