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 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef __STORAGE32_H__
30 #define __STORAGE32_H__
40 * Definitions for the file format offsets.
42 static const ULONG OFFSET_BIGBLOCKSIZEBITS
= 0x0000001e;
43 static const ULONG OFFSET_SMALLBLOCKSIZEBITS
= 0x00000020;
44 static const ULONG OFFSET_BBDEPOTCOUNT
= 0x0000002C;
45 static const ULONG OFFSET_ROOTSTARTBLOCK
= 0x00000030;
46 static const ULONG OFFSET_SBDEPOTSTART
= 0x0000003C;
47 static const ULONG OFFSET_SBDEPOTCOUNT
= 0x00000040;
48 static const ULONG OFFSET_EXTBBDEPOTSTART
= 0x00000044;
49 static const ULONG OFFSET_EXTBBDEPOTCOUNT
= 0x00000048;
50 static const ULONG OFFSET_BBDEPOTSTART
= 0x0000004C;
51 static const ULONG OFFSET_PS_NAME
= 0x00000000;
52 static const ULONG OFFSET_PS_NAMELENGTH
= 0x00000040;
53 static const ULONG OFFSET_PS_PROPERTYTYPE
= 0x00000042;
54 static const ULONG OFFSET_PS_PREVIOUSPROP
= 0x00000044;
55 static const ULONG OFFSET_PS_NEXTPROP
= 0x00000048;
56 static const ULONG OFFSET_PS_DIRPROP
= 0x0000004C;
57 static const ULONG OFFSET_PS_GUID
= 0x00000050;
58 static const ULONG OFFSET_PS_TSS1
= 0x00000064;
59 static const ULONG OFFSET_PS_TSD1
= 0x00000068;
60 static const ULONG OFFSET_PS_TSS2
= 0x0000006C;
61 static const ULONG OFFSET_PS_TSD2
= 0x00000070;
62 static const ULONG OFFSET_PS_STARTBLOCK
= 0x00000074;
63 static const ULONG OFFSET_PS_SIZE
= 0x00000078;
64 static const WORD DEF_BIG_BLOCK_SIZE_BITS
= 0x0009;
65 static const WORD DEF_SMALL_BLOCK_SIZE_BITS
= 0x0006;
66 static const WORD DEF_BIG_BLOCK_SIZE
= 0x0200;
67 static const WORD DEF_SMALL_BLOCK_SIZE
= 0x0040;
68 static const ULONG BLOCK_EXTBBDEPOT
= 0xFFFFFFFC;
69 static const ULONG BLOCK_SPECIAL
= 0xFFFFFFFD;
70 static const ULONG BLOCK_END_OF_CHAIN
= 0xFFFFFFFE;
71 static const ULONG BLOCK_UNUSED
= 0xFFFFFFFF;
72 static const ULONG PROPERTY_NULL
= 0xFFFFFFFF;
74 #define PROPERTY_NAME_MAX_LEN 0x20
75 #define PROPERTY_NAME_BUFFER_LEN 0x40
77 #define PROPSET_BLOCK_SIZE 0x00000080
80 * Property type of relation
82 #define PROPERTY_RELATION_PREVIOUS 0
83 #define PROPERTY_RELATION_NEXT 1
84 #define PROPERTY_RELATION_DIR 2
87 * Property type constants
89 #define PROPTYPE_STORAGE 0x01
90 #define PROPTYPE_STREAM 0x02
91 #define PROPTYPE_ROOT 0x05
94 * These defines assume a hardcoded blocksize. The code will assert
95 * if the blocksize is different. Some changes will have to be done if it
98 #define BIG_BLOCK_SIZE 0x200
99 #define COUNT_BBDEPOTINHEADER 109
100 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
101 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128
104 * These are signatures to detect the type of Document file.
106 static const BYTE STORAGE_magic
[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
107 static const BYTE STORAGE_oldmagic
[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
110 * Forward declarations of all the structures used by the storage
113 typedef struct StorageBaseImpl StorageBaseImpl
;
114 typedef struct StorageImpl StorageImpl
;
115 typedef struct StorageInternalImpl StorageInternalImpl
;
116 typedef struct BlockChainStream BlockChainStream
;
117 typedef struct SmallBlockChainStream SmallBlockChainStream
;
118 typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl
;
119 typedef struct StgProperty StgProperty
;
120 typedef struct StgStreamImpl StgStreamImpl
;
123 * This utility structure is used to read/write the information in a storage
128 WCHAR name
[PROPERTY_NAME_MAX_LEN
];
129 WORD sizeOfNameString
;
131 ULONG previousProperty
;
134 GUID propertyUniqueID
;
143 /*************************************************************************
144 * Big Block File support
146 * The big block file is an abstraction of a flat file separated in
147 * same sized blocks. The implementation for the methods described in
148 * this section appear in stg_bigblockfile.c
152 * Declaration of the data structures
154 typedef struct BigBlockFile BigBlockFile
,*LPBIGBLOCKFILE
;
155 typedef struct MappedPage MappedPage
,*LPMAPPEDPAGE
;
160 ULARGE_INTEGER filesize
;
166 MappedPage
*victimhead
, *victimtail
;
167 ULONG num_victim_pages
;
174 * Declaration of the functions used to manipulate the BigBlockFile
177 BigBlockFile
* BIGBLOCKFILE_Construct(HANDLE hFile
,
182 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This
);
183 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This
, ULONG index
);
184 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This
, ULONG index
);
185 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This
, void *pBlock
);
186 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This
, ULARGE_INTEGER newSize
);
187 ULARGE_INTEGER
BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This
);
189 /*************************************************************************
190 * Ole Convert support
193 void OLECONVERT_CreateOleStream(LPSTORAGE pStorage
);
194 HRESULT
OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage
, LPCSTR strOleTypeName
);
196 /****************************************************************************
197 * Storage32BaseImpl definitions.
199 * This structure defines the base information contained in all implementations
200 * of IStorage32 contained in this file storage implementation.
202 * In OOP terms, this is the base class for all the IStorage32 implementations
203 * contained in this file.
205 struct StorageBaseImpl
207 IStorageVtbl
*lpVtbl
; /* Needs to be the first item in the struct
208 * since we want to cast this in a Storage32 pointer */
211 * Reference count of this object
216 * Ancestor storage (top level)
218 StorageImpl
* ancestorStorage
;
221 * Index of the property for the root of
224 ULONG rootPropertySetIndex
;
227 * virtual Destructor method.
229 void (*v_destructor
)(StorageBaseImpl
*);
234 * Prototypes for the methods of the Storage32BaseImpl class.
236 HRESULT WINAPI
StorageBaseImpl_QueryInterface(
241 ULONG WINAPI
StorageBaseImpl_AddRef(
244 ULONG WINAPI
StorageBaseImpl_Release(
247 HRESULT WINAPI
StorageBaseImpl_OpenStream(
249 const OLECHAR
* pwcsName
, /* [string][in] */
250 void* reserved1
, /* [unique][in] */
251 DWORD grfMode
, /* [in] */
252 DWORD reserved2
, /* [in] */
253 IStream
** ppstm
); /* [out] */
255 HRESULT WINAPI
StorageBaseImpl_OpenStorage(
257 const OLECHAR
* pwcsName
, /* [string][unique][in] */
258 IStorage
* pstgPriority
, /* [unique][in] */
259 DWORD grfMode
, /* [in] */
260 SNB snbExclude
, /* [unique][in] */
261 DWORD reserved
, /* [in] */
262 IStorage
** ppstg
); /* [out] */
264 HRESULT WINAPI
StorageBaseImpl_EnumElements(
266 DWORD reserved1
, /* [in] */
267 void* reserved2
, /* [size_is][unique][in] */
268 DWORD reserved3
, /* [in] */
269 IEnumSTATSTG
** ppenum
); /* [out] */
271 HRESULT WINAPI
StorageBaseImpl_Stat(
273 STATSTG
* pstatstg
, /* [out] */
274 DWORD grfStatFlag
); /* [in] */
276 HRESULT WINAPI
StorageBaseImpl_RenameElement(
278 const OLECHAR
* pwcsOldName
, /* [string][in] */
279 const OLECHAR
* pwcsNewName
); /* [string][in] */
281 HRESULT WINAPI
StorageBaseImpl_CreateStream(
283 const OLECHAR
* pwcsName
, /* [string][in] */
284 DWORD grfMode
, /* [in] */
285 DWORD reserved1
, /* [in] */
286 DWORD reserved2
, /* [in] */
287 IStream
** ppstm
); /* [out] */
289 HRESULT WINAPI
StorageBaseImpl_SetClass(
291 REFCLSID clsid
); /* [in] */
293 /****************************************************************************
294 * Storage32Impl definitions.
296 * This implementation of the IStorage32 interface represents a root
297 * storage. Basically, a document file.
301 IStorageVtbl
*lpVtbl
; /* Needs to be the first item in the struct
302 * since we want to cast this in a Storage32 pointer */
305 * Declare the member of the Storage32BaseImpl class to allow
306 * casting as a Storage32BaseImpl
309 struct StorageImpl
* ancestorStorage
;
310 ULONG rootPropertySetIndex
;
311 void (*v_destructor
)(struct StorageImpl
*);
314 * The following data members are specific to the Storage32Impl
317 HANDLE hFile
; /* Physical support for the Docfile */
318 LPOLESTR pwcsName
; /* Full path of the document file */
320 /* FIXME: should this be in Storage32BaseImpl ? */
321 WCHAR filename
[PROPERTY_NAME_BUFFER_LEN
];
326 WORD bigBlockSizeBits
;
327 WORD smallBlockSizeBits
;
329 ULONG smallBlockSize
;
330 ULONG bigBlockDepotCount
;
331 ULONG rootStartBlock
;
332 ULONG smallBlockDepotStart
;
333 ULONG extBigBlockDepotStart
;
334 ULONG extBigBlockDepotCount
;
335 ULONG bigBlockDepotStart
[COUNT_BBDEPOTINHEADER
];
337 ULONG blockDepotCached
[NUM_BLOCKS_PER_DEPOT_BLOCK
];
338 ULONG indexBlockDepotCached
;
342 * Abstraction of the big block chains for the chains of the header.
344 BlockChainStream
* rootBlockChain
;
345 BlockChainStream
* smallBlockDepotChain
;
346 BlockChainStream
* smallBlockRootChain
;
349 * Pointer to the big block file abstraction
351 BigBlockFile
* bigBlockFile
;
355 * Method declaration for the Storage32Impl class
358 HRESULT WINAPI
StorageImpl_CreateStorage(
360 const OLECHAR
* pwcsName
, /* [string][in] */
361 DWORD grfMode
, /* [in] */
362 DWORD dwStgFmt
, /* [in] */
363 DWORD reserved2
, /* [in] */
364 IStorage
** ppstg
); /* [out] */
366 HRESULT WINAPI
StorageImpl_CopyTo(
368 DWORD ciidExclude
, /* [in] */
369 const IID
* rgiidExclude
, /* [size_is][unique][in] */
370 SNB snbExclude
, /* [unique][in] */
371 IStorage
* pstgDest
); /* [unique][in] */
373 HRESULT WINAPI
StorageImpl_MoveElementTo(
375 const OLECHAR
* pwcsName
, /* [string][in] */
376 IStorage
* pstgDest
, /* [unique][in] */
377 const OLECHAR
* pwcsNewName
, /* [string][in] */
378 DWORD grfFlags
); /* [in] */
380 HRESULT WINAPI
StorageImpl_Commit(
382 DWORD grfCommitFlags
); /* [in] */
384 HRESULT WINAPI
StorageImpl_Revert(
387 HRESULT WINAPI
StorageImpl_DestroyElement(
389 const OLECHAR
* pwcsName
); /* [string][in] */
391 HRESULT WINAPI
StorageImpl_SetElementTimes(
393 const OLECHAR
* pwcsName
, /* [string][in] */
394 const FILETIME
* pctime
, /* [in] */
395 const FILETIME
* patime
, /* [in] */
396 const FILETIME
* pmtime
); /* [in] */
398 HRESULT WINAPI
StorageImpl_SetStateBits(
400 DWORD grfStateBits
, /* [in] */
401 DWORD grfMask
); /* [in] */
403 HRESULT WINAPI
StorageImpl_Stat(IStorage
* iface
,
404 STATSTG
* pstatstg
, /* [out] */
405 DWORD grfStatFlag
); /* [in] */
407 void StorageImpl_Destroy(
410 HRESULT
StorageImpl_Construct(
419 BOOL
StorageImpl_ReadBigBlock(
424 BOOL
StorageImpl_WriteBigBlock(
429 void* StorageImpl_GetROBigBlock(
433 void* StorageImpl_GetBigBlock(
437 void StorageImpl_ReleaseBigBlock(
441 ULONG
StorageImpl_GetNextFreeBigBlock(
444 void StorageImpl_FreeBigBlock(
448 HRESULT
StorageImpl_GetNextBlockInChain(
451 ULONG
* nextBlockIndex
);
453 void StorageImpl_SetNextBlockInChain(
458 HRESULT
StorageImpl_LoadFileHeader(
461 void StorageImpl_SaveFileHeader(
464 BOOL
StorageImpl_ReadProperty(
467 StgProperty
* buffer
);
469 BOOL
StorageImpl_WriteProperty(
472 StgProperty
* buffer
);
474 BlockChainStream
* Storage32Impl_SmallBlocksToBigBlocks(
476 SmallBlockChainStream
** ppsbChain
);
478 ULONG
Storage32Impl_GetNextExtendedBlock(StorageImpl
* This
,
481 void Storage32Impl_AddBlockDepot(StorageImpl
* This
,
484 ULONG
Storage32Impl_AddExtBlockDepot(StorageImpl
* This
);
486 ULONG
Storage32Impl_GetExtDepotBlock(StorageImpl
* This
,
489 void Storage32Impl_SetExtDepotBlock(StorageImpl
* This
,
492 /****************************************************************************
493 * Storage32InternalImpl definitions.
495 * Definition of the implementation structure for the IStorage32 interface.
496 * This one implements the IStorage32 interface for storage that are
497 * inside another storage.
499 struct StorageInternalImpl
501 IStorageVtbl
*lpVtbl
; /* Needs to be the first item in the struct
502 * since we want to cast this in a Storage32 pointer */
505 * Declare the member of the Storage32BaseImpl class to allow
506 * casting as a Storage32BaseImpl
509 struct StorageImpl
* ancestorStorage
;
510 ULONG rootPropertySetIndex
;
511 void (*v_destructor
)(struct StorageInternalImpl
*);
514 * There is no specific data for this class.
519 * Method definitions for the Storage32InternalImpl class.
521 StorageInternalImpl
* StorageInternalImpl_Construct(
522 StorageImpl
* ancestorStorage
,
523 ULONG rootTropertyIndex
);
525 void StorageInternalImpl_Destroy(
526 StorageInternalImpl
* This
);
528 HRESULT WINAPI
StorageInternalImpl_Commit(
530 DWORD grfCommitFlags
); /* [in] */
532 HRESULT WINAPI
StorageInternalImpl_Revert(
536 /****************************************************************************
537 * IEnumSTATSTGImpl definitions.
539 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
540 * This class allows iterating through the content of a storage and to find
541 * specific items inside it.
543 struct IEnumSTATSTGImpl
545 IEnumSTATSTGVtbl
*lpVtbl
; /* Needs to be the first item in the struct
546 * since we want to cast this in a IEnumSTATSTG pointer */
548 ULONG ref
; /* Reference count */
549 StorageImpl
* parentStorage
; /* Reference to the parent storage */
550 ULONG firstPropertyNode
; /* Index of the root of the storage to enumerate */
553 * The current implementation of the IEnumSTATSTGImpl class uses a stack
554 * to walk the property sets to get the content of a storage. This stack
555 * is implemented by the following 3 data members
561 #define ENUMSTATSGT_SIZE_INCREMENT 10
565 * Method definitions for the IEnumSTATSTGImpl class.
567 HRESULT WINAPI
IEnumSTATSTGImpl_QueryInterface(
572 ULONG WINAPI
IEnumSTATSTGImpl_AddRef(
573 IEnumSTATSTG
* iface
);
575 ULONG WINAPI
IEnumSTATSTGImpl_Release(
576 IEnumSTATSTG
* iface
);
578 HRESULT WINAPI
IEnumSTATSTGImpl_Next(
582 ULONG
* pceltFetched
);
584 HRESULT WINAPI
IEnumSTATSTGImpl_Skip(
588 HRESULT WINAPI
IEnumSTATSTGImpl_Reset(
589 IEnumSTATSTG
* iface
);
591 HRESULT WINAPI
IEnumSTATSTGImpl_Clone(
593 IEnumSTATSTG
** ppenum
);
595 IEnumSTATSTGImpl
* IEnumSTATSTGImpl_Construct(
597 ULONG firstPropertyNode
);
599 void IEnumSTATSTGImpl_Destroy(
600 IEnumSTATSTGImpl
* This
);
602 void IEnumSTATSTGImpl_PushSearchNode(
603 IEnumSTATSTGImpl
* This
,
606 ULONG
IEnumSTATSTGImpl_PopSearchNode(
607 IEnumSTATSTGImpl
* This
,
610 ULONG
IEnumSTATSTGImpl_FindProperty(
611 IEnumSTATSTGImpl
* This
,
612 const OLECHAR
* lpszPropName
,
613 StgProperty
* buffer
);
615 INT
IEnumSTATSTGImpl_FindParentProperty(
616 IEnumSTATSTGImpl
*This
,
618 StgProperty
*currentProperty
,
622 /****************************************************************************
623 * StgStreamImpl definitions.
625 * This class imlements the IStream32 inteface and represents a stream
626 * located inside a storage object.
630 IStreamVtbl
*lpVtbl
; /* Needs to be the first item in the struct
631 * since we want to cast this in a IStream pointer */
639 * Storage that is the parent(owner) of the stream
641 StorageBaseImpl
* parentStorage
;
644 * Access mode of this stream.
649 * Index of the property that owns (points to) this stream.
654 * Helper variable that contains the size of the stream
656 ULARGE_INTEGER streamSize
;
659 * This is the current position of the cursor in the stream
661 ULARGE_INTEGER currentPosition
;
664 * The information in the stream is represented by a chain of small blocks
665 * or a chain of large blocks. Depending on the case, one of the two
666 * following variabled points to that information.
668 BlockChainStream
* bigBlockChain
;
669 SmallBlockChainStream
* smallBlockChain
;
673 * Method definition for the StgStreamImpl class.
675 StgStreamImpl
* StgStreamImpl_Construct(
676 StorageBaseImpl
* parentStorage
,
678 ULONG ownerProperty
);
680 void StgStreamImpl_Destroy(
681 StgStreamImpl
* This
);
683 void StgStreamImpl_OpenBlockChain(
684 StgStreamImpl
* This
);
686 HRESULT WINAPI
StgStreamImpl_QueryInterface(
688 REFIID riid
, /* [in] */
689 void** ppvObject
); /* [iid_is][out] */
691 ULONG WINAPI
StgStreamImpl_AddRef(
694 ULONG WINAPI
StgStreamImpl_Release(
697 HRESULT WINAPI
StgStreamImpl_Read(
699 void* pv
, /* [length_is][size_is][out] */
701 ULONG
* pcbRead
); /* [out] */
703 HRESULT WINAPI
StgStreamImpl_Write(
705 const void* pv
, /* [size_is][in] */
707 ULONG
* pcbWritten
); /* [out] */
709 HRESULT WINAPI
StgStreamImpl_Seek(
711 LARGE_INTEGER dlibMove
, /* [in] */
712 DWORD dwOrigin
, /* [in] */
713 ULARGE_INTEGER
* plibNewPosition
); /* [out] */
715 HRESULT WINAPI
StgStreamImpl_SetSize(
717 ULARGE_INTEGER libNewSize
); /* [in] */
719 HRESULT WINAPI
StgStreamImpl_CopyTo(
721 IStream
* pstm
, /* [unique][in] */
722 ULARGE_INTEGER cb
, /* [in] */
723 ULARGE_INTEGER
* pcbRead
, /* [out] */
724 ULARGE_INTEGER
* pcbWritten
); /* [out] */
726 HRESULT WINAPI
StgStreamImpl_Commit(
728 DWORD grfCommitFlags
); /* [in] */
730 HRESULT WINAPI
StgStreamImpl_Revert(
733 HRESULT WINAPI
StgStreamImpl_LockRegion(
735 ULARGE_INTEGER libOffset
, /* [in] */
736 ULARGE_INTEGER cb
, /* [in] */
737 DWORD dwLockType
); /* [in] */
739 HRESULT WINAPI
StgStreamImpl_UnlockRegion(
741 ULARGE_INTEGER libOffset
, /* [in] */
742 ULARGE_INTEGER cb
, /* [in] */
743 DWORD dwLockType
); /* [in] */
745 HRESULT WINAPI
StgStreamImpl_Stat(
747 STATSTG
* pstatstg
, /* [out] */
748 DWORD grfStatFlag
); /* [in] */
750 HRESULT WINAPI
StgStreamImpl_Clone(
752 IStream
** ppstm
); /* [out] */
755 /********************************************************************************
756 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
757 * abstractions used to read values from file buffers without having to worry
760 void StorageUtl_ReadWord(void* buffer
, ULONG offset
, WORD
* value
);
761 void StorageUtl_WriteWord(void* buffer
, ULONG offset
, WORD value
);
762 void StorageUtl_ReadDWord(void* buffer
, ULONG offset
, DWORD
* value
);
763 void StorageUtl_WriteDWord(void* buffer
, ULONG offset
, DWORD value
);
764 void StorageUtl_ReadGUID(void* buffer
, ULONG offset
, GUID
* value
);
765 void StorageUtl_WriteGUID(void* buffer
, ULONG offset
, GUID
* value
);
766 void StorageUtl_CopyPropertyToSTATSTG(STATSTG
* destination
,
770 /****************************************************************************
771 * BlockChainStream definitions.
773 * The BlockChainStream class is a utility class that is used to create an
774 * abstraction of the big block chains in the storage file.
776 struct BlockChainStream
778 StorageImpl
* parentStorage
;
779 ULONG
* headOfStreamPlaceHolder
;
780 ULONG ownerPropertyIndex
;
781 ULONG lastBlockNoInSequence
;
782 ULONG lastBlockNoInSequenceIndex
;
788 * Methods for the BlockChainStream class.
790 BlockChainStream
* BlockChainStream_Construct(
791 StorageImpl
* parentStorage
,
792 ULONG
* headOfStreamPlaceHolder
,
793 ULONG propertyIndex
);
795 void BlockChainStream_Destroy(
796 BlockChainStream
* This
);
798 ULONG
BlockChainStream_GetHeadOfChain(
799 BlockChainStream
* This
);
801 BOOL
BlockChainStream_ReadAt(
802 BlockChainStream
* This
,
803 ULARGE_INTEGER offset
,
808 BOOL
BlockChainStream_WriteAt(
809 BlockChainStream
* This
,
810 ULARGE_INTEGER offset
,
813 ULONG
* bytesWritten
);
815 BOOL
BlockChainStream_SetSize(
816 BlockChainStream
* This
,
817 ULARGE_INTEGER newSize
);
819 ULARGE_INTEGER
BlockChainStream_GetSize(
820 BlockChainStream
* This
);
822 ULONG
BlockChainStream_GetCount(
823 BlockChainStream
* This
);
825 /****************************************************************************
826 * SmallBlockChainStream definitions.
828 * The SmallBlockChainStream class is a utility class that is used to create an
829 * abstraction of the small block chains in the storage file.
831 struct SmallBlockChainStream
833 StorageImpl
* parentStorage
;
834 ULONG ownerPropertyIndex
;
838 * Methods of the SmallBlockChainStream class.
840 SmallBlockChainStream
* SmallBlockChainStream_Construct(
841 StorageImpl
* parentStorage
,
842 ULONG propertyIndex
);
844 void SmallBlockChainStream_Destroy(
845 SmallBlockChainStream
* This
);
847 ULONG
SmallBlockChainStream_GetHeadOfChain(
848 SmallBlockChainStream
* This
);
850 HRESULT
SmallBlockChainStream_GetNextBlockInChain(
851 SmallBlockChainStream
* This
,
853 ULONG
* nextBlockIndex
);
855 void SmallBlockChainStream_SetNextBlockInChain(
856 SmallBlockChainStream
* This
,
860 void SmallBlockChainStream_FreeBlock(
861 SmallBlockChainStream
* This
,
864 ULONG
SmallBlockChainStream_GetNextFreeBlock(
865 SmallBlockChainStream
* This
);
867 BOOL
SmallBlockChainStream_ReadAt(
868 SmallBlockChainStream
* This
,
869 ULARGE_INTEGER offset
,
874 BOOL
SmallBlockChainStream_WriteAt(
875 SmallBlockChainStream
* This
,
876 ULARGE_INTEGER offset
,
879 ULONG
* bytesWritten
);
881 BOOL
SmallBlockChainStream_SetSize(
882 SmallBlockChainStream
* This
,
883 ULARGE_INTEGER newSize
);
885 ULARGE_INTEGER
SmallBlockChainStream_GetSize(
886 SmallBlockChainStream
* This
);
888 ULONG
SmallBlockChainStream_GetCount(
889 SmallBlockChainStream
* This
);
892 #endif /* __STORAGE32_H__ */