AslRegistryBuildMachinePath

INT64 __fastcall AslRegistryBuildMachinePath(_UNICODE_STRING *MachineKeyPath, const WCHAR *Path){
  WCHAR v2; 
  VOID *v5; 
  INT64 v6; 
  unsigned int v7; 
  __int64 v8; 
  unsigned __int16 v9; 
  wchar_t *v10; 
  int MaximumLength; 
  UNICODE_STRING Source; 
  Source = 0i64;
  RtlInitUnicodeString(&Source, L"\\Registry\\Machine", v2);
  v7 = 0;
  MachineKeyPath->Length = 0;
  v8 = -1i64;
  do
    ++v8;
  while( Path[v8] );
  v9 = Source.Length + 2 * (v8 + 1);
  MachineKeyPath->MaximumLength = v9;
  v10 = (wchar_t *)AslAlloc(v5, v9, v6);
  MachineKeyPath->Buffer = v10;
  if( v10 )
  {
    RtlAppendUnicodeStringToString(MachineKeyPath, &Source);
    if( Path && *Path != 92 )
      RtlAppendUnicodeToString(MachineKeyPath, (PWCHAR)L"\\");
    RtlAppendUnicodeToString(MachineKeyPath, (PWCHAR)Path);
  }
  else
  {
    MaximumLength = MachineKeyPath->MaximumLength;
    v7 = -1073741801;
    AslLogCallPrintf(
      1ui64,
      "AslRegistryBuildMachinePath",
      0x58Cui64,
      "Failed to allocate %d bytes for user key buffer",
      MaximumLength);
  }
  return v7;
}

Referenced by:

AslRegistryGetKey