CmGetMatchingDevicePanelListWorker

NTSTATUS __fastcall CmGetMatchingDevicePanelListWorker(
        INT64 a1,
        INT64 a2,
        INT64 a3,
        _WORD *a4,
        UINT64 a5,
        UINT64 *a6,
        INT64 a7){
  int CachedContextBaseKey; 
  VOID **PoolWithTag; 
  VOID **v13; 
  VOID *v14; 
  int v15; 
  unsigned int v16; 
  __int64 v18[7]; 

  v18[0] = 0i64;
  *(_DWORD *)a6 = 0;
  if( (_DWORD)a5 )
    *a4 = 0;
  CachedContextBaseKey = PnpCtxGetCachedContextBaseKey(
                           (HPNPCTX *)a1,
                           PNPCTX_BASE_KEY_TYPE_CODEVICEINSTALLERS,
                           (VOID **)v18);
  if( CachedContextBaseKey >= 0 )
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 0xA0ui64, 1380994640i64);
    v13 = PoolWithTag;
    if( PoolWithTag )
    {
      memset(PoolWithTag, 0i64, 0xA0u);
      v14 = (VOID *)v18[0];
      *((_DWORD *)v13 + 38) = a7;
      *(_DWORD *)v13 = 1;
      v13[15] = (VOID *)a2;
      v13[16] = (VOID *)a3;
      v13[17] = a4;
      *((_DWORD *)v13 + 36) = a5;
      CachedContextBaseKey = PnpCtxRegEnumKeyWithCallback(a1, v14, (INT64)CmDevicePanelEnumSubkeyCallback, (INT64)v13);
      if( CachedContextBaseKey >= 0 )
      {
        v15 = *((_DWORD *)v13 + 37);
        *(_DWORD *)a6 = v15;
        if( v15 )
        {
          v16 = v15 + 1;
          *(_DWORD *)a6 = v16;
          if( a4 && (unsigned int)a5 >= v16 )
            a4[v16 - 1] = 0;
          else
            CachedContextBaseKey = -1073741789;
        }
      }
      ExFreePoolWithTag(v13, 0);
    }
    else
    {
      return -1073741801;
    }
  }
  return CachedContextBaseKey;
}

Referenced by:

CmGetMatchingDevicePanelList