From: Jinoh Kang jinoh.kang.kr@gmail.com
This is needed to handle dynamic module dependencies generated by GetProcAddress() etc. correctly. --- dlls/ntdll/loader.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index fedeb5746b8..955fe703929 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2077,8 +2077,14 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, else 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 ) - : find_ordinal_export( module, exports, exp_size, ord - exports->Base, NULL ); + WINE_MODREF *prev; + void *proc; + + prev = current_modref; + current_modref = wm; + + proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, NULL ) + : find_ordinal_export( module, exports, exp_size, ord - exports->Base, NULL ); if (proc) { *address = proc; @@ -2089,6 +2095,8 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name, WARN( "%s (ordinal %lu) not found in %s\n", debugstr_a(name ? name->Buffer : NULL), ord, debugstr_us(&wm->ldr.FullDllName) ); } + + current_modref = prev; }
RtlLeaveCriticalSection( &loader_section );