user32: check input in SetScrollInfo

Matt Finnicum mattfinn at gmail.com
Fri Aug 11 11:41:14 CDT 2006


This time, with a patch attached.. oops.

On 8/11/06, Matt Finnicum <mattfinn at gmail.com> wrote:
> Hi,
> SetScrollInfo in user32's scrollbar control is supposed to enforce
> maximum and minimum values for position and pagesize. Causes odd
> drawing errors in some richedit controls. This patch is consistent
> with msdn (http://windowssdk.msdn.microsoft.com/en-us/library/ms651293.aspx)
> and with testing on native.
> --Matt Finnicum
>
-------------- next part --------------
From 6ac27f07141f9cd49ed89b2da33d6b620fc7097e Mon Sep 17 00:00:00 2001
From: Matthew Finnicum <MattFinn at gmail.com>
Date: Thu, 10 Aug 2006 16:28:46 -0400
Subject: [PATCH] user32: check input in SetScrollInfo
---
 dlls/user/scroll.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/user/scroll.c b/dlls/user/scroll.c
index e9eae77..8d70076 100644
--- a/dlls/user/scroll.c
+++ b/dlls/user/scroll.c
@@ -1621,8 +1621,10 @@ static INT SCROLL_SetScrollInfo( HWND hw
     if (info->fMask & SIF_PAGE)
     {
 	if( infoPtr->page != info->nPage && info->nPage >= 0)
-	{
-            infoPtr->page = info->nPage;
+	{   /* check boundaries */
+	    infoPtr->page = max(0,info->nPage);
+            infoPtr->page = min(info->nMax - info->nMin + 1, infoPtr->page);
+            
             action |= SA_SSI_REFRESH;
 	}
     }
@@ -1632,8 +1634,9 @@ static INT SCROLL_SetScrollInfo( HWND hw
     if (info->fMask & SIF_POS)
     {
 	if( infoPtr->curVal != info->nPos )
-	{
-	    infoPtr->curVal = info->nPos;
+	{   /* check boundaries */
+	    infoPtr->curVal = max(info->nMin, info->nPos);
+	    infoPtr->curVal = min(info->nMax-max(infoPtr->page - 1, 0),infoPtr->curVal);
             action |= SA_SSI_REFRESH;
 	}
     }
-- 
1.4.1.1


More information about the wine-patches mailing list