ole32: Make storage.dll into a stand-alone 16-bit module.

oldstable
Alexandre Julliard 2009-03-11 17:03:10 +01:00
parent 7511d67447
commit f7fe2edadd
10 changed files with 271 additions and 114 deletions

1
.gitignore vendored
View File

@ -96,7 +96,6 @@ dlls/shell.dll16
dlls/sound.drv16
dlls/stdole2.tlb/std_ole_v2.tlb
dlls/stdole32.tlb/std_ole_v1.tlb
dlls/storage.dll16
dlls/system.drv16
dlls/toolhelp.dll16
dlls/twain.dll16

10
configure vendored
View File

@ -3917,6 +3917,7 @@ then
enable_ole2thk_dll16=${enable_ole2thk_dll16:-no}
enable_olecli_dll16=${enable_olecli_dll16:-no}
enable_olesvr_dll16=${enable_olesvr_dll16:-no}
enable_storage_dll16=${enable_storage_dll16:-no}
enable_stress_dll16=${enable_stress_dll16:-no}
enable_vdhcp_vxd=${enable_vdhcp_vxd:-no}
enable_vmm_vxd=${enable_vmm_vxd:-no}
@ -27134,6 +27135,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/sti/Makefile: dlls/sti/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/sti/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/storage.dll16/Makefile"
test "x$enable_storage_dll16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
storage.dll16"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/storage.dll16/Makefile: dlls/storage.dll16/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/storage.dll16/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/stress.dll16/Makefile"
test "x$enable_stress_dll16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
@ -29299,6 +29308,7 @@ do
"dlls/stdole2.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole2.tlb/Makefile" ;;
"dlls/stdole32.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole32.tlb/Makefile" ;;
"dlls/sti/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sti/Makefile" ;;
"dlls/storage.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/storage.dll16/Makefile" ;;
"dlls/stress.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stress.dll16/Makefile" ;;
"dlls/strmiids/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/strmiids/Makefile" ;;
"dlls/svrapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/svrapi/Makefile" ;;

View File

@ -154,6 +154,7 @@ then
enable_ole2thk_dll16=${enable_ole2thk_dll16:-no}
enable_olecli_dll16=${enable_olecli_dll16:-no}
enable_olesvr_dll16=${enable_olesvr_dll16:-no}
enable_storage_dll16=${enable_storage_dll16:-no}
enable_stress_dll16=${enable_stress_dll16:-no}
enable_vdhcp_vxd=${enable_vdhcp_vxd:-no}
enable_vmm_vxd=${enable_vmm_vxd:-no}
@ -2228,6 +2229,7 @@ WINE_CONFIG_MAKEFILE([dlls/spoolss/tests/Makefile],[dlls/Maketest.rules],[dlls],
WINE_CONFIG_MAKEFILE([dlls/stdole2.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/stdole32.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/sti/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/storage.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/stress.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/strmiids/Makefile],[dlls/Makeimplib.rules],[dlls],[ALL_IMPLIB_DIRS])
WINE_CONFIG_MAKEFILE([dlls/svrapi/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])

View File

@ -35,7 +35,6 @@ WIN16_FILES = \
setupx.dll16 \
shell.dll16 \
sound.drv16 \
storage.dll16 \
system.drv16 \
toolhelp.dll16 \
twain.dll16 \
@ -81,7 +80,7 @@ krnl386.exe16 system.drv16 toolhelp.dll16:
msvideo.dll16:
echo "msvfw32.dll" >$@
compobj.dll16 ole2.dll16 storage.dll16:
compobj.dll16 ole2.dll16:
echo "ole32.dll" >$@
ole2disp.dll16 typelib.dll16:

View File

@ -49,13 +49,11 @@ C_SRCS = \
C_SRCS16 = \
memlockbytes16.c \
ole16.c \
ole2_16.c \
storage.c
ole2_16.c
SPEC_SRCS16 = \
compobj.spec \
ole2.spec \
storage.spec
ole2.spec
RC_SRCS = ole32res.rc

View File

@ -35,6 +35,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wownt32.h"
#include "ole2.h"
#include "winerror.h"
@ -243,3 +244,66 @@ HRESULT WINAPI OleFlushClipboard16(void)
{
return OleFlushClipboard();
}
/***********************************************************************
* ReadClassStg (OLE2.18)
*
* This method reads the CLSID previously written to a storage object with
* the WriteClassStg.
*
* PARAMS
* pstg [I] Segmented LPSTORAGE pointer.
* pclsid [O] Pointer to where the CLSID is written
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
{
STATSTG16 statstg;
HANDLE16 hstatstg;
HRESULT hres;
DWORD args[3];
TRACE("(%x, %p)\n", pstg, pclsid);
if(pclsid==NULL)
return E_POINTER;
/*
* read a STATSTG structure (contains the clsid) from the storage
*/
args[0] = (DWORD)pstg; /* iface */
args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg );
args[2] = STATFLAG_DEFAULT;
if (!WOWCallback16Ex(
(DWORD)((const IStorage16Vtbl*)MapSL(
(SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl)
)->Stat,
WCB16_PASCAL,
3*sizeof(DWORD),
(LPVOID)args,
(LPDWORD)&hres
)) {
WOWGlobalUnlockFree16(args[1]);
ERR("CallTo16 IStorage16::Stat() failed, hres %x\n",hres);
return hres;
}
memcpy(&statstg, MapSL(args[1]), sizeof(STATSTG16));
WOWGlobalUnlockFree16(args[1]);
if(SUCCEEDED(hres)) {
*pclsid=statstg.clsid;
TRACE("clsid is %s\n", debugstr_guid(&statstg.clsid));
}
return hres;
}
/***********************************************************************
* GetConvertStg (OLE2.82)
*/
HRESULT WINAPI GetConvertStg16(LPSTORAGE stg) {
FIXME("unimplemented stub!\n");
return E_FAIL;
}

