Release 990226.
[wine/multimedia.git] / ole / storage32.h
bloba60ad370812b4b9dc082df89893726b830ca332a
1 /*
2 * Compound Storage (32 bit version)
4 * Implemented using the documentation of the LAOLA project at
5 * <URL:http://wwwwbs.cs.tu-berlin.de/~schwartz/pmh/index.html>
6 * (Thanks to Martin Schwartz <schwartz@cs.tu-berlin.de>)
8 * This include file contains definitions of types and function
9 * prototypes that are used in the many files implementing the
10 * storage functionality
12 * Copyright 1998,1999 Francis Beaudet
13 * Copyright 1998,1999 Thuy Nguyen
15 #ifndef __STORAGE32_H__
16 #define __STORAGE32_H__
19 * Definitions for the file format offsets.
21 static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
22 static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
23 static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
24 static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
25 static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
26 static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
27 static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048;
28 static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C;
29 static const ULONG OFFSET_PS_NAME = 0x00000000;
30 static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040;
31 static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042;
32 static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044;
33 static const ULONG OFFSET_PS_NEXTPROP = 0x00000048;
34 static const ULONG OFFSET_PS_DIRPROP = 0x0000004C;
35 static const ULONG OFFSET_PS_GUID = 0x00000050;
36 static const ULONG OFFSET_PS_TSS1 = 0x00000064;
37 static const ULONG OFFSET_PS_TSD1 = 0x00000068;
38 static const ULONG OFFSET_PS_TSS2 = 0x0000006C;
39 static const ULONG OFFSET_PS_TSD2 = 0x00000070;
40 static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
41 static const ULONG OFFSET_PS_SIZE = 0x00000078;
42 static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
43 static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
44 static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
45 static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
46 static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
47 static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
48 static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;
49 static const ULONG BLOCK_UNUSED = 0xFFFFFFFF;
50 static const ULONG PROPERTY_NULL = 0xFFFFFFFF;
52 #define PROPERTY_NAME_MAX_LEN 0x20
53 #define PROPERTY_NAME_BUFFER_LEN 0x40
55 #define PROPSET_BLOCK_SIZE 0x00000080
58 * Property type of relation
60 #define PROPERTY_RELATION_PREVIOUS 0
61 #define PROPERTY_RELATION_NEXT 1
62 #define PROPERTY_RELATION_DIR 2
65 * Property type constants
67 #define PROPTYPE_STORAGE 0x01
68 #define PROPTYPE_STREAM 0x02
69 #define PROPTYPE_ROOT 0x05
72 * These defines assume a hardcoded blocksize. The code will assert
73 * if the blocksize is different. Some changes will have to be done if it
74 * becomes the case.
76 #define BIG_BLOCK_SIZE 0x200
77 #define COUNT_BBDEPOTINHEADER 109
78 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
79 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128
82 * These are signatures to detect the type of Document file.
84 static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
85 static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
88 * Forward declarations of all the structures used by the storage
89 * module.
91 typedef struct StorageBaseImpl StorageBaseImpl;
92 typedef struct StorageImpl StorageImpl;
93 typedef struct StorageInternalImpl StorageInternalImpl;
94 typedef struct BlockChainStream BlockChainStream;
95 typedef struct SmallBlockChainStream SmallBlockChainStream;
96 typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
97 typedef struct StgProperty StgProperty;
98 typedef struct StgStreamImpl StgStreamImpl;
101 * This utility structure is used to read/write the information in a storage
102 * property.
104 struct StgProperty
106 WCHAR name[PROPERTY_NAME_MAX_LEN];
107 WORD sizeOfNameString;
108 BYTE propertyType;
109 ULONG previousProperty;
110 ULONG nextProperty;
111 ULONG dirProperty;
112 GUID propertyUniqueID;
113 ULONG timeStampS1;
114 ULONG timeStampD1;
115 ULONG timeStampS2;
116 ULONG timeStampD2;
117 ULONG startingBlock;
118 ULARGE_INTEGER size;
121 /*************************************************************************
122 * Big Block File support
124 * The big block file is an abstraction of a flat file separated in
125 * same sized blocks. The implementation for the methods described in
126 * this section appear in stg_bigblockfile.c
130 * Declaration of the data structures
132 typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
133 typedef struct MappedPage MappedPage,*LPMAPPEDPAGE;
134 typedef struct BigBlock BigBlock,*LPBIGBLOCK;
136 struct BigBlockFile
138 ULARGE_INTEGER filesize;
139 ULONG blocksize;
140 HANDLE hfile;
141 HANDLE hfilemap;
142 DWORD flProtect;
143 MappedPage *headmap_ro;
144 MappedPage *headmap_w;
145 BigBlock *headblock;
149 * Declaration of the functions used to manipulate the BigBlockFile
150 * data structure.
152 BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
153 DWORD openFlags,
154 ULONG blocksize);
155 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
156 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
157 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
158 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
159 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
160 ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
162 /****************************************************************************
163 * Storage32BaseImpl definitions.
165 * This stucture defines the base information contained in all implementations
166 * of IStorage32 contained in this filee storage implementation.
168 * In OOP terms, this is the base class for all the IStorage32 implementations
169 * contained in this file.
171 struct StorageBaseImpl
173 ICOM_VTABLE(IStorage)* lpvtbl; /* Needs to be the first item in the stuct
174 * since we want to cast this in a Storage32 pointer */
177 * Reference count of this object
179 ULONG ref;
182 * Ancestor storage (top level)
184 StorageImpl* ancestorStorage;
187 * Index of the property for the root of
188 * this storage
190 ULONG rootPropertySetIndex;
193 * virtual Destructor method.
195 void (*v_destructor)(StorageBaseImpl*);
200 * Prototypes for the methods of the Storage32BaseImpl class.
202 HRESULT WINAPI StorageBaseImpl_QueryInterface(
203 IStorage* iface,
204 REFIID riid,
205 void** ppvObject);
207 ULONG WINAPI StorageBaseImpl_AddRef(
208 IStorage* iface);
210 ULONG WINAPI StorageBaseImpl_Release(
211 IStorage* iface);
213 HRESULT WINAPI StorageBaseImpl_OpenStream(
214 IStorage* iface,
215 const OLECHAR* pwcsName, /* [string][in] */
216 void* reserved1, /* [unique][in] */
217 DWORD grfMode, /* [in] */
218 DWORD reserved2, /* [in] */
219 IStream** ppstm); /* [out] */
221 HRESULT WINAPI StorageBaseImpl_OpenStorage(
222 IStorage* iface,
223 const OLECHAR* pwcsName, /* [string][unique][in] */
224 IStorage* pstgPriority, /* [unique][in] */
225 DWORD grfMode, /* [in] */
226 SNB snbExclude, /* [unique][in] */
227 DWORD reserved, /* [in] */
228 IStorage** ppstg); /* [out] */
230 HRESULT WINAPI StorageBaseImpl_EnumElements(
231 IStorage* iface,
232 DWORD reserved1, /* [in] */
233 void* reserved2, /* [size_is][unique][in] */
234 DWORD reserved3, /* [in] */
235 IEnumSTATSTG** ppenum); /* [out] */
237 HRESULT WINAPI StorageBaseImpl_Stat(
238 IStorage* iface,
239 STATSTG* pstatstg, /* [out] */
240 DWORD grfStatFlag); /* [in] */
242 HRESULT WINAPI StorageBaseImpl_RenameElement(
243 IStorage* iface,
244 const OLECHAR* pwcsOldName, /* [string][in] */
245 const OLECHAR* pwcsNewName); /* [string][in] */
247 HRESULT WINAPI StorageBaseImpl_CreateStream(
248 IStorage* iface,
249 const OLECHAR* pwcsName, /* [string][in] */
250 DWORD grfMode, /* [in] */
251 DWORD reserved1, /* [in] */
252 DWORD reserved2, /* [in] */
253 IStream** ppstm); /* [out] */
255 HRESULT WINAPI StorageBaseImpl_SetClass(
256 IStorage* iface,
257 REFCLSID clsid); /* [in] */
259 /****************************************************************************
260 * Storage32Impl definitions.
262 * This implementation of the IStorage32 interface represents a root
263 * storage. Basically, a document file.
265 struct StorageImpl
267 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
268 * since we want to cast this in a Storage32 pointer */
271 * Declare the member of the Storage32BaseImpl class to allow
272 * casting as a Storage32BaseImpl
274 ULONG ref;
275 struct StorageImpl* ancestorStorage;
276 ULONG rootPropertySetIndex;
277 void (*v_destructor)(struct StorageImpl*);
280 * The following data members are specific to the Storage32Impl
281 * class
283 HANDLE hFile; /* Physical support for the Docfile */
286 * File header
288 WORD bigBlockSizeBits;
289 WORD smallBlockSizeBits;
290 ULONG bigBlockSize;
291 ULONG smallBlockSize;
292 ULONG bigBlockDepotCount;
293 ULONG rootStartBlock;
294 ULONG smallBlockDepotStart;
295 ULONG extBigBlockDepotStart;
296 ULONG extBigBlockDepotCount;
297 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
299 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
300 ULONG indexBlockDepotCached;
303 * Abstraction of the big block chains for the chains of the header.
305 BlockChainStream* rootBlockChain;
306 BlockChainStream* smallBlockDepotChain;
307 BlockChainStream* smallBlockRootChain;
310 * Pointer to the big block file abstraction
312 BigBlockFile* bigBlockFile;
316 * Method declaration for the Storage32Impl class
319 HRESULT WINAPI StorageImpl_CreateStorage(
320 IStorage* iface,
321 const OLECHAR* pwcsName, /* [string][in] */
322 DWORD grfMode, /* [in] */
323 DWORD dwStgFmt, /* [in] */
324 DWORD reserved2, /* [in] */
325 IStorage** ppstg); /* [out] */
327 HRESULT WINAPI StorageImpl_CopyTo(
328 IStorage* iface,
329 DWORD ciidExclude, /* [in] */
330 const IID* rgiidExclude, /* [size_is][unique][in] */
331 SNB snbExclude, /* [unique][in] */
332 IStorage* pstgDest); /* [unique][in] */
334 HRESULT WINAPI StorageImpl_MoveElementTo(
335 IStorage* iface,
336 const OLECHAR* pwcsName, /* [string][in] */
337 IStorage* pstgDest, /* [unique][in] */
338 const OLECHAR* pwcsNewName, /* [string][in] */
339 DWORD grfFlags); /* [in] */
341 HRESULT WINAPI StorageImpl_Commit(
342 IStorage* iface,
343 DWORD grfCommitFlags); /* [in] */
345 HRESULT WINAPI StorageImpl_Revert(
346 IStorage* iface);
348 HRESULT WINAPI StorageImpl_DestroyElement(
349 IStorage* iface,
350 const OLECHAR* pwcsName); /* [string][in] */
352 HRESULT WINAPI StorageImpl_SetElementTimes(
353 IStorage* iface,
354 const OLECHAR* pwcsName, /* [string][in] */
355 const FILETIME* pctime, /* [in] */
356 const FILETIME* patime, /* [in] */
357 const FILETIME* pmtime); /* [in] */
359 HRESULT WINAPI StorageImpl_SetStateBits(
360 IStorage* iface,
361 DWORD grfStateBits, /* [in] */
362 DWORD grfMask); /* [in] */
364 void StorageImpl_Destroy(
365 StorageImpl* This);
367 HRESULT StorageImpl_Construct(
368 StorageImpl* This,
369 HANDLE hFile,
370 DWORD openFlags);
372 BOOL StorageImpl_ReadBigBlock(
373 StorageImpl* This,
374 ULONG blockIndex,
375 void* buffer);
377 BOOL StorageImpl_WriteBigBlock(
378 StorageImpl* This,
379 ULONG blockIndex,
380 void* buffer);
382 void* StorageImpl_GetROBigBlock(
383 StorageImpl* This,
384 ULONG blockIndex);
386 void* StorageImpl_GetBigBlock(
387 StorageImpl* This,
388 ULONG blockIndex);
390 void StorageImpl_ReleaseBigBlock(
391 StorageImpl* This,
392 void* pBigBlock);
394 ULONG StorageImpl_GetNextFreeBigBlock(
395 StorageImpl* This);
397 void StorageImpl_FreeBigBlock(
398 StorageImpl* This,
399 ULONG blockIndex);
401 ULONG StorageImpl_GetNextBlockInChain(
402 StorageImpl* This,
403 ULONG blockIndex);
405 void StorageImpl_SetNextBlockInChain(
406 StorageImpl* This,
407 ULONG blockIndex,
408 ULONG nextBlock);
410 HRESULT StorageImpl_LoadFileHeader(
411 StorageImpl* This);
413 void StorageImpl_SaveFileHeader(
414 StorageImpl* This);
416 BOOL StorageImpl_ReadProperty(
417 StorageImpl* This,
418 ULONG index,
419 StgProperty* buffer);
421 BOOL StorageImpl_WriteProperty(
422 StorageImpl* This,
423 ULONG index,
424 StgProperty* buffer);
426 BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
427 StorageImpl* This,
428 SmallBlockChainStream** ppsbChain);
430 ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
431 ULONG blockIndex);
433 void Storage32Impl_AddBlockDepot(StorageImpl* This,
434 ULONG blockIndex);
436 ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
438 ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
439 ULONG depotIndex);
441 void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
442 ULONG depotIndex,
443 ULONG blockIndex);
444 /****************************************************************************
445 * Storage32InternalImpl definitions.
447 * Definition of the implementation structure for the IStorage32 interface.
448 * This one implements the IStorage32 interface for storage that are
449 * inside another storage.
451 struct StorageInternalImpl
453 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
454 * since we want to cast this in a Storage32 pointer */
457 * Declare the member of the Storage32BaseImpl class to allow
458 * casting as a Storage32BaseImpl
460 ULONG ref;
461 struct StorageImpl* ancestorStorage;
462 ULONG rootPropertySetIndex;
463 void (*v_destructor)(struct StorageInternalImpl*);
466 * There is no specific data for this class.
471 * Method definitions for the Storage32InternalImpl class.
473 StorageInternalImpl* StorageInternalImpl_Construct(
474 StorageImpl* ancestorStorage,
475 ULONG rootTropertyIndex);
477 void StorageInternalImpl_Destroy(
478 StorageInternalImpl* This);
480 HRESULT WINAPI StorageInternalImpl_Commit(
481 IStorage* iface,
482 DWORD grfCommitFlags); /* [in] */
484 HRESULT WINAPI StorageInternalImpl_Revert(
485 IStorage* iface);
488 /****************************************************************************
489 * IEnumSTATSTGImpl definitions.
491 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
492 * This class allows iterating through the content of a storage and to find
493 * specific items inside it.
495 struct IEnumSTATSTGImpl
497 ICOM_VTABLE(IEnumSTATSTG) *lpvtbl; /* Needs to be the first item in the stuct
498 * since we want to cast this in a IEnumSTATSTG pointer */
500 ULONG ref; /* Reference count */
501 StorageImpl* parentStorage; /* Reference to the parent storage */
502 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
505 * The current implementation of the IEnumSTATSTGImpl class uses a stack
506 * to walk the property sets to get the content of a storage. This stack
507 * is implemented by the following 3 data members
509 ULONG stackSize;
510 ULONG stackMaxSize;
511 ULONG* stackToVisit;
513 #define ENUMSTATSGT_SIZE_INCREMENT 10
517 * Method definitions for the IEnumSTATSTGImpl class.
519 HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
520 IEnumSTATSTG* iface,
521 REFIID riid,
522 void** ppvObject);
524 ULONG WINAPI IEnumSTATSTGImpl_AddRef(
525 IEnumSTATSTG* iface);
527 ULONG WINAPI IEnumSTATSTGImpl_Release(
528 IEnumSTATSTG* iface);
530 HRESULT WINAPI IEnumSTATSTGImpl_Next(
531 IEnumSTATSTG* iface,
532 ULONG celt,
533 STATSTG* rgelt,
534 ULONG* pceltFetched);
536 HRESULT WINAPI IEnumSTATSTGImpl_Skip(
537 IEnumSTATSTG* iface,
538 ULONG celt);
540 HRESULT WINAPI IEnumSTATSTGImpl_Reset(
541 IEnumSTATSTG* iface);
543 HRESULT WINAPI IEnumSTATSTGImpl_Clone(
544 IEnumSTATSTG* iface,
545 IEnumSTATSTG** ppenum);
547 IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
548 StorageImpl* This,
549 ULONG firstPropertyNode);
551 void IEnumSTATSTGImpl_Destroy(
552 IEnumSTATSTGImpl* This);
554 void IEnumSTATSTGImpl_PushSearchNode(
555 IEnumSTATSTGImpl* This,
556 ULONG nodeToPush);
558 ULONG IEnumSTATSTGImpl_PopSearchNode(
559 IEnumSTATSTGImpl* This,
560 BOOL remove);
562 ULONG IEnumSTATSTGImpl_FindProperty(
563 IEnumSTATSTGImpl* This,
564 const OLECHAR* lpszPropName,
565 StgProperty* buffer);
567 INT IEnumSTATSTGImpl_FindParentProperty(
568 IEnumSTATSTGImpl *This,
569 ULONG childProperty,
570 StgProperty *currentProperty,
571 ULONG *propertyId);
574 /****************************************************************************
575 * StgStreamImpl definitions.
577 * This class imlements the IStream32 inteface and represents a stream
578 * located inside a storage object.
580 struct StgStreamImpl
582 ICOM_VTABLE(IStream) *lpvtbl; /* Needs to be the first item in the stuct
583 * since we want to cast this in a IStream pointer */
586 * Reference count
588 ULONG ref;
591 * Storage that is the parent(owner) of the stream
593 StorageBaseImpl* parentStorage;
596 * Index of the property that owns (points to) this stream.
598 ULONG ownerProperty;
601 * Helper variable that contains the size of the stream
603 ULARGE_INTEGER streamSize;
606 * This is the current position of the cursor in the stream
608 ULARGE_INTEGER currentPosition;
611 * The information in the stream is represented by a chain of small blocks
612 * or a chain of large blocks. Depending on the case, one of the two
613 * following variabled points to that information.
615 BlockChainStream* bigBlockChain;
616 SmallBlockChainStream* smallBlockChain;
621 * Method definition for the StgStreamImpl class.
623 StgStreamImpl* StgStreamImpl_Construct(
624 StorageBaseImpl* parentStorage,
625 ULONG ownerProperty);
627 void StgStreamImpl_Destroy(
628 StgStreamImpl* This);
630 void StgStreamImpl_OpenBlockChain(
631 StgStreamImpl* This);
633 HRESULT WINAPI StgStreamImpl_QueryInterface(
634 IStream* iface,
635 REFIID riid, /* [in] */
636 void** ppvObject); /* [iid_is][out] */
638 ULONG WINAPI StgStreamImpl_AddRef(
639 IStream* iface);
641 ULONG WINAPI StgStreamImpl_Release(
642 IStream* iface);
644 HRESULT WINAPI StgStreamImpl_Read(
645 IStream* iface,
646 void* pv, /* [length_is][size_is][out] */
647 ULONG cb, /* [in] */
648 ULONG* pcbRead); /* [out] */
650 HRESULT WINAPI StgStreamImpl_Write(
651 IStream* iface,
652 const void* pv, /* [size_is][in] */
653 ULONG cb, /* [in] */
654 ULONG* pcbWritten); /* [out] */
656 HRESULT WINAPI StgStreamImpl_Seek(
657 IStream* iface,
658 LARGE_INTEGER dlibMove, /* [in] */
659 DWORD dwOrigin, /* [in] */
660 ULARGE_INTEGER* plibNewPosition); /* [out] */
662 HRESULT WINAPI StgStreamImpl_SetSize(
663 IStream* iface,
664 ULARGE_INTEGER libNewSize); /* [in] */
666 HRESULT WINAPI StgStreamImpl_CopyTo(
667 IStream* iface,
668 IStream* pstm, /* [unique][in] */
669 ULARGE_INTEGER cb, /* [in] */
670 ULARGE_INTEGER* pcbRead, /* [out] */
671 ULARGE_INTEGER* pcbWritten); /* [out] */
673 HRESULT WINAPI StgStreamImpl_Commit(
674 IStream* iface,
675 DWORD grfCommitFlags); /* [in] */
677 HRESULT WINAPI StgStreamImpl_Revert(
678 IStream* iface);
680 HRESULT WINAPI StgStreamImpl_LockRegion(
681 IStream* iface,
682 ULARGE_INTEGER libOffset, /* [in] */
683 ULARGE_INTEGER cb, /* [in] */
684 DWORD dwLockType); /* [in] */
686 HRESULT WINAPI StgStreamImpl_UnlockRegion(
687 IStream* iface,
688 ULARGE_INTEGER libOffset, /* [in] */
689 ULARGE_INTEGER cb, /* [in] */
690 DWORD dwLockType); /* [in] */
692 HRESULT WINAPI StgStreamImpl_Stat(
693 IStream* iface,
694 STATSTG* pstatstg, /* [out] */
695 DWORD grfStatFlag); /* [in] */
697 HRESULT WINAPI StgStreamImpl_Clone(
698 IStream* iface,
699 IStream** ppstm); /* [out] */
702 /********************************************************************************
703 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
704 * abstractions used to read values from file buffers without having to worry
705 * about bit order
707 void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
708 void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
709 void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
710 void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
711 void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
712 void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
713 void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
714 StgProperty* source,
715 int statFlags);
717 /****************************************************************************
718 * BlockChainStream definitions.
720 * The BlockChainStream class is a utility class that is used to create an
721 * abstraction of the big block chains in the storage file.
723 struct BlockChainStream
725 StorageImpl* parentStorage;
726 ULONG* headOfStreamPlaceHolder;
727 ULONG ownerPropertyIndex;
731 * Methods for the BlockChainStream class.
733 BlockChainStream* BlockChainStream_Construct(
734 StorageImpl* parentStorage,
735 ULONG* headOfStreamPlaceHolder,
736 ULONG propertyIndex);
738 void BlockChainStream_Destroy(
739 BlockChainStream* This);
741 ULONG BlockChainStream_GetHeadOfChain(
742 BlockChainStream* This);
744 BOOL BlockChainStream_ReadAt(
745 BlockChainStream* This,
746 ULARGE_INTEGER offset,
747 ULONG size,
748 void* buffer,
749 ULONG* bytesRead);
751 BOOL BlockChainStream_WriteAt(
752 BlockChainStream* This,
753 ULARGE_INTEGER offset,
754 ULONG size,
755 const void* buffer,
756 ULONG* bytesWritten);
758 BOOL BlockChainStream_SetSize(
759 BlockChainStream* This,
760 ULARGE_INTEGER newSize);
762 ULARGE_INTEGER BlockChainStream_GetSize(
763 BlockChainStream* This);
765 ULONG BlockChainStream_GetCount(
766 BlockChainStream* This);
768 /****************************************************************************
769 * SmallBlockChainStream definitions.
771 * The SmallBlockChainStream class is a utility class that is used to create an
772 * abstraction of the small block chains in the storage file.
774 struct SmallBlockChainStream
776 StorageImpl* parentStorage;
777 ULONG ownerPropertyIndex;
781 * Methods of the SmallBlockChainStream class.
783 SmallBlockChainStream* SmallBlockChainStream_Construct(
784 StorageImpl* parentStorage,
785 ULONG propertyIndex);
787 void SmallBlockChainStream_Destroy(
788 SmallBlockChainStream* This);
790 ULONG SmallBlockChainStream_GetHeadOfChain(
791 SmallBlockChainStream* This);
793 ULONG SmallBlockChainStream_GetNextBlockInChain(
794 SmallBlockChainStream* This,
795 ULONG blockIndex);
797 void SmallBlockChainStream_SetNextBlockInChain(
798 SmallBlockChainStream* This,
799 ULONG blockIndex,
800 ULONG nextBlock);
802 void SmallBlockChainStream_FreeBlock(
803 SmallBlockChainStream* This,
804 ULONG blockIndex);
806 ULONG SmallBlockChainStream_GetNextFreeBlock(
807 SmallBlockChainStream* This);
809 BOOL SmallBlockChainStream_ReadAt(
810 SmallBlockChainStream* This,
811 ULARGE_INTEGER offset,
812 ULONG size,
813 void* buffer,
814 ULONG* bytesRead);
816 BOOL SmallBlockChainStream_WriteAt(
817 SmallBlockChainStream* This,
818 ULARGE_INTEGER offset,
819 ULONG size,
820 const void* buffer,
821 ULONG* bytesWritten);
823 BOOL SmallBlockChainStream_SetSize(
824 SmallBlockChainStream* This,
825 ULARGE_INTEGER newSize);
827 ULARGE_INTEGER SmallBlockChainStream_GetSize(
828 SmallBlockChainStream* This);
830 ULONG SmallBlockChainStream_GetCount(
831 SmallBlockChainStream* This);
834 #endif __STORAGE32_H__