SepSetSystemPaths

NTSTATUS __stdcall SepSetSystemPaths(){
  __int64 v0; 
  __int64 v1; 
  NTSTATUS v2; 
  _KSPIN_LOCK *v3; 
  UINT64 v4; 
  VOID **PoolWithTag; 
  signed __int64 v6; 
  const wchar_t *v7; 
  WCHAR *v8; 
  void *v9; 

  v1 = v0;
  v2 = 0;
  SepLoadNgenLocations();
  v4 = PsGetCurrentServerSiloGlobals(v3)->NtSystemRoot.Length + 30i64;
  PoolWithTag = ExAllocatePoolWithTag(1ui64, 2 * v4 + 48, 1668499779i64);
  v6 = (signed __int64)PoolWithTag;
  if( !PoolWithTag )
    return -1073741801;
  v7 = (const wchar_t *)(PoolWithTag + 6);
  RtlStringCbPrintfW((WCHAR *)PoolWithTag + 24, v4, (WCHAR *)L"\\??\\%ws\\System32\\");
  RtlInitUnicodeString((PUNICODE_STRING)v6, v7);
  v8 = (WCHAR *)&v7[v4 >> 1];
  RtlStringCbPrintfW(v8, v4, (WCHAR *)L"\\??\\%ws\\SysWOW64\\");
  RtlInitUnicodeString((PUNICODE_STRING)(v6 + 16), v8);
  *(_OWORD *)(v6 + 32) = *(_OWORD *)v6;
  *(_WORD *)(v6 + 32) = 12;
  v9 = (void *)(v6 & -(__int64)(_InterlockedCompareExchange64((volatile signed __int64 *)(v1 + 32), v6, 0i64) != 0));
  if( v9 )
    ExFreePoolWithTag(v9, 0x63734943u);
  return v2;
}

Referenced by:

SepIsMinTCB