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.
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++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With