Index: rundll32.c
===================================================================
RCS file: /home/wine/wine/programs/rundll32/rundll32.c,v
retrieving revision 1.7
diff -u -r1.7 rundll32.c
--- rundll32.c	3 Dec 2003 20:29:24 -0000	1.7
+++ rundll32.c	9 Jan 2004 17:28:20 -0000
@@ -4,6 +4,7 @@
  * Copyright 2002 Alberto Massari
  * Copyright 2001-2003 Aric Stewart for CodeWeavers
  * Copyright 2003 Mike McCormack for CodeWeavers
+ * Copyright 2004 Steven Edwards for ReactOS
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -42,6 +43,9 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(rundll32);
 
+HINSTANCE16 (WINAPI *pLoadLibrary16)(LPCSTR libname)=NULL;
+FARPROC16 (WINAPI *pGetProcAddress16)(HMODULE16 hModule, LPCSTR name)=NULL;
+void (WINAPI *pRunDLL_CallEntry16)(DWORD, HWND, HINSTANCE, LPCSTR, INT)=NULL;
 
 extern void WINAPI RunDLL_CallEntry16( FARPROC proc, HWND hwnd, HINSTANCE inst,
                                        LPCSTR cmdline, INT cmdshow );
@@ -82,24 +86,49 @@
 
 static HINSTANCE16 load_dll16( LPCWSTR dll )
 {
+    HMODULE hModule;        /* On Mingw we dont support Win16 */
     HINSTANCE16 ret;
     DWORD len = WideCharToMultiByte( CP_ACP, 0, dll, -1, NULL, 0, NULL, NULL );
     char *dllA = HeapAlloc( GetProcessHeap(), 0, len );
     WideCharToMultiByte( CP_ACP, 0, dll, -1, dllA, len, NULL, NULL );
-    ret = LoadLibrary16( dllA );
-    HeapFree( GetProcessHeap(), 0, dllA );
-    return ret;
+
+    hModule = GetModuleHandleA("KERNEL32.DLL"); 
+        if (hModule)
+        {
+            pLoadLibrary16=(void*)GetProcAddress(hModule,"LoadLibrary16");
+            if (pLoadLibrary16){
+                ret = pLoadLibrary16( dllA );
+                HeapFree( GetProcessHeap(), 0, dllA );
+                return ret;
+            }else{
+                WINE_ERR("Couldnt load LoadLibrary16 from Kernel32.dll!\n");
+                ret = -1;
+            }
+        }
+        return ret;
 }
 
 static FARPROC16 get_entry_point16( HINSTANCE16 inst, LPCWSTR entry )
 {
+    HMODULE hModule;        /* On Mingw we dont support Win16 */
     FARPROC16 ret;
     DWORD len = WideCharToMultiByte( CP_ACP, 0, entry, -1, NULL, 0, NULL, NULL );
     char *entryA = HeapAlloc( GetProcessHeap(), 0, len );
     WideCharToMultiByte( CP_ACP, 0, entry, -1, entryA, len, NULL, NULL );
-    ret = GetProcAddress16( inst, entryA );
-    HeapFree( GetProcessHeap(), 0, entryA );
-    return ret;
+
+    hModule = GetModuleHandleA("KERNEL32.DLL"); 
+        if (hModule)
+        {
+            pGetProcAddress16=(void*)GetProcAddress(hModule,"GetProcAddress16");
+            if (pGetProcAddress16){
+                ret = pGetProcAddress16( inst, entryA );
+                HeapFree( GetProcessHeap(), 0, entryA );
+            }else{
+                WINE_ERR("Couldnt load GetProcAddress16 from Kernel32.dll!\n");
+                ret = NULL;
+            }
+        }
+        return ret;
 }
 
 static void *get_entry_point32( HMODULE module, LPCWSTR entry, BOOL *unicode )
@@ -295,7 +324,21 @@
         WINE_TRACE( "Calling %s (%p,%p,%s,%d)\n", wine_dbgstr_w(szEntryPoint),
                     hWnd, instance, wine_dbgstr_a(cmdline), info.wShowWindow );
 
-        if (win16) RunDLL_CallEntry16( entry_point, hWnd, instance, cmdline, info.wShowWindow );
+        if (win16) 
+        {        
+            HMODULE hModule;        /* On Mingw we dont support Win16 */
+            hModule = GetModuleHandleA("SHELL32.DLL"); 
+            if (hModule)
+            {
+                pRunDLL_CallEntry16=(void*)GetProcAddress(hModule,"RunDLL_CallEntry16");
+                if (pRunDLL_CallEntry16){
+                    pRunDLL_CallEntry16( entry_point, hWnd, instance, cmdline, info.wShowWindow );
+                }else{
+                    WINE_ERR( "Couldnt load RunDLL_CallEntry16 from shell32.dll!\n" );
+                    return 0;
+                }
+            }
+        }
         else
         {
             EntryPointA pEntryPointA = entry_point;
