- Accessing Registry Keys Safely
- Registry Key Security and Access Rights
- Registry Key Класс
- Определение
- Примеры
- Комментарии
- Свойства
- Методы
- Явные реализации интерфейса
- Методы расширения
- Как создать ключ реестра в Windows 10?
- Иерархия реестра
- Как создать ключ реестра в Windows 10
- Что делает ключ реестра?
- Why is Access Denied to a Registry Key Folder that is preventing me from Installing an Update to One of my Programs Windows 8?
- Replies (6)
Accessing Registry Keys Safely
Customer problems have frequently been traced to external components, such as third-party device installation applications, that do the following:
Delete critical registry keys.
Modify the access permissions of critical registry keys.
Many of the problems seen with external components are caused by using the KEY_ALL_ACCESS access permission for registry keys. Starting with Windows Server 2003, SetupDiCreateDevRegKey grants only KEY_READ and KEY_WRITE access permissions and not KEY_ALL_ACCESS. Starting with Windows Vista, additional KEY_ALL_ACCESS restrictions are enforced.
Follow these guidelines to safely access registry keys:
Use the SetupAPI functions only to open registry keys, especially the hardware keys and software keys for a device.
These functions address common problems that result from restrictions on access permissions.
The location and format of registry keys might change between different versions of Windows. Do not make assumptions about the location, format, or meaning of registry keys or values that are used for device and driver installation.
For more information about registry keys and trees, see Registry Trees and Keys for Devices and Drivers.
Do not use the registry to directly access or modify the internal settings of the device.
Request only the minimal access permissions that are required for each task, such as the following:
Do not directly open the device setup class keys in the registry. As with any registry key, the location and name of device setup class keys might change between versions of Windows.
To open device setup class keys safely, follow these guidelines:
Use SetupDiOpenClassRegKeyEx and set DIOCR_INSTALLER in the Flags parameter.
Do not directly open device interface class keys in the registry. As with any registry key, the location and name of device interface class keys might change between versions of Windows.
To open device interface class keys safely, use SetupDiOpenClassRegKeyEx and set DIOCR_INSTALLER in the Flags parameter.
Use only INF directives to modify registry keys that are reserved for use by the operating system. For more information, see Summary of INF Directives.
Class installers and co-installers cannot call registry functions to create, change, or delete registry values that are reserved for use by the operating system.
For more information about the access permissions of registry keys, see Registry Key Security and Access Rights.
Registry Key Security and Access Rights
The Windows security model enables you to control access to registry keys. For more information about security, see Access-Control Model.
You can specify a security descriptor for a registry key when you call the RegCreateKeyEx or RegSetKeySecurity function. If you specify NULL, the key gets a default security descriptor. The ACLs in a default security descriptor for a key are inherited from its direct parent key.
The valid access rights for registry keys include the DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER standard access rights. Registry keys do not support the SYNCHRONIZE standard access right.
The following table lists the specific access rights for registry key objects.
Value | Meaning |
---|---|
KEY_ALL_ACCESS (0xF003F) | Combines the STANDARD_RIGHTS_REQUIRED, KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, and KEY_CREATE_LINK access rights. |
KEY_CREATE_LINK (0x0020) | Reserved for system use. |
KEY_CREATE_SUB_KEY (0x0004) | Required to create a subkey of a registry key. |
KEY_ENUMERATE_SUB_KEYS (0x0008) | Required to enumerate the subkeys of a registry key. |
KEY_EXECUTE (0x20019) | Equivalent to KEY_READ. |
KEY_NOTIFY (0x0010) | Required to request change notifications for a registry key or for subkeys of a registry key. |
KEY_QUERY_VALUE (0x0001) | Required to query the values of a registry key. |
KEY_READ (0x20019) | Combines the STANDARD_RIGHTS_READ, KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS, and KEY_NOTIFY values. |
KEY_SET_VALUE (0x0002) | Required to create, delete, or set a registry value. |
KEY_WOW64_32KEY (0x0200) | Indicates that an application on 64-bit Windows should operate on the 32-bit registry view. This flag is ignored by 32-bit Windows. For more information, see Accessing an Alternate Registry View. This flag must be combined using the OR operator with the other flags in this table that either query or access registry values. Windows 2000: This flag is not supported. |
KEY_WOW64_64KEY (0x0100) | Indicates that an application on 64-bit Windows should operate on the 64-bit registry view. This flag is ignored by 32-bit Windows. For more information, see Accessing an Alternate Registry View. This flag must be combined using the OR operator with the other flags in this table that either query or access registry values. Windows 2000: This flag is not supported. |
KEY_WRITE (0x20006) | Combines the STANDARD_RIGHTS_WRITE, KEY_SET_VALUE, and KEY_CREATE_SUB_KEY access rights. |
When you call the RegOpenKeyEx function, the system checks the requested access rights against the key’s security descriptor. If the user does not have the correct access to the registry key, the open operation fails. If an administrator needs access to the key, the solution is to enable the SE_TAKE_OWNERSHIP_NAME privilege and open the registry key with WRITE_OWNER access. For more information, see Enabling and Disabling Privileges.
You can request the ACCESS_SYSTEM_SECURITY access right to a registry key if you want to read or write the key’s system access control list (SACL). For more information, see Access-Control Lists (ACLs) and SACL Access Right.
To view the current access rights for a key, including the predefined keys, use the Registry Editor (Regedt32.exe). After navigating to the desired key, go to the Edit menu and select Permissions.
Registry Key Класс
Определение
Представляет узел уровня раздела в реестре Windows. Represents a key-level node in the Windows registry. Этот класс является инкапсуляцией реестра. This class is a registry encapsulation.
Примеры
В следующем примере кода показано, как создать подраздел в разделе HKEY_CURRENT_USER, манипулировать его содержимым, а затем удалить подраздел. The following code example shows how to create a subkey under HKEY_CURRENT_USER, manipulate its contents, and then delete the subkey.
Комментарии
Обратите внимание, что данные, хранящиеся в реестре, доступны другим приложениям и пользователям, поэтому их не следует использовать для хранения данных безопасности или важных сведений о приложениях. Note that information stored in the registry is available to other applications and users, and therefore should not be used to store security data or critical application information.
Не предоставляйте RegistryKey объекты таким образом, чтобы вредоносная программа могла создать тысячи бессмысленных подразделов или пар «ключ-значение». Do not expose RegistryKey objects in such a way that a malicious program could create thousands of meaningless subkeys or key/value pairs. Например, не разрешать вызывающим объектам вводить произвольные ключи или значения. For example, do not allow callers to enter arbitrary keys or values.
Свойства
Получает объект SafeRegistryHandle, представляющий раздел реестра, инкапсулируемый текущим объектом RegistryKey. Gets a SafeRegistryHandle object that represents the registry key that the current RegistryKey object encapsulates.
Возвращает имя раздела. Retrieves the name of the key.
Возвращает количество подразделов для текущего раздела. Retrieves the count of subkeys of the current key.
Возвращает число значений в разделе. Retrieves the count of values in the key.
Получает представление, которое использовалось для создания раздела реестра. Gets the view that was used to create the registry key.
Методы
Если содержимое раздела было изменено, следует закрыть раздел и записать его на диск. Closes the key and flushes it to disk if its contents have been modified.
Создает объект, который содержит всю необходимую информацию для создания прокси-сервера, используемого для взаимодействия с удаленным объектом. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
Создает новый вложенный раздел или открывает существующий вложенный раздел с доступом на запись. Creates a new subkey or opens an existing subkey for write access.
Создает новый вложенный раздел или открывает существующий вложенный раздел с доступом на запись, используя заданный вариант проверки разрешений. Creates a new subkey or opens an existing subkey for write access, using the specified permission check option.
Создает подраздел или открывает подраздел с доступом на запись, используя заданные параметры проверки разрешений и параметры реестра. Creates a subkey or opens a subkey for write access, using the specified permission check and registry options.
Создает подраздел или подраздел с доступом на запись, используя заданные параметры проверки разрешений, параметры реестра и безопасности реестра. Creates a subkey or opens a subkey for write access, using the specified permission check option, registry option, and registry security.
Создает новый вложенный раздел или открывает существующий вложенный раздел с доступом на запись, используя заданный вариант проверки разрешений и безопасности реестра. Creates a new subkey or opens an existing subkey for write access, using the specified permission check option and registry security.
Удаляет заданный подраздел. Deletes the specified subkey.
Удаляет указанный подраздел и определяет, нужно ли создавать исключение, если подраздел не найден. Deletes the specified subkey, and specifies whether an exception is raised if the subkey is not found.
Рекурсивно удаляет вложенный раздел и все дочерние вложенные разделы. Deletes a subkey and any child subkeys recursively.
Рекурсивно удаляет указанный подраздел и все дочерние подразделы и определяет, нужно ли создавать исключение, если не удается найти подраздел. Deletes the specified subkey and any child subkeys recursively, and specifies whether an exception is raised if the subkey is not found.
Удаляет заданное значение из этого раздела. Deletes the specified value from this key.
Удаляет указанное значение из данного раздела и определяет, нужно ли создавать исключение, если значение на найдено. Deletes the specified value from this key, and specifies whether an exception is raised if the value is not found.
Освобождает все ресурсы, используемые текущим экземпляром класса RegistryKey. Releases all resources used by the current instance of the RegistryKey class.
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
Если содержимое раздела было изменено, следует закрыть раздел и записать его на диск. Closes the key and flushes it to disk if the contents have been modified.
Записывает в реестр все атрибуты заданного открытого раздела реестра. Writes all the attributes of the specified open registry key into the registry.
Создает раздел реестра на базе указанного дескриптора. Creates a registry key from a specified handle.
Создает раздел реестра на базе указанного дескриптора и параметров представления реестра. Creates a registry key from a specified handle and registry view setting.
Возвращает безопасность элемента управления доступом для текущего раздела реестра. Returns the access control security for the current registry key.
Возвращает заданные разделы безопасности элемента управления доступом для текущего раздела реестра. Returns the specified sections of the access control security for the current registry key.
Служит хэш-функцией по умолчанию. Serves as the default hash function.
Извлекает объект обслуживания во время существования, который управляет политикой времени существования данного экземпляра. Retrieves the current lifetime service object that controls the lifetime policy for this instance.
Возвращает массив строк, который содержит все имена подразделов. Retrieves an array of strings that contains all the subkey names.
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
Возвращает значение, связанное с заданным именем. Retrieves the value associated with the specified name. Если имя не найдено, возвращает предоставленное значение по умолчанию. If the name is not found, returns the default value that you provide.
Возвращает значение, связанное с заданным именем и параметрами извлечения. Retrieves the value associated with the specified name and retrieval options. Если имя не найдено, возвращает предоставленное значение по умолчанию. If the name is not found, returns the default value that you provide.
Возвращает тип данных реестра для значения, связанного с заданным именем. Retrieves the registry data type of the value associated with the specified name.
Возвращает массив строк, содержащий все имена значений, связанных с этим разделом. Retrieves an array of strings that contains all the value names associated with this key.
Получает объект службы времени существования для управления политикой времени существования для этого экземпляра. Obtains a lifetime service object to control the lifetime policy for this instance.
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
Создает неполную копию текущего объекта MarshalByRefObject. Creates a shallow copy of the current MarshalByRefObject object.
Открывает новый объект RegistryKey, который представляет запрошенный раздел на локальном компьютере в указанном представлении. Opens a new RegistryKey that represents the requested key on the local machine with the specified view.
Открытие нового раздела RegistryKey, который представляет запрошенный раздел на удаленном компьютере. Opens a new RegistryKey that represents the requested key on a remote machine.
Открывает новый раздел реестра, который представляет запрошенный раздел на удаленном компьютере в указанном представлении. Opens a new registry key that represents the requested key on a remote machine with the specified view.
Возвращает подраздел с доступом только для чтения. Retrieves a subkey as read-only.
Получает указанный подраздел и определяет, следует ли предоставить доступ для записи в этот раздел. Retrieves a specified subkey, and specifies whether write access is to be applied to the key.
Возвращает заданный подраздел с доступом для чтения или для чтения и записи. Retrieves the specified subkey for read or read/write access.
Возвращает заданный подраздел с доступом для чтения или для чтения и записи с запросом заданных прав доступа. Retrieves the specified subkey for read or read/write access, requesting the specified access rights.
Применяет безопасность управления доступом Windows к существующему разделу реестра. Applies Windows access control security to an existing registry key.
Задает указанную пару «имя-значение». Sets the specified name/value pair.
Устанавливает значение пары «имя-значение» в разделе реестра, используя заданный тип данных реестра. Sets the value of a name/value pair in the registry key, using the specified registry data type.
Возвращает строковое представление этого раздела. Retrieves a string representation of this key.
Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.
Явные реализации интерфейса
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Выполняет Close() в текущем реестре. Performs a Close() on the current key.
Методы расширения
Возвращает сведения безопасности для раздела реестра. Returns the security information of a registry key.
Возвращает сведения безопасности для раздела реестра. Returns the security information of a registry key.
Изменяет атрибуты безопасности для существующего раздела реестра. Changes the security attributes of an existing registry key.
Как создать ключ реестра в Windows 10?
Реестр Windows — это набор настроек, которые могут использовать Windows и приложения. Это каталог, в котором хранятся настройки и параметры операционной системы для Microsoft Windows. Он содержит информацию и настройки для всего аппаратного обеспечения, программного обеспечения операционной системы, большинства программ, не относящихся к операционной системе, пользователей, предпочтений ПК и т.д. Реестр состоит из следующих 5 корневых ключей. Корневые ключи содержат SubKeys. Подключи могут также содержать свои собственные подключи и содержать как минимум одно значение, называемое его значением по умолчанию. Ключ со всеми его подразделами и значениями называется Hive. Каждый ключ имеет один из типов данных — типы данных: REG_SZ, REG_BINARY, REG_DWORD, REG_QWORD, REG_MULTI_SZ или REG_EXPAND_SZ.
В этом посте мы покажем вам, как создать раздел реестра в Windows 10.
Реестр Windows сложен по архитектуре и построен так, что обычные потребители не поймут. Также желательно, чтобы вы знали основы и не изменяли их, если не знаете, что делаете.
Иерархия реестра
Для редактирования реестра мы используем встроенный редактор реестра или regedit. Он отображает древовидную структуру навигации. Самым верхним является ваш компьютер, за которым следует список папок и подпапок. Эти папки называются KEYS, и в компьютере есть пять фиксированных наборов папок.
Это мастер-ключи, поскольку вы не можете создать НОВЫЙ КЛЮЧ в разделе «Компьютер», но вы можете сгенерировать новые ключи под любым из этих мастер-ключей.
Как создать ключ реестра в Windows 10
1] Использование редактора реестра
Создать ключ реестра легко. Щелкните правой кнопкой мыши любую папку или пробел и выберите «Создать». Вы можете создать ключ, строковое значение, двоичное значение, значение DWORD (32-разрядное), значение QWORD (64-разрядное), многостроковое значение или расширяемое строковое значение. Этот метод полезен, когда вы планируете внести незначительные изменения, чтобы исправить проблему на вашем компьютере. Это может быть связано с приложением или на уровне ОС.
2] Используйте Блокнот для создания файлов REG
Щелкните правой кнопкой мыши по любому из существующих ключей и экспортируйте его. Откройте этот файл в блокноте, и он поможет вам понять, как вы можете редактировать ключ и его значения. Это полезно, когда вы хотите выполнить массовое редактирование с резервным копированием на месте.
Обратите внимание на объявление версии, за которым следует пустая строка, затем путь, за которым следует остаток в кавычках, и снова пустая строка. После завершения редактирования вы можете щелкнуть правой кнопкой мыши и выбрать объединить файл в куст реестра.
3] Сторонние инструменты
Если вы нашли редактор реестра по умолчанию сложным, вы можете использовать такие инструменты, как RegCool, Registry Manager Lite. Они предлагают такие функции, как Отмена, Повторить, управление разрешениями, окно с вкладками, импорт, экспорт, избранное и так далее.
3] Напишите свою программу
Если вы разработчик приложения, вам следует использовать программирование для управления настройками приложения в реестре. Вот пример, и он будет варьироваться в зависимости от языка, который вы используете для разработки приложения.
Теперь, когда вы знаете, как это сделать, мы также рекомендуем вам прочитать, что означает каждый из них. Это важно и поможет вам убедиться, что внесенные вами изменения верны.
Что делает ключ реестра?
Если вы представляете «Ключ» как папку, остальные представляют собой различные типы типов файлов, в которых хранятся различные типы значений. Таким образом, если вы создаете приложение, вы можете иметь основную папку, а затем подпапки, чтобы отделить один набор от другого. Вот немного о каждом из них:
DWORD & QWORD: Double Word может хранить 32-битные единицы данных, в то время как QWORD может хранить 64-битные данные.
Строковое значение (REG_SZ): может хранить строку в формате Unicode или ANSI и в конце содержит ноль.
Multi-String value: Если вы хотите сохранить несколько чисел String Value, вы можете использовать это. Тем не менее, обязательно завершите его пустой строкой (\0). Вот простой пример:
Обратите внимание, что ‘\0’ в конце обозначает конец первой строки, а последний ‘\0’ обозначает конец мультистроки.
Расширяемое строковое значение: это можно использовать для переменных среды с использованием строки Unicode или ANSI. Преимущество здесь в том, что вы можете расширить его в отличие от значений String и Multi-String.
Двоичное значение: самое простое, оно содержит 0 и 1.
Why is Access Denied to a Registry Key Folder that is preventing me from Installing an Update to One of my Programs Windows 8?
I am trying to install an update to my embroidery software program, and I am getting this error message:
Error: 1402. Could not open key:
UNKNOWN32\5DEmbroidery.Document.1\Shell. Verify that you have sufficient access to that key, or contact your support personnel.
I am logged in as the Administrator and I am the only profile on my laptop. I am not sure how to reassign privleges to this registry key, as I’m not sure where or how to find it. Can someone walk me through where to find this particular key in the Reigstry, and then what to do to fix this? Very frustrating.
Replies (6)
Welcome to Microsoft Community.
From the issue description, I understand that you are unable to install Embroidery software and you get an error “UNKNOWN32\5DEmbroidery.Document.1\Shell. Verify that you have sufficient access to that key, or contact your support personnel. I need more information to assist you in a better way.
1. Which software are you trying to install?
2. Did you check if the software is compatible with Windows 8?
This might be an issue if the program is not compatible with Windows 8. You may try the following steps and check if these steps help in resolving the issue.
Method 1 : Please check, if the software you are trying to install is compatible with Windows 8.
You may refer to the link for Windows 8 compatibility center.
Method 2: Run the program as administrator.
a. Right click on the installation file.
b. Click on Run as administrator.
You may contact software developer for further assistance.
Hope this helps. Please get back to us if you have any queries related to Windows. We are here to assist you.
1 person found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
1 person found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thank you for keeping us posted and providing the information.
Please let us know:
1. Have you logged in as an administrator?
2. How are you trying to update the software? Is it through Windows update or the manufacturer’s website?
You may try the following steps and check if this helps.
Temporarily disable third party security software.
Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you shouldn’t disable your antivirus software. If you have to temporarily disable it to install other software, you should re-enable it as soon as you’re done. If you’re connected to the Internet or a network while your antivirus software is disabled, your computer is vulnerable to attacks.
If disabling the software doesn’t help, we would request you to contact the software manufacturer.
Hope this helps. Please get back to us if you have any more questions related to Windows. We are here to assist you.
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
You could look at the access permissions in the registry, but you will have to search via RegEdit for this location UNKNOWN32\5DEmbroidery.Document.1\Shell, perhaps just search for the UNKNOWN32 key to make it easier.
Permissions are covered in the Help file of RegEdit as an article. Basically you just right-click on a Key and access Permissions via the drop down menu.
Launch RegEdit and use the Help program as it is your best source of information about RegEdit.
These following links take the subject a bit further too.
If you experimenting in the Registry, I hope you backup any keys before you changed them. See Import and Export in the RegEdit Help.
This EXAMPLE (ONLY) might or might not work for you with your program it uses the built-in Administrator account to perform the update?
«It seems that the «Run as administrator» command only gives you some administrative privileges, and they’re not enough to install Java (and OpenOffice, by association). In order to get around this, you need to actually log into the built-in administrator. Open a Command Prompt (Admin) with admin rights by using the Windows Key + X and selecting that option. At the prompt, type:
net user administrator /active:yes
Then log out of your regular account and back in as the built-in administrator, where you might be able to install the update. When you’re done, log back into your regular account and, for security purposes, disable the built-in administrator account using: