[4/5] GetWindowLongPtr: Windows
Robert Shearman
rob at codeweavers.com
Wed Sep 22 12:18:09 CDT 2004
Hi,
Once again, if this patch conflicts with your work just shout and make
Alexandre drop it for the moment.
Rob
Changelog:
GetWindowLong -> GetWindowLongPtr.
-------------- next part --------------
Index: wine/windows/defwnd.c
===================================================================
RCS file: /home/wine/wine/windows/defwnd.c,v
retrieving revision 1.91
diff -u -p -r1.91 defwnd.c
--- wine/windows/defwnd.c 1 Sep 2004 18:26:41 -0000 1.91
+++ wine/windows/defwnd.c 22 Sep 2004 17:01:31 -0000
@@ -621,7 +621,7 @@ static LRESULT DEFWND_DefWinProc( HWND h
UINT len;
HICON hIcon = (HICON)GetClassLongW( hwnd, GCL_HICON );
- HINSTANCE instance = (HINSTANCE)GetWindowLongW( hwnd, GWL_HINSTANCE );
+ HINSTANCE instance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
if (hIcon) return (LRESULT)hIcon;
for(len=1; len<64; len++)
if((hIcon = LoadIconW(instance, MAKEINTRESOURCEW(len))))
Index: wine/windows/dialog.c
===================================================================
RCS file: /home/wine/wine/windows/dialog.c,v
retrieving revision 1.134
diff -u -p -r1.134 dialog.c
--- wine/windows/dialog.c 10 Sep 2004 22:29:02 -0000 1.134
+++ wine/windows/dialog.c 22 Sep 2004 17:01:31 -0000
@@ -360,7 +360,7 @@ static BOOL DIALOG_CreateControls32( HWN
if (hwndDefButton)
SendMessageA( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE );
hwndDefButton = hwndCtrl;
- dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID );
+ dlgInfo->idResult = GetWindowLongPtrA( hwndCtrl, GWLP_ID );
}
}
TRACE(" END\n" );
@@ -1219,7 +1219,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndD
*/
INT WINAPI GetDlgCtrlID( HWND hwnd )
{
- return GetWindowLongW( hwnd, GWL_ID );
+ return GetWindowLongPtrW( hwnd, GWLP_ID );
}
@@ -1234,7 +1234,7 @@ HWND WINAPI GetDlgItem( HWND hwndDlg, IN
if (!list) return 0;
- for (i = 0; list[i]; i++) if (GetWindowLongW( list[i], GWL_ID ) == id) break;
+ for (i = 0; list[i]; i++) if (GetWindowLongPtrW( list[i], GWLP_ID ) == id) break;
ret = list[i];
HeapFree( GetProcessHeap(), 0, list );
return ret;
@@ -1378,7 +1378,7 @@ UINT WINAPI IsDlgButtonChecked( HWND hwn
*/
static BOOL CALLBACK CheckRB(HWND hwndChild, LPARAM lParam)
{
- LONG lChildID = GetWindowLongA(hwndChild, GWL_ID);
+ LONG lChildID = GetWindowLongPtrW(hwndChild, GWLP_ID);
RADIOGROUP *lpRadioGroup = (RADIOGROUP *) lParam;
if ((lChildID >= lpRadioGroup->firstID) &&
@@ -1386,11 +1386,11 @@ static BOOL CALLBACK CheckRB(HWND hwndCh
{
if (lChildID == lpRadioGroup->checkID)
{
- SendMessageA(hwndChild, BM_SETCHECK, BST_CHECKED, 0);
+ SendMessageW(hwndChild, BM_SETCHECK, BST_CHECKED, 0);
}
else
{
- SendMessageA(hwndChild, BM_SETCHECK, BST_UNCHECKED, 0);
+ SendMessageW(hwndChild, BM_SETCHECK, BST_UNCHECKED, 0);
}
}
Index: wine/windows/mdi.c
===================================================================
RCS file: /home/wine/wine/windows/mdi.c,v
retrieving revision 1.134
diff -u -p -r1.134 mdi.c
--- wine/windows/mdi.c 21 Sep 2004 20:04:10 -0000 1.134
+++ wine/windows/mdi.c 22 Sep 2004 17:01:32 -0000
@@ -152,7 +152,7 @@ static HWND MDI_GetChildByID(HWND hwnd,
for (i = 0; ci->nActiveChildren; i++)
{
- if (GetWindowLongW( ci->child[i], GWL_ID ) == id)
+ if (GetWindowLongPtrW( ci->child[i], GWLP_ID ) == id)
return ci->child[i];
}
return 0;
@@ -430,7 +430,7 @@ static LRESULT MDI_RefreshMenu(MDICLIENT
visible++;
- SetWindowLongW(ci->child[i], GWL_ID, id);
+ SetWindowLongPtrW(ci->child[i], GWLP_ID, id);
buf[0] = '&';
buf[1] = '0' + visible;
Index: wine/windows/message.c
===================================================================
RCS file: /home/wine/wine/windows/message.c,v
retrieving revision 1.159
diff -u -p -r1.159 message.c
--- wine/windows/message.c 26 Nov 2003 22:29:30 -0000 1.159
+++ wine/windows/message.c 22 Sep 2004 17:01:32 -0000
@@ -288,7 +288,7 @@ static BOOL process_cooked_keyboard_mess
HELPINFO hi;
hi.cbSize = sizeof(HELPINFO);
hi.iContextType = HELPINFO_WINDOW;
- hi.iCtrlId = GetWindowLongA( msg->hwnd, GWL_ID );
+ hi.iCtrlId = GetWindowLongPtrA( msg->hwnd, GWLP_ID );
hi.hItemHandle = msg->hwnd;
hi.dwContextId = GetWindowContextHelpId( msg->hwnd );
hi.MousePos = msg->pt;
Index: wine/windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.248
diff -u -p -r1.248 win.c
--- wine/windows/win.c 21 Sep 2004 00:24:22 -0000 1.248
+++ wine/windows/win.c 22 Sep 2004 17:01:34 -0000
@@ -201,7 +201,7 @@ static void send_parent_notify( HWND hwn
if ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_CHILD | WS_POPUP)) == WS_CHILD &&
!(GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY))
SendMessageW( GetParent(hwnd), WM_PARENTNOTIFY,
- MAKEWPARAM( msg, GetWindowLongW( hwnd, GWL_ID )), (LPARAM)hwnd );
+ MAKEWPARAM( msg, GetWindowLongPtrW( hwnd, GWLP_ID )), (LPARAM)hwnd );
}
@@ -640,7 +640,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd )
if (!(wndPtr->dwStyle & WS_CHILD))
{
- HMENU menu = (HMENU)SetWindowLongW( hwnd, GWL_ID, 0 );
+ HMENU menu = (HMENU)SetWindowLongPtrW( hwnd, GWLP_ID, 0 );
if (menu) DestroyMenu( menu );
}
if (wndPtr->hSysMenu)
@@ -1165,7 +1165,7 @@ static HWND WIN_CreateWindowEx( CREATEST
}
}
}
- else SetWindowLongW( hwnd, GWL_ID, (UINT)cs->hMenu );
+ else SetWindowLongPtrW( hwnd, GWLP_ID, (ULONG_PTR)cs->hMenu );
WIN_ReleaseWndPtr( wndPtr );
if (!USER_Driver.pCreateWindow( hwnd, cs, unicode))
@@ -1797,14 +1799,14 @@ WORD WINAPI GetWindowWord( HWND hwnd, IN
switch(offset)
{
- case GWL_HWNDPARENT:
- return GetWindowLongW( hwnd, offset );
- case GWL_ID:
- case GWL_HINSTANCE:
+ case GWLP_HWNDPARENT:
+ return GetWindowLongPtrW( hwnd, offset );
+ case GWLP_ID:
+ case GWLP_HINSTANCE:
{
- LONG ret = GetWindowLongW( hwnd, offset );
+ LONG_PTR ret = GetWindowLongPtrW( hwnd, offset );
if (HIWORD(ret))
- WARN("%d: discards high bits of 0x%08lx!\n", offset, ret );
+ ERR("%d: discards high bits of 0x%08lx!\n", offset, ret );
return LOWORD(ret);
}
default:
@@ -1824,10 +1826,10 @@ WORD WINAPI SetWindowWord( HWND hwnd, IN
switch(offset)
{
- case GWL_ID:
- case GWL_HINSTANCE:
- case GWL_HWNDPARENT:
- return SetWindowLongW( hwnd, offset, (UINT)newval );
+ case GWLP_ID:
+ case GWLP_HINSTANCE:
+ case GWLP_HWNDPARENT:
+ return SetWindowLongPtrW( hwnd, offset, (ULONG_PTR)newval );
default:
if (offset < 0)
{
@@ -1884,16 +1886,16 @@ WORD WINAPI SetWindowWord( HWND hwnd, IN
*
* Helper function for GetWindowLong().
*/
-static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
+static LONG_PTR WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
{
- LONG retvalue = 0;
+ LONG_PTR retvalue = 0;
WND *wndPtr;
- if (offset == GWL_HWNDPARENT)
+ if (offset == GWLP_HWNDPARENT)
{
HWND parent = GetAncestor( hwnd, GA_PARENT );
if (parent == GetDesktopWindow()) parent = GetWindow( hwnd, GW_OWNER );
- return (LONG)parent;
+ return (ULONG_PTR)parent;
}
if (!(wndPtr = WIN_GetPtr( hwnd )))
@@ -1904,7 +1906,7 @@ static LONG WIN_GetWindowLong( HWND hwnd
if (wndPtr == WND_OTHER_PROCESS)
{
- if (offset == GWL_WNDPROC)
+ if (offset == GWLP_WNDPROC)
{
SetLastError( ERROR_ACCESS_DENIED );
return 0;
@@ -1919,11 +1921,11 @@ static LONG WIN_GetWindowLong( HWND hwnd
{
switch(offset)
{
- case GWL_STYLE: retvalue = reply->old_style; break;
- case GWL_EXSTYLE: retvalue = reply->old_ex_style; break;
- case GWL_ID: retvalue = reply->old_id; break;
- case GWL_HINSTANCE: retvalue = (ULONG_PTR)reply->old_instance; break;
- case GWL_USERDATA: retvalue = (ULONG_PTR)reply->old_user_data; break;
+ case GWL_STYLE: retvalue = reply->old_style; break;
+ case GWL_EXSTYLE: retvalue = reply->old_ex_style; break;
+ case GWLP_ID: retvalue = reply->old_id; break;
+ case GWLP_HINSTANCE: retvalue = (ULONG_PTR)reply->old_instance; break;
+ case GWLP_USERDATA: retvalue = (ULONG_PTR)reply->old_user_data; break;
default:
if (offset >= 0) retvalue = reply->old_extra_value;
else SetLastError( ERROR_INVALID_INDEX );
@@ -1974,12 +1976,12 @@ static LONG WIN_GetWindowLong( HWND hwnd
switch(offset)
{
- case GWL_USERDATA: retvalue = wndPtr->userdata; break;
+ case GWLP_USERDATA: retvalue = wndPtr->userdata; break;
case GWL_STYLE: retvalue = wndPtr->dwStyle; break;
case GWL_EXSTYLE: retvalue = wndPtr->dwExStyle; break;
- case GWL_ID: retvalue = (LONG)wndPtr->wIDmenu; break;
- case GWL_WNDPROC: retvalue = (LONG)WINPROC_GetProc( wndPtr->winproc, type ); break;
- case GWL_HINSTANCE: retvalue = (LONG)wndPtr->hInstance; break;
+ case GWLP_ID: retvalue = (ULONG_PTR)wndPtr->wIDmenu; break;
+ case GWLP_WNDPROC: retvalue = (ULONG_PTR)WINPROC_GetProc( wndPtr->winproc, type ); break;
+ case GWLP_HINSTANCE: retvalue = (ULONG_PTR)wndPtr->hInstance; break;
default:
WARN("Unknown offset %d\n", offset );
SetLastError( ERROR_INVALID_INDEX );
@@ -1998,8 +2000,8 @@ static LONG WIN_GetWindowLong( HWND hwnd
* 0 is the failure code. However, in the case of failure SetLastError
* must be set to distinguish between a 0 return value and a failure.
*/
-static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
- WINDOWPROCTYPE type )
+static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
+ WINDOWPROCTYPE type )
{
STYLESTRUCT style;
BOOL ok;
@@ -2015,7 +2017,7 @@ static LONG WIN_SetWindowLong( HWND hwnd
}
if (!WIN_IsCurrentProcess( hwnd ))
{
- if (offset == GWL_WNDPROC)
+ if (offset == GWLP_WNDPROC)
{
SetLastError( ERROR_ACCESS_DENIED );
return 0;
@@ -2045,31 +2047,31 @@ static LONG WIN_SetWindowLong( HWND hwnd
if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
newval = style.styleNew;
break;
- case GWL_HWNDPARENT:
+ case GWLP_HWNDPARENT:
if (wndPtr->parent == GetDesktopWindow())
{
WIN_ReleasePtr( wndPtr );
- return (LONG)WIN_SetOwner( hwnd, (HWND)newval );
+ return (ULONG_PTR)WIN_SetOwner( hwnd, (HWND)newval );
}
else
{
WIN_ReleasePtr( wndPtr );
- return (LONG)SetParent( hwnd, (HWND)newval );
+ return (ULONG_PTR)SetParent( hwnd, (HWND)newval );
}
- case GWL_WNDPROC:
- retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type );
+ case GWLP_WNDPROC:
+ retval = (ULONG_PTR)WINPROC_GetProc( wndPtr->winproc, type );
WINPROC_SetProc( &wndPtr->winproc, (WNDPROC)newval, type, WIN_PROC_WINDOW );
WIN_ReleasePtr( wndPtr );
return retval;
- case GWL_ID:
- case GWL_HINSTANCE:
- case GWL_USERDATA:
+ case GWLP_ID:
+ case GWLP_HINSTANCE:
+ case GWLP_USERDATA:
break;
- case DWL_DLGPROC:
- if ((wndPtr->cbWndExtra + sizeof(LONG) >= DWL_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
+ case DWLP_DLGPROC:
+ if ((wndPtr->cbWndExtra + sizeof(LONG) >= DWLP_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
{
- WNDPROC *ptr = (WNDPROC *)((char *)wndPtr->wExtra + DWL_DLGPROC);
- retval = (LONG)WINPROC_GetProc( *ptr, type );
+ WNDPROC *ptr = (WNDPROC *)((char *)wndPtr->wExtra + DWLP_DLGPROC);
+ retval = (ULONG_PTR)WINPROC_GetProc( *ptr, type );
WINPROC_SetProc( ptr, (WNDPROC)newval, type, WIN_PROC_WINDOW );
WIN_ReleasePtr( wndPtr );
return retval;
@@ -2085,7 +2087,7 @@ static LONG WIN_SetWindowLong( HWND hwnd
}
else
{
- LONG *ptr = (LONG *)((char *)wndPtr->wExtra + offset);
+ LONG_PTR *ptr = (LONG_PTR *)((char *)wndPtr->wExtra + offset);
if (*ptr == newval) /* already set to the same value */
{
WIN_ReleasePtr( wndPtr );
@@ -2109,15 +2111,15 @@ static LONG WIN_SetWindowLong( HWND hwnd
req->flags = SET_WIN_EXSTYLE;
req->ex_style = newval;
break;
- case GWL_ID:
+ case GWLP_ID:
req->flags = SET_WIN_ID;
req->id = newval;
break;
- case GWL_HINSTANCE:
+ case GWLP_HINSTANCE:
req->flags = SET_WIN_INSTANCE;
req->instance = (void *)newval;
break;
- case GWL_USERDATA:
+ case GWLP_USERDATA:
req->flags = SET_WIN_USERDATA;
req->user_data = (void *)newval;
break;
@@ -2139,15 +2141,15 @@ static LONG WIN_SetWindowLong( HWND hwnd
wndPtr->dwExStyle = newval;
retval = reply->old_ex_style;
break;
- case GWL_ID:
+ case GWLP_ID:
wndPtr->wIDmenu = newval;
retval = reply->old_id;
break;
- case GWL_HINSTANCE:
+ case GWLP_HINSTANCE:
wndPtr->hInstance = (HINSTANCE)newval;
retval = (ULONG_PTR)reply->old_instance;
break;
- case GWL_USERDATA:
+ case GWLP_USERDATA:
wndPtr->userdata = newval;
retval = (ULONG_PTR)reply->old_user_data;
break;
@@ -2238,23 +2240,23 @@ LONG WINAPI SetWindowLongA( HWND hwnd, I
*
* GWL_STYLE The window's window style.
*
- * GWL_WNDPROC Pointer to the window's window procedure.
+ * GWLP_WNDPROC Pointer to the window's window procedure.
*
- * GWL_HINSTANCE The window's pplication instance handle.
+ * GWLP_HINSTANCE The window's pplication instance handle.
*
- * GWL_ID The window's identifier.
+ * GWLP_ID The window's identifier.
*
- * GWL_USERDATA The window's user-specified data.
+ * GWLP_USERDATA The window's user-specified data.
*
* If the window is a dialog box, the _offset_ parameter can be one of
* the following values:
*
- * DWL_DLGPROC The address of the window's dialog box procedure.
+ * DWLP_DLGPROC The address of the window's dialog box procedure.
*
- * DWL_MSGRESULT The return value of a message
+ * DWLP_MSGRESULT The return value of a message
* that the dialog box procedure processed.
*
- * DWL_USER Application specific information.
+ * DWLP_USER Application specific information.
*
* RETURNS
*
@@ -2625,7 +2627,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND p
{
if (!(wndPtr->dwStyle & WS_CHILD))
{
- HMENU menu = (HMENU)SetWindowLongW( hwnd, GWL_ID, 0 );
+ HMENU menu = (HMENU)SetWindowLongPtrW( hwnd, GWLP_ID, 0 );
if (menu) DestroyMenu( menu );
}
}
Index: wine/windows/winproc.c
===================================================================
RCS file: /home/wine/wine/windows/winproc.c,v
retrieving revision 1.119
diff -u -p -r1.119 winproc.c
--- wine/windows/winproc.c 15 Sep 2004 18:04:07 -0000 1.119
+++ wine/windows/winproc.c 22 Sep 2004 17:01:34 -0000
@@ -361,7 +361,7 @@ static LRESULT WINAPI WINPROC_CallWndPro
context.SegDs = context.SegEs = SELECTOROF(teb->cur_stack);
context.SegFs = wine_get_fs();
context.SegGs = wine_get_gs();
- if (!(context.Eax = GetWindowWord( HWND_32(hwnd), GWL_HINSTANCE ))) context.Eax = context.SegDs;
+ if (!(context.Eax = GetWindowWord( HWND_32(hwnd), GWLP_HINSTANCE ))) context.Eax = context.SegDs;
context.SegCs = SELECTOROF(proc);
context.Eip = OFFSETOF(proc);
context.Ebp = OFFSETOF(teb->cur_stack)
More information about the wine-patches
mailing list