PiDrvDbResolveNodeFilePaths

__int64 __fastcall PiDrvDbResolveNodeFilePaths(__int64 a1, VOID *a2, WCHAR a3){
  INT8 v5; 
  NTSTATUS v6; 
  NTSTATUS v7; 
  int v8; 
  unsigned int v9; 
  int NodeSystemRoot; 
  _UNICODE_STRING *v11; 
  _UNICODE_STRING DestinationString; 
  _UNICODE_STRING *v14; 
  VOID *Handle; 

  Handle = 0i64;
  v14 = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, 0i64);
  v5 = 1;
  if( (*(_DWORD *)(a1 + 492) & 1) == 0
    || (v7 = SysCtxRegOpenKey(0i64, 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((INT64)&DestinationString, (INT8 *)L"\\SystemRoot") )
      {
LABEL_10:
        v6 = -1073741670;
        goto LABEL_18;
      }
LABEL_15:
      NodeSystemRoot = PiDrvDbGetNodeSystemRoot(a1, &v14);
      v11 = v14;
      if( NodeSystemRoot < 0 )
        v11 = 0i64;
      v6 = PiDrvDbResolveFilePathKeyValues((INT64)a2, v5, &DestinationString, v11);
      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;
    v6 = RtlUnicodeStringPrintf(&DestinationString, (WCHAR *)L"%ws\\%wZ");
    if( v6 >= 0 )
      goto LABEL_15;
  }
LABEL_18:
  RtlFreeAnsiString(&DestinationString);
  if( Handle )
    ZwClose((_HANDLE)Handle);
  return(unsigned int)v6;
}

Referenced by:

PiDrvDbSetupNodeHive