PiDrvDbResolveNodeFilePaths

INT64 __fastcall PiDrvDbResolveNodeFilePaths(INT64 a1, INT64 a2, WCHAR a3){
  INT8 v5; 
  unsigned int v6; 
  int v7; 
  int v8; 
  unsigned int v9; 
  int v10; 
  int NodeSystemRoot; 
  UNICODE_STRING *v12; 
  struct _UNICODE_STRING DestinationString; 
  UNICODE_STRING *a2a; 
  HANDLE Handle; 
  Handle = 0i64;
  a2a = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, 0i64, a3);
  v5 = 1;
  if( (*(_DWORD *)(a1 + 492) & 1) == 0
    || (v7 = SysCtxRegOpenKey(0i64, (char *)a2, L"Setup\\ResolveFilePaths", 0, 0x20019u, &Handle),
        v6 = v7,
        v7 == -1073741772) )
  {
    v6 = 0;
    goto LABEL_18;
  }
  if( v7 >= 0 )
  {
    v8 = *(_DWORD *)(a1 + 64);
    if( (v8 & 1) == 0 && CmIsStateSeparationEnabled() )
      v5 = 3;
    if( (v8 & 8) == 0 )
    {
      if( !RtlCreateUnicodeString(&DestinationString, (PWCHAR)L"\\SystemRoot") )
      {
LABEL_10:
        v6 = -1073741670;
        goto LABEL_18;
      }
LABEL_15:
      NodeSystemRoot = PiDrvDbGetNodeSystemRoot(a1, &a2a);
      v12 = a2a;
      if( NodeSystemRoot < 0 )
        v12 = 0i64;
      v6 = PiDrvDbResolveFilePathKeyValues(a2, v5, &DestinationString, v12);
      goto LABEL_18;
    }
    v9 = *(unsigned __int16 *)(a1 + 18) + 28;
    if( v9 > 0xFFFE )
    {
      v6 = -2147483643;
      goto LABEL_18;
    }
    DestinationString.Length = 0;
    DestinationString.MaximumLength = v9;
    DestinationString.Buffer = (wchar_t *)ExpAllocateStringRoutine(v9);
    if( !DestinationString.Buffer )
      goto LABEL_10;
    RtlUnicodeStringPrintf(&DestinationString, L"%ws\\%wZ", L"\\DriverStores", a1 + 16);
    v6 = v10;
    if( v10 >= 0 )
      goto LABEL_15;
  }
LABEL_18:
  RtlFreeAnsiString(&DestinationString);
  if( Handle )
    ZwClose(Handle);
  return v6;
}

Referenced by:

PiDrvDbSetupNodeHive