Call 16-bit instead of 32-bit UserSignalProc entry point.
Don't load USER32.DLL unless requested by the program. Bugfix: Pass the correct thread ID to UserSignalProc.
This commit is contained in:
parent
cd841a4a86
commit
979000e038
|
@ -41,6 +41,7 @@ extern LONG CALLBACK THUNK_CallTo16_long_ll (FARPROC16,LONG,LONG);
|
|||
extern WORD CALLBACK THUNK_CallTo16_word_www (FARPROC16,WORD,WORD,WORD);
|
||||
extern WORD CALLBACK THUNK_CallTo16_word_wwl (FARPROC16,WORD,WORD,LONG);
|
||||
extern WORD CALLBACK THUNK_CallTo16_word_wlw (FARPROC16,WORD,LONG,WORD);
|
||||
extern WORD CALLBACK THUNK_CallTo16_word_lllw (FARPROC16,LONG,LONG,LONG,WORD);
|
||||
extern WORD CALLBACK THUNK_CallTo16_word_llwl (FARPROC16,LONG,LONG,WORD,LONG);
|
||||
extern WORD CALLBACK THUNK_CallTo16_word_lwww (FARPROC16,LONG,WORD,WORD,WORD);
|
||||
extern WORD CALLBACK THUNK_CallTo16_word_wlww (FARPROC16,WORD,LONG,WORD,WORD);
|
||||
|
@ -374,7 +375,6 @@ void THUNK_InitCallout(void)
|
|||
GETADDR( DispatchMessageW, "DispatchMessageW" );
|
||||
GETADDR( DispatchMessageA, "DispatchMessageA" );
|
||||
GETADDR( RedrawWindow, "RedrawWindow" );
|
||||
GETADDR( UserSignalProc, "UserSignalProc" );
|
||||
|
||||
#undef GETADDR
|
||||
}
|
||||
|
@ -399,6 +399,7 @@ void THUNK_InitCallout(void)
|
|||
GETADDR( InitThreadInput16, "InitThreadInput", word_ww );
|
||||
GETADDR( UserYield16, "UserYield", word_ );
|
||||
GETADDR( DestroyIcon32, "DestroyIcon32", word_ww );
|
||||
GETADDR( UserSignalProc, "SignalProc32", word_lllw );
|
||||
|
||||
#undef GETADDR
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ extern BOOL PROCESS_Init( void );
|
|||
extern BOOL PROCESS_IsCurrent( HANDLE handle );
|
||||
extern PDB *PROCESS_Initial(void);
|
||||
extern PDB *PROCESS_IdToPDB( DWORD id );
|
||||
extern void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule );
|
||||
extern void PROCESS_CallUserSignalProc( UINT uCode, DWORD dwThreadId, HMODULE hModule );
|
||||
extern PDB *PROCESS_Create( struct _NE_MODULE *pModule,
|
||||
LPCSTR cmd_line, LPCSTR env,
|
||||
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
|
||||
|
|
|
@ -462,9 +462,9 @@ void TASK_KillTask( HTASK16 hTask )
|
|||
/* Perform USER cleanup */
|
||||
|
||||
TASK_CallTaskSignalProc( USIG16_TERMINATION, hTask );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_EXIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0 ); /* FIXME */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_DESTROY, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_EXIT, 0, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, GetCurrentThreadId(), 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_DESTROY, 0, 0 );
|
||||
|
||||
if (nTaskCount <= 1)
|
||||
{
|
||||
|
@ -716,6 +716,7 @@ void WINAPI InitTask16( CONTEXT86 *context )
|
|||
|
||||
/* Initialize implicitly loaded DLLs */
|
||||
NE_InitializeDLLs( pTask->hModule );
|
||||
NE_DllProcessAttach( pTask->hModule );
|
||||
|
||||
/* Registers on return are:
|
||||
* ax 1 if OK, 0 on error
|
||||
|
|
|
@ -185,9 +185,10 @@ PDB *PROCESS_IdToPDB( DWORD id )
|
|||
* USIG_FLAGS_FAULT
|
||||
* The signal is being sent due to a fault.
|
||||
*/
|
||||
static void PROCESS_CallUserSignalProcHelper( UINT uCode, DWORD dwThreadOrProcessId,
|
||||
HMODULE hModule, DWORD flags, DWORD startup_flags )
|
||||
void PROCESS_CallUserSignalProc( UINT uCode, DWORD dwThreadId, HMODULE hModule )
|
||||
{
|
||||
DWORD flags = PROCESS_Current()->flags;
|
||||
DWORD startup_flags = PROCESS_Current()->env_db->startup_info->dwFlags;
|
||||
DWORD dwFlags = 0;
|
||||
|
||||
/* Determine dwFlags */
|
||||
|
@ -217,26 +218,12 @@ static void PROCESS_CallUserSignalProcHelper( UINT uCode, DWORD dwThreadOrProces
|
|||
/* Call USER signal proc */
|
||||
|
||||
if ( Callout.UserSignalProc )
|
||||
Callout.UserSignalProc( uCode, dwThreadOrProcessId, dwFlags, hModule );
|
||||
}
|
||||
|
||||
/* Call USER signal proc for the current thread/process */
|
||||
void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
|
||||
{
|
||||
DWORD dwThreadOrProcessId;
|
||||
|
||||
/* Get thread or process ID */
|
||||
if ( uCode == USIG_THREAD_INIT || uCode == USIG_THREAD_EXIT )
|
||||
dwThreadOrProcessId = GetCurrentThreadId();
|
||||
Callout.UserSignalProc( uCode, dwThreadId, dwFlags, hModule );
|
||||
else
|
||||
dwThreadOrProcessId = GetCurrentProcessId();
|
||||
|
||||
PROCESS_CallUserSignalProcHelper( uCode, dwThreadOrProcessId, hModule,
|
||||
PROCESS_Current()->flags,
|
||||
PROCESS_Current()->env_db->startup_info->dwFlags );
|
||||
Callout.UserSignalProc( uCode, GetCurrentProcessId(), dwFlags, hModule );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PROCESS_CreateEnvDB
|
||||
*
|
||||
|
@ -436,14 +423,9 @@ void PROCESS_Start(void)
|
|||
* in the case of a 16-bit process. Thus, we send the signal here.
|
||||
*/
|
||||
|
||||
/* Load USER32.DLL before calling UserSignalProc (relay debugging!) */
|
||||
LoadLibraryA( "USER32.DLL" );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, 0 );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 ); /* for initial thread */
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, 0, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, GetCurrentThreadId(), 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
|
||||
|
||||
/* Signal the parent process to continue */
|
||||
server_call( REQ_INIT_PROCESS_DONE );
|
||||
|
@ -468,7 +450,7 @@ void PROCESS_Start(void)
|
|||
PE_InitTls();
|
||||
}
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0 ); /* FIXME: correct location? */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0, 0 ); /* FIXME: correct location? */
|
||||
|
||||
if ( (pdb->flags & PDB32_CONSOLE_PROC) || (pdb->flags & PDB32_DOS_PROC) )
|
||||
AllocConsole();
|
||||
|
@ -485,7 +467,7 @@ void PROCESS_Start(void)
|
|||
TASK_AddTaskEntryBreakpoint( pdb->task );
|
||||
|
||||
/* Now call the entry point */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0, 0 );
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ void CALLBACK THREAD_FreeTEB( ULONG_PTR arg )
|
|||
TRACE("(%p) called\n", teb );
|
||||
SERVICE_Delete( teb->cleanup );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, (DWORD)teb->tid, 0 );
|
||||
|
||||
CloseHandle( teb->event );
|
||||
while (*pptr && (*pptr != teb)) pptr = &(*pptr)->next;
|
||||
|
@ -277,7 +277,7 @@ error:
|
|||
static void THREAD_Start(void)
|
||||
{
|
||||
LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)NtCurrentTeb()->entry_point;
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, (DWORD)NtCurrentTeb()->tid, 0 );
|
||||
PE_InitTls();
|
||||
MODULE_DllThreadAttach( NULL );
|
||||
|
||||
|
|
Loading…
Reference in New Issue