<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 17, 2014 at 12:48 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron.ballman@gmail.com" target="_blank">aaron.ballman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Oct 17, 2014 at 3:06 PM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></span>> -<br>
>  std::unique_ptr<Command> visualstudio::Compile::GetCommand(<br>
>      Compilation &C, const JobAction &JA, const InputInfo &Output,<br>
>      const InputInfoList &Inputs, const ArgList &Args,<br>
> Index: lib/Driver/WindowsToolChain.cpp<br>
> ===================================================================<br>
> --- lib/Driver/WindowsToolChain.cpp<br>
> +++ lib/Driver/WindowsToolChain.cpp<br>
> @@ -77,61 +77,59 @@<br>
>    return getArch() == llvm::Triple::x86_64;<br>
>  }<br>
><br>
> +#ifdef USE_WIN32<br>
> +static bool readFullStringValue(HKEY hkey, const char *valueName,<br>
> +                                std::string &value) {<br>
<br>
We should be preferring the W versions of these APIs instead of the A<br>
versions, especially since this is being used to pull out file paths.<br></blockquote><div>How does this work, since ultimately all of clang uses non-wide character strings anyway.  I mean I know how to convert between the two, but I was under the impression that everything was just already broken because afaik we don't ever use W functions anywhere else.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> +  DWORD result = 0;<br>
> +  DWORD valueSize = 0;<br>
> +  // First just query for the required size.<br>
> +  result = RegQueryValueEx(hkey, valueName, NULL, NULL, NULL, &valueSize);<br>
<br>
We should be caring about the key type as well, since we only want<br>
string values.<br></blockquote><div>True, but at the same time since we're querying for the key by name, we already know what type it is.  I suppose it's possible that someone has a corrupted registry though with a matching keyname of a different type, but otherwise it's not possible to have two keys with the same value </div></div></div></div>