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__
34 #include "wine/obj_base.h"
35 #include "wine/obj_storage.h"
38 * Definitions for the file format offsets.
40 static const ULONG OFFSET_BIGBLOCKSIZEBITS
= 0x0000001e;
41 static const ULONG OFFSET_SMALLBLOCKSIZEBITS
= 0x00000020;
42 static const ULONG OFFSET_BBDEPOTCOUNT
= 0x0000002C;
43 static const ULONG OFFSET_ROOTSTARTBLOCK
= 0x00000030;
44 static const ULONG OFFSET_SBDEPOTSTART
= 0x0000003C;
45 static const ULONG OFFSET_SBDEPOTCOUNT
= 0x00000040;
46 static const ULONG OFFSET_EXTBBDEPOTSTART
= 0x00000044;
47 static const ULONG OFFSET_EXTBBDEPOTCOUNT
= 0x00000048;
48 static const ULONG OFFSET_BBDEPOTSTART
= 0x0000004C;
49 static const ULONG OFFSET_PS_NAME
= 0x00000000;
50 static const ULONG OFFSET_PS_NAMELENGTH
= 0x00000040;
51 static const ULONG OFFSET_PS_PROPERTYTYPE
= 0x00000042;
52 static const ULONG OFFSET_PS_PREVIOUSPROP
= 0x00000044;
53 static const ULONG OFFSET_PS_NEXTPROP
= 0x00000048;
54 static const ULONG OFFSET_PS_DIRPROP
= 0x0000004C;
55 static const ULONG OFFSET_PS_GUID
= 0x00000050;
56 static const ULONG OFFSET_PS_TSS1
= 0x00000064;
57 static const ULONG OFFSET_PS_TSD1
= 0x00000068;
58 static const ULONG OFFSET_PS_TSS2
= 0x0000006C;
59 static const ULONG OFFSET_PS_TSD2
= 0x00000070;
60 static const ULONG OFFSET_PS_STARTBLOCK
= 0x00000074;
61 static const ULONG OFFSET_PS_SIZE
= 0x00000078;
62 static const WORD DEF_BIG_BLOCK_SIZE_BITS
= 0x0009;
63 static const WORD DEF_SMALL_BLOCK_SIZE_BITS
= 0x0006;
64 static const WORD DEF_BIG_BLOCK_SIZE
= 0x0200;
65 static const WORD DEF_SMALL_BLOCK_SIZE
= 0x0040;
66 static const ULONG BLOCK_EXTBBDEPOT
= 0xFFFFFFFC;
67 static const ULONG BLOCK_SPECIAL
= 0xFFFFFFFD;
68 static const ULONG BLOCK_END_OF_CHAIN
= 0xFFFFFFFE;
69 static const ULONG BLOCK_UNUSED
= 0xFFFFFFFF;
70 static const ULONG PROPERTY_NULL
= 0xFFFFFFFF;
72 #define PROPERTY_NAME_MAX_LEN 0x20
73 #define PROPERTY_NAME_BUFFER_LEN 0x40
75 #define PROPSET_BLOCK_SIZE 0x00000080
78 * Property type of relation
80 #define PROPERTY_RELATION_PREVIOUS 0
81 #define PROPERTY_RELATION_NEXT 1
82 #define PROPERTY_RELATION_DIR 2
85 * Property type constants
87 #define PROPTYPE_STORAGE 0x01
88 #define PROPTYPE_STREAM 0x02
89 #define PROPTYPE_ROOT 0x05
92 * These defines assume a hardcoded blocksize. The code will assert
93 * if the blocksize is different. Some changes will have to be done if it
96 #define BIG_BLOCK_SIZE 0x200
97 #define COUNT_BBDEPOTINHEADER 109
98 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
99 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128
102 * These are signatures to detect the type of Document file.
104 static const BYTE STORAGE_magic
[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
105 static const BYTE STORAGE_oldmagic
[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
108 * Forward declarations of all the structures used by the storage
111 typedef struct StorageBaseImpl StorageBaseImpl
;
112 typedef struct StorageImpl StorageImpl
;
113 typedef struct StorageInternalImpl StorageInternalImpl
;
114 typedef struct BlockChainStream BlockChainStream
;
115 typedef struct SmallBlockChainStream SmallBlockChainStream
;
116 typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl
;
117 typedef struct StgProperty StgProperty
;
118 typedef struct StgStreamImpl StgStreamImpl
;
121 * This utility structure is used to read/write the information in a storage
126 WCHAR name
[PROPERTY_NAME_MAX_LEN
];
127 WORD sizeOfNameString
;
129 ULONG previousProperty
;
132 GUID propertyUniqueID
;
141 /*************************************************************************
142 * Big Block File support
144 * The big block file is an abstraction of a flat file separated in
145 * same sized blocks. The implementation for the methods described in
146 * this section appear in stg_bigblockfile.c
150 * Declaration of the data structures
152 typedef struct BigBlockFile BigBlockFile
,*LPBIGBLOCKFILE
;
153 typedef struct MappedPage MappedPage
,*LPMAPPEDPAGE
;
158 ULARGE_INTEGER filesize
;
164 MappedPage
*victimhead
, *victimtail
;
165 ULONG num_victim_pages
;
172 * Declaration of the functions used to manipulate the BigBlockFile
175 BigBlockFile
* BIGBLOCKFILE_Construct(HANDLE hFile
,
180 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This
);
181 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This
, ULONG index
);
182 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This
, ULONG index
);
183 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This
, void *pBlock
);
184 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This
, ULARGE_INTEGER newSize
);
185 ULARGE_INTEGER
BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This
);
187 /*************************************************************************
188 * Ole Convert support
191 void OLECONVERT_CreateOleStream(LPSTORAGE pStorage
);
192 HRESULT
OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage
, LPCSTR strOleTypeName
);
194 /****************************************************************************
195 * Storage32BaseImpl definitions.
197 * This structure defines the base information contained in all implementations
198 * of IStorage32 contained in this file storage implementation.
200 * In OOP terms, this is the base class for all the IStorage32 implementations
201 * contained in this file.
203 struct StorageBaseImpl
205 ICOM_VFIELD(IStorage
); /* Needs to be the first item in the struct
206 * since we want to cast this in a Storage32 pointer */
209 * Reference count of this object
214 * Ancestor storage (top level)
216 StorageImpl
* ancestorStorage
;
219 * Index of the property for the root of
222 ULONG rootPropertySetIndex
;
225 * virtual Destructor method.
227 void (*v_destructor
)(StorageBaseImpl
*);
232 * Prototypes for the methods of the Storage32BaseImpl class.
234 HRESULT WINAPI
StorageBaseImpl_QueryInterface(
239 ULONG WINAPI
StorageBaseImpl_AddRef(
242 ULONG WINAPI
StorageBaseImpl_Release(
245 HRESULT WINAPI
StorageBaseImpl_OpenStream(
247 const OLECHAR
* pwcsName
, /* [string][in] */
248 void* reserved1
, /* [unique][in] */
249 DWORD grfMode
, /* [in] */
250 DWORD reserved2
, /* [in] */
251 IStream
** ppstm
); /* [out] */
253 HRESULT WINAPI
StorageBaseImpl_OpenStorage(
255 const OLECHAR
* pwcsName
, /* [string][unique][in] */
256 IStorage
* pstgPriority
, /* [unique][in] */
257 DWORD grfMode
, /* [in] */
258 SNB snbExclude
, /* [unique][in] */
259 DWORD reserved
, /* [in] */
260 IStorage
** ppstg
); /* [out] */
262 HRESULT WINAPI
StorageBaseImpl_EnumElements(
264 DWORD reserved1
, /* [in] */
265 void* reserved2
, /* [size_is][unique][in] */
266 DWORD reserved3
, /* [in] */
267 IEnumSTATSTG
** ppenum
); /* [out] */
269 HRESULT WINAPI
StorageBaseImpl_Stat(
271 STATSTG
* pstatstg
, /* [out] */
272 DWORD grfStatFlag
); /* [in] */
274 HRESULT WINAPI
StorageBaseImpl_RenameElement(
276 const OLECHAR
* pwcsOldName
, /* [string][in] */
277 const OLECHAR
* pwcsNewName
); /* [string][in] */
279 HRESULT WINAPI
StorageBaseImpl_CreateStream(
281 const OLECHAR
* pwcsName
, /* [string][in] */
282 DWORD grfMode
, /* [in] */
283 DWORD reserved1
, /* [in] */
284 DWORD reserved2
, /* [in] */
285 IStream
** ppstm
); /* [out] */
287 HRESULT WINAPI
StorageBaseImpl_SetClass(
289 REFCLSID clsid
); /* [in] */
291 /****************************************************************************
292 * Storage32Impl definitions.
294 * This implementation of the IStorage32 interface represents a root
295 * storage. Basically, a document file.
299 ICOM_VFIELD(IStorage
); /* Needs to be the first item in the struct
300 * since we want to cast this in a Storage32 pointer */
303 * Declare the member of the Storage32BaseImpl class to allow
304 * casting as a Storage32BaseImpl
307 struct StorageImpl
* ancestorStorage
;
308 ULONG rootPropertySetIndex
;
309 void (*v_destructor
)(struct StorageImpl
*);
312 * The following data members are specific to the Storage32Impl
315 HANDLE hFile
; /* Physical support for the Docfile */
316 LPOLESTR pwcsName
; /* Full path of the document file */
318 /* FIXME: should this be in Storage32BaseImpl ? */
319 WCHAR filename
[PROPERTY_NAME_BUFFER_LEN
];
324 WORD bigBlockSizeBits
;
325 WORD smallBlockSizeBits
;
327 ULONG smallBlockSize
;
328 ULONG bigBlockDepotCount
;
329 ULONG rootStartBlock
;
330 ULONG smallBlockDepotStart
;
331 ULONG extBigBlockDepotStart
;
332 ULONG extBigBlockDepotCount
;
333 ULONG bigBlockDepotStart
[COUNT_BBDEPOTINHEADER
];
335 ULONG blockDepotCached
[NUM_BLOCKS_PER_DEPOT_BLOCK
];
336 ULONG indexBlockDepotCached
;
340 * Abstraction of the big block chains for the chains of the header.
342 BlockChainStream
* rootBlockChain
;
343 BlockChainStream
* smallBlockDepotChain
;
344 BlockChainStream
* smallBlockRootChain
;
347 * Pointer to the big block file abstraction
349 BigBlockFile
* bigBlockFile
;
353 * Method declaration for the Storage32Impl class
356 HRESULT WINAPI
StorageImpl_CreateStorage(
358 const OLECHAR
* pwcsName
, /* [string][in] */
359 DWORD grfMode
, /* [in] */
360 DWORD dwStgFmt
, /* [in] */
361 DWORD reserved2
, /* [in] */
362 IStorage
** ppstg
); /* [out] */
364 HRESULT WINAPI
StorageImpl_CopyTo(
366 DWORD ciidExclude
, /* [in] */
367 const IID
* rgiidExclude
, /* [size_is][unique][in] */
368 SNB snbExclude
, /* [unique][in] */
369 IStorage
* pstgDest
); /* [unique][in] */
371 HRESULT WINAPI
StorageImpl_MoveElementTo(
373 const OLECHAR
* pwcsName
, /* [string][in] */
374 IStorage
* pstgDest
, /* [unique][in] */
375 const OLECHAR
* pwcsNewName
, /* [string][in] */
376 DWORD grfFlags
); /* [in] */
378 HRESULT WINAPI
StorageImpl_Commit(
380 DWORD grfCommitFlags
); /* [in] */
382 HRESULT WINAPI
StorageImpl_Revert(
385 HRESULT WINAPI
StorageImpl_DestroyElement(
387 const OLECHAR
* pwcsName
); /* [string][in] */
389 HRESULT WINAPI
StorageImpl_SetElementTimes(
391 const OLECHAR
* pwcsName
, /* [string][in] */
392 const FILETIME
* pctime
, /* [in] */
393 const FILETIME
* patime
, /* [in] */
394 const FILETIME
* pmtime
); /* [in] */
396 HRESULT WINAPI
StorageImpl_SetStateBits(
398 DWORD grfStateBits
, /* [in] */
399 DWORD grfMask
); /* [in] */
401 HRESULT WINAPI
StorageImpl_Stat(IStorage
* iface
,
402 STATSTG
* pstatstg
, /* [out] */
403 DWORD grfStatFlag
); /* [in] */
405 void StorageImpl_Destroy(
408 HRESULT
StorageImpl_Construct(
417 BOOL
StorageImpl_ReadBigBlock(
422 BOOL
StorageImpl_WriteBigBlock(
427 void* StorageImpl_GetROBigBlock(
431 void* StorageImpl_GetBigBlock(
435 void StorageImpl_ReleaseBigBlock(
439 ULONG
StorageImpl_GetNextFreeBigBlock(
442 void StorageImpl_FreeBigBlock(
446 HRESULT
StorageImpl_GetNextBlockInChain(
449 ULONG
* nextBlockIndex
);
451 void StorageImpl_SetNextBlockInChain(
456 HRESULT
StorageImpl_LoadFileHeader(
459 void StorageImpl_SaveFileHeader(
462 BOOL
StorageImpl_ReadProperty(
465 StgProperty
* buffer
);
467 BOOL
StorageImpl_WriteProperty(
470 StgProperty
* buffer
);
472 BlockChainStream
* Storage32Impl_SmallBlocksToBigBlocks(
474 SmallBlockChainStream
** ppsbChain
);
476 ULONG
Storage32Impl_GetNextExtendedBlock(StorageImpl
* This
,
479 void Storage32Impl_AddBlockDepot(StorageImpl
* This
,
482 ULONG
Storage32Impl_AddExtBlockDepot(StorageImpl
* This
);
484 ULONG
Storage32Impl_GetExtDepotBlock(StorageImpl
* This
,
487 void Storage32Impl_SetExtDepotBlock(StorageImpl
* This
,
490 /****************************************************************************
491 * Storage32InternalImpl definitions.
493 * Definition of the implementation structure for the IStorage32 interface.
494 * This one implements the IStorage32 interface for storage that are
495 * inside another storage.
497 struct StorageInternalImpl
499 ICOM_VFIELD(IStorage
); /* Needs to be the first item in the struct
500 * since we want to cast this in a Storage32 pointer */
503 * Declare the member of the Storage32BaseImpl class to allow
504 * casting as a Storage32BaseImpl
507 struct StorageImpl
* ancestorStorage
;
508 ULONG rootPropertySetIndex
;
509 void (*v_destructor
)(struct StorageInternalImpl
*);
512 * There is no specific data for this class.
517 * Method definitions for the Storage32InternalImpl class.
519 StorageInternalImpl
* StorageInternalImpl_Construct(
520 StorageImpl
* ancestorStorage
,
521 ULONG rootTropertyIndex
);
523 void StorageInternalImpl_Destroy(
524 StorageInternalImpl
* This
);
526 HRESULT WINAPI
StorageInternalImpl_Commit(
528 DWORD grfCommitFlags
); /* [in] */
530 HRESULT WINAPI
StorageInternalImpl_Revert(
534 /****************************************************************************
535 * IEnumSTATSTGImpl definitions.
537 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
538 * This class allows iterating through the content of a storage and to find
539 * specific items inside it.
541 struct IEnumSTATSTGImpl
543 ICOM_VFIELD(IEnumSTATSTG
); /* Needs to be the first item in the struct
544 * since we want to cast this in a IEnumSTATSTG pointer */
546 ULONG ref
; /* Reference count */
547 StorageImpl
* parentStorage
; /* Reference to the parent storage */
548 ULONG firstPropertyNode
; /* Index of the root of the storage to enumerate */
551 * The current implementation of the IEnumSTATSTGImpl class uses a stack
552 * to walk the property sets to get the content of a storage. This stack
553 * is implemented by the following 3 data members
559 #define ENUMSTATSGT_SIZE_INCREMENT 10
563 * Method definitions for the IEnumSTATSTGImpl class.
565 HRESULT WINAPI
IEnumSTATSTGImpl_QueryInterface(
570 ULONG WINAPI
IEnumSTATSTGImpl_AddRef(
571 IEnumSTATSTG
* iface
);
573 ULONG WINAPI
IEnumSTATSTGImpl_Release(
574 IEnumSTATSTG
* iface
);
576 HRESULT WINAPI
IEnumSTATSTGImpl_Next(
580 ULONG
* pceltFetched
);
582 HRESULT WINAPI
IEnumSTATSTGImpl_Skip(
586 HRESULT WINAPI
IEnumSTATSTGImpl_Reset(
587 IEnumSTATSTG
* iface
);
589 HRESULT WINAPI
IEnumSTATSTGImpl_Clone(
591 IEnumSTATSTG
** ppenum
);
593 IEnumSTATSTGImpl
* IEnumSTATSTGImpl_Construct(
595 ULONG firstPropertyNode
);
597 void IEnumSTATSTGImpl_Destroy(
598 IEnumSTATSTGImpl
* This
);
600 void IEnumSTATSTGImpl_PushSearchNode(
601 IEnumSTATSTGImpl
* This
,
604 ULONG
IEnumSTATSTGImpl_PopSearchNode(
605 IEnumSTATSTGImpl
* This
,
608 ULONG
IEnumSTATSTGImpl_FindProperty(
609 IEnumSTATSTGImpl
* This
,
610 const OLECHAR
* lpszPropName
,
611 StgProperty
* buffer
);
613 INT
IEnumSTATSTGImpl_FindParentProperty(
614 IEnumSTATSTGImpl
*This
,
616 StgProperty
*currentProperty
,
620 /****************************************************************************
621 * StgStreamImpl definitions.
623 * This class imlements the IStream32 inteface and represents a stream
624 * located inside a storage object.
628 ICOM_VFIELD(IStream
); /* Needs to be the first item in the struct
629 * since we want to cast this in a IStream pointer */
637 * Storage that is the parent(owner) of the stream
639 StorageBaseImpl
* parentStorage
;
642 * Access mode of this stream.
647 * Index of the property that owns (points to) this stream.
652 * Helper variable that contains the size of the stream
654 ULARGE_INTEGER streamSize
;
657 * This is the current position of the cursor in the stream
659 ULARGE_INTEGER currentPosition
;
662 * The information in the stream is represented by a chain of small blocks
663 * or a chain of large blocks. Depending on the case, one of the two
664 * following variabled points to that information.
666 BlockChainStream
* bigBlockChain
;
667 SmallBlockChainStream
* smallBlockChain
;
671 * Method definition for the StgStreamImpl class.
673 StgStreamImpl
* StgStreamImpl_Construct(
674 StorageBaseImpl
* parentStorage
,
676 ULONG ownerProperty
);
678 void StgStreamImpl_Destroy(
679 StgStreamImpl
* This
);
681 void StgStreamImpl_OpenBlockChain(
682 StgStreamImpl
* This
);
684 HRESULT WINAPI
StgStreamImpl_QueryInterface(
686 REFIID riid
, /* [in] */
687 void** ppvObject
); /* [iid_is][out] */
689 ULONG WINAPI
StgStreamImpl_AddRef(
692 ULONG WINAPI
StgStreamImpl_Release(
695 HRESULT WINAPI
StgStreamImpl_Read(
697 void* pv
, /* [length_is][size_is][out] */
699 ULONG
* pcbRead
); /* [out] */
701 HRESULT WINAPI
StgStreamImpl_Write(
703 const void* pv
, /* [size_is][in] */
705 ULONG
* pcbWritten
); /* [out] */
707 HRESULT WINAPI
StgStreamImpl_Seek(
709 LARGE_INTEGER dlibMove
, /* [in] */
710 DWORD dwOrigin
, /* [in] */
711 ULARGE_INTEGER
* plibNewPosition
); /* [out] */
713 HRESULT WINAPI
StgStreamImpl_SetSize(
715 ULARGE_INTEGER libNewSize
); /* [in] */
717 HRESULT WINAPI
StgStreamImpl_CopyTo(
719 IStream
* pstm
, /* [unique][in] */
720 ULARGE_INTEGER cb
, /* [in] */
721 ULARGE_INTEGER
* pcbRead
, /* [out] */
722 ULARGE_INTEGER
* pcbWritten
); /* [out] */
724 HRESULT WINAPI
StgStreamImpl_Commit(
726 DWORD grfCommitFlags
); /* [in] */
728 HRESULT WINAPI
StgStreamImpl_Revert(
731 HRESULT WINAPI
StgStreamImpl_LockRegion(
733 ULARGE_INTEGER libOffset
, /* [in] */
734 ULARGE_INTEGER cb
, /* [in] */
735 DWORD dwLockType
); /* [in] */
737 HRESULT WINAPI
StgStreamImpl_UnlockRegion(
739 ULARGE_INTEGER libOffset
, /* [in] */
740 ULARGE_INTEGER cb
, /* [in] */
741 DWORD dwLockType
); /* [in] */
743 HRESULT WINAPI
StgStreamImpl_Stat(
745 STATSTG
* pstatstg
, /* [out] */
746 DWORD grfStatFlag
); /* [in] */
748 HRESULT WINAPI
StgStreamImpl_Clone(
750 IStream
** ppstm
); /* [out] */
753 /********************************************************************************
754 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
755 * abstractions used to read values from file buffers without having to worry
758 void StorageUtl_ReadWord(void* buffer
, ULONG offset
, WORD
* value
);
759 void StorageUtl_WriteWord(void* buffer
, ULONG offset
, WORD value
);
760 void StorageUtl_ReadDWord(void* buffer
, ULONG offset
, DWORD
* value
);
761 void StorageUtl_WriteDWord(void* buffer
, ULONG offset
, DWORD value
);
762 void StorageUtl_ReadGUID(void* buffer
, ULONG offset
, GUID
* value
);
763 void StorageUtl_WriteGUID(void* buffer
, ULONG offset
, GUID
* value
);
764 void StorageUtl_CopyPropertyToSTATSTG(STATSTG
* destination
,
768 /****************************************************************************
769 * BlockChainStream definitions.
771 * The BlockChainStream class is a utility class that is used to create an
772 * abstraction of the big block chains in the storage file.
774 struct BlockChainStream
776 StorageImpl
* parentStorage
;
777 ULONG
* headOfStreamPlaceHolder
;
778 ULONG ownerPropertyIndex
;
779 ULONG lastBlockNoInSequence
;
780 ULONG lastBlockNoInSequenceIndex
;
786 * Methods for the BlockChainStream class.
788 BlockChainStream
* BlockChainStream_Construct(
789 StorageImpl
* parentStorage
,
790 ULONG
* headOfStreamPlaceHolder
,
791 ULONG propertyIndex
);
793 void BlockChainStream_Destroy(
794 BlockChainStream
* This
);
796 ULONG
BlockChainStream_GetHeadOfChain(
797 BlockChainStream
* This
);
799 BOOL
BlockChainStream_ReadAt(
800 BlockChainStream
* This
,
801 ULARGE_INTEGER offset
,
806 BOOL
BlockChainStream_WriteAt(
807 BlockChainStream
* This
,
808 ULARGE_INTEGER offset
,
811 ULONG
* bytesWritten
);
813 BOOL
BlockChainStream_SetSize(
814 BlockChainStream
* This
,
815 ULARGE_INTEGER newSize
);
817 ULARGE_INTEGER
BlockChainStream_GetSize(
818 BlockChainStream
* This
);
820 ULONG
BlockChainStream_GetCount(
821 BlockChainStream
* This
);
823 /****************************************************************************
824 * SmallBlockChainStream definitions.
826 * The SmallBlockChainStream class is a utility class that is used to create an
827 * abstraction of the small block chains in the storage file.
829 struct SmallBlockChainStream
831 StorageImpl
* parentStorage
;
832 ULONG ownerPropertyIndex
;
836 * Methods of the SmallBlockChainStream class.
838 SmallBlockChainStream
* SmallBlockChainStream_Construct(
839 StorageImpl
* parentStorage
,
840 ULONG propertyIndex
);
842 void SmallBlockChainStream_Destroy(
843 SmallBlockChainStream
* This
);
845 ULONG
SmallBlockChainStream_GetHeadOfChain(
846 SmallBlockChainStream
* This
);
848 HRESULT
SmallBlockChainStream_GetNextBlockInChain(
849 SmallBlockChainStream
* This
,
851 ULONG
* nextBlockIndex
);
853 void SmallBlockChainStream_SetNextBlockInChain(
854 SmallBlockChainStream
* This
,
858 void SmallBlockChainStream_FreeBlock(
859 SmallBlockChainStream
* This
,
862 ULONG
SmallBlockChainStream_GetNextFreeBlock(
863 SmallBlockChainStream
* This
);
865 BOOL
SmallBlockChainStream_ReadAt(
866 SmallBlockChainStream
* This
,
867 ULARGE_INTEGER offset
,
872 BOOL
SmallBlockChainStream_WriteAt(
873 SmallBlockChainStream
* This
,
874 ULARGE_INTEGER offset
,
877 ULONG
* bytesWritten
);
879 BOOL
SmallBlockChainStream_SetSize(
880 SmallBlockChainStream
* This
,
881 ULARGE_INTEGER newSize
);
883 ULARGE_INTEGER
SmallBlockChainStream_GetSize(
884 SmallBlockChainStream
* This
);
886 ULONG
SmallBlockChainStream_GetCount(
887 SmallBlockChainStream
* This
);
890 #endif /* __STORAGE32_H__ */