From 94e4485bff3308f0c2fefe0523fa5f5d319e4233 Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Sat, 23 Jan 1999 14:15:17 +0000 Subject: [PATCH] Implemented WIN16_CallMsgFilter32, WIN16_DispatchMessage32, DrawAnimatedRects16 (stub), FormatMessage16, WIN16_GetMessage32, WIN16_PeekMessage32 and WIN16_TranslateMessage32. --- graphics/painting.c | 23 +++++++++ if1632/user.spec | 14 +++--- include/wine/winuser16.h | 13 +++++ loader/pe_image.c | 2 + misc/lstr.c | 15 ++++++ windows/hook.c | 43 +++++++++++++++++ windows/message.c | 102 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 205 insertions(+), 7 deletions(-) diff --git a/graphics/painting.c b/graphics/painting.c index bc647082134..b424d638236 100644 --- a/graphics/painting.c +++ b/graphics/painting.c @@ -871,6 +871,29 @@ BOOL32 WINAPI FloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color ) } +/********************************************************************** + * DrawAnimatedRects16 (USER.448) + */ +BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni, + const RECT16* lprcFrom, + const RECT16* lprcTo ) +{ + RECT32 rcFrom32, rcTo32; + + rcFrom32.left = (INT32)lprcFrom->left; + rcFrom32.top = (INT32)lprcFrom->top; + rcFrom32.right = (INT32)lprcFrom->right; + rcFrom32.bottom = (INT32)lprcFrom->bottom; + + rcTo32.left = (INT32)lprcTo->left; + rcTo32.top = (INT32)lprcTo->top; + rcTo32.right = (INT32)lprcTo->right; + rcTo32.bottom = (INT32)lprcTo->bottom; + + return DrawAnimatedRects32((HWND32)hwnd, (INT32)idAni, &rcFrom32, &rcTo32); +} + + /********************************************************************** * DrawAnimatedRects32 (USER32.153) */ diff --git a/if1632/user.spec b/if1632/user.spec index 2113bb287f2..b2096585772 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -406,7 +406,7 @@ file user.exe 445 pascal DefFrameProc(word word word word long) DefFrameProc16 446 stub SetMenuItemInfo 447 pascal DefMDIChildProc(word word word long) DefMDIChildProc16 -448 stub DrawAnimatedRects +448 pascal16 DrawAnimatedRects(word word ptr ptr) DrawAnimatedRects16 449 stub DrawState 450 pascal16 CreateIconFromResourceEx(ptr long word long word word word) CreateIconFromResourceEx16 451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel16 @@ -485,7 +485,7 @@ file user.exe 602 stub SetCheckCursorTimer 604 stub BroadcastSystemMessage 605 stub HackTaskMonitor -606 stub FormatMessage +606 pascal FormatMessage(long ptr word word ptr word ptr) FormatMessage16 608 pascal16 GetForegroundWindow() GetForegroundWindow16 609 pascal16 SetForegroundWindow(word) SetForegroundWindow16 610 stub DestroyIcon32 @@ -516,12 +516,12 @@ file user.exe 802 stub OPENFILENAME_CALLBACK16 803 stub PRINTDLG_CALLBACK16 804 stub CHOOSECOLOR_CALLBACK16 -819 stub PeekMessage32 -820 stub GetMessage32 -821 stub TranslateMessage32 +819 pascal16 PeekMessage32(ptr word word word word word) WIN16_PeekMessage32 +820 pascal GetMessage32(segptr word word word word) WIN16_GetMessage32 +821 pascal16 TranslateMessage32(ptr word) WIN16_TranslateMessage32 #821 stub IsDialogMessage32 # FIXME: two ordinal 821??? -822 stub DispatchMessage32 -823 stub CallMsgFilter32 +822 pascal DispatchMessage32(ptr word) WIN16_DispatchMessage32 +823 pascal16 CallMsgFilter32(segptr word word) WIN16_CallMsgFilter32 825 stub PostMessage32 826 stub PostThreadMessage32 827 pascal16 MessageBoxIndirect(ptr) MessageBoxIndirect16 diff --git a/include/wine/winuser16.h b/include/wine/winuser16.h index 056258b30cc..afaede607c5 100644 --- a/include/wine/winuser16.h +++ b/include/wine/winuser16.h @@ -59,6 +59,12 @@ typedef struct POINT16 pt WINE_PACKED; } MSG16, *LPMSG16; +typedef struct +{ + MSG16 msg; + WORD wParamHigh; +} MSG16_32, *LPMSG16_32; + /* Cursors / Icons */ typedef struct @@ -228,6 +234,7 @@ HDWP16 WINAPI BeginDeferWindowPos16(INT16); HDC16 WINAPI BeginPaint16(HWND16,LPPAINTSTRUCT16); BOOL16 WINAPI BringWindowToTop16(HWND16); BOOL16 WINAPI CallMsgFilter16(SEGPTR,INT16); +BOOL16 WINAPI WIN16_CallMsgFilter32(SEGPTR,INT16,BOOL16); LRESULT WINAPI CallNextHookEx16(HHOOK,INT16,WPARAM16,LPARAM); LRESULT WINAPI CallWindowProc16(WNDPROC16,HWND16,UINT16,WPARAM16,LPARAM); BOOL16 WINAPI ChangeClipboardChain16(HWND16,HWND16); @@ -278,6 +285,7 @@ INT16 WINAPI DialogBoxIndirect16(HINSTANCE16,HANDLE16,HWND16,DLGPROC16); INT16 WINAPI DialogBoxIndirectParam16(HINSTANCE16,HANDLE16,HWND16,DLGPROC16,LPARAM); INT16 WINAPI DialogBoxParam16(HINSTANCE16,SEGPTR,HWND16,DLGPROC16,LPARAM); LONG WINAPI DispatchMessage16(const MSG16*); +LONG WINAPI WIN16_DispatchMessage32(const MSG16_32*,BOOL16); INT16 WINAPI DlgDirList16(HWND16,LPSTR,INT16,INT16,UINT16); INT16 WINAPI DlgDirListComboBox16(HWND16,LPSTR,INT16,INT16,UINT16); BOOL16 WINAPI DlgDirSelectComboBoxEx16(HWND16,LPSTR,INT16,INT16); @@ -286,6 +294,7 @@ BOOL32 WINAPI DlgDirSelectComboBoxEx32W(HWND32,LPWSTR,INT32,INT32); BOOL16 WINAPI DlgDirSelectEx16(HWND16,LPSTR,INT16,INT16); BOOL16 WINAPI DragDetect16(HWND16,POINT16); DWORD WINAPI DragObject16(HWND16,HWND16,UINT16,HANDLE16,WORD,HCURSOR16); +BOOL16 WINAPI DrawAnimatedRects16(HWND16,INT16,const RECT16*,const RECT16*); BOOL16 WINAPI DrawCaption16(HWND16,HDC16,const RECT16*,UINT16); BOOL16 WINAPI DrawCaptionTemp16(HWND16,HDC16, const RECT16*,HFONT16,HICON16,LPCSTR,UINT16); BOOL16 WINAPI DrawEdge16(HDC16,LPRECT16,UINT16,UINT16); @@ -312,6 +321,7 @@ INT16 WINAPI FillRect16(HDC16,const RECT16*,HBRUSH16); HWND16 WINAPI FindWindow16(SEGPTR,LPCSTR); HWND16 WINAPI FindWindowEx16(HWND16,HWND16,SEGPTR,LPCSTR); BOOL16 WINAPI FlashWindow16(HWND16,BOOL16); +DWORD WINAPI FormatMessage16(DWORD,LPCVOID,WORD,WORD,LPSTR,WORD,LPDWORD); INT16 WINAPI FrameRect16(HDC16,const RECT16*,HBRUSH16); HWND16 WINAPI GetActiveWindow16(void); WORD WINAPI GetAsyncKeyState16(INT16); @@ -354,6 +364,7 @@ BOOL16 WINAPI GetMenuItemRect16(HWND16,HMENU16,UINT16,LPRECT16); UINT16 WINAPI GetMenuState16(HMENU16,UINT16,UINT16); INT16 WINAPI GetMenuString16(HMENU16,UINT16,LPSTR,INT16,UINT16); BOOL16 WINAPI GetMessage16(SEGPTR,HWND16,UINT16,UINT16); +BOOL16 WINAPI WIN16_GetMessage32(SEGPTR,HWND16,UINT16,UINT16,BOOL16); HWND16 WINAPI GetNextDlgGroupItem16(HWND16,HWND16,BOOL16); HWND16 WINAPI GetNextDlgTabItem16(HWND16,HWND16,BOOL16); HWND16 WINAPI GetNextWindow16(HWND16,WORD); @@ -433,6 +444,7 @@ void WINAPI OffsetRect16(LPRECT16,INT16,INT16); BOOL16 WINAPI OpenClipboard16(HWND16); BOOL16 WINAPI OpenIcon16(HWND16); BOOL16 WINAPI PeekMessage16(LPMSG16,HWND16,UINT16,UINT16,UINT16); +BOOL16 WINAPI WIN16_PeekMessage32(LPMSG16_32,HWND16,UINT16,UINT16,UINT16,BOOL16); BOOL16 WINAPI PostAppMessage16(HTASK16,UINT16,WPARAM16,LPARAM); BOOL16 WINAPI PostMessage16(HWND16,UINT16,WPARAM16,LPARAM); void WINAPI PostQuitMessage16(INT16); @@ -509,6 +521,7 @@ BOOL16 WINAPI TrackPopupMenu16(HMENU16,UINT16,INT16,INT16,INT16,HWND16,cons INT16 WINAPI TranslateAccelerator16(HWND16,HACCEL16,LPMSG16); BOOL16 WINAPI TranslateMDISysAccel16(HWND16,LPMSG16); BOOL16 WINAPI TranslateMessage16(const MSG16*); +BOOL16 WINAPI WIN16_TranslateMessage32(const MSG16_32*,BOOL16); INT16 WINAPI TransmitCommChar16(INT16,CHAR); BOOL16 WINAPI UnionRect16(LPRECT16,const RECT16*,const RECT16*); BOOL16 WINAPI UnregisterClass16(SEGPTR,HINSTANCE16); diff --git a/loader/pe_image.c b/loader/pe_image.c index 46f9fb951df..1a4b99ca37f 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -874,8 +874,10 @@ HINSTANCE16 PE_CreateProcess( LPCSTR name, LPCSTR cmd_line, /* Load file */ if ((hModule32 = PE_LoadImage( name, &ofs, &modName )) < 32) return hModule32; +#if 0 if (PE_HEADER(hModule32)->FileHeader.Characteristics & IMAGE_FILE_DLL) return 20; /* FIXME: not the right error code */ +#endif /* Create 16-bit dummy module */ if ((hModule16 = MODULE_CreateDummyModule( &ofs, modName )) < 32) return hModule16; diff --git a/misc/lstr.c b/misc/lstr.c index c121ad41eb0..625e469b6e2 100644 --- a/misc/lstr.c +++ b/misc/lstr.c @@ -512,6 +512,21 @@ BOOL32 WINAPI IsCharUpper32W(WCHAR x) return iswupper(x); } +/*********************************************************************** + * FormatMessage16 (USER.606) + */ +DWORD WINAPI FormatMessage16( + DWORD dwFlags, + LPCVOID lpSource, + WORD dwMessageId, + WORD dwLanguageId, + LPSTR lpBuffer, + WORD nSize, + LPDWORD args /* va_list *args */ +) { + return FormatMessage32A(dwFlags, lpSource, (DWORD)dwMessageId, (DWORD)dwLanguageId, lpBuffer, (DWORD)nSize, args); +} + /*********************************************************************** * FormatMessage32A (KERNEL32.138) * FIXME: missing wrap,FROM_SYSTEM message-loading, diff --git a/windows/hook.c b/windows/hook.c index 61928bd7894..5aac94eb9eb 100644 --- a/windows/hook.c +++ b/windows/hook.c @@ -1346,6 +1346,49 @@ BOOL16 WINAPI CallMsgFilter16( SEGPTR msg, INT16 code ) } +/*********************************************************************** + * WIN16_CallMsgFilter32 (USER.823) + */ +BOOL16 WINAPI WIN16_CallMsgFilter32( SEGPTR msg16_32, INT16 code, BOOL16 wHaveParamHigh ) +{ + MSG16_32 *lpmsg16_32 = (MSG16_32 *)PTR_SEG_TO_LIN(msg16_32); + + if (wHaveParamHigh == FALSE) + { + lpmsg16_32->wParamHigh = 0; + /* WARNING: msg16_32->msg has to be the first variable in the struct */ + return CallMsgFilter16(msg16_32, code); + } + else + { + MSG32 msg32; + BOOL16 ret; + + msg32.hwnd = lpmsg16_32->msg.hwnd; + msg32.message = lpmsg16_32->msg.message; + msg32.wParam = + MAKELONG(lpmsg16_32->msg.wParam, lpmsg16_32->wParamHigh); + msg32.lParam = lpmsg16_32->msg.lParam; + msg32.time = lpmsg16_32->msg.time; + msg32.pt.x = (INT32)lpmsg16_32->msg.pt.x; + msg32.pt.y = (INT32)lpmsg16_32->msg.pt.y; + + ret = (BOOL16)CallMsgFilter32A(&msg32, (INT32)code); + + lpmsg16_32->msg.hwnd = msg32.hwnd; + lpmsg16_32->msg.message = msg32.message; + lpmsg16_32->msg.wParam = LOWORD(msg32.wParam); + lpmsg16_32->msg.lParam = msg32.lParam; + lpmsg16_32->msg.time = msg32.time; + lpmsg16_32->msg.pt.x = (INT16)msg32.pt.x; + lpmsg16_32->msg.pt.y = (INT16)msg32.pt.y; + lpmsg16_32->wParamHigh = HIWORD(msg32.wParam); + + return ret; + } +} + + /*********************************************************************** * CallMsgFilter32A (USER32.15) */ diff --git a/windows/message.c b/windows/message.c index 84e915182a3..1072c84e2f9 100644 --- a/windows/message.c +++ b/windows/message.c @@ -933,6 +933,37 @@ BOOL16 WINAPI PeekMessage16( LPMSG16 msg, HWND16 hwnd, UINT16 first, return MSG_PeekMessage( msg, hwnd, first, last, flags, TRUE ); } +/*********************************************************************** + * WIN16_PeekMessage32 (USER.819) + */ +BOOL16 WINAPI WIN16_PeekMessage32( LPMSG16_32 lpmsg16_32, HWND16 hwnd, + UINT16 first, UINT16 last, UINT16 flags, BOOL16 wHaveParamHigh ) +{ + if (wHaveParamHigh == FALSE) + { + lpmsg16_32->wParamHigh = 0; + return PeekMessage16(&(lpmsg16_32->msg), hwnd, first, last, flags); + } + else + { + MSG32 msg32; + BOOL16 ret; + + ret = (BOOL16)PeekMessage32A(&msg32, (HWND32)hwnd, + (UINT32)first, (UINT32)last, (UINT32)flags); + lpmsg16_32->msg.hwnd = msg32.hwnd; + lpmsg16_32->msg.message = msg32.message; + lpmsg16_32->msg.wParam = LOWORD(msg32.wParam); + lpmsg16_32->msg.lParam = msg32.lParam; + lpmsg16_32->msg.time = msg32.time; + lpmsg16_32->msg.pt.x = (INT16)msg32.pt.x; + lpmsg16_32->msg.pt.y = (INT16)msg32.pt.y; + lpmsg16_32->wParamHigh = HIWORD(msg32.wParam); + return ret; + } +} + + /*********************************************************************** * PeekMessageA */ @@ -1000,6 +1031,39 @@ BOOL16 WINAPI GetMessage16( SEGPTR msg, HWND16 hwnd, UINT16 first, UINT16 last) return (lpmsg->message != WM_QUIT); } +/*********************************************************************** + * WIN16_GetMessage32 (USER.820) + */ +BOOL16 WIN16_GetMessage32( SEGPTR msg16_32, HWND16 hWnd, UINT16 first, + UINT16 last, BOOL16 wHaveParamHigh ) +{ + MSG16_32 *lpmsg16_32 = (MSG16_32 *)PTR_SEG_TO_LIN(msg16_32); + + if (wHaveParamHigh == FALSE) /* normal GetMessage16 call */ + { + + lpmsg16_32->wParamHigh = 0; /* you never know... */ + /* WARNING: msg16_32->msg has to be the first variable in the struct */ + return GetMessage16(msg16_32, hWnd, first, last); + } + else + { + MSG32 msg32; + BOOL16 ret; + + ret = (BOOL16)GetMessage32A(&msg32, hWnd, first, last); + lpmsg16_32->msg.hwnd = msg32.hwnd; + lpmsg16_32->msg.message = msg32.message; + lpmsg16_32->msg.wParam = LOWORD(msg32.wParam); + lpmsg16_32->msg.lParam = msg32.lParam; + lpmsg16_32->msg.time = msg32.time; + lpmsg16_32->msg.pt.x = (INT16)msg32.pt.x; + lpmsg16_32->msg.pt.y = (INT16)msg32.pt.y; + lpmsg16_32->wParamHigh = HIWORD(msg32.wParam); + return ret; + } +} + /*********************************************************************** * GetMessage32A (USER32.270) */ @@ -1703,6 +1767,22 @@ BOOL16 WINAPI TranslateMessage16( const MSG16 *msg ) } +/*********************************************************************** + * WIN16_TranslateMessage32 (USER.821) + */ +BOOL16 WINAPI WIN16_TranslateMessage32( const MSG16_32 *msg, BOOL16 wHaveParamHigh ) +{ + WPARAM32 wParam; + + if (wHaveParamHigh) + wParam = MAKELONG(msg->msg.wParam, msg->wParamHigh); + else + wParam = (WPARAM32)msg->msg.wParam; + + return MSG_DoTranslateMessage( msg->msg.message, msg->msg.hwnd, + wParam, msg->msg.lParam ); +} + /*********************************************************************** * TranslateMessage32 (USER32.556) */ @@ -1758,6 +1838,28 @@ LONG WINAPI DispatchMessage16( const MSG16* msg ) } +/*********************************************************************** + * WIN16_DispatchMessage32 (USER.822) + */ +LONG WINAPI WIN16_DispatchMessage32( const MSG16_32* lpmsg16_32, BOOL16 wHaveParamHigh ) +{ + if (wHaveParamHigh == FALSE) + return DispatchMessage16(&(lpmsg16_32->msg)); + else + { + MSG32 msg; + + msg.hwnd = lpmsg16_32->msg.hwnd; + msg.message = lpmsg16_32->msg.message; + msg.wParam = MAKELONG(lpmsg16_32->msg.wParam, lpmsg16_32->wParamHigh); + msg.lParam = lpmsg16_32->msg.lParam; + msg.time = lpmsg16_32->msg.time; + msg.pt.x = (INT32)lpmsg16_32->msg.pt.x; + msg.pt.y = (INT32)lpmsg16_32->msg.pt.y; + return DispatchMessage32A(&msg); + } +} + /*********************************************************************** * DispatchMessage32A (USER32.141) */