+captive_Module_GetExportAddress() to access W32 modules symbols
authorshort <>
Thu, 3 Apr 2003 12:21:41 +0000 (12:21 +0000)
committershort <>
Thu, 3 Apr 2003 12:21:41 +0000 (12:21 +0000)
src/libcaptive/include/captive/ldr.h
src/libcaptive/ldr/loader.c

index e100440..bbbbcc0 100644 (file)
@@ -34,6 +34,7 @@ NTSTATUS captive_LdrpLoadAndCallImage(PMODULE_OBJECT *ModuleObjectp,PUNICODE_STR
 /* LdrLoadModule() declared in reactos includes */
 struct captive_ModuleList_patchpoint *captive_ModuleList_patchpoint_find(gconstpointer ExportAddress);
 G_CONST_RETURN gchar *captive_ModuleList_function_disable_find(gconstpointer ExportAddress);
+void *captive_Module_GetExportAddress(const gchar *ModuleName_utf8,const gchar *FunctionName);
 
 /* reactos/ntoskrnl/ldr/loader.c file-scope global declaration: */
 /* Newlines prevent their inclusion by gtk-doc. */
index aa69dd9..1cac046 100644 (file)
@@ -65,6 +65,7 @@ static void captive_ModuleList_function_disable_hash_init(void)
 
 /* reactos/ntoskrnl/ldr/loader.c file-scope global declaration: */
 NTSTATUS LdrProcessModule(PVOID ModuleLoadBase,PUNICODE_STRING ModuleName,PMODULE_OBJECT *ModuleObject);
+PVOID LdrGetExportAddress(PMODULE_OBJECT ModuleObject,char *Name,unsigned short Hint);
 
 
 /* 'ntoskrnl/ldr/loader.c' file-scoped declaration: */
@@ -623,3 +624,24 @@ G_CONST_RETURN gchar *captive_ModuleList_function_disable_find(gconstpointer Exp
 
        return g_hash_table_lookup(captive_ModuleList_function_disable_hash,ExportAddress);     /* funcname */
 }
+
+
+void *captive_Module_GetExportAddress(const gchar *ModuleName_utf8,const gchar *FunctionName)
+{
+MODULE_OBJECT *ModuleObject;
+void *r;
+
+       g_return_val_if_fail(ModuleName_utf8!=NULL,NULL);
+       g_return_val_if_fail(FunctionName!=NULL,NULL);
+
+       ModuleObject=LdrGetModuleObject(captive_utf8_to_UnicodeString_alloca(g_path_get_basename(ModuleName_utf8)));
+       g_return_val_if_fail(ModuleObject!=NULL,NULL);
+
+       r=LdrGetExportAddress(
+                       ModuleObject,   /* ModuleObject */
+                       (/* de-const */char *)FunctionName,     /* Name */
+                       -1);    /*Hint*/
+       g_return_val_if_fail(r!=NULL,NULL);
+
+       return r;
+}