user32/kernel32

Eric Pouech eric.pouech at wanadoo.fr
Sat Jan 11 11:12:33 CST 2003


Eric Pouech wrote:
> on the front on getting of include/module.h (while separating kernel32 
> from ntdll), I came across this one...
> this patch won't let user32/user call directly a 16 bit exported 
> function (NE_)DefResourceHandler
> we'll use a function pointer instead
> so, this will help in user32/kernel32 separation ;-)
> 
> A+
this time with the patch attached

-- 
Eric Pouech
-------------- next part --------------
Name:          user_ci
ChangeLog:     removed direct call to (NE_)DefResourceHandler and replaced it by a 16 bit call to krnl386.exe
License:       X11
GenDate:       2003/01/11 17:03:31 UTC
ModifiedFiles: windows/cursoricon.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/windows/cursoricon.c,v
retrieving revision 1.62
diff -u -u -r1.62 cursoricon.c
--- windows/cursoricon.c	12 Dec 2002 23:34:01 -0000	1.62
+++ windows/cursoricon.c	11 Jan 2003 15:49:00 -0000
@@ -54,7 +54,6 @@
 #include "wine/exception.h"
 #include "bitmap.h"
 #include "cursoricon.h"
-#include "module.h"
 #include "wine/debug.h"
 #include "user.h"
 #include "message.h"
@@ -96,6 +95,38 @@
 static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT("IconCrst");
 static WORD ICON_HOTSPOT = 0x4242;
 
+/* ### start build ### */
+extern WORD CALLBACK NE_CallTo16_word_www(FARPROC16,WORD,WORD,WORD);
+/* ### stop build ### */
+
+/******************************************************************
+ *		NE_DefResourceHandler
+ *
+ * Helper routine to actually call DefResourceHandler in Krnl386.exe
+ *
+ */
+static HGLOBAL16 NE_DefResourceHandler(HGLOBAL16 hg16, HMODULE16 hm16, HRSRC16 hr16)
+{
+    static HMODULE16    mh16;
+    static FARPROC16    fp16;
+
+    /* FIXME: to be completely clean, we should also test whether LoadLibrary16 and
+     * GetProcAddress16 are exported from kernel32...
+     * If not, we should also fail
+     */
+    if (!mh16 && !(mh16 = LoadLibrary16("KRNL386.EXE")))
+    {
+        FIXME("Couldn't load KRNL386.EXE\n"); 
+        return 0;
+    }
+    if (!fp16 && !(fp16 = GetProcAddress16(mh16, "DefResourceHandle")))
+    {
+        FIXME("Couldn't find address for DefResourceHandle\n"); 
+        return 0;
+    }
+
+    return NE_CallTo16_word_www(fp16, hg16, hm16, hr16);
+}
 
 /***********************************************************************
  *             map_fileW


More information about the wine-patches mailing list