advapi32: Add RegCreate/DeleteKey tests and fixes

James Hawkins truiken at gmail.com
Wed Feb 23 07:39:51 CST 2005


On 23 Feb 2005 13:57:08 +0100, Alexandre Julliard <julliard at winehq.org> wrote:
> James Hawkins <truiken at 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).
> 
> --
> Alexandre Julliard
> julliard at winehq.org
> 

By lower level functions do you mean the ntdll reg functions?

-- 
James Hawkins



More information about the wine-devel mailing list