How does Windows Installer close an application during uninstall?

試著忘記壹切 提交于 2019-12-08 07:21:12

问题


When uninstalling my application, it attempts to stop it if it's running:

Sadly, the automatically closing doesn't really work and it displays this error:

My applications disappear, the windows, the tray bar icon, they are all gone. But I can still see them in the process list.

I'm guessing Windows sends a signal to the applications to exit gracefully and the UI does so, but there's some lingering thread preventing the processes from terminating.

How does Windows Installer close an application during uninstall?

Once I know this I want to simulate it while debugging my app to see what's going on. Is this a sound plan?


回答1:


Since Windows Vista, Windows Installer will leverage the Restart Manager to identify, close, and restart applications. Microsoft's documentation on Using Restart Manager, and in particular Using Restart Manager with a Primary Installer should be a solid starting point for implementing a test harness. Your applications and services should instead follow the Guidelines for Applications and Services.

The Guidelines for Applications discuss the messages sent to your application by the restart manager; services are restarted through the service control manager. In theory you could simulate the restart manager at that level, but I suspect you'd be better served by invoking the real thing, registering a carefully chosen list of resources to target just your application, if possible.



来源:https://stackoverflow.com/questions/50274420/how-does-windows-installer-close-an-application-during-uninstall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!