ExReleaseRundownProtectionEx

NTSTATUS __fastcall ExReleaseRundownProtectionEx(INT64 *a1, UINT64 a2){
  signed __int64 v2; 
  bool v3; 
  signed __int64 v4; 
  unsigned __int64 v5; 

  _m_prefetchw(a1);
  v2 = *a1;
  if( (*a1 & 1) != 0 )
  {
LABEL_4:
    v5 = v2 & 0xFFFFFFFFFFFFFFFEui64;
    v4 = _InterlockedExchangeAdd64((volatile signed __int64 *)v5, -(__int64)(unsigned int)a2);
    if( v4 == (unsigned int)a2 && !_interlockedbittestandreset((volatile signed __int32 *)(v5 + 32), 0) )
      LODWORD(v4) = KeSetEvent((PRKEVENT)(v5 + 8), 0, 0);
  }
  else
  {
    while( 1 )
    {
      v4 = _InterlockedCompareExchange64(a1, v2 - (unsigned int)(2 * a2), v2);
      v3 = v2 == v4;
      v2 = v4;
      if( v3 )
        break;
      if( (v4 & 1) != 0 )
        goto LABEL_4;
    }
  }
  return v4;
}

Referenced by:

No references.