comctl32/propsheet: Test and fix for crash processing PSM_INDEXTOHWND with no longer valid handle.

This commit is contained in:
Ričardas Barkauskas 2009-10-17 19:11:29 +03:00 committed by Alexandre Julliard
parent 1aee359542
commit a8f89a2ffa
2 changed files with 9 additions and 1 deletions

View File

@ -2553,6 +2553,8 @@ static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex)
{
PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
if (!psInfo)
return 0;
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
WARN("%d out of range.\n", iPageIndex);
return 0;

View File

@ -26,6 +26,7 @@
#include "wine/test.h"
static HWND parent;
static HWND sheethwnd;
static LONG active_page = -1;
@ -40,12 +41,13 @@ static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
char caption[256];
GetWindowTextA(hwnd, caption, sizeof(caption));
ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
sheethwnd = hwnd;
return 0;
}
}
return 0;
}
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam)
{
@ -71,6 +73,10 @@ static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
return FALSE;
}
}
case WM_NCDESTROY:
ok(!SendMessageA(sheethwnd, PSM_INDEXTOHWND, 400, 0),"Should always be 0\n");
return TRUE;
default:
return FALSE;
}