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

Last change on this file since 3721 was 3167, checked in by davidr, 25 years ago

Ported changes from wine/corel sources

File size: 27.0 KB
Line 
1/* $Id: storage.h,v 1.2 2000-03-19 15:35:15 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};
91
92/*
93 * Forward declarations of all the structures used by the storage
94 * module.
95 */
96typedef struct StorageBaseImpl StorageBaseImpl;
97typedef struct StorageImpl StorageImpl;
98typedef struct StorageInternalImpl StorageInternalImpl;
99typedef struct BlockChainStream BlockChainStream;
100typedef struct SmallBlockChainStream SmallBlockChainStream;
101typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
102typedef struct StgProperty StgProperty;
103typedef struct StgStreamImpl StgStreamImpl;
104
105/*
106 * This utility structure is used to read/write the information in a storage
107 * property.
108 */
109struct StgProperty
110{
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;
124};
125
126/*************************************************************************
127 * Big Block File support
128 *
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
132 */
133
134/*
135 * Declaration of the data structures
136 */
137typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
138typedef struct MappedPage MappedPage,*LPMAPPEDPAGE;
139
140struct BigBlockFile
141{
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;
154};
155
156/*
157 * Declaration of the functions used to manipulate the BigBlockFile
158 * data structure.
159 */
160BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
161 ILockBytes* pLkByt,
162 DWORD openFlags,
163 ULONG blocksize,
164 BOOL fileBased);
165void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
166void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
167void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
168void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
169void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
170ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
171
172/****************************************************************************
173 * Storage32BaseImpl definitions.
174 *
175 * This stucture defines the base information contained in all implementations
176 * of IStorage32 contained in this filee storage implementation.
177 *
178 * In OOP terms, this is the base class for all the IStorage32 implementations
179 * contained in this file.
180 */
181struct StorageBaseImpl
182{
183 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
184 * since we want to cast this in a Storage32 pointer */
185
186 /*
187 * Reference count of this object
188 */
189 ULONG ref;
190
191 /*
192 * Ancestor storage (top level)
193 */
194 StorageImpl* ancestorStorage;
195
196 /*
197 * Index of the property for the root of
198 * this storage
199 */
200 ULONG rootPropertySetIndex;
201
202 /*
203 * virtual Destructor method.
204 */
205 void (*v_destructor)(StorageBaseImpl*);
206};
207
208
209/*
210 * Prototypes for the methods of the Storage32BaseImpl class.
211 */
212HRESULT WINAPI StorageBaseImpl_QueryInterface(
213 IStorage* iface,
214 REFIID riid,
215 void** ppvObject);
216
217ULONG WINAPI StorageBaseImpl_AddRef(
218 IStorage* iface);
219
220ULONG WINAPI StorageBaseImpl_Release(
221 IStorage* iface);
222
223HRESULT WINAPI StorageBaseImpl_OpenStream(
224 IStorage* iface,
225 const OLECHAR* pwcsName, /* [string][in] */
226 void* reserved1, /* [unique][in] */
227 DWORD grfMode, /* [in] */
228 DWORD reserved2, /* [in] */
229 IStream** ppstm); /* [out] */
230
231HRESULT WINAPI StorageBaseImpl_OpenStorage(
232 IStorage* iface,
233 const OLECHAR* pwcsName, /* [string][unique][in] */
234 IStorage* pstgPriority, /* [unique][in] */
235 DWORD grfMode, /* [in] */
236 SNB snbExclude, /* [unique][in] */
237 DWORD reserved, /* [in] */
238 IStorage** ppstg); /* [out] */
239
240HRESULT WINAPI StorageBaseImpl_EnumElements(
241 IStorage* iface,
242 DWORD reserved1, /* [in] */
243 void* reserved2, /* [size_is][unique][in] */
244 DWORD reserved3, /* [in] */
245 IEnumSTATSTG** ppenum); /* [out] */
246
247HRESULT WINAPI StorageBaseImpl_Stat(
248 IStorage* iface,
249 STATSTG* pstatstg, /* [out] */
250 DWORD grfStatFlag); /* [in] */
251
252HRESULT WINAPI StorageBaseImpl_RenameElement(
253 IStorage* iface,
254 const OLECHAR* pwcsOldName, /* [string][in] */
255 const OLECHAR* pwcsNewName); /* [string][in] */
256
257HRESULT WINAPI StorageBaseImpl_CreateStream(
258 IStorage* iface,
259 const OLECHAR* pwcsName, /* [string][in] */
260 DWORD grfMode, /* [in] */
261 DWORD reserved1, /* [in] */
262 DWORD reserved2, /* [in] */
263 IStream** ppstm); /* [out] */
264
265HRESULT WINAPI StorageBaseImpl_SetClass(
266 IStorage* iface,
267 REFCLSID clsid); /* [in] */
268
269/****************************************************************************
270 * Storage32Impl definitions.
271 *
272 * This implementation of the IStorage32 interface represents a root
273 * storage. Basically, a document file.
274 */
275struct StorageImpl
276{
277 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
278 * since we want to cast this in a Storage32 pointer */
279
280 /*
281 * Declare the member of the Storage32BaseImpl class to allow
282 * casting as a Storage32BaseImpl
283 */
284 ULONG ref;
285 struct StorageImpl* ancestorStorage;
286 ULONG rootPropertySetIndex;
287 void (*v_destructor)(struct StorageImpl*);
288
289 /*
290 * The following data members are specific to the Storage32Impl
291 * class
292 */
293 HANDLE hFile; /* Physical support for the Docfile */
294
295 /*
296 * File header
297 */
298 WORD bigBlockSizeBits;
299 WORD smallBlockSizeBits;
300 ULONG bigBlockSize;
301 ULONG smallBlockSize;
302 ULONG bigBlockDepotCount;
303 ULONG rootStartBlock;
304 ULONG smallBlockDepotStart;
305 ULONG extBigBlockDepotStart;
306 ULONG extBigBlockDepotCount;
307 ULONG bigBlockDepotStart[COUNT_BBDEPOTINHEADER];
308
309 ULONG blockDepotCached[NUM_BLOCKS_PER_DEPOT_BLOCK];
310 ULONG indexBlockDepotCached;
311 ULONG prevFreeBlock;
312
313 /*
314 * Abstraction of the big block chains for the chains of the header.
315 */
316 BlockChainStream* rootBlockChain;
317 BlockChainStream* smallBlockDepotChain;
318 BlockChainStream* smallBlockRootChain;
319
320 /*
321 * Pointer to the big block file abstraction
322 */
323 BigBlockFile* bigBlockFile;
324
325 /*****************************************************************************************/
326 /* warning: this is a temp fix for bugs related to save file to mounted network drive */
327 /* TBD: these lines should be removed when we will get the final fix */
328 /*****************************************************************************************/
329 WCHAR* srcDestFiles[2];
330 /*****************************************************************************************/
331};
332
333/*
334 * Method declaration for the Storage32Impl class
335 */
336
337HRESULT 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] */
344
345HRESULT 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] */
351
352HRESULT 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] */
358
359HRESULT WINAPI StorageImpl_Commit(
360 IStorage* iface,
361 DWORD grfCommitFlags); /* [in] */
362
363HRESULT WINAPI StorageImpl_Revert(
364 IStorage* iface);
365
366HRESULT WINAPI StorageImpl_DestroyElement(
367 IStorage* iface,
368 const OLECHAR* pwcsName); /* [string][in] */
369
370HRESULT 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] */
376
377HRESULT WINAPI StorageImpl_SetStateBits(
378 IStorage* iface,
379 DWORD grfStateBits, /* [in] */
380 DWORD grfMask); /* [in] */
381
382void StorageImpl_Destroy(
383 StorageImpl* This);
384
385HRESULT StorageImpl_Construct(
386 StorageImpl* This,
387 HANDLE hFile,
388 ILockBytes* pLkbyt,
389 DWORD openFlags,
390 BOOL fileBased,
391 BOOL fileCreate);
392
393BOOL StorageImpl_ReadBigBlock(
394 StorageImpl* This,
395 ULONG blockIndex,
396 void* buffer);
397
398BOOL StorageImpl_WriteBigBlock(
399 StorageImpl* This,
400 ULONG blockIndex,
401 void* buffer);
402
403void* StorageImpl_GetROBigBlock(
404 StorageImpl* This,
405 ULONG blockIndex);
406
407void* StorageImpl_GetBigBlock(
408 StorageImpl* This,
409 ULONG blockIndex);
410
411void StorageImpl_ReleaseBigBlock(
412 StorageImpl* This,
413 void* pBigBlock);
414
415ULONG StorageImpl_GetNextFreeBigBlock(
416 StorageImpl* This);
417
418void StorageImpl_FreeBigBlock(
419 StorageImpl* This,
420 ULONG blockIndex);
421
422ULONG StorageImpl_GetNextBlockInChain(
423 StorageImpl* This,
424 ULONG blockIndex);
425
426void StorageImpl_SetNextBlockInChain(
427 StorageImpl* This,
428 ULONG blockIndex,
429 ULONG nextBlock);
430
431HRESULT StorageImpl_LoadFileHeader(
432 StorageImpl* This);
433
434void StorageImpl_SaveFileHeader(
435 StorageImpl* This);
436
437BOOL StorageImpl_ReadProperty(
438 StorageImpl* This,
439 ULONG index,
440 StgProperty* buffer);
441
442BOOL StorageImpl_WriteProperty(
443 StorageImpl* This,
444 ULONG index,
445 StgProperty* buffer);
446
447BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
448 StorageImpl* This,
449 SmallBlockChainStream** ppsbChain);
450
451ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
452 ULONG blockIndex);
453
454void Storage32Impl_AddBlockDepot(StorageImpl* This,
455 ULONG blockIndex);
456
457ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
458
459ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
460 ULONG depotIndex);
461
462void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
463 ULONG depotIndex,
464 ULONG blockIndex);
465/****************************************************************************
466 * Storage32InternalImpl definitions.
467 *
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.
471 */
472struct StorageInternalImpl
473{
474 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
475 * since we want to cast this in a Storage32 pointer */
476
477 /*
478 * Declare the member of the Storage32BaseImpl class to allow
479 * casting as a Storage32BaseImpl
480 */
481 ULONG ref;
482 struct StorageImpl* ancestorStorage;
483 ULONG rootPropertySetIndex;
484 void (*v_destructor)(struct StorageInternalImpl*);
485
486 /*
487 * There is no specific data for this class.
488 */
489};
490
491/*
492 * Method definitions for the Storage32InternalImpl class.
493 */
494StorageInternalImpl* StorageInternalImpl_Construct(
495 StorageImpl* ancestorStorage,
496 ULONG rootTropertyIndex);
497
498void StorageInternalImpl_Destroy(
499 StorageInternalImpl* This);
500
501HRESULT WINAPI StorageInternalImpl_Commit(
502 IStorage* iface,
503 DWORD grfCommitFlags); /* [in] */
504
505HRESULT WINAPI StorageInternalImpl_Revert(
506 IStorage* iface);
507
508
509/****************************************************************************
510 * IEnumSTATSTGImpl definitions.
511 *
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.
515 */
516struct IEnumSTATSTGImpl
517{
518 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct
519 * since we want to cast this in a IEnumSTATSTG pointer */
520
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 */
524
525 /*
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
529 */
530 ULONG stackSize;
531 ULONG stackMaxSize;
532 ULONG* stackToVisit;
533
534#define ENUMSTATSGT_SIZE_INCREMENT 10
535};
536
537/*
538 * Method definitions for the IEnumSTATSTGImpl class.
539 */
540HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
541 IEnumSTATSTG* iface,
542 REFIID riid,
543 void** ppvObject);
544
545ULONG WINAPI IEnumSTATSTGImpl_AddRef(
546 IEnumSTATSTG* iface);
547
548ULONG WINAPI IEnumSTATSTGImpl_Release(
549 IEnumSTATSTG* iface);
550
551HRESULT WINAPI IEnumSTATSTGImpl_Next(
552 IEnumSTATSTG* iface,
553 ULONG celt,
554 STATSTG* rgelt,
555 ULONG* pceltFetched);
556
557HRESULT WINAPI IEnumSTATSTGImpl_Skip(
558 IEnumSTATSTG* iface,
559 ULONG celt);
560
561HRESULT WINAPI IEnumSTATSTGImpl_Reset(
562 IEnumSTATSTG* iface);
563
564HRESULT WINAPI IEnumSTATSTGImpl_Clone(
565 IEnumSTATSTG* iface,
566 IEnumSTATSTG** ppenum);
567
568IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
569 StorageImpl* This,
570 ULONG firstPropertyNode);
571
572void IEnumSTATSTGImpl_Destroy(
573 IEnumSTATSTGImpl* This);
574
575void IEnumSTATSTGImpl_PushSearchNode(
576 IEnumSTATSTGImpl* This,
577 ULONG nodeToPush);
578
579ULONG IEnumSTATSTGImpl_PopSearchNode(
580 IEnumSTATSTGImpl* This,
581 BOOL remove);
582
583ULONG IEnumSTATSTGImpl_FindProperty(
584 IEnumSTATSTGImpl* This,
585 const OLECHAR* lpszPropName,
586 StgProperty* buffer);
587
588INT IEnumSTATSTGImpl_FindParentProperty(
589 IEnumSTATSTGImpl *This,
590 ULONG childProperty,
591 StgProperty *currentProperty,
592 ULONG *propertyId);
593
594
595/****************************************************************************
596 * StgStreamImpl definitions.
597 *
598 * This class imlements the IStream32 inteface and represents a stream
599 * located inside a storage object.
600 */
601struct StgStreamImpl
602{
603 ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct
604 * since we want to cast this in a IStream pointer */
605
606 /*
607 * Reference count
608 */
609 ULONG ref;
610
611 /*
612 * Storage that is the parent(owner) of the stream
613 */
614 StorageBaseImpl* parentStorage;
615
616 /*
617 * Access mode of this stream.
618 */
619 DWORD grfMode;
620
621 /*
622 * Index of the property that owns (points to) this stream.
623 */
624 ULONG ownerProperty;
625
626 /*
627 * Helper variable that contains the size of the stream
628 */
629 ULARGE_INTEGER streamSize;
630
631 /*
632 * This is the current position of the cursor in the stream
633 */
634 ULARGE_INTEGER currentPosition;
635
636 /*
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.
640 */
641 BlockChainStream* bigBlockChain;
642 SmallBlockChainStream* smallBlockChain;
643
644};
645
646/*
647 * Method definition for the StgStreamImpl class.
648 */
649StgStreamImpl* StgStreamImpl_Construct(
650 StorageBaseImpl* parentStorage,
651 DWORD grfMode,
652 ULONG ownerProperty);
653
654void StgStreamImpl_Destroy(
655 StgStreamImpl* This);
656
657void StgStreamImpl_OpenBlockChain(
658 StgStreamImpl* This);
659
660HRESULT WINAPI StgStreamImpl_QueryInterface(
661 IStream* iface,
662 REFIID riid, /* [in] */
663 void** ppvObject); /* [iid_is][out] */
664
665ULONG WINAPI StgStreamImpl_AddRef(
666 IStream* iface);
667
668ULONG WINAPI StgStreamImpl_Release(
669 IStream* iface);
670
671HRESULT WINAPI StgStreamImpl_Read(
672 IStream* iface,
673 void* pv, /* [length_is][size_is][out] */
674 ULONG cb, /* [in] */
675 ULONG* pcbRead); /* [out] */
676
677HRESULT WINAPI StgStreamImpl_Write(
678 IStream* iface,
679 const void* pv, /* [size_is][in] */
680 ULONG cb, /* [in] */
681 ULONG* pcbWritten); /* [out] */
682
683HRESULT WINAPI StgStreamImpl_Seek(
684 IStream* iface,
685 LARGE_INTEGER dlibMove, /* [in] */
686 DWORD dwOrigin, /* [in] */
687 ULARGE_INTEGER* plibNewPosition); /* [out] */
688
689HRESULT WINAPI StgStreamImpl_SetSize(
690 IStream* iface,
691 ULARGE_INTEGER libNewSize); /* [in] */
692
693HRESULT WINAPI StgStreamImpl_CopyTo(
694 IStream* iface,
695 IStream* pstm, /* [unique][in] */
696 ULARGE_INTEGER cb, /* [in] */
697 ULARGE_INTEGER* pcbRead, /* [out] */
698 ULARGE_INTEGER* pcbWritten); /* [out] */
699
700HRESULT WINAPI StgStreamImpl_Commit(
701 IStream* iface,
702 DWORD grfCommitFlags); /* [in] */
703
704HRESULT WINAPI StgStreamImpl_Revert(
705 IStream* iface);
706
707HRESULT WINAPI StgStreamImpl_LockRegion(
708 IStream* iface,
709 ULARGE_INTEGER libOffset, /* [in] */
710 ULARGE_INTEGER cb, /* [in] */
711 DWORD dwLockType); /* [in] */
712
713HRESULT WINAPI StgStreamImpl_UnlockRegion(
714 IStream* iface,
715 ULARGE_INTEGER libOffset, /* [in] */
716 ULARGE_INTEGER cb, /* [in] */
717 DWORD dwLockType); /* [in] */
718
719HRESULT WINAPI StgStreamImpl_Stat(
720 IStream* iface,
721 STATSTG* pstatstg, /* [out] */
722 DWORD grfStatFlag); /* [in] */
723
724HRESULT WINAPI StgStreamImpl_Clone(
725 IStream* iface,
726 IStream** ppstm); /* [out] */
727
728
729/********************************************************************************
730 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
731 * abstractions used to read values from file buffers without having to worry
732 * about bit order
733 */
734void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
735void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
736void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
737void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
738void StorageUtl_ReadDWords(void *buffer, ULONG offset, DWORD *values,
739 ULONG len);
740void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
741void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
742void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
743 StgProperty* source,
744 int statFlags);
745
746/****************************************************************************
747 * BlockChainStream definitions.
748 *
749 * The BlockChainStream class is a utility class that is used to create an
750 * abstraction of the big block chains in the storage file.
751 */
752struct BlockChainStream
753{
754 StorageImpl* parentStorage;
755 ULONG* headOfStreamPlaceHolder;
756 ULONG ownerPropertyIndex;
757 ULONG lastBlockNoInSequence;
758 ULONG lastBlockNoInSequenceIndex;
759 ULONG tailIndex;
760 ULONG numBlocks;
761 BOOL lazyInitComplete;
762};
763
764/*
765 * Methods for the BlockChainStream class.
766 */
767BlockChainStream* BlockChainStream_Construct(
768 StorageImpl* parentStorage,
769 ULONG* headOfStreamPlaceHolder,
770 ULONG propertyIndex);
771
772void BlockChainStream_Destroy(
773 BlockChainStream* This);
774
775ULONG BlockChainStream_GetHeadOfChain(
776 BlockChainStream* This);
777
778BOOL BlockChainStream_ReadAt(
779 BlockChainStream* This,
780 ULARGE_INTEGER offset,
781 ULONG size,
782 void* buffer,
783 ULONG* bytesRead);
784
785BOOL BlockChainStream_WriteAt(
786 BlockChainStream* This,
787 ULARGE_INTEGER offset,
788 ULONG size,
789 const void* buffer,
790 ULONG* bytesWritten);
791
792BOOL BlockChainStream_SetSize(
793 BlockChainStream* This,
794 ULARGE_INTEGER newSize);
795
796ULARGE_INTEGER BlockChainStream_GetSize(
797 BlockChainStream* This);
798
799ULONG BlockChainStream_GetCount(
800 BlockChainStream* This);
801
802/****************************************************************************
803 * SmallBlockChainStream definitions.
804 *
805 * The SmallBlockChainStream class is a utility class that is used to create an
806 * abstraction of the small block chains in the storage file.
807 */
808struct SmallBlockChainStream
809{
810 StorageImpl* parentStorage;
811 ULONG ownerPropertyIndex;
812};
813
814/*
815 * Methods of the SmallBlockChainStream class.
816 */
817SmallBlockChainStream* SmallBlockChainStream_Construct(
818 StorageImpl* parentStorage,
819 ULONG propertyIndex);
820
821void SmallBlockChainStream_Destroy(
822 SmallBlockChainStream* This);
823
824ULONG SmallBlockChainStream_GetHeadOfChain(
825 SmallBlockChainStream* This);
826
827ULONG SmallBlockChainStream_GetNextBlockInChain(
828 SmallBlockChainStream* This,
829 ULONG blockIndex);
830
831void SmallBlockChainStream_SetNextBlockInChain(
832 SmallBlockChainStream* This,
833 ULONG blockIndex,
834 ULONG nextBlock);
835
836void SmallBlockChainStream_FreeBlock(
837 SmallBlockChainStream* This,
838 ULONG blockIndex);
839
840ULONG SmallBlockChainStream_GetNextFreeBlock(
841 SmallBlockChainStream* This);
842
843BOOL SmallBlockChainStream_ReadAt(
844 SmallBlockChainStream* This,
845 ULARGE_INTEGER offset,
846 ULONG size,
847 void* buffer,
848 ULONG* bytesRead);
849
850BOOL SmallBlockChainStream_WriteAt(
851 SmallBlockChainStream* This,
852 ULARGE_INTEGER offset,
853 ULONG size,
854 const void* buffer,
855 ULONG* bytesWritten);
856
857BOOL SmallBlockChainStream_SetSize(
858 SmallBlockChainStream* This,
859 ULARGE_INTEGER newSize);
860
861ULARGE_INTEGER SmallBlockChainStream_GetSize(
862 SmallBlockChainStream* This);
863
864ULONG SmallBlockChainStream_GetCount(
865 SmallBlockChainStream* This);
866
867
868#endif /* __STORAGE32_H__ */
869
870
871
Note: See TracBrowser for help on using the repository browser.