msi [6/10]: pcchValue represents the length of szValue in TCHARS, not bytes

Alexandre Julliard julliard at winehq.org
Mon Jul 2 09:09:48 CDT 2007


"James Hawkins" <truiken at gmail.com> writes:

> @@ -341,10 +341,15 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWS
>      }
>      else if (strcmpW(INSTALLPROPERTY_PACKAGENAMEW, szProperty)==0)
>      {
> +        *pcchValue = *pcchValue * sizeof(WCHAR);
>          rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0, 
> -                (LPBYTE)szValue, pcchValue);
> +                              (LPBYTE)szValue, pcchValue);
>          if (rc != ERROR_SUCCESS && rc != ERROR_MORE_DATA)
>              rc = ERROR_SUCCESS;
> +        if (*pcchValue)
> +            *pcchValue = (*pcchValue - 1) / sizeof(WCHAR);
> +        if (szValue)
> +            szValue[*pcchValue] = '\0';

You shouldn't use the results if the registry function failed. Also
there isn't much point in checking pcchValue for NULL since you
accessed it already.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list