Vincent Povirk : ole32: Move the low-level functionality of WriteProperty to a new function.

Alexandre Julliard julliard at winehq.org
Thu Oct 29 11:20:39 CDT 2009


Module: wine
Branch: master
Commit: e71c696b510fc60f1a18491a8e9c03f0a139cb6d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e71c696b510fc60f1a18491a8e9c03f0a139cb6d

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Oct 28 11:41:50 2009 -0500

ole32: Move the low-level functionality of WriteProperty to a new function.

---

 dlls/ole32/storage32.c |   37 +++++++++++++++++++++++++++----------
 dlls/ole32/storage32.h |    5 +++++
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 4ff9f89..86c174b 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -3072,6 +3072,32 @@ HRESULT StorageImpl_ReadRawDirEntry(StorageImpl *This, ULONG index, BYTE *buffer
 }
 
 /******************************************************************************
+ *      StorageImpl_WriteRawDirEntry
+ *
+ * This method will write the raw data from a directory entry in the file.
+ *
+ * buffer must be PROPSET_BLOCK_SIZE bytes long.
+ */
+HRESULT StorageImpl_WriteRawDirEntry(StorageImpl *This, ULONG index, const BYTE *buffer)
+{
+  ULARGE_INTEGER offset;
+  HRESULT hr;
+  ULONG bytesRead;
+
+  offset.u.HighPart = 0;
+  offset.u.LowPart  = index * PROPSET_BLOCK_SIZE;
+
+  hr = BlockChainStream_WriteAt(
+                    This->rootBlockChain,
+                    offset,
+                    PROPSET_BLOCK_SIZE,
+                    buffer,
+                    &bytesRead);
+
+  return hr;
+}
+
+/******************************************************************************
  *      Storage32Impl_ReadProperty
  *
  * This method will read the specified property from the property chain.
@@ -3171,12 +3197,7 @@ BOOL StorageImpl_WriteProperty(
   const StgProperty*    buffer)
 {
   BYTE           currentProperty[PROPSET_BLOCK_SIZE];
-  ULARGE_INTEGER offsetInPropSet;
   HRESULT        writeRes;
-  ULONG          bytesWritten;
-
-  offsetInPropSet.u.HighPart = 0;
-  offsetInPropSet.u.LowPart  = index * PROPSET_BLOCK_SIZE;
 
   memset(currentProperty, 0, PROPSET_BLOCK_SIZE);
 
@@ -3242,11 +3263,7 @@ BOOL StorageImpl_WriteProperty(
       OFFSET_PS_SIZE,
       buffer->size.u.LowPart);
 
-  writeRes = BlockChainStream_WriteAt(This->rootBlockChain,
-                                      offsetInPropSet,
-                                      PROPSET_BLOCK_SIZE,
-                                      currentProperty,
-                                      &bytesWritten);
+  writeRes = StorageImpl_WriteRawDirEntry(This, index, currentProperty);
   return SUCCEEDED(writeRes) ? TRUE : FALSE;
 }
 
diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h
index 281948e..bbc6a5d 100644
--- a/dlls/ole32/storage32.h
+++ b/dlls/ole32/storage32.h
@@ -295,6 +295,11 @@ HRESULT StorageImpl_ReadRawDirEntry(
             ULONG index,
             BYTE *buffer);
 
+HRESULT StorageImpl_WriteRawDirEntry(
+            StorageImpl *This,
+            ULONG index,
+            const BYTE *buffer);
+
 BOOL StorageImpl_ReadProperty(
             StorageImpl*    This,
             ULONG           index,




More information about the wine-cvs mailing list