Commit d1c14414 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- Moved 16 bit functions to a seperate file.

- First implementation for free threaded marshaller. - Fixed handling of REG_EXPAND_STRING registry values in CoCreateObject. - Fixed CoLoad/FreeLibrary functions. - Fixed use internal dll-list (used only for functions loading a dll internally without returning HMODULE).
parent c414344e
...@@ -21,12 +21,14 @@ C_SRCS = \ ...@@ -21,12 +21,14 @@ C_SRCS = \
defaulthandler.c \ defaulthandler.c \
errorinfo.c \ errorinfo.c \
filemoniker.c \ filemoniker.c \
ftmarshal.c \
hglobalstream.c \ hglobalstream.c \
ifs.c \ ifs.c \
itemmoniker.c \ itemmoniker.c \
marshal.c \ marshal.c \
memlockbytes.c \ memlockbytes.c \
moniker.c \ moniker.c \
ole16.c \
ole2.c \ ole2.c \
ole2stubs.c \ ole2stubs.c \
ole2impl.c \ ole2impl.c \
...@@ -45,4 +47,3 @@ RC_SRCS = ole32res.rc ...@@ -45,4 +47,3 @@ RC_SRCS = ole32res.rc
@MAKE_DLL_RULES@ @MAKE_DLL_RULES@
### Dependencies: ### Dependencies:
...@@ -116,4 +116,6 @@ HRESULT WINAPI RunningObjectTableImpl_UnInitialize(); ...@@ -116,4 +116,6 @@ HRESULT WINAPI RunningObjectTableImpl_UnInitialize();
/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */ /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable); int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable);
HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
#endif /* __WINE_OLE_COMPOBJ_H */ #endif /* __WINE_OLE_COMPOBJ_H */
/*
* free threaded marshaler
*
* Copyright 2002 Juergen Schmied
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "winbase.h"
#include "wine/obj_base.h"
#include "wine/obj_storage.h"
#include "wine/obj_marshal.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
typedef struct _FTMarshalImpl {
ICOM_VFIELD (IUnknown);
DWORD ref;
ICOM_VTABLE (IMarshal) * lpvtblFTM;
IUnknown *pUnkOuter;
} FTMarshalImpl;
#define _IFTMUnknown_(This)(IUnknown*)&(This->lpVtbl)
#define _IFTMarshal_(This) (IMarshal*)&(This->lpvtblFTM)
#define _IFTMarshall_Offset ((int)(&(((FTMarshalImpl*)0)->lpvtblFTM)))
#define _ICOM_THIS_From_IFTMarshal(class, name) class* This = (class*)(((char*)name)-_IFTMarshall_Offset);
/* inner IUnknown to handle aggregation */
HRESULT WINAPI IiFTMUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppv)
{
ICOM_THIS (FTMarshalImpl, iface);
TRACE ("\n");
*ppv = NULL;
if (IsEqualIID (&IID_IUnknown, riid))
*ppv = _IFTMUnknown_ (This);
else if (IsEqualIID (&IID_IMarshal, riid))
*ppv = _IFTMarshal_ (This);
else {
FIXME ("No interface for %s.\n", debugstr_guid (riid));
return E_NOINTERFACE;
}
IUnknown_AddRef ((IUnknown *) * ppv);
return S_OK;
}
ULONG WINAPI IiFTMUnknown_fnAddRef (IUnknown * iface)
{
ICOM_THIS (FTMarshalImpl, iface);
TRACE ("\n");
return InterlockedIncrement (&This->ref);
}
ULONG WINAPI IiFTMUnknown_fnRelease (IUnknown * iface)
{
ICOM_THIS (FTMarshalImpl, iface);
TRACE ("\n");
if (InterlockedDecrement (&This->ref))
return This->ref;
HeapFree (GetProcessHeap (), 0, This);
return 0;
}
static ICOM_VTABLE (IUnknown) iunkvt =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IiFTMUnknown_fnQueryInterface,
IiFTMUnknown_fnAddRef,
IiFTMUnknown_fnRelease
};
HRESULT WINAPI FTMarshalImpl_QueryInterface (LPMARSHAL iface, REFIID riid, LPVOID * ppv)
{
_ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface);
TRACE ("(%p)->(\n\tIID:\t%s,%p)\n", This, debugstr_guid (riid), ppv);
return IUnknown_QueryInterface (This->pUnkOuter, riid, ppv);
}
ULONG WINAPI FTMarshalImpl_AddRef (LPMARSHAL iface)
{
_ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface);
TRACE ("\n");
return IUnknown_AddRef (This->pUnkOuter);
}
ULONG WINAPI FTMarshalImpl_Release (LPMARSHAL iface)
{
_ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface);
TRACE ("\n");
return IUnknown_Release (This->pUnkOuter);
}
HRESULT WINAPI FTMarshalImpl_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext,
void *pvDestContext, DWORD mshlflags, CLSID * pCid)
{
FIXME ("(), stub!\n");
return S_OK;
}
HRESULT WINAPI FTMarshalImpl_GetMarshalSizeMax (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext,
void *pvDestContext, DWORD mshlflags, DWORD * pSize)
{
IMarshal *pMarshal = NULL;
HRESULT hres;
_ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface);
FIXME ("(), stub!\n");
/* if the marshaling happends inside the same process the interface pointer is
copied between the appartments */
if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) {
*pSize = sizeof (This);
return S_OK;
}
/* use the standard marshaler to handle all other cases */
CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal);
hres = IMarshal_GetMarshalSizeMax (pMarshal, riid, pv, dwDestContext, pvDestContext, mshlflags, pSize);
IMarshal_Release (pMarshal);
return hres;
return S_OK;
}
HRESULT WINAPI FTMarshalImpl_MarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void *pv,
DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
{
IMarshal *pMarshal = NULL;
HRESULT hres;
_ICOM_THIS_From_IFTMarshal (FTMarshalImpl, iface);
FIXME ("(), stub!\n");
/* if the marshaling happends inside the same process the interface pointer is
copied between the appartments */
if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) {
return IStream_Write (pStm, This, sizeof (This), 0);
}
/* use the standard marshaler to handle all other cases */
CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal);
hres = IMarshal_MarshalInterface (pMarshal, pStm, riid, pv, dwDestContext, pvDestContext, mshlflags);
IMarshal_Release (pMarshal);
return hres;
}
HRESULT WINAPI FTMarshalImpl_UnmarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void **ppv)
{
FIXME ("(), stub!\n");
return S_OK;
}
HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream * pStm)
{
FIXME ("(), stub!\n");
return S_OK;
}
HRESULT WINAPI FTMarshalImpl_DisconnectObject (LPMARSHAL iface, DWORD dwReserved)
{
FIXME ("(), stub!\n");
return S_OK;
}
ICOM_VTABLE (IMarshal) ftmvtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
FTMarshalImpl_QueryInterface,
FTMarshalImpl_AddRef,
FTMarshalImpl_Release,
FTMarshalImpl_GetUnmarshalClass,
FTMarshalImpl_GetMarshalSizeMax,
FTMarshalImpl_MarshalInterface,
FTMarshalImpl_UnmarshalInterface,
FTMarshalImpl_ReleaseMarshalData,
FTMarshalImpl_DisconnectObject
};
/***********************************************************************
* CoCreateFreeThreadedMarshaler [OLE32.5]
*
*/
HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN * ppunkMarshal)
{
FTMarshalImpl *ftm;
TRACE ("(%p %p)\n", punkOuter, ppunkMarshal);
ftm = (FTMarshalImpl *) HeapAlloc (GetProcessHeap (), 0, sizeof (FTMarshalImpl));
if (!ftm)
return E_OUTOFMEMORY;
ICOM_VTBL (ftm) = &iunkvt;
ftm->lpvtblFTM = &ftmvtbl;
ftm->ref = 1;
ftm->pUnkOuter = punkOuter;
*ppunkMarshal = _IFTMUnknown_ (ftm);
return S_OK;
}
...@@ -27,156 +27,15 @@ ...@@ -27,156 +27,15 @@
#include "ole2.h" #include "ole2.h"
#include "windef.h" #include "windef.h"
#include "winbase.h"
#include "winerror.h" #include "winerror.h"
#include "wine/obj_base.h" #include "wine/obj_base.h"
#include "wine/winbase16.h"
#include "ifs.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
/* --- IMalloc16 implementation */
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IMalloc16);
DWORD ref;
/* IMalloc16 fields */
} IMalloc16Impl;
/******************************************************************************
* IMalloc16_QueryInterface [COMPOBJ.500]
*/
HRESULT WINAPI IMalloc16_fnQueryInterface(IMalloc16* iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
) {
*obj = This;
return 0;
}
return OLE_E_ENUM_NOMORE;
}
/******************************************************************************
* IMalloc16_AddRef [COMPOBJ.501]
*/
ULONG WINAPI IMalloc16_fnAddRef(IMalloc16* iface) {
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->AddRef()\n",This);
return 1; /* cannot be freed */
}
/******************************************************************************
* IMalloc16_Release [COMPOBJ.502]
*/
ULONG WINAPI IMalloc16_fnRelease(IMalloc16* iface) {
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->Release()\n",This);
return 1; /* cannot be freed */
}
/******************************************************************************
* IMalloc16_Alloc [COMPOBJ.503]
*/
SEGPTR WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) {
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->Alloc(%ld)\n",This,cb);
return MapLS( HeapAlloc( GetProcessHeap(), 0, cb ) );
}
/******************************************************************************
* IMalloc16_Realloc [COMPOBJ.504]
*/
SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb)
{
SEGPTR ret;
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb);
ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) );
UnMapLS(pv);
return ret;
}
/******************************************************************************
* IMalloc16_Free [COMPOBJ.505]
*/
VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv)
{
void *ptr = MapSL(pv);
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->Free(%08lx)\n",This,pv);
UnMapLS(pv);
HeapFree( GetProcessHeap(), 0, ptr );
}
/******************************************************************************
* IMalloc16_GetSize [COMPOBJ.506]
*/
DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv)
{
ICOM_CTHIS(IMalloc16Impl,iface);
TRACE("(%p)->GetSize(%08lx)\n",This,pv);
return HeapSize( GetProcessHeap(), 0, MapSL(pv) );
}
/******************************************************************************
* IMalloc16_DidAlloc [COMPOBJ.507]
*/
INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) {
ICOM_CTHIS(IMalloc16,iface);
TRACE("(%p)->DidAlloc(%p)\n",This,pv);
return (INT16)-1;
}
/******************************************************************************
* IMalloc16_HeapMinimize [COMPOBJ.508]
*/
LPVOID WINAPI IMalloc16_fnHeapMinimize(IMalloc16* iface) {
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->HeapMinimize()\n",This);
return NULL;
}
/******************************************************************************
* IMalloc16_Constructor [VTABLE]
*/
LPMALLOC16
IMalloc16_Constructor()
{
static ICOM_VTABLE(IMalloc16) vt16;
static SEGPTR msegvt16;
IMalloc16Impl* This;
HMODULE16 hcomp = GetModuleHandle16("COMPOBJ");
This = HeapAlloc( GetProcessHeap(), 0, sizeof(IMalloc16Impl) );
if (!msegvt16)
{
#define VTENT(x) vt16.x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(vt16.x)
VTENT(QueryInterface);
VTENT(AddRef);
VTENT(Release);
VTENT(Alloc);
VTENT(Realloc);
VTENT(Free);
VTENT(GetSize);
VTENT(DidAlloc);
VTENT(HeapMinimize);
#undef VTENT
msegvt16 = MapLS( &vt16 );
}
ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)msegvt16;
This->ref = 1;
return (LPMALLOC16)MapLS( This );
}
/****************************************************************************** /******************************************************************************
* IMalloc32 implementation * IMalloc32 implementation
* *
......
...@@ -123,7 +123,14 @@ typedef enum tagCLSCTX ...@@ -123,7 +123,14 @@ typedef enum tagCLSCTX
CLSCTX_INPROC_HANDLER16 = 0x20, CLSCTX_INPROC_HANDLER16 = 0x20,
CLSCTX_INPROC_SERVERX86 = 0x40, CLSCTX_INPROC_SERVERX86 = 0x40,
CLSCTX_INPROC_HANDLERX86 = 0x80, CLSCTX_INPROC_HANDLERX86 = 0x80,
CLSCTX_ESERVER_HANDLER = 0x100 CLSCTX_ESERVER_HANDLER = 0x100,
CLSCTX_NO_CODE_DOWNLOAD = 0x400,
CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
CLSCTX_NO_FAILURE_LOG = 0x4000,
CLSCTX_DISABLE_AAA = 0x8000,
CLSCTX_ENABLE_AAA = 0x10000,
CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000
} CLSCTX; } CLSCTX;
#define CLSCTX_INPROC (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) #define CLSCTX_INPROC (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER)
...@@ -143,7 +150,8 @@ typedef enum tagMSHCTX ...@@ -143,7 +150,8 @@ typedef enum tagMSHCTX
MSHCTX_LOCAL = 0, MSHCTX_LOCAL = 0,
MSHCTX_NOSHAREDMEM = 1, MSHCTX_NOSHAREDMEM = 1,
MSHCTX_DIFFERENTMACHINE = 2, MSHCTX_DIFFERENTMACHINE = 2,
MSHCTX_INPROC = 3 MSHCTX_INPROC = 3,
MSHCTX_CROSSCTX = 4
} MSHCTX; } MSHCTX;
typedef unsigned short VARTYPE; typedef unsigned short VARTYPE;
......
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