My application needs two COM DLLs to be registered. It is done automatically if the user has the necessary access rights, but otherwise it can be done using regsvr32.
Now on a few workstations the following happens:
- Start
cmd.exeas Administrator - Register first DLL: Success
- Register second DLL: Failure (0x80004005, Access denied)
The first time this error was reported to me, I automatically responded: “Of course it doesn’t work, you need Administrator privileges.” Needless to say, I felt pretty embarrassed as I tried to register the DLL myself…
What could be the reason for this: One DLL can be registered, the other not.
Some background information:
- Both DLLs are created with Delphi 2005.
- Both DLLs have very simple interfaces and only very few classes.
- The failing machines were always Vista or Windows 7.
Normally I’d start Process Monitor, but I don’t have access to one of the workstations right now, so I have to gather as much information as possible until I can get my hands on one of them.
UPDATE: I remotely accessed one of the failing workstations. Mysterious things happened:
- Starting Process Monitor was not possible (!) After a few seconds Windows showed a “not enough memory” error.
- Switching to a different user made it possible to register the DLL. (!)
In other words:
- Log on as
UserA, startcmd.exeas Administrator,regsvr32.exe: Failure - Log on as
UserB, startcmd.exeas Administrator,regsvr32.exe: Success
What could introduce such behaviour?!
Couple of things to try and check for:
Update
Based on your comment, it looks that failed registration attempt as a regular user is leaving the machine in a messed up state. It’s something either in
HKCU\Software\Classes(the per-user mapping of the HKCR) or inHKCR\VirtualStore\MACHINE\SOFTWARE(the virtualized HKLM). You need to determine exactly what is being left in the registry upon unsuccessful registration attempt.I would run process explorer on a clean machine and attempt non-elevated registration to take a snapshot.
Also, try getting the machine in such a state and then run non-elevated unregister. In the ideal case this should “fix” the machine. If that works, you have a quick workaround you can give to your users while you are working on the proper fix.