From 6d0b86a92b925192346df871210694dedeaae29c Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 2 Nov 2006 12:21:53 +0000 Subject: [PATCH] comctl32: Fix return value of PropertySheet() for modal propsheets. --- dlls/comctl32/propsheet.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 1fd5caf71be..4c81ec73cc0 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -122,8 +122,6 @@ typedef struct tagPropSheetInfo BOOL hasApply; BOOL hasFinish; BOOL useCallback; - BOOL restartWindows; - BOOL rebootSystem; BOOL activeValid; PropPageInfo* proppage; HFONT hFont; @@ -132,6 +130,7 @@ typedef struct tagPropSheetInfo int height; HIMAGELIST hImageList; BOOL ended; + INT result; } PropSheetInfo; typedef struct @@ -333,8 +332,7 @@ static BOOL PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh, if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0; - psInfo->restartWindows = FALSE; - psInfo->rebootSystem = FALSE; + psInfo->result = 0; psInfo->hImageList = 0; psInfo->activeValid = FALSE; @@ -388,8 +386,7 @@ static BOOL PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh, if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0; - psInfo->restartWindows = FALSE; - psInfo->rebootSystem = FALSE; + psInfo->result = 0; psInfo->hImageList = 0; psInfo->activeValid = FALSE; @@ -2763,6 +2760,9 @@ static INT do_loop(PropSheetInfo *psInfo) ret = -1; } + if(ret != -1) + ret = psInfo->result; + DestroyWindow(hwnd); return ret; } @@ -3147,14 +3147,10 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID) { PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); - int result = TRUE; - if (psInfo->restartWindows) - result = ID_PSRESTARTWINDOWS; - - /* reboot system takes precedence over restart windows */ - if (psInfo->rebootSystem) - result = ID_PSREBOOTSYSTEM; + /* don't overwrite ID_PSRESTARTWINDOWS or ID_PSREBOOTSYSTEM */ + if (psInfo->result == 0) + psInfo->result = IDOK; if (psInfo->isModeless) psInfo->activeValid = FALSE; @@ -3630,7 +3626,10 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (!psInfo) return FALSE; - psInfo->restartWindows = TRUE; + /* reboot system takes precedence over restart windows */ + if (psInfo->result != ID_PSREBOOTSYSTEM) + psInfo->result = ID_PSRESTARTWINDOWS; + return TRUE; } @@ -3642,7 +3641,8 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (!psInfo) return FALSE; - psInfo->rebootSystem = TRUE; + psInfo->result = ID_PSREBOOTSYSTEM; + return TRUE; }