Release 970804
Sun Aug 3 14:03:43 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [documentation/Makefile.in]
Create links for files included from wine.texinfo.
* [wine.man]
Moved to documentation dir.
* [if1632/builtin.c]
Made SYSTEM.DLL always loaded by default.
* [loader/signal.c] [if1632/signal.c]
Split signal.c in generic/emulator-specific parts.
* [misc/system.c] [if1632/thunk.c]
Implemented system timer functions.
Fixed InquireSystem parameters.
* [msdos/ioports.c]
Defined inb/outb functions to avoid including asm/io.h.
Use the right instruction for word and dword direct access.
* [multimedia/mmsystem.c]
Fixed CallTo16 usage.
Sat Aug 2 13:05:23 1997 Andreas Mohr <100.30936@germany.net>
* [controls/edit.c]
When text is inserted into a newly created editline, the caret
is placed after the text. Should be placed before the text. Fixed.
* [files/file.c]
Removed O_TRUNC flag from OF_WRITE mode in _lopen32().
According to doc _lopen() never truncates files.
* [if1632/user.spec] [misc/comm.c]
Added stub for EnableCommNotification().
* [misc/ver.c]
Fixed problem with VerQueryValue*() running over end of name table
in rare cases.
* [msdos/int21.c]
Enhanced ioctlGetDeviceInfo() to correctly return the current drive.
* [multimedia/joystick.c] [windows/message.c]
Added joystick support !!!
Needs Linux >= 2.1.45 or joystick-0.8.0.tar.gz.
Fri Aug 1 18:02:09 1997 Morten Welinder <terra@diku.dk>
* [if1632/user32.spec]
Define DrawAnimatedRects32.
* [graphics/painting.c]
(DrawAnimatedRects32): Create stub.
* [misc/registry.c]
Cope with NULL class in RegQueryInfoKey32A.
* [if1632/user32.spec]
Add GetMenuItemInfo32[AW].
* [controls/menu.c]
(InsertMenu32A): Upgrade flags to 8 hex-digits.
(MENUEX_ParseResource): First shot at implementation.
(LoadMenuIndirect32A): Handle extended menus.
(GetMenuItemInfo32[AW]): First shot at implementation.
* [include/windows.h]
Define MFT_*, MFS_*, MIIM_* macros. Define MENUITEMINFO[AW]
structures and pointers.
* [Makefile.in]
(etags): Add TAGS as target.
* [if1632/comctl32.spec]
Use Windows 95's ordinals. Add a few missing stubs.
Thu Jul 31 14:01:13 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [objects/color.c]
Fix for 16 color mode of XFree.
* [if1632/kernel32.spec][win32/ordinals.c]
Moved/added some ordinal only exported functions from kernel32.dll
(mostly thunking preparation stuff).
Wed Jul 30 09:16:38 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c] [include/win16drv.h]
Escape(SETABORTPROC) returns success to keep pbrush.exe happy.
Escape(NEXTBAND) implemented to make HP PCL printer driver work in
word. Stub for PATBLT added to start work on printing more than
text.
Mon Jul 28 13:14:28 1997 Victor Schneider <vischne@ibm.net>
* [libtest/expand.c]
New Winelib test program.
Wed Jul 23 09:37:13 1997 Adrian Harvey <adrian@select.com.au>
* [tools/build.c] [tools/build-spec.txt] [if1632/kernel.spec]
[if1632/user.spec]
Added ability to set filename wine considers the built-in DLLs
to be in to something other than name.DLL with new "file" key
in .spec files.
Made kernel filename KRNL386.EXE (some programs use this name
explicitly - ChemOffice install now starts up).
Made user filename USER.EXE (just to be tidy).
Sun Jul 20 23:51:02 1997 David A. Cuthbert <dacut@henry.ece.cmu.edu>
* [controls/menu.c] [misc/tweak.c] [include/tweak.h]
Fixed MENU_KeyLeft and MENU_KeyRight to handle multiple-column
menus. Misc menu drawing issues for Win95 tweaks fixed. Misc
warnings fixed.
* [loader/module.c]
Spaces are now permitted in file/path names on the command line.
If multiple matches can be made, the preferred match is the
path/file with fewer spaces.
Tue Jul 29 02:21:15 1997 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [misc/compobj.c]
Added CLSIDFromString and StringFromCLSID.
diff --git a/loader/main.c b/loader/main.c
index 4fb3aa3..4ac8026 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -44,12 +44,7 @@
#include "debugger.h"
#endif
-/* Winelib run-time flag */
-#ifdef WINELIB
-int __winelib = 1;
-#else
-int __winelib = 0;
-#endif
+int __winelib = 1; /* Winelib run-time flag */
HANDLE32 SystemHeap = 0;
HANDLE32 SegptrHeap = 0;
@@ -61,7 +56,6 @@
{
extern BOOL32 RELAY_Init(void);
extern BOOL32 WIN16DRV_Init(void);
- extern BOOL32 SIGNAL_Init(void);
extern BOOL32 VIRTUAL_Init(void);
extern BOOL32 WIDGETS_Init(void);
@@ -80,6 +74,9 @@
/* Initialize DOS memory */
if (!DOSMEM_Init()) return 0;
+ /* Initialize signal handling */
+ if (!SIGNAL_Init()) return 0;
+
#ifdef WINELIB
/* Create USER and GDI heap */
USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
@@ -94,7 +91,7 @@
if (!BUILTIN_Init()) return 0;
/* Initialize signal handling */
- if (!SIGNAL_Init()) return 0;
+ if (!SIGNAL_InitEmulator()) return 0;
/* Create the Win16 printer driver */
if (!WIN16DRV_Init()) return 0;
@@ -184,6 +181,8 @@
int i,loaded;
HINSTANCE16 handle;
+ __winelib = 0; /* First of all, clear the Winelib flag */
+
/*
* Save this so that the internal debugger can get a hold of it if
* it needs to.
diff --git a/loader/module.c b/loader/module.c
index a3522c6..bd12830 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -1162,8 +1162,9 @@
0xFF00, hModule, FALSE, FALSE, FALSE)
);
oldstack = IF1632_Saved16_ss_sp;
- IF1632_Saved16_ss_sp = MAKELONG( 0xFF00 - sizeof(*stack16Top),
- pModule->self_loading_sel );
+ IF1632_Saved16_ss_sp =
+ PTR_SEG_OFF_TO_SEGPTR( pModule->self_loading_sel,
+ 0xff00 - sizeof(*stack16Top) );
stack16Top = CURRENT_STACK16;
stack16Top->saved_ss_sp = 0;
stack16Top->ebp = 0;
@@ -1458,10 +1459,11 @@
{
LOADPARAMS params;
HGLOBAL16 cmdShowHandle, cmdLineHandle;
- HINSTANCE16 handle;
+ HINSTANCE16 handle = 2;
WORD *cmdShowPtr;
char *p, *cmdline, filename[256];
static int use_load_module = 1;
+ int spacelimit = 0, exhausted = 0;
if (!lpCmdLine)
return 2; /* File not found */
@@ -1473,115 +1475,148 @@
return 8; /* Out of memory */
}
- /* Store nCmdShow */
+ /* Keep trying to load a file by trying different filenames; e.g.,
+ for the cmdline "abcd efg hij", try "abcd" with args "efg hij",
+ then "abcd efg" with arg "hij", and finally "abcd efg hij" with
+ no args */
- cmdShowPtr = (WORD *)GlobalLock16( cmdShowHandle );
- cmdShowPtr[0] = 2;
- cmdShowPtr[1] = nCmdShow;
+ while(!exhausted && handle == 2) {
+ int spacecount = 0;
- /* Build the filename and command-line */
+ /* Store nCmdShow */
- cmdline = (char *)GlobalLock16( cmdLineHandle );
- lstrcpyn32A(filename, lpCmdLine, sizeof(filename) - 4 /* for extension */);
- for (p = filename; *p && (*p != ' ') && (*p != '\t'); p++);
- if (*p) lstrcpyn32A( cmdline + 1, p + 1, 127 );
- else cmdline[1] = '\0';
- cmdline[0] = strlen( cmdline + 1 ) + 1;
- *p = '\0';
+ cmdShowPtr = (WORD *)GlobalLock16( cmdShowHandle );
+ cmdShowPtr[0] = 2;
+ cmdShowPtr[1] = nCmdShow;
- /* Now load the executable file */
+ /* Build the filename and command-line */
- if (use_load_module)
- {
+ cmdline = (char *)GlobalLock16( cmdLineHandle );
+ lstrcpyn32A(filename, lpCmdLine,
+ sizeof(filename) - 4 /* for extension */);
+
+ /* Keep grabbing characters until end-of-string, tab, or until the
+ number of spaces is greater than the spacelimit */
+
+ for (p = filename; ; p++) {
+ if(*p == ' ') {
+ ++spacecount;
+ if(spacecount > spacelimit) {
+ ++spacelimit;
+ break;
+ }
+ }
+
+ if(*p == '\0' || *p == '\t') {
+ exhausted = 1;
+ break;
+ }
+ }
+
+ if (*p)
+ lstrcpyn32A( cmdline + 1, p + 1, 127 );
+ else
+ cmdline[1] = '\0';
+
+ cmdline[0] = strlen( cmdline + 1 ) + 1;
+ *p = '\0';
+
+ /* Now load the executable file */
+
+ if (use_load_module)
+ {
#ifdef WINELIB
- /* WINELIB: Use LoadModule() only for the program itself */
- use_load_module = 0;
- params.hEnvironment = (HGLOBAL16)GetDOSEnvironment();
+ /* WINELIB: Use LoadModule() only for the program itself */
+ use_load_module = 0;
+ params.hEnvironment = (HGLOBAL16)GetDOSEnvironment();
#else
- params.hEnvironment = (HGLOBAL16)SELECTOROF( GetDOSEnvironment() );
+ params.hEnvironment = (HGLOBAL16)SELECTOROF( GetDOSEnvironment() );
#endif /* WINELIB */
- params.cmdLine = (SEGPTR)WIN16_GlobalLock16( cmdLineHandle );
- params.showCmd = (SEGPTR)WIN16_GlobalLock16( cmdShowHandle );
- params.reserved = 0;
- handle = LoadModule16( filename, ¶ms );
- if (handle == 2) /* file not found */
- {
- /* Check that the original file name did not have a suffix */
- p = strrchr(filename, '.');
- /* if there is a '.', check if either \ OR / follow */
- if (!p || strchr(p, '/') || strchr(p, '\\'))
- {
- p = filename + strlen(filename);
- strcpy( p, ".exe" );
- handle = LoadModule16( filename, ¶ms );
- *p = '\0'; /* Remove extension */
- }
+ params.cmdLine = (SEGPTR)WIN16_GlobalLock16( cmdLineHandle );
+ params.showCmd = (SEGPTR)WIN16_GlobalLock16( cmdShowHandle );
+ params.reserved = 0;
+ handle = LoadModule16( filename, ¶ms );
+ if (handle == 2) /* file not found */
+ {
+ /* Check that the original file name did not have a suffix */
+ p = strrchr(filename, '.');
+ /* if there is a '.', check if either \ OR / follow */
+ if (!p || strchr(p, '/') || strchr(p, '\\'))
+ {
+ p = filename + strlen(filename);
+ strcpy( p, ".exe" );
+ handle = LoadModule16( filename, ¶ms );
+ *p = '\0'; /* Remove extension */
+ }
+ }
}
- }
- else handle = 2;
+ else
+ handle = 2; /* file not found */
- if (handle < 32)
- {
- /* Try to start it as a unix program */
- if (!fork())
+ if (handle < 32)
{
- /* Child process */
- DOS_FULL_NAME full_name;
- const char *unixfilename = NULL;
- const char *argv[256], **argptr;
- int iconic = (nCmdShow == SW_SHOWMINIMIZED ||
- nCmdShow == SW_SHOWMINNOACTIVE);
+ /* Try to start it as a unix program */
+ if (!fork())
+ {
+ /* Child process */
+ DOS_FULL_NAME full_name;
+ const char *unixfilename = NULL;
+ const char *argv[256], **argptr;
+ int iconic = (nCmdShow == SW_SHOWMINIMIZED ||
+ nCmdShow == SW_SHOWMINNOACTIVE);
- /* get unixfilename */
- if (strchr(filename, '/') ||
- strchr(filename, ':') ||
- strchr(filename, '\\'))
- {
- if (DOSFS_GetFullName( filename, TRUE, &full_name ))
- unixfilename = full_name.long_name;
- }
- else unixfilename = filename;
+ /* get unixfilename */
+ if (strchr(filename, '/') ||
+ strchr(filename, ':') ||
+ strchr(filename, '\\'))
+ {
+ if (DOSFS_GetFullName( filename, TRUE, &full_name ))
+ unixfilename = full_name.long_name;
+ }
+ else unixfilename = filename;
- if (unixfilename)
- {
- /* build argv */
- argptr = argv;
- if (iconic) *argptr++ = "-iconic";
- *argptr++ = unixfilename;
- p = cmdline;
- while (1)
- {
- while (*p && (*p == ' ' || *p == '\t')) *p++ = '\0';
- if (!*p) break;
- *argptr++ = p;
- while (*p && *p != ' ' && *p != '\t') p++;
- }
- *argptr++ = 0;
+ if (unixfilename)
+ {
+ /* build argv */
+ argptr = argv;
+ if (iconic) *argptr++ = "-iconic";
+ *argptr++ = unixfilename;
+ p = cmdline;
+ while (1)
+ {
+ while (*p && (*p == ' ' || *p == '\t')) *p++ = '\0';
+ if (!*p) break;
+ *argptr++ = p;
+ while (*p && *p != ' ' && *p != '\t') p++;
+ }
+ *argptr++ = 0;
- /* Execute */
- execvp(argv[0], (char**)argv);
- }
+ /* Execute */
+ execvp(argv[0], (char**)argv);
+ }
- /* Failed ! */
+ /* Failed ! */
- if (__winelib)
- {
- /* build argv */
- argptr = argv;
- *argptr++ = "wine";
- if (iconic) *argptr++ = "-iconic";
- *argptr++ = lpCmdLine;
- *argptr++ = 0;
+ if (__winelib)
+ {
+ /* build argv */
+ argptr = argv;
+ *argptr++ = "wine";
+ if (iconic) *argptr++ = "-iconic";
+ *argptr++ = lpCmdLine;
+ *argptr++ = 0;
- /* Execute */
- execvp(argv[0] , (char**)argv);
+ /* Execute */
+ execvp(argv[0] , (char**)argv);
- /* Failed ! */
- fprintf(stderr, "WinExec: can't exec 'wine %s'\n", lpCmdLine);
- }
- exit(1);
+ /* Failed ! */
+ fprintf(stderr, "WinExec: can't exec 'wine %s'\n",
+ lpCmdLine);
+ }
+ exit(1);
+ }
}
- }
+ } /* while (!exhausted && handle < 32) */
GlobalFree16( cmdShowHandle );
GlobalFree16( cmdLineHandle );
@@ -1590,6 +1625,35 @@
/***********************************************************************
+ * WIN32_GetProcAddress16 (KERNEL32.36)
+ * Get procaddress in 16bit module from win32... (kernel32 undoc. ordinal func)
+ */
+FARPROC16 WIN32_GetProcAddress16( HMODULE16 hModule, LPSTR name )
+{
+ WORD ordinal;
+ FARPROC16 ret;
+
+ if (!hModule) {
+ fprintf(stderr,"WIN32_GetProcAddress16: hModule may not be 0!\n");
+ return (FARPROC16)0;
+ }
+ hModule = GetExePtr(hModule);
+ if (HIWORD(name)) {
+ ordinal = MODULE_GetOrdinal( hModule, name );
+ dprintf_module( stddeb, "WIN32_GetProcAddress16: %04x '%s'\n",
+ hModule, name );
+ } else {
+ ordinal = LOWORD(name);
+ dprintf_module( stddeb, "GetProcAddress: %04x %04x\n",
+ hModule, ordinal );
+ }
+ if (!ordinal) return (FARPROC16)0;
+ ret = MODULE_GetEntryPoint( hModule, ordinal );
+ dprintf_module(stddeb,"WIN32_GetProcAddress16: returning %08x\n",(UINT32)ret);
+ return ret;
+}
+
+/***********************************************************************
* GetProcAddress16 (KERNEL.50)
*/
FARPROC16 GetProcAddress16( HMODULE16 hModule, SEGPTR name )
diff --git a/loader/ne_image.c b/loader/ne_image.c
index ca2819b..3536206 100644
--- a/loader/ne_image.c
+++ b/loader/ne_image.c
@@ -77,8 +77,8 @@
PTR_SEG_OFF_TO_LIN(pSegTable->selector,0);
oldstack = IF1632_Saved16_ss_sp;
oldselector = pSeg->selector;
- IF1632_Saved16_ss_sp = MAKELONG( 0xFF00 - sizeof(*stack16Top),
- pModule->self_loading_sel );
+ IF1632_Saved16_ss_sp = PTR_SEG_OFF_TO_SEGPTR(pModule->self_loading_sel,
+ 0xff00 - sizeof(*stack16Top));
stack16Top = CURRENT_STACK16;
stack16Top->saved_ss_sp = 0;
stack16Top->ds = stack16Top->es = pModule->self_loading_sel;
diff --git a/loader/resource.c b/loader/resource.c
index a569850..6e4ac03 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -626,7 +626,7 @@
if (buffer) buffer2 = HeapAlloc( GetProcessHeap(), 0, buflen * 2 );
retval = LoadString32W(instance,resource_id,buffer2,buflen);
- if (buffer)
+ if (buffer2)
{
lstrcpynWtoA( buffer, buffer2, buflen );
HeapFree( GetProcessHeap(), 0, buffer2 );
diff --git a/loader/signal.c b/loader/signal.c
index 43aae82..1257e33 100644
--- a/loader/signal.c
+++ b/loader/signal.c
@@ -1,4 +1,8 @@
-#ifndef WINELIB
+/*
+ * Wine signal handling
+ *
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -21,198 +25,110 @@
#include <syscall.h>
#endif
-#include "debugger.h"
-#include "options.h"
-#include "sigcontext.h"
-#include "win.h"
+#include "miscemu.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();
+/* Linux sigaction function */
+#if defined(linux) && defined(__i386__)
/* 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));
+struct kernel_sigaction
+{
+ void (*sa_handler)();
+ unsigned long sa_mask;
+ unsigned long sa_flags;
+ void (*sa_restorer)();
};
/* 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)
+ restorer field, which is used to specify the signal stack address */
+static __inline__ 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;
+ __asm__ __volatile__( "int $0x80"
+ : "=a" (sig)
+ : "0" (SYS_sigaction),
+ "b" (sig),
+ "c" (new),
+ "d" (old) );
+ if (sig>=0)
+ return 0;
+ errno = -sig;
+ return -1;
}
-#endif /* linux */
+#endif /* linux && __i386__ */
-#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 */
+/* Signal stack */
+
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+# define SIGNAL_STACK_SIZE MINSIGSTKSZ
+#elif defined (__svr4__) || defined(_SCO_DS)
+# define SIGNAL_STACK_SIZE SIGSTKSZ
#else
-#define HANDLER_DEF(name) void name (int signal, int code, SIGCONTEXT *context)
-#define HANDLER_PROLOG /* nothing */
-#define HANDLER_EPILOG /* nothing */
+# define SIGNAL_STACK_SIZE 4096
#endif
-extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
+static char SIGNAL_Stack[SIGNAL_STACK_SIZE];
-/**********************************************************************
- * 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)
+static void SIGNAL_child(void)
{
- HANDLER_PROLOG;
#ifdef HAVE_WAIT4
- wait4( 0, NULL, WNOHANG, NULL);
+ 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);
+ /* I am sort-of guessing that this is the same as the wait4 call. */
+ waitpid (0, NULL, WNOHANG);
#else
- wait(NULL);
+ 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 )
+void SIGNAL_SetHandler( int sig, void (*func)(), int flags )
{
int ret;
-#ifdef linux
+#if defined(linux) && defined(__i386__)
+
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);
+ (void (*)())((int)(SIGNAL_Stack + sizeof(SIGNAL_Stack) - 4) & ~3);
ret = wine_sigaction( sig, &sig_act, NULL );
-#endif /* linux */
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#else /* linux && __i386__ */
+
struct sigaction sig_act;
sigset_t sig_mask;
sigemptyset(&sig_mask);
sig_act.sa_handler = func;
+ sig_act.sa_mask = sig_mask;
+
+# if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
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;
+# elif defined (__svr4__) || defined(_SCO_DS)
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;
+# elif defined(__EMX__)
sig_act.sa_flags = 0; /* FIXME: EMX has only SA_ACK and SA_SYSV */
- sig_act.sa_mask = sig_mask;
+# else
+ sig_act.sa_flags = 0;
+# endif
ret = sigaction( sig, &sig_act, NULL );
-#endif /* __EMX__ */
+
+#endif /* linux && __i386__ */
if (ret < 0)
{
@@ -230,53 +146,23 @@
*/
BOOL32 SIGNAL_Init(void)
{
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__svr4__) || defined(_SCO_DS)
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_sp = SIGNAL_Stack;
+ ss.ss_size = sizeof(SIGNAL_Stack);
ss.ss_flags = 0;
- if (sigaltstack(&ss, NULL) < 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 */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __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 */
+#ifdef SIGIO
SIGNAL_SetHandler( SIGIO, (void (*)())WINSOCK_sigio, 0);
#endif
return TRUE;
@@ -284,34 +170,13 @@
/**********************************************************************
- * 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 */
+#ifdef SIGIO
sigaddset(&set, SIGIO);
#endif
sigaddset(&set, SIGUSR1);
@@ -320,5 +185,3 @@
#endif
sigprocmask( (flag) ? SIG_BLOCK : SIG_UNBLOCK , &set, NULL);
}
-
-#endif /* ifndef WINELIB */
diff --git a/loader/task.c b/loader/task.c
index 93756c8..4094ee9 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -578,9 +578,9 @@
/* Create the 16-bit stack frame */
- pTask->ss_sp = MAKELONG( ((pModule->sp != 0) ? pModule->sp :
- pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1,
- hInstance );
+ pTask->ss_sp = PTR_SEG_OFF_TO_SEGPTR( hInstance,
+ ((pModule->sp != 0) ? pModule->sp :
+ pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1 );
stack16Top = (char *)PTR_SEG_TO_LIN( pTask->ss_sp );
frame16 = (STACK16FRAME *)stack16Top - 1;
frame16->saved_ss_sp = 0;
@@ -1159,8 +1159,8 @@
/* Switch to the new stack */
- IF1632_Saved16_ss_sp = pTask->ss_sp = MAKELONG( ptr - sizeof(STACK16FRAME),
- seg );
+ IF1632_Saved16_ss_sp = pTask->ss_sp = PTR_SEG_OFF_TO_SEGPTR( seg,
+ ptr - sizeof(STACK16FRAME) );
newFrame = CURRENT_STACK16;
/* Copy the stack frame and the local variables to the new stack */
@@ -1216,23 +1216,19 @@
/***********************************************************************
* GetTaskQueueDS (KERNEL.118)
*/
-#ifndef WINELIB
void GetTaskQueueDS( CONTEXT *context )
{
DS_reg(context) = GlobalHandleToSel( GetTaskQueue(0) );
}
-#endif /* WINELIB */
/***********************************************************************
* GetTaskQueueES (KERNEL.119)
*/
-#ifndef WINELIB
void GetTaskQueueES( CONTEXT *context )
{
ES_reg(context) = GlobalHandleToSel( GetTaskQueue(0) );
}
-#endif /* WINELIB */
/***********************************************************************