LdrpFetchAddressOfSecurityCookie
VOID *__fastcall LdrpFetchAddressOfSecurityCookie(
VOID *ModuleBase,
UINT64 SizeOfImage,
UINT64 *ReprotectSection,
_IMAGE_LOAD_CONFIG_DIRECTORY64 **LoadConfigDir){
__int64 v5;
_IMAGE_LOAD_CONFIG_DIRECTORY64 *v8;
char *SecurityCookie;
IMAGE_NT_HEADERS *v11;
v5 = (unsigned int)SizeOfImage;
RtlImageNtHeaderEx(1ui64, ModuleBase, 0i64, &v11);
LODWORD(v8) = LdrImageDirectoryEntryToLoadConfig(ModuleBase);
*(_DWORD *)ReprotectSection = 0;
if( v8
&& v8->Size >= 0x70
&& (SecurityCookie = (char *)v8->SecurityCookie, SecurityCookie > ModuleBase)
&& SecurityCookie < (char *)ModuleBase + v5 - 8 )
{
if( LoadConfigDir )
*LoadConfigDir = v8;
return SecurityCookie;
}
else
{
if( LoadConfigDir )
{
if( v8 && v8->Size >= 4 )
*LoadConfigDir = v8;
else
*LoadConfigDir = 0i64;
}
return 0i64;
}
}Referenced by:
LdrInitSecurityCookie