sub_1405B03A8

__int64 __fastcall sub_1405B03A8(__int64 a1){
  INT64 *v1; 
  _DWORD *v3; 
  _DWORD *Pool2; 
  NTSTATUS v5; 
  _ETHREAD *CurrentThread; 
  _LIST_ENTRY *Silo; 
  _RTL_QUERY_REGISTRY_TABLE QueryTable; 
  __int64 v10; 
  int v11; 
  __int64 v12; 
  __int64 v13; 
  int v14; 
  __int64 v15; 
  int v16; 

  v1 = &PspHostSiloGlobals;
  if( a1 )
    v1 = *(INT64 **)(a1 + 1272);
  v3 = 0i64;
  Pool2 = ExAllocatePool2(256i64, 0x14008ui64, 0x69534C53ui64);
  if( Pool2 && (v3 = ExAllocatePool2(256i64, 0xB7C0ui64, 0x69534C53ui64)) != 0i64 )
  {
    memset(Pool2, 0i64, 0x14000u);
    memset(v3 + 2, 0i64, 0xB7B4u);
    Pool2[20481] = 0;
    QueryTable.DefaultData = 0i64;
    v10 = 0i64;
    v11 = 0;
    v12 = 0i64;
    v13 = 0i64;
    v14 = 0;
    v15 = 0i64;
    v16 = 0;
    Pool2[20480] = 81920;
    v3[11759] = -1;
    QueryTable.QueryRoutine = (int(__fastcall *)(wchar_t *, unsigned int, void *, unsigned int, void *, void *))ExpQueryRegistryRoutine;
    *(_QWORD *)v3 = Pool2;
    QueryTable.Name = L"ProductPolicy";
    v1[113] = (INT64)v3;
    QueryTable.Flags = 256;
    QueryTable.DefaultType = 50331651;
    QueryTable.DefaultLength = 81920;
    QueryTable.EntryContext = v3;
    ExpInitLicensing((INT64)v1);
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    Silo = (_LIST_ENTRY *)CurrentThread->Silo;
    CurrentThread->Silo = (_EJOB *)a1;
    v5 = RtlQueryRegistryValuesEx(2ui64, L"ProductOptions", &QueryTable, 0i64, 0i64);
    ExInitLicenseData();
    KeGetCurrentThread()[1].WaitBlock[3].WaitListEntry.Blink = Silo;
    if( v5 >= 0 )
      return(unsigned int)v5;
  }
  else
  {
    v5 = -1073741801;
  }
  if( Pool2 )
    ExFreePoolWithTag(Pool2, 0x69534C53u);
  if( v3 )
    ExFreePoolWithTag(v3, 0x69534C53u);
  return(unsigned int)v5;
}

Referenced by:

PspInitializeServerSiloDeferred