]> git.cworth.org Git - apitrace/commitdiff
Don't force using system librarie on retrace.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 20 Apr 2012 20:05:15 +0000 (21:05 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Fri, 20 Apr 2012 20:05:15 +0000 (21:05 +0100)
retrace/dllretrace.py

index db1a5863390ce206b704287d44481cd41016d40b..abcd2028b98b2d7b308e20501a1bf74481a9e069 100644 (file)
@@ -31,23 +31,18 @@ from dispatch import Dispatcher
 class DllRetracer(Retracer):
 
     def retraceApi(self, api):
-        print '''
+        print r'''
+static LPCSTR g_szDll = "%s";
 static HMODULE g_hDll = NULL;
 
 static PROC
 _getPublicProcAddress(LPCSTR lpProcName)
 {
     if (!g_hDll) {
-        char szDll[MAX_PATH] = {0};
-        
-        if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
-            return NULL;
-        }
-        
-        strcat(szDll, "\\\\%s");
-        
-        g_hDll = LoadLibraryA(szDll);
+        g_hDll = LoadLibraryA(g_szDll);
         if (!g_hDll) {
+            os::log("error: failed to load %%s\n", g_szDll);
+            exit(1);
             return NULL;
         }
     }
@@ -55,7 +50,7 @@ _getPublicProcAddress(LPCSTR lpProcName)
     return GetProcAddress(g_hDll, lpProcName);
 }
 
-''' % api.name
+''' % api.name.upper()
 
         dispatcher = Dispatcher()
         dispatcher.dispatch_api(api)