On Thu, Aug 30, 2018 at 12:59 PM, Alexandre Julliard julliard@winehq.org wrote:
Gabriel Ivăncescu gabrielopcode@gmail.com writes:
This doesn't seem like an improvement. In particular, querying the key twice just to retrieve the length is making things worse, and creating more race conditions. Also note that RegQueryValueExW already adds a terminating null if necessary.
-- Alexandre Julliard julliard@winehq.org
Yes indeed the first query gets the length, but the second one makes sure the length is exactly the same so there can't be any race condition, unless I'm missing something?
About the NUL terminator: while it may be true for Wine's implementation, MSDN states that it's not necessarily the case (and tell you to use GetRegValue, which is more convoluted), and I imagine some application might hook RegQueryValueExW and provide a MSDN-compatible implementation or something (remote chance but it doesn't really hurt). Nevertheless, if you really think it's not an issue I will take that extra bit out then.