[PATCH] Fix 16 bit StringFromGUID2 to not use wide characters

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Tue May 20 02:19:40 CDT 2008


Am Montag, den 19.05.2008, 19:58 +0900 schrieb Dmitry Timoshkov:
> "Michael Karcher" <wine at mkarcher.dialup.fu-berlin.de> wrote:
> 
> > +INT WINAPI StringFromGUID2_16(REFGUID id, LPSTR str, INT cmax)
> > +{
> > +  char xguid[80];
> > +  int           len;
> > +
> > +  if (WINE_StringFromCLSID( id, xguid ))
> > +  return 0;
> > +  
> > +  len = strlen( xguid ) + 1; /* The terminating zero counts */
> > +  if (len > cmax)
> > +        return 0;
> > +        
> > +  strcpy( str, xguid );
> > +  return len;
> > +}
> 
> This is not an equivalent of the old implementation, is it really
> supposed to fail if the buffer length is shorter than the guid?

It is, in fact, an equivalent implementation of the old one.
MultiByteToWideChar is also failing (return value of zero) if the buffer
length is to short, exactly as the new implementation does. I am adding
that case to the 32 bit testsuite (but I also tested it on 16 bits)

Regards,
  Michael Karcher




More information about the wine-devel mailing list