Vincent Povirk : ole32: Use the raw directory entry functions in getFreeProperty.

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


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Oct 28 12:49:09 2009 -0500

ole32: Use the raw directory entry functions in getFreeProperty.

The meaning of the "index" argument in Read/WriteProperty will likely
change in the future, but getFreeProperty must work with real indexes
into the file's real directory stream.

---

 dlls/ole32/storage32.c |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 86c174b..b1f19f3 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -1182,20 +1182,24 @@ static ULONG getFreeProperty(
 {
   ULONG       currentPropertyIndex = 0;
   ULONG       newPropertyIndex     = PROPERTY_NULL;
-  BOOL      readSuccessful        = TRUE;
-  StgProperty currentProperty;
+  HRESULT readRes = S_OK;
+  BYTE currentData[PROPSET_BLOCK_SIZE];
+  WORD sizeOfNameString;
 
   do
   {
-    /*
-     * Start by reading the root property
-     */
-    readSuccessful = StorageImpl_ReadProperty(storage->base.ancestorStorage,
-                                               currentPropertyIndex,
-                                               &currentProperty);
-    if (readSuccessful)
+    readRes = StorageImpl_ReadRawDirEntry(storage->base.ancestorStorage,
+                                          currentPropertyIndex,
+                                          currentData);
+
+    if (SUCCEEDED(readRes))
     {
-      if (currentProperty.sizeOfNameString == 0)
+      StorageUtl_ReadWord(
+        currentData,
+        OFFSET_PS_NAMELENGTH,
+        &sizeOfNameString);
+
+      if (sizeOfNameString == 0)
       {
         /*
          * The property existis and is available, we found it.
@@ -1217,9 +1221,9 @@ static ULONG getFreeProperty(
   /*
    * grow the property chain
    */
-  if (! readSuccessful)
+  if (!SUCCEEDED(readRes))
   {
-    StgProperty    emptyProperty;
+    BYTE           emptyData[PROPSET_BLOCK_SIZE];
     ULARGE_INTEGER newSize;
     ULONG          propertyIndex;
     ULONG          lastProperty  = 0;
@@ -1246,7 +1250,7 @@ static ULONG getFreeProperty(
      * memset the empty property in order to initialize the unused newly
      * created property
      */
-    memset(&emptyProperty, 0, sizeof(StgProperty));
+    memset(&emptyData, 0, PROPSET_BLOCK_SIZE);
 
     /*
      * initialize them
@@ -1258,10 +1262,10 @@ static ULONG getFreeProperty(
       propertyIndex < lastProperty;
       propertyIndex++)
     {
-      StorageImpl_WriteProperty(
+      StorageImpl_WriteRawDirEntry(
         storage->base.ancestorStorage,
         propertyIndex,
-        &emptyProperty);
+        emptyData);
     }
   }
 




More information about the wine-cvs mailing list