Alexandre Julliard : user32: Fix tick counter wrap-around handling.

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:52 CST 2014


Module: wine
Branch: stable
Commit: 65f93d20e8fbff642ba3e68fd799246442e977d1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=65f93d20e8fbff642ba3e68fd799246442e977d1

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Oct 21 14:48:01 2013 +0200

user32: Fix tick counter wrap-around handling.

(cherry picked from commit 7b2eafbc8a7073cb70c4eb4d19691ef5c25807b0)

---

 dlls/user32/dde_client.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/dde_client.c b/dlls/user32/dde_client.c
index 91e1549..7a30ed2 100644
--- a/dlls/user32/dde_client.c
+++ b/dlls/user32/dde_client.c
@@ -1017,22 +1017,20 @@ static WDML_QUEUE_STATE WDML_HandleReply(WDML_CONV* pConv, MSG* msg, HDDEDATA* h
  */
 static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, const WDML_XACT* pXAct, DWORD *ack)
 {
-    DWORD	dwTime;
+    DWORD	start, elapsed;
     DWORD	err;
     WDML_CONV*	pConv;
 
     TRACE("Starting wait for a timeout of %d ms\n", dwTimeout);
 
-    /* FIXME: time 32 bit wrap around */
-    dwTimeout += GetCurrentTime();
-
-    while ((dwTime = GetCurrentTime()) < dwTimeout)
+    start = GetTickCount();
+    while ((elapsed = GetTickCount() - start) < dwTimeout)
     {
 	/* we cannot be in the crit sect all the time because when client and server run in a
 	 * single process they need to share the access to the internal data
 	 */
 	if (MsgWaitForMultipleObjects(0, NULL, FALSE,
-				      dwTimeout - dwTime, QS_POSTMESSAGE) == WAIT_OBJECT_0)
+				      dwTimeout - elapsed, QS_POSTMESSAGE) == WAIT_OBJECT_0)
 	{
 	    MSG		msg;
 




More information about the wine-cvs mailing list