winebuild fix

eric pouech eric.pouech at wanadoo.fr
Sun Sep 30 08:24:49 CDT 2001


when winebuild tried to generate delay import information for a GUI
executable, 
some function prototypes were defined twice (and with different
signatures :-( )
in the .spec.c file
this patch should take care of it (and also some mismatch when the GUI
is compiled
with STRICT turned on)

A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
-------------- next part --------------
Name: wb_dlgui
ChangeLog: fixed delay import generated code (duplicated defs with GUI exe:s)
GenDate: 2001/09/30 13:20:57 UTC
ModifiedFiles: tools/winebuild/import.c tools/winebuild/spec32.c
AddedFiles: 
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winebuild/import.c,v
retrieving revision 1.18
diff -u -u -r1.18 import.c
--- tools/winebuild/import.c	2001/05/22 19:55:51	1.18
+++ tools/winebuild/import.c	2001/09/30 09:33:36
@@ -547,8 +547,13 @@
        fprintf( outfile, "extern void __stdcall RtlRaiseException( struct exc_record * );\n" );
     }
 
-    fprintf( outfile, "extern void * __stdcall LoadLibraryA(const char*);\n");
-    fprintf( outfile, "extern void * __stdcall GetProcAddress(void *, const char*);\n");
+    fprintf( outfile, "extern unsigned __stdcall LoadLibraryA(const char*);\n");
+    /* FIXME: need the typedef. the regular form isn't recognized by gcc
+     * extern int __stdcall (* __stdcall GetProcAddress(unsigned, const char*))();
+     * so, let's pollute name space
+     */
+    fprintf( outfile, "typedef int __stdcall (*farProc)();\n" );
+    fprintf( outfile, "extern farProc __stdcall GetProcAddress(unsigned, const char*);\n" );
     fprintf( outfile, "\n" );
 
     fprintf( outfile, "void *__stdcall __wine_delay_load( int idx_nr )\n" );
@@ -559,8 +564,8 @@
     fprintf( outfile, "  const char** pINT = imd->pINT + nr;\n" );
     fprintf( outfile, "  void *fn;\n\n" );
 
-    fprintf( outfile, "  if (!*imd->phmod) *imd->phmod = LoadLibraryA(imd->szName);\n" );
-    fprintf( outfile, "  if (*imd->phmod && (fn = GetProcAddress(*imd->phmod, *pINT + 2)))\n");
+    fprintf( outfile, "  if (!*imd->phmod) *imd->phmod = (void*)LoadLibraryA(imd->szName);\n" );
+    fprintf( outfile, "  if (*imd->phmod && (fn = GetProcAddress((unsigned)*imd->phmod, *pINT + 2)))\n");
     fprintf( outfile, "    /* patch IAT with final value */\n" );
     fprintf( outfile, "    return *pIAT = fn;\n" );
     fprintf( outfile, "  else {\n");
Index: tools/winebuild/spec32.c
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.29
diff -u -u -r1.29 spec32.c
--- tools/winebuild/spec32.c	2001/06/07 22:29:03	1.29
+++ tools/winebuild/spec32.c	2001/09/30 09:29:48
@@ -509,6 +509,9 @@
     case SPEC_MODE_GUIEXE:
         if (!init_func) init_func = "WinMain";
         fprintf( outfile,
+                 "\n#ifdef STRICT\n"
+                 "   #undef STRICT\n"
+                 "#endif\n"
                  "\n#include <winbase.h>\n"
                  "int _ARGC;\n"
                  "char **_ARGV;\n"
@@ -531,6 +534,9 @@
     case SPEC_MODE_GUIEXE_UNICODE:
         if (!init_func) init_func = "WinMain";
         fprintf( outfile,
+                 "\n#ifdef STRICT\n"
+                 "   #undef STRICT\n"
+                 "#endif\n"
                  "\n#include <winbase.h>\n"
                  "int _ARGC;\n"
                  "WCHAR **_ARGV;\n"


More information about the wine-patches mailing list