Author: dchapyshev
Date: Tue Aug 4 18:43:37 2009
New Revision: 42385
URL:
http://svn.reactos.org/svn/reactos?rev=42385&view=rev
Log:
- Sync FreeLibrary with Wine. Fixes an exception at installation Firefox 3.5.x
Modified:
trunk/reactos/dll/win32/kernel32/misc/ldr.c
Modified: trunk/reactos/dll/win32/kernel32/misc/ldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/ld…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] Tue Aug 4 18:43:37 2009
@@ -340,28 +340,25 @@
/*
* @implemented
*/
-BOOL
-WINAPI
-FreeLibrary( HMODULE hLibModule )
-{
- PVOID Module = (PVOID)((ULONG_PTR)hLibModule & ~1);
+BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
+{
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);