Alexandre Julliard : kernel32: Remove the file parameter check again in LoadLibraryExW since some broken apps pass garbage here .
Alexandre Julliard
julliard at winehq.org
Tue May 26 09:24:57 CDT 2009
Module: wine
Branch: master
Commit: 2cd36b6b60e7726bb881f18b0f333ece699c8313
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2cd36b6b60e7726bb881f18b0f333ece699c8313
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue May 26 14:26:42 2009 +0200
kernel32: Remove the file parameter check again in LoadLibraryExW since some broken apps pass garbage here.
---
dlls/kernel32/module.c | 6 ------
dlls/kernel32/tests/module.c | 28 ++++++++++++++++++++++++----
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index 1b259e5..86675b6 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -922,12 +922,6 @@ 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 73d7946..374a18e 100644
--- a/dlls/kernel32/tests/module.c
+++ b/dlls/kernel32/tests/module.c
@@ -249,10 +249,24 @@ static void testLoadLibraryEx(void)
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("testfile.dll", hfile, 0);
ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
- ok(GetLastError() == ERROR_SHARING_VIOLATION ||
- GetLastError() == ERROR_INVALID_PARAMETER || /* win2k3 */
- GetLastError() == ERROR_FILE_NOT_FOUND, /* win9x */
- "Unexpected last error, got %d\n", GetLastError());
+ todo_wine
+ {
+ ok(GetLastError() == ERROR_SHARING_VIOLATION ||
+ GetLastError() == ERROR_INVALID_PARAMETER || /* win2k3 */
+ GetLastError() == ERROR_FILE_NOT_FOUND, /* win9x */
+ "Unexpected last error, got %d\n", GetLastError());
+ }
+
+ SetLastError(0xdeadbeef);
+ hmodule = LoadLibraryExA("testfile.dll", (HANDLE)0xdeadbeef, 0);
+ ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
+ todo_wine
+ {
+ ok(GetLastError() == ERROR_SHARING_VIOLATION ||
+ GetLastError() == ERROR_INVALID_PARAMETER || /* win2k3 */
+ GetLastError() == ERROR_FILE_NOT_FOUND, /* win9x */
+ "Unexpected last error, got %d\n", GetLastError());
+ }
/* try to open a file that is locked */
SetLastError(0xdeadbeef);
@@ -304,6 +318,12 @@ static void testLoadLibraryEx(void)
GetLastError() == ERROR_SUCCESS, /* win9x */
"Expected 0xdeadbeef or ERROR_SUCCESS, got %d\n", GetLastError());
+ /* try invalid file handle */
+ SetLastError(0xdeadbeef);
+ hmodule = LoadLibraryExA(path, (HANDLE)0xdeadbeef, 0);
+ if (!hmodule) /* succeeds on xp and older */
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError());
+
CloseHandle(hmodule);
/* load kernel32.dll with no path */
More information about the wine-cvs
mailing list