Module: wine Branch: master Commit: 2ab000267488076ce0c0c9e018e57ec5294f640b URL: http://source.winehq.org/git/wine.git/?a=commit;h=2ab000267488076ce0c0c9e018...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Nov 22 18:12:56 2013 +0400
kernel32/tests: Test for LoadLibraryEx() with full path without extension.
---
dlls/kernel32/tests/module.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index 992f0ec..0d140a4 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -348,7 +348,7 @@ static void testLoadLibraryEx(void) if (!hmodule) /* succeeds on xp and older */ ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError());
- CloseHandle(hmodule); + FreeLibrary(hmodule);
/* load kernel32.dll with no path */ SetLastError(0xdeadbeef); @@ -358,7 +358,7 @@ static void testLoadLibraryEx(void) GetLastError() == ERROR_SUCCESS, /* win9x */ "Expected 0xdeadbeef or ERROR_SUCCESS, got %d\n", GetLastError());
- CloseHandle(hmodule); + FreeLibrary(hmodule);
GetCurrentDirectoryA(MAX_PATH, path); if (path[lstrlenA(path) - 1] != '\') @@ -376,7 +376,7 @@ static void testLoadLibraryEx(void) broken(GetLastError() == ERROR_INVALID_HANDLE), /* nt4 */ "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
- /* Free the loaded dll when its the first time this dll is loaded + /* Free the loaded dll when it's the first time this dll is loaded in process - First time should pass, second fail */ SetLastError(0xdeadbeef); hmodule = LoadLibraryExA("comctl32.dll", NULL, LOAD_LIBRARY_AS_DATAFILE); @@ -389,8 +389,19 @@ static void testLoadLibraryEx(void) ret = FreeLibrary(hmodule); ok(!ret, "Unexpected ability to free the module, failed with %d\n", GetLastError());
- CloseHandle(hmodule); - + /* load with full path, name without extension */ + GetSystemDirectoryA(path, MAX_PATH); + if (path[lstrlenA(path) - 1] != '\') + lstrcatA(path, "\"); + lstrcatA(path, "kernel32"); + hmodule = LoadLibraryExA(path, NULL, 0); + ok(hmodule != NULL, "got %p\n", hmodule); + FreeLibrary(hmodule); + + /* same with alterate search path */ + hmodule = LoadLibraryExA(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + ok(hmodule != NULL, "got %p\n", hmodule); + FreeLibrary(hmodule); }
static void testGetDllDirectory(void)