gpt4 book ai didi

c++ - 确定注册表项的对象名称

转载 作者:行者123 更新时间:2023-11-28 03:19:36 24 4
gpt4 key购买 nike

我正在尝试使用函数 SetNamedSecurityInfo() 为注册表项设置自主访问控制列表 (DACL) .

如果我正在设置注册表项,我不确定第一个参数 pObjectName 应该是什么?我也不确定这个字符串的格式,即对于当前用户我使用 HKEY_CURRENT_USER\ or CURRENT_USER

对于注册表项,对象名称只是注册表项的路径还是其他?

例如:

LPTSTR pObjectName = _T("HKEY_CURRENT_USER\\Software\\MyAppName");
// or should it be...
LPTSTR pObjectName = _T("CURRENT_USER\\Software\\MyAppName");

最佳答案

Read the documentation对于 SetNamedSecurityInfo():

For descriptions of the string formats for the different object types, see SE_OBJECT_TYPE.

.

SE_REGISTRY_KEY Indicates a registry key. A registry key object can be in the local registry, such as CLASSES_ROOT\SomePath or in a remote registry, such as \ComputerName\CLASSES_ROOT\SomePath.

The names of registry keys must use the following literal strings to identify the predefined registry keys: "CLASSES_ROOT", "CURRENT_USER", "MACHINE", and "USERS".

所以你的问题的答案是这样的:

LPTSTR pObjectName = _T("CURRENT_USER\\Software\\MyAppName");

关于c++ - 确定注册表项的对象名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15846184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com