How does Windows Installer close an application during uninstall?
Asked Answered
L

1

2

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

enter image description here

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

enter image description here

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?

Looksee answered 10/5, 2018 at 13:46 Comment(10)
I'm curious how you solve this. I did a quick google search and couldn't come up with any good articles on implementing win32 specific restart manager interactions in a java application.Alpers
@ChristopherPainter: I haven't started working on it yet. Michael Urman posted a lot of sources that I need to read, process, understand and then I'll take a stab at fixing this. It somehow doesn't surprise me this is an issue as Java for the desktop is essentially abandonware.Looksee
This may be one situation where it's ok to just use a QuietExecuteCA to TASKKILL the process.Alpers
I've seen people try to do multiplatform for a couple decades now (my attempt was in PowersBuilder back in the 90s) and it's never quiet worked for me. I'm not a Java guy but I came across some threads that suggested using JNA. I found this link that does some kind of interaction with the Restart Manager. It's all greek to me though. javatips.net/api/com.sun.jna.ptr.longbyreferenceAlpers
My most recent multiplatform attempts have been with Electron. You might find this funny or depressing. github.com/electron/electron/issues/3387Alpers
I tried working with electron. I found it slow, memory hungry and Javascript has a lot of issues. Even using a saner language that compiles to it, having to use an event based model instead of proper multithreading was really annoying. To the point that I abandoned for Java. I think I should have just switched to dot net.Looksee
Dotnet. You said it not me. ;) (I didn't want to be rude.) I'm surrounded by people with opinions... Electron wasn't my choice. I understand why people want HTML/JS everywhere .....full stack all platforms but my preference is to create an optimzied experience for each platform.Alpers
@ChristopherPainter: I think that after a lot of head banging against win32 brick walls, I managed to get a Java Restart Manager working. I'm planning on writing down my findings in my blog. If I haven't done it after a while, feel free to prod me.Looksee
Blog post found: flexpoint.tech/2018/05/21/… But I'm not sure how to test this efficiently. Could someone comment if this would help: nishy-software.com/en/restart-manager-test-toolPrecautious
@Dale: I wrote that blog post ;)Looksee
A
6

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.

Alburnum answered 10/5, 2018 at 14:1 Comment(1)
Well... that was a deep rabbit hole to go into. Starting from this and piecing together many other posts and source code I found, I managed to implement Restart Manager on Java. I'm thinking of making a blog post about it. I'll post the link when that's done for anyone interested.Looksee

© 2022 - 2024 — McMap. All rights reserved.