Max_Headroom
Posts: 7
Joined: Sun May 01, 2022 12:29 pm

Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Sun May 01, 2022 12:55 pm

I am just trialing Advanced Installer so I'm a novice with this tool and also a novice developer.

I have created a shell extension for Windows using SharpShell. The creators of SharpShell recommend using their ServerRegistrationManager.exe to register the DLL and that works fine when run in a CMD window with:

Code: Select all

ServerRegistrationManager.exe install shellextension.dll -codebase
I am using the Custom Action "LaunchFile" to call the EXE and moved its execution stage to be after 'Finish Execution'.

I have set the parameters to:

File to launch: [#ServerRegistrationManager.exe]
Command line: install [shellextension.dll] -codebase
Working directory: [Installable_Dir]

I have ticked the option to 'Run as Administrator' but changing this seem to make no difference.

The MSI runs fine and installs and uninstalls all the required files without a problem, but whilst I can see it running the ServerRegistrationManager.exe, the DLL is not registered.

BTW in the "Execution Time" section I get the feeling that I should select 'After the system has been successfully modified (commit)' , but this and the other options are greyed out so that 'Immediately' is selected and can't be changed.

What am I doing wrong?

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Mon May 02, 2022 7:21 am

Hello and welcome to our forums,

Please note that we have predefined support to register DLL files.

To achieve that, please have a look on our How do I register a file? FAQ. In the "Files and Folders" page just right click on your file "Properties" --> "Registration" tab.

Hope that helps! Please let me know if you have any questions.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Max_Headroom
Posts: 7
Joined: Sun May 01, 2022 12:29 pm

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Mon May 02, 2022 12:23 pm

Many thanks for the advice.

So I have deleted my Custom Action and at the same time I realised that your built-in methods to invoke REGASM rendered the calls to ServerRegistrationManager.exe redundant. So with renewed hope I followed the guidance on registering a DLL and:

Doubled-clicked on the DLL
Selected 'Auto register file (DLL, OCX, etc)'
I left the other settings with their defaults.

When I run the resultant MSI I don't get any errors but it hasn't registered the DLL correctly because the shell extension does not appear.

NOTE: as a test I then manually ran the following in a command window running as Administrator and it registered fine:

Code: Select all

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /codebase CloudFilerExtension.dll
So to my inexperienced eye, it looks like it's either failing to run regasm or there's an issue with user permissions when running regasm.

I have attached my AIP file.

Where am I going wrong?
Attachments
CloudFiler Shell Extension.aip
(23.52KiB)Downloaded 170 times

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Mon May 02, 2022 1:04 pm

Hello,

Please disregard my last reply, I somehow overlooked this part: "The creators of SharpShell recommend using their ServerRegistrationManager.exe to register the DLL"

In order to achieve this, you can use your first approach with the custom action.

All resources are installed on the target machine during Add Resources action group. The "LaunchFile" custom action needs to be added after the "Add Resources" action group and then can be scheduled to run on "deferred" execution time. Also, you need to pass the filename into the "Command line" filed with the "#" character. Or you can type "[" in the field and then pick your file using "File" option.
file.png
file.png (5.19KiB)Viewed 3473 times
CA .png
CA .png (177.39KiB)Viewed 3473 times


Please let me know if that helped.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Max_Headroom
Posts: 7
Joined: Sun May 01, 2022 12:29 pm

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Mon May 02, 2022 3:12 pm

Hmm, I tried that but whilst the MSI runs happily the shell extension is not registered.

BTW whilst I'm happy to use the ServerRegistrationManager.exe, I pretty convinced that it's not required as running REGASM from the command prompt works fine. So I still suspect it's something to do with either permissions or the sequence of events i.e. the shell extension DLL is not present when the attempt to register it is invoked.

Here's a screen shot of my settings:
a1CW5vec0R.png
a1CW5vec0R.png (57.28KiB)Viewed 3471 times
I have tried so many variations so I'm hoping that someone will spot a silly error somewhere.

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Tue May 03, 2022 8:55 am

Hello,

This is quite strange, but it may fail to register the file under the LocalSystem account.

Can you please check the "Run as administrator" option for the custom action, and also uncheck the "Run under the LocalSystem account" option.

Otherwise, if that does not work, in order for us to further investigate this, can you please forward to us the following resources:

1. the newest .AIP file.
2. a download link for your setup package.

file by email to support at advancedinstaller dot com?

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Max_Headroom
Posts: 7
Joined: Sun May 01, 2022 12:29 pm

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Tue May 03, 2022 9:41 am

Thanks Liviu, it didn't work so I have emailed the files to you.

Max_Headroom
Posts: 7
Joined: Sun May 01, 2022 12:29 pm

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Wed May 04, 2022 9:21 am

BTW, I didn't want to mention this before as it felt like it would just complicate the whole picture, but when I was first experimenting with Advanced Installer I followed some advice on this forum to use the "Launch File" custom action and I was pleased to find that the installation AND registration worked fine. I then noticed that there is a "Launch attached file" and "Launch installed file" and felt that it would be wise to give those a try to see if they provided anything better. I don't recall whether I tried both, I believe that I only tried the "Launch installed file" but, not only didn't that work it also found that when I reverted to using the "Launch File" method it still wouldn't register the DLL.

I hope this helps.

Did you manage to take a look at the files I emailed through?

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Wed May 04, 2022 10:30 am

Hello Alec,

I have replied to you over the email.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Max_Headroom
Posts: 7
Joined: Sun May 01, 2022 12:29 pm

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Wed May 04, 2022 6:23 pm

All thanks to Liviu, I now have this working and would like to share it for the benefit of others.

Despite many attempted to register my DLL using REGASM alone, I just couldn't get it to work, but thankfully the ServerRegistrationManager.exe that comes with SharpShell does it all fine as long as you get the calling methods right.

So here is how to register your DLL. Note the /c which causes the CMD window to automatically close, and the quotes:
icWq2WAhGW.png
icWq2WAhGW.png (55.58KiB)Viewed 3428 times
Here is how to then un-install the DLL:
rbmGBO2dWi.png
rbmGBO2dWi.png (57.24KiB)Viewed 3428 times

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Calling ServerRegistrationManager.exe to register a shell extension DLL in Windows

Thu May 05, 2022 7:21 am

Hello Alec,

I'm glad you got this working. Thank you for your follow-up on this and for sharing it with us!

I am sure this will be of help for other users facing a similar scenario.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”