From c8713bf71b60d26f32193be65fc9abb9a89a6a96 Mon Sep 17 00:00:00 2001 From: short <> Date: Thu, 3 Apr 2003 12:21:41 +0000 Subject: [PATCH] +captive_Module_GetExportAddress() to access W32 modules symbols --- src/libcaptive/include/captive/ldr.h | 1 + src/libcaptive/ldr/loader.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/libcaptive/include/captive/ldr.h b/src/libcaptive/include/captive/ldr.h index e100440..bbbbcc0 100644 --- a/src/libcaptive/include/captive/ldr.h +++ b/src/libcaptive/include/captive/ldr.h @@ -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. */ diff --git a/src/libcaptive/ldr/loader.c b/src/libcaptive/ldr/loader.c index aa69dd9..1cac046 100644 --- a/src/libcaptive/ldr/loader.c +++ b/src/libcaptive/ldr/loader.c @@ -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; +} -- 1.8.3.1