IoDeleteDevice

VOID __stdcall IoDeleteDevice(_DEVICE_OBJECT *DeviceObject){
  int v1; 
  EVENT_DESCRIPTOR *v2; 
  _OBJECT_NAME_INFORMATION *v3; 
  void *v5; 
  KIRQL v6; 
  _OBJECT_NAME_INFORMATION *Pool_1; 
  void *retaddr; 
  UINT64 ReturnLength; 
  v1 = *((_DWORD *)DeviceObject + 12);
  v2 = 0i64;
  LODWORD(ReturnLength) = 0;
  v3 = 0i64;
  if( (v1 & 0x40) != 0 && (unsigned int)ObQueryNameString(DeviceObject, 0i64, 0i64, &ReturnLength) == -1073741820 )
  {
    Pool_1 = (_OBJECT_NAME_INFORMATION *)IopVerifierExAllocatePool_1(PagedPool, (unsigned int)ReturnLength);
    v3 = Pool_1;
    if( Pool_1 )
    {
      if( (int)ObQueryNameString(DeviceObject, Pool_1, (unsigned int)ReturnLength, &ReturnLength) >= 0 )
        v2 = (EVENT_DESCRIPTOR *)v3;
    }
  }
  EtwTiLogDeviceObjectLoadUnload(0, (UINT16 *)(*((_QWORD *)DeviceObject + 1) + 56i64), v2);
  if( v3 )
    ExFreePoolWithTag(v3, 0);
  if( (MmVerifierData & 0x90) != 0 )
    IovDeleteDevice(DeviceObject, retaddr);
  if( (*((_DWORD *)DeviceObject + 12) & 0x800) != 0 )
    IoUnregisterShutdownNotification(DeviceObject);
  v5 = (void *)*((_QWORD *)DeviceObject + 5);
  if( v5 )
  {
    IopRemoveTimerFromTimerList(*((_IO_TIMER **)DeviceObject + 5));
    ExFreePoolWithTag(v5, 0);
  }
  if( (*((_DWORD *)DeviceObject + 12) & 0x40) != 0 )
    ObMakeTemporaryObject(DeviceObject);
  PoRunDownDeviceObject(DeviceObject);
  PnpFreeInterruptInformation(DeviceObject);
  v6 = KeAcquireQueuedSpinLock(0xAui64);
  *(_DWORD *)(*((_QWORD *)DeviceObject + 39) + 32i64) |= 2u;
  if( *((_DWORD *)DeviceObject + 1) )
    KeReleaseQueuedSpinLock(0xAui64, v6);
  else
    IopCompleteUnloadOrDelete(DeviceObject, 0, v6);
}

Referenced by:

HalpAddDevice
IoCreateDeviceSecure
IoReportDetectedDevice
IopCreateRootEnumeratedDeviceObject
IopInitializeDeviceInstanceKey
IopInitializePlugPlayServices
IopLegacyResourceAllocation
IopPnPDispatch
IopRemoveLegacyDeviceNode
PiInitializeDevice
PiSwDestroyDeviceObject
PiSwGetChildPdo
RawDeleteVcb
RawInitialize
RawMountVolume
RawShutdown
VfFilterAttach
ViDdiDriverEntry
ViFilterDispatchPnp
VrpRegistryUnload
WmipDriverEntry