Added support for WODM_BREAKLOOP message.
[wine.git] / dlls / ole32 / storage32.h
blob564efbf19fe0862368a47cabf538b21c4e9ba24b
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__
18 #include "wtypes.h"
19 #include "winnt.h"
20 #include "wine/obj_storage.h"
23 * Definitions for the file format offsets.
25 static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
26 static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
27 static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
28 static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
29 static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
30 static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
31 static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048;
32 static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C;
33 static const ULONG OFFSET_PS_NAME = 0x00000000;
34 static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040;
35 static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042;
36 static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044;
37 static const ULONG OFFSET_PS_NEXTPROP = 0x00000048;
38 static const ULONG OFFSET_PS_DIRPROP = 0x0000004C;
39 static const ULONG OFFSET_PS_GUID = 0x00000050;
40 static const ULONG OFFSET_PS_TSS1 = 0x00000064;
41 static const ULONG OFFSET_PS_TSD1 = 0x00000068;
42 static const ULONG OFFSET_PS_TSS2 = 0x0000006C;
43 static const ULONG OFFSET_PS_TSD2 = 0x00000070;
44 static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
45 static const ULONG OFFSET_PS_SIZE = 0x00000078;
46 static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
47 static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
48 static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
49 static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
50 static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
51 static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
52 static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;
53 static const ULONG BLOCK_UNUSED = 0xFFFFFFFF;
54 static const ULONG PROPERTY_NULL = 0xFFFFFFFF;
56 #define PROPERTY_NAME_MAX_LEN 0x20
57 #define PROPERTY_NAME_BUFFER_LEN 0x40
59 #define PROPSET_BLOCK_SIZE 0x00000080
62 * Property type of relation
64 #define PROPERTY_RELATION_PREVIOUS 0
65 #define PROPERTY_RELATION_NEXT 1
66 #define PROPERTY_RELATION_DIR 2
69 * Property type constants
71 #define PROPTYPE_STORAGE 0x01
72 #define PROPTYPE_STREAM 0x02
73 #define PROPTYPE_ROOT 0x05
76 * These defines assume a hardcoded blocksize. The code will assert
77 * if the blocksize is different. Some changes will have to be done if it
78 * becomes the case.
80 #define BIG_BLOCK_SIZE 0x200
81 #define COUNT_BBDEPOTINHEADER 109
82 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
83 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128
86 * These are signatures to detect the type of Document file.
88 static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
89 static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
92 * Forward declarations of all the structures used by the storage
93 * module.
95 typedef struct StorageBaseImpl StorageBaseImpl;
96 typedef struct StorageImpl StorageImpl;
97 typedef struct StorageInternalImpl StorageInternalImpl;
98 typedef struct BlockChainStream BlockChainStream;
99 typedef struct SmallBlockChainStream SmallBlockChainStream;
100 typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
101 typedef struct StgProperty StgProperty;
102 typedef struct StgStreamImpl StgStreamImpl;
105 * This utility structure is used to read/write the information in a storage
106 * property.
108 struct StgProperty
110 WCHAR name[PROPERTY_NAME_MAX_LEN];
111 WORD sizeOfNameString;
112 BYTE propertyType;
113 ULONG previousProperty;
114 ULONG nextProperty;
115 ULONG dirProperty;
116 GUID propertyUniqueID;
117 ULONG timeStampS1;
118 ULONG timeStampD1;
119 ULONG timeStampS2;
120 ULONG timeStampD2;
121 ULONG startingBlock;
122 ULARGE_INTEGER size;
125 /*************************************************************************
126 * Big Block File support
128 * The big block file is an abstraction of a flat file separated in
129 * same sized blocks. The implementation for the methods described in
130 * this section appear in stg_bigblockfile.c
134 * Declaration of the data structures
136 typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
137 typedef struct MappedPage MappedPage,*LPMAPPEDPAGE;
138 typedef struct BigBlock BigBlock,*LPBIGBLOCK;
140 struct BigBlockFile
142 BOOL fileBased;
143 ULARGE_INTEGER filesize;
144 ULONG blocksize;
145 HANDLE hfile;
146 HANDLE hfilemap;
147 DWORD flProtect;
148 MappedPage *maplisthead;
149 ILockBytes *pLkbyt;
150 HGLOBAL hbytearray;
151 LPVOID pbytearray;
152 BigBlock *headblock;
156 * Declaration of the functions used to manipulate the BigBlockFile
157 * data structure.
159 BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
160 ILockBytes* pLkByt,
161 DWORD openFlags,
162 ULONG blocksize,
163 BOOL fileBased);
164 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
165 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
166 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
167 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
168 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
169 ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
171 /****************************************************************************
172 * Storage32BaseImpl definitions.
174 * This stucture defines the base information contained in all implementations
175 * of IStorage32 contained in this filee storage implementation.
177 * In OOP terms, this is the base class for all the IStorage32 implementations
178 * contained in this file.
180 struct StorageBaseImpl
182 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
183 * since we want to cast this in a Storage32 pointer */
186 * Reference count of this object
188 ULONG ref;
191 * Ancestor storage (top level)
193 StorageImpl* ancestorStorage;
196 * Index of the property for the root of
197 * this storage
199 ULONG rootPropertySetIndex;
202 * virtual Destructor method.
204 void (*v_destructor)(StorageBaseImpl*);
209 * Prototypes for the methods of the Storage32BaseImpl class.
211 HRESULT WINAPI StorageBaseImpl_QueryInterface(
212 IStorage* iface,
213 REFIID riid,
214 void** ppvObject);
216 ULONG WINAPI StorageBaseImpl_AddRef(
217 IStorage* iface);
219 ULONG WINAPI StorageBaseImpl_Release(
220 IStorage* iface);
222 HRESULT WINAPI StorageBaseImpl_OpenStream(
223 IStorage* iface,
224 const OLECHAR* pwcsName, /* [string][in] */
225 void* reserved1, /* [unique][in] */
226 DWORD grfMode, /* [in] */
227 DWORD reserved2, /* [in] */
228 IStream** ppstm); /* [out] */
230 HRESULT WINAPI StorageBaseImpl_OpenStorage(
231 IStorage* iface,
232 const OLECHAR* pwcsName, /* [string][unique][in] */
233 IStorage* pstgPriority, /* [unique][in] */
234 DWORD grfMode, /* [in] */
235 SNB snbExclude, /* [unique][in] */
236 DWORD reserved, /* [in] */
237 IStorage** ppstg); /* [out] */
239 HRESULT WINAPI StorageBaseImpl_EnumElements(
240 IStorage* iface,
241 DWORD reserved1, /* [in] */
242 void* reserved2, /* [size_is][unique][in] */
243 DWORD reserved3, /* [in] */
244 IEnumSTATSTG** ppenum); /* [out] */
246 HRESULT WINAPI StorageBaseImpl_Stat(
247 IStorage* iface,
248 STATSTG* pstatstg, /* [out] */
249 DWORD grfStatFlag); /* [in] */
251 HRESULT WINAPI StorageBaseImpl_RenameElement(
252 IStorage* iface,
253 const OLECHAR* pwcsOldName, /* [string][in] */
254 const OLECHAR* pwcsNewName); /* [string][in] */
256 HRESULT WINAPI StorageBaseImpl_CreateStream(
257 IStorage* iface,
258 const OLECHAR* pwcsName, /* [string][in] */
259 DWORD grfMode, /* [in] */
260 DWORD reserved1, /* [in] */
261 DWORD reserved2, /* [in] */
262 IStream** ppstm); /* [out] */
264 HRESULT WINAPI StorageBaseImpl_SetClass(
265 IStorage* iface,
266 REFCLSID clsid); /* [in] */
268 /****************************************************************************
269 * Storage32Impl definitions.
271 * This implementation of the IStorage32 interface represents a root
272 * storage. Basically, a document file.
274 struct StorageImpl
276 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
277 * since we want to cast this in a Storage32 pointer */
280 * Declare the member of the Storage32BaseImpl class to allow
281 * casting as a Storage32BaseImpl
283 ULONG ref;
284 struct StorageImpl* ancestorStorage;
285 ULONG rootPropertySetIndex;
286 void (*v_destructor)(struct StorageImpl*);
289 * The following data members are specific to the Storage32Impl
290 * class
292 HANDLE hFile; /* Physical support for the Docfile */
295 * File header
297 WORD bigBlockSizeBits;
298 WORD smallBlockSizeBits;
299 ULONG bigBlockSize;
300 ULONG smallBlockSize;
301 ULONG bigBlockDepotCount;
302 ULONG rootStartBlock;
303 ULONG smallBlockDepotStart;
304 ULONG extBigBlockDepotStart;
305 ULONG extBigBlockDepotCount;
306 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
308 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
309 ULONG indexBlockDepotCached;
310 ULONG prevFreeBlock;
313 * Abstraction of the big block chains for the chains of the header.
315 BlockChainStream* rootBlockChain;
316 BlockChainStream* smallBlockDepotChain;
317 BlockChainStream* smallBlockRootChain;
320 * Pointer to the big block file abstraction
322 BigBlockFile* bigBlockFile;
326 * Method declaration for the Storage32Impl class
329 HRESULT WINAPI StorageImpl_CreateStorage(
330 IStorage* iface,
331 const OLECHAR* pwcsName, /* [string][in] */
332 DWORD grfMode, /* [in] */
333 DWORD dwStgFmt, /* [in] */
334 DWORD reserved2, /* [in] */
335 IStorage** ppstg); /* [out] */
337 HRESULT WINAPI StorageImpl_CopyTo(
338 IStorage* iface,
339 DWORD ciidExclude, /* [in] */
340 const IID* rgiidExclude, /* [size_is][unique][in] */
341 SNB snbExclude, /* [unique][in] */
342 IStorage* pstgDest); /* [unique][in] */
344 HRESULT WINAPI StorageImpl_MoveElementTo(
345 IStorage* iface,
346 const OLECHAR* pwcsName, /* [string][in] */
347 IStorage* pstgDest, /* [unique][in] */
348 const OLECHAR* pwcsNewName, /* [string][in] */
349 DWORD grfFlags); /* [in] */
351 HRESULT WINAPI StorageImpl_Commit(
352 IStorage* iface,
353 DWORD grfCommitFlags); /* [in] */
355 HRESULT WINAPI StorageImpl_Revert(
356 IStorage* iface);
358 HRESULT WINAPI StorageImpl_DestroyElement(
359 IStorage* iface,
360 const OLECHAR* pwcsName); /* [string][in] */
362 HRESULT WINAPI StorageImpl_SetElementTimes(
363 IStorage* iface,
364 const OLECHAR* pwcsName, /* [string][in] */
365 const FILETIME* pctime, /* [in] */
366 const FILETIME* patime, /* [in] */
367 const FILETIME* pmtime); /* [in] */
369 HRESULT WINAPI StorageImpl_SetStateBits(
370 IStorage* iface,
371 DWORD grfStateBits, /* [in] */
372 DWORD grfMask); /* [in] */
374 void StorageImpl_Destroy(
375 StorageImpl* This);
377 HRESULT StorageImpl_Construct(
378 StorageImpl* This,
379 HANDLE hFile,
380 ILockBytes* pLkbyt,
381 DWORD openFlags,
382 BOOL fileBased);
384 BOOL StorageImpl_ReadBigBlock(
385 StorageImpl* This,
386 ULONG blockIndex,
387 void* buffer);
389 BOOL StorageImpl_WriteBigBlock(
390 StorageImpl* This,
391 ULONG blockIndex,
392 void* buffer);
394 void* StorageImpl_GetROBigBlock(
395 StorageImpl* This,
396 ULONG blockIndex);
398 void* StorageImpl_GetBigBlock(
399 StorageImpl* This,
400 ULONG blockIndex);
402 void StorageImpl_ReleaseBigBlock(
403 StorageImpl* This,
404 void* pBigBlock);
406 ULONG StorageImpl_GetNextFreeBigBlock(
407 StorageImpl* This);
409 void StorageImpl_FreeBigBlock(
410 StorageImpl* This,
411 ULONG blockIndex);
413 ULONG StorageImpl_GetNextBlockInChain(
414 StorageImpl* This,
415 ULONG blockIndex);
417 void StorageImpl_SetNextBlockInChain(
418 StorageImpl* This,
419 ULONG blockIndex,
420 ULONG nextBlock);
422 HRESULT StorageImpl_LoadFileHeader(
423 StorageImpl* This);
425 void StorageImpl_SaveFileHeader(
426 StorageImpl* This);
428 BOOL StorageImpl_ReadProperty(
429 StorageImpl* This,
430 ULONG index,
431 StgProperty* buffer);
433 BOOL StorageImpl_WriteProperty(
434 StorageImpl* This,
435 ULONG index,
436 StgProperty* buffer);
438 BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
439 StorageImpl* This,
440 SmallBlockChainStream** ppsbChain);
442 ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
443 ULONG blockIndex);
445 void Storage32Impl_AddBlockDepot(StorageImpl* This,
446 ULONG blockIndex);
448 ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
450 ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
451 ULONG depotIndex);
453 void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
454 ULONG depotIndex,
455 ULONG blockIndex);
456 /****************************************************************************
457 * Storage32InternalImpl definitions.
459 * Definition of the implementation structure for the IStorage32 interface.
460 * This one implements the IStorage32 interface for storage that are
461 * inside another storage.
463 struct StorageInternalImpl
465 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
466 * since we want to cast this in a Storage32 pointer */
469 * Declare the member of the Storage32BaseImpl class to allow
470 * casting as a Storage32BaseImpl
472 ULONG ref;
473 struct StorageImpl* ancestorStorage;
474 ULONG rootPropertySetIndex;
475 void (*v_destructor)(struct StorageInternalImpl*);
478 * There is no specific data for this class.
483 * Method definitions for the Storage32InternalImpl class.
485 StorageInternalImpl* StorageInternalImpl_Construct(
486 StorageImpl* ancestorStorage,
487 ULONG rootTropertyIndex);
489 void StorageInternalImpl_Destroy(
490 StorageInternalImpl* This);
492 HRESULT WINAPI StorageInternalImpl_Commit(
493 IStorage* iface,
494 DWORD grfCommitFlags); /* [in] */
496 HRESULT WINAPI StorageInternalImpl_Revert(
497 IStorage* iface);
500 /****************************************************************************
501 * IEnumSTATSTGImpl definitions.
503 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
504 * This class allows iterating through the content of a storage and to find
505 * specific items inside it.
507 struct IEnumSTATSTGImpl
509 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct
510 * since we want to cast this in a IEnumSTATSTG pointer */
512 ULONG ref; /* Reference count */
513 StorageImpl* parentStorage; /* Reference to the parent storage */
514 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
517 * The current implementation of the IEnumSTATSTGImpl class uses a stack
518 * to walk the property sets to get the content of a storage. This stack
519 * is implemented by the following 3 data members
521 ULONG stackSize;
522 ULONG stackMaxSize;
523 ULONG* stackToVisit;
525 #define ENUMSTATSGT_SIZE_INCREMENT 10
529 * Method definitions for the IEnumSTATSTGImpl class.
531 HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
532 IEnumSTATSTG* iface,
533 REFIID riid,
534 void** ppvObject);
536 ULONG WINAPI IEnumSTATSTGImpl_AddRef(
537 IEnumSTATSTG* iface);
539 ULONG WINAPI IEnumSTATSTGImpl_Release(
540 IEnumSTATSTG* iface);
542 HRESULT WINAPI IEnumSTATSTGImpl_Next(
543 IEnumSTATSTG* iface,
544 ULONG celt,
545 STATSTG* rgelt,
546 ULONG* pceltFetched);
548 HRESULT WINAPI IEnumSTATSTGImpl_Skip(
549 IEnumSTATSTG* iface,
550 ULONG celt);
552 HRESULT WINAPI IEnumSTATSTGImpl_Reset(
553 IEnumSTATSTG* iface);
555 HRESULT WINAPI IEnumSTATSTGImpl_Clone(
556 IEnumSTATSTG* iface,
557 IEnumSTATSTG** ppenum);
559 IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
560 StorageImpl* This,
561 ULONG firstPropertyNode);
563 void IEnumSTATSTGImpl_Destroy(
564 IEnumSTATSTGImpl* This);
566 void IEnumSTATSTGImpl_PushSearchNode(
567 IEnumSTATSTGImpl* This,
568 ULONG nodeToPush);
570 ULONG IEnumSTATSTGImpl_PopSearchNode(
571 IEnumSTATSTGImpl* This,
572 BOOL remove);
574 ULONG IEnumSTATSTGImpl_FindProperty(
575 IEnumSTATSTGImpl* This,
576 const OLECHAR* lpszPropName,
577 StgProperty* buffer);
579 INT IEnumSTATSTGImpl_FindParentProperty(
580 IEnumSTATSTGImpl *This,
581 ULONG childProperty,
582 StgProperty *currentProperty,
583 ULONG *propertyId);
586 /****************************************************************************
587 * StgStreamImpl definitions.
589 * This class imlements the IStream32 inteface and represents a stream
590 * located inside a storage object.
592 struct StgStreamImpl
594 ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct
595 * since we want to cast this in a IStream pointer */
598 * Reference count
600 ULONG ref;
603 * Storage that is the parent(owner) of the stream
605 StorageBaseImpl* parentStorage;
608 * Index of the property that owns (points to) this stream.
610 ULONG ownerProperty;
613 * Helper variable that contains the size of the stream
615 ULARGE_INTEGER streamSize;
618 * This is the current position of the cursor in the stream
620 ULARGE_INTEGER currentPosition;
623 * The information in the stream is represented by a chain of small blocks
624 * or a chain of large blocks. Depending on the case, one of the two
625 * following variabled points to that information.
627 BlockChainStream* bigBlockChain;
628 SmallBlockChainStream* smallBlockChain;
633 * Method definition for the StgStreamImpl class.
635 StgStreamImpl* StgStreamImpl_Construct(
636 StorageBaseImpl* parentStorage,
637 ULONG ownerProperty);
639 void StgStreamImpl_Destroy(
640 StgStreamImpl* This);
642 void StgStreamImpl_OpenBlockChain(
643 StgStreamImpl* This);
645 HRESULT WINAPI StgStreamImpl_QueryInterface(
646 IStream* iface,
647 REFIID riid, /* [in] */
648 void** ppvObject); /* [iid_is][out] */
650 ULONG WINAPI StgStreamImpl_AddRef(
651 IStream* iface);
653 ULONG WINAPI StgStreamImpl_Release(
654 IStream* iface);
656 HRESULT WINAPI StgStreamImpl_Read(
657 IStream* iface,
658 void* pv, /* [length_is][size_is][out] */
659 ULONG cb, /* [in] */
660 ULONG* pcbRead); /* [out] */
662 HRESULT WINAPI StgStreamImpl_Write(
663 IStream* iface,
664 const void* pv, /* [size_is][in] */
665 ULONG cb, /* [in] */
666 ULONG* pcbWritten); /* [out] */
668 HRESULT WINAPI StgStreamImpl_Seek(
669 IStream* iface,
670 LARGE_INTEGER dlibMove, /* [in] */
671 DWORD dwOrigin, /* [in] */
672 ULARGE_INTEGER* plibNewPosition); /* [out] */
674 HRESULT WINAPI StgStreamImpl_SetSize(
675 IStream* iface,
676 ULARGE_INTEGER libNewSize); /* [in] */
678 HRESULT WINAPI StgStreamImpl_CopyTo(
679 IStream* iface,
680 IStream* pstm, /* [unique][in] */
681 ULARGE_INTEGER cb, /* [in] */
682 ULARGE_INTEGER* pcbRead, /* [out] */
683 ULARGE_INTEGER* pcbWritten); /* [out] */
685 HRESULT WINAPI StgStreamImpl_Commit(
686 IStream* iface,
687 DWORD grfCommitFlags); /* [in] */
689 HRESULT WINAPI StgStreamImpl_Revert(
690 IStream* iface);
692 HRESULT WINAPI StgStreamImpl_LockRegion(
693 IStream* iface,
694 ULARGE_INTEGER libOffset, /* [in] */
695 ULARGE_INTEGER cb, /* [in] */
696 DWORD dwLockType); /* [in] */
698 HRESULT WINAPI StgStreamImpl_UnlockRegion(
699 IStream* iface,
700 ULARGE_INTEGER libOffset, /* [in] */
701 ULARGE_INTEGER cb, /* [in] */
702 DWORD dwLockType); /* [in] */
704 HRESULT WINAPI StgStreamImpl_Stat(
705 IStream* iface,
706 STATSTG* pstatstg, /* [out] */
707 DWORD grfStatFlag); /* [in] */
709 HRESULT WINAPI StgStreamImpl_Clone(
710 IStream* iface,
711 IStream** ppstm); /* [out] */
714 /********************************************************************************
715 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
716 * abstractions used to read values from file buffers without having to worry
717 * about bit order
719 void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
720 void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
721 void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
722 void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
723 void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
724 void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
725 void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
726 StgProperty* source,
727 int statFlags);
729 /****************************************************************************
730 * BlockChainStream definitions.
732 * The BlockChainStream class is a utility class that is used to create an
733 * abstraction of the big block chains in the storage file.
735 struct BlockChainStream
737 StorageImpl* parentStorage;
738 ULONG* headOfStreamPlaceHolder;
739 ULONG ownerPropertyIndex;
740 ULONG lastBlockNoInSequence;
741 ULONG lastBlockNoInSequenceIndex;
742 ULONG tailIndex;
743 ULONG numBlocks;
747 * Methods for the BlockChainStream class.
749 BlockChainStream* BlockChainStream_Construct(
750 StorageImpl* parentStorage,
751 ULONG* headOfStreamPlaceHolder,
752 ULONG propertyIndex);
754 void BlockChainStream_Destroy(
755 BlockChainStream* This);
757 ULONG BlockChainStream_GetHeadOfChain(
758 BlockChainStream* This);
760 BOOL BlockChainStream_ReadAt(
761 BlockChainStream* This,
762 ULARGE_INTEGER offset,
763 ULONG size,
764 void* buffer,
765 ULONG* bytesRead);
767 BOOL BlockChainStream_WriteAt(
768 BlockChainStream* This,
769 ULARGE_INTEGER offset,
770 ULONG size,
771 const void* buffer,
772 ULONG* bytesWritten);
774 BOOL BlockChainStream_SetSize(
775 BlockChainStream* This,
776 ULARGE_INTEGER newSize);
778 ULARGE_INTEGER BlockChainStream_GetSize(
779 BlockChainStream* This);
781 ULONG BlockChainStream_GetCount(
782 BlockChainStream* This);
784 /****************************************************************************
785 * SmallBlockChainStream definitions.
787 * The SmallBlockChainStream class is a utility class that is used to create an
788 * abstraction of the small block chains in the storage file.
790 struct SmallBlockChainStream
792 StorageImpl* parentStorage;
793 ULONG ownerPropertyIndex;
797 * Methods of the SmallBlockChainStream class.
799 SmallBlockChainStream* SmallBlockChainStream_Construct(
800 StorageImpl* parentStorage,
801 ULONG propertyIndex);
803 void SmallBlockChainStream_Destroy(
804 SmallBlockChainStream* This);
806 ULONG SmallBlockChainStream_GetHeadOfChain(
807 SmallBlockChainStream* This);
809 ULONG SmallBlockChainStream_GetNextBlockInChain(
810 SmallBlockChainStream* This,
811 ULONG blockIndex);
813 void SmallBlockChainStream_SetNextBlockInChain(
814 SmallBlockChainStream* This,
815 ULONG blockIndex,
816 ULONG nextBlock);
818 void SmallBlockChainStream_FreeBlock(
819 SmallBlockChainStream* This,
820 ULONG blockIndex);
822 ULONG SmallBlockChainStream_GetNextFreeBlock(
823 SmallBlockChainStream* This);
825 BOOL SmallBlockChainStream_ReadAt(
826 SmallBlockChainStream* This,
827 ULARGE_INTEGER offset,
828 ULONG size,
829 void* buffer,
830 ULONG* bytesRead);
832 BOOL SmallBlockChainStream_WriteAt(
833 SmallBlockChainStream* This,
834 ULARGE_INTEGER offset,
835 ULONG size,
836 const void* buffer,
837 ULONG* bytesWritten);
839 BOOL SmallBlockChainStream_SetSize(
840 SmallBlockChainStream* This,
841 ULARGE_INTEGER newSize);
843 ULARGE_INTEGER SmallBlockChainStream_GetSize(
844 SmallBlockChainStream* This);
846 ULONG SmallBlockChainStream_GetCount(
847 SmallBlockChainStream* This);
850 #endif /* __STORAGE32_H__ */