[PATCH 3/3] shell32/autocomplete: Revamp pwzsRegKeyPath handling so it can deal with arbitrary sizes and make it more robust

Gabriel Iv─âncescu gabrielopcode at gmail.com
Thu Aug 30 06:23:27 CDT 2018

On Thu, Aug 30, 2018 at 12:59 PM, Alexandre Julliard
<julliard at winehq.org> wrote:
> Gabriel Iv─âncescu <gabrielopcode at 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 at 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.

More information about the wine-devel mailing list