Temporary hack to share handles between processes sharing the same
[wine/multimedia.git] / dlls / ole32 / storage32.h
blob6fd1eb72561af2b8ff2c10fb7fd42badec06d997
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;
139 struct BigBlockFile
141 BOOL fileBased;
142 ULARGE_INTEGER filesize;
143 ULONG blocksize;
144 HANDLE hfile;
145 HANDLE hfilemap;
146 DWORD flProtect;
147 MappedPage *maplist;
148 MappedPage *victimhead, *victimtail;
149 ULONG num_victim_pages;
150 ILockBytes *pLkbyt;
151 HGLOBAL hbytearray;
152 LPVOID pbytearray;
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 * Ole Convert support
175 void OLECONVERT_CreateOleStream(LPSTORAGE pStorage);
176 HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName);
178 /****************************************************************************
179 * Storage32BaseImpl definitions.
181 * This stucture defines the base information contained in all implementations
182 * of IStorage32 contained in this filee storage implementation.
184 * In OOP terms, this is the base class for all the IStorage32 implementations
185 * contained in this file.
187 struct StorageBaseImpl
189 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
190 * since we want to cast this in a Storage32 pointer */
193 * Reference count of this object
195 ULONG ref;
198 * Ancestor storage (top level)
200 StorageImpl* ancestorStorage;
203 * Index of the property for the root of
204 * this storage
206 ULONG rootPropertySetIndex;
209 * virtual Destructor method.
211 void (*v_destructor)(StorageBaseImpl*);
216 * Prototypes for the methods of the Storage32BaseImpl class.
218 HRESULT WINAPI StorageBaseImpl_QueryInterface(
219 IStorage* iface,
220 REFIID riid,
221 void** ppvObject);
223 ULONG WINAPI StorageBaseImpl_AddRef(
224 IStorage* iface);
226 ULONG WINAPI StorageBaseImpl_Release(
227 IStorage* iface);
229 HRESULT WINAPI StorageBaseImpl_OpenStream(
230 IStorage* iface,
231 const OLECHAR* pwcsName, /* [string][in] */
232 void* reserved1, /* [unique][in] */
233 DWORD grfMode, /* [in] */
234 DWORD reserved2, /* [in] */
235 IStream** ppstm); /* [out] */
237 HRESULT WINAPI StorageBaseImpl_OpenStorage(
238 IStorage* iface,
239 const OLECHAR* pwcsName, /* [string][unique][in] */
240 IStorage* pstgPriority, /* [unique][in] */
241 DWORD grfMode, /* [in] */
242 SNB snbExclude, /* [unique][in] */
243 DWORD reserved, /* [in] */
244 IStorage** ppstg); /* [out] */
246 HRESULT WINAPI StorageBaseImpl_EnumElements(
247 IStorage* iface,
248 DWORD reserved1, /* [in] */
249 void* reserved2, /* [size_is][unique][in] */
250 DWORD reserved3, /* [in] */
251 IEnumSTATSTG** ppenum); /* [out] */
253 HRESULT WINAPI StorageBaseImpl_Stat(
254 IStorage* iface,
255 STATSTG* pstatstg, /* [out] */
256 DWORD grfStatFlag); /* [in] */
258 HRESULT WINAPI StorageBaseImpl_RenameElement(
259 IStorage* iface,
260 const OLECHAR* pwcsOldName, /* [string][in] */
261 const OLECHAR* pwcsNewName); /* [string][in] */
263 HRESULT WINAPI StorageBaseImpl_CreateStream(
264 IStorage* iface,
265 const OLECHAR* pwcsName, /* [string][in] */
266 DWORD grfMode, /* [in] */
267 DWORD reserved1, /* [in] */
268 DWORD reserved2, /* [in] */
269 IStream** ppstm); /* [out] */
271 HRESULT WINAPI StorageBaseImpl_SetClass(
272 IStorage* iface,
273 REFCLSID clsid); /* [in] */
275 /****************************************************************************
276 * Storage32Impl definitions.
278 * This implementation of the IStorage32 interface represents a root
279 * storage. Basically, a document file.
281 struct StorageImpl
283 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
284 * since we want to cast this in a Storage32 pointer */
287 * Declare the member of the Storage32BaseImpl class to allow
288 * casting as a Storage32BaseImpl
290 ULONG ref;
291 struct StorageImpl* ancestorStorage;
292 ULONG rootPropertySetIndex;
293 void (*v_destructor)(struct StorageImpl*);
296 * The following data members are specific to the Storage32Impl
297 * class
299 HANDLE hFile; /* Physical support for the Docfile */
302 * File header
304 WORD bigBlockSizeBits;
305 WORD smallBlockSizeBits;
306 ULONG bigBlockSize;
307 ULONG smallBlockSize;
308 ULONG bigBlockDepotCount;
309 ULONG rootStartBlock;
310 ULONG smallBlockDepotStart;
311 ULONG extBigBlockDepotStart;
312 ULONG extBigBlockDepotCount;
313 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
315 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
316 ULONG indexBlockDepotCached;
317 ULONG prevFreeBlock;
320 * Abstraction of the big block chains for the chains of the header.
322 BlockChainStream* rootBlockChain;
323 BlockChainStream* smallBlockDepotChain;
324 BlockChainStream* smallBlockRootChain;
327 * Pointer to the big block file abstraction
329 BigBlockFile* bigBlockFile;
333 * Method declaration for the Storage32Impl class
336 HRESULT WINAPI StorageImpl_CreateStorage(
337 IStorage* iface,
338 const OLECHAR* pwcsName, /* [string][in] */
339 DWORD grfMode, /* [in] */
340 DWORD dwStgFmt, /* [in] */
341 DWORD reserved2, /* [in] */
342 IStorage** ppstg); /* [out] */
344 HRESULT WINAPI StorageImpl_CopyTo(
345 IStorage* iface,
346 DWORD ciidExclude, /* [in] */
347 const IID* rgiidExclude, /* [size_is][unique][in] */
348 SNB snbExclude, /* [unique][in] */
349 IStorage* pstgDest); /* [unique][in] */
351 HRESULT WINAPI StorageImpl_MoveElementTo(
352 IStorage* iface,
353 const OLECHAR* pwcsName, /* [string][in] */
354 IStorage* pstgDest, /* [unique][in] */
355 const OLECHAR* pwcsNewName, /* [string][in] */
356 DWORD grfFlags); /* [in] */
358 HRESULT WINAPI StorageImpl_Commit(
359 IStorage* iface,
360 DWORD grfCommitFlags); /* [in] */
362 HRESULT WINAPI StorageImpl_Revert(
363 IStorage* iface);
365 HRESULT WINAPI StorageImpl_DestroyElement(
366 IStorage* iface,
367 const OLECHAR* pwcsName); /* [string][in] */
369 HRESULT WINAPI StorageImpl_SetElementTimes(
370 IStorage* iface,
371 const OLECHAR* pwcsName, /* [string][in] */
372 const FILETIME* pctime, /* [in] */
373 const FILETIME* patime, /* [in] */
374 const FILETIME* pmtime); /* [in] */
376 HRESULT WINAPI StorageImpl_SetStateBits(
377 IStorage* iface,
378 DWORD grfStateBits, /* [in] */
379 DWORD grfMask); /* [in] */
381 void StorageImpl_Destroy(
382 StorageImpl* This);
384 HRESULT StorageImpl_Construct(
385 StorageImpl* This,
386 HANDLE hFile,
387 ILockBytes* pLkbyt,
388 DWORD openFlags,
389 BOOL fileBased,
390 BOOL fileCreate);
392 BOOL StorageImpl_ReadBigBlock(
393 StorageImpl* This,
394 ULONG blockIndex,
395 void* buffer);
397 BOOL StorageImpl_WriteBigBlock(
398 StorageImpl* This,
399 ULONG blockIndex,
400 void* buffer);
402 void* StorageImpl_GetROBigBlock(
403 StorageImpl* This,
404 ULONG blockIndex);
406 void* StorageImpl_GetBigBlock(
407 StorageImpl* This,
408 ULONG blockIndex);
410 void StorageImpl_ReleaseBigBlock(
411 StorageImpl* This,
412 void* pBigBlock);
414 ULONG StorageImpl_GetNextFreeBigBlock(
415 StorageImpl* This);
417 void StorageImpl_FreeBigBlock(
418 StorageImpl* This,
419 ULONG blockIndex);
421 ULONG StorageImpl_GetNextBlockInChain(
422 StorageImpl* This,
423 ULONG blockIndex);
425 void StorageImpl_SetNextBlockInChain(
426 StorageImpl* This,
427 ULONG blockIndex,
428 ULONG nextBlock);
430 HRESULT StorageImpl_LoadFileHeader(
431 StorageImpl* This);
433 void StorageImpl_SaveFileHeader(
434 StorageImpl* This);
436 BOOL StorageImpl_ReadProperty(
437 StorageImpl* This,
438 ULONG index,
439 StgProperty* buffer);
441 BOOL StorageImpl_WriteProperty(
442 StorageImpl* This,
443 ULONG index,
444 StgProperty* buffer);
446 BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
447 StorageImpl* This,
448 SmallBlockChainStream** ppsbChain);
450 ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
451 ULONG blockIndex);
453 void Storage32Impl_AddBlockDepot(StorageImpl* This,
454 ULONG blockIndex);
456 ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
458 ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
459 ULONG depotIndex);
461 void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
462 ULONG depotIndex,
463 ULONG blockIndex);
464 /****************************************************************************
465 * Storage32InternalImpl definitions.
467 * Definition of the implementation structure for the IStorage32 interface.
468 * This one implements the IStorage32 interface for storage that are
469 * inside another storage.
471 struct StorageInternalImpl
473 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
474 * since we want to cast this in a Storage32 pointer */
477 * Declare the member of the Storage32BaseImpl class to allow
478 * casting as a Storage32BaseImpl
480 ULONG ref;
481 struct StorageImpl* ancestorStorage;
482 ULONG rootPropertySetIndex;
483 void (*v_destructor)(struct StorageInternalImpl*);
486 * There is no specific data for this class.
491 * Method definitions for the Storage32InternalImpl class.
493 StorageInternalImpl* StorageInternalImpl_Construct(
494 StorageImpl* ancestorStorage,
495 ULONG rootTropertyIndex);
497 void StorageInternalImpl_Destroy(
498 StorageInternalImpl* This);
500 HRESULT WINAPI StorageInternalImpl_Commit(
501 IStorage* iface,
502 DWORD grfCommitFlags); /* [in] */
504 HRESULT WINAPI StorageInternalImpl_Revert(
505 IStorage* iface);
508 /****************************************************************************
509 * IEnumSTATSTGImpl definitions.
511 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
512 * This class allows iterating through the content of a storage and to find
513 * specific items inside it.
515 struct IEnumSTATSTGImpl
517 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct
518 * since we want to cast this in a IEnumSTATSTG pointer */
520 ULONG ref; /* Reference count */
521 StorageImpl* parentStorage; /* Reference to the parent storage */
522 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
525 * The current implementation of the IEnumSTATSTGImpl class uses a stack
526 * to walk the property sets to get the content of a storage. This stack
527 * is implemented by the following 3 data members
529 ULONG stackSize;
530 ULONG stackMaxSize;
531 ULONG* stackToVisit;
533 #define ENUMSTATSGT_SIZE_INCREMENT 10
537 * Method definitions for the IEnumSTATSTGImpl class.
539 HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
540 IEnumSTATSTG* iface,
541 REFIID riid,
542 void** ppvObject);
544 ULONG WINAPI IEnumSTATSTGImpl_AddRef(
545 IEnumSTATSTG* iface);
547 ULONG WINAPI IEnumSTATSTGImpl_Release(
548 IEnumSTATSTG* iface);
550 HRESULT WINAPI IEnumSTATSTGImpl_Next(
551 IEnumSTATSTG* iface,
552 ULONG celt,
553 STATSTG* rgelt,
554 ULONG* pceltFetched);
556 HRESULT WINAPI IEnumSTATSTGImpl_Skip(
557 IEnumSTATSTG* iface,
558 ULONG celt);
560 HRESULT WINAPI IEnumSTATSTGImpl_Reset(
561 IEnumSTATSTG* iface);
563 HRESULT WINAPI IEnumSTATSTGImpl_Clone(
564 IEnumSTATSTG* iface,
565 IEnumSTATSTG** ppenum);
567 IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
568 StorageImpl* This,
569 ULONG firstPropertyNode);
571 void IEnumSTATSTGImpl_Destroy(
572 IEnumSTATSTGImpl* This);
574 void IEnumSTATSTGImpl_PushSearchNode(
575 IEnumSTATSTGImpl* This,
576 ULONG nodeToPush);
578 ULONG IEnumSTATSTGImpl_PopSearchNode(
579 IEnumSTATSTGImpl* This,
580 BOOL remove);
582 ULONG IEnumSTATSTGImpl_FindProperty(
583 IEnumSTATSTGImpl* This,
584 const OLECHAR* lpszPropName,
585 StgProperty* buffer);
587 INT IEnumSTATSTGImpl_FindParentProperty(
588 IEnumSTATSTGImpl *This,
589 ULONG childProperty,
590 StgProperty *currentProperty,
591 ULONG *propertyId);
594 /****************************************************************************
595 * StgStreamImpl definitions.
597 * This class imlements the IStream32 inteface and represents a stream
598 * located inside a storage object.
600 struct StgStreamImpl
602 ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct
603 * since we want to cast this in a IStream pointer */
606 * Reference count
608 ULONG ref;
611 * Storage that is the parent(owner) of the stream
613 StorageBaseImpl* parentStorage;
616 * Access mode of this stream.
618 DWORD grfMode;
621 * Index of the property that owns (points to) this stream.
623 ULONG ownerProperty;
626 * Helper variable that contains the size of the stream
628 ULARGE_INTEGER streamSize;
631 * This is the current position of the cursor in the stream
633 ULARGE_INTEGER currentPosition;
636 * The information in the stream is represented by a chain of small blocks
637 * or a chain of large blocks. Depending on the case, one of the two
638 * following variabled points to that information.
640 BlockChainStream* bigBlockChain;
641 SmallBlockChainStream* smallBlockChain;
645 * Method definition for the StgStreamImpl class.
647 StgStreamImpl* StgStreamImpl_Construct(
648 StorageBaseImpl* parentStorage,
649 DWORD grfMode,
650 ULONG ownerProperty);
652 void StgStreamImpl_Destroy(
653 StgStreamImpl* This);
655 void StgStreamImpl_OpenBlockChain(
656 StgStreamImpl* This);
658 HRESULT WINAPI StgStreamImpl_QueryInterface(
659 IStream* iface,
660 REFIID riid, /* [in] */
661 void** ppvObject); /* [iid_is][out] */
663 ULONG WINAPI StgStreamImpl_AddRef(
664 IStream* iface);
666 ULONG WINAPI StgStreamImpl_Release(
667 IStream* iface);
669 HRESULT WINAPI StgStreamImpl_Read(
670 IStream* iface,
671 void* pv, /* [length_is][size_is][out] */
672 ULONG cb, /* [in] */
673 ULONG* pcbRead); /* [out] */
675 HRESULT WINAPI StgStreamImpl_Write(
676 IStream* iface,
677 const void* pv, /* [size_is][in] */
678 ULONG cb, /* [in] */
679 ULONG* pcbWritten); /* [out] */
681 HRESULT WINAPI StgStreamImpl_Seek(
682 IStream* iface,
683 LARGE_INTEGER dlibMove, /* [in] */
684 DWORD dwOrigin, /* [in] */
685 ULARGE_INTEGER* plibNewPosition); /* [out] */
687 HRESULT WINAPI StgStreamImpl_SetSize(
688 IStream* iface,
689 ULARGE_INTEGER libNewSize); /* [in] */
691 HRESULT WINAPI StgStreamImpl_CopyTo(
692 IStream* iface,
693 IStream* pstm, /* [unique][in] */
694 ULARGE_INTEGER cb, /* [in] */
695 ULARGE_INTEGER* pcbRead, /* [out] */
696 ULARGE_INTEGER* pcbWritten); /* [out] */
698 HRESULT WINAPI StgStreamImpl_Commit(
699 IStream* iface,
700 DWORD grfCommitFlags); /* [in] */
702 HRESULT WINAPI StgStreamImpl_Revert(
703 IStream* iface);
705 HRESULT WINAPI StgStreamImpl_LockRegion(
706 IStream* iface,
707 ULARGE_INTEGER libOffset, /* [in] */
708 ULARGE_INTEGER cb, /* [in] */
709 DWORD dwLockType); /* [in] */
711 HRESULT WINAPI StgStreamImpl_UnlockRegion(
712 IStream* iface,
713 ULARGE_INTEGER libOffset, /* [in] */
714 ULARGE_INTEGER cb, /* [in] */
715 DWORD dwLockType); /* [in] */
717 HRESULT WINAPI StgStreamImpl_Stat(
718 IStream* iface,
719 STATSTG* pstatstg, /* [out] */
720 DWORD grfStatFlag); /* [in] */
722 HRESULT WINAPI StgStreamImpl_Clone(
723 IStream* iface,
724 IStream** ppstm); /* [out] */
727 /********************************************************************************
728 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
729 * abstractions used to read values from file buffers without having to worry
730 * about bit order
732 void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
733 void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
734 void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
735 void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
736 void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
737 void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
738 void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
739 StgProperty* source,
740 int statFlags);
742 /****************************************************************************
743 * BlockChainStream definitions.
745 * The BlockChainStream class is a utility class that is used to create an
746 * abstraction of the big block chains in the storage file.
748 struct BlockChainStream
750 StorageImpl* parentStorage;
751 ULONG* headOfStreamPlaceHolder;
752 ULONG ownerPropertyIndex;
753 ULONG lastBlockNoInSequence;
754 ULONG lastBlockNoInSequenceIndex;
755 ULONG tailIndex;
756 ULONG numBlocks;
760 * Methods for the BlockChainStream class.
762 BlockChainStream* BlockChainStream_Construct(
763 StorageImpl* parentStorage,
764 ULONG* headOfStreamPlaceHolder,
765 ULONG propertyIndex);
767 void BlockChainStream_Destroy(
768 BlockChainStream* This);
770 ULONG BlockChainStream_GetHeadOfChain(
771 BlockChainStream* This);
773 BOOL BlockChainStream_ReadAt(
774 BlockChainStream* This,
775 ULARGE_INTEGER offset,
776 ULONG size,
777 void* buffer,
778 ULONG* bytesRead);
780 BOOL BlockChainStream_WriteAt(
781 BlockChainStream* This,
782 ULARGE_INTEGER offset,
783 ULONG size,
784 const void* buffer,
785 ULONG* bytesWritten);
787 BOOL BlockChainStream_SetSize(
788 BlockChainStream* This,
789 ULARGE_INTEGER newSize);
791 ULARGE_INTEGER BlockChainStream_GetSize(
792 BlockChainStream* This);
794 ULONG BlockChainStream_GetCount(
795 BlockChainStream* This);
797 /****************************************************************************
798 * SmallBlockChainStream definitions.
800 * The SmallBlockChainStream class is a utility class that is used to create an
801 * abstraction of the small block chains in the storage file.
803 struct SmallBlockChainStream
805 StorageImpl* parentStorage;
806 ULONG ownerPropertyIndex;
810 * Methods of the SmallBlockChainStream class.
812 SmallBlockChainStream* SmallBlockChainStream_Construct(
813 StorageImpl* parentStorage,
814 ULONG propertyIndex);
816 void SmallBlockChainStream_Destroy(
817 SmallBlockChainStream* This);
819 ULONG SmallBlockChainStream_GetHeadOfChain(
820 SmallBlockChainStream* This);
822 ULONG SmallBlockChainStream_GetNextBlockInChain(
823 SmallBlockChainStream* This,
824 ULONG blockIndex);
826 void SmallBlockChainStream_SetNextBlockInChain(
827 SmallBlockChainStream* This,
828 ULONG blockIndex,
829 ULONG nextBlock);
831 void SmallBlockChainStream_FreeBlock(
832 SmallBlockChainStream* This,
833 ULONG blockIndex);
835 ULONG SmallBlockChainStream_GetNextFreeBlock(
836 SmallBlockChainStream* This);
838 BOOL SmallBlockChainStream_ReadAt(
839 SmallBlockChainStream* This,
840 ULARGE_INTEGER offset,
841 ULONG size,
842 void* buffer,
843 ULONG* bytesRead);
845 BOOL SmallBlockChainStream_WriteAt(
846 SmallBlockChainStream* This,
847 ULARGE_INTEGER offset,
848 ULONG size,
849 const void* buffer,
850 ULONG* bytesWritten);
852 BOOL SmallBlockChainStream_SetSize(
853 SmallBlockChainStream* This,
854 ULARGE_INTEGER newSize);
856 ULARGE_INTEGER SmallBlockChainStream_GetSize(
857 SmallBlockChainStream* This);
859 ULONG SmallBlockChainStream_GetCount(
860 SmallBlockChainStream* This);
863 #endif /* __STORAGE32_H__ */