Commit c6f049fc authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

coml2: Move GetConvertStg from ole32.

parent 53c0a31b
......@@ -4,4 +4,5 @@ IMPORTLIB = coml2
IMPORTS = uuid
SOURCES = \
memlockbytes.c
memlockbytes.c \
storage32.c
......@@ -12,7 +12,7 @@
@ stdcall CreateILockBytesOnHGlobal(ptr long ptr)
@ stub DllGetClassObject
@ stub FmtIdToPropStgName
@ stub GetConvertStg
@ stdcall GetConvertStg(ptr)
@ stdcall GetHGlobalFromILockBytes(ptr ptr)
@ stub PropStgNameToFmtId
@ stub ReadClassStg
......
/*
* Compound Storage (32 bit version)
* Storage implementation
*
* This file contains the compound file implementation
* of the storage interface.
*
* Copyright 1999 Francis Beaudet
* Copyright 1999 Sylvain St-Germain
* Copyright 1999 Thuy Nguyen
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
* The compound file implementation of IStorage used for create
* and manage substorages and streams within a storage object
* residing in a compound file object.
*/
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"
#include "wine/debug.h"
#include "ole2.h" /* For Write/ReadClassStm */
#include "winreg.h"
#include "wine/wingdi16.h"
WINE_DEFAULT_DEBUG_CHANNEL(storage);
enum stream_1ole_flags {
OleStream_LinkedObject = 0x00000001,
OleStream_Convert = 0x00000004
};
/***********************************************************************
* GetConvertStg (coml2.@)
*/
HRESULT WINAPI GetConvertStg(IStorage *stg)
{
static const DWORD version_magic = 0x02000001;
DWORD header[2];
IStream *stream;
HRESULT hr;
TRACE("%p\n", stg);
if (!stg) return E_INVALIDARG;
hr = IStorage_OpenStream(stg, L"\1Ole", NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
if (FAILED(hr)) return hr;
hr = IStream_Read(stream, header, sizeof(header), NULL);
IStream_Release(stream);
if (FAILED(hr)) return hr;
if (header[0] != version_magic)
{
ERR("got wrong version magic for 1Ole stream, %#lx.\n", header[0]);
return E_FAIL;
}
return header[1] & OleStream_Convert ? S_OK : S_FALSE;
}
......@@ -10566,36 +10566,6 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAMEx ( LPSTORAGE stg, CLIPFORMAT cf, L
}
/***********************************************************************
* GetConvertStg (OLE32.@)
*/
HRESULT WINAPI GetConvertStg(IStorage *stg)
{
static const DWORD version_magic = 0x02000001;
DWORD header[2];
IStream *stream;
HRESULT hr;
TRACE("%p\n", stg);
if (!stg) return E_INVALIDARG;
hr = IStorage_OpenStream(stg, L"\1Ole", NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
if (FAILED(hr)) return hr;
hr = IStream_Read(stream, header, sizeof(header), NULL);
IStream_Release(stream);
if (FAILED(hr)) return hr;
if (header[0] != version_magic)
{
ERR("got wrong version magic for 1Ole stream, %#lx.\n", header[0]);
return E_FAIL;
}
return header[1] & OleStream_Convert ? S_OK : S_FALSE;
}
/***********************************************************************
* SetConvertStg (OLE32.@)
*/
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
......
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