p.magalhaes
p.magalhaes

Reputation: 8374

Writing/Read Windows Registry - Windows Service

I develop a Windows Service that will run under SYSTEM user. So I want to make a installer to configure this service. The installer will create entries in the windows registry.

When the Windows Service starts it will to read these entries, generated by the installer.

This entries will point to a Config File, and where to store the log files of the service. Which key Do I need to write/read to make this work? I am worried about permissions.

Is it in the CURRENT_USER key?

I develop the Windows Service in Delphi.

Thanks,

Upvotes: 2

Views: 1564

Answers (1)

Ian Boyd
Ian Boyd

Reputation: 256711

Remy's comment is correct.

The SYSTEM account does not have their own HKEY_CURRENT_USER registry hive.

You should be storing configuration information in HKEY_LOCAL_MACHINE, or in your own custom xml configuration file in your AppData directory.

Side note: i believe that attempts to use HKEY_CURRENT_USER when no profile hive is loaded will get you HKEY_USERS/.DEFAULT; which isn't something you want to be using.

Upvotes: 1

Related Questions