Release 980601
[wine.git] / include / storage.h
blobc25baf47c6b47967508ec249904850830e6a8f06
1 #ifndef _WINE_STORAGE_H
2 #define _WINE_STORAGE_H
4 /* Does this look like a cellar to you? */
6 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
7 #define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
8 #define PURE
9 #define FAR
10 #define THIS_ THIS,
12 struct storage_header {
13 BYTE magic[8]; /* 00: magic */
14 BYTE unknown1[36]; /* 08: unknown */
15 DWORD num_of_bbd_blocks;/* 2C: length of big datablocks */
16 DWORD root_startblock;/* 30: root storage first big block */
17 DWORD unknown2[2]; /* 34: unknown */
18 DWORD sbd_startblock; /* 3C: small block depot first big block */
19 DWORD unknown3[3]; /* 40: unknown */
20 DWORD bbd_list[109]; /* 4C: big data block list (up to end of sector)*/
22 struct storage_pps_entry {
23 WCHAR pps_rawname[32];/* 00: \0 terminated widechar name */
24 WORD pps_sizeofname; /* 40: namelength in bytes */
25 BYTE pps_type; /* 42: flags, 1 storage/dir, 2 stream, 5 root */
26 BYTE pps_unknown0; /* 43: unknown */
27 DWORD pps_prev; /* 44: previous pps */
28 DWORD pps_next; /* 48: next pps */
29 DWORD pps_dir; /* 4C: directory pps */
30 GUID pps_guid; /* 50: class ID */
31 DWORD pps_unknown1; /* 60: unknown */
32 FILETIME pps_ft1; /* 64: filetime1 */
33 FILETIME pps_ft2; /* 70: filetime2 */
34 DWORD pps_sb; /* 74: data startblock */
35 DWORD pps_size; /* 78: datalength. (<0x1000)?small:big blocks*/
36 DWORD pps_unknown2; /* 7C: unknown */
39 #define STORAGE_CHAINENTRY_FAT 0xfffffffd
40 #define STORAGE_CHAINENTRY_ENDOFCHAIN 0xfffffffe
41 #define STORAGE_CHAINENTRY_FREE 0xffffffff
43 typedef LPOLESTR16 *SNB16;
44 typedef LPOLESTR32 *SNB32;
45 DECL_WINELIB_TYPE(SNB)
47 typedef struct IStorage16 IStorage16,*LPSTORAGE16;
48 typedef struct IStorage32 IStorage32,*LPSTORAGE32;
49 typedef struct IStream16 IStream16,*LPSTREAM16;
50 typedef struct IStream32 IStream32,*LPSTREAM32;
52 typedef struct IEnumSTATSTG IEnumSTATSTG,*LPENUMSTATSTG;
54 typedef struct {
55 LPOLESTR16 pwcsName;
56 DWORD type;
57 ULARGE_INTEGER cbSize;
58 FILETIME mtime;
59 FILETIME ctime;
60 FILETIME atime;
61 DWORD grfMode;
62 DWORD grfLocksSupported;
63 CLSID clsid;
64 DWORD grfStateBits;
65 DWORD reserved;
66 } STATSTG;
68 #define STGM_DIRECT 0x00000000
69 #define STGM_TRANSACTED 0x00010000
70 #define STGM_SIMPLE 0x08000000
71 #define STGM_READ 0x00000000
72 #define STGM_WRITE 0x00000001
73 #define STGM_READWRITE 0x00000002
74 #define STGM_SHARE_DENY_NONE 0x00000040
75 #define STGM_SHARE_DENY_READ 0x00000030
76 #define STGM_SHARE_DENY_WRITE 0x00000020
77 #define STGM_SHARE_EXCLUSIVE 0x00000010
78 #define STGM_PRIORITY 0x00040000
79 #define STGM_DELETEONRELEASE 0x04000000
80 #define STGM_NOSCRATCH 0x00100000
81 #define STGM_CREATE 0x00001000
82 #define STGM_CONVERT 0x00020000
83 #define STGM_FAILIFTHERE 0x00000000
85 #define THIS LPSTORAGE16 this
86 typedef struct IStorage16_VTable {
87 /* IUnknown methods */
88 STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj);
89 STDMETHOD_(ULONG,AddRef) (THIS);
90 STDMETHOD_(ULONG,Release) (THIS);
91 /* IStorage methods */
92 STDMETHOD(CreateStream)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream16 **ppstm);
93 STDMETHOD(OpenStream)(THIS_ LPCOLESTR16 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream16 **ppstm);
94 STDMETHOD(CreateStorage)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage16 **ppstg);
95 STDMETHOD(OpenStorage)(THIS_ LPCOLESTR16 pwcsName,IStorage16 *pstgPriority, DWORD grfMode, SNB16 SNB16Exclude, DWORD reserved, IStorage16 **ppstg);
96 STDMETHOD(CopyTo)(THIS_ DWORD ciidExclude, const IID *rgiidExclude, SNB16 SNB16Exclude, IStorage16 *pstgDest);
97 STDMETHOD(MoveElementTo)(THIS_ LPCOLESTR16 pwcsName, IStorage16 *pstgDest, LPCOLESTR16 pwcsNewName, DWORD grfFlags);
98 STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
99 STDMETHOD(Revert)(THIS);
100 STDMETHOD(EnumElements)(THIS_ DWORD reserved1,void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum);
101 STDMETHOD(DestroyElement)(THIS_ LPCOLESTR16 pwcsName);
102 STDMETHOD(RenameElement)(THIS_ LPCOLESTR16 pwcsOldName, LPCOLESTR16 pwcsNewName);
103 STDMETHOD(SetElementTimes)(THIS_ LPCOLESTR16 pwcsName, const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime);
104 STDMETHOD(SetClass)(THIS_ REFCLSID clsid);
105 STDMETHOD(SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask);
106 STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag);
107 } IStorage16_VTable,*LPSTORAGE16_VTABLE;
109 struct IStorage16 {
110 LPSTORAGE16_VTABLE lpvtbl;
111 DWORD ref;
112 SEGPTR thisptr; /* pointer to this struct as segmented */
113 struct storage_pps_entry stde;
114 int ppsent;
115 HFILE32 hf;
117 #undef THIS
118 #define THIS LPSTORAGE32 this
119 typedef struct IStorage32_VTable {
120 /* IUnknown methods */
121 STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj);
122 STDMETHOD_(ULONG,AddRef) (THIS);
123 STDMETHOD_(ULONG,Release) (THIS);
124 /* IStorage methods */
125 STDMETHOD(CreateStream)(THIS_ LPCOLESTR32 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream32 **ppstm);
126 STDMETHOD(OpenStream)(THIS_ LPCOLESTR32 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream32 **ppstm);
127 STDMETHOD(CreateStorage)(THIS_ LPCOLESTR32 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage32 **ppstg);
128 STDMETHOD(OpenStorage)(THIS_ LPCOLESTR32 pwcsName,IStorage32 *pstgPriority, DWORD grfMode, SNB32 SNB16Exclude, DWORD reserved, IStorage32 **ppstg);
129 STDMETHOD(CopyTo)(THIS_ DWORD ciidExclude, const IID *rgiidExclude, SNB32 SNB16Exclude, IStorage32 *pstgDest);
130 STDMETHOD(MoveElementTo)(THIS_ LPCOLESTR32 pwcsName, IStorage32 *pstgDest, LPCOLESTR32 pwcsNewName, DWORD grfFlags);
131 STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
132 STDMETHOD(Revert)(THIS);
133 STDMETHOD(EnumElements)(THIS_ DWORD reserved1,void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum);
134 STDMETHOD(DestroyElement)(THIS_ LPCOLESTR32 pwcsName);
135 STDMETHOD(RenameElement)(THIS_ LPCOLESTR32 pwcsOldName, LPCOLESTR32 pwcsNewName);
136 STDMETHOD(SetElementTimes)(THIS_ LPCOLESTR32 pwcsName, const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime);
137 STDMETHOD(SetClass)(THIS_ REFCLSID clsid);
138 STDMETHOD(SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask);
139 STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag);
140 } IStorage32_VTable,*LPSTORAGE32_VTABLE;
142 struct IStorage32 {
143 LPSTORAGE32_VTABLE lpvtbl;
144 DWORD ref;
145 struct storage_pps_entry stde;
146 int ppsent;
147 HFILE32 hf;
149 #undef THIS
151 #define THIS LPSTREAM16 this
152 typedef struct IStream16_VTable {
153 STDMETHOD(QueryInterface)(THIS_ REFIID riid, void * *ppvObject);
154 STDMETHOD_(ULONG,AddRef)(THIS);
155 STDMETHOD_(ULONG,Release)(THIS);
156 STDMETHOD(Read)(THIS_ void *pv, ULONG cb, ULONG *pcbRead);
157 STDMETHOD(Write)(THIS_ const void *pv,ULONG cb,ULONG *pcbWritten);
158 STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove,DWORD dwOrigin,ULARGE_INTEGER *plibNewPosition);
159 STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize);
160 STDMETHOD(CopyTo)(THIS_ IStream16 *pstm,ULARGE_INTEGER cb,ULARGE_INTEGER *pcbRead,ULARGE_INTEGER *pcbWritten);
161 STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
162 STDMETHOD(Revert)(THIS);
163 STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,DWORD dwLockType);
164 STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
165 STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag);
166 STDMETHOD(Clone)(THIS_ IStream16 **ppstm);
167 } IStream16_VTable,*LPSTREAM16_VTABLE;
169 struct IStream16 {
170 LPSTREAM16_VTABLE lpvtbl;
171 DWORD ref;
172 SEGPTR thisptr; /* pointer to this struct as segmented */
173 struct storage_pps_entry stde;
174 int ppsent;
175 HFILE32 hf;
176 ULARGE_INTEGER offset;
178 #undef THIS
179 #define THIS LPSTREAM32 this
180 typedef struct IStream32_VTable {
181 STDMETHOD(QueryInterface)(THIS_ REFIID riid, void * *ppvObject);
182 STDMETHOD_(ULONG,AddRef)(THIS);
183 STDMETHOD_(ULONG,Release)(THIS);
184 STDMETHOD(Read)(THIS_ void *pv, ULONG cb, ULONG *pcbRead);
185 STDMETHOD(Write)(THIS_ const void *pv,ULONG cb,ULONG *pcbWritten);
186 STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove,DWORD dwOrigin,ULARGE_INTEGER *plibNewPosition);
187 STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize);
188 STDMETHOD(CopyTo)(THIS_ IStream32 *pstm,ULARGE_INTEGER cb,ULARGE_INTEGER *pcbRead,ULARGE_INTEGER *pcbWritten);
189 STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
190 STDMETHOD(Revert)(THIS);
191 STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,DWORD dwLockType);
192 STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
193 STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag);
194 STDMETHOD(Clone)(THIS_ IStream32 **ppstm);
195 } IStream32_VTable,*LPSTREAM32_VTABLE;
197 struct IStream32 {
198 LPSTREAM32_VTABLE lpvtbl;
199 DWORD ref;
200 struct storage_pps_entry stde;
201 int ppsent;
202 HFILE32 hf;
203 ULARGE_INTEGER offset;
205 #undef THIS
207 #undef STDMETHOD
208 #undef STDMETHOD_
209 #undef PURE
210 #undef FAR
211 #undef THIS_
212 #endif