开发者

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

开发者 https://www.devze.com 2023-01-14 23:04 出处:网络
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 star

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 the开发者_如何学运维re 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++.

0

精彩评论

暂无评论...
验证码 换一张
取 消