source: trunk/src/ole32/storage.h@ 1036

Last change on this file since 1036 was 1033, checked in by davidr, 26 years ago

Ported remaining files pertaining to OLE32 from WINE

File size: 26.4 KB
Line 
1/* $Id: storage.h,v 1.1 1999-09-24 21:49:45 davidr Exp $ */
2/*
3 * Compound Storage (32 bit version)
4 *
5 * Implemented using the documentation of the LAOLA project at
6 * <URL:http://wwwwbs.cs.tu-berlin.de/~schwartz/pmh/index.html>
7 * (Thanks to Martin Schwartz <schwartz@cs.tu-berlin.de>)
8 *
9 * This include file contains definitions of types and function
10 * prototypes that are used in the many files implementing the
11 * storage functionality
12 *
13 * Copyright 1998,1999 Francis Beaudet
14 * Copyright 1998,1999 Thuy Nguyen
15 */
16#ifndef __STORAGE32_H__
17#define __STORAGE32_H__
18
19#include "wtypes.h"
20#include "winnt.h"
21#include "wine/obj_storage.h"
22
23/*
24 * Definitions for the file format offsets.
25 */
26static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
27static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
28static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
29static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
30static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
31static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
32static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048;
33static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C;
34static const ULONG OFFSET_PS_NAME = 0x00000000;
35static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040;
36static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042;
37static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044;
38static const ULONG OFFSET_PS_NEXTPROP = 0x00000048;
39static const ULONG OFFSET_PS_DIRPROP = 0x0000004C;
40static const ULONG OFFSET_PS_GUID = 0x00000050;
41static const ULONG OFFSET_PS_TSS1 = 0x00000064;
42static const ULONG OFFSET_PS_TSD1 = 0x00000068;
43static const ULONG OFFSET_PS_TSS2 = 0x0000006C;
44static const ULONG OFFSET_PS_TSD2 = 0x00000070;
45static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
46static const ULONG OFFSET_PS_SIZE = 0x00000078;
47static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
48static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
49static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
50static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
51static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
52static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
53static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;
54static const ULONG BLOCK_UNUSED = 0xFFFFFFFF;
55static const ULONG PROPERTY_NULL = 0xFFFFFFFF;
56
57#define PROPERTY_NAME_MAX_LEN 0x20
58#define PROPERTY_NAME_BUFFER_LEN 0x40
59
60#define PROPSET_BLOCK_SIZE 0x00000080
61
62/*
63 * Property type of relation
64 */
65#define PROPERTY_RELATION_PREVIOUS 0
66#define PROPERTY_RELATION_NEXT 1
67#define PROPERTY_RELATION_DIR 2
68
69/*
70 * Property type constants
71 */
72#define PROPTYPE_STORAGE 0x01
73#define PROPTYPE_STREAM 0x02
74#define PROPTYPE_ROOT 0x05
75
76/*
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.
80 */
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
85
86/*
87 * These are signatures to detect the type of Document file.
88 */
89static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
90static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
91static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0};
92
93/*
94 * Forward declarations of all the structures used by the storage
95 * module.
96 */
97typedef struct StorageBaseImpl StorageBaseImpl;
98typedef struct StorageImpl StorageImpl;
99typedef struct StorageInternalImpl StorageInternalImpl;
100typedef struct BlockChainStream BlockChainStream;
101typedef struct SmallBlockChainStream SmallBlockChainStream;
102typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
103typedef struct StgProperty StgProperty;
104typedef struct StgStreamImpl StgStreamImpl;
105
106/*
107 * This utility structure is used to read/write the information in a storage
108 * property.
109 */
110struct StgProperty
111{
112 WCHAR name[PROPERTY_NAME_MAX_LEN];
113 WORD sizeOfNameString;
114 BYTE propertyType;
115 ULONG previousProperty;
116 ULONG nextProperty;
117 ULONG dirProperty;
118 GUID propertyUniqueID;
119 ULONG timeStampS1;
120 ULONG timeStampD1;
121 ULONG timeStampS2;
122 ULONG timeStampD2;
123 ULONG startingBlock;
124 ULARGE_INTEGER size;
125};
126
127/*************************************************************************
128 * Big Block File support
129 *
130 * The big block file is an abstraction of a flat file separated in
131 * same sized blocks. The implementation for the methods described in
132 * this section appear in stg_bigblockfile.c
133 */
134
135/*
136 * Declaration of the data structures
137 */
138typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
139typedef struct MappedPage MappedPage,*LPMAPPEDPAGE;
140typedef struct BigBlock BigBlock,*LPBIGBLOCK;
141
142struct BigBlockFile
143{
144 BOOL fileBased;
145 ULARGE_INTEGER filesize;
146 ULONG blocksize;
147 HANDLE hfile;
148 HANDLE hfilemap;
149 DWORD flProtect;
150 MappedPage *maplisthead;
151 ILockBytes *pLkbyt;
152 HGLOBAL hbytearray;
153 LPVOID pbytearray;
154 BigBlock *headblock;
155};
156
157/*
158 * Declaration of the functions used to manipulate the BigBlockFile
159 * data structure.
160 */
161BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
162 ILockBytes* pLkByt,
163 DWORD openFlags,
164 ULONG blocksize,
165 BOOL fileBased);
166void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
167void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
168void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
169void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
170void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
171ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
172
173/****************************************************************************
174 * Storage32BaseImpl definitions.
175 *
176 * This stucture defines the base information contained in all implementations
177 * of IStorage32 contained in this filee storage implementation.
178 *
179 * In OOP terms, this is the base class for all the IStorage32 implementations
180 * contained in this file.
181 */
182struct StorageBaseImpl
183{
184 ICOM_VTABLE(IStorage)* lpvtbl; /* Needs to be the first item in the stuct
185 * since we want to cast this in a Storage32 pointer */
186
187 /*
188 * Reference count of this object
189 */
190 ULONG ref;
191
192 /*
193 * Ancestor storage (top level)
194 */
195 StorageImpl* ancestorStorage;
196
197 /*
198 * Index of the property for the root of
199 * this storage
200 */
201 ULONG rootPropertySetIndex;
202
203 /*
204 * virtual Destructor method.
205 */
206 void (*v_destructor)(StorageBaseImpl*);
207};
208
209
210/*
211 * Prototypes for the methods of the Storage32BaseImpl class.
212 */
213HRESULT WINAPI StorageBaseImpl_QueryInterface(
214 IStorage* iface,
215 REFIID riid,
216 void** ppvObject);
217
218ULONG WINAPI StorageBaseImpl_AddRef(
219 IStorage* iface);
220
221ULONG WINAPI StorageBaseImpl_Release(
222 IStorage* iface);
223
224HRESULT WINAPI StorageBaseImpl_OpenStream(
225 IStorage* iface,
226 const OLECHAR* pwcsName, /* [string][in] */
227 void* reserved1, /* [unique][in] */
228 DWORD grfMode, /* [in] */
229 DWORD reserved2, /* [in] */
230 IStream** ppstm); /* [out] */
231
232HRESULT WINAPI StorageBaseImpl_OpenStorage(
233 IStorage* iface,
234 const OLECHAR* pwcsName, /* [string][unique][in] */
235 IStorage* pstgPriority, /* [unique][in] */
236 DWORD grfMode, /* [in] */
237 SNB snbExclude, /* [unique][in] */
238 DWORD reserved, /* [in] */
239 IStorage** ppstg); /* [out] */
240
241HRESULT WINAPI StorageBaseImpl_EnumElements(
242 IStorage* iface,
243 DWORD reserved1, /* [in] */
244 void* reserved2, /* [size_is][unique][in] */
245 DWORD reserved3, /* [in] */
246 IEnumSTATSTG** ppenum); /* [out] */
247
248HRESULT WINAPI StorageBaseImpl_Stat(
249 IStorage* iface,
250 STATSTG* pstatstg, /* [out] */
251 DWORD grfStatFlag); /* [in] */
252
253HRESULT WINAPI StorageBaseImpl_RenameElement(
254 IStorage* iface,
255 const OLECHAR* pwcsOldName, /* [string][in] */
256 const OLECHAR* pwcsNewName); /* [string][in] */
257
258HRESULT WINAPI StorageBaseImpl_CreateStream(
259 IStorage* iface,
260 const OLECHAR* pwcsName, /* [string][in] */
261 DWORD grfMode, /* [in] */
262 DWORD reserved1, /* [in] */
263 DWORD reserved2, /* [in] */
264 IStream** ppstm); /* [out] */
265
266HRESULT WINAPI StorageBaseImpl_SetClass(
267 IStorage* iface,
268 REFCLSID clsid); /* [in] */
269
270/****************************************************************************
271 * Storage32Impl definitions.
272 *
273 * This implementation of the IStorage32 interface represents a root
274 * storage. Basically, a document file.
275 */
276struct StorageImpl
277{
278 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
279 * since we want to cast this in a Storage32 pointer */
280
281 /*
282 * Declare the member of the Storage32BaseImpl class to allow
283 * casting as a Storage32BaseImpl
284 */
285 ULONG ref;
286 struct StorageImpl* ancestorStorage;
287 ULONG rootPropertySetIndex;
288 void (*v_destructor)(struct StorageImpl*);
289
290 /*
291 * The following data members are specific to the Storage32Impl
292 * class
293 */
294 HANDLE hFile; /* Physical support for the Docfile */
295
296 /*
297 * File header
298 */
299 WORD bigBlockSizeBits;
300 WORD smallBlockSizeBits;
301 ULONG bigBlockSize;
302 ULONG smallBlockSize;
303 ULONG bigBlockDepotCount;
304 ULONG rootStartBlock;
305 ULONG smallBlockDepotStart;
306 ULONG extBigBlockDepotStart;
307 ULONG extBigBlockDepotCount;
308 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
309
310 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
311 ULONG indexBlockDepotCached;
312 ULONG prevFreeBlock;
313
314 /*
315 * Abstraction of the big block chains for the chains of the header.
316 */
317 BlockChainStream* rootBlockChain;
318 BlockChainStream* smallBlockDepotChain;
319 BlockChainStream* smallBlockRootChain;
320
321 /*
322 * Pointer to the big block file abstraction
323 */
324 BigBlockFile* bigBlockFile;
325};
326
327/*
328 * Method declaration for the Storage32Impl class
329 */
330
331HRESULT WINAPI StorageImpl_CreateStorage(
332 IStorage* iface,
333 const OLECHAR* pwcsName, /* [string][in] */
334 DWORD grfMode, /* [in] */
335 DWORD dwStgFmt, /* [in] */
336 DWORD reserved2, /* [in] */
337 IStorage** ppstg); /* [out] */
338
339HRESULT WINAPI StorageImpl_CopyTo(
340 IStorage* iface,
341 DWORD ciidExclude, /* [in] */
342 const IID* rgiidExclude, /* [size_is][unique][in] */
343 SNB snbExclude, /* [unique][in] */
344 IStorage* pstgDest); /* [unique][in] */
345
346HRESULT WINAPI StorageImpl_MoveElementTo(
347 IStorage* iface,
348 const OLECHAR* pwcsName, /* [string][in] */
349 IStorage* pstgDest, /* [unique][in] */
350 const OLECHAR* pwcsNewName, /* [string][in] */
351 DWORD grfFlags); /* [in] */
352
353HRESULT WINAPI StorageImpl_Commit(
354 IStorage* iface,
355 DWORD grfCommitFlags); /* [in] */
356
357HRESULT WINAPI StorageImpl_Revert(
358 IStorage* iface);
359
360HRESULT WINAPI StorageImpl_DestroyElement(
361 IStorage* iface,
362 const OLECHAR* pwcsName); /* [string][in] */
363
364HRESULT WINAPI StorageImpl_SetElementTimes(
365 IStorage* iface,
366 const OLECHAR* pwcsName, /* [string][in] */
367 const FILETIME* pctime, /* [in] */
368 const FILETIME* patime, /* [in] */
369 const FILETIME* pmtime); /* [in] */
370
371HRESULT WINAPI StorageImpl_SetStateBits(
372 IStorage* iface,
373 DWORD grfStateBits, /* [in] */
374 DWORD grfMask); /* [in] */
375
376void StorageImpl_Destroy(
377 StorageImpl* This);
378
379HRESULT StorageImpl_Construct(
380 StorageImpl* This,
381 HANDLE hFile,
382 ILockBytes* pLkbyt,
383 DWORD openFlags,
384 BOOL fileBased);
385
386BOOL StorageImpl_ReadBigBlock(
387 StorageImpl* This,
388 ULONG blockIndex,
389 void* buffer);
390
391BOOL StorageImpl_WriteBigBlock(
392 StorageImpl* This,
393 ULONG blockIndex,
394 void* buffer);
395
396void* StorageImpl_GetROBigBlock(
397 StorageImpl* This,
398 ULONG blockIndex);
399
400void* StorageImpl_GetBigBlock(
401 StorageImpl* This,
402 ULONG blockIndex);
403
404void StorageImpl_ReleaseBigBlock(
405 StorageImpl* This,
406 void* pBigBlock);
407
408ULONG StorageImpl_GetNextFreeBigBlock(
409 StorageImpl* This);
410
411void StorageImpl_FreeBigBlock(
412 StorageImpl* This,
413 ULONG blockIndex);
414
415ULONG StorageImpl_GetNextBlockInChain(
416 StorageImpl* This,
417 ULONG blockIndex);
418
419void StorageImpl_SetNextBlockInChain(
420 StorageImpl* This,
421 ULONG blockIndex,
422 ULONG nextBlock);
423
424HRESULT StorageImpl_LoadFileHeader(
425 StorageImpl* This);
426
427void StorageImpl_SaveFileHeader(
428 StorageImpl* This);
429
430BOOL StorageImpl_ReadProperty(
431 StorageImpl* This,
432 ULONG index,
433 StgProperty* buffer);
434
435BOOL StorageImpl_WriteProperty(
436 StorageImpl* This,
437 ULONG index,
438 StgProperty* buffer);
439
440BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
441 StorageImpl* This,
442 SmallBlockChainStream** ppsbChain);
443
444ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
445 ULONG blockIndex);
446
447void Storage32Impl_AddBlockDepot(StorageImpl* This,
448 ULONG blockIndex);
449
450ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
451
452ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
453 ULONG depotIndex);
454
455void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
456 ULONG depotIndex,
457 ULONG blockIndex);
458/****************************************************************************
459 * Storage32InternalImpl definitions.
460 *
461 * Definition of the implementation structure for the IStorage32 interface.
462 * This one implements the IStorage32 interface for storage that are
463 * inside another storage.
464 */
465struct StorageInternalImpl
466{
467 ICOM_VTABLE(IStorage) *lpvtbl; /* Needs to be the first item in the stuct
468 * since we want to cast this in a Storage32 pointer */
469
470 /*
471 * Declare the member of the Storage32BaseImpl class to allow
472 * casting as a Storage32BaseImpl
473 */
474 ULONG ref;
475 struct StorageImpl* ancestorStorage;
476 ULONG rootPropertySetIndex;
477 void (*v_destructor)(struct StorageInternalImpl*);
478
479 /*
480 * There is no specific data for this class.
481 */
482};
483
484/*
485 * Method definitions for the Storage32InternalImpl class.
486 */
487StorageInternalImpl* StorageInternalImpl_Construct(
488 StorageImpl* ancestorStorage,
489 ULONG rootTropertyIndex);
490
491void StorageInternalImpl_Destroy(
492 StorageInternalImpl* This);
493
494HRESULT WINAPI StorageInternalImpl_Commit(
495 IStorage* iface,
496 DWORD grfCommitFlags); /* [in] */
497
498HRESULT WINAPI StorageInternalImpl_Revert(
499 IStorage* iface);
500
501
502/****************************************************************************
503 * IEnumSTATSTGImpl definitions.
504 *
505 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
506 * This class allows iterating through the content of a storage and to find
507 * specific items inside it.
508 */
509struct IEnumSTATSTGImpl
510{
511 ICOM_VTABLE(IEnumSTATSTG) *lpvtbl; /* Needs to be the first item in the stuct
512 * since we want to cast this in a IEnumSTATSTG pointer */
513
514 ULONG ref; /* Reference count */
515 StorageImpl* parentStorage; /* Reference to the parent storage */
516 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
517
518 /*
519 * The current implementation of the IEnumSTATSTGImpl class uses a stack
520 * to walk the property sets to get the content of a storage. This stack
521 * is implemented by the following 3 data members
522 */
523 ULONG stackSize;
524 ULONG stackMaxSize;
525 ULONG* stackToVisit;
526
527#define ENUMSTATSGT_SIZE_INCREMENT 10
528};
529
530/*
531 * Method definitions for the IEnumSTATSTGImpl class.
532 */
533HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
534 IEnumSTATSTG* iface,
535 REFIID riid,
536 void** ppvObject);
537
538ULONG WINAPI IEnumSTATSTGImpl_AddRef(
539 IEnumSTATSTG* iface);
540
541ULONG WINAPI IEnumSTATSTGImpl_Release(
542 IEnumSTATSTG* iface);
543
544HRESULT WINAPI IEnumSTATSTGImpl_Next(
545 IEnumSTATSTG* iface,
546 ULONG celt,
547 STATSTG* rgelt,
548 ULONG* pceltFetched);
549
550HRESULT WINAPI IEnumSTATSTGImpl_Skip(
551 IEnumSTATSTG* iface,
552 ULONG celt);
553
554HRESULT WINAPI IEnumSTATSTGImpl_Reset(
555 IEnumSTATSTG* iface);
556
557HRESULT WINAPI IEnumSTATSTGImpl_Clone(
558 IEnumSTATSTG* iface,
559 IEnumSTATSTG** ppenum);
560
561IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
562 StorageImpl* This,
563 ULONG firstPropertyNode);
564
565void IEnumSTATSTGImpl_Destroy(
566 IEnumSTATSTGImpl* This);
567
568void IEnumSTATSTGImpl_PushSearchNode(
569 IEnumSTATSTGImpl* This,
570 ULONG nodeToPush);
571
572ULONG IEnumSTATSTGImpl_PopSearchNode(
573 IEnumSTATSTGImpl* This,
574 BOOL remove);
575
576ULONG IEnumSTATSTGImpl_FindProperty(
577 IEnumSTATSTGImpl* This,
578 const OLECHAR* lpszPropName,
579 StgProperty* buffer);
580
581INT IEnumSTATSTGImpl_FindParentProperty(
582 IEnumSTATSTGImpl *This,
583 ULONG childProperty,
584 StgProperty *currentProperty,
585 ULONG *propertyId);
586
587
588/****************************************************************************
589 * StgStreamImpl definitions.
590 *
591 * This class imlements the IStream32 inteface and represents a stream
592 * located inside a storage object.
593 */
594struct StgStreamImpl
595{
596 ICOM_VTABLE(IStream) *lpvtbl; /* Needs to be the first item in the stuct
597 * since we want to cast this in a IStream pointer */
598
599 /*
600 * Reference count
601 */
602 ULONG ref;
603
604 /*
605 * Storage that is the parent(owner) of the stream
606 */
607 StorageBaseImpl* parentStorage;
608
609 /*
610 * Index of the property that owns (points to) this stream.
611 */
612 ULONG ownerProperty;
613
614 /*
615 * Helper variable that contains the size of the stream
616 */
617 ULARGE_INTEGER streamSize;
618
619 /*
620 * This is the current position of the cursor in the stream
621 */
622 ULARGE_INTEGER currentPosition;
623
624 /*
625 * The information in the stream is represented by a chain of small blocks
626 * or a chain of large blocks. Depending on the case, one of the two
627 * following variabled points to that information.
628 */
629 BlockChainStream* bigBlockChain;
630 SmallBlockChainStream* smallBlockChain;
631
632};
633
634/*
635 * Method definition for the StgStreamImpl class.
636 */
637StgStreamImpl* StgStreamImpl_Construct(
638 StorageBaseImpl* parentStorage,
639 ULONG ownerProperty);
640
641void StgStreamImpl_Destroy(
642 StgStreamImpl* This);
643
644void StgStreamImpl_OpenBlockChain(
645 StgStreamImpl* This);
646
647HRESULT WINAPI StgStreamImpl_QueryInterface(
648 IStream* iface,
649 REFIID riid, /* [in] */
650 void** ppvObject); /* [iid_is][out] */
651
652ULONG WINAPI StgStreamImpl_AddRef(
653 IStream* iface);
654
655ULONG WINAPI StgStreamImpl_Release(
656 IStream* iface);
657
658HRESULT WINAPI StgStreamImpl_Read(
659 IStream* iface,
660 void* pv, /* [length_is][size_is][out] */
661 ULONG cb, /* [in] */
662 ULONG* pcbRead); /* [out] */
663
664HRESULT WINAPI StgStreamImpl_Write(
665 IStream* iface,
666 const void* pv, /* [size_is][in] */
667 ULONG cb, /* [in] */
668 ULONG* pcbWritten); /* [out] */
669
670HRESULT WINAPI StgStreamImpl_Seek(
671 IStream* iface,
672 LARGE_INTEGER dlibMove, /* [in] */
673 DWORD dwOrigin, /* [in] */
674 ULARGE_INTEGER* plibNewPosition); /* [out] */
675
676HRESULT WINAPI StgStreamImpl_SetSize(
677 IStream* iface,
678 ULARGE_INTEGER libNewSize); /* [in] */
679
680HRESULT WINAPI StgStreamImpl_CopyTo(
681 IStream* iface,
682 IStream* pstm, /* [unique][in] */
683 ULARGE_INTEGER cb, /* [in] */
684 ULARGE_INTEGER* pcbRead, /* [out] */
685 ULARGE_INTEGER* pcbWritten); /* [out] */
686
687HRESULT WINAPI StgStreamImpl_Commit(
688 IStream* iface,
689 DWORD grfCommitFlags); /* [in] */
690
691HRESULT WINAPI StgStreamImpl_Revert(
692 IStream* iface);
693
694HRESULT WINAPI StgStreamImpl_LockRegion(
695 IStream* iface,
696 ULARGE_INTEGER libOffset, /* [in] */
697 ULARGE_INTEGER cb, /* [in] */
698 DWORD dwLockType); /* [in] */
699
700HRESULT WINAPI StgStreamImpl_UnlockRegion(
701 IStream* iface,
702 ULARGE_INTEGER libOffset, /* [in] */
703 ULARGE_INTEGER cb, /* [in] */
704 DWORD dwLockType); /* [in] */
705
706HRESULT WINAPI StgStreamImpl_Stat(
707 IStream* iface,
708 STATSTG* pstatstg, /* [out] */
709 DWORD grfStatFlag); /* [in] */
710
711HRESULT WINAPI StgStreamImpl_Clone(
712 IStream* iface,
713 IStream** ppstm); /* [out] */
714
715
716/********************************************************************************
717 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
718 * abstractions used to read values from file buffers without having to worry
719 * about bit order
720 */
721void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
722void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
723void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
724void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
725void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
726void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
727void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
728 StgProperty* source,
729 int statFlags);
730
731/****************************************************************************
732 * BlockChainStream definitions.
733 *
734 * The BlockChainStream class is a utility class that is used to create an
735 * abstraction of the big block chains in the storage file.
736 */
737struct BlockChainStream
738{
739 StorageImpl* parentStorage;
740 ULONG* headOfStreamPlaceHolder;
741 ULONG ownerPropertyIndex;
742 ULONG lastBlockNoInSequence;
743 ULONG lastBlockNoInSequenceIndex;
744 ULONG tailIndex;
745 ULONG numBlocks;
746};
747
748/*
749 * Methods for the BlockChainStream class.
750 */
751BlockChainStream* BlockChainStream_Construct(
752 StorageImpl* parentStorage,
753 ULONG* headOfStreamPlaceHolder,
754 ULONG propertyIndex);
755
756void BlockChainStream_Destroy(
757 BlockChainStream* This);
758
759ULONG BlockChainStream_GetHeadOfChain(
760 BlockChainStream* This);
761
762BOOL BlockChainStream_ReadAt(
763 BlockChainStream* This,
764 ULARGE_INTEGER offset,
765 ULONG size,
766 void* buffer,
767 ULONG* bytesRead);
768
769BOOL BlockChainStream_WriteAt(
770 BlockChainStream* This,
771 ULARGE_INTEGER offset,
772 ULONG size,
773 const void* buffer,
774 ULONG* bytesWritten);
775
776BOOL BlockChainStream_SetSize(
777 BlockChainStream* This,
778 ULARGE_INTEGER newSize);
779
780ULARGE_INTEGER BlockChainStream_GetSize(
781 BlockChainStream* This);
782
783ULONG BlockChainStream_GetCount(
784 BlockChainStream* This);
785
786/****************************************************************************
787 * SmallBlockChainStream definitions.
788 *
789 * The SmallBlockChainStream class is a utility class that is used to create an
790 * abstraction of the small block chains in the storage file.
791 */
792struct SmallBlockChainStream
793{
794 StorageImpl* parentStorage;
795 ULONG ownerPropertyIndex;
796};
797
798/*
799 * Methods of the SmallBlockChainStream class.
800 */
801SmallBlockChainStream* SmallBlockChainStream_Construct(
802 StorageImpl* parentStorage,
803 ULONG propertyIndex);
804
805void SmallBlockChainStream_Destroy(
806 SmallBlockChainStream* This);
807
808ULONG SmallBlockChainStream_GetHeadOfChain(
809 SmallBlockChainStream* This);
810
811ULONG SmallBlockChainStream_GetNextBlockInChain(
812 SmallBlockChainStream* This,
813 ULONG blockIndex);
814
815void SmallBlockChainStream_SetNextBlockInChain(
816 SmallBlockChainStream* This,
817 ULONG blockIndex,
818 ULONG nextBlock);
819
820void SmallBlockChainStream_FreeBlock(
821 SmallBlockChainStream* This,
822 ULONG blockIndex);
823
824ULONG SmallBlockChainStream_GetNextFreeBlock(
825 SmallBlockChainStream* This);
826
827BOOL SmallBlockChainStream_ReadAt(
828 SmallBlockChainStream* This,
829 ULARGE_INTEGER offset,
830 ULONG size,
831 void* buffer,
832 ULONG* bytesRead);
833
834BOOL SmallBlockChainStream_WriteAt(
835 SmallBlockChainStream* This,
836 ULARGE_INTEGER offset,
837 ULONG size,
838 const void* buffer,
839 ULONG* bytesWritten);
840
841BOOL SmallBlockChainStream_SetSize(
842 SmallBlockChainStream* This,
843 ULARGE_INTEGER newSize);
844
845ULARGE_INTEGER SmallBlockChainStream_GetSize(
846 SmallBlockChainStream* This);
847
848ULONG SmallBlockChainStream_GetCount(
849 SmallBlockChainStream* This);
850
851
852#endif /* __STORAGE32_H__ */
853
854
855
Note: See TracBrowser for help on using the repository browser.