Module: wine Branch: master Commit: 731306bf78f2b8a6a92448e1977268b4396eb449 URL: http://source.winehq.org/git/wine.git/?a=commit;h=731306bf78f2b8a6a92448e197...
Author: James Hawkins jhawkins@codeweavers.com Date: Tue Sep 2 01:01:59 2008 -0500
kernel32: Fix two tests that fail in win2k3 and modify LoadLibraryEx to match this behavior.
---
dlls/kernel32/module.c | 6 ++++++ dlls/kernel32/tests/module.c | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index 86675b6..1b259e5 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -922,6 +922,12 @@ HMODULE WINAPI LoadLibraryExW(LPCWSTR libnameW, HANDLE hfile, DWORD flags) UNICODE_STRING wstr; HMODULE res;
+ if (hfile) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!libnameW) { SetLastError(ERROR_INVALID_PARAMETER); diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index ca31aaf..7b602e7 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -245,13 +245,12 @@ static void testLoadLibraryEx(void) SetLastError(0xdeadbeef); hmodule = LoadLibraryExA("testfile.dll", hfile, 0); ok(hmodule == 0, "Expected 0, got %p\n", hmodule); - todo_wine - { - ok(GetLastError() == ERROR_SHARING_VIOLATION, - "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError()); - } + ok(GetLastError() == ERROR_SHARING_VIOLATION || + GetLastError() == ERROR_INVALID_PARAMETER, /* win2k3 */ + "Expected ERROR_SHARING_VIOLATION or ERROR_INVALID_PARAMETER, got %d\n", + GetLastError());
- /* has nothing to do with hFile */ + /* try to open a file that is locked */ SetLastError(0xdeadbeef); hmodule = LoadLibraryExA("testfile.dll", NULL, 0); ok(hmodule == 0, "Expected 0, got %p\n", hmodule); @@ -261,12 +260,14 @@ static void testLoadLibraryEx(void) "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError()); }
- /* one last try with hFile */ + /* lpFileName does not matter */ SetLastError(0xdeadbeef); hmodule = LoadLibraryExA(NULL, hfile, 0); ok(hmodule == 0, "Expected 0, got %p\n", hmodule); - ok(GetLastError() == ERROR_MOD_NOT_FOUND, - "Expected ERROR_MOD_NOT_FOUND, got %d\n", GetLastError()); + ok(GetLastError() == ERROR_MOD_NOT_FOUND || + GetLastError() == ERROR_INVALID_PARAMETER, /* win2k3 */ + "Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_PARAMETER, got %d\n", + GetLastError());
CloseHandle(hfile);