Driver Problems? Questions? Issues?
Put OSR's experience to work for you! Contact us for assistance with:
  • Creating the right design for your requirements
  • Reviewing your existing driver code
  • Analyzing driver reliability/performance issues
  • Custom training mixed with consulting and focused directly on your specific areas of interest/concern.
Check us out. OSR, the Windows driver experts.

OSR Seminars


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 3  
10 Jan 18 23:57
Vishnu Karthik
xxxxxx@gmail.com
Join Date: 25 Oct 2016
Posts To This List: 5
User Mode Application never exits

Hi, I have written a user mode application which has a main thread and that thread creates a child thread. The child thread makes an IOCTL call and waits in the kernel driver on a wait event. When the execution reaches the end of application, I see the app just hangs forever. Looking at the pending call stacks, I see only the child thread waiting on the event and the main thread has exited cleanly. The child thread is waiting on an event like this: KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, NULL); When the app is going to terminate, shouldn't the child thread waiting on the event get alerted since I have set Alertable = TRUE? Once I receive the STATUS_ALERTED return value, I will go ahead and terminate the child thread as well. But for some reason, the child thread is not coming out of wait. Is there anything that I am missing?
  Message 2 of 3  
11 Jan 18 03:07
Tim Roberts
xxxxxx@probo.com
Join Date: 28 Jan 2005
Posts To This List: 11997
User Mode Application never exits

On Jan 10, 2018, at 8:57 PM, xxxxx@gmail.com <xxxxx@lists.osr.com> wrote: > > I have written a user mode application which has a main thread and that thread creates a child thread. The child thread makes an IOCTL call and waits in the kernel driver on a wait event. That's not a good design, for exactly this reason. Can't you just submit an ioctl, pend it in the driver, and have the user-mode thread wait on the event? ??? Tim Roberts, xxxxx@probo.com Providenza & Boekelheide, Inc.
  Message 3 of 3  
11 Jan 18 14:13
M M
xxxxxx@hotmail.com
Join Date: 21 Oct 2010
Posts To This List: 767
User Mode Application never exits

I don?t think you understand how alertable waits and APCs are supposed to work https://msdn.microsoft.com/en-us/library/windows/desktop/ms681951(v=vs.85).aspx probably what you want to do is call SetEvent or CloseHandle or CancelIoEx to wake up your worker thread you could even call ExitProcess if you really wanted to Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 ________________________________ From: xxxxx@lists.osr.com <xxxxx@lists.osr.com> on behalf of xxxxx@gmail.com <xxxxx@lists.osr.com> Sent: Wednesday, January 10, 2018 11:57:11 PM To: Windows System Software Devs Interest List Subject: [ntdev] User Mode Application never exits Hi, I have written a user mode application which has a main thread and that thread creates a child thread. The child thread makes an IOCTL call and waits in the kernel driver on a wait event. When the execution reaches the end of application, I see the app just hangs forever. Looking at the pending call stacks, I see only the child thread waiting on the event and the main thread has exited cleanly. The child thread is waiting on an event like this: KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, NULL); When the app is going to terminate, shouldn't the child thread waiting on the event get alerted since I have set Alertable = TRUE? Once I receive the STATUS_ALERTED return value, I will go ahead and terminate the child thread as well. But for some reason, the child thread is not coming out of wait. Is there anything that I am missing? --- NTDEV is sponsored by OSR Visit the list online at: <http://www.osronline.com/showlists.cfm?list=ntdev> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at <http://www.osr.com/seminars> To unsubscribe, visit the List Server section of OSR Online at <http://www.osronline.com/page.cfm?name=ListServer> --
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 02:42.


Copyright ©2015, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license