Added validations for page index before using it.
This commit is contained in:
parent
2d06944f38
commit
7d487c914f
|
@ -1021,6 +1021,9 @@ static BOOL PROPSHEET_Back(HWND hwndDlg)
|
||||||
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
||||||
PropSheetInfoStr);
|
PropSheetInfoStr);
|
||||||
|
|
||||||
|
if (psInfo->active_page <= 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
hdr.code = PSN_WIZBACK;
|
hdr.code = PSN_WIZBACK;
|
||||||
|
|
||||||
|
@ -1053,6 +1056,9 @@ static BOOL PROPSHEET_Next(HWND hwndDlg)
|
||||||
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
||||||
PropSheetInfoStr);
|
PropSheetInfoStr);
|
||||||
|
|
||||||
|
if (psInfo->active_page < 0 || psInfo->active_page == psInfo->nPages - 1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
hdr.code = PSN_WIZNEXT;
|
hdr.code = PSN_WIZNEXT;
|
||||||
|
|
||||||
|
@ -1084,6 +1090,9 @@ static BOOL PROPSHEET_Finish(HWND hwndDlg)
|
||||||
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
||||||
PropSheetInfoStr);
|
PropSheetInfoStr);
|
||||||
|
|
||||||
|
if (psInfo->active_page < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
hdr.code = PSN_WIZFINISH;
|
hdr.code = PSN_WIZFINISH;
|
||||||
|
|
||||||
|
@ -1116,6 +1125,9 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg)
|
||||||
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
||||||
PropSheetInfoStr);
|
PropSheetInfoStr);
|
||||||
|
|
||||||
|
if (psInfo->active_page < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1152,9 +1164,13 @@ static void PROPSHEET_Cancel(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
||||||
PropSheetInfoStr);
|
PropSheetInfoStr);
|
||||||
HWND hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
HWND hwndPage;
|
||||||
NMHDR hdr;
|
NMHDR hdr;
|
||||||
|
|
||||||
|
if (psInfo->active_page < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
hdr.code = PSN_QUERYCANCEL;
|
hdr.code = PSN_QUERYCANCEL;
|
||||||
|
|
||||||
|
@ -1178,9 +1194,13 @@ static void PROPSHEET_Help(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
||||||
PropSheetInfoStr);
|
PropSheetInfoStr);
|
||||||
HWND hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
HWND hwndPage;
|
||||||
NMHDR hdr;
|
NMHDR hdr;
|
||||||
|
|
||||||
|
if (psInfo->active_page < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
hdr.code = PSN_HELP;
|
hdr.code = PSN_HELP;
|
||||||
|
|
||||||
|
@ -1301,9 +1321,8 @@ static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg)
|
||||||
HWND hwndPage;
|
HWND hwndPage;
|
||||||
NMHDR hdr;
|
NMHDR hdr;
|
||||||
|
|
||||||
if (!psInfo)
|
if (!psInfo || psInfo->active_page < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notify the current page.
|
* Notify the current page.
|
||||||
*/
|
*/
|
||||||
|
@ -1328,6 +1347,9 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
|
||||||
HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP);
|
HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP);
|
||||||
NMHDR hdr;
|
NMHDR hdr;
|
||||||
|
|
||||||
|
if (psInfo->active_page < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
||||||
|
|
||||||
hdr.hwndFrom = hwndDlg;
|
hdr.hwndFrom = hwndDlg;
|
||||||
|
@ -1335,14 +1357,12 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
|
||||||
* hpage takes precedence over index.
|
* hpage takes precedence over index.
|
||||||
*/
|
*/
|
||||||
if (hpage != NULL)
|
if (hpage != NULL)
|
||||||
{
|
|
||||||
index = PROPSHEET_GetPageIndex(hpage, psInfo);
|
index = PROPSHEET_GetPageIndex(hpage, psInfo);
|
||||||
|
|
||||||
if (index == -1)
|
if (index < 0 || index >= psInfo->nPages)
|
||||||
{
|
{
|
||||||
TRACE("Could not find page to remove!\n");
|
TRACE("Could not find page to select!\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hwndPage = psInfo->proppage[index].hwndPage;
|
hwndPage = psInfo->proppage[index].hwndPage;
|
||||||
|
@ -1804,6 +1824,8 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
|
HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
|
||||||
LPCPROPSHEETPAGEA ppshpage;
|
LPCPROPSHEETPAGEA ppshpage;
|
||||||
|
|
||||||
|
SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Small icon in the title bar.
|
* Small icon in the title bar.
|
||||||
*/
|
*/
|
||||||
|
@ -1868,9 +1890,6 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
if (!(psInfo->ppshheader->dwFlags & PSH_WIZARD))
|
if (!(psInfo->ppshheader->dwFlags & PSH_WIZARD))
|
||||||
SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
|
SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
|
||||||
|
|
||||||
SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
|
|
||||||
|
|
||||||
|
|
||||||
if (!HIWORD(psInfo->ppshheader->pszCaption) &&
|
if (!HIWORD(psInfo->ppshheader->pszCaption) &&
|
||||||
psInfo->ppshheader->hInstance)
|
psInfo->ppshheader->hInstance)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue