Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbejy@wpi.edu>
[wine/multimedia.git] / ole / storage32.h
blobf8416b3f0b13c3f4ecb8eeec45833caac072b7fc
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 *maplisthead;
144 BigBlock *headblock;
148 * Declaration of the functions used to manipulate the BigBlockFile
149 * data structure.
151 BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
152 DWORD openFlags,
153 ULONG blocksize);
154 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
155 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
156 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
157 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
158 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
159 ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
161 /****************************************************************************
162 * Storage32BaseImpl definitions.
164 * This stucture defines the base information contained in all implementations
165 * of IStorage32 contained in this filee storage implementation.
167 * In OOP terms, this is the base class for all the IStorage32 implementations
168 * contained in this file.
170 struct StorageBaseImpl
172 ICOM_VTABLE(IStorage)* lpvtbl; /* Needs to be the first item in the stuct
173 * since we want to cast this in a Storage32 pointer */
176 * Reference count of this object
178 ULONG ref;
181 * Ancestor storage (top level)
183 StorageImpl* ancestorStorage;
186 * Index of the property for the root of
187 * this storage
189 ULONG rootPropertySetIndex;
192 * virtual Destructor method.
194 void (*v_destructor)(StorageBaseImpl*);
199 * Prototypes for the methods of the Storage32BaseImpl class.
201 HRESULT WINAPI StorageBaseImpl_QueryInterface(
202 IStorage* iface,
203 REFIID riid,
204 void** ppvObject);
206 ULONG WINAPI StorageBaseImpl_AddRef(
207 IStorage* iface);
209 ULONG WINAPI StorageBaseImpl_Release(
210 IStorage* iface);
212 HRESULT WINAPI StorageBaseImpl_OpenStream(
213 IStorage* iface,
214 const OLECHAR* pwcsName, /* [string][in] */
215 void* reserved1, /* [unique][in] */
216 DWORD grfMode, /* [in] */
217 DWORD reserved2, /* [in] */
218 IStream** ppstm); /* [out] */
220 HRESULT WINAPI StorageBaseImpl_OpenStorage(
221 IStorage* iface,
222 const OLECHAR* pwcsName, /* [string][unique][in] */
223 IStorage* pstgPriority, /* [unique][in] */
224 DWORD grfMode, /* [in] */
225 SNB snbExclude, /* [unique][in] */
226 DWORD reserved, /* [in] */
227 IStorage** ppstg); /* [out] */
229 HRESULT WINAPI StorageBaseImpl_EnumElements(
230 IStorage* iface,
231 DWORD reserved1, /* [in] */
232 void* reserved2, /* [size_is][unique][in] */
233 DWORD reserved3, /* [in] */
234 IEnumSTATSTG** ppenum); /* [out] */
236 HRESULT WINAPI StorageBaseImpl_Stat(
237 IStorage* iface,
238 STATSTG* pstatstg, /* [out] */
239 DWORD grfStatFlag); /* [in] */
241 HRESULT WINAPI StorageBaseImpl_RenameElement(
242 IStorage* iface,
243 const OLECHAR* pwcsOldName, /* [string][in] */
244 const OLECHAR* pwcsNewName); /* [string][in] */
246 HRESULT WINAPI StorageBaseImpl_CreateStream(
247 IStorage* iface,
248 const OLECHAR* pwcsName, /* [string][in] */
249 DWORD grfMode, /* [in] */
250 DWORD reserved1, /* [in] */
251 DWORD reserved2, /* [in] */
252 IStream** ppstm); /* [out] */
254 HRESULT WINAPI StorageBaseImpl_SetClass(
255 IStorage* iface,
256 REFCLSID clsid); /* [in] */
258 /****************************************************************************
259 * Storage32Impl definitions.
261 * This implementation of the IStorage32 interface represents a root
262 * storage. Basically, a document file.
264 struct StorageImpl
266 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
267 * since we want to cast this in a Storage32 pointer */
270 * Declare the member of the Storage32BaseImpl class to allow
271 * casting as a Storage32BaseImpl
273 ULONG ref;
274 struct StorageImpl* ancestorStorage;
275 ULONG rootPropertySetIndex;
276 void (*v_destructor)(struct StorageImpl*);
279 * The following data members are specific to the Storage32Impl
280 * class
282 HANDLE hFile; /* Physical support for the Docfile */
285 * File header
287 WORD bigBlockSizeBits;
288 WORD smallBlockSizeBits;
289 ULONG bigBlockSize;
290 ULONG smallBlockSize;
291 ULONG bigBlockDepotCount;
292 ULONG rootStartBlock;
293 ULONG smallBlockDepotStart;
294 ULONG extBigBlockDepotStart;
295 ULONG extBigBlockDepotCount;
296 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
298 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
299 ULONG indexBlockDepotCached;
300 ULONG prevFreeBlock;
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;
728 ULONG lastBlockNoInSequence;
729 ULONG lastBlockNoInSequenceIndex;
730 ULONG tailIndex;
731 ULONG numBlocks;
735 * Methods for the BlockChainStream class.
737 BlockChainStream* BlockChainStream_Construct(
738 StorageImpl* parentStorage,
739 ULONG* headOfStreamPlaceHolder,
740 ULONG propertyIndex);
742 void BlockChainStream_Destroy(
743 BlockChainStream* This);
745 ULONG BlockChainStream_GetHeadOfChain(
746 BlockChainStream* This);
748 BOOL BlockChainStream_ReadAt(
749 BlockChainStream* This,
750 ULARGE_INTEGER offset,
751 ULONG size,
752 void* buffer,
753 ULONG* bytesRead);
755 BOOL BlockChainStream_WriteAt(
756 BlockChainStream* This,
757 ULARGE_INTEGER offset,
758 ULONG size,
759 const void* buffer,
760 ULONG* bytesWritten);
762 BOOL BlockChainStream_SetSize(
763 BlockChainStream* This,
764 ULARGE_INTEGER newSize);
766 ULARGE_INTEGER BlockChainStream_GetSize(
767 BlockChainStream* This);
769 ULONG BlockChainStream_GetCount(
770 BlockChainStream* This);
772 /****************************************************************************
773 * SmallBlockChainStream definitions.
775 * The SmallBlockChainStream class is a utility class that is used to create an
776 * abstraction of the small block chains in the storage file.
778 struct SmallBlockChainStream
780 StorageImpl* parentStorage;
781 ULONG ownerPropertyIndex;
785 * Methods of the SmallBlockChainStream class.
787 SmallBlockChainStream* SmallBlockChainStream_Construct(
788 StorageImpl* parentStorage,
789 ULONG propertyIndex);
791 void SmallBlockChainStream_Destroy(
792 SmallBlockChainStream* This);
794 ULONG SmallBlockChainStream_GetHeadOfChain(
795 SmallBlockChainStream* This);
797 ULONG SmallBlockChainStream_GetNextBlockInChain(
798 SmallBlockChainStream* This,
799 ULONG blockIndex);
801 void SmallBlockChainStream_SetNextBlockInChain(
802 SmallBlockChainStream* This,
803 ULONG blockIndex,
804 ULONG nextBlock);
806 void SmallBlockChainStream_FreeBlock(
807 SmallBlockChainStream* This,
808 ULONG blockIndex);
810 ULONG SmallBlockChainStream_GetNextFreeBlock(
811 SmallBlockChainStream* This);
813 BOOL SmallBlockChainStream_ReadAt(
814 SmallBlockChainStream* This,
815 ULARGE_INTEGER offset,
816 ULONG size,
817 void* buffer,
818 ULONG* bytesRead);
820 BOOL SmallBlockChainStream_WriteAt(
821 SmallBlockChainStream* This,
822 ULARGE_INTEGER offset,
823 ULONG size,
824 const void* buffer,
825 ULONG* bytesWritten);
827 BOOL SmallBlockChainStream_SetSize(
828 SmallBlockChainStream* This,
829 ULARGE_INTEGER newSize);
831 ULARGE_INTEGER SmallBlockChainStream_GetSize(
832 SmallBlockChainStream* This);
834 ULONG SmallBlockChainStream_GetCount(
835 SmallBlockChainStream* This);
838 #endif /* __STORAGE32_H__ */