Vincent Povirk : ole32: Add and use a destroyDirEntry function for deleting directory entries.

Alexandre Julliard julliard at winehq.org
Tue Nov 3 15:37:20 CST 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Nov  2 12:25:46 2009 -0600

ole32: Add and use a destroyDirEntry function for deleting directory entries.

We need this so we can free any related resources in memory.

---

 dlls/ole32/storage32.c |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 3af5157..e4b933e 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -183,6 +183,10 @@ static HRESULT createDirEntry(
   const StgProperty *newData,
   ULONG *index);
 
+static HRESULT destroyDirEntry(
+  StorageImpl *storage,
+  ULONG index);
+
 static void updatePropertyChain(
   StorageBaseImpl *storage,
   ULONG       newPropertyIndex,
@@ -1257,6 +1261,27 @@ static HRESULT createDirEntry(
   return hr;
 }
 
+/***************************************************************************
+ *
+ * Internal Method
+ *
+ * Mark a directory entry in the file as free.
+ */
+static HRESULT destroyDirEntry(
+  StorageImpl *storage,
+  ULONG index)
+{
+  HRESULT hr;
+  BYTE emptyData[PROPSET_BLOCK_SIZE];
+
+  memset(&emptyData, 0, PROPSET_BLOCK_SIZE);
+
+  hr = StorageImpl_WriteRawDirEntry(storage, index, emptyData);
+
+  return hr;
+}
+
+
 /****************************************************************************
  *
  * Internal Method
@@ -1802,13 +1827,11 @@ static HRESULT WINAPI StorageBaseImpl_DestroyElement(
         foundPropertyIndexToDelete);
 
   /*
-   * Invalidate the property by zeroing its name member.
+   * Invalidate the property
    */
-  propertyToDelete.sizeOfNameString = 0;
-
-  StorageImpl_WriteProperty(This->ancestorStorage,
-                            foundPropertyIndexToDelete,
-                            &propertyToDelete);
+  if (SUCCEEDED(hr))
+    destroyDirEntry(This->ancestorStorage,
+                    foundPropertyIndexToDelete);
 
   return hr;
 }




More information about the wine-cvs mailing list