CreateItemMoniker may get NULL as szDelim, some cleanups.
[wine/multimedia.git] / dlls / ole32 / storage32.h
blobb1dddad0effb366246d9a54250c3369963e3ec2c
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_base.h"
21 #include "wine/obj_storage.h"
24 * Definitions for the file format offsets.
26 static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
27 static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
28 static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
29 static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
30 static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
31 static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
32 static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048;
33 static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C;
34 static const ULONG OFFSET_PS_NAME = 0x00000000;
35 static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040;
36 static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042;
37 static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044;
38 static const ULONG OFFSET_PS_NEXTPROP = 0x00000048;
39 static const ULONG OFFSET_PS_DIRPROP = 0x0000004C;
40 static const ULONG OFFSET_PS_GUID = 0x00000050;
41 static const ULONG OFFSET_PS_TSS1 = 0x00000064;
42 static const ULONG OFFSET_PS_TSD1 = 0x00000068;
43 static const ULONG OFFSET_PS_TSS2 = 0x0000006C;
44 static const ULONG OFFSET_PS_TSD2 = 0x00000070;
45 static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
46 static const ULONG OFFSET_PS_SIZE = 0x00000078;
47 static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
48 static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
49 static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
50 static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
51 static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
52 static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
53 static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;
54 static const ULONG BLOCK_UNUSED = 0xFFFFFFFF;
55 static const ULONG PROPERTY_NULL = 0xFFFFFFFF;
57 #define PROPERTY_NAME_MAX_LEN 0x20
58 #define PROPERTY_NAME_BUFFER_LEN 0x40
60 #define PROPSET_BLOCK_SIZE 0x00000080
63 * Property type of relation
65 #define PROPERTY_RELATION_PREVIOUS 0
66 #define PROPERTY_RELATION_NEXT 1
67 #define PROPERTY_RELATION_DIR 2
70 * Property type constants
72 #define PROPTYPE_STORAGE 0x01
73 #define PROPTYPE_STREAM 0x02
74 #define PROPTYPE_ROOT 0x05
77 * These defines assume a hardcoded blocksize. The code will assert
78 * if the blocksize is different. Some changes will have to be done if it
79 * becomes the case.
81 #define BIG_BLOCK_SIZE 0x200
82 #define COUNT_BBDEPOTINHEADER 109
83 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
84 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128
87 * These are signatures to detect the type of Document file.
89 static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
90 static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
93 * Forward declarations of all the structures used by the storage
94 * module.
96 typedef struct StorageBaseImpl StorageBaseImpl;
97 typedef struct StorageImpl StorageImpl;
98 typedef struct StorageInternalImpl StorageInternalImpl;
99 typedef struct BlockChainStream BlockChainStream;
100 typedef struct SmallBlockChainStream SmallBlockChainStream;
101 typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
102 typedef struct StgProperty StgProperty;
103 typedef struct StgStreamImpl StgStreamImpl;
106 * This utility structure is used to read/write the information in a storage
107 * property.
109 struct StgProperty
111 WCHAR name[PROPERTY_NAME_MAX_LEN];
112 WORD sizeOfNameString;
113 BYTE propertyType;
114 ULONG previousProperty;
115 ULONG nextProperty;
116 ULONG dirProperty;
117 GUID propertyUniqueID;
118 ULONG timeStampS1;
119 ULONG timeStampD1;
120 ULONG timeStampS2;
121 ULONG timeStampD2;
122 ULONG startingBlock;
123 ULARGE_INTEGER size;
126 /*************************************************************************
127 * Big Block File support
129 * The big block file is an abstraction of a flat file separated in
130 * same sized blocks. The implementation for the methods described in
131 * this section appear in stg_bigblockfile.c
135 * Declaration of the data structures
137 typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
138 typedef struct MappedPage MappedPage,*LPMAPPEDPAGE;
140 struct BigBlockFile
142 BOOL fileBased;
143 ULARGE_INTEGER filesize;
144 ULONG blocksize;
145 HANDLE hfile;
146 HANDLE hfilemap;
147 DWORD flProtect;
148 MappedPage *maplist;
149 MappedPage *victimhead, *victimtail;
150 ULONG num_victim_pages;
151 ILockBytes *pLkbyt;
152 HGLOBAL hbytearray;
153 LPVOID pbytearray;
157 * Declaration of the functions used to manipulate the BigBlockFile
158 * data structure.
160 BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
161 ILockBytes* pLkByt,
162 DWORD openFlags,
163 ULONG blocksize,
164 BOOL fileBased);
165 void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
166 void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
167 void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
168 void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
169 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
170 ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
172 /*************************************************************************
173 * Ole Convert support
176 void OLECONVERT_CreateOleStream(LPSTORAGE pStorage);
177 HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName);
179 /****************************************************************************
180 * Storage32BaseImpl definitions.
182 * This stucture defines the base information contained in all implementations
183 * of IStorage32 contained in this filee storage implementation.
185 * In OOP terms, this is the base class for all the IStorage32 implementations
186 * contained in this file.
188 struct StorageBaseImpl
190 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
191 * since we want to cast this in a Storage32 pointer */
194 * Reference count of this object
196 ULONG ref;
199 * Ancestor storage (top level)
201 StorageImpl* ancestorStorage;
204 * Index of the property for the root of
205 * this storage
207 ULONG rootPropertySetIndex;
210 * virtual Destructor method.
212 void (*v_destructor)(StorageBaseImpl*);
217 * Prototypes for the methods of the Storage32BaseImpl class.
219 HRESULT WINAPI StorageBaseImpl_QueryInterface(
220 IStorage* iface,
221 REFIID riid,
222 void** ppvObject);
224 ULONG WINAPI StorageBaseImpl_AddRef(
225 IStorage* iface);
227 ULONG WINAPI StorageBaseImpl_Release(
228 IStorage* iface);
230 HRESULT WINAPI StorageBaseImpl_OpenStream(
231 IStorage* iface,
232 const OLECHAR* pwcsName, /* [string][in] */
233 void* reserved1, /* [unique][in] */
234 DWORD grfMode, /* [in] */
235 DWORD reserved2, /* [in] */
236 IStream** ppstm); /* [out] */
238 HRESULT WINAPI StorageBaseImpl_OpenStorage(
239 IStorage* iface,
240 const OLECHAR* pwcsName, /* [string][unique][in] */
241 IStorage* pstgPriority, /* [unique][in] */
242 DWORD grfMode, /* [in] */
243 SNB snbExclude, /* [unique][in] */
244 DWORD reserved, /* [in] */
245 IStorage** ppstg); /* [out] */
247 HRESULT WINAPI StorageBaseImpl_EnumElements(
248 IStorage* iface,
249 DWORD reserved1, /* [in] */
250 void* reserved2, /* [size_is][unique][in] */
251 DWORD reserved3, /* [in] */
252 IEnumSTATSTG** ppenum); /* [out] */
254 HRESULT WINAPI StorageBaseImpl_Stat(
255 IStorage* iface,
256 STATSTG* pstatstg, /* [out] */
257 DWORD grfStatFlag); /* [in] */
259 HRESULT WINAPI StorageBaseImpl_RenameElement(
260 IStorage* iface,
261 const OLECHAR* pwcsOldName, /* [string][in] */
262 const OLECHAR* pwcsNewName); /* [string][in] */
264 HRESULT WINAPI StorageBaseImpl_CreateStream(
265 IStorage* iface,
266 const OLECHAR* pwcsName, /* [string][in] */
267 DWORD grfMode, /* [in] */
268 DWORD reserved1, /* [in] */
269 DWORD reserved2, /* [in] */
270 IStream** ppstm); /* [out] */
272 HRESULT WINAPI StorageBaseImpl_SetClass(
273 IStorage* iface,
274 REFCLSID clsid); /* [in] */
276 /****************************************************************************
277 * Storage32Impl definitions.
279 * This implementation of the IStorage32 interface represents a root
280 * storage. Basically, a document file.
282 struct StorageImpl
284 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
285 * since we want to cast this in a Storage32 pointer */
288 * Declare the member of the Storage32BaseImpl class to allow
289 * casting as a Storage32BaseImpl
291 ULONG ref;
292 struct StorageImpl* ancestorStorage;
293 ULONG rootPropertySetIndex;
294 void (*v_destructor)(struct StorageImpl*);
297 * The following data members are specific to the Storage32Impl
298 * class
300 HANDLE hFile; /* Physical support for the Docfile */
303 * File header
305 WORD bigBlockSizeBits;
306 WORD smallBlockSizeBits;
307 ULONG bigBlockSize;
308 ULONG smallBlockSize;
309 ULONG bigBlockDepotCount;
310 ULONG rootStartBlock;
311 ULONG smallBlockDepotStart;
312 ULONG extBigBlockDepotStart;
313 ULONG extBigBlockDepotCount;
314 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
316 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
317 ULONG indexBlockDepotCached;
318 ULONG prevFreeBlock;
321 * Abstraction of the big block chains for the chains of the header.
323 BlockChainStream* rootBlockChain;
324 BlockChainStream* smallBlockDepotChain;
325 BlockChainStream* smallBlockRootChain;
328 * Pointer to the big block file abstraction
330 BigBlockFile* bigBlockFile;
334 * Method declaration for the Storage32Impl class
337 HRESULT WINAPI StorageImpl_CreateStorage(
338 IStorage* iface,
339 const OLECHAR* pwcsName, /* [string][in] */
340 DWORD grfMode, /* [in] */
341 DWORD dwStgFmt, /* [in] */
342 DWORD reserved2, /* [in] */
343 IStorage** ppstg); /* [out] */
345 HRESULT WINAPI StorageImpl_CopyTo(
346 IStorage* iface,
347 DWORD ciidExclude, /* [in] */
348 const IID* rgiidExclude, /* [size_is][unique][in] */
349 SNB snbExclude, /* [unique][in] */
350 IStorage* pstgDest); /* [unique][in] */
352 HRESULT WINAPI StorageImpl_MoveElementTo(
353 IStorage* iface,
354 const OLECHAR* pwcsName, /* [string][in] */
355 IStorage* pstgDest, /* [unique][in] */
356 const OLECHAR* pwcsNewName, /* [string][in] */
357 DWORD grfFlags); /* [in] */
359 HRESULT WINAPI StorageImpl_Commit(
360 IStorage* iface,
361 DWORD grfCommitFlags); /* [in] */
363 HRESULT WINAPI StorageImpl_Revert(
364 IStorage* iface);
366 HRESULT WINAPI StorageImpl_DestroyElement(
367 IStorage* iface,
368 const OLECHAR* pwcsName); /* [string][in] */
370 HRESULT WINAPI StorageImpl_SetElementTimes(
371 IStorage* iface,
372 const OLECHAR* pwcsName, /* [string][in] */
373 const FILETIME* pctime, /* [in] */
374 const FILETIME* patime, /* [in] */
375 const FILETIME* pmtime); /* [in] */
377 HRESULT WINAPI StorageImpl_SetStateBits(
378 IStorage* iface,
379 DWORD grfStateBits, /* [in] */
380 DWORD grfMask); /* [in] */
382 void StorageImpl_Destroy(
383 StorageImpl* This);
385 HRESULT StorageImpl_Construct(
386 StorageImpl* This,
387 HANDLE hFile,
388 ILockBytes* pLkbyt,
389 DWORD openFlags,
390 BOOL fileBased,
391 BOOL fileCreate);
393 BOOL StorageImpl_ReadBigBlock(
394 StorageImpl* This,
395 ULONG blockIndex,
396 void* buffer);
398 BOOL StorageImpl_WriteBigBlock(
399 StorageImpl* This,
400 ULONG blockIndex,
401 void* buffer);
403 void* StorageImpl_GetROBigBlock(
404 StorageImpl* This,
405 ULONG blockIndex);
407 void* StorageImpl_GetBigBlock(
408 StorageImpl* This,
409 ULONG blockIndex);
411 void StorageImpl_ReleaseBigBlock(
412 StorageImpl* This,
413 void* pBigBlock);
415 ULONG StorageImpl_GetNextFreeBigBlock(
416 StorageImpl* This);
418 void StorageImpl_FreeBigBlock(
419 StorageImpl* This,
420 ULONG blockIndex);
422 ULONG StorageImpl_GetNextBlockInChain(
423 StorageImpl* This,
424 ULONG blockIndex);
426 void StorageImpl_SetNextBlockInChain(
427 StorageImpl* This,
428 ULONG blockIndex,
429 ULONG nextBlock);
431 HRESULT StorageImpl_LoadFileHeader(
432 StorageImpl* This);
434 void StorageImpl_SaveFileHeader(
435 StorageImpl* This);
437 BOOL StorageImpl_ReadProperty(
438 StorageImpl* This,
439 ULONG index,
440 StgProperty* buffer);
442 BOOL StorageImpl_WriteProperty(
443 StorageImpl* This,
444 ULONG index,
445 StgProperty* buffer);
447 BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
448 StorageImpl* This,
449 SmallBlockChainStream** ppsbChain);
451 ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
452 ULONG blockIndex);
454 void Storage32Impl_AddBlockDepot(StorageImpl* This,
455 ULONG blockIndex);
457 ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
459 ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
460 ULONG depotIndex);
462 void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
463 ULONG depotIndex,
464 ULONG blockIndex);
465 /****************************************************************************
466 * Storage32InternalImpl definitions.
468 * Definition of the implementation structure for the IStorage32 interface.
469 * This one implements the IStorage32 interface for storage that are
470 * inside another storage.
472 struct StorageInternalImpl
474 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
475 * since we want to cast this in a Storage32 pointer */
478 * Declare the member of the Storage32BaseImpl class to allow
479 * casting as a Storage32BaseImpl
481 ULONG ref;
482 struct StorageImpl* ancestorStorage;
483 ULONG rootPropertySetIndex;
484 void (*v_destructor)(struct StorageInternalImpl*);
487 * There is no specific data for this class.
492 * Method definitions for the Storage32InternalImpl class.
494 StorageInternalImpl* StorageInternalImpl_Construct(
495 StorageImpl* ancestorStorage,
496 ULONG rootTropertyIndex);
498 void StorageInternalImpl_Destroy(
499 StorageInternalImpl* This);
501 HRESULT WINAPI StorageInternalImpl_Commit(
502 IStorage* iface,
503 DWORD grfCommitFlags); /* [in] */
505 HRESULT WINAPI StorageInternalImpl_Revert(
506 IStorage* iface);
509 /****************************************************************************
510 * IEnumSTATSTGImpl definitions.
512 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
513 * This class allows iterating through the content of a storage and to find
514 * specific items inside it.
516 struct IEnumSTATSTGImpl
518 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct
519 * since we want to cast this in a IEnumSTATSTG pointer */
521 ULONG ref; /* Reference count */
522 StorageImpl* parentStorage; /* Reference to the parent storage */
523 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
526 * The current implementation of the IEnumSTATSTGImpl class uses a stack
527 * to walk the property sets to get the content of a storage. This stack
528 * is implemented by the following 3 data members
530 ULONG stackSize;
531 ULONG stackMaxSize;
532 ULONG* stackToVisit;
534 #define ENUMSTATSGT_SIZE_INCREMENT 10
538 * Method definitions for the IEnumSTATSTGImpl class.
540 HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
541 IEnumSTATSTG* iface,
542 REFIID riid,
543 void** ppvObject);
545 ULONG WINAPI IEnumSTATSTGImpl_AddRef(
546 IEnumSTATSTG* iface);
548 ULONG WINAPI IEnumSTATSTGImpl_Release(
549 IEnumSTATSTG* iface);
551 HRESULT WINAPI IEnumSTATSTGImpl_Next(
552 IEnumSTATSTG* iface,
553 ULONG celt,
554 STATSTG* rgelt,
555 ULONG* pceltFetched);
557 HRESULT WINAPI IEnumSTATSTGImpl_Skip(
558 IEnumSTATSTG* iface,
559 ULONG celt);
561 HRESULT WINAPI IEnumSTATSTGImpl_Reset(
562 IEnumSTATSTG* iface);
564 HRESULT WINAPI IEnumSTATSTGImpl_Clone(
565 IEnumSTATSTG* iface,
566 IEnumSTATSTG** ppenum);
568 IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
569 StorageImpl* This,
570 ULONG firstPropertyNode);
572 void IEnumSTATSTGImpl_Destroy(
573 IEnumSTATSTGImpl* This);
575 void IEnumSTATSTGImpl_PushSearchNode(
576 IEnumSTATSTGImpl* This,
577 ULONG nodeToPush);
579 ULONG IEnumSTATSTGImpl_PopSearchNode(
580 IEnumSTATSTGImpl* This,
581 BOOL remove);
583 ULONG IEnumSTATSTGImpl_FindProperty(
584 IEnumSTATSTGImpl* This,
585 const OLECHAR* lpszPropName,
586 StgProperty* buffer);
588 INT IEnumSTATSTGImpl_FindParentProperty(
589 IEnumSTATSTGImpl *This,
590 ULONG childProperty,
591 StgProperty *currentProperty,
592 ULONG *propertyId);
595 /****************************************************************************
596 * StgStreamImpl definitions.
598 * This class imlements the IStream32 inteface and represents a stream
599 * located inside a storage object.
601 struct StgStreamImpl
603 ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct
604 * since we want to cast this in a IStream pointer */
607 * Reference count
609 ULONG ref;
612 * Storage that is the parent(owner) of the stream
614 StorageBaseImpl* parentStorage;
617 * Access mode of this stream.
619 DWORD grfMode;
622 * Index of the property that owns (points to) this stream.
624 ULONG ownerProperty;
627 * Helper variable that contains the size of the stream
629 ULARGE_INTEGER streamSize;
632 * This is the current position of the cursor in the stream
634 ULARGE_INTEGER currentPosition;
637 * The information in the stream is represented by a chain of small blocks
638 * or a chain of large blocks. Depending on the case, one of the two
639 * following variabled points to that information.
641 BlockChainStream* bigBlockChain;
642 SmallBlockChainStream* smallBlockChain;
646 * Method definition for the StgStreamImpl class.
648 StgStreamImpl* StgStreamImpl_Construct(
649 StorageBaseImpl* parentStorage,
650 DWORD grfMode,
651 ULONG ownerProperty);
653 void StgStreamImpl_Destroy(
654 StgStreamImpl* This);
656 void StgStreamImpl_OpenBlockChain(
657 StgStreamImpl* This);
659 HRESULT WINAPI StgStreamImpl_QueryInterface(
660 IStream* iface,
661 REFIID riid, /* [in] */
662 void** ppvObject); /* [iid_is][out] */
664 ULONG WINAPI StgStreamImpl_AddRef(
665 IStream* iface);
667 ULONG WINAPI StgStreamImpl_Release(
668 IStream* iface);
670 HRESULT WINAPI StgStreamImpl_Read(
671 IStream* iface,
672 void* pv, /* [length_is][size_is][out] */
673 ULONG cb, /* [in] */
674 ULONG* pcbRead); /* [out] */
676 HRESULT WINAPI StgStreamImpl_Write(
677 IStream* iface,
678 const void* pv, /* [size_is][in] */
679 ULONG cb, /* [in] */
680 ULONG* pcbWritten); /* [out] */
682 HRESULT WINAPI StgStreamImpl_Seek(
683 IStream* iface,
684 LARGE_INTEGER dlibMove, /* [in] */
685 DWORD dwOrigin, /* [in] */
686 ULARGE_INTEGER* plibNewPosition); /* [out] */
688 HRESULT WINAPI StgStreamImpl_SetSize(
689 IStream* iface,
690 ULARGE_INTEGER libNewSize); /* [in] */
692 HRESULT WINAPI StgStreamImpl_CopyTo(
693 IStream* iface,
694 IStream* pstm, /* [unique][in] */
695 ULARGE_INTEGER cb, /* [in] */
696 ULARGE_INTEGER* pcbRead, /* [out] */
697 ULARGE_INTEGER* pcbWritten); /* [out] */
699 HRESULT WINAPI StgStreamImpl_Commit(
700 IStream* iface,
701 DWORD grfCommitFlags); /* [in] */
703 HRESULT WINAPI StgStreamImpl_Revert(
704 IStream* iface);
706 HRESULT WINAPI StgStreamImpl_LockRegion(
707 IStream* iface,
708 ULARGE_INTEGER libOffset, /* [in] */
709 ULARGE_INTEGER cb, /* [in] */
710 DWORD dwLockType); /* [in] */
712 HRESULT WINAPI StgStreamImpl_UnlockRegion(
713 IStream* iface,
714 ULARGE_INTEGER libOffset, /* [in] */
715 ULARGE_INTEGER cb, /* [in] */
716 DWORD dwLockType); /* [in] */
718 HRESULT WINAPI StgStreamImpl_Stat(
719 IStream* iface,
720 STATSTG* pstatstg, /* [out] */
721 DWORD grfStatFlag); /* [in] */
723 HRESULT WINAPI StgStreamImpl_Clone(
724 IStream* iface,
725 IStream** ppstm); /* [out] */
728 /********************************************************************************
729 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
730 * abstractions used to read values from file buffers without having to worry
731 * about bit order
733 void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
734 void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
735 void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
736 void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
737 void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
738 void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
739 void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
740 StgProperty* source,
741 int statFlags);
743 /****************************************************************************
744 * BlockChainStream definitions.
746 * The BlockChainStream class is a utility class that is used to create an
747 * abstraction of the big block chains in the storage file.
749 struct BlockChainStream
751 StorageImpl* parentStorage;
752 ULONG* headOfStreamPlaceHolder;
753 ULONG ownerPropertyIndex;
754 ULONG lastBlockNoInSequence;
755 ULONG lastBlockNoInSequenceIndex;
756 ULONG tailIndex;
757 ULONG numBlocks;
761 * Methods for the BlockChainStream class.
763 BlockChainStream* BlockChainStream_Construct(
764 StorageImpl* parentStorage,
765 ULONG* headOfStreamPlaceHolder,
766 ULONG propertyIndex);
768 void BlockChainStream_Destroy(
769 BlockChainStream* This);
771 ULONG BlockChainStream_GetHeadOfChain(
772 BlockChainStream* This);
774 BOOL BlockChainStream_ReadAt(
775 BlockChainStream* This,
776 ULARGE_INTEGER offset,
777 ULONG size,
778 void* buffer,
779 ULONG* bytesRead);
781 BOOL BlockChainStream_WriteAt(
782 BlockChainStream* This,
783 ULARGE_INTEGER offset,
784 ULONG size,
785 const void* buffer,
786 ULONG* bytesWritten);
788 BOOL BlockChainStream_SetSize(
789 BlockChainStream* This,
790 ULARGE_INTEGER newSize);
792 ULARGE_INTEGER BlockChainStream_GetSize(
793 BlockChainStream* This);
795 ULONG BlockChainStream_GetCount(
796 BlockChainStream* This);
798 /****************************************************************************
799 * SmallBlockChainStream definitions.
801 * The SmallBlockChainStream class is a utility class that is used to create an
802 * abstraction of the small block chains in the storage file.
804 struct SmallBlockChainStream
806 StorageImpl* parentStorage;
807 ULONG ownerPropertyIndex;
811 * Methods of the SmallBlockChainStream class.
813 SmallBlockChainStream* SmallBlockChainStream_Construct(
814 StorageImpl* parentStorage,
815 ULONG propertyIndex);
817 void SmallBlockChainStream_Destroy(
818 SmallBlockChainStream* This);
820 ULONG SmallBlockChainStream_GetHeadOfChain(
821 SmallBlockChainStream* This);
823 ULONG SmallBlockChainStream_GetNextBlockInChain(
824 SmallBlockChainStream* This,
825 ULONG blockIndex);
827 void SmallBlockChainStream_SetNextBlockInChain(
828 SmallBlockChainStream* This,
829 ULONG blockIndex,
830 ULONG nextBlock);
832 void SmallBlockChainStream_FreeBlock(
833 SmallBlockChainStream* This,
834 ULONG blockIndex);
836 ULONG SmallBlockChainStream_GetNextFreeBlock(
837 SmallBlockChainStream* This);
839 BOOL SmallBlockChainStream_ReadAt(
840 SmallBlockChainStream* This,
841 ULARGE_INTEGER offset,
842 ULONG size,
843 void* buffer,
844 ULONG* bytesRead);
846 BOOL SmallBlockChainStream_WriteAt(
847 SmallBlockChainStream* This,
848 ULARGE_INTEGER offset,
849 ULONG size,
850 const void* buffer,
851 ULONG* bytesWritten);
853 BOOL SmallBlockChainStream_SetSize(
854 SmallBlockChainStream* This,
855 ULARGE_INTEGER newSize);
857 ULARGE_INTEGER SmallBlockChainStream_GetSize(
858 SmallBlockChainStream* This);
860 ULONG SmallBlockChainStream_GetCount(
861 SmallBlockChainStream* This);
864 #endif /* __STORAGE32_H__ */