简体   繁体   English

Windows在应用程序崩溃时关闭内核句柄所需的时间

[英]how long it takes for kernel handles to close by Windows when an application crashes

I know Windows close kernel handles when an application crashes, but if I want to wait on this event, can I be sure it will happen in milisec or it might take a while? 我知道Windows关闭内核会在应用程序崩溃时进行处理,但是如果我想等待此事件,可以确定它会在毫秒内发生还是会花费一些时间? I would like to trigger a new function the moment one application is crashed and I'm checking if this handle is NULL but it seems like I can't get a NULL value in this case. 我想在一个应用程序崩溃时触发一个新函数,并且我正在检查此句柄是否为NULL,但在这种情况下似乎无法获得NULL值。

How long it will take may vary depending upon many factors including implementation, type of crash, etc. It might take awhile. 所需的时间可能取决于许多因素,包括实现,崩溃类型等。它可能需要一段时间。

If you want to know when a process has crashed, you should set up a "watchdog" thread or process that waits on the application's Process Handle , using a function such as WaitForSingleObject . 如果您想知道某个进程何时崩溃,则应该使用诸如WaitForSingleObject之类的函数来设置一个“看门狗”线程或等待应用程序的Process Handle进程 When the process dies, the event will be signaled and you can act accordingly. 流程结束后,将发出事件信号,您可以采取相应措施。

Windows does not close handles when an application "crashes" - it closes them when the process terminates, no matter how the process terminates. 当应用程序“崩溃”时,Windows不会关闭句柄-进程终止时,无论进程如何终止,Windows都会关闭句柄。 By the time this happens the variables don't exist any more because the user mode address space has been shut down. 到这种情况发生时,变量已不存在,因为用户模式地址空间已关闭。

What are you trying to do? 你想做什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当应用程序崩溃时,打开句柄会发生什么? (从Windows XP开始) - What happens to open handles when an application crashes? (Windows XP onwards) 如何枚举内核中指定进程的所有打开句柄(Windows) - How to enumerate all opened handles of specified process in kernel (Windows) 应用程序崩溃时如何生成 Windows 内存转储。? - How to generate windows memory dump when application crashes.? 事件发生时如何启动线程并正确关闭其句柄 - How to start a thread when an event occurs and close their handles crrectly 如何以编程方式关闭Windows 8应用程序? - How to close a Windows 8 application programmatically? 如何在程序崩溃时仅关闭程序,而没有任何警告屏幕等…C ++ Windows - How to just close a program when it crashes, without any warning screens, etc … C++ Windows 当我关闭应用程序时,CocosDension在Windows上崩溃 - CocosDension crashing on Windows when I close the application 运行 windows 卸载程序时关闭应用程序 - Close application when running windows uninstaller 如何在Windows中以编程方式关闭打开的文件/应用程序? - How to programmatically close an open file/application in windows? 正确注册使用Windows处理网站的应用程序 - Properly registering an application that handles websites with windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM