Commit e392a0c9 authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

Added USER32.UserSignalProc to Callout table.

Implemented built-in UserSignalProc(). Don't announce Win3.1-style USER handler any more.
parent 8139c301
......@@ -554,31 +554,15 @@ DWORD WINAPI THUNK_GetDCHook( HDC16 hdc, FARPROC16 *phookProc )
*/
FARPROC16 WINAPI THUNK_SetTaskSignalProc( HTASK16 hTask, FARPROC16 proc )
{
static FARPROC16 defSignalProc16 = NULL;
THUNK *thunk = THUNK_Alloc( proc, (RELAY)CallTo16_word_wwwww );
if ( !thunk ) return NULL;
THUNK *thunk = NULL;
if( !defSignalProc16 )
defSignalProc16 = NE_GetEntryPoint(GetModuleHandle16("USER"), 314 );
if( proc == defSignalProc16 )
thunk = (THUNK*)SetTaskSignalProc( hTask, (FARPROC16)&USER_SignalProc );
else
{
thunk = THUNK_Alloc( proc, (RELAY)CallTo16_word_wwwww );
if( !thunk ) return FALSE;
thunk = (THUNK*)SetTaskSignalProc( hTask, (FARPROC16)thunk );
}
thunk = (THUNK*)SetTaskSignalProc( hTask, (FARPROC16)thunk );
if ( !thunk ) return NULL;
if( thunk != (THUNK*)USER_SignalProc )
{
if( !thunk ) return NULL;
proc = thunk->proc;
THUNK_Free( thunk );
return proc;
}
return defSignalProc16;
proc = thunk->proc;
THUNK_Free( thunk );
return proc;
}
/***********************************************************************
......@@ -883,6 +867,7 @@ void THUNK_InitCallout(void)
GETADDR( DispatchMessageW, "DispatchMessageW" );
GETADDR( DispatchMessageA, "DispatchMessageA" );
GETADDR( RedrawWindow, "RedrawWindow" );
GETADDR( UserSignalProc, "UserSignalProc" );
#undef GETADDR
}
......
......@@ -361,7 +361,7 @@ file user.exe
385 pascal16 GetMenuContextHelpId(word) GetMenuContextHelpId16
389 pascal LoadImage(word segstr word word word word) LoadImage16
390 pascal16 CopyImage(word word word word word) CopyImage16
391 stub SignalProc32
391 pascal16 SignalProc32(long long long word) UserSignalProc
394 pascal16 DrawIconEx(word word word word word word word word word) DrawIconEx16
395 pascal16 GetIconInfo(word ptr) GetIconInfo16
397 pascal16 RegisterClassEx(ptr) RegisterClassEx16
......
......@@ -122,6 +122,9 @@ typedef struct
BOOL WINAPI (*RedrawWindow)( HWND hwnd, const RECT *rectUpdate,
HRGN hrgnUpdate, UINT flags );
WORD WINAPI (*UserSignalProc)( UINT uCode, DWORD dwThreadOrProcessID,
DWORD dwFlags, HMODULE16 hModule );
HQUEUE16 WINAPI (*InitThreadInput16)( WORD unknown, WORD flags );
void WINAPI (*UserYield16)( void );
WORD WINAPI (*DestroyIcon32)( HGLOBAL16 handle, UINT16 flags );
......
......@@ -118,11 +118,11 @@ typedef struct _TDB
#define TDBF_OS2APP 0x0008
#define TDBF_WIN32 0x0010
/* USER signals */
#define USIG_TERMINATION 0x0020
#define USIG_DLL_LOAD 0x0040
#define USIG_DLL_UNLOAD 0x0080
#define USIG_GPF 0x0666
/* Windows 3.1 USER signals */
#define USIG16_TERMINATION 0x0020
#define USIG16_DLL_LOAD 0x0040
#define USIG16_DLL_UNLOAD 0x0080
#define USIG16_GPF 0x0666
/* THHOOK Kernel Data Structure */
......
......@@ -38,8 +38,8 @@ typedef struct tagUSER_DRIVER {
extern USER_DRIVER *USER_Driver;
void WINAPI USER_SignalProc(HANDLE16, UINT16, UINT16, HINSTANCE16, HQUEUE16);
void USER_ExitWindows(void);
void USER_QueueCleanup( HQUEUE16 hQueue );
WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
DWORD dwFlags, HMODULE16 hModule );
#endif /* __WINE_USER_H */
......@@ -251,9 +251,6 @@ BOOL WINAPI MAIN_UserInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserve
/* Create desktop window */
if (!WIN_CreateDesktopWindow()) return FALSE;
/* Install default USER Signal Handler */
SetTaskSignalProc( 0, (FARPROC16)USER_SignalProc );
/* Initialize keyboard driver */
KEYBOARD_Enable( keybd_event, InputKeyStateTable );
......
......@@ -10,6 +10,7 @@
#include "task.h"
#include "syslevel.h"
#include "cursoricon.h"
#include "user.h"
#include "queue.h"
#include "debug.h"
......@@ -321,6 +322,7 @@ CALLOUT_TABLE Callout =
TranslateMessage16, TranslateMessage,
DispatchMessage16, DispatchMessageA, DispatchMessageW,
RedrawWindow16, RedrawWindow,
UserSignalProc,
InitThreadInput16,
UserYield16,
CURSORICON_Destroy
......
......@@ -625,3 +625,4 @@ init MAIN_UserInit
620 stdcall GetTaskmanWindow () GetTaskmanWindow
621 stdcall SetTaskmanWindow (long) SetTaskmanWindow
622 stdcall GetProgmanWindow () GetProgmanWindow
623 stdcall UserSignalProc(long long long long) UserSignalProc
......@@ -27,6 +27,7 @@
#include "local.h"
#include "class.h"
#include "desktop.h"
#include "process.h"
#include "debug.h"
/***********************************************************************
......@@ -125,12 +126,19 @@ static void USER_ModuleUnload( HMODULE16 hModule )
/**********************************************************************
* USER_QueueCleanup
*/
void USER_QueueCleanup( HQUEUE16 hQueue )
static void USER_QueueCleanup( HQUEUE16 hQueue )
{
if ( hQueue )
{
WND* desktop = WIN_GetDesktop();
/* Patch desktop window */
if ( desktop->hmemTaskQ == hQueue )
{
HTASK16 nextTask = TASK_GetNextTask( GetCurrentTask() );
desktop->hmemTaskQ = GetTaskQueue16( nextTask );
}
/* Patch resident popup menu window */
MENU_PatchResidentPopup( hQueue, NULL );
......@@ -153,27 +161,17 @@ void USER_QueueCleanup( HQUEUE16 hQueue )
/**********************************************************************
* USER_AppExit
*/
static void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue )
static void USER_AppExit( HINSTANCE16 hInstance )
{
/* FIXME: empty clipboard if needed, maybe destroy menus (Windows
* only complains about them but does nothing);
*/
WND* desktop = WIN_GetDesktop();
/* Patch desktop window */
if( desktop->hmemTaskQ == hQueue )
desktop->hmemTaskQ = GetTaskQueue16(TASK_GetNextTask(hTask));
USER_QueueCleanup(hQueue);
/* ModuleUnload() in "Internals" */
hInstance = GetExePtr( hInstance );
if( GetModuleUsage16( hInstance ) <= 1 )
USER_ModuleUnload( hInstance );
WIN_ReleaseDesktop();
}
......@@ -202,26 +200,72 @@ void WINAPI USER_SignalProc( HANDLE16 hTaskOrModule, UINT16 uCode,
UINT16 uExitFn, HINSTANCE16 hInstance,
HQUEUE16 hQueue )
{
switch( uCode )
FIXME( win, "Win 3.1 USER signal %04x\n", uCode );
}
/***********************************************************************
* UserSignalProc (USER.610) (USER32.559)
*
* For comments about the meaning of uCode and dwFlags
* see PROCESS_CallUserSignalProc.
*
*/
WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
DWORD dwFlags, HMODULE16 hModule )
{
HINSTANCE16 hInst;
/* FIXME: Proper reaction to most signals still missing. */
switch ( uCode )
{
case USIG_GPF:
case USIG_TERMINATION:
USER_AppExit( hTaskOrModule, hInstance, hQueue ); /* task */
break;
case USIG_DLL_UNLOAD_WIN16:
case USIG_DLL_UNLOAD_WIN32:
USER_ModuleUnload( hModule );
break;
case USIG_DLL_UNLOAD_ORPHANS:
break;
case USIG_FAULT_DIALOG_PUSH:
case USIG_FAULT_DIALOG_POP:
break;
case USIG_THREAD_INIT:
break;
case USIG_THREAD_EXIT:
USER_QueueCleanup( GetThreadQueue16( dwThreadOrProcessID ) );
SetThreadQueue16( dwThreadOrProcessID, 0 );
break;
case USIG_PROCESS_CREATE:
case USIG_PROCESS_INIT:
case USIG_PROCESS_LOADED:
case USIG_PROCESS_RUNNING:
break;
case USIG_DLL_LOAD:
break;
case USIG_PROCESS_EXIT:
break;
case USIG_DLL_UNLOAD:
USER_ModuleUnload( hTaskOrModule ); /* module */
break;
case USIG_PROCESS_DESTROY:
hInst = GetProcessDword( dwThreadOrProcessID, GPD_HINSTANCE16 );
USER_AppExit( hInst );
break;
default:
FIXME(msg,"Unimplemented USER signal: %i\n", (int)uCode );
default:
FIXME( win, "(%04x, %08lx, %04lx, %04x)\n",
uCode, dwThreadOrProcessID, dwFlags, hModule );
break;
}
/* FIXME: Should chain to GdiSignalProc now. */
return 0;
}
/***********************************************************************
* ExitWindows16 (USER.7)
*/
......
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