ole32: Use symbolic names for range lock offsets.
[wine/wine-gecko.git] / dlls / ole32 / storage32.h
blob83fdd4c8078fe66e8bcfaee0171471172b9ebf56
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
14 * Copyright 2010 Vincent Povirk for CodeWeavers
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #ifndef __STORAGE32_H__
31 #define __STORAGE32_H__
33 #include <stdarg.h>
35 #include "windef.h"
36 #include "winbase.h"
37 #include "winnt.h"
38 #include "objbase.h"
39 #include "winreg.h"
40 #include "winternl.h"
41 #include "wine/list.h"
44 * Definitions for the file format offsets.
46 static const ULONG OFFSET_MINORVERSION = 0x00000018;
47 static const ULONG OFFSET_MAJORVERSION = 0x0000001a;
48 static const ULONG OFFSET_BYTEORDERMARKER = 0x0000001c;
49 static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
50 static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
51 static const ULONG OFFSET_DIRSECTORCOUNT = 0x00000028;
52 static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
53 static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
54 static const ULONG OFFSET_SMALLBLOCKLIMIT = 0x00000038;
55 static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
56 static const ULONG OFFSET_SBDEPOTCOUNT = 0x00000040;
57 static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
58 static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048;
59 static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C;
60 static const ULONG OFFSET_PS_NAME = 0x00000000;
61 static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040;
62 static const ULONG OFFSET_PS_STGTYPE = 0x00000042;
63 static const ULONG OFFSET_PS_LEFTCHILD = 0x00000044;
64 static const ULONG OFFSET_PS_RIGHTCHILD = 0x00000048;
65 static const ULONG OFFSET_PS_DIRROOT = 0x0000004C;
66 static const ULONG OFFSET_PS_GUID = 0x00000050;
67 static const ULONG OFFSET_PS_CTIMELOW = 0x00000064;
68 static const ULONG OFFSET_PS_CTIMEHIGH = 0x00000068;
69 static const ULONG OFFSET_PS_MTIMELOW = 0x0000006C;
70 static const ULONG OFFSET_PS_MTIMEHIGH = 0x00000070;
71 static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
72 static const ULONG OFFSET_PS_SIZE = 0x00000078;
73 static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
74 static const WORD MIN_BIG_BLOCK_SIZE_BITS = 0x0009;
75 static const WORD MAX_BIG_BLOCK_SIZE_BITS = 0x000c;
76 static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
77 static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
78 static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
79 static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
80 static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
81 static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;
82 static const ULONG BLOCK_UNUSED = 0xFFFFFFFF;
83 static const ULONG DIRENTRY_NULL = 0xFFFFFFFF;
85 #define DIRENTRY_NAME_MAX_LEN 0x20
86 #define DIRENTRY_NAME_BUFFER_LEN 0x40
88 #define RAW_DIRENTRY_SIZE 0x00000080
90 #define HEADER_SIZE 512
92 #define MIN_BIG_BLOCK_SIZE 0x200
93 #define MAX_BIG_BLOCK_SIZE 0x1000
96 * Type of child entry link
98 #define DIRENTRY_RELATION_PREVIOUS 0
99 #define DIRENTRY_RELATION_NEXT 1
100 #define DIRENTRY_RELATION_DIR 2
103 * type constant used in files for the root storage
105 #define STGTY_ROOT 0x05
107 #define COUNT_BBDEPOTINHEADER 109
109 /* FIXME: This value is stored in the header, but we hard-code it to 0x1000. */
110 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
112 #define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f)
113 #define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0)
114 #define STGM_CREATE_MODE(stgm) ((stgm)&0x0f000)
116 #define STGM_KNOWN_FLAGS (0xf0ff | \
117 STGM_TRANSACTED | STGM_CONVERT | STGM_PRIORITY | STGM_NOSCRATCH | \
118 STGM_NOSNAPSHOT | STGM_DIRECT_SWMR | STGM_DELETEONRELEASE | STGM_SIMPLE)
121 * Forward declarations of all the structures used by the storage
122 * module.
124 typedef struct StorageBaseImpl StorageBaseImpl;
125 typedef struct StorageBaseImplVtbl StorageBaseImplVtbl;
126 typedef struct StorageImpl StorageImpl;
127 typedef struct BlockChainStream BlockChainStream;
128 typedef struct SmallBlockChainStream SmallBlockChainStream;
129 typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
130 typedef struct DirEntry DirEntry;
131 typedef struct StgStreamImpl StgStreamImpl;
134 * A reference to a directory entry in the file or a transacted cache.
136 typedef ULONG DirRef;
139 * This utility structure is used to read/write the information in a directory
140 * entry.
142 struct DirEntry
144 WCHAR name[DIRENTRY_NAME_MAX_LEN];
145 WORD sizeOfNameString;
146 BYTE stgType;
147 DirRef leftChild;
148 DirRef rightChild;
149 DirRef dirRootEntry;
150 GUID clsid;
151 FILETIME ctime;
152 FILETIME mtime;
153 ULONG startingBlock;
154 ULARGE_INTEGER size;
157 HRESULT FileLockBytesImpl_Construct(HANDLE hFile, DWORD openFlags, LPCWSTR pwcsName, ILockBytes **pLockBytes) DECLSPEC_HIDDEN;
159 /*************************************************************************
160 * Ole Convert support
163 HRESULT STORAGE_CreateOleStream(IStorage*, DWORD) DECLSPEC_HIDDEN;
164 HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName) DECLSPEC_HIDDEN;
166 enum swmr_mode
168 SWMR_None,
169 SWMR_Writer,
170 SWMR_Reader
173 /****************************************************************************
174 * StorageBaseImpl definitions.
176 * This structure defines the base information contained in all implementations
177 * of IStorage contained in this file storage implementation.
179 * In OOP terms, this is the base class for all the IStorage implementations
180 * contained in this file.
182 struct StorageBaseImpl
184 IStorage IStorage_iface;
185 IPropertySetStorage IPropertySetStorage_iface; /* interface for adding a properties stream */
186 IDirectWriterLock IDirectWriterLock_iface;
187 LONG ref;
190 * Stream tracking list
193 struct list strmHead;
196 * Storage tracking list
198 struct list storageHead;
201 * TRUE if this object has been invalidated
203 BOOL reverted;
206 * Index of the directory entry of this storage
208 DirRef storageDirEntry;
211 * virtual methods.
213 const StorageBaseImplVtbl *baseVtbl;
216 * flags that this storage was opened or created with
218 DWORD openFlags;
221 * State bits appear to only be preserved while running. No in the stream
223 DWORD stateBits;
225 BOOL create; /* Was the storage created or opened.
226 The behaviour of STGM_SIMPLE depends on this */
228 * If this storage was opened in transacted mode, the object that implements
229 * the transacted snapshot or cache.
231 StorageBaseImpl *transactedChild;
232 enum swmr_mode lockingrole;
235 /* virtual methods for StorageBaseImpl objects */
236 struct StorageBaseImplVtbl {
237 void (*Destroy)(StorageBaseImpl*);
238 void (*Invalidate)(StorageBaseImpl*);
239 HRESULT (*Flush)(StorageBaseImpl*);
240 HRESULT (*GetFilename)(StorageBaseImpl*,LPWSTR*);
241 HRESULT (*CreateDirEntry)(StorageBaseImpl*,const DirEntry*,DirRef*);
242 HRESULT (*WriteDirEntry)(StorageBaseImpl*,DirRef,const DirEntry*);
243 HRESULT (*ReadDirEntry)(StorageBaseImpl*,DirRef,DirEntry*);
244 HRESULT (*DestroyDirEntry)(StorageBaseImpl*,DirRef);
245 HRESULT (*StreamReadAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,void*,ULONG*);
246 HRESULT (*StreamWriteAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,const void*,ULONG*);
247 HRESULT (*StreamSetSize)(StorageBaseImpl*,DirRef,ULARGE_INTEGER);
248 HRESULT (*StreamLink)(StorageBaseImpl*,DirRef,DirRef);
251 static inline void StorageBaseImpl_Destroy(StorageBaseImpl *This)
253 This->baseVtbl->Destroy(This);
256 static inline void StorageBaseImpl_Invalidate(StorageBaseImpl *This)
258 This->baseVtbl->Invalidate(This);
261 static inline HRESULT StorageBaseImpl_Flush(StorageBaseImpl *This)
263 return This->baseVtbl->Flush(This);
266 static inline HRESULT StorageBaseImpl_GetFilename(StorageBaseImpl *This, LPWSTR *result)
268 return This->baseVtbl->GetFilename(This, result);
271 static inline HRESULT StorageBaseImpl_CreateDirEntry(StorageBaseImpl *This,
272 const DirEntry *newData, DirRef *index)
274 return This->baseVtbl->CreateDirEntry(This, newData, index);
277 static inline HRESULT StorageBaseImpl_WriteDirEntry(StorageBaseImpl *This,
278 DirRef index, const DirEntry *data)
280 return This->baseVtbl->WriteDirEntry(This, index, data);
283 static inline HRESULT StorageBaseImpl_ReadDirEntry(StorageBaseImpl *This,
284 DirRef index, DirEntry *data)
286 return This->baseVtbl->ReadDirEntry(This, index, data);
289 static inline HRESULT StorageBaseImpl_DestroyDirEntry(StorageBaseImpl *This,
290 DirRef index)
292 return This->baseVtbl->DestroyDirEntry(This, index);
295 /* Read up to size bytes from this directory entry's stream at the given offset. */
296 static inline HRESULT StorageBaseImpl_StreamReadAt(StorageBaseImpl *This,
297 DirRef index, ULARGE_INTEGER offset, ULONG size, void *buffer, ULONG *bytesRead)
299 return This->baseVtbl->StreamReadAt(This, index, offset, size, buffer, bytesRead);
302 /* Write size bytes to this directory entry's stream at the given offset,
303 * growing the stream if necessary. */
304 static inline HRESULT StorageBaseImpl_StreamWriteAt(StorageBaseImpl *This,
305 DirRef index, ULARGE_INTEGER offset, ULONG size, const void *buffer, ULONG *bytesWritten)
307 return This->baseVtbl->StreamWriteAt(This, index, offset, size, buffer, bytesWritten);
310 static inline HRESULT StorageBaseImpl_StreamSetSize(StorageBaseImpl *This,
311 DirRef index, ULARGE_INTEGER newsize)
313 return This->baseVtbl->StreamSetSize(This, index, newsize);
316 /* Make dst point to the same stream that src points to. Other stream operations
317 * will not work properly for entries that point to the same stream, so this
318 * must be a very temporary state, and only one entry pointing to a given stream
319 * may be reachable at any given time. */
320 static inline HRESULT StorageBaseImpl_StreamLink(StorageBaseImpl *This,
321 DirRef dst, DirRef src)
323 return This->baseVtbl->StreamLink(This, dst, src);
326 /****************************************************************************
327 * StorageBaseImpl stream list handlers
330 void StorageBaseImpl_AddStream(StorageBaseImpl * stg, StgStreamImpl * strm) DECLSPEC_HIDDEN;
331 void StorageBaseImpl_RemoveStream(StorageBaseImpl * stg, StgStreamImpl * strm) DECLSPEC_HIDDEN;
333 /* Number of BlockChainStream objects to cache in a StorageImpl */
334 #define BLOCKCHAIN_CACHE_SIZE 4
336 /****************************************************************************
337 * Storage32Impl definitions.
339 * This implementation of the IStorage32 interface represents a root
340 * storage. Basically, a document file.
342 struct StorageImpl
344 struct StorageBaseImpl base;
347 * File header
349 WORD bigBlockSizeBits;
350 WORD smallBlockSizeBits;
351 ULONG bigBlockSize;
352 ULONG smallBlockSize;
353 ULONG bigBlockDepotCount;
354 ULONG rootStartBlock;
355 ULONG smallBlockLimit;
356 ULONG smallBlockDepotStart;
357 ULONG extBigBlockDepotStart;
358 ULONG *extBigBlockDepotLocations;
359 ULONG extBigBlockDepotLocationsSize;
360 ULONG extBigBlockDepotCount;
361 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
363 ULONG extBlockDepotCached[MAX_BIG_BLOCK_SIZE / 4];
364 ULONG indexExtBlockDepotCached;
366 ULONG blockDepotCached[MAX_BIG_BLOCK_SIZE / 4];
367 ULONG indexBlockDepotCached;
368 ULONG prevFreeBlock;
370 /* All small blocks before this one are known to be in use. */
371 ULONG firstFreeSmallBlock;
374 * Abstraction of the big block chains for the chains of the header.
376 BlockChainStream* rootBlockChain;
377 BlockChainStream* smallBlockDepotChain;
378 BlockChainStream* smallBlockRootChain;
380 /* Cache of block chain streams objects for directory entries */
381 BlockChainStream* blockChainCache[BLOCKCHAIN_CACHE_SIZE];
382 UINT blockChainToEvict;
384 ILockBytes* lockBytes;
386 ULONG locked_bytes[8];
389 HRESULT StorageImpl_ReadRawDirEntry(
390 StorageImpl *This,
391 ULONG index,
392 BYTE *buffer) DECLSPEC_HIDDEN;
394 void UpdateRawDirEntry(
395 BYTE *buffer,
396 const DirEntry *newData) DECLSPEC_HIDDEN;
398 HRESULT StorageImpl_WriteRawDirEntry(
399 StorageImpl *This,
400 ULONG index,
401 const BYTE *buffer) DECLSPEC_HIDDEN;
403 HRESULT StorageImpl_ReadDirEntry(
404 StorageImpl* This,
405 DirRef index,
406 DirEntry* buffer) DECLSPEC_HIDDEN;
408 HRESULT StorageImpl_WriteDirEntry(
409 StorageImpl* This,
410 DirRef index,
411 const DirEntry* buffer) DECLSPEC_HIDDEN;
413 BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
414 StorageImpl* This,
415 SmallBlockChainStream** ppsbChain) DECLSPEC_HIDDEN;
417 SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
418 StorageImpl* This,
419 BlockChainStream** ppbbChain,
420 ULARGE_INTEGER newSize) DECLSPEC_HIDDEN;
422 /****************************************************************************
423 * StgStreamImpl definitions.
425 * This class implements the IStream interface and represents a stream
426 * located inside a storage object.
428 struct StgStreamImpl
430 IStream IStream_iface;
431 LONG ref;
434 * We are an entry in the storage object's stream handler list
436 struct list StrmListEntry;
439 * Storage that is the parent(owner) of the stream
441 StorageBaseImpl* parentStorage;
444 * Access mode of this stream.
446 DWORD grfMode;
449 * Index of the directory entry that owns (points to) this stream.
451 DirRef dirEntry;
454 * This is the current position of the cursor in the stream
456 ULARGE_INTEGER currentPosition;
459 static inline StgStreamImpl *impl_from_IStream( IStream *iface )
461 return CONTAINING_RECORD(iface, StgStreamImpl, IStream_iface);
465 * Method definition for the StgStreamImpl class.
467 StgStreamImpl* StgStreamImpl_Construct(
468 StorageBaseImpl* parentStorage,
469 DWORD grfMode,
470 DirRef dirEntry) DECLSPEC_HIDDEN;
473 /* Range lock constants.
475 * The storage format reserves the region from 0x7fffff00-0x7fffffff for
476 * locking and synchronization. Unfortuantely, the spec doesn't say which bytes
477 * within that range are used, and for what. These are guesses based on testing.
478 * In particular, ends of ranges may be wrong.
480 0x0 through 0x57: Unknown. Causes read-only exclusive opens to fail.
481 0x58 through 0x7f: Priority mode.
482 0x80: Commit lock.
483 0x81 through 0x91: Priority mode, again. Not sure why it uses two regions.
484 0x92: Lock-checking lock. Held while opening so ranges can be tested without
485 causing spurious failures if others try to grab or test those ranges at the
486 same time.
487 0x93 through 0xa6: Read mode.
488 0xa7 through 0xba: Write mode.
489 0xbb through 0xce: Deny read.
490 0xcf through 0xe2: Deny write.
491 0xe2 through 0xff: Unknown. Causes read-only exclusive opens to fail.
494 #define RANGELOCK_UNK1_FIRST 0x7fffff00
495 #define RANGELOCK_UNK1_LAST 0x7fffff57
496 #define RANGELOCK_PRIORITY1_FIRST 0x7fffff58
497 #define RANGELOCK_PRIORITY1_LAST 0x7fffff7f
498 #define RANGELOCK_COMMIT 0x7fffff80
499 #define RANGELOCK_PRIORITY2_FIRST 0x7fffff81
500 #define RANGELOCK_PRIORITY2_LAST 0x7fffff91
501 #define RANGELOCK_CHECKLOCKS 0x7fffff92
502 #define RANGELOCK_READ_FIRST 0x7fffff93
503 #define RANGELOCK_READ_LAST 0x7fffffa6
504 #define RANGELOCK_WRITE_FIRST 0x7fffffa7
505 #define RANGELOCK_WRITE_LAST 0x7fffffba
506 #define RANGELOCK_DENY_READ_FIRST 0x7fffffbb
507 #define RANGELOCK_DENY_READ_LAST 0x7fffffce
508 #define RANGELOCK_DENY_WRITE_FIRST 0x7fffffcf
509 #define RANGELOCK_DENY_WRITE_LAST 0x7fffffe2
510 #define RANGELOCK_UNK2_FIRST 0x7fffffe3
511 #define RANGELOCK_UNK2_LAST 0x7fffffff
512 #define RANGELOCK_TRANSACTION_FIRST RANGELOCK_PRIORITY1_FIRST
513 #define RANGELOCK_TRANSACTION_LAST RANGELOCK_CHECKLOCKS
514 #define RANGELOCK_FIRST RANGELOCK_UNK1_FIRST
515 #define RANGELOCK_LAST RANGELOCK_UNK2_LAST
518 /******************************************************************************
519 * Endian conversion macros
521 #ifdef WORDS_BIGENDIAN
523 #define htole32(x) RtlUlongByteSwap(x)
524 #define htole16(x) RtlUshortByteSwap(x)
525 #define lendian32toh(x) RtlUlongByteSwap(x)
526 #define lendian16toh(x) RtlUshortByteSwap(x)
528 #else
530 #define htole32(x) (x)
531 #define htole16(x) (x)
532 #define lendian32toh(x) (x)
533 #define lendian16toh(x) (x)
535 #endif
537 /******************************************************************************
538 * The StorageUtl_ functions are miscellaneous utility functions. Most of which
539 * are abstractions used to read values from file buffers without having to
540 * worry about bit order
542 void StorageUtl_ReadWord(const BYTE* buffer, ULONG offset, WORD* value) DECLSPEC_HIDDEN;
543 void StorageUtl_WriteWord(BYTE* buffer, ULONG offset, WORD value) DECLSPEC_HIDDEN;
544 void StorageUtl_ReadDWord(const BYTE* buffer, ULONG offset, DWORD* value) DECLSPEC_HIDDEN;
545 void StorageUtl_WriteDWord(BYTE* buffer, ULONG offset, DWORD value) DECLSPEC_HIDDEN;
546 void StorageUtl_ReadULargeInteger(const BYTE* buffer, ULONG offset,
547 ULARGE_INTEGER* value) DECLSPEC_HIDDEN;
548 void StorageUtl_WriteULargeInteger(BYTE* buffer, ULONG offset,
549 const ULARGE_INTEGER *value) DECLSPEC_HIDDEN;
550 void StorageUtl_ReadGUID(const BYTE* buffer, ULONG offset, GUID* value) DECLSPEC_HIDDEN;
551 void StorageUtl_WriteGUID(BYTE* buffer, ULONG offset, const GUID* value) DECLSPEC_HIDDEN;
552 void StorageUtl_CopyDirEntryToSTATSTG(StorageBaseImpl *storage,STATSTG* destination,
553 const DirEntry* source, int statFlags) DECLSPEC_HIDDEN;
555 /****************************************************************************
556 * BlockChainStream definitions.
558 * The BlockChainStream class is a utility class that is used to create an
559 * abstraction of the big block chains in the storage file.
561 struct BlockChainRun
563 /* This represents a range of blocks that happen reside in consecutive sectors. */
564 ULONG firstSector;
565 ULONG firstOffset;
566 ULONG lastOffset;
569 typedef struct BlockChainBlock
571 ULONG index;
572 ULONG sector;
573 BOOL read;
574 BOOL dirty;
575 BYTE data[MAX_BIG_BLOCK_SIZE];
576 } BlockChainBlock;
578 struct BlockChainStream
580 StorageImpl* parentStorage;
581 ULONG* headOfStreamPlaceHolder;
582 DirRef ownerDirEntry;
583 struct BlockChainRun* indexCache;
584 ULONG indexCacheLen;
585 ULONG indexCacheSize;
586 BlockChainBlock cachedBlocks[2];
587 ULONG blockToEvict;
588 ULONG tailIndex;
589 ULONG numBlocks;
593 * Methods for the BlockChainStream class.
595 BlockChainStream* BlockChainStream_Construct(
596 StorageImpl* parentStorage,
597 ULONG* headOfStreamPlaceHolder,
598 DirRef dirEntry) DECLSPEC_HIDDEN;
600 void BlockChainStream_Destroy(
601 BlockChainStream* This) DECLSPEC_HIDDEN;
603 HRESULT BlockChainStream_ReadAt(
604 BlockChainStream* This,
605 ULARGE_INTEGER offset,
606 ULONG size,
607 void* buffer,
608 ULONG* bytesRead) DECLSPEC_HIDDEN;
610 HRESULT BlockChainStream_WriteAt(
611 BlockChainStream* This,
612 ULARGE_INTEGER offset,
613 ULONG size,
614 const void* buffer,
615 ULONG* bytesWritten) DECLSPEC_HIDDEN;
617 BOOL BlockChainStream_SetSize(
618 BlockChainStream* This,
619 ULARGE_INTEGER newSize) DECLSPEC_HIDDEN;
621 HRESULT BlockChainStream_Flush(
622 BlockChainStream* This) DECLSPEC_HIDDEN;
624 /****************************************************************************
625 * SmallBlockChainStream definitions.
627 * The SmallBlockChainStream class is a utility class that is used to create an
628 * abstraction of the small block chains in the storage file.
630 struct SmallBlockChainStream
632 StorageImpl* parentStorage;
633 DirRef ownerDirEntry;
634 ULONG* headOfStreamPlaceHolder;
638 * Methods of the SmallBlockChainStream class.
640 SmallBlockChainStream* SmallBlockChainStream_Construct(
641 StorageImpl* parentStorage,
642 ULONG* headOfStreamPlaceHolder,
643 DirRef dirEntry) DECLSPEC_HIDDEN;
645 void SmallBlockChainStream_Destroy(
646 SmallBlockChainStream* This) DECLSPEC_HIDDEN;
648 HRESULT SmallBlockChainStream_ReadAt(
649 SmallBlockChainStream* This,
650 ULARGE_INTEGER offset,
651 ULONG size,
652 void* buffer,
653 ULONG* bytesRead) DECLSPEC_HIDDEN;
655 HRESULT SmallBlockChainStream_WriteAt(
656 SmallBlockChainStream* This,
657 ULARGE_INTEGER offset,
658 ULONG size,
659 const void* buffer,
660 ULONG* bytesWritten) DECLSPEC_HIDDEN;
662 BOOL SmallBlockChainStream_SetSize(
663 SmallBlockChainStream* This,
664 ULARGE_INTEGER newSize) DECLSPEC_HIDDEN;
667 #endif /* __STORAGE32_H__ */