HalSetEnvironmentVariable

INT64 __fastcall HalSetEnvironmentVariable(const CHAR *a1, const CHAR *a2){
  INT64 v4; 
  INT64 v5; 
  INT64 v6; 
  unsigned __int8 v7; 
  INT64 v8; 
  INT64 v9; 
  INT64 v10; 
  unsigned __int8 v11; 
  if( HalFirmwareTypeEfi )
    return 7i64;
  if( stricmp(a1, "LastKnownGood") )
    return 16i64;
  if( stricmp(a2, "TRUE") )
  {
    if( !stricmp(a2, "FALSE") )
    {
      HalpAcquireCmosSpinLock(v9, v8, v10);
      __outbyte(0x70u, 0xBu);
      v11 = __inbyte(0x71u);
      __outbyte(0x70u, 0xBu);
      __outbyte(0x71u, v11 & 0xFE);
      goto LABEL_8;
    }
    return 16i64;
  }
  HalpAcquireCmosSpinLock(v5, v4, v6);
  __outbyte(0x70u, 0xBu);
  v7 = __inbyte(0x71u);
  __outbyte(0x70u, 0xBu);
  __outbyte(0x71u, v7 | 1);
LABEL_8:
  _InterlockedExchange(&HalpSystemHardwareLock, -1);
  if( (_BYTE)HalpSystemHardwareLockInterruptsEnabled )
    _enable();
  return 0i64;
}

Referenced by:

NtSetSystemEnvironmentValue