Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Add event on MSiRMFilesInUse dialog is not working.

Fri Jan 12, 2024 8:33 am

Hi,
I met a problem is that at uninstallaion stage even i choose automatically close the application in MsiRMFilesInUse dialog, but the application that in used didn't auto close and the uninstallation process is still finished.
So I add a custom action to terminate process and set its condition as "AppsShutdownOption = "All" when user select auto close and click the ok button in MsiRMFilesInUse dialog, see attached files.
But the terminate process custom actin seems not execute.
Could anyone tell me how to terminate the process when user choose automatically close then click ok button?

Thanks!
Best Regards,
Justin
Attachments
2.png
2.png (40.29KiB)Viewed 33609 times
1.png
1.png (95.03KiB)Viewed 33609 times

Catalin
Posts: 6506
Joined: Wed Jun 13, 2018 7:49 am

Re: Add event on MSiRMFilesInUse dialog is not working.

Mon Jan 15, 2024 1:16 pm

Hello Justin,

If you want to stop an application so that the FileInUse Dialog is skipped, then the Stop Process action should be scheduled before InstallValidate (in "Custom Actions" page that would be before the "Preparing" action group).

I think this would be the best approach as I'm not quite sure that dialog (which is a Windows Installer dialog) is able to execute events.

I would advise adding some UI (e.g. a MessageBox custom action) to the same button to see whether the actions are executed or not. If the MessageBox is spawned, then it means the Stop Process custom action also executes but perhaps is unable to stop the process.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Add event on MSiRMFilesInUse dialog is not working.

Tue Jan 16, 2024 7:48 am

Hi Catalin,

Thanks for your reply. As your suggestion, I added a MessageBox as custom action event in MsiRMFilesInUse dialog but it didn't triggered and the MsiRMFilesInUse dialog is coming from windows.
So does it mean that I have to close application before the dialog display (before InstallValidate), and ignore the user's intent to close the application or not?

Thanks!!
Best Regards,
Justin

Catalin
Posts: 6506
Joined: Wed Jun 13, 2018 7:49 am

Re: Add event on MSiRMFilesInUse dialog is not working.

Tue Jan 16, 2024 1:12 pm

Hello Justin,
As your suggestion, I added a MessageBox as custom action event in MsiRMFilesInUse dialog but it didn't triggered and the MsiRMFilesInUse dialog is coming from windows.
Unfortunately, that's what I was afraid of.

That dialog is quite special from what I've noticed when it comes to Windows Installer, so I was thinking that executing an event on one of its' buttons will not work.
So does it mean that I have to close application before the dialog display (before InstallValidate), and ignore the user's intent to close the application or not?
That's exactly right. This dialog is spawned by the InstallValidate action and therefore if the applications are stopped before then the Reboot dialog should no longer appear.

There is one little corner case here which I remember and that is if the process that you need to stop requires admin privileges, then you need to provide those from the very beginning.

I will try to explain this as simple as possible. If you go to "Custom Actions" page and right click on the Action Groups --> "Show Standard Action" --> "Preparing" you will see that InstallValidate action resides there.

The Preparing action group is also when the installation stage goes from immediate to deferred - before the Preparing action group, you can not have a deferred action.

Now, in Windows Installer, only a deferred action can be elevated (through the "Run under the LocalSystem account with full privileges" option) because there's a "best practice" in place that only deferred actions should modify the system (e.g. add new files, remove some files, add registry entries, create services, etc.).

So, if what you want to stop is something that requires admin privileges (e.g. a service) then we might reach this corner case.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Add event on MSiRMFilesInUse dialog is not working.

Wed Jan 17, 2024 3:12 am

Hello Catalin,

Thanks for your prompt reply and detailed explanation.

Cheeer,
Best Regards,
Justin

Catalin
Posts: 6506
Joined: Wed Jun 13, 2018 7:49 am

Re: Add event on MSiRMFilesInUse dialog is not working.

Thu Jan 18, 2024 2:37 pm

You are always welcome, Justin!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”