On 6/12/07, Misha Koshelev mk144210@bcm.edu wrote:
This is necessary (bug not sufficient, see my comment in the bug report that I am about to post) to fix bug 8678.
It is also clearly correct, as checking the type "returned" by RegQueryValueEx when it fails makes no sense.
size = 0;
res = RegQueryValueExW(env, var, NULL, &type, NULL, &size);
- if ((res != ERROR_MORE_DATA && res != ERROR_FILE_NOT_FOUND) || type != REG_SZ)
+ if ((res != ERROR_MORE_DATA && res != ERROR_FILE_NOT_FOUND) ||
+ (res == ERROR_SUCCESS && type != REG_SZ))
{
RegCloseKey(env);
return res;
This is wrong. If res == ERROR_SUCCESS, then the first condition evaluates to TRUE and we fall through to exit, but then again, res will never be ERROR_SUCCESS after that particular call. Either way, I have a patch ready to send in that fixes the entire action.