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

Last change on this file since 5280 was 5026, checked in by sandervl, 25 years ago

Wine resync

File size: 26.6 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#ifdef __cplusplus
24extern "C" {
25#endif
26
27/*
28 * Definitions for the file format offsets.
29 */
30static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
31static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
32static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
33static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
34static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
35static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
36static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048;
37static const ULONG OFFSET_BBDEPOTSTART = 0x0000004C;
38static const ULONG OFFSET_PS_NAME = 0x00000000;
39static const ULONG OFFSET_PS_NAMELENGTH = 0x00000040;
40static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042;
41static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044;
42static const ULONG OFFSET_PS_NEXTPROP = 0x00000048;
43static const ULONG OFFSET_PS_DIRPROP = 0x0000004C;
44static const ULONG OFFSET_PS_GUID = 0x00000050;
45static const ULONG OFFSET_PS_TSS1 = 0x00000064;
46static const ULONG OFFSET_PS_TSD1 = 0x00000068;
47static const ULONG OFFSET_PS_TSS2 = 0x0000006C;
48static const ULONG OFFSET_PS_TSD2 = 0x00000070;
49static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
50static const ULONG OFFSET_PS_SIZE = 0x00000078;
51static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
52static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
53static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
54static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
55static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
56static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
57static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;
58static const ULONG BLOCK_UNUSED = 0xFFFFFFFF;
59static const ULONG PROPERTY_NULL = 0xFFFFFFFF;
60
61#define PROPERTY_NAME_MAX_LEN 0x20
62#define PROPERTY_NAME_BUFFER_LEN 0x40
63
64#define PROPSET_BLOCK_SIZE 0x00000080
65
66/*
67 * Property type of relation
68 */
69#define PROPERTY_RELATION_PREVIOUS 0
70#define PROPERTY_RELATION_NEXT 1
71#define PROPERTY_RELATION_DIR 2
72
73/*
74 * Property type constants
75 */
76#define PROPTYPE_STORAGE 0x01
77#define PROPTYPE_STREAM 0x02
78#define PROPTYPE_ROOT 0x05
79
80/*
81 * These defines assume a hardcoded blocksize. The code will assert
82 * if the blocksize is different. Some changes will have to be done if it
83 * becomes the case.
84 */
85#define BIG_BLOCK_SIZE 0x200
86#define COUNT_BBDEPOTINHEADER 109
87#define LIMIT_TO_USE_SMALL_BLOCK 0x1000
88#define NUM_BLOCKS_PER_DEPOT_BLOCK 128
89
90/*
91 * These are signatures to detect the type of Document file.
92 */
93static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
94static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
95
96/*
97 * Forward declarations of all the structures used by the storage
98 * module.
99 */
100typedef struct StorageBaseImpl StorageBaseImpl;
101typedef struct StorageImpl StorageImpl;
102typedef struct StorageInternalImpl StorageInternalImpl;
103typedef struct BlockChainStream BlockChainStream;
104typedef struct SmallBlockChainStream SmallBlockChainStream;
105typedef struct IEnumSTATSTGImpl IEnumSTATSTGImpl;
106typedef struct StgProperty StgProperty;
107typedef struct StgStreamImpl StgStreamImpl;
108
109/*
110 * This utility structure is used to read/write the information in a storage
111 * property.
112 */
113struct StgProperty
114{
115 WCHAR name[PROPERTY_NAME_MAX_LEN];
116 WORD sizeOfNameString;
117 BYTE propertyType;
118 ULONG previousProperty;
119 ULONG nextProperty;
120 ULONG dirProperty;
121 GUID propertyUniqueID;
122 ULONG timeStampS1;
123 ULONG timeStampD1;
124 ULONG timeStampS2;
125 ULONG timeStampD2;
126 ULONG startingBlock;
127 ULARGE_INTEGER size;
128};
129
130/*************************************************************************
131 * Big Block File support
132 *
133 * The big block file is an abstraction of a flat file separated in
134 * same sized blocks. The implementation for the methods described in
135 * this section appear in stg_bigblockfile.c
136 */
137
138/*
139 * Declaration of the data structures
140 */
141typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
142typedef struct MappedPage MappedPage,*LPMAPPEDPAGE;
143
144struct BigBlockFile
145{
146 BOOL fileBased;
147 ULARGE_INTEGER filesize;
148 ULONG blocksize;
149 HANDLE hfile;
150 HANDLE hfilemap;
151 DWORD flProtect;
152 MappedPage *maplist;
153 MappedPage *victimhead, *victimtail;
154 ULONG num_victim_pages;
155 ILockBytes *pLkbyt;
156 HGLOBAL hbytearray;
157 LPVOID pbytearray;
158};
159
160/*
161 * Declaration of the functions used to manipulate the BigBlockFile
162 * data structure.
163 */
164BigBlockFile* BIGBLOCKFILE_Construct(HANDLE hFile,
165 ILockBytes* pLkByt,
166 DWORD openFlags,
167 ULONG blocksize,
168 BOOL fileBased);
169void BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
170void* BIGBLOCKFILE_GetBigBlock(LPBIGBLOCKFILE This, ULONG index);
171void* BIGBLOCKFILE_GetROBigBlock(LPBIGBLOCKFILE This, ULONG index);
172void BIGBLOCKFILE_ReleaseBigBlock(LPBIGBLOCKFILE This, void *pBlock);
173void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
174ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This);
175
176/*************************************************************************
177 * Ole Convert support
178 */
179
180void OLECONVERT_CreateOleStream(LPSTORAGE pStorage);
181HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName);
182
183/****************************************************************************
184 * Storage32BaseImpl definitions.
185 *
186 * This stucture defines the base information contained in all implementations
187 * of IStorage32 contained in this filee storage implementation.
188 *
189 * In OOP terms, this is the base class for all the IStorage32 implementations
190 * contained in this file.
191 */
192struct StorageBaseImpl
193{
194 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
195 * since we want to cast this in a Storage32 pointer */
196
197 /*
198 * Reference count of this object
199 */
200 ULONG ref;
201
202 /*
203 * Ancestor storage (top level)
204 */
205 StorageImpl* ancestorStorage;
206
207 /*
208 * Index of the property for the root of
209 * this storage
210 */
211 ULONG rootPropertySetIndex;
212
213 /*
214 * virtual Destructor method.
215 */
216 void (*v_destructor)(StorageBaseImpl*);
217};
218
219
220/*
221 * Prototypes for the methods of the Storage32BaseImpl class.
222 */
223HRESULT WINAPI StorageBaseImpl_QueryInterface(
224 IStorage* iface,
225 REFIID riid,
226 void** ppvObject);
227
228ULONG WINAPI StorageBaseImpl_AddRef(
229 IStorage* iface);
230
231ULONG WINAPI StorageBaseImpl_Release(
232 IStorage* iface);
233
234HRESULT WINAPI StorageBaseImpl_OpenStream(
235 IStorage* iface,
236 const OLECHAR* pwcsName, /* [string][in] */
237 void* reserved1, /* [unique][in] */
238 DWORD grfMode, /* [in] */
239 DWORD reserved2, /* [in] */
240 IStream** ppstm); /* [out] */
241
242HRESULT WINAPI StorageBaseImpl_OpenStorage(
243 IStorage* iface,
244 const OLECHAR* pwcsName, /* [string][unique][in] */
245 IStorage* pstgPriority, /* [unique][in] */
246 DWORD grfMode, /* [in] */
247 SNB snbExclude, /* [unique][in] */
248 DWORD reserved, /* [in] */
249 IStorage** ppstg); /* [out] */
250
251HRESULT WINAPI StorageBaseImpl_EnumElements(
252 IStorage* iface,
253 DWORD reserved1, /* [in] */
254 void* reserved2, /* [size_is][unique][in] */
255 DWORD reserved3, /* [in] */
256 IEnumSTATSTG** ppenum); /* [out] */
257
258HRESULT WINAPI StorageBaseImpl_Stat(
259 IStorage* iface,
260 STATSTG* pstatstg, /* [out] */
261 DWORD grfStatFlag); /* [in] */
262
263HRESULT WINAPI StorageBaseImpl_RenameElement(
264 IStorage* iface,
265 const OLECHAR* pwcsOldName, /* [string][in] */
266 const OLECHAR* pwcsNewName); /* [string][in] */
267
268HRESULT WINAPI StorageBaseImpl_CreateStream(
269 IStorage* iface,
270 const OLECHAR* pwcsName, /* [string][in] */
271 DWORD grfMode, /* [in] */
272 DWORD reserved1, /* [in] */
273 DWORD reserved2, /* [in] */
274 IStream** ppstm); /* [out] */
275
276HRESULT WINAPI StorageBaseImpl_SetClass(
277 IStorage* iface,
278 REFCLSID clsid); /* [in] */
279
280/****************************************************************************
281 * Storage32Impl definitions.
282 *
283 * This implementation of the IStorage32 interface represents a root
284 * storage. Basically, a document file.
285 */
286struct StorageImpl
287{
288 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
289 * since we want to cast this in a Storage32 pointer */
290
291 /*
292 * Declare the member of the Storage32BaseImpl class to allow
293 * casting as a Storage32BaseImpl
294 */
295 ULONG ref;
296 struct StorageImpl* ancestorStorage;
297 ULONG rootPropertySetIndex;
298 void (*v_destructor)(struct StorageImpl*);
299
300 /*
301 * The following data members are specific to the Storage32Impl
302 * class
303 */
304 HANDLE hFile; /* Physical support for the Docfile */
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
386void StorageImpl_Destroy(
387 StorageImpl* This);
388
389HRESULT StorageImpl_Construct(
390 StorageImpl* This,
391 HANDLE hFile,
392 ILockBytes* pLkbyt,
393 DWORD openFlags,
394 BOOL fileBased,
395 BOOL fileCreate);
396
397BOOL StorageImpl_ReadBigBlock(
398 StorageImpl* This,
399 ULONG blockIndex,
400 void* buffer);
401
402BOOL StorageImpl_WriteBigBlock(
403 StorageImpl* This,
404 ULONG blockIndex,
405 void* buffer);
406
407void* StorageImpl_GetROBigBlock(
408 StorageImpl* This,
409 ULONG blockIndex);
410
411void* StorageImpl_GetBigBlock(
412 StorageImpl* This,
413 ULONG blockIndex);
414
415void StorageImpl_ReleaseBigBlock(
416 StorageImpl* This,
417 void* pBigBlock);
418
419ULONG StorageImpl_GetNextFreeBigBlock(
420 StorageImpl* This);
421
422void StorageImpl_FreeBigBlock(
423 StorageImpl* This,
424 ULONG blockIndex);
425
426ULONG StorageImpl_GetNextBlockInChain(
427 StorageImpl* This,
428 ULONG blockIndex);
429
430void StorageImpl_SetNextBlockInChain(
431 StorageImpl* This,
432 ULONG blockIndex,
433 ULONG nextBlock);
434
435HRESULT StorageImpl_LoadFileHeader(
436 StorageImpl* This);
437
438void StorageImpl_SaveFileHeader(
439 StorageImpl* This);
440
441BOOL StorageImpl_ReadProperty(
442 StorageImpl* This,
443 ULONG index,
444 StgProperty* buffer);
445
446BOOL StorageImpl_WriteProperty(
447 StorageImpl* This,
448 ULONG index,
449 StgProperty* buffer);
450
451BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
452 StorageImpl* This,
453 SmallBlockChainStream** ppsbChain);
454
455ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
456 ULONG blockIndex);
457
458void Storage32Impl_AddBlockDepot(StorageImpl* This,
459 ULONG blockIndex);
460
461ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);
462
463ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
464 ULONG depotIndex);
465
466void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
467 ULONG depotIndex,
468 ULONG blockIndex);
469/****************************************************************************
470 * Storage32InternalImpl definitions.
471 *
472 * Definition of the implementation structure for the IStorage32 interface.
473 * This one implements the IStorage32 interface for storage that are
474 * inside another storage.
475 */
476struct StorageInternalImpl
477{
478 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
479 * since we want to cast this in a Storage32 pointer */
480
481 /*
482 * Declare the member of the Storage32BaseImpl class to allow
483 * casting as a Storage32BaseImpl
484 */
485 ULONG ref;
486 struct StorageImpl* ancestorStorage;
487 ULONG rootPropertySetIndex;
488 void (*v_destructor)(struct StorageInternalImpl*);
489
490 /*
491 * There is no specific data for this class.
492 */
493};
494
495/*
496 * Method definitions for the Storage32InternalImpl class.
497 */
498StorageInternalImpl* StorageInternalImpl_Construct(
499 StorageImpl* ancestorStorage,
500 ULONG rootTropertyIndex);
501
502void StorageInternalImpl_Destroy(
503 StorageInternalImpl* This);
504
505HRESULT WINAPI StorageInternalImpl_Commit(
506 IStorage* iface,
507 DWORD grfCommitFlags); /* [in] */
508
509HRESULT WINAPI StorageInternalImpl_Revert(
510 IStorage* iface);
511
512
513/****************************************************************************
514 * IEnumSTATSTGImpl definitions.
515 *
516 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
517 * This class allows iterating through the content of a storage and to find
518 * specific items inside it.
519 */
520struct IEnumSTATSTGImpl
521{
522 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct
523 * since we want to cast this in a IEnumSTATSTG pointer */
524
525 ULONG ref; /* Reference count */
526 StorageImpl* parentStorage; /* Reference to the parent storage */
527 ULONG firstPropertyNode; /* Index of the root of the storage to enumerate */
528
529 /*
530 * The current implementation of the IEnumSTATSTGImpl class uses a stack
531 * to walk the property sets to get the content of a storage. This stack
532 * is implemented by the following 3 data members
533 */
534 ULONG stackSize;
535 ULONG stackMaxSize;
536 ULONG* stackToVisit;
537
538#define ENUMSTATSGT_SIZE_INCREMENT 10
539};
540
541/*
542 * Method definitions for the IEnumSTATSTGImpl class.
543 */
544HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface(
545 IEnumSTATSTG* iface,
546 REFIID riid,
547 void** ppvObject);
548
549ULONG WINAPI IEnumSTATSTGImpl_AddRef(
550 IEnumSTATSTG* iface);
551
552ULONG WINAPI IEnumSTATSTGImpl_Release(
553 IEnumSTATSTG* iface);
554
555HRESULT WINAPI IEnumSTATSTGImpl_Next(
556 IEnumSTATSTG* iface,
557 ULONG celt,
558 STATSTG* rgelt,
559 ULONG* pceltFetched);
560
561HRESULT WINAPI IEnumSTATSTGImpl_Skip(
562 IEnumSTATSTG* iface,
563 ULONG celt);
564
565HRESULT WINAPI IEnumSTATSTGImpl_Reset(
566 IEnumSTATSTG* iface);
567
568HRESULT WINAPI IEnumSTATSTGImpl_Clone(
569 IEnumSTATSTG* iface,
570 IEnumSTATSTG** ppenum);
571
572IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
573 StorageImpl* This,
574 ULONG firstPropertyNode);
575
576void IEnumSTATSTGImpl_Destroy(
577 IEnumSTATSTGImpl* This);
578
579void IEnumSTATSTGImpl_PushSearchNode(
580 IEnumSTATSTGImpl* This,
581 ULONG nodeToPush);
582
583ULONG IEnumSTATSTGImpl_PopSearchNode(
584 IEnumSTATSTGImpl* This,
585 BOOL remove);
586
587ULONG IEnumSTATSTGImpl_FindProperty(
588 IEnumSTATSTGImpl* This,
589 const OLECHAR* lpszPropName,
590 StgProperty* buffer);
591
592INT IEnumSTATSTGImpl_FindParentProperty(
593 IEnumSTATSTGImpl *This,
594 ULONG childProperty,
595 StgProperty *currentProperty,
596 ULONG *propertyId);
597
598
599/****************************************************************************
600 * StgStreamImpl definitions.
601 *
602 * This class imlements the IStream32 inteface and represents a stream
603 * located inside a storage object.
604 */
605struct StgStreamImpl
606{
607 ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct
608 * since we want to cast this in a IStream pointer */
609
610 /*
611 * Reference count
612 */
613 ULONG ref;
614
615 /*
616 * Storage that is the parent(owner) of the stream
617 */
618 StorageBaseImpl* parentStorage;
619
620 /*
621 * Access mode of this stream.
622 */
623 DWORD grfMode;
624
625 /*
626 * Index of the property that owns (points to) this stream.
627 */
628 ULONG ownerProperty;
629
630 /*
631 * Helper variable that contains the size of the stream
632 */
633 ULARGE_INTEGER streamSize;
634
635 /*
636 * This is the current position of the cursor in the stream
637 */
638 ULARGE_INTEGER currentPosition;
639
640 /*
641 * The information in the stream is represented by a chain of small blocks
642 * or a chain of large blocks. Depending on the case, one of the two
643 * following variabled points to that information.
644 */
645 BlockChainStream* bigBlockChain;
646 SmallBlockChainStream* smallBlockChain;
647};
648
649/*
650 * Method definition for the StgStreamImpl class.
651 */
652StgStreamImpl* StgStreamImpl_Construct(
653 StorageBaseImpl* parentStorage,
654 DWORD grfMode,
655 ULONG ownerProperty);
656
657void StgStreamImpl_Destroy(
658 StgStreamImpl* This);
659
660void StgStreamImpl_OpenBlockChain(
661 StgStreamImpl* This);
662
663HRESULT WINAPI StgStreamImpl_QueryInterface(
664 IStream* iface,
665 REFIID riid, /* [in] */
666 void** ppvObject); /* [iid_is][out] */
667
668ULONG WINAPI StgStreamImpl_AddRef(
669 IStream* iface);
670
671ULONG WINAPI StgStreamImpl_Release(
672 IStream* iface);
673
674HRESULT WINAPI StgStreamImpl_Read(
675 IStream* iface,
676 void* pv, /* [length_is][size_is][out] */
677 ULONG cb, /* [in] */
678 ULONG* pcbRead); /* [out] */
679
680HRESULT WINAPI StgStreamImpl_Write(
681 IStream* iface,
682 const void* pv, /* [size_is][in] */
683 ULONG cb, /* [in] */
684 ULONG* pcbWritten); /* [out] */
685
686HRESULT WINAPI StgStreamImpl_Seek(
687 IStream* iface,
688 LARGE_INTEGER dlibMove, /* [in] */
689 DWORD dwOrigin, /* [in] */
690 ULARGE_INTEGER* plibNewPosition); /* [out] */
691
692HRESULT WINAPI StgStreamImpl_SetSize(
693 IStream* iface,
694 ULARGE_INTEGER libNewSize); /* [in] */
695
696HRESULT WINAPI StgStreamImpl_CopyTo(
697 IStream* iface,
698 IStream* pstm, /* [unique][in] */
699 ULARGE_INTEGER cb, /* [in] */
700 ULARGE_INTEGER* pcbRead, /* [out] */
701 ULARGE_INTEGER* pcbWritten); /* [out] */
702
703HRESULT WINAPI StgStreamImpl_Commit(
704 IStream* iface,
705 DWORD grfCommitFlags); /* [in] */
706
707HRESULT WINAPI StgStreamImpl_Revert(
708 IStream* iface);
709
710HRESULT WINAPI StgStreamImpl_LockRegion(
711 IStream* iface,
712 ULARGE_INTEGER libOffset, /* [in] */
713 ULARGE_INTEGER cb, /* [in] */
714 DWORD dwLockType); /* [in] */
715
716HRESULT WINAPI StgStreamImpl_UnlockRegion(
717 IStream* iface,
718 ULARGE_INTEGER libOffset, /* [in] */
719 ULARGE_INTEGER cb, /* [in] */
720 DWORD dwLockType); /* [in] */
721
722HRESULT WINAPI StgStreamImpl_Stat(
723 IStream* iface,
724 STATSTG* pstatstg, /* [out] */
725 DWORD grfStatFlag); /* [in] */
726
727HRESULT WINAPI StgStreamImpl_Clone(
728 IStream* iface,
729 IStream** ppstm); /* [out] */
730
731
732/********************************************************************************
733 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are
734 * abstractions used to read values from file buffers without having to worry
735 * about bit order
736 */
737void StorageUtl_ReadWord(void* buffer, ULONG offset, WORD* value);
738void StorageUtl_WriteWord(void* buffer, ULONG offset, WORD value);
739void StorageUtl_ReadDWord(void* buffer, ULONG offset, DWORD* value);
740void StorageUtl_WriteDWord(void* buffer, ULONG offset, DWORD value);
741void StorageUtl_ReadGUID(void* buffer, ULONG offset, GUID* value);
742void StorageUtl_WriteGUID(void* buffer, ULONG offset, GUID* value);
743void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination,
744 StgProperty* source,
745 int statFlags);
746
747/****************************************************************************
748 * BlockChainStream definitions.
749 *
750 * The BlockChainStream class is a utility class that is used to create an
751 * abstraction of the big block chains in the storage file.
752 */
753struct BlockChainStream
754{
755 StorageImpl* parentStorage;
756 ULONG* headOfStreamPlaceHolder;
757 ULONG ownerPropertyIndex;
758 ULONG lastBlockNoInSequence;
759 ULONG lastBlockNoInSequenceIndex;
760 ULONG tailIndex;
761 ULONG numBlocks;
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#ifdef __cplusplus
869}
870#endif
871
872#endif /* __STORAGE32_H__ */
873
874
875
Note: See TracBrowser for help on using the repository browser.