source: trunk/src/ole32/storage32.h@ 8266

Last change on this file since 8266 was 7926, checked in by sandervl, 24 years ago

Wine 20020215 resync

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