-
-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ServerRegistrationManager class not mentioned in docs/tutorials? #398
Comments
I looked at the source code for Server Manager to figure out the bits needed to install/uninstall/register/unregister. It wasn't very complicated, the main things you need are ServerRegistrationManager.InstallServer, UninstallServer, RegisterServer and UnregisterServer. But you'll also probably need some code from Server Manager itself relating to listing the servers contained in a DLL, since you can't pass the DLL path directly to these functions. |
In the end I ended up with this helper class, which takes care of everything (you only need to call 2 functions in your code, InstallAndRegisterShellEx and UninstallAndUnregisterShellEx, though I've added some other useful functions like ShellExIsInstalled)
Here is the helper class: https://pastebin.com/vqDU1pfC Additionally, you'll need 2 files from Server Manager. ServerEntry.cs and ServerManagerApi.cs. They are both here: https://github.com/dwmkerr/sharpshell/tree/main/SharpShell/Tools/ServerManager Excuse some things being hardcoded, I spent all day working on getting this working and when I finally found a potential fix I just wanted to get it working as quickly as possible, not spend even more time on something that I wasn't yet sure would even work. I might take the time to do it properly at a later time, but not today. |
So, I've been following SharpShell documentation to make a Context Menu handler, and it has said that you use either
regasm.exe
orsrm.exe
to register your COM servers with the system.I cannot expect my endusers to install the NET SDK, nor can I expect them to download SharpShell Tools, and I would imagine most users of the library can't. So I painstakingly simulated the actions of
regasm.exe
in a custom function that I cobbled together from StackOverflow and my own research on whatregasm
does, via Process Monitor.And now that I got it all working, I find a class called
ServerRegistrationManager
in the SharpShell code, which seems to do exactly what I needed all along, but has not been mentioned by any of the tutorial/doc material?Am I misunderstanding, and this is not actually intended for my purposes, or have I just wasted my time?
I do notice that, at a glance, it does not seem to offer the option to register the COM server to HKCU/Software/Classes instead of HKCR, which means it unnecessarily requires administrator mode...
The text was updated successfully, but these errors were encountered: