Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>
[wine.git] / ole / storage32.h
blob3f35ab93ad459cb3769b1044de2d973dead648d5
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 BOOL fileBased;
139 ULARGE_INTEGER filesize;
140 ULONG blocksize;
141 HANDLE hfile;
142 HANDLE hfilemap;
143 DWORD flProtect;
144 MappedPage *maplisthead;
145 ILockBytes *pLkbyt;
146 HGLOBAL hbytearray;
147 LPVOID pbytearray;
148 BigBlock *headblock;
152 * Declaration of the functions used to manipulate the BigBlockFile
153 * data structure.
155 BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
156 ILockBytes* pLkByt,
157 DWORD openFlags,
158 ULONG blocksize,
159 BOOL fileBased);
160 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
161 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
162 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
163 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
164 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
165 ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
167 /****************************************************************************
168 * Storage32BaseImpl definitions.
170 * This stucture defines the base information contained in all implementations
171 * of IStorage32 contained in this filee storage implementation.
173 * In OOP terms, this is the base class for all the IStorage32 implementations
174 * contained in this file.
176 struct StorageBaseImpl
178 ICOM_VTABLE(IStorage)* lpvtbl; /* Needs to be the first item in the stuct
179 * since we want to cast this in a Storage32 pointer */
182 * Reference count of this object
184 ULONG ref;
187 * Ancestor storage (top level)
189 StorageImpl* ancestorStorage;
192 * Index of the property for the root of
193 * this storage
195 ULONG rootPropertySetIndex;
198 * virtual Destructor method.
200 void (*v_destructor)(StorageBaseImpl*);
205 * Prototypes for the methods of the Storage32BaseImpl class.
207 HRESULT WINAPI StorageBaseImpl_QueryInterface(
208 IStorage* iface,
209 REFIID riid,
210 void** ppvObject);
212 ULONG WINAPI StorageBaseImpl_AddRef(
213 IStorage* iface);
215 ULONG WINAPI StorageBaseImpl_Release(
216 IStorage* iface);
218 HRESULT WINAPI StorageBaseImpl_OpenStream(
219 IStorage* iface,
220 const OLECHAR* pwcsName, /* [string][in] */
221 void* reserved1, /* [unique][in] */
222 DWORD grfMode, /* [in] */
223 DWORD reserved2, /* [in] */
224 IStream** ppstm); /* [out] */
226 HRESULT WINAPI StorageBaseImpl_OpenStorage(
227 IStorage* iface,
228 const OLECHAR* pwcsName, /* [string][unique][in] */
229 IStorage* pstgPriority, /* [unique][in] */
230 DWORD grfMode, /* [in] */
231 SNB snbExclude, /* [unique][in] */
232 DWORD reserved, /* [in] */
233 IStorage** ppstg); /* [out] */
235 HRESULT WINAPI StorageBaseImpl_EnumElements(
236 IStorage* iface,
237 DWORD reserved1, /* [in] */
238 void* reserved2, /* [size_is][unique][in] */
239 DWORD reserved3, /* [in] */
240 IEnumSTATSTG** ppenum); /* [out] */
242 HRESULT WINAPI StorageBaseImpl_Stat(
243 IStorage* iface,
244 STATSTG* pstatstg, /* [out] */
245 DWORD grfStatFlag); /* [in] */
247 HRESULT WINAPI StorageBaseImpl_RenameElement(
248 IStorage* iface,
249 const OLECHAR* pwcsOldName, /* [string][in] */
250 const OLECHAR* pwcsNewName); /* [string][in] */
252 HRESULT WINAPI StorageBaseImpl_CreateStream(
253 IStorage* iface,
254 const OLECHAR* pwcsName, /* [string][in] */
255 DWORD grfMode, /* [in] */
256 DWORD reserved1, /* [in] */
257 DWORD reserved2, /* [in] */
258 IStream** ppstm); /* [out] */
260 HRESULT WINAPI StorageBaseImpl_SetClass(
261 IStorage* iface,
262 REFCLSID clsid); /* [in] */
264 /****************************************************************************
265 * Storage32Impl definitions.
267 * This implementation of the IStorage32 interface represents a root
268 * storage. Basically, a document file.
270 struct StorageImpl
272 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
273 * since we want to cast this in a Storage32 pointer */
276 * Declare the member of the Storage32BaseImpl class to allow
277 * casting as a Storage32BaseImpl
279 ULONG ref;
280 struct StorageImpl* ancestorStorage;
281 ULONG rootPropertySetIndex;
282 void (*v_destructor)(struct StorageImpl*);
285 * The following data members are specific to the Storage32Impl
286 * class
288 HANDLE hFile; /* Physical support for the Docfile */
291 * File header
293 WORD bigBlockSizeBits;
294 WORD smallBlockSizeBits;
295 ULONG bigBlockSize;
296 ULONG smallBlockSize;
297 ULONG bigBlockDepotCount;
298 ULONG rootStartBlock;
299 ULONG smallBlockDepotStart;
300 ULONG extBigBlockDepotStart;
301 ULONG extBigBlockDepotCount;
302 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
304 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
305 ULONG indexBlockDepotCached;
306 ULONG prevFreeBlock;
309 * Abstraction of the big block chains for the chains of the header.
311 BlockChainStream* rootBlockChain;
312 BlockChainStream* smallBlockDepotChain;
313 BlockChainStream* smallBlockRootChain;
316 * Pointer to the big block file abstraction
318 BigBlockFile* bigBlockFile;
322 * Method declaration for the Storage32Impl class
325 HRESULT WINAPI StorageImpl_CreateStorage(
326 IStorage* iface,
327 const OLECHAR* pwcsName, /* [string][in] */
328 DWORD grfMode, /* [in] */
329 DWORD dwStgFmt, /* [in] */
330 DWORD reserved2, /* [in] */
331 IStorage** ppstg); /* [out] */
333 HRESULT WINAPI StorageImpl_CopyTo(
334 IStorage* iface,
335 DWORD ciidExclude, /* [in] */
336 const IID* rgiidExclude, /* [size_is][unique][in] */
337 SNB snbExclude, /* [unique][in] */
338 IStorage* pstgDest); /* [unique][in] */
340 HRESULT WINAPI StorageImpl_MoveElementTo(
341 IStorage* iface,
342 const OLECHAR* pwcsName, /* [string][in] */
343 IStorage* pstgDest, /* [unique][in] */
344 const OLECHAR* pwcsNewName, /* [string][in] */
345 DWORD grfFlags); /* [in] */
347 HRESULT WINAPI StorageImpl_Commit(
348 IStorage* iface,
349 DWORD grfCommitFlags); /* [in] */
351 HRESULT WINAPI StorageImpl_Revert(
352 IStorage* iface);
354 HRESULT WINAPI StorageImpl_DestroyElement(
355 IStorage* iface,
356 const OLECHAR* pwcsName); /* [string][in] */
358 HRESULT WINAPI StorageImpl_SetElementTimes(
359 IStorage* iface,
360 const OLECHAR* pwcsName, /* [string][in] */
361 const FILETIME* pctime, /* [in] */
362 const FILETIME* patime, /* [in] */
363 const FILETIME* pmtime); /* [in] */
365 HRESULT WINAPI StorageImpl_SetStateBits(
366 IStorage* iface,
367 DWORD grfStateBits, /* [in] */
368 DWORD grfMask); /* [in] */
370 void StorageImpl_Destroy(
371 StorageImpl* This);
373 HRESULT StorageImpl_Construct(
374 StorageImpl* This,
375 HANDLE hFile,
376 ILockBytes* pLkbyt,
377 DWORD openFlags,
378 BOOL fileBased);
380 BOOL StorageImpl_ReadBigBlock(
381 StorageImpl* This,
382 ULONG blockIndex,
383 void* buffer);
385 BOOL StorageImpl_WriteBigBlock(
386 StorageImpl* This,
387 ULONG blockIndex,
388 void* buffer);
390 void* StorageImpl_GetROBigBlock(
391 StorageImpl* This,
392 ULONG blockIndex);
394 void* StorageImpl_GetBigBlock(
395 StorageImpl* This,
396 ULONG blockIndex);
398 void StorageImpl_ReleaseBigBlock(
399 StorageImpl* This,
400 void* pBigBlock);
402 ULONG StorageImpl_GetNextFreeBigBlock(
403 StorageImpl* This);
405 void StorageImpl_FreeBigBlock(
406 StorageImpl* This,
407 ULONG blockIndex);
409 ULONG StorageImpl_GetNextBlockInChain(
410 StorageImpl* This,
411 ULONG blockIndex);
413 void StorageImpl_SetNextBlockInChain(
414 StorageImpl* This,
415 ULONG blockIndex,
416 ULONG nextBlock);
418 HRESULT StorageImpl_LoadFileHeader(
419 StorageImpl* This);
421 void StorageImpl_SaveFileHeader(
422 StorageImpl* This);
424 BOOL StorageImpl_ReadProperty(
425 StorageImpl* This,
426 ULONG index,
427 StgProperty* buffer);
429 BOOL StorageImpl_WriteProperty(
430 StorageImpl* This,
431 ULONG index,
432 StgProperty* buffer);
434 BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
435 StorageImpl* This,
436 SmallBlockChainStream** ppsbChain);
438 ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
439 ULONG blockIndex);
441 void Storage32Impl_AddBlockDepot(StorageImpl* This,
442 ULONG blockIndex);
444 ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
446 ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
447 ULONG depotIndex);
449 void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
450 ULONG depotIndex,
451 ULONG blockIndex);
452 /****************************************************************************
453 * Storage32InternalImpl definitions.
455 * Definition of the implementation structure for the IStorage32 interface.
456 * This one implements the IStorage32 interface for storage that are
457 * inside another storage.
459 struct StorageInternalImpl
461 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
462 * since we want to cast this in a Storage32 pointer */
465 * Declare the member of the Storage32BaseImpl class to allow
466 * casting as a Storage32BaseImpl
468 ULONG ref;
469 struct StorageImpl* ancestorStorage;
470 ULONG rootPropertySetIndex;
471 void (*v_destructor)(struct StorageInternalImpl*);
474 * There is no specific data for this class.
479 * Method definitions for the Storage32InternalImpl class.
481 StorageInternalImpl* StorageInternalImpl_Construct(
482 StorageImpl* ancestorStorage,
483 ULONG rootTropertyIndex);
485 void StorageInternalImpl_Destroy(
486 StorageInternalImpl* This);
488 HRESULT WINAPI StorageInternalImpl_Commit(
489 IStorage* iface,
490 DWORD grfCommitFlags); /* [in] */
492 HRESULT WINAPI StorageInternalImpl_Revert(
493 IStorage* iface);
496 /****************************************************************************
497 * IEnumSTATSTGImpl definitions.
499 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
500 * This class allows iterating through the content of a storage and to find
501 * specific items inside it.
503 struct IEnumSTATSTGImpl
505 ICOM_VTABLE(IEnumSTATSTG) *lpvtbl; /* Needs to be the first item in the stuct
506 * since we want to cast this in a IEnumSTATSTG pointer */
508 ULONG ref; /* Reference count */
509 StorageImpl* parentStorage; /* Reference to the parent storage */
510 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
513 * The current implementation of the IEnumSTATSTGImpl class uses a stack
514 * to walk the property sets to get the content of a storage. This stack
515 * is implemented by the following 3 data members
517 ULONG stackSize;
518 ULONG stackMaxSize;
519 ULONG* stackToVisit;
521 #define ENUMSTATSGT_SIZE_INCREMENT 10
525 * Method definitions for the IEnumSTATSTGImpl class.
527 HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
528 IEnumSTATSTG* iface,
529 REFIID riid,
530 void** ppvObject);
532 ULONG WINAPI IEnumSTATSTGImpl_AddRef(
533 IEnumSTATSTG* iface);
535 ULONG WINAPI IEnumSTATSTGImpl_Release(
536 IEnumSTATSTG* iface);
538 HRESULT WINAPI IEnumSTATSTGImpl_Next(
539 IEnumSTATSTG* iface,
540 ULONG celt,
541 STATSTG* rgelt,
542 ULONG* pceltFetched);
544 HRESULT WINAPI IEnumSTATSTGImpl_Skip(
545 IEnumSTATSTG* iface,
546 ULONG celt);
548 HRESULT WINAPI IEnumSTATSTGImpl_Reset(
549 IEnumSTATSTG* iface);
551 HRESULT WINAPI IEnumSTATSTGImpl_Clone(
552 IEnumSTATSTG* iface,
553 IEnumSTATSTG** ppenum);
555 IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
556 StorageImpl* This,
557 ULONG firstPropertyNode);
559 void IEnumSTATSTGImpl_Destroy(
560 IEnumSTATSTGImpl* This);
562 void IEnumSTATSTGImpl_PushSearchNode(
563 IEnumSTATSTGImpl* This,
564 ULONG nodeToPush);
566 ULONG IEnumSTATSTGImpl_PopSearchNode(
567 IEnumSTATSTGImpl* This,
568 BOOL remove);
570 ULONG IEnumSTATSTGImpl_FindProperty(
571 IEnumSTATSTGImpl* This,
572 const OLECHAR* lpszPropName,
573 StgProperty* buffer);
575 INT IEnumSTATSTGImpl_FindParentProperty(
576 IEnumSTATSTGImpl *This,
577 ULONG childProperty,
578 StgProperty *currentProperty,
579 ULONG *propertyId);
582 /****************************************************************************
583 * StgStreamImpl definitions.
585 * This class imlements the IStream32 inteface and represents a stream
586 * located inside a storage object.
588 struct StgStreamImpl
590 ICOM_VTABLE(IStream) *lpvtbl; /* Needs to be the first item in the stuct
591 * since we want to cast this in a IStream pointer */
594 * Reference count
596 ULONG ref;
599 * Storage that is the parent(owner) of the stream
601 StorageBaseImpl* parentStorage;
604 * Index of the property that owns (points to) this stream.
606 ULONG ownerProperty;
609 * Helper variable that contains the size of the stream
611 ULARGE_INTEGER streamSize;
614 * This is the current position of the cursor in the stream
616 ULARGE_INTEGER currentPosition;
619 * The information in the stream is represented by a chain of small blocks
620 * or a chain of large blocks. Depending on the case, one of the two
621 * following variabled points to that information.
623 BlockChainStream* bigBlockChain;
624 SmallBlockChainStream* smallBlockChain;
629 * Method definition for the StgStreamImpl class.
631 StgStreamImpl* StgStreamImpl_Construct(
632 StorageBaseImpl* parentStorage,
633 ULONG ownerProperty);
635 void StgStreamImpl_Destroy(
636 StgStreamImpl* This);
638 void StgStreamImpl_OpenBlockChain(
639 StgStreamImpl* This);
641 HRESULT WINAPI StgStreamImpl_QueryInterface(
642 IStream* iface,
643 REFIID riid, /* [in] */
644 void** ppvObject); /* [iid_is][out] */
646 ULONG WINAPI StgStreamImpl_AddRef(
647 IStream* iface);
649 ULONG WINAPI StgStreamImpl_Release(
650 IStream* iface);
652 HRESULT WINAPI StgStreamImpl_Read(
653 IStream* iface,
654 void* pv, /* [length_is][size_is][out] */
655 ULONG cb, /* [in] */
656 ULONG* pcbRead); /* [out] */
658 HRESULT WINAPI StgStreamImpl_Write(
659 IStream* iface,
660 const void* pv, /* [size_is][in] */
661 ULONG cb, /* [in] */
662 ULONG* pcbWritten); /* [out] */
664 HRESULT WINAPI StgStreamImpl_Seek(
665 IStream* iface,
666 LARGE_INTEGER dlibMove, /* [in] */
667 DWORD dwOrigin, /* [in] */
668 ULARGE_INTEGER* plibNewPosition); /* [out] */
670 HRESULT WINAPI StgStreamImpl_SetSize(
671 IStream* iface,
672 ULARGE_INTEGER libNewSize); /* [in] */
674 HRESULT WINAPI StgStreamImpl_CopyTo(
675 IStream* iface,
676 IStream* pstm, /* [unique][in] */
677 ULARGE_INTEGER cb, /* [in] */
678 ULARGE_INTEGER* pcbRead, /* [out] */
679 ULARGE_INTEGER* pcbWritten); /* [out] */
681 HRESULT WINAPI StgStreamImpl_Commit(
682 IStream* iface,
683 DWORD grfCommitFlags); /* [in] */
685 HRESULT WINAPI StgStreamImpl_Revert(
686 IStream* iface);
688 HRESULT WINAPI StgStreamImpl_LockRegion(
689 IStream* iface,
690 ULARGE_INTEGER libOffset, /* [in] */
691 ULARGE_INTEGER cb, /* [in] */
692 DWORD dwLockType); /* [in] */
694 HRESULT WINAPI StgStreamImpl_UnlockRegion(
695 IStream* iface,
696 ULARGE_INTEGER libOffset, /* [in] */
697 ULARGE_INTEGER cb, /* [in] */
698 DWORD dwLockType); /* [in] */
700 HRESULT WINAPI StgStreamImpl_Stat(
701 IStream* iface,
702 STATSTG* pstatstg, /* [out] */
703 DWORD grfStatFlag); /* [in] */
705 HRESULT WINAPI StgStreamImpl_Clone(
706 IStream* iface,
707 IStream** ppstm); /* [out] */
710 /********************************************************************************
711 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
712 * abstractions used to read values from file buffers without having to worry
713 * about bit order
715 void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
716 void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
717 void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
718 void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
719 void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
720 void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
721 void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
722 StgProperty* source,
723 int statFlags);
725 /****************************************************************************
726 * BlockChainStream definitions.
728 * The BlockChainStream class is a utility class that is used to create an
729 * abstraction of the big block chains in the storage file.
731 struct BlockChainStream
733 StorageImpl* parentStorage;
734 ULONG* headOfStreamPlaceHolder;
735 ULONG ownerPropertyIndex;
736 ULONG lastBlockNoInSequence;
737 ULONG lastBlockNoInSequenceIndex;
738 ULONG tailIndex;
739 ULONG numBlocks;
743 * Methods for the BlockChainStream class.
745 BlockChainStream* BlockChainStream_Construct(
746 StorageImpl* parentStorage,
747 ULONG* headOfStreamPlaceHolder,
748 ULONG propertyIndex);
750 void BlockChainStream_Destroy(
751 BlockChainStream* This);
753 ULONG BlockChainStream_GetHeadOfChain(
754 BlockChainStream* This);
756 BOOL BlockChainStream_ReadAt(
757 BlockChainStream* This,
758 ULARGE_INTEGER offset,
759 ULONG size,
760 void* buffer,
761 ULONG* bytesRead);
763 BOOL BlockChainStream_WriteAt(
764 BlockChainStream* This,
765 ULARGE_INTEGER offset,
766 ULONG size,
767 const void* buffer,
768 ULONG* bytesWritten);
770 BOOL BlockChainStream_SetSize(
771 BlockChainStream* This,
772 ULARGE_INTEGER newSize);
774 ULARGE_INTEGER BlockChainStream_GetSize(
775 BlockChainStream* This);
777 ULONG BlockChainStream_GetCount(
778 BlockChainStream* This);
780 /****************************************************************************
781 * SmallBlockChainStream definitions.
783 * The SmallBlockChainStream class is a utility class that is used to create an
784 * abstraction of the small block chains in the storage file.
786 struct SmallBlockChainStream
788 StorageImpl* parentStorage;
789 ULONG ownerPropertyIndex;
793 * Methods of the SmallBlockChainStream class.
795 SmallBlockChainStream* SmallBlockChainStream_Construct(
796 StorageImpl* parentStorage,
797 ULONG propertyIndex);
799 void SmallBlockChainStream_Destroy(
800 SmallBlockChainStream* This);
802 ULONG SmallBlockChainStream_GetHeadOfChain(
803 SmallBlockChainStream* This);
805 ULONG SmallBlockChainStream_GetNextBlockInChain(
806 SmallBlockChainStream* This,
807 ULONG blockIndex);
809 void SmallBlockChainStream_SetNextBlockInChain(
810 SmallBlockChainStream* This,
811 ULONG blockIndex,
812 ULONG nextBlock);
814 void SmallBlockChainStream_FreeBlock(
815 SmallBlockChainStream* This,
816 ULONG blockIndex);
818 ULONG SmallBlockChainStream_GetNextFreeBlock(
819 SmallBlockChainStream* This);
821 BOOL SmallBlockChainStream_ReadAt(
822 SmallBlockChainStream* This,
823 ULARGE_INTEGER offset,
824 ULONG size,
825 void* buffer,
826 ULONG* bytesRead);
828 BOOL SmallBlockChainStream_WriteAt(
829 SmallBlockChainStream* This,
830 ULARGE_INTEGER offset,
831 ULONG size,
832 const void* buffer,
833 ULONG* bytesWritten);
835 BOOL SmallBlockChainStream_SetSize(
836 SmallBlockChainStream* This,
837 ULARGE_INTEGER newSize);
839 ULARGE_INTEGER SmallBlockChainStream_GetSize(
840 SmallBlockChainStream* This);
842 ULONG SmallBlockChainStream_GetCount(
843 SmallBlockChainStream* This);
846 #endif /* __STORAGE32_H__ */