comctl32: Do not crash, when the startpage is invalid

Detlef Riekenberg wine.dev at web.de
Thu Nov 30 17:50:31 CST 2006


Native printui.dll(w2k) use 4 Propsheet, but set nPages to 5

Wine detected in PropsheetW, that nPages was wrong
(PROPSHEET_CollectPageInfo failed) and decremented 
psInfo->nPages, but psInfo->active_page was out of
range in this case.

Reproduce the Bug:
"rundll32.exe printui.dll,PrintUIEntry /s /t 4"

Windows activates Page#0 on this command: We should do the same.


Changelog:
 comctl32: Do not crash, when the startpage is invalid

-- 
 
By by ... Detlef

-------------- next part --------------
>From 5831e06311e8c169a0097a2d1e48e5f2dbfc26df Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Fri, 1 Dec 2006 00:32:36 +0100
Subject: [PATCH] comctl32: Do not crash, when the startpage is invalid
---
 dlls/comctl32/propsheet.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index 7261d19..8490d74 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -2824,6 +2824,9 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHE
     }
   }
 
+  if (psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0;
+  TRACE("startpage: %d of %d pages\n", psInfo->active_page, psInfo->nPages);
+
   psInfo->unicode = FALSE;
   psInfo->ended = FALSE;
 
@@ -2875,6 +2878,9 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHE
     }
   }
 
+  if (psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0;
+  TRACE("startpage: %d of %d pages\n", psInfo->active_page, psInfo->nPages);
+
   psInfo->unicode = TRUE;
   psInfo->ended = FALSE;
 
-- 
1.4.1



More information about the wine-patches mailing list