[PATCH 3/7] reg: Add path/key conversion functions

Stefan Dösinger stefandoesinger at gmail.com
Thu Nov 6 08:54:38 CST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2014-11-06 09:11, schrieb Jonathan Vollebregt:
> On 11/04/2014 10:48 PM, Stefan Dösinger wrote:
>> My reading comprehension may be lacking again, but can't you just
>> call RegDeleteTree(subkey, NULL)? You're also assuming the caller
>> isn't trying to nuke HKEY_LOCAL_MACHINE:-)  .
> 
> That deletes everything below the key, but not the key itself, so I
> have to do it that way.
This is unfortunate, I guess we'll have to live with parsing the key
twice in this case. RegDeleteKey doesn't help either, it can only
delete a subkey.

> Reg is supposed to throw an error if the key ends in more than one 
> backslash, RegCreateKey/RegOpenKey doesn't so it has to be checked 
> manually.
Do we have tests for the RegCreateKey / RegOpenKey behavior? I did not
find any when I looked.

> The message with ERROR_INVALID_DATATYPE says it indicates the
> *data* has the wrong type, nothing about the type itself.
Huh, I am not sure I understand what this means or what the difference
is :-\ .

> Given an incorrect type RegSetValueEx returns ERROR_ACCESS_DENIED,
> which isn't the most descriptive of error codes. Perhaps it would
> still be better to make our own more descriptive error code
Agreed, ERROR_ACCESS_DENIED is a bit unfortunate. This is the behavior
of Windows, not Wine's implementation, right?

>> I think this is a bad place to catch unsupported data types.
>> "type" comes from one of your own functions, namely
>> wchar_get_type(). If reg.exe shouldn't support any of the data
>> types not explicitly handled here then wchar_get_type should
>> already return an error in this case. Otherwise you can make this
>> a FIXME("Add support for type %u\n" type);
> 
> What should I do in default then? It would be a bad idea to return 
> ERROR_SUCCESS
For code that should be unreachable an ERR() would be enough. The
completely unexpected already happened, any attempt to clean up after
that will come up short anyway. The idea is that when ERRs are removed
at compile time the compiler can remove the condition as well since it
just covers an empty block of code.

If you want to make sure you abort you can add an assert(0).

Though if you put the conversion function into the type table you
avoid the issue altogether.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJUW4uuAAoJEN0/YqbEcdMw4JQP/1h4Cg5/PlzgJCsKcEOzxlPc
+A3M5St152rhcFQPmTM58QcwlGUBiZLMB1h/wmFYk+7fvADjLhv64BzFMvnhQ/B+
vIYDJBhcfAE0571W2H31bx76Rfl7BxviCWMTH+mUvI26okRBPbaQLC3TtwxaOaPO
+UlRVq1F8y8q6fYqQ3qL/fHjml+swFf5n0vCyHMHFIDP+cBGzFvJmveW+HQowqTQ
W/+c0thhj0+lekcZXQMNr4btfamhOcqU4D2YTEcFIRVg7+7QG0U89nri1C7S4DyW
ZQh2c7T4P5VD+bv8KUgpowJmB91oZ3hv7RMyrLKdPKk1JKPs9UniA2T4BvPcEt1m
i7k5QXOTIzYoaEccjaMEVnhOHExkhaiIZoJsMSOCoPF2jvzIDYL9f/4uCiLCKbnq
2lMilQ2k9PWxFI2JiuEeci8htAZVssyXtMZXUMjuWzoc2dkRAmhYOwWgSaSuZp+N
chklFB+jwJLPtb3hcdzn4xAyx4ytECyknwoSt5b26iIx2Xlq6M4YYlVFzhpQ3P7M
m/srFGITzSs26vo6loTAfBRrcRIAHVvvGxum5SLGvdf5ofPM6oeYfb6ejJ3bA06R
JuShvacl0YdhTxwD+uziogVB3NbLPji0o2l3O7tCxHeI82NIihm09fOZi8G6f9PM
BsrC/GG8E7Bn43Cv+j4A
=4Il4
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list