Re: [setupapi] fix return values and GUID string in SetupDiOpenClassRegKeyExW
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
--- Joris Huizer <jorishuizer(a)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
participants (2)
-
Damjan Jovanovic -
Joris Huizer