James Hawkins truiken@gmail.com writes:
- /* a key cannot be created directly beneath HKEY_LOCAL_MACHINE or HKEY_USERS */
- if ((hkey == HKEY_LOCAL_MACHINE || hkey == HKEY_USERS) && !strchr(name, '\')) {
*retkey = NULL;- return ERROR_INVALID_PARAMETER;
- }
- if (!(ret = RegOpenKeyExW( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp ))) {
/* check for any subkeys* a key cannot be deleted if it has any subkeys*/RegQueryInfoKeyW(tmp, NULL, NULL, NULL, &numSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL);if (numSubKeys != 0) {if (*name) RegCloseKey(tmp);return ERROR_ACCESS_DENIED;}
These kinds of checks should be done in the lower level functions, not in advapi32 (and in the case of the delete, are done already AFAICT).