[PATCH v4 2/8] reg.exe: Add path_get_key() to remove boilerplate

Jonathan Vollebregt jnvsor at gmail.com
Mon Oct 13 09:51:03 CDT 2014


> Right, I didn't keep that in mind. Still there's the question of what
> should happen if the user passes a key path like
> HKEY_LOCAL_MACHINE_IBREAKYOU\Software\Wine .

>> Assuming you expect errors using RegCloseKey on a predefined key
>> like HCKU: In practice it works just fine. I imagine it's supposed
>> to work this way since testbot doesn't throw any errors either.
> According to the RegCloseKey implementation in
> dlls/advapi32/registry.c you are correct. I can't find any tests for
> this behavior though. A comment may be in order if you intentionally
> relying on this behavior.

Fixed and commented:
> https://github.com/jnvsor/wine/commit/1f6012dcee7ee58e7206c1a6510cc77972755508

> This
> patch is easier to read, but I am still wondering what the
>
>> +    if (key[0] == '\\') +        key++;
>
> and
>
>> +    i = strlenW(key) - 1; +    while (i >= 0 && key[i] == '\\') +
>> key[i--] = 0;
>
> parts are for. What do leading backslashes in a key do if they don't
> specify a remote host? Can there really be any number of trailing
> backslashes? What about trailing spaces like "
> \\remote_host\HKLM\foo\bar"?

The examples at the following URL indicate that even if a single leading 
backslash isn't a valid key name, it's a valid reg.exe input.
> https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/reg.mspx?mfr=true

Trailing spaces are valid key names (At least in wine, I imagine in 
native too)

> There are plenty of things that need additional tests.

The closest thing I have to a native windows system is testbot and I 
doubt you'd want me clogging it up just to find out what the proper reg 
inputs are.

If anyone can write tests for the rest, that would be great!



More information about the wine-devel mailing list