Check for a valid module before attempting to read the export
directory in LdrGetProcedureAddress.
This commit is contained in:
parent
220edd52d4
commit
4cbf118d88
|
@ -1181,8 +1181,10 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
|
|||
|
||||
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(HMODULE module, const ANSI_STRING *name,
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue