AslRegistryBuildUserPath

INT64 __fastcall AslRegistryBuildUserPath(_UNICODE_STRING *UserKeyPath, const WCHAR *Path){
  int v4; 
  VOID *v5; 
  INT64 v6; 
  unsigned int v7; 
  __int64 v8; 
  unsigned __int16 v9; 
  wchar_t *v10; 
  int v12; 
  UNICODE_STRING Source; 
  Source = 0i64;
  v4 = RtlFormatCurrentUserKeyPath(&Source);
  v7 = v4;
  if( v4 < 0 )
  {
    v12 = v4;
    AslLogCallPrintf(1ui64, "AslRegistryBuildUserPath", 0x5C4ui64, "RtlFormatCurrentUserKeyPath failed [%x]", v12);
  }
  else
  {
    UserKeyPath->Length = 0;
    v8 = -1i64;
    do
      ++v8;
    while( Path[v8] );
    v9 = Source.Length + 2 * (v8 + 1);
    UserKeyPath->MaximumLength = v9;
    v10 = (wchar_t *)AslAlloc(v5, v9, v6);
    UserKeyPath->Buffer = v10;
    if( v10 )
    {
      RtlAppendUnicodeStringToString(UserKeyPath, &Source);
      RtlAppendUnicodeToString(UserKeyPath, (PWCHAR)Path);
      v7 = 0;
    }
    else
    {
      v7 = -1073741801;
      AslLogCallPrintf(1ui64, "AslRegistryBuildUserPath", 0x5D0ui64, "Out of memory");
    }
  }
  RtlFreeAnsiString(&Source);
  return v7;
}

Referenced by:

AslRegistryGetKey