[setupapi] fix return values and GUID string in SetupDiOpenClassRegKeyExW

Damjan Jovanovic dj015 at yahoo.com
Mon Jul 3 05:26:35 CDT 2006



--- Joris Huizer <jorishuizer at planet.nl> wrote:

> Damjan Jovanovic wrote:
> > +    guidStringWithBraces[0] = (WCHAR) '{';
> > +    CopyMemory(&guidStringWithBraces[1],
> lpGuidString,
> > +        (MAX_GUID_STRING_LEN - 3)*sizeof(WCHAR));
> > +    guidStringWithBraces[MAX_GUID_STRING_LEN - 2]
> = (WCHAR) '}';
> > +    guidStringWithBraces[MAX_GUID_STRING_LEN - 1]
> = 0;
> > +    RpcStringFreeW(&lpGuidString);
> 
> Just wondering, shouldn't that be something like
> 
>      guidStringWithBraces[0] = (WCHAR) '{';
>      CopyMemory(&guidStringWithBraces[1],
> lpGuidString,
>          (MAX_GUID_STRING_LEN - 3)*sizeof(WCHAR));
>      guidStringWithBraces[1 + strlenW(lpGuidString)]
> = (WCHAR) '}';
>      guidStringWithBraces[2 + strlenW(lpGuidString)]
> = 0;
>      RpcStringFreeW(&lpGuidString);
> 
> HTH,
> 
> Joris

It works as it is, and all GUID strings are the same
length, so MAX_GUID_STRING_LEN is faster since it
evaluates at compile time.

Damjan


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the wine-devel mailing list