Nikolay Sivov : ole32: Use a single implementation for 1Ole stream initialization.

Alexandre Julliard julliard at winehq.org
Thu Jul 19 13:23:43 CDT 2012


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Jul 19 10:35:08 2012 +0400

ole32: Use a single implementation for 1Ole stream initialization.

---

 dlls/ole32/defaulthandler.c |   37 ++++++-------------------------------
 1 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c
index 68d85ec..b43b962 100644
--- a/dlls/ole32/defaulthandler.c
+++ b/dlls/ole32/defaulthandler.c
@@ -58,6 +58,7 @@
 #include "ole2.h"
 
 #include "compobj_private.h"
+#include "storage32.h"
 
 #include "wine/unicode.h"
 #include "wine/debug.h"
@@ -1583,10 +1584,8 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_IsDirty(
 }
 
 /***********************************************************************
- *   init_ole_stream
  *
- * Creates the '\1Ole' stream.
- * The format of this stream is as follows:
+ * The format of '\1Ole' stream is as follows:
  *
  * DWORD Version == 0x02000001
  * DWORD Flags - low bit set indicates the object is a link otherwise it's embedded.
@@ -1611,29 +1610,6 @@ typedef struct
 } ole_stream_header_t;
 static const DWORD ole_stream_version = 0x02000001;
 
-static void init_ole_stream(IStorage *storage)
-{
-    HRESULT hr;
-    IStream *stream;
-
-    hr = IStorage_CreateStream(storage, OleStream, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
-    if(SUCCEEDED(hr))
-    {
-        DWORD written;
-        ole_stream_header_t header;
-
-        header.version         = ole_stream_version;
-        header.flags           = 0;
-        header.link_update_opt = 0;
-        header.res             = 0;
-        header.moniker_size    = 0;
-
-        IStream_Write(stream, &header, sizeof(header), &written);
-        IStream_Release(stream);
-    }
-    return;
-}
-
 static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
 {
     IStream *stream;
@@ -1663,10 +1639,8 @@ static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
         IStream_Release(stream);
     }
     else
-    {
-        init_ole_stream(storage);
-        hr = S_OK;
-    }
+        hr = STORAGE_CreateOleStream(storage, 0);
+
     return hr;
 }
 
@@ -1682,7 +1656,8 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_InitNew(
     HRESULT hr;
 
     TRACE("(%p)->(%p)\n", iface, pStg);
-    init_ole_stream(pStg);
+    hr = STORAGE_CreateOleStream(pStg, 0);
+    if (hr != S_OK) return hr;
 
     hr = IPersistStorage_InitNew(This->dataCache_PersistStg, pStg);
 




More information about the wine-cvs mailing list