]> git.cworth.org Git - apitrace/blobdiff - winapi.py
Use the process ID as process name when /proc/self/exe can't be read.
[apitrace] / winapi.py
index 30826e3fed9a957323b370d2fed3aa67c9d28e67..3777dcbf3c8baab08f5a3818a1b64da977e91f0d 100644 (file)
--- a/winapi.py
+++ b/winapi.py
@@ -151,73 +151,3 @@ IUnknown.methods = (
 )
 
 
-class DllFunction(Function):
-
-    def get_true_pointer(self):
-        ptype = self.pointer_type()
-        pvalue = self.pointer_value()
-        print '    if(!g_hDll) {'
-        print '        g_hDll = LoadLibrary(g_szDll);'
-        print '        if(!g_hDll)'
-        self.fail_impl()
-        print '    }'
-        print '    if(!%s) {' % (pvalue,)
-        print '        %s = (%s)GetProcAddress(g_hDll, "%s");' % (pvalue, ptype, self.name)
-        print '        if(!%s)' % (pvalue,)
-        self.fail_impl()
-        print '    }'
-
-
-class Dll:
-
-    def __init__(self, name):
-        self.name = name
-        self.functions = []
-        if self not in towrap:
-            towrap.append(self)
-
-    def wrap_name(self):
-        return "Wrap" + self.name
-
-    def wrap_pre_decl(self):
-        pass
-
-    def wrap_decl(self):
-        print 'static HINSTANCE g_hDll = NULL;'
-        print 'static TCHAR g_szDll[MAX_PATH] = {0};'
-        print
-        print 'BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);'
-        print
-        for function in self.functions:
-            function.wrap_decl()
-        print
-
-    def wrap_impl(self):
-        print r'BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {'
-        print r'    switch(fdwReason) {'
-        print r'    case DLL_PROCESS_ATTACH:'
-        print r'        if(!GetSystemDirectory(g_szDll, MAX_PATH))'
-        print r'            return FALSE;'
-        print r'        _tcscat(g_szDll, TEXT("\\%s.dll"));' % self.name
-        print r'        Log::Open("%s");' % self.name
-        print r'    case DLL_THREAD_ATTACH:'
-        print r'        return TRUE;'
-        print r'    case DLL_THREAD_DETACH:'
-        print r'        return TRUE;'
-        print r'    case DLL_PROCESS_DETACH:'
-        print r'        Log::Close();'
-        print r'        if(g_hDll) {'
-        print r'            FreeLibrary(g_hDll);'
-        print r'            g_hDll = NULL;'
-        print r'        }'
-        print r'        return TRUE;'
-        print r'    }'
-        print r'    (void)hinstDLL;'
-        print r'    (void)lpvReserved;'
-        print r'    return TRUE;'
-        print r'}'
-        print
-        for function in self.functions:
-            function.wrap_impl()
-        print
-