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.
Mike