PspSiloInitializeSystemRootSymlink

NTSTATUS __stdcall PspSiloInitializeSystemRootSymlink(_EJOB *Silo){
  _ESERVERSILO_GLOBALS *ServerSiloGlobals; 
  NTSTATUS result; 
  unsigned __int16 v4; 
  VOID **PoolWithTag; 
  VOID **v6; 
  _EJOB *v7; 
  _EJOB *v8; 
  int v9; 
  _UNICODE_STRING DestinationString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  UINT16 pusResult; 
  VOID *LinkHandle; 

  pusResult = 0;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  LinkHandle = 0i64;
  ServerSiloGlobals = PsGetServerSiloGlobals(Silo);
  result = RtlUShortAdd(0x14u, ServerSiloGlobals->NtSystemRoot.Length, &pusResult);
  if( result >= 0 )
  {
    v4 = pusResult;
    PoolWithTag = ExAllocatePoolWithTag(1ui64, pusResult, 1884517200i64);
    v6 = PoolWithTag;
    if( PoolWithTag )
    {
      *(_QWORD *)&DestinationString.Length = 0i64;
      DestinationString.MaximumLength = v4;
      DestinationString.Buffer = (wchar_t *)PoolWithTag;
      RtlCopyUnicodeString(&DestinationString, &PspSystemRootTargetPrefix);
      RtlAppendUnicodeStringToString(&DestinationString, &ServerSiloGlobals->NtSystemRoot);
      ObjectAttributes.Length = 48;
      ObjectAttributes.ObjectName = (_UNICODE_STRING *)&PspSystemRootSymlinkName;
      ObjectAttributes.RootDirectory = 0i64;
      *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
      ObjectAttributes.Attributes = 528;
      LODWORD(v7) = PsAttachSiloToCurrentThread((INT64)Silo);
      v8 = v7;
      v9 = ZwCreateSymbolicLinkObject(&LinkHandle, 983041, &ObjectAttributes, &DestinationString);
      PsDetachSiloFromCurrentThread(v8);
      if( v9 >= 0 )
        ZwClose((_HANDLE)LinkHandle);
      ExFreePoolWithTag(v6, 0x70537350u);
      return v9;
    }
    else
    {
      return -1073741670;
    }
  }
  return result;
}

Referenced by:

PspInitializeServerSiloDeferred