Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/kernel32/tests/loader.c | 19 +++++++++++++++++++ dlls/ntdll/loader.c | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index ba979a26a32..5a706fadc48 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -4225,11 +4225,13 @@ static void test_loader_lock(void) BOOL blocks_on_load_in_progress_module = FALSE; BOOL blocks_on_decref_library = FALSE; HMODULE hmodule_preloaded, hmodule; + WCHAR buffer[MAX_PATH]; ULONG_PTR magic; NTSTATUS status; HANDLE thread; void *cookie; void *proc; + DWORD ret; BOOL bret;
extract_resource("locking_dll.dll", "TESTDLL", "lock.dll"); @@ -4337,6 +4339,10 @@ static void test_loader_lock(void) ok(bret, "GetModuleHandleEx failed, err %u.\n", GetLastError()); ok(hmodule == hmodule_preloaded, "Got unexpected hmodule %p, expected %p.\n", hmodule, hmodule_preloaded);
+ ret = GetModuleFileNameW(hmodule, buffer, ARRAY_SIZE(buffer)); + check_timeout(FALSE); + ok(ret, "Got zero ret.\n"); + proc = GetProcAddress(hmodule, "timeGetTime"); check_timeout(FALSE); ok(!!proc, "GetProcAddress failed.\n"); @@ -4371,6 +4377,10 @@ static void test_loader_lock(void) check_timeout(blocks_on_decref_library); ok(bret, "FreeLibrary failed, err %u.\n", GetLastError());
+ ret = GetModuleFileNameW(lock_dll_handle, buffer, ARRAY_SIZE(buffer)); + check_timeout(FALSE); + ok(ret, "Got zero ret.\n"); + if (BLOCKING_TESTS_ENABLED) { ok(!!lock_dll_handle, "Got NULL lock_dll_handle.\n"); @@ -4421,6 +4431,10 @@ static void test_loader_lock(void) ok(hmodule == hmodule_preloaded, "Got unexpected hmodule %p, expected %p.\n", hmodule, hmodule_preloaded); check_timeout(FALSE);
+ ret = GetModuleFileNameW(hmodule, buffer, ARRAY_SIZE(buffer)); + check_timeout(FALSE); + ok(ret, "Got zero ret.\n"); + proc = GetProcAddress(hmodule, "timeGetTime"); ok(!!proc, "GetProcAddress failed.\n"); check_timeout(FALSE); @@ -4454,6 +4468,11 @@ static void test_loader_lock(void) check_timeout(FALSE); ok(status == STATUS_DLL_NOT_FOUND, "Got unexpected status %#x.\n", status);
+ ret = GetModuleFileNameW(lock_dll_handle, buffer, ARRAY_SIZE(buffer)); + check_timeout(FALSE); + ok((!blocks_on_load_in_progress_module && ret) || (blocks_on_load_in_progress_module && !ret), + "Got unexpected ret %u.\n", ret); + if (BLOCKING_TESTS_ENABLED) { hmodule = GetModuleHandleW(L"lock.dll"); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index eaca55acf65..65cf618626b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3383,7 +3383,7 @@ NTSTATUS WINAPI LdrGetDllFullName( HMODULE module, UNICODE_STRING *name )
if (!module) module = NtCurrentTeb()->Peb->ImageBaseAddress;
- lock_loader_exclusive(); + lock_loader_shared(); wm = get_modref( module ); if (wm) {