PnpCheckDriverDependencies

__int64 __fastcall PnpCheckDriverDependencies(wchar_t *Str1, _BYTE *a2, __int64 a3){
  char v5; 
  NTSTATUS CachedContextBaseKey; 
  __int64 v7; 
  NTSTATUS v8; 
  __int64 v9; 
  NTSTATUS v10; 
  int v11; 
  int v12; 
  __int64 v14; 
  int v15; 
  VOID *Handle; 
  UINT64 v17; 
  INT64 v18; 
  int v19; 
  __int64 v20; 
  int v21; 

  v20 = a3;
  *a2 = 0;
  v18 = 0i64;
  v5 = 0;
  v17 = 0i64;
  Handle = 0i64;
  v15 = 0;
  v19 = 0;
  v21 = 0;
  CachedContextBaseKey = PnpCtxGetCachedContextBaseKey(
                           *(&stru_140CF2E80 + 607),
                           PNPCTX_BASE_KEY_TYPE_CONTROLSET,
                           (VOID **)&v18);
  if( CachedContextBaseKey >= 0 )
  {
    for( ; *Str1; Str1 += v14 + 1 )
    {
      if( !wcsicmp(Str1, L"*") || v5 )
        goto LABEL_36;
      if( !v17 )
      {
        v7 = 0i64;
        if( *(&stru_140CF2E80 + 607) )
          v7 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64);
        v8 = SysCtxRegOpenKey(v7, (VOID *)v18, L"Control\\FirmwareResources", 0, 0x20019u, (VOID **)&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);
        Handle = 0i64;
      }
      v9 = 0i64;
      if( *(&stru_140CF2E80 + 607) )
        v9 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64);
      v10 = SysCtxRegOpenKey(v9, (VOID *)v17, Str1, 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( Str1[v14] );
    }
    if( CachedContextBaseKey >= 0 )
    {
LABEL_27:
      if( !*Str1 )
        *a2 = 1;
    }
  }
LABEL_29:
  if( v17 )
    ZwClose(v17);
  if( Handle )
    ZwClose((_HANDLE)Handle);
  return(unsigned int)CachedContextBaseKey;
}

Referenced by:

PipProcessPendingObjects