msi 1: Implement MsiSourceListGetInfoA [try2]

James Hawkins truiken at gmail.com
Thu Jun 28 13:21:01 CDT 2007


On 6/28/07, Alexandre Julliard <julliard at winehq.org> wrote:
> "James Hawkins" <truiken at gmail.com> writes:
>
> > +    ret = MsiSourceListGetInfoW(product, usersid, dwContext, dwOptions,
> > +                                 property, value, pcchValue);
> > +    if (ret == ERROR_SUCCESS)
> > +        WideCharToMultiByte(CP_ACP, 0, value, -1, szValue, *pcchValue, NULL, NULL);
>
> The handling of pcchValue is wrong, you need a separate variable for
> the W size, and you need to set *pcchValue to the correct A size.
>

To quote msdn for convenience:

"pcchValue: A pointer to a variable that specifies the number of TCHAR
in the szValue buffer. When the function returns, this parameter is
set to the size of the requested value whether or not the function
copies the value into the specified buffer. The size is returned as
the number of TCHAR in the requested value, not including the
terminating null character."

By this definition, for any particular property requested, the size
returned should be exactly the same for both the A and W call.  This
eliminates the need for a W size variable, and in fact, setting the
returned A size by manipulating the returned W size (the usual divide
by sizeof WCHAR) would be wrong.  Have I messed up somewhere in my
logic?

-- 
James Hawkins



More information about the wine-devel mailing list