1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-05 17:28:47 +00:00

coml2: Move GetConvertStg from ole32.

This commit is contained in:
Fabian Maurer 2023-11-16 04:56:12 +01:00 committed by Alexandre Julliard
parent 53c0a31b28
commit c6f049fc33
4 changed files with 89 additions and 32 deletions

View File

@ -4,4 +4,5 @@ IMPORTLIB = coml2
IMPORTS = uuid
SOURCES = \
memlockbytes.c
memlockbytes.c \
storage32.c

View File

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

86
dlls/coml2/storage32.c Normal file
View File

@ -0,0 +1,86 @@
/*
* 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;
}

View File

@ -10565,36 +10565,6 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAMEx ( LPSTORAGE stg, CLIPFORMAT cf, L
return E_NOTIMPL;
}
/***********************************************************************
* 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.@)
*/