advapi32: Implement NtLoadKey

James Hawkins truiken at gmail.com
Fri Mar 25 09:11:27 CST 2005


On Fri, 25 Mar 2005 17:08:25 +0900, Mike McCormack <mike at codeweavers.com> wrote:
> 
> James Hawkins wrote:
> 
> > +/* mount a key directly under HKLM or HKU */
> > +static void mount_key(struct key *key, const WCHAR *subkey, obj_handle_t handle)
> > +{
> 
> > +    if (!(f = fdopen(fd, "r")))
> > +        return;
> > +
> > +    /* create the key */
> > +    newkey = create_key(key, subkey, NULL, KEY_DIRTY, 0, &created);
> > +    if (!newkey)
> > +        return;
> > +
> > +    /* load the key */
> > +    load_keys(newkey, f, -1);
> > +}
> 
> I think you leak the FILE * returned from fdopen here.  Additionally, if
> dup() or fdopen() fails, no error code will be set, so the code will
> fail silently.
> 
> In NtLoadKey(), you should close the file handle "hive" that you open.
> 
> Can't you achieve the same effect using the original load_registry
> request, rather than creating a new request?  If not, you can also
> remove the load_registry request from protocol.def as I think it's no
> longer used.

Oops this is the wrong (previous) patch.  I'll send in the new one.


-- 
James Hawkins



More information about the wine-devel mailing list