kernel32: Return error on second attempt to free a module.
This commit is contained in:
parent
10f6d5c1fa
commit
99a0376a4f
|
@ -1003,8 +1003,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary(HINSTANCE hLibModule)
|
||||||
{
|
{
|
||||||
/* this is a LOAD_LIBRARY_AS_DATAFILE module */
|
/* this is a LOAD_LIBRARY_AS_DATAFILE module */
|
||||||
char *ptr = (char *)hLibModule - 1;
|
char *ptr = (char *)hLibModule - 1;
|
||||||
UnmapViewOfFile( ptr );
|
return UnmapViewOfFile( ptr );
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((nts = LdrUnloadDll( hLibModule )) == STATUS_SUCCESS) retv = TRUE;
|
if ((nts = LdrUnloadDll( hLibModule )) == STATUS_SUCCESS) retv = TRUE;
|
||||||
|
|
|
@ -359,6 +359,24 @@ static void testLoadLibraryEx(void)
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
||||||
broken(GetLastError() == ERROR_INVALID_HANDLE), /* nt4 */
|
broken(GetLastError() == ERROR_INVALID_HANDLE), /* nt4 */
|
||||||
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
/* Free the loaded dll when its the first time this dll is loaded
|
||||||
|
in process - First time should pass, second fail */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
hmodule = LoadLibraryExA("comctl32.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
|
||||||
|
ok(hmodule != 0, "Expected valid module handle\n");
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ok(FreeLibrary(hmodule),
|
||||||
|
"Expected to be able to free the module, failed with %d\n",
|
||||||
|
GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ok(!FreeLibrary(hmodule),
|
||||||
|
"Unexpected ability to free the module, failed with %d\n",
|
||||||
|
GetLastError());
|
||||||
|
|
||||||
|
CloseHandle(hmodule);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(module)
|
START_TEST(module)
|
||||||
|
|
Loading…
Reference in New Issue