View File

@ -0,0 +1,15 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = storage.dll16
IMPORTS = uuid ole32 kernel32 ntdll
EXTRADLLFLAGS = -Wb,--subsystem,win16,--main-module,ole32.dll
SPEC_SRCS = storage.dll16.spec
C_SRCS = storage.c
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -0,0 +1,133 @@
/*
* Copyright 1997 Marcus Meissner
*
* 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
*/
#ifndef __WINE_OLE_IFS_H
#define __WINE_OLE_IFS_H
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
typedef CHAR OLECHAR16;
typedef LPSTR LPOLESTR16;
typedef LPCSTR LPCOLESTR16;
#define STDMETHOD16CALLTYPE __cdecl
#define STDMETHOD16(m) HRESULT (STDMETHOD16CALLTYPE *m)
#define STDMETHOD16_(t,m) t (STDMETHOD16CALLTYPE *m)
/**********************************************************************/
typedef struct ILockBytes16 *LPLOCKBYTES16;
#define INTERFACE ILockBytes16
DECLARE_INTERFACE_(ILockBytes16,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD16_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD16_(ULONG,AddRef)(THIS) PURE;
STDMETHOD16_(ULONG,Release)(THIS) PURE;
/*** ILockBytes16 methods ***/
STDMETHOD16(ReadAt)(THIS_ ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead) PURE;
STDMETHOD16(WriteAt)(THIS_ ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten) PURE;
STDMETHOD16(Flush)(THIS) PURE;
STDMETHOD16(SetSize)(THIS_ ULARGE_INTEGER cb) PURE;
STDMETHOD16(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE;
STDMETHOD16(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE;
STDMETHOD16(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag) PURE;
};
#undef INTERFACE
/**********************************************************************/
typedef struct tagSTATSTG16
{
LPOLESTR16 pwcsName;
DWORD type;
ULARGE_INTEGER cbSize;
FILETIME mtime;
FILETIME ctime;
FILETIME atime;
DWORD grfMode;
DWORD grfLocksSupported;
CLSID clsid;
DWORD grfStateBits;
DWORD reserved;
} STATSTG16;
typedef struct IStream16 *LPSTREAM16;
#define INTERFACE IStream16
DECLARE_INTERFACE_(IStream16,ISequentialStream)
{
/*** IUnknown methods ***/
STDMETHOD16_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD16_(ULONG,AddRef)(THIS) PURE;
STDMETHOD16_(ULONG,Release)(THIS) PURE;
/*** ISequentialStream methods ***/
STDMETHOD16_(HRESULT,Read)(THIS_ void* pv, ULONG cb, ULONG* pcbRead) PURE;
STDMETHOD16_(HRESULT,Write)(THIS_ const void* pv, ULONG cb, ULONG* pcbWritten) PURE;
/*** IStream16 methods ***/
STDMETHOD16(Seek)(THIS_ LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) PURE;
STDMETHOD16(SetSize)(THIS_ ULARGE_INTEGER libNewSize) PURE;
STDMETHOD16(CopyTo)(THIS_ IStream16* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) PURE;
STDMETHOD16(Commit)(THIS_ DWORD grfCommitFlags) PURE;
STDMETHOD16(Revert)(THIS) PURE;
STDMETHOD16(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE;
STDMETHOD16(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE;
STDMETHOD16(Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE;
STDMETHOD16(Clone)(THIS_ IStream16** ppstm) PURE;
};
#undef INTERFACE
/**********************************************************************/
typedef OLECHAR16 **SNB16;
typedef struct IStorage16 *LPSTORAGE16;
#define INTERFACE IStorage16
DECLARE_INTERFACE_(IStorage16,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD16_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD16_(ULONG,AddRef)(THIS) PURE;
STDMETHOD16_(ULONG,Release)(THIS) PURE;
/*** IStorage16 methods ***/
STDMETHOD16_(HRESULT,CreateStream)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream16** ppstm) PURE;
STDMETHOD16_(HRESULT,OpenStream)(THIS_ LPCOLESTR16 pwcsName, void* reserved1, DWORD grfMode, DWORD reserved2, IStream16** ppstm) PURE;
STDMETHOD16_(HRESULT,CreateStorage)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage16** ppstg) PURE;
STDMETHOD16_(HRESULT,OpenStorage)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgPriority, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16** ppstg) PURE;
STDMETHOD16_(HRESULT,CopyTo)(THIS_ DWORD ciidExclude, const IID* rgiidExclude, SNB16 snbExclude, IStorage16* pstgDest) PURE;
STDMETHOD16_(HRESULT,MoveElementTo)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgDest, LPCOLESTR16 pwcsNewName, DWORD grfFlags) PURE;
STDMETHOD16_(HRESULT,Commit)(THIS_ DWORD grfCommitFlags) PURE;
STDMETHOD16_(HRESULT,Revert)(THIS) PURE;
STDMETHOD16_(HRESULT,EnumElements)(THIS_ DWORD reserved1, void* reserved2, DWORD reserved3, IEnumSTATSTG** ppenum) PURE;
STDMETHOD16_(HRESULT,DestroyElement)(THIS_ LPCOLESTR16 pwcsName) PURE;
STDMETHOD16_(HRESULT,RenameElement)(THIS_ LPCOLESTR16 pwcsOldName, LPCOLESTR16 pwcsNewName) PURE;
STDMETHOD16_(HRESULT,SetElementTimes)(THIS_ LPCOLESTR16 pwcsName, const FILETIME* pctime, const FILETIME* patime, const FILETIME* pmtime) PURE;
STDMETHOD16_(HRESULT,SetClass)(THIS_ REFCLSID clsid) PURE;
STDMETHOD16_(HRESULT,SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask) PURE;
STDMETHOD16_(HRESULT,Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE;
};
#undef INTERFACE
#endif /* __WINE_OLE_IFS_H */

View File

@ -114,18 +114,18 @@ static void _create_istream16(LPSTREAM16 *str);
* #define DF_VTOC_FREE -1
* #define DF_NAMELEN 0x20 // Maximum entry name length - 31 characters plus
* // a NUL terminator
*
*
* #define DF_FT_STORAGE 1
* #define DF_FT_STREAM 2
* #define DF_FT_LOCKBYTES 3 // Not used -- How the bloody hell did I manage
* #define DF_FT_PROPERTY 4 // Not Used -- to figure these two out?
* #define DF_FT_ROOT 5
*
*
* #define DF_BLOCK_SIZE 0x200
* #define DF_VTOC_SIZE 0x80
* #define DF_DE_PER_BLOCK 4
* #define DF_STREAM_BLOCK_SIZE 0x40
*
*
* A DocFile is divided into blocks of 512 bytes.
* The first block contains the header.
*
@ -199,36 +199,36 @@ static void _create_istream16(LPSTREAM16 *str);
*
*
* #define TOTAL_SIMPLE_VTOCS 109
*
*
* struct DocFile_Header
* {
* df_byte iMagic1; // 0xd0
* df_byte iMagic2; // 0xcf
* df_byte iMagic3; // 0x11
* df_byte iMagic4; // 0xe0 - Spells D0CF11E0, or DocFile
* df_byte iMagic5; // 161 (igi upside down)
* df_byte iMagic6; // 177 (lli upside down - see below
* df_byte iMagic7; // 26 (gz upside down)
* df_byte iMagic8; // 225 (szz upside down) - see below
* df_byte iMagic1; // 0xd0
* df_byte iMagic2; // 0xcf
* df_byte iMagic3; // 0x11
* df_byte iMagic4; // 0xe0 - Spells D0CF11E0, or DocFile
* df_byte iMagic5; // 161 (igi upside down)
* df_byte iMagic6; // 177 (lli upside down - see below
* df_byte iMagic7; // 26 (gz upside down)
* df_byte iMagic8; // 225 (szz upside down) - see below
* df_int4 aiUnknown1[4];
* df_int4 iVersion; // DocFile Version - 0x03003E
* df_int4 iVersion; // DocFile Version - 0x03003E
* df_int4 aiUnknown2[4];
* df_int4 nVTOCs; // Number of VTOCs
* df_int4 iFirstDirBlock; // First Directory Block
* df_int4 nVTOCs; // Number of VTOCs
* df_int4 iFirstDirBlock; // First Directory Block
* df_int4 aiUnknown3[2];
* df_int4 iFirstDataVTOC; // First data VTOC block
* df_int4 iFirstDataVTOC; // First data VTOC block
* df_int4 iHasData; // 1 if there is data in the file - yes, this is important
* df_int4 iExtendedVTOC; // Extended VTOC location
* df_int4 iExtendedVTOCSize; // Size of extended VTOC (+1?)
* df_int4 iExtendedVTOC; // Extended VTOC location
* df_int4 iExtendedVTOCSize; // Size of extended VTOC (+1?)
* df_int4 aiVTOCofVTOCs[TOTAL_SIMPLE_VTOCS];
* };
*
*
* struct DocFile_VTOC
* {
* df_int4 aiBlocks[DF_VTOC_SIZE];
* };
*
*
*
*
* The meaning of the magic numbers
*
* 0xd0cf11e0 is DocFile with a zero on the end (sort of)
@ -243,27 +243,27 @@ static void _create_istream16(LPSTREAM16 *str);
* Microsoft placeholder variables, along the lines of foo, bar and baz.
* Alternatively, it could be 22526, which would be gzszz.
*
*
*
* struct DocFile_DirEnt
* {
* df_char achEntryName[DF_NAMELEN]; // Entry Name
* df_int2 iNameLen; // Name length in bytes, including NUL terminator
* df_byte iFileType; // Entry type
* df_byte iColour; // 1 = Black, 0 = Red
* df_int4 iLeftSibling; // Next Left Sibling Entry - See below
* df_int4 iRightSibling; // Next Right Sibling Entry
* df_int4 iFirstChild; // First Child Entry
* df_byte achClassID[16]; // Class ID
* df_int4 iStateBits; // [GS]etStateBits value
* df_int4 iCreatedLow; // Low DWORD of creation time
* df_int4 iCreatedHigh; // High DWORD of creation time
* df_int4 iModifiedLow; // Low DWORD of modification time
* df_int4 iModifiedHigh; // High DWORD of modification time
* df_int4 iVTOCPosition; // VTOC Position
* df_int4 iFileSize; // Size of the stream
* df_int4 iZero; // We think this is part of the 64 bit stream size - must be 0
* df_char achEntryName[DF_NAMELEN]; // Entry Name
* df_int2 iNameLen; // Name length in bytes, including NUL terminator
* df_byte iFileType; // Entry type
* df_byte iColour; // 1 = Black, 0 = Red
* df_int4 iLeftSibling; // Next Left Sibling Entry - See below
* df_int4 iRightSibling; // Next Right Sibling Entry
* df_int4 iFirstChild; // First Child Entry
* df_byte achClassID[16]; // Class ID
* df_int4 iStateBits; // [GS]etStateBits value
* df_int4 iCreatedLow; // Low DWORD of creation time
* df_int4 iCreatedHigh; // High DWORD of creation time
* df_int4 iModifiedLow; // Low DWORD of modification time
* df_int4 iModifiedHigh; // High DWORD of modification time
* df_int4 iVTOCPosition; // VTOC Position
* df_int4 iFileSize; // Size of the stream
* df_int4 iZero; // We think this is part of the 64 bit stream size - must be 0
* };
*
*
* Siblings
* ========
*
@ -364,7 +364,7 @@ STORAGE_get_big_block(stream_access16 *str,int n,BYTE *block)
DWORD args[6];
HRESULT hres;
HANDLE16 hsig;
args[0] = (DWORD)str->lockbytes; /* iface */
args[1] = (n+1)*BIGSIZE;
args[2] = 0; /* ULARGE_INTEGER offset */
@ -1094,7 +1094,7 @@ static void
_ilockbytes16_addref(SEGPTR lockbytes) {
DWORD args[1];
HRESULT hres;
args[0] = (DWORD)lockbytes; /* iface */
if (!WOWCallback16Ex(
(DWORD)((const ILockBytes16Vtbl*)MapSL(
@ -1112,7 +1112,7 @@ static void
_ilockbytes16_release(SEGPTR lockbytes) {
DWORD args[1];
HRESULT hres;
args[0] = (DWORD)lockbytes; /* iface */
if (!WOWCallback16Ex(
(DWORD)((const ILockBytes16Vtbl*)MapSL(
@ -1130,7 +1130,7 @@ static void
_ilockbytes16_flush(SEGPTR lockbytes) {
DWORD args[1];
HRESULT hres;
args[0] = (DWORD)lockbytes; /* iface */
if (!WOWCallback16Ex(
(DWORD)((const ILockBytes16Vtbl*)MapSL(
@ -2110,7 +2110,7 @@ HRESULT WINAPI StgIsStorageILockBytes16(SEGPTR plkbyt)
DWORD args[6];
HRESULT hres;
HANDLE16 hsig;
args[0] = (DWORD)plkbyt; /* iface */
args[1] = args[2] = 0; /* ULARGE_INTEGER offset */
args[3] = WOWGlobalAllocLock16( 0, 8, &hsig ); /* sig */
@ -2180,66 +2180,3 @@ HRESULT WINAPI StgOpenStorageOnILockBytes16(
}
return S_OK;
}
/***********************************************************************
* ReadClassStg (OLE2.18)
*
* This method reads the CLSID previously written to a storage object with
* the WriteClassStg.
*
* PARAMS
* pstg [I] Segmented LPSTORAGE pointer.
* pclsid [O] Pointer to where the CLSID is written
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
{
STATSTG16 statstg;
HANDLE16 hstatstg;
HRESULT hres;
DWORD args[3];
TRACE("(%x, %p)\n", pstg, pclsid);
if(pclsid==NULL)
return E_POINTER;
/*
* read a STATSTG structure (contains the clsid) from the storage
*/
args[0] = (DWORD)pstg; /* iface */
args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg );
args[2] = STATFLAG_DEFAULT;
if (!WOWCallback16Ex(
(DWORD)((const IStorage16Vtbl*)MapSL(
(SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl)
)->Stat,
WCB16_PASCAL,
3*sizeof(DWORD),
(LPVOID)args,
(LPDWORD)&hres
)) {
WOWGlobalUnlockFree16(args[1]);
ERR("CallTo16 IStorage16::Stat() failed, hres %x\n",hres);
return hres;
}
memcpy(&statstg, MapSL(args[1]), sizeof(STATSTG16));
WOWGlobalUnlockFree16(args[1]);
if(SUCCEEDED(hres)) {
*pclsid=statstg.clsid;
TRACE("clsid is %s\n", debugstr_guid(&statstg.clsid));
}
return hres;
}
/***********************************************************************
* GetConvertStg (OLE2.82)
*/
HRESULT WINAPI GetConvertStg16(LPSTORAGE stg) {
FIXME("unimplemented stub!\n");
return E_FAIL;
}