PipCreateComputerId

NTSTATUS __stdcall PipCreateComputerId(
        PVOID ComputerIdsKeyHandle,
        UNICODE_STRING **StringList,
        UINT64 StringCount,
        GUID *ComputerId){
  unsigned int v4; 
  unsigned int v6; 
  unsigned __int16 v8; 
  unsigned int v9; 
  _WORD **v10; 
  _WORD *v11; 
  unsigned __int16 v12; 
  unsigned __int16 v13; 
  VOID *PoolWithTag; 
  VOID *v15; 
  UINT8 *v16; 
  int v17; 
  NTSTATUS Class5Guid; 
  WCHAR v19; 
  int v20; 
  WCHAR v21; 
  int v22; 
  PVOID Data; 
  UINT64 DataSize; 
  UINT64 DataSizea; 
  struct _UNICODE_STRING DestinationString; 
  HANDLE KeyHandle; 
  WCHAR SourceString[40]; 
  wchar_t pszDest[48]; 
  _GUID *Guid; 
  v4 = 0;
  KeyHandle = ComputerIdsKeyHandle;
  v6 = (unsigned int)ComputerId;
  v8 = 0;
  v9 = 0;
  DestinationString = 0i64;
  if( !(_DWORD)ComputerId )
    return -1073741811;
  v10 = (_WORD **)StringCount;
  do
  {
    v11 = *v10;
    v12 = v8 + 2;
    ++v10;
    if( !v9 )
      v12 = v8;
    ++v9;
    v8 = *v11 + v12;
  }
  while( v9 < (unsigned int)ComputerId );
  if( v8 <= 2u )
    return -1073741811;
  v13 = v8 + 2;
  PoolWithTag = ExAllocatePoolWithTag(PagedPool, v13, 0x6E697050ui64);
  v15 = PoolWithTag;
  if( !PoolWithTag )
    return -1073741670;
  v16 = (UINT8 *)PoolWithTag;
  do
  {
    if( v4 )
    {
      *(_WORD *)v16 = 38;
      v16 += 2;
    }
    if( **(_WORD **)StringCount )
    {
      memmove(v16, *(UINT8 **)(*(_QWORD *)StringCount + 8i64), **(unsigned __int16 **)StringCount);
      v16 += 2 * ((unsigned __int64)**(unsigned __int16 **)StringCount >> 1);
    }
    ++v4;
    StringCount += 8i64;
  }
  while( v4 < v6 );
  *(_WORD *)v16 = 0;
  v17 = v13;
  Class5Guid = RtlGenerateClass5Guid(&NamespaceGuid, v15, (unsigned int)v13 - 2, Guid);
  if( Class5Guid >= 0 )
  {
    PnpStringFromGuid((int *)Guid, SourceString);
    Class5Guid = v20;
    if( v20 >= 0 )
    {
      RtlInitUnicodeString(&DestinationString, SourceString, v19);
      LODWORD(DataSize) = v17;
      Class5Guid = ZwSetValueKey(KeyHandle, &DestinationString, 0i64, 1ui64, v15, DataSize);
      if( Class5Guid >= 0 )
      {
        if( StringList )
        {
          LODWORD(Data) = 2048;
          RtlStringCbPrintfExW(
            pszDest,
            0x5Cui64,
            0i64,
            0i64,
            (UINT64)Data,
            L"%ws_%ws",
            SourceString,
            L"amd64",
            *(_QWORD *)&DestinationString.Length,
            DestinationString.Buffer);
          Class5Guid = v22;
          if( v22 >= 0 )
          {
            RtlInitUnicodeString(&DestinationString, pszDest, v21);
            LODWORD(DataSizea) = 0;
            Class5Guid = ZwSetValueKey(StringList, &DestinationString, 0i64, 1ui64, 0i64, DataSizea);
          }
        }
      }
    }
  }
  ExFreePoolWithTag(v15, 0);
  return Class5Guid;
}

Referenced by:

PipInitComputerIds