Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop a Delphi 6 COM server application re-registering with COM at startup

I have a set of legacy Delphi 6 aplications that are out of process COM servers. In attempting to run these programs as a normal domain user on Windows I see them when running up (without any command line arguments or switches) attempting to update chunks of HKEY_CURRENT_CLASSES. this fails due to lac of permission to the HKCR hive. It appears that the act of running a Delphi 6 COM server causes it to attempt to register its embedded COM types with the system registry.

I do not want this behavior normally. We would do this once during install under and adminatrative account to initalise the COM registry, but would not want to do this under normal running conditions of a non adminastrative account. (if you moniroy the system with sys internals process monitor you can see the failed registry key access attempts).

Is there a command line switch I can pass to a Delphi 6 COM server to prevent this automatic COM registrtion logic?

like image 780
Pete Stensønes Avatar asked Feb 25 '23 13:02

Pete Stensønes


2 Answers

I don't think you're actually seeing what you think you are...

Delphi only tries to install COM servers if they haven't already been installed. I suspect what you're seeing is your application checking to see if it's registered yet or not. The reason you're seeing the failures is because back in Delphi 6 the registry key would have been opened with ALL_ACCESS rights (D6 was prior to XP/Vista/Win7), and I think that's what's causing your failed registry access attempts.

In answer to your question, though: No, there's no command line switch to prevent the automatic registration logic.

like image 93
Ken White Avatar answered Feb 27 '23 02:02

Ken White


It will always try to register the server from TComServer.Initialize unless the startup parameter is /UNREGSERVER which will remove the registry settings. If the startup parameter is /REGSERVER you will get an exception if the registration failed otherwise it will just swallow the exception. Automatic registration of out-proc COM servers has been removed in later version of Delphi. The only option you have to remove this behavior in Delphi 6 is to modify TComServer.Inititalize to only register the server when FStartMode is smRegServer or smUnregServer.

like image 33
Mikael Eriksson Avatar answered Feb 27 '23 01:02

Mikael Eriksson