Commit ea2a9a89 authored by Alexandre Julliard's avatar Alexandre Julliard

Removed a few Callout functions by doing a GetProcAddress at the time

we actually need the function.
parent fe5b19d1
......@@ -28,7 +28,6 @@
#include "winnt.h"
#include "wincon.h"
#include "callback.h"
#include "msdos.h"
#include "file.h"
#include "miscemu.h"
......@@ -426,13 +425,13 @@ void WINAPI DOSVM_Wait( INT read_pipe, HANDLE hObject )
objc=hObject?2:1;
do {
/* check for messages (waste time before the response check below) */
if (Callout.PeekMessageA)
if (PeekMessageA)
{
while (Callout.PeekMessageA(&msg,0,0,0,PM_REMOVE|PM_NOYIELD)) {
while (PeekMessageA(&msg,0,0,0,PM_REMOVE|PM_NOYIELD)) {
/* got a message */
DOSVM_ProcessMessage(&msg);
/* we don't need a TranslateMessage here */
Callout.DispatchMessageA(&msg);
DispatchMessageA(&msg);
got_msg = TRUE;
}
}
......@@ -465,8 +464,8 @@ chk_console_input:
break;
}
/* nothing yet, block while waiting for something to do */
if (Callout.MsgWaitForMultipleObjects)
waitret = Callout.MsgWaitForMultipleObjects(objc,objs,FALSE,INFINITE,QS_ALLINPUT);
if (MsgWaitForMultipleObjects)
waitret = MsgWaitForMultipleObjects(objc,objs,FALSE,INFINITE,QS_ALLINPUT);
else
waitret = WaitForMultipleObjects(objc,objs,FALSE,INFINITE);
......
......@@ -37,23 +37,13 @@ extern WORD CALLBACK THUNK_CallTo16_word_wwwl (FARPROC16,WORD,WORD,WORD,LONG);
static THUNK *firstThunk = NULL;
CALLOUT_TABLE Callout = {
/* PeekMessageA */ NULL,
/* GetMessageA */ NULL,
/* SendMessageA */ NULL,
/* PostMessageA */ NULL,
/* TranslateMessage */ NULL,
/* DispatchMessageA */ NULL,
/* RedrawWindow */ NULL,
/* UserSignalProc */ NULL,
/* FinalUserInit16 */ NULL,
/* InitThreadInput16 */ NULL,
/* UserYield16) */ NULL,
/* DestroyIcon32 */ NULL,
/* WaitForInputIdle */ NULL,
/* MsgWaitForMultipleObjects */ NULL,
/* WindowFromDC */ NULL,
/* MessageBoxA */ NULL,
/* MessageBoxW */ NULL
/* WaitForInputIdle */ NULL
};
/***********************************************************************
......@@ -171,18 +161,8 @@ void THUNK_InitCallout(void)
#define GETADDR( name ) \
*(FARPROC *)&Callout.name = GetProcAddress( hModule, #name )
GETADDR( PeekMessageA );
GETADDR( GetMessageA );
GETADDR( SendMessageA );
GETADDR( PostMessageA );
GETADDR( TranslateMessage );
GETADDR( DispatchMessageA );
GETADDR( RedrawWindow );
GETADDR( WaitForInputIdle );
GETADDR( MsgWaitForMultipleObjects );
GETADDR( WindowFromDC );
GETADDR( MessageBoxA );
GETADDR( MessageBoxW );
#undef GETADDR
}
else WARN("no 32-bit USER\n");
......
......@@ -23,23 +23,13 @@ extern void THUNK_InitCallout(void);
typedef struct
{
BOOL WINAPI (*PeekMessageA)( LPMSG, HWND, UINT, UINT, UINT );
BOOL WINAPI (*GetMessageA)( MSG*, HWND, UINT, UINT );
LRESULT WINAPI (*SendMessageA)( HWND, UINT, WPARAM, LPARAM );
BOOL WINAPI (*PostMessageA)( HWND, UINT, WPARAM, LPARAM );
BOOL WINAPI (*TranslateMessage)( const MSG *msg );
LONG WINAPI (*DispatchMessageA)( const MSG* msg );
BOOL WINAPI (*RedrawWindow)( HWND, const RECT *, HRGN, UINT );
WORD WINAPI (*UserSignalProc)( UINT, DWORD, DWORD, HMODULE16 );
void WINAPI (*FinalUserInit16)( void );
HQUEUE16 WINAPI (*InitThreadInput16)( WORD, WORD );
void WINAPI (*UserYield16)( void );
WORD WINAPI (*DestroyIcon32)( HGLOBAL16, UINT16 );
DWORD WINAPI (*WaitForInputIdle)( HANDLE, DWORD );
DWORD WINAPI (*MsgWaitForMultipleObjects)( DWORD, HANDLE *, BOOL, DWORD, DWORD );
HWND WINAPI (*WindowFromDC)( HDC );
INT WINAPI (*MessageBoxA)( HWND, LPCSTR, LPCSTR, UINT );
INT WINAPI (*MessageBoxW)( HWND, LPCWSTR, LPCWSTR, UINT );
} CALLOUT_TABLE;
extern CALLOUT_TABLE Callout;
......
......@@ -1573,6 +1573,8 @@ BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask )
}
typedef INT (WINAPI *MessageBoxA_funcptr)(HWND hWnd, LPCSTR text, LPCSTR title, UINT type);
/**************************************************************************
* FatalAppExit16 (KERNEL.137)
*/
......@@ -1582,11 +1584,19 @@ void WINAPI FatalAppExit16( UINT16 action, LPCSTR str )
if (!pTask || !(pTask->error_mode & SEM_NOGPFAULTERRORBOX))
{
if (Callout.MessageBoxA)
Callout.MessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
else
ERR( "%s\n", debugstr_a(str) );
HMODULE mod = GetModuleHandleA( "user32.dll" );
if (mod)
{
MessageBoxA_funcptr pMessageBoxA = (MessageBoxA_funcptr)GetProcAddress( mod, "MessageBoxA" );
if (pMessageBoxA)
{
pMessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
goto done;
}
}
ERR( "%s\n", debugstr_a(str) );
}
done:
ExitThread(0xff);
}
......
......@@ -17,6 +17,10 @@
static char main_exe_name[MAX_PATH];
static HANDLE main_exe_file;
static BOOL (WINAPI *pGetMessageA)(LPMSG,HWND,UINT,UINT);
static BOOL (WINAPI *pTranslateMessage)(const MSG*);
static LONG (WINAPI *pDispatchMessageA)(const MSG*);
extern void PROCESS_InitWine( int argc, char *argv[], LPSTR win16_exe_name,
HANDLE *win16_exe_file ) WINE_NORETURN;
extern HINSTANCE16 NE_StartMain( LPCSTR name, HANDLE file );
......@@ -28,12 +32,16 @@ int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT
{
MSG msg;
HINSTANCE16 instance;
HMODULE user32;
if (!LoadLibraryA( "user32.dll" ))
if (!(user32 = LoadLibraryA( "user32.dll" )))
{
MESSAGE( "Cannot load user32.dll\n" );
ExitProcess( GetLastError() );
}
pGetMessageA = (void *)GetProcAddress( user32, "GetMessageA" );
pTranslateMessage = (void *)GetProcAddress( user32, "TranslateMessage" );
pDispatchMessageA = (void *)GetProcAddress( user32, "DispatchMessageA" );
THUNK_InitCallout();
if ((instance = NE_StartMain( main_exe_name, main_exe_file )) < 32)
......@@ -59,10 +67,10 @@ int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT
/* Start message loop for desktop window */
while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
while ( GetNumTasks16() > 1 && pGetMessageA( &msg, 0, 0, 0 ) )
{
Callout.TranslateMessage( &msg );
Callout.DispatchMessageA( &msg );
pTranslateMessage( &msg );
pDispatchMessageA( &msg );
}
ExitProcess( 0 );
......
......@@ -19,7 +19,6 @@
#include "color.h"
#include "palette.h"
#include "debugtools.h"
#include "callback.h"
#include "winerror.h"
DEFAULT_DEBUG_CHANNEL(palette);
......@@ -775,28 +774,40 @@ UINT WINAPI RealizePalette(
}
typedef HWND WINAPI (*WindowFromDC_funcptr)( HDC );
typedef BOOL WINAPI (*RedrawWindow_funcptr)( HWND, const RECT *, HRGN, UINT );
/**********************************************************************
* UpdateColors16 (DISPLAY.366)
* UpdateColors16 (GDI.366)
*/
INT16 WINAPI UpdateColors16( HDC16 hDC )
{
HMODULE mod;
DC *dc;
HWND hWnd;
int size;
if (!(dc = DC_GetDCPtr( hDC ))) return 0;
size = dc->devCaps->sizePalette;
GDI_ReleaseObj( hDC );
if (Callout.WindowFromDC)
{
hWnd = Callout.WindowFromDC( hDC );
/* Docs say that we have to remap current drawable pixel by pixel
* but it would take forever given the speed of XGet/PutPixel.
*/
if (hWnd && size)
Callout.RedrawWindow( hWnd, NULL, 0, RDW_INVALIDATE );
mod = GetModuleHandleA("user32.dll");
if (mod)
{
WindowFromDC_funcptr pWindowFromDC = (WindowFromDC_funcptr)GetProcAddress(mod,"WindowFromDC");
if (pWindowFromDC)
{
HWND hWnd = pWindowFromDC( hDC );
/* Docs say that we have to remap current drawable pixel by pixel
* but it would take forever given the speed of XGet/PutPixel.
*/
if (hWnd && size)
{
RedrawWindow_funcptr pRedrawWindow = GetProcAddress( mod, "RedrawWindow" );
if (pRedrawWindow) pRedrawWindow( hWnd, NULL, 0, RDW_INVALIDATE );
}
}
}
return 0x666;
}
......
......@@ -26,8 +26,9 @@
#include "windef.h"
#include "winerror.h"
#include "ntddk.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/exception.h"
#include "callback.h"
#include "thread.h"
#include "stackframe.h"
#include "server.h"
......@@ -37,6 +38,8 @@ DEFAULT_DEBUG_CHANNEL(seh);
static PTOP_LEVEL_EXCEPTION_FILTER top_filter;
typedef INT (WINAPI *MessageBoxA_funcptr)(HWND,LPCSTR,LPCSTR,UINT);
typedef INT (WINAPI *MessageBoxW_funcptr)(HWND,LPCWSTR,LPCWSTR,UINT);
/*******************************************************************
* RaiseException (KERNEL32.@)
......@@ -241,14 +244,22 @@ DWORD WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS epointers)
strcpy(format, "debugger/winedbg %ld %ld");
}
if (!bAuto && Callout.MessageBoxA) {
format_exception_msg( epointers, buffer );
if (Callout.MessageBoxA( 0, buffer, "Error", MB_YESNO | MB_ICONHAND ) == IDNO) {
TRACE("Killing process\n");
return EXCEPTION_EXECUTE_HANDLER;
}
if (!bAuto)
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
MessageBoxA_funcptr pMessageBoxA = NULL;
if (mod) pMessageBoxA = (MessageBoxA_funcptr)GetProcAddress( mod, "MessageBoxA" );
if (pMessageBoxA)
{
format_exception_msg( epointers, buffer );
if (pMessageBoxA( 0, buffer, "Error", MB_YESNO | MB_ICONHAND ) == IDNO)
{
TRACE("Killing process\n");
return EXCEPTION_EXECUTE_HANDLER;
}
}
}
if (format[0]) {
HANDLE hEvent;
PROCESS_INFORMATION info;
......@@ -304,11 +315,14 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(
*/
void WINAPI FatalAppExitA( UINT action, LPCSTR str )
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
MessageBoxA_funcptr pMessageBoxA = NULL;
WARN("AppExit\n");
if (Callout.MessageBoxA)
Callout.MessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
else
ERR( "%s\n", debugstr_a(str) );
if (mod) pMessageBoxA = (MessageBoxA_funcptr)GetProcAddress( mod, "MessageBoxA" );
if (pMessageBoxA) pMessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
else ERR( "%s\n", debugstr_a(str) );
ExitProcess(0);
}
......@@ -318,10 +332,13 @@ void WINAPI FatalAppExitA( UINT action, LPCSTR str )
*/
void WINAPI FatalAppExitW( UINT action, LPCWSTR str )
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
MessageBoxW_funcptr pMessageBoxW = NULL;
WARN("AppExit\n");
if (Callout.MessageBoxW)
Callout.MessageBoxW( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
else
ERR( "%s\n", debugstr_w(str) );
if (mod) pMessageBoxW = (MessageBoxW_funcptr)GetProcAddress( mod, "MessageBoxW" );
if (pMessageBoxW) pMessageBoxW( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
else ERR( "%s\n", debugstr_w(str) );
ExitProcess(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment