MmSetHardFaultBehavior
NTSTATUS __stdcall MmSetHardFaultBehavior(_ETHREAD *Thread, UINT64 SetState){
bool v2;
unsigned __int64 v4;
struct _KPRCB *CurrentPrcb;
__int64 CachedResidentAvailable;
signed __int32 v8;
v2 = (_DWORD)SetState == 0;
v4 = 26i64;
if( v2 )
{
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable == -1 )
goto LABEL_11;
if( (unsigned __int64)(CachedResidentAvailable + 26) <= 0x100 )
{
do
{
v8 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + 26,
CachedResidentAvailable);
v2 = (_DWORD)CachedResidentAvailable == v8;
LODWORD(CachedResidentAvailable) = v8;
if( v2 )
goto LABEL_8;
}
while( v8 != -1 && (unsigned __int64)(v8 + 26i64) <= 0x100 );
}
if( (int)CachedResidentAvailable > 192
&& (_DWORD)CachedResidentAvailable != -1
&& (_DWORD)CachedResidentAvailable == _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
192,
CachedResidentAvailable) )
{
v4 = (int)CachedResidentAvailable - 192 + 26i64;
}
if( v4 )
LABEL_11:
_InterlockedExchangeAdd64((_QWORD *)&stru_140C50B28 + 883, v4);
LABEL_8:
Thread->$84F33738BEE95ACDF5C5BF1C8FDC7C8C::_bf_0 &= ~4u;
KiLeaveGuardedRegionUnsafe((__int64)Thread);
return 0;
}
if( MiChargeResident((ULONG_PTR *)&Irp.Core.PartitionId, 0x1Aui64, 0x400ui64) )
{
--Thread->Tcb.SpecialApcDisable;
Thread->$84F33738BEE95ACDF5C5BF1C8FDC7C8C::_bf_0 |= 4u;
return 0;
}
return -1073741670;
}Referenced by:
SMKM_STORE::SmStWorker