WheapSetPolicyValue

NTSTATUS __stdcall WheapSetPolicyValue(UINT64 Type, UINT64 *Value){
  unsigned int v2; 
  __int64 v3; 
  int *v4; 
  int v5; 
  int v6; 
  int v7; 
  int v8; 
  int v9; 
  bool v10; 
  int v11; 
  int v12; 
  int v13; 
  int v14; 
  int v15; 
  int v16; 

  if( (unsigned int)Type < 0xD )
  {
    v2 = *(_DWORD *)Value;
    v3 = (unsigned int)Type;
    if( *(_DWORD *)Value >= (unsigned int)dword_1409850E0[6 * (unsigned int)Type]
      && v2 <= dword_1409850E4[6 * (unsigned int)Type] )
    {
      _mm_lfence();
      v4 = (&off_1409850D8)[3 * (unsigned int)Type];
      if( *v4 == -1 )
      {
        if( (unsigned int)Type > 6 )
        {
          v12 = Type - 7;
          if( v12 )
          {
            v13 = v12 - 1;
            if( v13 )
            {
              v14 = v13 - 1;
              if( v14 )
              {
                v15 = v14 - 1;
                if( v15 )
                {
                  v16 = v15 - 1;
                  if( v16 )
                  {
                    if( v16 != 1 )
                      goto LABEL_36;
                    v10 = v2 == WheapRegPolicyCmciThresholdPollCount;
                  }
                  else
                  {
                    v10 = v2 == WheapRegPolicyCmciThresholdTime;
                  }
                }
                else
                {
                  v10 = v2 == WheapRegPolicyCmciThresholdCount;
                }
              }
              else
              {
                v10 = v2 == WheapRegPolicyRestoreCmciErrorLimit;
              }
            }
            else
            {
              v10 = v2 == WheapRegPolicyRestoreCmciMaxAttempts;
            }
          }
          else
          {
            v10 = v2 == WheapRegPolicyRestoreCmciEnabled;
          }
          goto LABEL_34;
        }
        if( (_DWORD)Type == 6 )
        {
          v10 = v2 == WheaRegPolicyIgnoreDummyWrite;
          goto LABEL_34;
        }
        v5 = 0;
        if( (_DWORD)Type )
        {
          v6 = Type - 1;
          if( v6 )
          {
            v7 = v6 - 1;
            if( v7 )
            {
              v8 = v7 - 1;
              if( v8 )
              {
                v9 = v8 - 1;
                if( v9 )
                {
                  if( v9 != 1 )
                    goto LABEL_36;
                  v10 = v2 == (unsigned int)(WheapPolicyMemPfaTimeout / 0x989680ui64);
                }
                else
                {
                  v10 = v2 == WheapPolicyMemPfaThreshold;
                }
              }
              else
              {
                v10 = v2 == WheapPolicyMemPfaPageCount;
              }
LABEL_34:
              if( v10 )
                return 0;
LABEL_36:
              *v4 = v2;
              WheaRegPolicyTableChanged[v3] = 1;
              return 0;
            }
            v11 = (unsigned __int8)WheapPolicyMemPfaDisable;
          }
          else
          {
            v11 = *(&WheapErrorSourceTable + 58);
          }
        }
        else
        {
          v11 = (unsigned __int8)WheapPolicyDisableOffline;
        }
        LOBYTE(v5) = v2 != 0;
        v10 = v5 == v11;
        goto LABEL_34;
      }
      v10 = *v4 == v2;
      goto LABEL_34;
    }
  }
  return -1073741811;
}

Referenced by:

WheapWmiExecutePolicyManagementMethod