PipSmBiosGetString

NTSTATUS __fastcall PipSmBiosGetString(
        __int64 a1,
        unsigned __int8 a2,
        __int64 a3,
        int a4,
        _UNICODE_STRING *DestinationString){
  unsigned int v5; 
  char *v6; 
  unsigned __int64 v7; 
  int v8; 
  char v9; 
  unsigned __int16 v10; 
  char *v11; 
  UINT8 v12; 
  __int64 v13; 
  __int64 v14; 
  bool v16; 
  _STRING SourceString; 

  v5 = a2;
  SourceString = 0i64;
  if( !a2 )
    return -1073741275;
  v6 = (char *)(*(unsigned __int8 *)(a1 + 1) + a1);
  v7 = a3 + (unsigned int)(a4 - 1);
  v8 = 1;
  if( v5 > 1 )
  {
    v9 = *v6;
    while( !v9 )
    {
LABEL_7:
      if( !++v6 )
        return -1073741275;
      v9 = *v6;
      if( !*v6 )
      {
        v6 = 0i64;
        goto LABEL_10;
      }
      if( ++v8 >= v5 )
        goto LABEL_10;
    }
    while( (unsigned __int64)++v6 < v7 )
    {
      if( !*v6 )
        goto LABEL_7;
    }
    return -1073741275;
  }
LABEL_10:
  if( !v6 )
    return -1073741275;
  v10 = 0;
  SourceString.Buffer = v6;
  SourceString.Length = 0;
  v11 = v6;
  while( *v6 )
  {
    ++v10;
    ++v6;
    SourceString.Length = v10;
    if( (unsigned __int64)v6 >= v7 || v10 > 0x40u )
      return -1073741275;
  }
  if( v6 == (char *)-1i64 )
    return -1073741275;
  v12 = *v11;
  if( *v11 )
  {
    do
    {
      strchr((UINT8 *)&byte_14000D498, v12);
      if( !v13 )
        break;
      ++v11;
      SourceString.Length = --v10;
      v12 = *v11;
    }
    while( *v11 );
    SourceString.Buffer = v11;
  }
  if( v10 )
  {
    do
    {
      strchr((UINT8 *)&byte_14000D498, v11[v10 - 1]);
      if( !v14 )
        break;
      v16 = v10-- == 1;
      SourceString.Length = v10;
    }
    while( !v16 );
  }
  SourceString.MaximumLength = v10 + 1;
  return RtlAnsiStringToUnicodeString(DestinationString, &SourceString, 1u);
}

Referenced by:

PipInitComputerIds