wine/dlls/ntdll loader.c

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 29 10:42:01 CST 2005


ChangeSet ID:	21553
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/29 10:42:01

Modified files:
	dlls/ntdll     : loader.c 

Log message:
	Check for a valid module before attempting to read the export
	directory in LdrGetProcedureAddress.

Patch: http://cvs.winehq.org/patch.py?id=21553

Old revision  New revision  Changes     Path
 1.109         1.110         +4 -7       wine/dlls/ntdll/loader.c

Index: wine/dlls/ntdll/loader.c
diff -u -p wine/dlls/ntdll/loader.c:1.109 wine/dlls/ntdll/loader.c:1.110
--- wine/dlls/ntdll/loader.c:1.109	29 Nov 2005 16:42: 1 -0000
+++ wine/dlls/ntdll/loader.c	29 Nov 2005 16:42: 1 -0000
@@ -1181,8 +1181,10 @@ NTSTATUS WINAPI LdrGetProcedureAddress(H
 
     RtlEnterCriticalSection( &loader_section );
 
-    if ((exports = RtlImageDirectoryEntryToData( module, TRUE,
-                                                 IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size )))
+    /* check if the module itself is invalid to return the proper error */
+    if (!get_modref( module )) ret = STATUS_DLL_NOT_FOUND;
+    else if ((exports = RtlImageDirectoryEntryToData( module, TRUE,
+                                                      IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size )))
     {
         void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1 )
                           : find_ordinal_export( module, exports, exp_size, ord - exports->Base );
@@ -1192,11 +1194,6 @@ NTSTATUS WINAPI LdrGetProcedureAddress(H
             ret = STATUS_SUCCESS;
         }
     }
-    else
-    {
-        /* check if the module itself is invalid to return the proper error */
-        if (!get_modref( module )) ret = STATUS_DLL_NOT_FOUND;
-    }
 
     RtlLeaveCriticalSection( &loader_section );
     return ret;



More information about the wine-cvs mailing list