Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

ObDereferenceObject never returns

tony_zhutony_zhu Member Posts: 31

This is happening in my code.
under what condition, ObDereferenceObject never returns, and is there any way to check the reason?


  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,450
    Call stack under the Ob call? What type of object are you dereferencing? For instance, a deref on a file object can lead to the MJ_CLOSE irp being sent to the underlying stack and it could be stuck in the driver.
  • Dejan_MaksimovicDejan_Maksimovic Member - All Emails Posts: 246
    via Email
    What is the stack trace?
    An invalid handle passed is the most common reason.
    Also, the ObMgr might need to wait on an event, that would never get
    satisfied in your case (e.g. you are holding the lock)

    > This is happening in my code.
    > under what condition, ObDereferenceObject never returns, and is there any
    > way to check the reason?
    > --
    > Reply to this email directly or follow the link below to check it out:
    > Check it out:
  • tony_zhutony_zhu Member Posts: 31

    Thanks @Dejan_Maksimovic and @Doron_Holan
    the type of object is FILE_OBJECT.
    for the call stack, as it is WDDM related and so
    dxgkrnl!DpiDxgkDdiUnload+0x33 [onecoreuap\windows\core\dxkernel\dxgkrnl\port\dpetw.cxx @ 447]
    dxgkrnl!DpiCleanup+0xaf [onecoreuap\windows\core\dxkernel\dxgkrnl\port\dpport.cxx @ 3193]
    dxgkrnl!DpiDriverUnload+0xb [onecoreuap\windows\core\dxkernel\dxgkrnl\port\dpport.cxx @ 3229]
    nt!IopUnloadDriver+0x20f [minkernel\ntos\io\iomgr\loadunld.c @ 571]
    nt!PnpUnloadAttachedDriver+0xa6 [minkernel\ntos\io\pnpmgr\remove.c @ 3724]
    nt!PnpRemoveLockedDeviceNode+0x240 [minkernel\ntos\io\pnpmgr\remove.c @ 1501]
    nt!PnpDeleteLockedDeviceNode+0x8b [minkernel\ntos\io\pnpmgr\remove.c @ 584]
    nt!PnpDeleteLockedDeviceNodes+0x76 [minkernel\ntos\io\pnpmgr\remove.c @ 1712]
    nt!PipRemoveDevicesInRelationList+0x8d [minkernel\ntos\io\pnpmgr\remove.c @ 474]
    nt!PnpDelayedRemoveWorker+0x114 [minkernel\ntos\io\pnpmgr\remove.c @ 363]
    nt!PnpChainDereferenceComplete+0xfd [minkernel\ntos\io\pnpmgr\remove.c @ 285]
    nt!PnpIsChainDereferenced+0xac [minkernel\ntos\io\pnpmgr\eventremove.c @ 1521]
    nt!PnpProcessQueryRemoveAndEject+0x2a2 [minkernel\ntos\io\pnpmgr\event.c @ 2896]
    nt!PnpProcessTargetDeviceEvent+0xea [minkernel\ntos\io\pnpmgr\event.c @ 3351]
    nt!PnpDeviceEventWorker+0x2d8 [minkernel\ntos\io\pnpmgr\event.c @ 1821]
    nt!ExpWorkerThread+0x105 [minkernel\ntos\ex\worker.c @ 4315]
    nt!PspSystemThreadStartup+0x55 [minkernel\ntos\ps\psexec.c @ 9310]
    nt!KiStartSystemThread+0x2a [minkernel\ntos\ke\amd64\threadbg.asm @ 83]

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,583

    Sooooo... you’re hanging in your WDDM driver’s unload entry point...


    Peter Viscarola

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Writing WDF Drivers 21 Oct 2019 OSR Seminar Space & ONLINE
Internals & Software Drivers 18 Nov 2019 Dulles, VA
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 27 Apr 2020 OSR Seminar Space & ONLINE