How to register a COM object for all users

I am using regsvr32 MyCOM.dll to register my com object for my application. This works fine under my admin account. if the user switches to non-admin, the program will fail. It seems that the COM object is not loaded for a non-admin user. Any ideas on why this might be or a possible solution?

+6
source share
2 answers

COM objects should be registered by the administrator user, as a rule. (There are subtleties and exceptions that I will not get here, because based on your description, this is not what happens.)

However, once a COM object has been registered, all users should be able to use it, provided that the object has been registered with the appropriate permissions.

+6
source

regsvr32 MyCOM.dll will call the dllRegisterServer function exported to dll, which happens to dll. Usually it logs the CLSID and other registration information in the HKEY_LOCAL_MACHINE \ software \ Classes section (the same as HKEY_CLASSES_ROOT for write operations), so the registration should be visible to each user if the user does not have conflicting registration in HKEY_CURRENT_USER \ software \ Classes.

I assume that registration is not a problem, but your COM object does something that prevents it from being downloaded for non-administrators (request for write access to the key under HKEY_LOCAL_MACHINE, etc.). You can use Process Monitor and look for ACCESS_DENIED errors and see if this gives any hints.

Another option is to manually register the object under HKEY_CURRENT_USER \ software \ Classes for a user who is not an administrator. This should eliminate registration problems.

+8
source

Source: https://habr.com/ru/post/885916/