On 10/28/2014 09:51 PM, Stefan Dösinger wrote:
I don't think you need the NULL check with the early return
RegOpenKey always returns an error if path starts with '\', which is why theres an increment on path right after the strchrW
Of course if path_get_key returns NULL we'll be passing in the equivalent of `(WCHAR *)2` so the NULL check prevents segfaults.
We could replace the return with the path increment so that RegOpenKey gets NULL as it's parameter like this:
path = strchrW(path, '\\'); if (path) path++; if (RegOpenKeyW(k, path, &k) != ERROR_SUCCESS)
I suppose removing a line is worth the extra effort of having root keys go through RegOpenKey
How's this draft?