Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/ntdll/loader.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 37323608c3a..436491921c6 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2069,22 +2069,22 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic ) return STATUS_SUCCESS; }
- /****************************************************************** - * LdrGetProcedureAddress (NTDLL.@) + * get_procedure_address + * + * Helper for LdrGetProcedureAddress(). */ -NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, - ULONG ord, PVOID *address) + +NTSTATUS get_procedure_address( HMODULE module, const ANSI_STRING *name, + ULONG ord, void **address ) { IMAGE_EXPORT_DIRECTORY *exports; DWORD exp_size; - NTSTATUS ret = STATUS_PROCEDURE_NOT_FOUND; - - lock_loader_exclusive();
/* check if the module itself is invalid to return the proper error */ - if (!get_modref( module )) ret = STATUS_DLL_NOT_FOUND; - else if ((exports = RtlImageDirectoryEntryToData( module, TRUE, + if (!get_modref( module )) return STATUS_DLL_NOT_FOUND; + + if ((exports = RtlImageDirectoryEntryToData( module, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size ))) { void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, NULL ) @@ -2092,10 +2092,22 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, if (proc) { *address = proc; - ret = STATUS_SUCCESS; + return STATUS_SUCCESS; } } + return STATUS_PROCEDURE_NOT_FOUND; +} + +/****************************************************************** + * LdrGetProcedureAddress (NTDLL.@) + */ +NTSTATUS WINAPI LdrGetProcedureAddress( HMODULE module, const ANSI_STRING *name, + ULONG ord, PVOID *address ) +{ + NTSTATUS ret;
+ lock_loader_exclusive(); + ret = get_procedure_address( module, name, ord, address ); unlock_loader(); return ret; }