From c5feb317b309913bb8f11f30fe559a641e79bf74 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 24 Jul 2005 16:15:24 +0000 Subject: [PATCH] Implemented IsValidInterface16, CoMemAlloc. Added debug to HGLOBALLockBytes16_QueryInterface. --- dlls/ole32/compobj.spec | 4 ++-- dlls/ole32/memlockbytes16.c | 4 +++- dlls/ole32/ole16.c | 15 +++++++++++++++ dlls/ole32/ole2_16.c | 28 +++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/dlls/ole32/compobj.spec b/dlls/ole32/compobj.spec index 90425a0a6e7..f218cceefb1 100644 --- a/dlls/ole32/compobj.spec +++ b/dlls/ole32/compobj.spec @@ -20,7 +20,7 @@ 20 pascal CLSIDFromString(str ptr) CLSIDFromString16 21 stub ISVALIDPTRIN 22 stub ISVALIDPTROUT -23 stub ISVALIDINTERFACE +23 pascal IsValidInterface(segptr) IsValidInterface16 24 stub ISVALIDIID 25 stub RESULTFROMSCODE 26 stub GETSCODE @@ -147,7 +147,7 @@ 148 stub MKVDEFAULTHASHKEY 149 stub DELETE16 150 stub COMEMCTXOF -151 stub COMEMALLOC +151 pascal CoMemAlloc(long long long) 152 stub COMEMFREE 153 stub SHRREALLOC 154 stub ___EXPORTEDSTUB diff --git a/dlls/ole32/memlockbytes16.c b/dlls/ole32/memlockbytes16.c index d55db4ecfb6..d2c65989c7a 100644 --- a/dlls/ole32/memlockbytes16.c +++ b/dlls/ole32/memlockbytes16.c @@ -217,8 +217,10 @@ HRESULT HGLOBALLockBytesImpl16_QueryInterface( /* * Check that we obtained an interface. */ - if ((*ppvObject)==0) + if ((*ppvObject)==0) { + FIXME("Unknown IID %s\n", debugstr_guid(riid)); return E_NOINTERFACE; + } /* * Query Interface always increases the reference count by one when it is diff --git a/dlls/ole32/ole16.c b/dlls/ole32/ole16.c index d102c6ec1e0..7536d3f5ed0 100644 --- a/dlls/ole32/ole16.c +++ b/dlls/ole32/ole16.c @@ -506,3 +506,18 @@ BOOL WINAPI COMPOBJ_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD TRACE("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, res1, res2); return TRUE; } + +/*********************************************************************** + * CoMemAlloc [COMPOBJ.151] + */ +SEGPTR WINAPI CoMemAlloc(DWORD size, DWORD dwMemContext, DWORD x) { + HRESULT hres; + SEGPTR segptr; + + /* FIXME: check context handling */ + TRACE("(%ld, 0x%08lx, 0x%08lx)\n", size, dwMemContext, x); + hres = _xmalloc16(size, &segptr); + if (hres != S_OK) + return (SEGPTR)0; + return segptr; +} diff --git a/dlls/ole32/ole2_16.c b/dlls/ole32/ole2_16.c index ad341d3c484..77c1d28b95b 100644 --- a/dlls/ole32/ole2_16.c +++ b/dlls/ole32/ole2_16.c @@ -163,6 +163,32 @@ HRESULT WINAPI OleSetMenuDescriptor16( LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject) { - FIXME("(%lx, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject); + FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject); return E_NOTIMPL; } + +/****************************************************************************** + * IsValidInterface [COMPOBJ.23] + * + * Determines whether a pointer is a valid interface. + * + * PARAMS + * punk [I] Interface to be tested. + * + * RETURNS + * TRUE, if the passed pointer is a valid interface, or FALSE otherwise. + */ +BOOL WINAPI IsValidInterface16(SEGPTR punk) +{ + DWORD **ptr; + + if (IsBadReadPtr16(punk,4)) + return FALSE; + ptr = MapSL(punk); + if (IsBadReadPtr16((SEGPTR)ptr[0],4)) /* check vtable ptr */ + return FALSE; + ptr = MapSL((SEGPTR)ptr[0]); /* ptr to first method */ + if (IsBadReadPtr16((SEGPTR)ptr[0],2)) + return FALSE; + return TRUE; +} -- 2.11.4.GIT