SfcIsKeyProtected function (sfc.h)
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 );
A handle to the root registry key. This must be a handle to one of the following predefined keys.
[in, optional] SubKeyName
A null-terminated string value containing the name of the subkey. This key must a subkey of the key identified by the hKey parameter. For more information about key names, see Structure of the Registry. If this parameter is NULL, the function only checks whether the root registry key is protected.
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, see Accessing 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. The SfcIsKeyProtected 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>
The SfcIsKeyProtected 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>
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|