kernel32: Remove the file parameter check again in LoadLibraryExW since some broken apps pass garbage here.

This commit is contained in:
Alexandre Julliard 2009-05-26 14:26:42 +02:00
parent c7f01479c3
commit 2cd36b6b60
2 changed files with 24 additions and 10 deletions

View File

@ -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);

View File

@ -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 */