This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Determines whether the specified registry key is protected. Applications should avoid replacing protected registry keys.
BOOL SfcIsKeyProtected( [in] HKEY KeyHandle, [in, optional] LPCWSTR SubKeyName, [in] REGSAM KeySam);
[in] KeyHandle
A handle to the root registry key. This must be a handle to one of the followingpredefined keys.
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
[in, optional] SubKeyName
Anull-terminated string value containing the name of the subkey. This key must a subkey of the key identified by thehKey parameter. For more information about key names, seeStructure of the Registry.If this parameter isNULL, the function only checks whether the root registry key is protected.
[in] KeySam
A constant that specifies the alternate registry view that should be used by applications that run on 64-bit Windows. This flag is ignored on the x86 platform. For more information, seeAccessing an Alternate Registry View.
If the key is protected, the return value is a nonzero value.
If the key is not protected, the return value is zero.
A key is protected by WRP if the path exists and is protected by WRP. TheSfcIsKeyProtected function indicates that a subkey is protected by WRP if the subkey has a parent key that is protected by WRP.
For example, if the following registry key exists on the system and is protected by WRP:
HKEY_LOCAL_MACHINE SOFTWARE Classes Microsoft <WinFeature>
TheSfcIsKeyProtected function returns a nonzero value for the following subkey. The new subkey does not need to exist for the function to determine that it is WRP-protected.
HKEY_LOCAL_MACHINE SOFTWARE Classes Microsoft <WinFeature> <new subkey>
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | sfc.h |
Library | Sfc.lib |
DLL | Sfc.dll |
Was this page helpful?
Was this page helpful?