Commit 5c377858 authored by Alexandre Julliard's avatar Alexandre Julliard

Use Get/SetWindowLongPtr when accessing pointers in the window extra

bytes.
parent 5b7da809
...@@ -469,7 +469,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, ...@@ -469,7 +469,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
default: default:
return 0; return 0;
} }
oldHbitmap = (HBITMAP)SetWindowLongW( hWnd, HIMAGE_GWL_OFFSET, lParam ); oldHbitmap = (HBITMAP)SetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET, lParam );
InvalidateRect( hWnd, NULL, FALSE ); InvalidateRect( hWnd, NULL, FALSE );
return (LRESULT)oldHbitmap; return (LRESULT)oldHbitmap;
......
...@@ -152,7 +152,7 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style) ...@@ -152,7 +152,7 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) ) if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
{ {
lphc->self = hwnd; lphc->self = hwnd;
SetWindowLongW( hwnd, 0, (LONG)lphc ); SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc );
/* some braindead apps do try to use scrollbar/border flags */ /* some braindead apps do try to use scrollbar/border flags */
...@@ -190,7 +190,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc ) ...@@ -190,7 +190,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox ) if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
DestroyWindow( lphc->hWndLBox ); DestroyWindow( lphc->hWndLBox );
SetWindowLongW( lphc->self, 0, 0 ); SetWindowLongPtrW( lphc->self, 0, 0 );
HeapFree( GetProcessHeap(), 0, lphc ); HeapFree( GetProcessHeap(), 0, lphc );
} }
return 0; return 0;
...@@ -1865,7 +1865,7 @@ static char *strdupA(LPCSTR str) ...@@ -1865,7 +1865,7 @@ static char *strdupA(LPCSTR str)
static LRESULT ComboWndProc_common( HWND hwnd, UINT message, static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam, BOOL unicode ) WPARAM wParam, LPARAM lParam, BOOL unicode )
{ {
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongW( hwnd, 0 ); LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 );
TRACE("[%p]: msg %s wp %08x lp %08lx\n", TRACE("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam ); hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
......
...@@ -424,7 +424,7 @@ static inline LRESULT DefWindowProcT(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ...@@ -424,7 +424,7 @@ static inline LRESULT DefWindowProcT(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam, BOOL unicode ) WPARAM wParam, LPARAM lParam, BOOL unicode )
{ {
EDITSTATE *es = (EDITSTATE *)GetWindowLongW( hwnd, 0 ); EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 );
LRESULT result = 0; LRESULT result = 0;
TRACE("hwnd=%p msg=%x (%s) wparam=%x lparam=%lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), wParam, lParam); TRACE("hwnd=%p msg=%x (%s) wparam=%x lparam=%lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), wParam, lParam);
...@@ -4116,7 +4116,7 @@ static LRESULT EDIT_WM_Destroy(EDITSTATE *es) ...@@ -4116,7 +4116,7 @@ static LRESULT EDIT_WM_Destroy(EDITSTATE *es)
pc = pp; pc = pp;
} }
SetWindowLongW( es->hwndSelf, 0, 0 ); SetWindowLongPtrW( es->hwndSelf, 0, 0 );
HeapFree(GetProcessHeap(), 0, es); HeapFree(GetProcessHeap(), 0, es);
return 0; return 0;
...@@ -4615,7 +4615,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode) ...@@ -4615,7 +4615,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode)
if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es)))) if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es))))
return FALSE; return FALSE;
SetWindowLongW( hwnd, 0, (LONG)es ); SetWindowLongPtrW( hwnd, 0, (LONG_PTR)es );
/* /*
* Note: since the EDITSTATE has not been fully initialized yet, * Note: since the EDITSTATE has not been fully initialized yet,
......
...@@ -2489,7 +2489,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc ) ...@@ -2489,7 +2489,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
descr->owner = lphc->self; descr->owner = lphc->self;
} }
SetWindowLongW( descr->self, 0, (LONG)descr ); SetWindowLongPtrW( descr->self, 0, (LONG_PTR)descr );
/* if (wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) descr->style &= ~LBS_NOTIFY; /* if (wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) descr->style &= ~LBS_NOTIFY;
*/ */
...@@ -2530,7 +2530,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc ) ...@@ -2530,7 +2530,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
static BOOL LISTBOX_Destroy( LB_DESCR *descr ) static BOOL LISTBOX_Destroy( LB_DESCR *descr )
{ {
LISTBOX_ResetContent( descr ); LISTBOX_ResetContent( descr );
SetWindowLongW( descr->self, 0, 0 ); SetWindowLongPtrW( descr->self, 0, 0 );
HeapFree( GetProcessHeap(), 0, descr ); HeapFree( GetProcessHeap(), 0, descr );
return TRUE; return TRUE;
} }
...@@ -2542,7 +2542,7 @@ static BOOL LISTBOX_Destroy( LB_DESCR *descr ) ...@@ -2542,7 +2542,7 @@ static BOOL LISTBOX_Destroy( LB_DESCR *descr )
static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam, BOOL unicode ) WPARAM wParam, LPARAM lParam, BOOL unicode )
{ {
LB_DESCR *descr = (LB_DESCR *)GetWindowLongW( hwnd, 0 ); LB_DESCR *descr = (LB_DESCR *)GetWindowLongPtrW( hwnd, 0 );
LPHEADCOMBO lphc = 0; LPHEADCOMBO lphc = 0;
LRESULT ret; LRESULT ret;
...@@ -2555,7 +2555,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, ...@@ -2555,7 +2555,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
CREATESTRUCTW *lpcs = (CREATESTRUCTW *)lParam; CREATESTRUCTW *lpcs = (CREATESTRUCTW *)lParam;
if (lpcs->style & LBS_COMBOBOX) lphc = (LPHEADCOMBO)lpcs->lpCreateParams; if (lpcs->style & LBS_COMBOBOX) lphc = (LPHEADCOMBO)lpcs->lpCreateParams;
if (!LISTBOX_Create( hwnd, lphc )) return -1; if (!LISTBOX_Create( hwnd, lphc )) return -1;
TRACE("creating wnd=%p descr=%lx\n", hwnd, GetWindowLongW( hwnd, 0 ) ); TRACE("creating wnd=%p descr=%lx\n", hwnd, GetWindowLongPtrW( hwnd, 0 ) );
return 0; return 0;
} }
/* Ignore all other messages before we get a WM_CREATE */ /* Ignore all other messages before we get a WM_CREATE */
......
...@@ -3129,7 +3129,7 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, ...@@ -3129,7 +3129,7 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam,
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam; CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam;
SetWindowLongW( hwnd, 0, (LONG)cs->lpCreateParams ); SetWindowLongPtrW( hwnd, 0, (LONG_PTR)cs->lpCreateParams );
return 0; return 0;
} }
...@@ -3141,7 +3141,7 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, ...@@ -3141,7 +3141,7 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam,
PAINTSTRUCT ps; PAINTSTRUCT ps;
BeginPaint( hwnd, &ps ); BeginPaint( hwnd, &ps );
MENU_DrawPopupMenu( hwnd, ps.hdc, MENU_DrawPopupMenu( hwnd, ps.hdc,
(HMENU)GetWindowLongW( hwnd, 0 ) ); (HMENU)GetWindowLongPtrW( hwnd, 0 ) );
EndPaint( hwnd, &ps ); EndPaint( hwnd, &ps );
return 0; return 0;
} }
...@@ -3157,18 +3157,18 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, ...@@ -3157,18 +3157,18 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam,
if( wParam ) if( wParam )
{ {
if (!GetWindowLongW( hwnd, 0 )) ERR("no menu to display\n"); if (!GetWindowLongPtrW( hwnd, 0 )) ERR("no menu to display\n");
} }
else else
SetWindowLongW( hwnd, 0, 0 ); SetWindowLongPtrW( hwnd, 0, 0 );
break; break;
case MM_SETMENUHANDLE: case MM_SETMENUHANDLE:
SetWindowLongW( hwnd, 0, wParam ); SetWindowLongPtrW( hwnd, 0, wParam );
break; break;
case MM_GETMENUHANDLE: case MM_GETMENUHANDLE:
return GetWindowLongW( hwnd, 0 ); return GetWindowLongPtrW( hwnd, 0 );
default: default:
return DefWindowProcW( hwnd, message, wParam, lParam ); return DefWindowProcW( hwnd, message, wParam, lParam );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment