WheapCommitPolicy

NTSTATUS __stdcall WheapCommitPolicy(){
  int RegistryKey; 
  char v1; 
  _BYTE *v2; 
  unsigned int v3; 
  wchar_t **v4; 
  UINT64 ValueLength; 

  RegistryKey = RtlCheckRegistryKey(2ui64, (PWCHAR)L"WHEA\\Policy");
  if( RegistryKey < 0 )
  {
    RegistryKey = RtlCreateRegistryKey(2u, (PWSTR)L"WHEA");
    if( RegistryKey >= 0 )
      RegistryKey = RtlCreateRegistryKey(2u, (PWSTR)L"WHEA\\Policy");
  }
  if( RegistryKey >= 0 )
  {
    v1 = 0;
    v2 = WheaRegPolicyTableChanged;
    v3 = 0;
    v4 = &WheaRegPolicyTable;
    while( 1 )
    {
      if( *v2 )
      {
        LODWORD(ValueLength) = 4;
        v1 = 1;
        RegistryKey = RtlWriteRegistryValue(2ui64, L"WHEA\\Policy", *v4, 4ui64, v4[1], ValueLength);
        if( RegistryKey < 0 )
          break;
      }
      ++v3;
      ++v2;
      v4 += 3;
      if( v3 >= 0xD )
      {
        if( RegistryKey >= 0 && v1 )
          WheapPfaReset();
        break;
      }
    }
    WheapLogPolicyTelemetry();
  }
  return RegistryKey;
}

Referenced by:

WheapWmiExecutePolicyManagementMethod