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)
UNICODE_STRING wstr;
HMODULE res;
if (hfile)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
if (!libnameW)
{
SetLastError(ERROR_INVALID_PARAMETER);
......
......@@ -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 */
......
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