- def __init__(self, dllname):
- self.dllname = dllname
-
- def header(self, api):
- print '''
-static HMODULE g_hDll = NULL;
+ def dispatchModule(self, module):
+ tag = module.name.upper()
+ print r'HMODULE g_h%sModule = NULL;' % (tag,)
+ print r''
+ print r'static PROC'
+ print r'_get%sProcAddress(LPCSTR lpProcName) {' % tag
+ print r' if (!g_h%sModule) {' % tag
+ print r' char szDll[MAX_PATH] = {0};'
+ print r' if (!GetSystemDirectoryA(szDll, MAX_PATH)) {'
+ print r' return NULL;'
+ print r' }'
+ print r' strcat(szDll, "\\\\%s.dll");' % module.name
+ print r' g_h%sModule = LoadLibraryA(szDll);' % tag
+ print r' if (!g_h%sModule) {' % tag
+ print r' return NULL;'
+ print r' }'
+ print r' }'
+ print r' return GetProcAddress(g_h%sModule, lpProcName);' % tag
+ print r'}'
+ print r''