如何访问HKCU注册表当前登录的用户(S),从服务? [英] How to access HKCU registry of currently logged on user(s), from a service?

查看:375
本文介绍了如何访问HKCU注册表当前登录的用户(S),从服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从内我要检查存储每个用户的HKCU注册表区域内的一些用户preferences一个窗口服务。我怎样才能做到这一点?

From within a windows service I want to check some user preferences that are stored within each users' HKCU registry area. How can I do this?

我看到HKEY_USERS具有已登录到机器的每个用户的子项(或类似的东西?),并在这些是HKCU区域为每个用户。然而,这些子项是用户的SID,所以某种程度上我需要工作,当前登录的用户(S)出来的SID。

I see that HKEY_USERS has subkeys of each user that has logged in to the machine (or something like that?), and within these are the HKCU areas for each user. However, these subkeys are the SIDs of the users, so somehow I'd need to work out the SID of the currently logged in user(s).

然后,我会查询 HKEY_USERS \<保证用户的SID> \取其\键\ I \需到位查询的 HKEY_CURRENT_USER \为准\键\ I \需

I would then query HKEY_USERS\<the users SID>\whichever\key\i\need in place of querying HKEY_CURRENT_USER\whichever\key\i\need.

从<一个href="http://stackoverflow.com/questions/2077958/how-to-determine-the-current-windows-user-from-a-windows-service">this问题我可以得到该机在域\用户格式,在当前的用户列表。有没有一种方法来获取用户的SID,从他们的Windows登录?还是有更直接的方式来获得的注册表路径是HKCU为当前登录的用户(S)?

From this question I can get a list of the current users on the machine in DOMAIN\USER format. Is there a way to get the SID of a user from their windows login? Or is there a more direct way to get the registry path that is HKCU for the currently logged in user(s)?

推荐答案

下面是转换用户名的SID的一个例子:<一href="http://stackoverflow.com/questions/1040623/convert-a-username-to-a-sid-string-in-c-net">http://stackoverflow.com/questions/1040623/convert-a-username-to-a-sid-string-in-c-net

Here's an example of converting a username to SID: http://stackoverflow.com/questions/1040623/convert-a-username-to-a-sid-string-in-c-net

这篇关于如何访问HKCU注册表当前登录的用户(S),从服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