Commit 2cd36b6b authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Remove the file parameter check again in LoadLibraryExW since some…

kernel32: Remove the file parameter check again in LoadLibraryExW since some broken apps pass garbage here.
parent c7f01479
...@@ -922,12 +922,6 @@ HMODULE WINAPI LoadLibraryExW(LPCWSTR libnameW, HANDLE hfile, DWORD flags) ...@@ -922,12 +922,6 @@ HMODULE WINAPI LoadLibraryExW(LPCWSTR libnameW, HANDLE hfile, DWORD flags)
UNICODE_STRING wstr; UNICODE_STRING wstr;
HMODULE res; HMODULE res;
if (hfile)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
if (!libnameW) if (!libnameW)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
......
...@@ -249,10 +249,24 @@ static void testLoadLibraryEx(void) ...@@ -249,10 +249,24 @@ static void testLoadLibraryEx(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("testfile.dll", hfile, 0); hmodule = LoadLibraryExA("testfile.dll", hfile, 0);
ok(hmodule == 0, "Expected 0, got %p\n", hmodule); ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
ok(GetLastError() == ERROR_SHARING_VIOLATION || todo_wine
GetLastError() == ERROR_INVALID_PARAMETER || /* win2k3 */ {
GetLastError() == ERROR_FILE_NOT_FOUND, /* win9x */ ok(GetLastError() == ERROR_SHARING_VIOLATION ||
"Unexpected last error, got %d\n", GetLastError()); 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 */ /* try to open a file that is locked */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -304,6 +318,12 @@ static void testLoadLibraryEx(void) ...@@ -304,6 +318,12 @@ static void testLoadLibraryEx(void)
GetLastError() == ERROR_SUCCESS, /* win9x */ GetLastError() == ERROR_SUCCESS, /* win9x */
"Expected 0xdeadbeef or ERROR_SUCCESS, got %d\n", GetLastError()); "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); CloseHandle(hmodule);
/* load kernel32.dll with no path */ /* load kernel32.dll with no path */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment