开发者

Can a Service Write to Registry [HKLM]

开发者 https://www.devze.com 2023-01-11 01:52 出处:网络
I am writing a service for Windows Vista/7 which needs read/write/delete access to the registry key HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons

I am writing a service for Windows Vista/7 which needs read/write/delete access to the registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons

Ar开发者_开发知识库e there any special considerations I must make just in case the target system has UAC enabled and the service must always run with administrator privileges?

The service is being written in VB.NET but C# code is welcome.

Thanks


User Account Control (UAC) only applies to users who are logged on interactively. A windows service will have the full security token (as opposed to the restricted one UAC generates for non-standard account users) available to it.

If your service is running as either Administrator, a member of the Administrators group or LOCALSYSTEM, it should have unrestricted access to HKLM. The only thing you may need to be aware of is registry redirection for 32bit processes running on 64bit Windows.


The only issue to consider is that the service must run under an account that has Registry read/write/delete access to the specified key.

0

精彩评论

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

关注公众号