Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can a service running under the "local service" account save its state

I have a windows service (actually a serviced component) implemented in native C++. I want to be able to run it using the NT AUTHORITY/LOCAL SERVICE account but I want it to be able to store some startup-state information somewhere. Is there somewhere that the local service account has write access to? As far as I can tell, the built-in accounts don't get home directories like normal user accounts do.

like image 522
Pacman Avatar asked Sep 03 '10 16:09

Pacman


1 Answers

In Windows XP, the LOCAL SERVICE account does have a home directory in Documents and Settings. In Vista/7, the LocalService account (along with other SYSTEM accounts) stores its data (by default) in C:\ProgramData.

You can access the folder in C# like:

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);

So I assume you would access it in a similar way in C++.

like image 139
palswim Avatar answered Oct 23 '22 05:10

palswim