[PATCH 5/6] propsys: Partially implement property stringification

Jonas Kümmerlin rgcjonas at gmail.com
Wed Jul 15 04:28:57 CDT 2015


Nikolay Sivov wrote:
> > +    case VT_LPSTR:
> > +        *pcch = MultiByteToWideChar(CP_ACP, 0, propvarIn
> > ->u.pszVal, -1, NULL, 0);
> > +        break;
> 
> You sure it's meant to be WCHAR even for VT_LPSTR type? This looks 
> wrong 
> to me.
Yes, windows does convert between narrow and wide strings as requested.
If you call PropVariantToString, you'll get a unicode string no matter
what (see tests/propsys.c:921).

> > +/* FIXME: It is 2015, why do I have to write this? */
> > +static UINT i64_to_wstr(LONGLONG llVal, WCHAR *buf)
> 
> Maybe you could reuse VarBstrFromUI8() from oleaut32?
VarBstrFromUI8() allocates a new BSTR, I'd prefer something like
snprintfW(), but according to libs/wine/string.c:478 it won't support
64bit integers on 32bit machines (and C89 doesn't even specify "%lld").
Maybe vsnprintfW() should be fixed then.

> 
> > +        if (len < cch)
> > +        {
> > +            memcpy(buf, propvar->u.bstrVal, len*sizeof(WCHAR));
> > +            buf[len] = 0;
> > +        }
> 
> Isn't it what strcpyW does? This pattern appears in several places.
Actually, I'd rather prefer to replace the whole block with
StringCchCopyW. Which will most likely happen.




More information about the wine-devel mailing list