Hugh McMaster hugh.mcmaster@outlook.com writes:
Yes, sorry about that. I'll send an updated patch.
It seems to me that it would be better to check for a backslash or null-terminator at the valid string length, instead of calculating the input key length. Something like the following:
for (i = 0; i < num_class_keys; i++) { int len = lstrlenW(reg_class_namesW[i]); WCHAR wc = lpKeyName[len]; if (!strncmp(lpKeyName, reg_class_namesW[i], len) && (wc == 0 || wc == '\\')) { *hKey = reg_class_keys[i]; break; } }
Is this preferable? Or do you want to use pointer arithmetic?
You can do it that way, but you can't access lpKeyName[len] before the strncmp since you don't know if the string is long enough.