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

This commit is contained in:
Nikolay Sivov 2012-07-19 10:35:08 +04:00 committed by Alexandre Julliard
parent c3fd306f61
commit 24a690e90e

View file

@ -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);