comctl32: Fix return value of PropertySheet() for modal propsheets.

This commit is contained in:
Huw Davies 2006-11-02 12:21:53 +00:00 committed by Alexandre Julliard
parent 1ebf1471c0
commit 6d0b86a92b
1 changed files with 15 additions and 15 deletions

View File

@ -122,8 +122,6 @@ typedef struct tagPropSheetInfo
BOOL hasApply; BOOL hasApply;
BOOL hasFinish; BOOL hasFinish;
BOOL useCallback; BOOL useCallback;
BOOL restartWindows;
BOOL rebootSystem;
BOOL activeValid; BOOL activeValid;
PropPageInfo* proppage; PropPageInfo* proppage;
HFONT hFont; HFONT hFont;
@ -132,6 +130,7 @@ typedef struct tagPropSheetInfo
int height; int height;
HIMAGELIST hImageList; HIMAGELIST hImageList;
BOOL ended; BOOL ended;
INT result;
} PropSheetInfo; } PropSheetInfo;
typedef struct typedef struct
@ -333,8 +332,7 @@ static BOOL PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh,
if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages) if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages)
psInfo->active_page = 0; psInfo->active_page = 0;
psInfo->restartWindows = FALSE; psInfo->result = 0;
psInfo->rebootSystem = FALSE;
psInfo->hImageList = 0; psInfo->hImageList = 0;
psInfo->activeValid = FALSE; psInfo->activeValid = FALSE;
@ -388,8 +386,7 @@ static BOOL PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh,
if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages) if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages)
psInfo->active_page = 0; psInfo->active_page = 0;
psInfo->restartWindows = FALSE; psInfo->result = 0;
psInfo->rebootSystem = FALSE;
psInfo->hImageList = 0; psInfo->hImageList = 0;
psInfo->activeValid = FALSE; psInfo->activeValid = FALSE;
@ -2763,6 +2760,9 @@ static INT do_loop(PropSheetInfo *psInfo)
ret = -1; ret = -1;
} }
if(ret != -1)
ret = psInfo->result;
DestroyWindow(hwnd); DestroyWindow(hwnd);
return ret; return ret;
} }
@ -3147,14 +3147,10 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID)
{ {
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
PropSheetInfoStr); PropSheetInfoStr);
int result = TRUE;
if (psInfo->restartWindows) /* don't overwrite ID_PSRESTARTWINDOWS or ID_PSREBOOTSYSTEM */
result = ID_PSRESTARTWINDOWS; if (psInfo->result == 0)
psInfo->result = IDOK;
/* reboot system takes precedence over restart windows */
if (psInfo->rebootSystem)
result = ID_PSREBOOTSYSTEM;
if (psInfo->isModeless) if (psInfo->isModeless)
psInfo->activeValid = FALSE; psInfo->activeValid = FALSE;
@ -3630,7 +3626,10 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!psInfo) if (!psInfo)
return FALSE; return FALSE;
psInfo->restartWindows = TRUE; /* reboot system takes precedence over restart windows */
if (psInfo->result != ID_PSREBOOTSYSTEM)
psInfo->result = ID_PSRESTARTWINDOWS;
return TRUE; return TRUE;
} }
@ -3642,7 +3641,8 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!psInfo) if (!psInfo)
return FALSE; return FALSE;
psInfo->rebootSystem = TRUE; psInfo->result = ID_PSREBOOTSYSTEM;
return TRUE; return TRUE;
} }