From 8dbffe70fbee3e52b9358a5bde40507e84d1957f Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 24 Jul 1999 10:27:58 +0000 Subject: [PATCH] Removed MODULE_GetWndProcEntry16(). Use 32-bit window procedures in COMMDLG instead. --- dlls/commdlg/colordlg.c | 26 ++++++++++++++++--- dlls/commdlg/filedlg.c | 52 +++++++++++++++++++++++++++++++++++--- dlls/commdlg/finddlg.c | 52 +++++++++++++++++++++++++++++++++++--- dlls/commdlg/fontdlg.c | 4 +-- dlls/commdlg/printdlg.c | 6 ++--- if1632/wprocs.spec | 9 ------- include/commdlg.h | 6 ----- include/module.h | 1 - loader/module.c | 55 ----------------------------------------- relay32/utthunk.c | 18 ++++++++++++-- 10 files changed, 140 insertions(+), 89 deletions(-) diff --git a/dlls/commdlg/colordlg.c b/dlls/commdlg/colordlg.c index 6e374a4b447..c59a8afd6cf 100644 --- a/dlls/commdlg/colordlg.c +++ b/dlls/commdlg/colordlg.c @@ -26,6 +26,27 @@ DEFAULT_DEBUG_CHANNEL(commdlg) #include "cdlg.h" +/*********************************************************************** + * ColorDlgProc [internal] + * + * FIXME: Convert to real 32-bit message processing + */ +static LRESULT WINAPI ColorDlgProc(HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + UINT16 msg16; + MSGPARAM16 mp16; + + mp16.lParam = lParam; + if (WINPROC_MapMsg32ATo16( hDlg, msg, wParam, + &msg16, &mp16.wParam, &mp16.lParam ) == -1) + return 0; + mp16.lResult = ColorDlgProc16( (HWND16)hDlg, msg16, mp16.wParam, mp16.lParam ); + + WINPROC_UnmapMsg32ATo16( hDlg, msg, wParam, lParam, &mp16 ); + return mp16.lResult; +} + /*********************************************************************** * ChooseColor (COMMDLG.5) */ @@ -85,8 +106,8 @@ BOOL16 WINAPI ChooseColor16(LPCHOOSECOLOR16 lpChCol) hInst = GetWindowLongA( lpChCol->hwndOwner, GWL_HINSTANCE ); hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format, lpChCol->hwndOwner, - (DLGPROC16)MODULE_GetWndProcEntry16("ColorDlgProc"), - (DWORD)lpChCol, WIN_PROC_16 ); + (DLGPROC16)ColorDlgProc, + (DWORD)lpChCol, WIN_PROC_32A ); if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpChCol->hwndOwner); if (hDlgTmpl) FreeResource16( hDlgTmpl ); @@ -1165,7 +1186,6 @@ LRESULT WINAPI ColorDlgProc16(HWND16 hDlg, UINT16 message, return FALSE ; } - /*********************************************************************** * ChooseColorA (COMDLG32.1) */ diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c index adfbd700c1c..01e5d544255 100644 --- a/dlls/commdlg/filedlg.c +++ b/dlls/commdlg/filedlg.c @@ -73,6 +73,50 @@ static BOOL FileDlg_Init(void) return TRUE; } +/*********************************************************************** + * FileOpenDlgProc [internal] + * + * FIXME: Convert to real 32-bit message processing + */ +static LRESULT WINAPI FileOpenDlgProc(HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + UINT16 msg16; + MSGPARAM16 mp16; + + mp16.lParam = lParam; + if (WINPROC_MapMsg32ATo16( hDlg, msg, wParam, + &msg16, &mp16.wParam, &mp16.lParam ) == -1) + return 0; + mp16.lResult = FileOpenDlgProc16( (HWND16)hDlg, msg16, + mp16.wParam, mp16.lParam ); + + WINPROC_UnmapMsg32ATo16( hDlg, msg, wParam, lParam, &mp16 ); + return mp16.lResult; +} + +/*********************************************************************** + * FileSaveDlgProc [internal] + * + * FIXME: Convert to real 32-bit message processing + */ +static LRESULT WINAPI FileSaveDlgProc(HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + UINT16 msg16; + MSGPARAM16 mp16; + + mp16.lParam = lParam; + if (WINPROC_MapMsg32ATo16( hDlg, msg, wParam, + &msg16, &mp16.wParam, &mp16.lParam ) == -1) + return 0; + mp16.lResult = FileSaveDlgProc16( (HWND16)hDlg, msg16, + mp16.wParam, mp16.lParam ); + + WINPROC_UnmapMsg32ATo16( hDlg, msg, wParam, lParam, &mp16 ); + return mp16.lResult; +} + /*********************************************************************** * GetOpenFileName16 (COMMDLG.1) * @@ -199,8 +243,8 @@ BOOL16 WINAPI GetOpenFileName16( /* FIXME: doesn't handle win32 format correctly yet */ hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format, lpofn->hwndOwner, - (DLGPROC16)MODULE_GetWndProcEntry16("FileOpenDlgProc"), - ofn, WIN_PROC_16 ); + (DLGPROC16)FileOpenDlgProc, + ofn, WIN_PROC_32A ); if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner ); if (str1) @@ -361,8 +405,8 @@ BOOL16 WINAPI GetSaveFileName16( hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format, lpofn->hwndOwner, - (DLGPROC16)MODULE_GetWndProcEntry16("FileSaveDlgProc"), - ofn, WIN_PROC_16 ); + (DLGPROC16)FileSaveDlgProc, + ofn, WIN_PROC_32A ); if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner ); if (str1) diff --git a/dlls/commdlg/finddlg.c b/dlls/commdlg/finddlg.c index 47400279cae..564cf2eea0d 100644 --- a/dlls/commdlg/finddlg.c +++ b/dlls/commdlg/finddlg.c @@ -24,6 +24,50 @@ DEFAULT_DEBUG_CHANNEL(commdlg) #include "cdlg.h" +/*********************************************************************** + * FindTextDlgProc [internal] + * + * FIXME: Convert to real 32-bit message processing + */ +static LRESULT WINAPI FindTextDlgProc(HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + UINT16 msg16; + MSGPARAM16 mp16; + + mp16.lParam = lParam; + if (WINPROC_MapMsg32ATo16( hDlg, msg, wParam, + &msg16, &mp16.wParam, &mp16.lParam ) == -1) + return 0; + mp16.lResult = FindTextDlgProc16( (HWND16)hDlg, msg16, + mp16.wParam, mp16.lParam ); + + WINPROC_UnmapMsg32ATo16( hDlg, msg, wParam, lParam, &mp16 ); + return mp16.lResult; +} + +/*********************************************************************** + * ReplaceTextDlgProc [internal] + * + * FIXME: Convert to real 32-bit message processing + */ +static LRESULT WINAPI ReplaceTextDlgProc(HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam) +{ + UINT16 msg16; + MSGPARAM16 mp16; + + mp16.lParam = lParam; + if (WINPROC_MapMsg32ATo16( hDlg, msg, wParam, + &msg16, &mp16.wParam, &mp16.lParam ) == -1) + return 0; + mp16.lResult = ReplaceTextDlgProc16( (HWND16)hDlg, msg16, + mp16.wParam, mp16.lParam ); + + WINPROC_UnmapMsg32ATo16( hDlg, msg, wParam, lParam, &mp16 ); + return mp16.lResult; +} + /*********************************************************************** * FindText16 (COMMDLG.11) */ @@ -53,8 +97,8 @@ HWND16 WINAPI FindText16( SEGPTR find ) } hInst = GetWindowLongA( lpFind->hwndOwner , GWL_HINSTANCE); return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner, - (DLGPROC16)MODULE_GetWndProcEntry16("FindTextDlgProc"), - find, WIN_PROC_16 ); + (DLGPROC16)FindTextDlgProc, + find, WIN_PROC_32A ); } @@ -87,8 +131,8 @@ HWND16 WINAPI ReplaceText16( SEGPTR find ) } hInst = GetWindowLongA( lpFind->hwndOwner , GWL_HINSTANCE); return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner, - (DLGPROC16)MODULE_GetWndProcEntry16("ReplaceTextDlgProc"), - find, WIN_PROC_16 ); + (DLGPROC16)ReplaceTextDlgProc, + find, WIN_PROC_32A ); } diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c index 77b51841314..5a9772a0530 100644 --- a/dlls/commdlg/fontdlg.c +++ b/dlls/commdlg/fontdlg.c @@ -122,8 +122,8 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont) hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format, lpChFont->hwndOwner, - (DLGPROC16)MODULE_GetWndProcEntry16("FormatCharDlgProc"), - (DWORD)lpChFont, WIN_PROC_16 ); + (DLGPROC16)FormatCharDlgProcA, + (DWORD)lpChFont, WIN_PROC_32A ); if (hwndDialog) bRet = DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner); if (hDlgTmpl) FreeResource16( hDlgTmpl ); lpChFont->lpTemplateName=lpTemplateName; diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c index bdb5cc2b0f3..17ac3a1112b 100644 --- a/dlls/commdlg/printdlg.c +++ b/dlls/commdlg/printdlg.c @@ -67,9 +67,9 @@ BOOL16 WINAPI PrintDlg16( SEGPTR printdlg ) hwndDialog = DIALOG_CreateIndirect( hInst, template, TRUE, lpPrint->hwndOwner, (DLGPROC16)((lpPrint->Flags & PD_PRINTSETUP) ? - MODULE_GetWndProcEntry16("PrintSetupDlgProc") : - MODULE_GetWndProcEntry16("PrintDlgProc")), - printdlg, WIN_PROC_16 ); + /* FIXME: PrintSetupDlgProc */ PrintDlgProcA : + PrintDlgProcA ), + printdlg, WIN_PROC_32A ); if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpPrint->hwndOwner); return bRet; } diff --git a/if1632/wprocs.spec b/if1632/wprocs.spec index 32b2c3bc483..c492f4eca94 100644 --- a/if1632/wprocs.spec +++ b/if1632/wprocs.spec @@ -1,18 +1,9 @@ name wprocs type win16 -14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc16 -15 pascal FileSaveDlgProc(word word word long) FileSaveDlgProc16 -16 pascal ColorDlgProc(word word word long) ColorDlgProc16 -17 pascal FindTextDlgProc(word word word long) FindTextDlgProc16 -18 pascal ReplaceTextDlgProc(word word word long) ReplaceTextDlgProc16 -19 pascal PrintSetupDlgProc(word word word long) PrintSetupDlgProc16 -20 pascal PrintDlgProc(word word word long) PrintDlgProc16 23 pascal UTGlue16(ptr long ptr long) UTGlue16 -24 pascal16 TASK_Reschedule() TASK_Reschedule 27 pascal EntryAddrProc(word word) NE_GetEntryPoint 28 pascal MyAlloc(word word word) NE_AllocateSegment -30 pascal FormatCharDlgProc(word word word long) FormatCharDlgProc16 # Interrupt vectors 0-255 are ordinals 100-355 # The 'word' parameter are the flags pushed on the stack by the interrupt diff --git a/include/commdlg.h b/include/commdlg.h index 6aec065e732..b4767d2b4f9 100644 --- a/include/commdlg.h +++ b/include/commdlg.h @@ -627,13 +627,7 @@ LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPAR LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam); LRESULT WINAPI ColorDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam); LRESULT WINAPI FindTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam); -LRESULT WINAPI FindTextDlgProcA(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); -LRESULT WINAPI FindTextDlgProcW(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); -#define FindTextDlgProc WINELIB_NAME_AW(FindTextDlgProc) LRESULT WINAPI ReplaceTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam); -LRESULT WINAPI ReplaceTextDlgProcA(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); -LRESULT WINAPI ReplaceTextDlgProcW(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); -#define ReplaceTextProc WINELIB_NAME_AW(ReplaceTextDlgProc) LRESULT WINAPI PrintDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam); LRESULT WINAPI PrintDlgProcA(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); LRESULT WINAPI PrintDlgProcW(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); diff --git a/include/module.h b/include/module.h index 9055fbe264c..2468be33d9e 100644 --- a/include/module.h +++ b/include/module.h @@ -184,7 +184,6 @@ extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD fl extern BOOL MODULE_FreeLibrary( WINE_MODREF *wm ); extern WINE_MODREF *MODULE_FindModule( LPCSTR path ); extern HMODULE MODULE_CreateDummyModule( const OFSTRUCT *ofs, LPCSTR modName ); -extern FARPROC16 MODULE_GetWndProcEntry16( const char *name ); extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name ); extern SEGPTR WINAPI HasGPHandler16( SEGPTR address ); extern void MODULE_WalkModref( DWORD id ); diff --git a/loader/module.c b/loader/module.c index 6b4222bfafd..8cd2fbcd5cd 100644 --- a/loader/module.c +++ b/loader/module.c @@ -420,61 +420,6 @@ HMODULE MODULE_CreateDummyModule( const OFSTRUCT *ofs, LPCSTR modName ) } -/*********************************************************************** - * MODULE_GetWndProcEntry16 (not a Windows API function) - * - * Return an entry point from the WPROCS dll. - */ -FARPROC16 MODULE_GetWndProcEntry16( LPCSTR name ) -{ - FARPROC16 ret = NULL; - - if (__winelib) - { - /* FIXME: hack for Winelib */ - extern LRESULT ColorDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - extern LRESULT FileOpenDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - extern LRESULT FileSaveDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - extern LRESULT FindTextDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - extern LRESULT PrintDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - extern LRESULT PrintSetupDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - extern LRESULT ReplaceTextDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); - - if (!strcmp(name,"ColorDlgProc")) - return (FARPROC16)ColorDlgProc16; - if (!strcmp(name,"FileOpenDlgProc")) - return (FARPROC16)FileOpenDlgProc16; - if (!strcmp(name,"FileSaveDlgProc")) - return (FARPROC16)FileSaveDlgProc16; - if (!strcmp(name,"FindTextDlgProc")) - return (FARPROC16)FindTextDlgProc16; - if (!strcmp(name,"PrintDlgProc")) - return (FARPROC16)PrintDlgProc16; - if (!strcmp(name,"PrintSetupDlgProc")) - return (FARPROC16)PrintSetupDlgProc16; - if (!strcmp(name,"ReplaceTextDlgProc")) - return (FARPROC16)ReplaceTextDlgProc16; - FIXME_(module)("No mapping for %s(), add one in library/miscstubs.c\n",name); - assert( FALSE ); - return NULL; - } - else - { - WORD ordinal; - static HMODULE hModule = 0; - - if (!hModule) hModule = GetModuleHandle16( "WPROCS" ); - ordinal = NE_GetOrdinal( hModule, name ); - if (!(ret = NE_GetEntryPoint( hModule, ordinal ))) - { - WARN_(module)("%s not found\n", name ); - assert( FALSE ); - } - } - return ret; -} - - /********************************************************************** * MODULE_FindModule32 * diff --git a/relay32/utthunk.c b/relay32/utthunk.c index 9460e2d437b..0ed56e83fb7 100644 --- a/relay32/utthunk.c +++ b/relay32/utthunk.c @@ -4,6 +4,7 @@ * Copyright 1999 Ulrich Weigand */ +#include "wine/winbase16.h" #include "windef.h" #include "heap.h" #include "module.h" @@ -139,7 +140,20 @@ static DWORD WINAPI UTGlue32( FARPROC16 target, LPVOID lpBuff, DWORD dwUserDefin static UTINFO *UTAlloc( HMODULE hModule, HMODULE16 hModule16, FARPROC16 target16, FARPROC target32 ) { - UTINFO *ut = HeapAlloc( SegptrHeap, HEAP_ZERO_MEMORY, sizeof(UTINFO) ); + static FARPROC16 UTGlue16_Segptr = NULL; + UTINFO *ut; + + if ( !UTGlue16_Segptr ) + { + HMODULE16 hModule = GetModuleHandle16( "WPROCS" ); + int ordinal = NE_GetOrdinal( hModule, "UTGlue16" ); + if ( hModule && ordinal ) + UTGlue16_Segptr = NE_GetEntryPoint( hModule, ordinal ); + + if ( !UTGlue16_Segptr ) return NULL; + } + + ut = HeapAlloc( SegptrHeap, HEAP_ZERO_MEMORY, sizeof(UTINFO) ); if ( !ut ) return NULL; ut->hModule = hModule; @@ -150,7 +164,7 @@ static UTINFO *UTAlloc( HMODULE hModule, HMODULE16 hModule16, ut->ut16.target = (DWORD)target32; ut->ut16.pushl_eax = 0x50; ut->ut16.ljmp = 0xea; - ut->ut16.utglue16 = (DWORD)MODULE_GetWndProcEntry16( "UTGlue16" ); + ut->ut16.utglue16 = (DWORD)UTGlue16_Segptr; ut->ut32.popl_eax = 0x58; ut->ut32.pushl = 0x68;