Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ntdll/loader.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 849c43b24b..c4fdd48afe 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1735,6 +1735,7 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic ) NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, ULONG ord, PVOID *address) { + WINE_MODREF *wm; IMAGE_EXPORT_DIRECTORY *exports; DWORD exp_size; NTSTATUS ret = STATUS_PROCEDURE_NOT_FOUND; @@ -1742,17 +1743,29 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, RtlEnterCriticalSection( &loader_section );
/* 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, - IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size ))) - { - LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; - void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, load_path ) - : find_ordinal_export( module, exports, exp_size, ord - exports->Base, load_path ); - if (proc) + if (!(wm = get_modref( module ))) + { + ret = STATUS_DLL_NOT_FOUND; + } + else + { + if ((exports = RtlImageDirectoryEntryToData( module, TRUE, + IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size ))) + { + const WCHAR *load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; + void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, load_path ) + : find_ordinal_export( module, exports, exp_size, ord - exports->Base, load_path ); + if (proc) + { + *address = proc; + ret = STATUS_SUCCESS; + } + } + + if (ret == STATUS_PROCEDURE_NOT_FOUND) { - *address = proc; - ret = STATUS_SUCCESS; + WARN( "function %s (ordinal %d) not found in module %s\n", + wine_dbgstr_a(name ? name->Buffer : NULL), ord, wine_dbgstr_w(wm->ldr.FullDllName.Buffer) ); } }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=75267
Your paranoid android.
=== debiant (32 bit report) ===
ntdll: om.c:2118: Test failed: got 89