Commit 5edf4e1c authored by Alexandre Julliard's avatar Alexandre Julliard

Removed a few unnecessary Callouts.

parent 8afe6628
......@@ -265,13 +265,10 @@ static void thread_detach(void)
if (hQueue)
{
TIMER_RemoveQueueTimers( hQueue );
HOOK_FreeQueueHooks( hQueue );
HOOK_FreeQueueHooks();
QUEUE_SetExitingQueue( hQueue );
WIN_DestroyThreadWindows( GetDesktopWindow() );
QUEUE_DeleteMsgQueue( hQueue );
SetThreadQueue16( 0, 0 );
QUEUE_DeleteMsgQueue();
}
if (!(NtCurrentTeb()->tibflags & TEBF_WIN32))
......
......@@ -20,29 +20,15 @@ DEFAULT_DEBUG_CHANNEL(thunk);
/* by the build program to generate the file if1632/callto16.S */
/* ### start build ### */
extern WORD CALLBACK THUNK_CallTo16_word_ (FARPROC16);
extern WORD CALLBACK THUNK_CallTo16_word_l (FARPROC16,LONG);
extern LONG CALLBACK THUNK_CallTo16_long_l (FARPROC16,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_lllw (FARPROC16,LONG,LONG,LONG,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_lwww (FARPROC16,LONG,WORD,WORD,WORD);
extern LONG CALLBACK THUNK_CallTo16_long_wwwl (FARPROC16,WORD,WORD,WORD,LONG);
extern WORD CALLBACK THUNK_CallTo16_word_lwwww(FARPROC16,LONG,WORD,WORD,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_w (FARPROC16,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_wlww (FARPROC16,WORD,LONG,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_ww (FARPROC16,WORD,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_wwwl (FARPROC16,WORD,WORD,WORD,LONG);
/* ### stop build ### */
static THUNK *firstThunk = NULL;
CALLOUT_TABLE Callout = {
/* PostMessageA */ NULL,
/* UserSignalProc */ NULL,
/* FinalUserInit16 */ NULL,
/* InitThreadInput16 */ NULL,
/* UserYield16) */ NULL,
/* DestroyIcon32 */ NULL,
/* WaitForInputIdle */ NULL
/* DestroyIcon32 */ NULL
};
/***********************************************************************
......@@ -151,31 +137,13 @@ static FARPROC THUNK_GetCalloutThunk( NE_MODULE *pModule, LPSTR name, RELAY rela
*/
void THUNK_InitCallout(void)
{
HMODULE hModule;
NE_MODULE *pModule;
hModule = GetModuleHandleA( "user32.dll" );
if ( hModule )
{
#define GETADDR( name ) \
*(FARPROC *)&Callout.name = GetProcAddress( hModule, #name )
GETADDR( PostMessageA );
GETADDR( WaitForInputIdle );
#undef GETADDR
}
else WARN("no 32-bit USER\n");
pModule = NE_GetPtr( GetModuleHandle16( "USER.EXE" ) );
NE_MODULE *pModule = NE_GetPtr( GetModuleHandle16( "USER.EXE" ) );
if ( pModule )
{
#define GETADDR( var, name, thk ) \
*(FARPROC *)&Callout.var = THUNK_GetCalloutThunk( pModule, name, \
(RELAY)THUNK_CallTo16_##thk )
GETADDR( FinalUserInit16, "FinalUserInit", word_ );
GETADDR( InitThreadInput16, "InitThreadInput", word_ww );
GETADDR( UserYield16, "UserYield", word_ );
GETADDR( DestroyIcon32, "DestroyIcon32", word_ww );
GETADDR( UserSignalProc, "SignalProc32", word_lllw );
#undef GETADDR
......
......@@ -23,13 +23,8 @@ extern void THUNK_InitCallout(void);
typedef struct
{
BOOL WINAPI (*PostMessageA)( HWND, UINT, WPARAM, LPARAM );
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 );
} CALLOUT_TABLE;
extern CALLOUT_TABLE Callout;
......
......@@ -26,7 +26,6 @@ extern LRESULT HOOK_CallHooksA( INT id, INT code, WPARAM wParam,
extern LRESULT HOOK_CallHooksW( INT id, INT code, WPARAM wParam,
LPARAM lParam );
extern void HOOK_FreeModuleHooks( HMODULE16 hModule );
extern void HOOK_FreeQueueHooks( HQUEUE16 hQueue );
extern void HOOK_ResetQueueHooks( HQUEUE16 hQueue );
extern void HOOK_FreeQueueHooks(void);
#endif /* __WINE_HOOK_H */
......@@ -17,7 +17,6 @@
#include "file.h"
#include "module.h"
#include "debugtools.h"
#include "callback.h"
#include "wine/server.h"
DEFAULT_DEBUG_CHANNEL(module);
......@@ -30,6 +29,25 @@ static WINE_MODREF *exe_modref;
static int free_lib_count; /* recursion depth of FreeLibrary calls */
static int process_detaching; /* set on process detach to avoid deadlocks with thread detach */
/***********************************************************************
* wait_input_idle
*
* Wrapper to call WaitForInputIdle USER function
*/
typedef DWORD (WINAPI *WaitForInputIdle_ptr)( HANDLE hProcess, DWORD dwTimeOut );
static DWORD wait_input_idle( HANDLE process, DWORD timeout )
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
if (mod)
{
WaitForInputIdle_ptr ptr = (WaitForInputIdle_ptr)GetProcAddress( mod, "WaitForInputIdle" );
if (ptr) return ptr( process, timeout );
}
return 0;
}
/*************************************************************************
* MODULE32_LookupHMODULE
* looks for the referenced HMODULE in the current process
......@@ -852,8 +870,7 @@ HINSTANCE WINAPI WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
0, NULL, NULL, &startup, &info ))
{
/* Give 30 seconds to the app to come up */
if (Callout.WaitForInputIdle &&
Callout.WaitForInputIdle( info.hProcess, 30000 ) == 0xFFFFFFFF)
if (wait_input_idle( info.hProcess, 30000 ) == 0xFFFFFFFF)
WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
hInstance = (HINSTANCE)33;
/* Close off the handles */
......@@ -910,8 +927,7 @@ HINSTANCE WINAPI LoadModule( LPCSTR name, LPVOID paramBlock )
params->lpEnvAddress, NULL, &startup, &info ))
{
/* Give 30 seconds to the app to come up */
if (Callout.WaitForInputIdle &&
Callout.WaitForInputIdle( info.hProcess, 30000 ) == 0xFFFFFFFF )
if (wait_input_idle( info.hProcess, 30000 ) == 0xFFFFFFFF )
WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
hInstance = (HINSTANCE)33;
/* Close off the handles */
......
......@@ -19,7 +19,6 @@
#include "winsock.h"
#include "wine/winbase16.h"
#include "callback.h"
#include "drive.h"
#include "file.h"
#include "global.h"
......@@ -727,8 +726,20 @@ void WINAPI Yield16(void)
TDB *pCurTask = TASK_GetCurrent();
if (pCurTask) pCurTask->hYieldTo = 0;
if (pCurTask && pCurTask->hQueue && Callout.UserYield16) Callout.UserYield16();
else OldYield16();
if (pCurTask && pCurTask->hQueue)
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
if (mod)
{
FARPROC proc = GetProcAddress( mod, "UserYield16" );
if (proc)
{
proc();
return;
}
}
}
OldYield16();
}
/***********************************************************************
......@@ -1034,27 +1045,10 @@ VOID WINAPI SetFastQueue16( DWORD thread, HANDLE hQueue )
*/
HANDLE WINAPI GetFastQueue16( void )
{
TEB *teb = NtCurrentTeb();
if (!teb) return 0;
HANDLE ret = (HANDLE)NtCurrentTeb()->queue;
if (!teb->queue)
{
if (!Callout.InitThreadInput16)
{
THUNK_InitCallout();
if (!Callout.InitThreadInput16)
{
FIXME("InitThreadInput16 callout not found, trouble ahead\n");
return 0;
}
}
Callout.InitThreadInput16( 0, (teb->tibflags & TEBF_WIN32) ? 5 : 4 );
if (!teb->queue)
FIXME("(): should initialize thread-local queue, expect failure!\n" );
}
return (HANDLE)teb->queue;
if (!ret) FIXME("(): should initialize thread-local queue, expect failure!\n" );
return ret;
}
/***********************************************************************
......
......@@ -363,9 +363,6 @@ static void start_process(void)
/* Get pointers to USER routines called by KERNEL */
THUNK_InitCallout();
/* Call FinalUserInit routine */
if (Callout.FinalUserInit16) Callout.FinalUserInit16();
/* Note: The USIG_PROCESS_CREATE signal is supposed to be sent in the
* context of the parent process. Actually, the USER signal proc
* doesn't really care about that, but it *does* require that the
......
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