aboutsummaryrefslogtreecommitdiff
path: root/system/wine/LOTRO.patch
blob: 4f760793ce96f5ecde007d2d8535a32a42d95690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From b9716dfe5f6283f83131fe6a638eea14c137ceb4 Mon Sep 17 00:00:00 2001
From: Daniel Santos <daniel.santos@pobox.com>
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