Don't allow comctl32 controls to access their infoPtr before it has

been  allocated or after it has been freed.
This commit is contained in:
James Abbatiello 2001-02-12 03:42:23 +00:00 committed by Alexandre Julliard
parent 14150c1ad5
commit 841ef6ebb9
5 changed files with 20 additions and 15 deletions

View File

@ -1164,6 +1164,7 @@ DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("\n"); TRACE("\n");
COMCTL32_Free (infoPtr); COMCTL32_Free (infoPtr);
SetWindowLongA( hwnd, 0, 0 );
return 0; return 0;
} }
@ -1171,6 +1172,9 @@ DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI static LRESULT WINAPI
DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!DATETIME_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
return DefWindowProcA( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
{ {

View File

@ -195,6 +195,9 @@ FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI static LRESULT WINAPI
FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
return DefWindowProcA( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:

View File

@ -55,6 +55,7 @@ NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* free comboex info data */ /* free comboex info data */
COMCTL32_Free (infoPtr); COMCTL32_Free (infoPtr);
SetWindowLongA( hwnd, 0, 0 );
return 0; return 0;
} }
@ -64,6 +65,9 @@ NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI static LRESULT WINAPI
NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!NATIVEFONT_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
return DefWindowProcA( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
{ {

View File

@ -1099,7 +1099,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
if (!infoPtr && (uMsg != WM_CREATE)) if (!infoPtr && (uMsg != WM_CREATE))
return DefWindowProcA (hwnd, uMsg, wParam, lParam); return DefWindowProcA (hwnd, uMsg, wParam, lParam);
switch (uMsg) switch (uMsg)
{ {

View File

@ -4266,20 +4266,8 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
static LRESULT WINAPI static LRESULT WINAPI
ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!TOOLBAR_GetInfoPtr(hwnd) && (uMsg != WM_NCCREATE))
switch (uMsg) return DefWindowProcA( hwnd, uMsg, wParam, lParam );
{
case WM_DESTROY:
return TOOLBAR_Destroy (hwnd, wParam, lParam);
case WM_NCCREATE:
return TOOLBAR_NCCreate (hwnd, wParam, lParam);
}
if (!TOOLBAR_GetInfoPtr (hwnd))
{
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
}
switch (uMsg) switch (uMsg)
{ {
@ -4541,6 +4529,9 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_CREATE: case WM_CREATE:
return TOOLBAR_Create (hwnd, wParam, lParam); return TOOLBAR_Create (hwnd, wParam, lParam);
case WM_DESTROY:
return TOOLBAR_Destroy (hwnd, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
return TOOLBAR_EraseBackground (hwnd, wParam, lParam); return TOOLBAR_EraseBackground (hwnd, wParam, lParam);
@ -4574,6 +4565,9 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_NCCALCSIZE: case WM_NCCALCSIZE:
return TOOLBAR_NCCalcSize (hwnd, wParam, lParam); return TOOLBAR_NCCalcSize (hwnd, wParam, lParam);
case WM_NCCREATE:
return TOOLBAR_NCCreate (hwnd, wParam, lParam);
case WM_NCPAINT: case WM_NCPAINT:
return TOOLBAR_NCPaint (hwnd, wParam, lParam); return TOOLBAR_NCPaint (hwnd, wParam, lParam);