16 bit hwnd in SendmessageA/W
Alexandre Julliard
julliard at winehq.org
Sat May 7 07:21:42 CDT 2005
Rein Klazes <wijn at wanadoo.nl> writes:
> Is anything else needed, I wonder?
Yes, try something like this:
Index: dlls/user/win.c
===================================================================
RCS file: /opt/cvs-commit/wine/dlls/user/win.c,v
retrieving revision 1.2
diff -u -p -r1.2 win.c
--- dlls/user/win.c 27 Apr 2005 10:23:24 -0000 1.2
+++ dlls/user/win.c 7 May 2005 12:18:40 -0000
@@ -307,13 +307,14 @@ WND *WIN_GetPtr( HWND hwnd )
USER_Lock();
if ((ptr = user_handles[index]))
{
- if (ptr->dwMagic == WND_MAGIC && (!HIWORD(hwnd) || hwnd == ptr->hwndSelf))
+ if (ptr->dwMagic == WND_MAGIC &&
+ (hwnd == ptr->hwndSelf || !HIWORD(hwnd) || HIWORD(hwnd) == 0xffff))
return ptr;
ptr = NULL;
}
else if (index == USER_HANDLE_TO_INDEX(hwndDesktop))
{
- if (!HIWORD(hwnd) || hwnd == GetDesktopWindow()) ptr = WND_DESKTOP;
+ if (hwnd == GetDesktopWindow() || !HIWORD(hwnd) || HIWORD(hwnd) == 0xffff) ptr = WND_DESKTOP;
else ptr = NULL;
}
else ptr = WND_OTHER_PROCESS;
Index: server/user.c
===================================================================
RCS file: /opt/cvs-commit/wine/server/user.c,v
retrieving revision 1.8
diff -u -p -r1.8 user.c
--- server/user.c 28 May 2004 19:35:37 -0000 1.8
+++ server/user.c 7 May 2005 12:18:40 -0000
@@ -35,12 +35,14 @@ static int allocated_handles;
static struct user_handle *handle_to_entry( user_handle_t handle )
{
+ unsigned short generation;
int index = (((unsigned int)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
if (index < 0 || index >= nb_handles) return NULL;
if (!handles[index].type) return NULL;
- if (((unsigned int)handle >> 16) && ((unsigned int)handle >> 16 != handles[index].generation))
- return NULL;
- return &handles[index];
+ generation = (unsigned int)handle >> 16;
+ if (generation == handles[index].generation || !generation || generation == 0xffff)
+ return &handles[index];
+ return NULL;
}
inline static user_handle_t entry_to_handle( struct user_handle *ptr )
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list