user32: Implement GetWindowModuleFileName with tests
Reece Dunn
msclrhd at googlemail.com
Fri Feb 8 06:42:30 CST 2008
On 08/02/2008, Dmitry Timoshkov <dmitry at codeweavers.com> wrote:
> "Maarten Lankhorst" <m.b.lankhorst at gmail.com> wrote:
>
> > + retval = GetWindowModuleFileNameW(hwnd, filenameW, cchFileNameMax);
> > + if (retval)
> > + {
> > + DWORD lasterror = GetLastError();
> > + WideCharToMultiByte(CP_ACP, 0, filenameW, -1, lpszFileName, cchFileNameMax, NULL, NULL);
> > + SetLastError(lasterror);
>
> What's the point of saving/restoring last error value? If WideCharToMultiByte
> fails you need to return an error in that case, not silently continue.
The usual model is something like this:
SetLastError(0xdeadbeef);
WinApiCall();
ok(GetLastError() == ERROR_SUCCESS, "WinApiCall failed, expected
ERROR_SUCCESS, got %d", GetLastError());
- Reece
More information about the wine-devel
mailing list