dxfile.h 7.7 KB

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