Hi,
Another case where I don't think I know enough of the finer details for a correct solution.
MS Visual C++ 1.5 IDE - 16 bit win application - communicates its window handle to WINTEE32.EXE - win32 app - to handle the build process:
E:\MSVC\BIN\WINTEE32.EXE -h2a -vn
5e is the 16 bit window handle.
Here it sends data to the IDE:
0035:Call user32.SendMessageA(ffff002a,0000004a,0008004a,77a3fe28) ret=77a51649
That does not work, SendMessageA does only expect full 32 bit win handles. Things work with this patch:
========================================================================== --- wine/dlls/user/message.c 2005-05-05 10:26:28.000000000 +0200 +++ mywine/dlls/user/message.c 2005-05-05 20:07:46.000000000 +0200 @@ -2388,6 +2388,13 @@ LRESULT WINAPI SendMessageTimeoutA( HWND return 1; }
+ /* if it is not a 32bit window handle */ + if( !IsWindow( hwnd)) { + /* try if it is a 16 bit handle */ + hwnd = WIN_Handle32( (HWND16) hwnd ); + info.hwnd = hwnd; + } + if (!(dest_tid = GetWindowThreadProcessId( hwnd, &dest_pid ))) return 0;
if (USER_IsExitingThread( dest_tid )) return 0; ==========================================================================
Is anything else needed, I wonder?
Rein.
"Rein Klazes" wijn@wanadoo.nl wrote:
E:\MSVC\BIN\WINTEE32.EXE -h2a -vn
5e is the 16 bit window handle.
2a I'd guess, not 5e.
Here it sends data to the IDE:
0035:Call user32.SendMessageA(ffff002a,0000004a,0008004a,77a3fe28) ret=77a51649
That does not work, SendMessageA does only expect full 32 bit win handles.
You need to find out why and how 2a became ffff002a in the first place.
On Sat, 7 May 2005 19:48:02 +0900, you wrote:
"Rein Klazes" wijn@wanadoo.nl wrote:
E:\MSVC\BIN\WINTEE32.EXE -h2a -vn
5e is the 16 bit window handle.
2a I'd guess, not 5e.
You guess correctly.
Here it sends data to the IDE:
0035:Call user32.SendMessageA(ffff002a,0000004a,0008004a,77a3fe28) ret=77a51649
That does not work, SendMessageA does only expect full 32 bit win handles.
You need to find out why and how 2a became ffff002a in the first place.
Setting the hiword to ffff, I think. I hoped I did not need to prove that by going through the disassembled code.
Rein.
Rein Klazes wijn@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 )