Commit 24a690e9 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent c3fd306f
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "ole2.h" #include "ole2.h"
#include "compobj_private.h" #include "compobj_private.h"
#include "storage32.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -1583,10 +1584,8 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_IsDirty( ...@@ -1583,10 +1584,8 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_IsDirty(
} }
/*********************************************************************** /***********************************************************************
* init_ole_stream
* *
* Creates the '\1Ole' stream. * The format of '\1Ole' stream is as follows:
* The format of this stream is as follows:
* *
* DWORD Version == 0x02000001 * DWORD Version == 0x02000001
* DWORD Flags - low bit set indicates the object is a link otherwise it's embedded. * DWORD Flags - low bit set indicates the object is a link otherwise it's embedded.
...@@ -1611,29 +1610,6 @@ typedef struct ...@@ -1611,29 +1610,6 @@ typedef struct
} ole_stream_header_t; } ole_stream_header_t;
static const DWORD ole_stream_version = 0x02000001; 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) static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
{ {
IStream *stream; IStream *stream;
...@@ -1663,10 +1639,8 @@ static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage) ...@@ -1663,10 +1639,8 @@ static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
IStream_Release(stream); IStream_Release(stream);
} }
else else
{ hr = STORAGE_CreateOleStream(storage, 0);
init_ole_stream(storage);
hr = S_OK;
}
return hr; return hr;
} }
...@@ -1682,7 +1656,8 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_InitNew( ...@@ -1682,7 +1656,8 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_InitNew(
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%p)\n", iface, pStg); 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); hr = IPersistStorage_InitNew(This->dataCache_PersistStg, pStg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment