Sync with trunk (r48414)
[reactos.git] / dll / win32 / ole32 / storage32.h
index 19f3f2d..9e7fe10 100644 (file)
@@ -11,6 +11,7 @@
  *
  * Copyright 1998,1999 Francis Beaudet
  * Copyright 1998,1999 Thuy Nguyen
+ * Copyright 2010 Vincent Povirk for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 /*
  * Definitions for the file format offsets.
  */
+static const ULONG OFFSET_MINORVERSION       = 0x00000018;
+static const ULONG OFFSET_MAJORVERSION       = 0x0000001a;
+static const ULONG OFFSET_BYTEORDERMARKER    = 0x0000001c;
 static const ULONG OFFSET_BIGBLOCKSIZEBITS   = 0x0000001e;
 static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
+static const ULONG OFFSET_DIRSECTORCOUNT     = 0x00000028;
 static const ULONG OFFSET_BBDEPOTCOUNT      = 0x0000002C;
 static const ULONG OFFSET_ROOTSTARTBLOCK     = 0x00000030;
 static const ULONG OFFSET_SMALLBLOCKLIMIT    = 0x00000038;
@@ -149,31 +154,7 @@ struct DirEntry
   ULARGE_INTEGER size;
 };
 
-/*************************************************************************
- * Big Block File support
- *
- * The big block file is an abstraction of a flat file separated in
- * same sized blocks. The implementation for the methods described in
- * this section appear in stg_bigblockfile.c
- */
-
-typedef struct BigBlockFile BigBlockFile,*LPBIGBLOCKFILE;
-
-/*
- * Declaration of the functions used to manipulate the BigBlockFile
- * data structure.
- */
-BigBlockFile*  BIGBLOCKFILE_Construct(HANDLE hFile,
-                                      ILockBytes* pLkByt,
-                                      DWORD openFlags,
-                                      BOOL fileBased);
-void           BIGBLOCKFILE_Destructor(LPBIGBLOCKFILE This);
-HRESULT        BIGBLOCKFILE_Expand(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
-HRESULT        BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize);
-HRESULT        BIGBLOCKFILE_ReadAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset,
-           void* buffer, ULONG size, ULONG* bytesRead);
-HRESULT        BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset,
-           const void* buffer, ULONG size, ULONG* bytesRead);
+HRESULT FileLockBytesImpl_Construct(HANDLE hFile, DWORD openFlags, LPCWSTR pwcsName, ILockBytes **pLockBytes);
 
 /*************************************************************************
  * Ole Convert support
@@ -240,9 +221,6 @@ struct StorageBaseImpl
    */
   DWORD stateBits;
 
-  /* If set, this overrides the root storage name returned by IStorage_Stat */
-  LPCWSTR          filename;
-
   BOOL             create;     /* Was the storage created or opened.
                                   The behaviour of STGM_SIMPLE depends on this */
   /*
@@ -256,6 +234,8 @@ struct StorageBaseImpl
 struct StorageBaseImplVtbl {
   void (*Destroy)(StorageBaseImpl*);
   void (*Invalidate)(StorageBaseImpl*);
+  HRESULT (*Flush)(StorageBaseImpl*);
+  HRESULT (*GetFilename)(StorageBaseImpl*,LPWSTR*);
   HRESULT (*CreateDirEntry)(StorageBaseImpl*,const DirEntry*,DirRef*);
   HRESULT (*WriteDirEntry)(StorageBaseImpl*,DirRef,const DirEntry*);
   HRESULT (*ReadDirEntry)(StorageBaseImpl*,DirRef,DirEntry*);
@@ -276,6 +256,16 @@ static inline void StorageBaseImpl_Invalidate(StorageBaseImpl *This)
   This->baseVtbl->Invalidate(This);
 }
 
+static inline HRESULT StorageBaseImpl_Flush(StorageBaseImpl *This)
+{
+  return This->baseVtbl->Flush(This);
+}
+
+static inline HRESULT StorageBaseImpl_GetFilename(StorageBaseImpl *This, LPWSTR *result)
+{
+  return This->baseVtbl->GetFilename(This, result);
+}
+
 static inline HRESULT StorageBaseImpl_CreateDirEntry(StorageBaseImpl *This,
   const DirEntry *newData, DirRef *index)
 {
@@ -351,13 +341,6 @@ struct StorageImpl
 {
   struct StorageBaseImpl base;
 
-  /*
-   * The following data members are specific to the Storage32Impl
-   * class
-   */
-  HANDLE           hFile;      /* Physical support for the Docfile */
-  LPOLESTR         pwcsName;   /* Full path of the document file */
-
   /*
    * File header
    */
@@ -391,10 +374,7 @@ struct StorageImpl
   BlockChainStream* blockChainCache[BLOCKCHAIN_CACHE_SIZE];
   UINT blockChainToEvict;
 
-  /*
-   * Pointer to the big block file abstraction
-   */
-  BigBlockFile* bigBlockFile;
+  ILockBytes* lockBytes;
 };
 
 HRESULT StorageImpl_ReadRawDirEntry(