mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 19:26:16 +00:00
- Sync FreeLibrary with Wine. Fixes an exception at installation Firefox 3.5.x
svn path=/trunk/; revision=42385
This commit is contained in:
@@ -340,28 +340,25 @@ GetProcAddress( HMODULE hModule, LPCSTR lpProcName )
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
FreeLibrary( HMODULE hLibModule )
|
||||
BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
|
||||
{
|
||||
PVOID Module = (PVOID)((ULONG_PTR)hLibModule & ~1);
|
||||
NTSTATUS Status;
|
||||
|
||||
if (!hLibModule)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((ULONG_PTR)hLibModule & 1)
|
||||
{
|
||||
if (!RtlImageNtHeader(Module))
|
||||
{
|
||||
SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = NtUnmapViewOfSection(NtCurrentProcess(), Module);
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = LdrUnloadDll(hLibModule);
|
||||
/* this is a LOAD_LIBRARY_AS_DATAFILE module */
|
||||
char *ptr = (char *)hLibModule - 1;
|
||||
UnmapViewOfFile(ptr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Status = LdrUnloadDll(hLibModule);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
|
||||
Reference in New Issue
Block a user