如何模拟Windows关机进行调试?Windows

2023-09-02 12:01:10 作者:一场一个人的私奔

我有一个问题,我的应用程序时,Windows关闭 - 我的应用程序没有很好地退出,导致结束任务窗口中显示。我如何使用调试器来看看这是怎么回事?

I have an issue with my application when Windows shuts down - my app isn't exiting nicely, resulting in the End Task window being displayed. How can I use the debugger to see what's going on?

有没有一种方法,因此认为关闭Windows发送Windows关机消息(S)我的应用程序,这样我就可以清楚地看到它的行为?

Is there a way to send the Windows shutdown message(s) to my application so it thinks Windows is shutting down, so I can see exactly how it behaves?

推荐答案

有一个在微软的徽标测试工具的Windows,它可以用来发送关机和重启的消息到指定的重启管理器(rmtool.exe)的工具处理。徽标测试工具可以在这里下载:

There is a tool named Restart Manager (rmtool.exe) in the Microsoft's Logo Testing Tools for Windows, which can be used to send shutdown and restart messages to a process. Logo testing tools can be downloaded here:

http://download.microsoft.com/download/d/2/5/d2522ce4-a441-459d-8302-be8f3321823c/LogoToolsv1.0.msi

然后就可以关闭模​​拟为您的流程:

Then you can simulate shutdown for your process:

rmtool.exe -p [PID] -S

其中[PID]是进程ID。按照Vista徽标认证测试用例文档,

where [PID] is the process ID. According to the Vista Logo Certification Test Cases document,

重启管理器关闭的消息是:

Restart Manager shutdown messages are:

一个。 WM_QUERYENDSESSION与LPARAM = ENDSESSION_CLOSEAPP(为0x1)。GUI应用程序必须响应(TRUE)立即向prepare为重启

a. WM_QUERYENDSESSION with LPARAM = ENDSESSION_CLOSEAPP(0x1): GUI applications must respond (TRUE) immediately to prepare for a restart.

乙。 WM_ENDSESSION与LPARAM = ENDSESSION_CLOSEAPP(为0x1):5秒内应用程序必须关机(20秒服务)

b. WM_ENDSESSION with LPARAM = ENDSESSION_CLOSEAPP(0x1): The application must shutdown within 5 seconds (20 seconds for services).

℃。 CTRL_SHUTDOWN_EVENT:控制台应用程序必须立即关闭

c. CTRL_SHUTDOWN_EVENT: Console applications must shutdown immediately.

 
精彩推荐
图片推荐