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