From b82e2884fcaca3329e88cb9d90ff05d2b1c12f89 Mon Sep 17 00:00:00 2001 From: Ahmed Arif Date: Mon, 29 Jun 2026 21:10:41 +0200 Subject: [PATCH] [NTUSER] Report fresh scrollbar state in co_IntGetScrollBarInfo (#9137) `co_IntGetScrollBarInfo()` computed the `rgstate` bits into the output buffer and then immediately overwrote them with the cached copy, so callers always got stale state. Fix this by copying the cached info before computing `rgstate`. This also exposed an inverted `WS_DISABLED` test (per wine, disabled `SB_CTL` should report `UNAVAILABLE`, not enabled ones), which is now fixed as well. --- win32ss/user/ntuser/scrollbar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c index 5e39fe4ad7e..3189d80fae7 100644 --- a/win32ss/user/ntuser/scrollbar.c +++ b/win32ss/user/ntuser/scrollbar.c @@ -701,6 +701,8 @@ co_IntGetScrollBarInfo(PWND Window, LONG idObject, PSCROLLBARINFO psbi) IntGetScrollBarRect(Window, Bar, &(sbi->rcScrollBar)); IntCalculateThumb(Window, Bar, sbi, pSBData); + RtlCopyMemory(psbi, sbi, sizeof(*psbi)); + // Scrollbar state psbi->rgstate[0] = 0; if ((Bar == SB_HORZ && !(Window->style & WS_HSCROLL)) @@ -713,11 +715,9 @@ co_IntGetScrollBarInfo(PWND Window, LONG idObject, PSCROLLBARINFO psbi) else psbi->rgstate[0] |= STATE_SYSTEM_OFFSCREEN; } - if (Bar == SB_CTL && !(Window->style & WS_DISABLED)) + if (Bar == SB_CTL && (Window->style & WS_DISABLED)) psbi->rgstate[0] |= STATE_SYSTEM_UNAVAILABLE; - RtlCopyMemory(psbi, sbi, sizeof(SCROLLBARINFO)); - return TRUE; }