PATCH: 2 more ole16 functions

Marcus Meissner marcus at jet.franken.de
Sat Jul 23 12:53:25 CDT 2005


Hi,

2 more 16bit functions.

Ciao, Marcus

Changelog:
	Implemented IsValidInterface16, CoMemAlloc.
	Added debug to HGLOBALLockBytes16_QueryInterface.

Index: dlls/ole32/compobj.spec
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.spec,v
retrieving revision 1.9
diff -u -r1.9 compobj.spec
--- dlls/ole32/compobj.spec	26 Sep 2003 04:32:20 -0000	1.9
+++ dlls/ole32/compobj.spec	23 Jul 2005 17:51:46 -0000
@@ -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
Index: dlls/ole32/memlockbytes16.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/memlockbytes16.c,v
retrieving revision 1.13
diff -u -r1.13 memlockbytes16.c
--- dlls/ole32/memlockbytes16.c	22 Jul 2005 18:26:31 -0000	1.13
+++ dlls/ole32/memlockbytes16.c	23 Jul 2005 17:51:46 -0000
@@ -217,8 +217,10 @@
   /*
    * 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
Index: dlls/ole32/ole16.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole16.c,v
retrieving revision 1.18
diff -u -r1.18 ole16.c
--- dlls/ole32/ole16.c	22 Jul 2005 09:03:29 -0000	1.18
+++ dlls/ole32/ole16.c	23 Jul 2005 17:51:46 -0000
@@ -506,3 +506,18 @@
         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;
+}
Index: dlls/ole32/ole2_16.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2_16.c,v
retrieving revision 1.6
diff -u -r1.6 ole2_16.c
--- dlls/ole32/ole2_16.c	22 Jul 2005 18:29:39 -0000	1.6
+++ dlls/ole32/ole2_16.c	23 Jul 2005 17:51:46 -0000
@@ -163,6 +163,32 @@
     LPOLEINPLACEFRAME        lpFrame,
     LPOLEINPLACEACTIVEOBJECT lpActiveObject)
 {
-    FIXME("(%lx, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject);
+    FIXME("(%x, %x, %x, %p, %p), stub!\n", (unsigned int)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;
 }



More information about the wine-patches mailing list