msi: Do not use type value if call to RegQueryValueEx failed.
Koshelev, Misha Vladislavo
mk144210 at bcm.tmc.edu
Wed Jun 13 09:41:28 CDT 2007
http://www.winehq.org/pipermail/wine-patches/2007-June/040336.html
The third version I sent out (yes I know, I was quite sleepy) _is_ correct though.
And that particular call _will_ return ERROR_SUCCESS and _not_ ERROR_MORE_DATA,
see:
http://msdn2.microsoft.com/en-us/library/ms724911.aspx
Specifically, a call to RegQueryValueEx with a NULL data pointer and a valid size pointer returns
ERROR_SUCCESS if the size pointer is filled, _not_ ERROR_MORE_DATA, which is returned
if a valid data pointer is passed.
Misha
________________________________
From: James Hawkins [mailto:truiken at gmail.com]
Sent: Wed 6/13/2007 1:22 AM
To: wine-devel at winehq.org
Cc: Koshelev, Misha Vladislavo
Subject: Re: msi: Do not use type value if call to RegQueryValueEx failed.
On 6/12/07, Misha Koshelev <mk144210 at 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.
--
James Hawkins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20070613/3eec83f0/attachment-0001.htm
More information about the wine-devel
mailing list