Subject off-top: Reading registry entries in win 2000 with service
Author Luiz Alves
I am writing an service app to win 2000 and in a service I need
read values of the windows registry to set the name to smtp server.

I create the keys on event after Install of the service and I used a
separate app to configure the keys on registry. In this app, I can read and
write the keys normally. Until here all right.

The problem is when I put the same code in a Service.

In the event OnStart of the service, I try:

with TRegIniFile.Create( 'Software\NewhospCS\ChatPlug' ) do begin
try
sMyKey:=ReadString( 'Chaves', 'PLUG','NewHosp Adm' );
finally
free;
end;
end;

I use then LogMessage procedure to see this value of sMyKey, but the problem
is that "sMyKey" always is '', although there is a value in this key.

If I use this code into a normal app(not a service) in win 2000, all works
correct and the value of sMyKey is obtained.

If I run the service into a user account, I can read from register.

Does someone has a sample about how read windows registry in a service start
up, when it's runnning as local system account?

Thanks in Advance,

Luiz.