[ros-diffs] [rharabien] 51104: Set last error to ERROR_PROC_NOT_FOUND in case of NULL module in GetProcAddress Check for error when freeing datafile Fixes 2 winetests

rharabien at svn.reactos.org rharabien at svn.reactos.org
Mon Mar 21 14:16:01 UTC 2011


Author: rharabien
Date: Mon Mar 21 14:16:01 2011
New Revision: 51104

URL: http://svn.reactos.org/svn/reactos?rev=51104&view=rev
Log:
Set last error to ERROR_PROC_NOT_FOUND in case of NULL module in GetProcAddress
Check for error when freeing datafile
Fixes 2 winetests

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/ldr.c?rev=51104&r1=51103&r2=51104&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] Mon Mar 21 14:16:01 2011
@@ -310,6 +310,12 @@
 	FARPROC fnExp = NULL;
 	NTSTATUS Status;
 
+	if (!hModule)
+	{
+		SetLastError(ERROR_PROC_NOT_FOUND);
+		return NULL;
+	}
+
 	if (HIWORD(lpProcName) != 0)
 	{
 		RtlInitAnsiString (&ProcedureName,
@@ -354,8 +360,7 @@
     {
         /* this is a LOAD_LIBRARY_AS_DATAFILE module */
         char *ptr = (char *)hLibModule - 1;
-        UnmapViewOfFile(ptr);
-        return TRUE;
+        return UnmapViewOfFile(ptr);
     }
 
     Status = LdrUnloadDll(hLibModule);




More information about the Ros-diffs mailing list