PnpProcessCompletedEject

VOID __stdcall PnpProcessCompletedEject(PVOID Context){
  _SYSTEM_POWER_STATE v1; 
  int v2; 
  __int64 v4; 
  _QWORD *v5; 
  PVOID *v6; 
  __int64 v7; 
  __int64 v8; 
  _RELATION_LIST *v9; 
  _KEVENT *v10; 
  UINT64 *v11; 
  _QWORD *v12; 
  INT64 v13; 
  v1 = *((_DWORD *)Context + 23);
  v2 = 0;
  if( (unsigned int)v1 > PowerSystemWorking )
  {
    *((_BYTE *)Context + 89) = 0;
    v2 = IopWarmEjectDevice(*((_DEVICE_OBJECT **)Context + 7), v1);
  }
  v4 = *((_QWORD *)Context + 12);
  if( v4 )
  {
    (*(void(__fastcall **)(_QWORD, __int64))(v4 + 32))(*(_QWORD *)(v4 + 8), 1i64);
    (*(void(__fastcall **)(_QWORD))(*((_QWORD *)Context + 12) + 24i64))(*(_QWORD *)(*((_QWORD *)Context + 12) + 8i64));
  }
  PpDevNodeLockTree(1);
  v5 = *(_QWORD **)Context;
  if( *(PVOID *)(*(_QWORD *)Context + 8i64) != Context || (v6 = (PVOID *)*((_QWORD *)Context + 1), *v6 != Context) )
    __fastfail(3u);
  *v6 = v5;
  v5[1] = v6;
  v7 = *((_QWORD *)Context + 7);
  if( v7 )
    v8 = *(_QWORD *)(*(_QWORD *)(v7 + 312) + 40i64);
  else
    v8 = 0i64;
  v9 = (_RELATION_LIST *)*((_QWORD *)Context + 8);
  if( v9 )
  {
    if( *((_BYTE *)Context + 88) )
    {
      PpProfileMarkAllTransitioningDocksEjected();
      v9 = (_RELATION_LIST *)*((_QWORD *)Context + 8);
    }
    PnpInvalidateRelationsInList(v9, EjectDevice, 0, 1u);
    PnpTrackQueryRemoveDevices(*((unsigned int ***)Context + 8), 0);
    IopFreeRelationList(*((PVOID *)Context + 8));
    *(_QWORD *)(v8 + 696) = 0i64;
  }
  else
  {
    *((_BYTE *)Context + 89) = 0;
  }
  PpDevNodeUnlockTree(1);
  v12 = (_QWORD *)*((_QWORD *)Context + 6);
  if( v12 )
  {
    v13 = v12[13];
    if( v13 )
    {
      PnpDisableWatchdog(v13);
      v12[13] = 0i64;
    }
    PnpCompleteDeviceEvent(v12, v2);
  }
  if( *((_BYTE *)Context + 89) )
    PnpSetDeviceRemovalSafe(*((_DEVICE_OBJECT **)Context + 7), v10, v11);
  HalPutDmaAdapter(*((PADAPTER_OBJECT *)Context + 7));
  ExFreePoolWithTag(Context, 0);
}

Referenced by:

PnpProcessQueryRemoveAndEject