Non Admin Registration
Registering a DLL without admin rights.
Permissions
The registry is key to the operation of windows so although all users can read the content, most areas are protected from normal users and require administration priviledges.
The user can freely read/write the HKCU.
This creates an issue when trying to register a DLL as RegAsm can only normally be used register a DLL for the local machine (HKLM)which requires local admin rights and this is often not available.
For a non-admin user the requirement is to register the DLL within HKCU. RegAsm doesn't provide that option directly, however, with a little thought RegAsm can be used to create a file that would reflect the registry keys to be created in HKLM. This file can then be edited to change the location where the keys are to be installed, i.e. within HKCU.
Non-admin developers building DLL
When developing a COM DLL there is an option within tools such as VS to "Register COM for Interop", however if the tool is not running with elevated (admin) rights when the DLL is built there will be a failure to register the DLL. will be
One approach is:
- Not check the register option
- Create the DLL then register as above using RegAsm - and provided that no changes to the location or public classes within the DLL it will continue to be available. Any changes to name, location, public classes and the DLL should be registered again.
A standard user can add, modify and delete keys from HKCU using the Reg command (note this is a command that is also used in the WXS files).
So supporting the registration of a DLL ONLY requires a knowledge of the keys to set. Fortunately, use can be made of RegAsm to create a file which specifies the keys that need to be set. This file can be manually modified to place the keys in the correct part of the registry and then imported using RegEdit, and hence support the needs of a Non-admin user. Not straightforward but possible as illustrated in an example of non-admin registration