From b9716dfe5f6283f83131fe6a638eea14c137ceb4 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Mon, 15 Oct 2012 15:12:59 -0500 Subject: user32: Don't ignore return/error value of MapWindowPoints ScreenToClient should return zero if the operation fails, but is always returning TRUE. This patch corrects the problem and solves a crash bug in Lord of the Rings Online (bug #31979) Credit for discovering the source of this problem should go to somebody else, as yet unidentified, since the original patch came from a closed forum for beta testers of the LoTRO Riders of Rohan expansion and the forum has subsequently been wiped. However, I'll take credit for fixing it up, but if I ever figure out where it came from, hopefully they can get credit as well. --- dlls/user32/winpos.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index 5a2f1f2..80aab32 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -250,8 +250,15 @@ BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt ) */ BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt ) { - MapWindowPoints( 0, hwnd, lppnt, 1 ); - return TRUE; + DWORD old_err = GetLastError(); + BOOL ret; + + SetLastError(0xd00d13); + ret = MapWindowPoints( 0, hwnd, lppnt, 1 ) != 0 || + GetLastError() != 0xd00d13; + SetLastError(old_err); + + return ret; } -- 1.7.3.4