PnpCheckDriverDependencies

INT64 __stdcall PnpCheckDriverDependencies(
        WCHAR *Dependencies,
        UINT8 *DependenciesSatisfied,
        UINT8 *GenericBootDependency){
  char v5; 
  int CachedContextBaseKey; 
  __int64 v7; 
  int v8; 
  __int64 v9; 
  int v10; 
  int v11; 
  int v12; 
  __int64 v14; 
  int v15; 
  HANDLE Handle; 
  HANDLE v17; 
  char *v18; 
  int v19; 
  __int64 v20; 
  int v21; 
  v20 = (__int64)GenericBootDependency;
  *DependenciesSatisfied = 0;
  v18 = 0i64;
  v5 = 0;
  v17 = 0i64;
  Handle = 0i64;
  v15 = 0;
  v19 = 0;
  v21 = 0;
  CachedContextBaseKey = PnpCtxGetCachedContextBaseKey(PiPnpRtlCtx, 4, (__int64 *)&v18);
  if( CachedContextBaseKey >= 0 )
  {
    for( ; *Dependencies; Dependencies += v14 + 1 )
    {
      if( !wcsicmp(Dependencies, L"*") || v5 )
        goto LABEL_36;
      if( !v17 )
      {
        v7 = 0i64;
        if( PiPnpRtlCtx )
          v7 = *(_QWORD *)(PiPnpRtlCtx + 224);
        v8 = SysCtxRegOpenKey(v7, v18, L"Control\\FirmwareResources", 0, 0x20019u, &v17);
        CachedContextBaseKey = v8;
        if( v8 == -1073741772 || v8 == -1073741444 )
        {
          v5 = 1;
LABEL_35:
          CachedContextBaseKey = 0;
          goto LABEL_36;
        }
        if( v8 < 0 )
          goto LABEL_29;
      }
      if( Handle )
      {
        ZwClose(Handle);
        Handle = 0i64;
      }
      v9 = 0i64;
      if( PiPnpRtlCtx )
        v9 = *(_QWORD *)(PiPnpRtlCtx + 224);
      v10 = SysCtxRegOpenKey(v9, (char *)v17, Dependencies, 0, 1u, &Handle);
      CachedContextBaseKey = v10;
      if( v10 == -1073741772 || v10 == -1073741444 )
        goto LABEL_35;
      if( v10 < 0 )
        goto LABEL_29;
      LODWORD(v20) = 4;
      v11 = RegRtlQueryValue(Handle, L"Phase", &v21, &v19, (__int64)&v20);
      CachedContextBaseKey = v11;
      if( v11 == -1073741772 )
      {
        CachedContextBaseKey = 0;
        goto LABEL_27;
      }
      if( v11 == -1073741444 )
        goto LABEL_35;
      if( v11 < 0 )
        goto LABEL_29;
      if( v19 != 2 )
        break;
      LODWORD(v20) = 4;
      v12 = RegRtlQueryValue(Handle, L"LastAttemptStatus", &v21, &v15, (__int64)&v20);
      CachedContextBaseKey = v12;
      if( v12 == -1073741772 )
      {
        CachedContextBaseKey = 0;
        break;
      }
      if( v12 == -1073741444 )
        goto LABEL_35;
      if( v12 < 0 )
        goto LABEL_29;
      if( v15 )
        break;
LABEL_36:
      v14 = -1i64;
      do
        ++v14;
      while( Dependencies[v14] );
    }
    if( CachedContextBaseKey >= 0 )
    {
LABEL_27:
      if( !*Dependencies )
        *DependenciesSatisfied = 1;
    }
  }
LABEL_29:
  if( v17 )
    ZwClose(v17);
  if( Handle )
    ZwClose(Handle);
  return(unsigned int)CachedContextBaseKey;
}

Referenced by:

PipProcessPendingObjects