Windows中用户配置文件的唯一标识符 [英] Unique identifier for user profiles in Windows
问题描述
对于客户机/服务器应用程序,我需要集中存储通常进入用户配置文件目录的部分配置信息.
For a client/server application I need to centrally store parts of the configuration information that usually goes into the users profile directory.
客户端应用程序将首先使用带有GUID的文件或注册表项写入当前配置文件.此GUID随后将用作服务器上配置数据库中的密钥.
The client application would on first use write a file or registry entry with a GUID into the current profile. This GUID would subsequently be used as a key in the configuration database on the server.
现在,我想知道Windows用户配置文件是否已经具有可用于代替生成自己的GUID的唯一标识符.
Now I'm wondering if Windows user profiles already have unique identifiers I could use instead of generating my own GUIDs.
用户名可能无效,因为用户可能有多个配置文件.将其与计算机名称结合使用将不起作用,因为可能会有漫游配置文件.
The username won't work because users might have multiple profiles. Combining it with the computer name won't work because there might be roaming profiles.
更新:
我只是在同一域中的两台计算机上查看了HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList
中的SID.没有启用漫游,因此我的用户帐户在每台计算机上都有一个单独的配置文件.这两个配置文件都列出了相同的SID.这意味着我必须继续生成自己的GUID.
I just looked at the SIDs in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList
on two computers in the same domain. Roaming is not enabled, so my user account has a separate profile on each machine. Both profiles are listed with the same SID. This means I have to keep generating my own GUIDs.
推荐答案
Windows用户和组使用安全标识符(SID).
Windows users and groups use security identifiers (SIDs).
安全标识符(SID)是 可变长度的唯一值 用于识别证券 Windows中的主体或安全组 操作系统.
A security identifier (SID) is a unique value of variable length that is used to identify a security principal or security group in Windows operating systems.
Windows内置了预定义SID列表.其他SID是通过将当前计算机的(随机生成的96位)SID与递增的数字相结合而生成的.
There is a list of predefined SIDs that Windows has built-in. Other SIDs are generated by combining the current computer's (randomly generated, 96-bit) SID with an incremented number.
在计算机上具有帐户的用户的SID存储在注册表中的HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList
SIDs of users that have accounts on a computer are stored in the registry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList
示例SID(取自有关磁盘复制的Microsoft政策Windows XP安装):
以下示例显示四个本地用户帐户的SID.请注意,添加新帐户后,只有最后四位数字递增.
The following example displays the SIDs for four local user accounts. Note that only the last four digits are incremented as new accounts are added.
- S-1-5-21-191058668-193157475-1542849698-500管理员
- S-1-5-21-191058668-193157475-1542849698-1000用户1
- S-1-5-21-191058668-193157475-1542849698-1001用户2
- S-1-5-21-191058668-193157475-1542849698-1002用户3
由于SID的生成方式,它们应该是唯一的.由于它们是Windows配置文件系统的一部分,因此漫游配置文件在每个系统上都应具有相同的SID.
Because of how SIDs are generated, they should be unique. Since they are part of the windows profile system, roaming profiles should have the same SID on every system.
这篇关于Windows中用户配置文件的唯一标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!