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