Nikolay Sivov <nsivov(a)codeweavers.com> writes:
> - new_this->IEnumCATEGORYINFO_iface = This->IEnumCATEGORYINFO_iface;
> - new_this->ref = 1;
> - new_this->lcid = This->lcid;
> - /* FIXME: could we more efficiently use DuplicateHandle? */
> - open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &new_this->key);
> - new_this->next_index = This->next_index;
> + cloned->IEnumCATEGORYINFO_iface = This->IEnumCATEGORYINFO_iface;
> + cloned->ref = 1;
> + cloned->lcid = This->lcid;
>
> - *ppenum = &new_this->IEnumCATEGORYINFO_iface;
> + if (!DuplicateHandle(GetCurrentProcess(), This->key, GetCurrentProcess(), (HANDLE*)&cloned->key, 0, FALSE, DUPLICATE_SAME_ACCESS))
> + {
> + IEnumCATEGORYINFO_Release(&cloned->IEnumCATEGORYINFO_iface);
> + return E_FAIL;
> + }
Using DuplicateHandle is not a good idea on registry keys, particularly
for HKEY_CLASSES_ROOT keys.
--
Alexandre Julliard
julliard(a)winehq.org