Sat Jul 19 13:03:01 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [tools/build.c] [include/stackframe.h] Save the complete %ebp register in CallFrom16; fixes a crash with LabView reported by Andreas Mohr. * [loader/main.c] Avoid executing a built-in DLL. * [controls/static.c] Converted static window procedure to Win32. * [windows/message.c] [windows/queue.c] [include/queue.h] Hacked SendMessage functions to support inter-task messages with SendMessage32A/W. Sun Jul 13 16:55:35 1997 Bernhard Rosenkraenzer <bero@bero-online.ml.org> * [ipc/bit_array.c] Don't use bitops.h in Linux 2.1.x (these versions do not return the previous state for clear_bit and set_bit) * [ipc/shm_main_blk.c] Adapt to GLIBC's ipc_perm structure. * [memory/ldt.c] Include <asm/unistd.h> on Linux/GLIBC systems (required for _syscall3). Wed Jul 9 23:53:19 1997 David A. Cuthbert <dacut@henry.ece.cmu.edu> * [include/options.h] [files/profile.c] Added PROFILE_GetWineIniBool and PROFILE_EnumerateWineIniSection. * [include/sysmetrics.h] [include/windows.h] [windows/sysmetrics.c] All sysmetrics moved to array (no more constant macros). Added MOUSEWHEELPRESENT metric. * [include/bitmap.h] [objects/oembitmap.c] Added OBM_Init() (see also loader/main.c) and more support for Win95 bitmaps; added size info to OEM bitmaps. * [include/graphics.h] [windows/graphics.h] Added GRAPH_DrawGenericReliefRect. * [loader/main.c] Added TWEAK_Init() and TWEAK_CheckConfiguration() calls (the latter checks for invalid entries in wine.conf). * [include/debug.h] [include/stddebug.h] [include/nonclient.h] [include/tweak.h] [controls/menu.c] [misc/tweak.c] [objects/gdiobj.c] [windows/syscolor.c] [windows/nonclient.c] [BUGS] [documentation/win95look] Added tweaks for Windows 95 interface support. See documentation/win95look for more information. * [controls/edit.c] Fixed EDIT_MoveHome bug. * [misc/ver.c] Changed name of dprintf_ver_string to ver_dstring to fix problem with tools/make_debug utility. Wed Jul 9 21:31:54 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [objects/dib.c] Don't use palettes with dibs with biBitCount > 8. * [misc/ole2nls.c][misc/ver.c] IsValidLocale, EnumSystemLocales fixed (winhlp32.exe works) Some VerLanguage coded moved to ole2nls.c, some cleanups. * [multimedia/mcistring.c] Fixed "capabilities <dev> device type" crash (cool.exe). * [misc/main.c] SystemParametersInfo*: added stub option 41 (GETNONCLIENTMETRICS), duplicated some stuff away from SPI16 that writes 32bit vars.(one COMCTL32.DLL crash, freecell.exe) Tue Jul 8 22:40:53 1997 Morten Welinder <terra@diku.dk> * [if1632/shell32.spec] Use Windows 95's ordinals. Help wanted, inquire within. Mon Jul 7 11:20:36 1997 Philippe De Muyter <phdm@info.ucl.ac.be> * [if1632/relay.c] [if1632/user.spec] [if1632/kernel.spec] [tools/build-spec.txt] [tools/build.c] Added type 'segstr' (segmented pointer to null-terminated string) to .spec files. * [windows/user.c] [if1632/user.spec] ExitWindowsExec stub function added. Mon Jul 7 01:18:25 1997 U. Bonnes <bon@elektron.ikp.physik.th-darmstadt.de> * [files/file.c] [include/winbase.h] [if1632/kernel32.spec] Implement MoveFileEx32, some enhancement for Movefile32. Sat Jul 5 18:13:48 1997 Bruce Milner <Bruce.Milner@genetics.utah.edu. * [files/file.c] [if1632/kernel32.spec] [include/winerror.h] [msdos/int21.c] [win32/file.c] Add LockFile/UnlockFile implementation. Add back in int21 func(0x5c) Record locking functions. * [files/file.c] Fixed bug with OF_REOPEN in FILE_DoOpenFile. Fri Jul 4 12:00:00 1997 Henrik Olsen <Henrik.Olsen@iaeste.dk> * [misc/ole2nls.c] [programs/progman/Da.rc] [programs/winhelp/Da.rc] [resources/sysres_Da.rc] Added/updated Danish language support. Thu Jul 3 13:04:20 1997 Claus Fischer <fischer@iue.tuwien.ac.at> * [files/dos_fs.c] Properly implemented DOSFS_UnixTimeToFileTime and DOSFS_FileTimeToUnixTime. * [documentation/wine.texinfo] First version of texinfo documentation.
324 lines
8.3 KiB
C
324 lines
8.3 KiB
C
#ifndef WINELIB
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <signal.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <time.h>
|
|
#include <setjmp.h>
|
|
|
|
#include <sys/time.h>
|
|
#include <sys/timeb.h>
|
|
#include <sys/types.h>
|
|
#include <sys/wait.h>
|
|
|
|
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__svr4__) || defined(_SCO_DS) || defined(__EMX__)
|
|
#if !defined(_SCO_DS) && !defined(__EMX__)
|
|
#include <sys/syscall.h>
|
|
#endif
|
|
#include <sys/param.h>
|
|
#else
|
|
#include <syscall.h>
|
|
#endif
|
|
|
|
#include "debugger.h"
|
|
#include "options.h"
|
|
#include "sigcontext.h"
|
|
#include "win.h"
|
|
#include "winsock.h"
|
|
|
|
#if !defined(BSD4_4) || defined(linux) || defined(__FreeBSD__)
|
|
char * cstack[4096];
|
|
#endif
|
|
|
|
#ifdef linux
|
|
extern void ___sig_restore();
|
|
extern void ___masksig_restore();
|
|
|
|
/* This is the sigaction structure from the Linux 2.1.20 kernel. */
|
|
|
|
struct kernel_sigaction {
|
|
__sighandler_t sa_handler;
|
|
unsigned long sa_mask;
|
|
unsigned long sa_flags;
|
|
void (*sa_restorer) __P ((void));
|
|
};
|
|
|
|
/* Similar to the sigaction function in libc, except it leaves alone the
|
|
restorer field */
|
|
|
|
static int
|
|
wine_sigaction(int sig,struct kernel_sigaction * new,
|
|
struct kernel_sigaction * old)
|
|
{
|
|
__asm__("int $0x80":"=a" (sig)
|
|
:"0" (SYS_sigaction),"b" (sig),"c" (new),"d" (old));
|
|
if (sig>=0)
|
|
return 0;
|
|
errno = -sig;
|
|
return -1;
|
|
}
|
|
#endif /* linux */
|
|
|
|
|
|
#ifdef linux
|
|
#define HANDLER_DEF(name) void name (int signal, SIGCONTEXT context_struct)
|
|
#define HANDLER_PROLOG SIGCONTEXT *context = &context_struct; (void)context; {
|
|
#define HANDLER_EPILOG }
|
|
#elif defined(__svr4__) || defined(_SCO_DS)
|
|
#define HANDLER_DEF(name) void name (int signal, void *siginfo, SIGCONTEXT *context)
|
|
#define HANDLER_PROLOG /* nothing */
|
|
#define HANDLER_EPILOG /* nothing */
|
|
#else
|
|
#define HANDLER_DEF(name) void name (int signal, int code, SIGCONTEXT *context)
|
|
#define HANDLER_PROLOG /* nothing */
|
|
#define HANDLER_EPILOG /* nothing */
|
|
#endif
|
|
|
|
extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
|
|
|
|
/**********************************************************************
|
|
* wine_timer
|
|
*
|
|
* SIGALRM handler.
|
|
*/
|
|
static
|
|
HANDLER_DEF(wine_timer)
|
|
{
|
|
HANDLER_PROLOG;
|
|
/* Should do real-time timers here */
|
|
DOSMEM_Tick();
|
|
HANDLER_EPILOG;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_break
|
|
*
|
|
* Handle Ctrl-C and such
|
|
*/
|
|
static
|
|
HANDLER_DEF(SIGNAL_break)
|
|
{
|
|
HANDLER_PROLOG;
|
|
if (Options.debug) wine_debug( signal, context ); /* Enter our debugger */
|
|
exit(0);
|
|
HANDLER_EPILOG;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_child
|
|
*
|
|
* wait4 terminated child processes
|
|
*/
|
|
static
|
|
HANDLER_DEF(SIGNAL_child)
|
|
{
|
|
HANDLER_PROLOG;
|
|
#ifdef HAVE_WAIT4
|
|
wait4( 0, NULL, WNOHANG, NULL);
|
|
#elif defined (HAVE_WAITPID)
|
|
/* I am sort-of guessing that this is the same as the wait4 call. */
|
|
waitpid (0, NULL, WNOHANG);
|
|
#else
|
|
wait(NULL);
|
|
#endif
|
|
HANDLER_EPILOG;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_trap
|
|
*
|
|
* SIGTRAP handler.
|
|
*/
|
|
static
|
|
HANDLER_DEF(SIGNAL_trap)
|
|
{
|
|
HANDLER_PROLOG;
|
|
wine_debug( signal, context ); /* Enter our debugger */
|
|
HANDLER_EPILOG;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_fault
|
|
*
|
|
* Segfault handler.
|
|
*/
|
|
static
|
|
HANDLER_DEF(SIGNAL_fault)
|
|
{
|
|
HANDLER_PROLOG;
|
|
if (CS_sig(context) == WINE_CODE_SELECTOR)
|
|
{
|
|
fprintf( stderr, "Segmentation fault in Wine program (%04x:%08lx)."
|
|
" Please debug.\n",
|
|
(unsigned short) CS_sig(context), EIP_sig(context));
|
|
}
|
|
else
|
|
{
|
|
if (INSTR_EmulateInstruction( context )) return;
|
|
fprintf( stderr, "Segmentation fault in Windows program %04x:%08lx.\n",
|
|
(unsigned short) CS_sig(context), EIP_sig(context) );
|
|
}
|
|
wine_debug( signal, context );
|
|
HANDLER_EPILOG;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_SetHandler
|
|
*/
|
|
static void SIGNAL_SetHandler( int sig, void (*func)(), int flags )
|
|
{
|
|
int ret;
|
|
|
|
#ifdef linux
|
|
struct kernel_sigaction sig_act;
|
|
sig_act.sa_handler = func;
|
|
sig_act.sa_flags = SA_RESTART | (flags) ? SA_NOMASK : 0;
|
|
/* Point to the top of the stack, minus 4 just in case, and make
|
|
it aligned */
|
|
sig_act.sa_restorer =
|
|
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
|
|
ret = wine_sigaction( sig, &sig_act, NULL );
|
|
#endif /* linux */
|
|
|
|
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
struct sigaction sig_act;
|
|
sigset_t sig_mask;
|
|
sigemptyset(&sig_mask);
|
|
sig_act.sa_handler = func;
|
|
sig_act.sa_flags = SA_ONSTACK;
|
|
sig_act.sa_mask = sig_mask;
|
|
ret = sigaction( sig, &sig_act, NULL );
|
|
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
|
|
|
#if defined (__svr4__) || defined(_SCO_DS)
|
|
struct sigaction sig_act;
|
|
sigset_t sig_mask;
|
|
sigemptyset(&sig_mask);
|
|
sig_act.sa_handler = func;
|
|
sig_act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART;
|
|
sig_act.sa_mask = sig_mask;
|
|
ret = sigaction( sig, &sig_act, NULL );
|
|
#endif /* __svr4__ || _SCO_DS */
|
|
|
|
#if defined(__EMX__)
|
|
struct sigaction sig_act;
|
|
sigset_t sig_mask;
|
|
sigemptyset(&sig_mask);
|
|
sig_act.sa_handler = func;
|
|
sig_act.sa_flags = 0; /* FIXME: EMX has only SA_ACK and SA_SYSV */
|
|
sig_act.sa_mask = sig_mask;
|
|
ret = sigaction( sig, &sig_act, NULL );
|
|
#endif /* __EMX__ */
|
|
|
|
if (ret < 0)
|
|
{
|
|
perror( "sigaction" );
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
extern void stop_wait(int a);
|
|
extern void WINSOCK_sigio(int a);
|
|
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_Init
|
|
*/
|
|
BOOL32 SIGNAL_Init(void)
|
|
{
|
|
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
struct sigaltstack ss;
|
|
|
|
if ((ss.ss_sp = malloc(MINSIGSTKSZ)) == NULL) {
|
|
fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
|
|
MINSIGSTKSZ);
|
|
return FALSE;
|
|
}
|
|
ss.ss_size = MINSIGSTKSZ;
|
|
ss.ss_flags = 0;
|
|
if (sigaltstack(&ss, NULL) < 0) {
|
|
perror("sigstack");
|
|
return FALSE;
|
|
}
|
|
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
|
|
|
#if defined (__svr4__) || defined(_SCO_DS)
|
|
struct sigaltstack ss;
|
|
|
|
if ((ss.ss_sp = malloc(SIGSTKSZ) ) == NULL) {
|
|
fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
|
|
SIGSTKSZ);
|
|
return FALSE;
|
|
}
|
|
ss.ss_size = SIGSTKSZ;
|
|
ss.ss_flags = 0;
|
|
if (sigaltstack(&ss, NULL) < 0) {
|
|
perror("sigstack");
|
|
return FALSE;
|
|
}
|
|
#endif /* __svr4__ || _SCO_DS */
|
|
|
|
SIGNAL_SetHandler( SIGALRM, (void (*)())wine_timer, 1);
|
|
SIGNAL_SetHandler( SIGINT, (void (*)())SIGNAL_break, 1);
|
|
SIGNAL_SetHandler( SIGCHLD, (void (*)())SIGNAL_child, 1);
|
|
SIGNAL_SetHandler( SIGSEGV, (void (*)())SIGNAL_fault, 1);
|
|
SIGNAL_SetHandler( SIGILL, (void (*)())SIGNAL_fault, 1);
|
|
SIGNAL_SetHandler( SIGFPE, (void (*)())SIGNAL_fault, 1);
|
|
SIGNAL_SetHandler( SIGTRAP, (void (*)())SIGNAL_trap, 1); /* debugger */
|
|
SIGNAL_SetHandler( SIGHUP, (void (*)())SIGNAL_trap, 1); /* forced break */
|
|
#ifdef SIGBUS
|
|
SIGNAL_SetHandler( SIGBUS, (void (*)())SIGNAL_fault, 1);
|
|
#endif
|
|
#ifdef CONFIG_IPC
|
|
SIGNAL_SetHandler( SIGUSR2, (void (*)())stop_wait, 1); /* For IPC */
|
|
#endif
|
|
#ifndef __EMX__ /* FIXME */
|
|
SIGNAL_SetHandler( SIGIO, (void (*)())WINSOCK_sigio, 0);
|
|
#endif
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_StartBIOSTimer
|
|
*
|
|
* Start the BIOS tick timer.
|
|
*/
|
|
void SIGNAL_StartBIOSTimer(void)
|
|
{
|
|
#ifndef __EMX__ /* FIXME: Time don't work... Use BIOS directly instead */
|
|
struct itimerval vt_timer;
|
|
static int timer_started = 0;
|
|
|
|
if (timer_started) return;
|
|
timer_started = 1;
|
|
vt_timer.it_interval.tv_sec = 0;
|
|
vt_timer.it_interval.tv_usec = 54929;
|
|
vt_timer.it_value = vt_timer.it_interval;
|
|
|
|
setitimer(ITIMER_REAL, &vt_timer, NULL);
|
|
#endif
|
|
}
|
|
|
|
/**********************************************************************
|
|
* SIGNAL_MaskAsyncEvents
|
|
*/
|
|
void SIGNAL_MaskAsyncEvents( BOOL32 flag )
|
|
{
|
|
sigset_t set;
|
|
sigemptyset(&set);
|
|
#ifndef __EMX__ /* FIXME */
|
|
sigaddset(&set, SIGIO);
|
|
#endif
|
|
sigaddset(&set, SIGUSR1);
|
|
#ifdef CONFIG_IPC
|
|
sigaddset(&set, SIGUSR2);
|
|
#endif
|
|
sigprocmask( (flag) ? SIG_BLOCK : SIG_UNBLOCK , &set, NULL);
|
|
}
|
|
|
|
#endif /* ifndef WINELIB */
|