CmGetMatchingDeviceList

NTSTATUS __stdcall CmGetMatchingDeviceList(
        HPNPCTX *hPnpCtx,
        UINT8 *MatchCallbackRoutine,
        HPNPCTX *a3,
        const WCHAR *a4,
        _CM_OBJECT_TYPE a5,
        VOID *a6,
        VOID *MatchCallbackContext,
        WCHAR *Buffer,
        UINT64 BufferLength,
        UINT64 *RequiredLength,
        UINT64 Flags){
  __int64(__fastcall *v15)(HPNPCTX *, _QWORD, __int64, __int64, int, VOID **); 
  int v16; 
  NTSTATUS MatchingDeviceListForSubkey; 
  int v19; 
  NTSTATUS v20; 
  VOID *a7[12]; 

  memset(a7, 0i64, 0x58u);
  v15 = (__int64(__fastcall *)(HPNPCTX *, _QWORD, __int64, __int64, int, VOID **))*((_QWORD *)hPnpCtx + 63);
  a7[3] = a3;
  LODWORD(a7[5]) = a5;
  a7[2] = MatchCallbackRoutine;
  a7[4] = (VOID *)a4;
  a7[6] = a6;
  LODWORD(a7[7]) = (_DWORD)MatchCallbackContext;
  if( v15 )
  {
    v16 = v15(hPnpCtx, 0i64, 1i64, 4i64, 1, a7);
    if( v16 == -1073741822 )
    {
      v15 = 0i64;
    }
    else
    {
      if( v16 == -1073741536 )
        return(NTSTATUS)a7[0];
      if( v16 )
        return -1073741595;
    }
  }
  if( LOWORD(a7[7]) )
    MatchingDeviceListForSubkey = -1073741811;
  else
    MatchingDeviceListForSubkey = CmGetMatchingDeviceListForSubkey(
                                    hPnpCtx,
                                    0i64,
                                    0,
                                    (UINT8 *)a7[2],
                                    (HPNPCTX *)a7[3],
                                    (const WCHAR *)a7[4],
                                    (_CM_OBJECT_TYPE)a7[5],
                                    a7[6],
                                    a7[0],
                                    (WCHAR *)a7[1],
                                    (UINT64)a7[2],
                                    (UINT64 *)a7[3]);
  if( !v15 )
    return MatchingDeviceListForSubkey;
  LODWORD(a7[0]) = MatchingDeviceListForSubkey;
  v19 = v15(hPnpCtx, 0i64, 1i64, 4i64, 2, a7);
  if( v19 == -1073741822 )
    return MatchingDeviceListForSubkey;
  if( v19 == -1073741536 )
    return(NTSTATUS)a7[0];
  v20 = MatchingDeviceListForSubkey;
  if( v19 )
    return -1073741595;
  return v20;
}

Referenced by:

CmDeleteDeviceWorker
PipMigratePnpState
PnpDispatchDevice