CmpVEAddHiveToSIDMappingTable

__int64 __fastcall CmpVEAddHiveToSIDMappingTable(__int64 a1, __int64 a2, WCHAR a3){
  unsigned __int16 *v5; 
  unsigned __int64 v6; 
  _WORD *v7; 
  unsigned __int16 MaximumLength; 
  unsigned __int16 Length; 
  __int64 result; 
  struct _UNICODE_STRING DestinationString; 
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, 0i64, a3);
  v5 = *(unsigned __int16 **)(a2 + 16);
  v6 = *((_QWORD *)v5 + 1);
  v7 = (_WORD *)(v6 + 2 * (((unsigned __int64)*v5 - 2) >> 1));
  if( *v7 != 92 )
  {
    MaximumLength = DestinationString.MaximumLength;
    Length = DestinationString.Length;
    do
    {
      --v7;
      Length += 2;
      MaximumLength += 2;
    }
    while( (unsigned __int64)v7 >= v6 && *v7 != 92 );
    DestinationString.MaximumLength = MaximumLength;
    DestinationString.Length = Length;
  }
  DestinationString.Buffer = v7 + 1;
  result = CmpAddStringToMapping((const void **)&DestinationString, a1);
  if( (int)result >= 0 )
  {
    *(_DWORD *)(a1 + 4152) |= 2u;
    return 0i64;
  }
  return result;
}

Referenced by:

CmpLoadKeyCommon