PiDrvDbQuerySyncNodesUpdated

NTSTATUS __stdcall PiDrvDbQuerySyncNodesUpdated(CHAR a1, CHAR *a2){
  UINT64 v3; 
  int PersistedStateLocation; 
  VOID **PoolWithTag; 
  INT64 i; 
  VOID *a5; 
  INT64 a6; 
  VOID *Handle[2]; 
  INT64 Source1; 
  INT64 a7; 
  INT64 v13; 

  Handle[0] = 0i64;
  Source1 = 0i64;
  Handle[1] = 0i64;
  v3 = 520i64;
  LODWORD(v13) = 0;
  LODWORD(a7) = 0;
  while( 1 )
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, v3, 1650749520i64);
    if( !PoolWithTag )
    {
      PersistedStateLocation = -1073741670;
      goto LABEL_7;
    }
    LODWORD(a6) = v3;
    PersistedStateLocation = RtlGetPersistedStateLocation(
                               (WCHAR *)&stru_1407D2340._Xmm10,
                               0i64,
                               &stru_1407D2340.P3Home,
                               0i64,
                               PoolWithTag,
                               a6,
                               (INT64)&a7);
    if( PersistedStateLocation != -2147483643 )
      break;
    ExFreePoolWithTag(PoolWithTag, 0);
    PoolWithTag = 0i64;
    if( (unsigned int)a7 <= (unsigned int)v3 )
    {
      PersistedStateLocation = -1073741595;
      break;
    }
    v3 = (unsigned int)a7;
  }
  if( PersistedStateLocation >= 0 )
  {
    LODWORD(a5) = 131103;
    PersistedStateLocation = PnpCtxRegCreateTree(0i64, 0i64, (WCHAR *)PoolWithTag, 0i64, (UINT64)a5, 0i64, Handle, 0i64);
    if( PersistedStateLocation >= 0 )
    {
      for( i = PiDrvDbNodeList; (INT64 *)i != &PiDrvDbNodeList; i = *(_QWORD *)i )
      {
        if( (*(_DWORD *)(i + 64) & 4) == 0 || !PnpBootMode )
        {
          PnpGetObjectProperty(
            *(&stru_140CF2E80 + 1214),
            *(_QWORD *)(i + 24),
            7i64,
            *(_QWORD *)(i + 72),
            0i64,
            (INT64)&DEVPKEY_DriverDatabase_LastUpdateDate,
            (INT64)&v13,
            (INT64)&Source1);
          PersistedStateLocation = 0;
        }
      }
      if( a2 )
        *a2 = 0;
    }
  }
LABEL_7:
  if( Handle[0] )
    ZwClose((_HANDLE)Handle[0]);
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0);
  return PersistedStateLocation;
}

Referenced by:

PpDevCfgInit