winewrap: simplify wrapper

Dimitrie O. Paun dpaun at rogers.com
Wed Apr 9 01:27:26 CDT 2003


To match patch:
     http://www.winehq.com/hypermail/wine-cvs/2003/04/0082.html

ChangeLog
  We don't need to dlopen the app module before the LoadLibrary().

Index: tools/winewrap.c
===================================================================
RCS file: /var/cvs/wine/tools/winewrap.c,v
retrieving revision 1.14
diff -u -r1.14 winewrap.c
--- tools/winewrap.c	2 Apr 2003 22:36:29 -0000	1.14
+++ tools/winewrap.c	9 Apr 2003 06:24:24 -0000
@@ -173,33 +173,15 @@
     "int WINAPI main(int argc, char** argv, char** envp)\n"
     "#endif\n"
     "{\n"
-    "    void* appLibrary;\n"
     "    HINSTANCE hApp = 0, hMFC = 0, hMain = 0;\n"
     "    void* appMain;\n"
-    "    char* libName;\n"
     "    int retcode;\n"
     "\n"
-    "    /* Load the application's library */\n"
-    "    libName=(char*)malloc(2+strlen(appName)+3+1);\n"
-    "    /* FIXME: we should get the wrapper's path and use that as the base for\n"
-    "     * the library\n"
-    "     */\n"
-    "    sprintf(libName,\"./%%s.so\",appName);\n"
-    "    appLibrary=dlopen(libName,RTLD_NOW);\n"
-    "    if (appLibrary==NULL) {\n"
-    "        sprintf(libName,\"%%s.so\",appName);\n"
-    "        appLibrary=dlopen(libName,RTLD_NOW);\n"
-    "    }\n"
-    "    if (!appLibrary) error(\"Could not load the %%s library: %%s\", libName, dlerror());\n"
-    "\n"
     "    /* Then if this application is MFC based, load the MFC module */\n"
-    "    /* FIXME: I'm not sure this is really necessary */\n"
     "    if (mfcModule) {\n"
     "        hMFC = LoadLibrary(mfcModule);\n"
     "        if (!hMFC) error(\"Could not load the MFC module %%s (%%d)\", mfcModule, GetLastError());\n"
-    "        /* MFC is a special case: the WinMain is in the MFC library,\n"
-    "         * instead of the application's library.\n"
-    "         */\n"
+    "        /* For MFC apps, WinMain is in the MFC library */\n"
     "        hMain = hMFC;\n"
     "    }\n"
     "\n"
@@ -223,8 +205,6 @@
     "    /* Cleanup and done */\n"
     "    FreeLibrary(hApp);\n"
     "    FreeLibrary(hMFC);\n"
-    "    dlclose(appLibrary);\n"
-    "    free(libName);\n"
     "\n"
     "    return retcode;\n"
     "}\n"



-- 
Dimi.




More information about the wine-patches mailing list