modified include/reactos/wine/exception.h

Farewell Wine exception handling macros. You won't be missed

modified   dll/win32/icmp/icmp_main.c
   Removed gratuitous use of _getpid
   Winsock APIs don't set errno, they set the last error
   As a consequence, icmp.dll no longer depends on msvcrt.dll

modified   tools/rbuild/module.cpp
   Link DLLs to ntdll's CRT instead of msvcrt's by default (most DLLs don't actually need msvcrt)

Everything else:
   Set crt attribute of <module> to "msvcrt" if ntdll isn't good enough
   Link to pseh if necessary

svn path=/trunk/; revision=38221
This commit is contained in:
KJK::Hyperion 2008-12-21 03:58:19 +00:00
parent 0cbe39b8da
commit 77911bbdee
37 changed files with 89 additions and 352 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="mesa32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_MESA32}" installbase="system32" installname="mesa32.dll" allowwarnings="true">
<module name="mesa32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_MESA32}" installbase="system32" installname="mesa32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="src/drivers/windows/icd/mesa.def" />
<linkerflag>-enable-stdcall-fixup</linkerflag>
<library>ntdll</library>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="yes">
<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="desk.def" />
<include base="desk">.</include>
<define name="_WIN32" />

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes">
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="intl.def" />
<include base="intl">.</include>
<library>kernel32</library>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="main" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MAIN}" installbase="system32" installname="main.cpl" unicode="yes">
<module name="main" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MAIN}" installbase="system32" installname="main.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="main.def" />
<include base="main">.</include>
<library>kernel32</library>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="mmsys" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MMSYS}" installbase="system32" installname="mmsys.cpl" unicode="yes">
<module name="mmsys" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MMSYS}" installbase="system32" installname="mmsys.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="mmsys.spec" />
<include base="mmsys">.</include>
<library>kernel32</library>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes">
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="usrmgr.def" />
<include base="usrmgr">.</include>
<library>kernel32</library>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="ddraw" type="win32dll" installbase="system32" installname="ddraw.dll" allowwarnings ="true" unicode="yes">
<module name="ddraw" type="win32dll" installbase="system32" installname="ddraw.dll" allowwarnings ="true" unicode="yes" crt="msvcrt">
<importlibrary definition="ddraw.def" />
<include base="ddraw">.</include>
<library>kernel32</library>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="dsound" type="win32dll" baseaddress="${BASEADDRESS_DSOUND}" installbase="system32" installname="dsound.dll" allowwarnings ="true">
<module name="dsound" type="win32dll" baseaddress="${BASEADDRESS_DSOUND}" installbase="system32" installname="dsound.dll" allowwarnings ="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="dsound.spec" />
<include base="dsound">.</include>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="wined3d" type="win32dll" installbase="system32" installname="wined3d.dll" allowwarnings ="true">
<module name="wined3d" type="win32dll" installbase="system32" installname="wined3d.dll" allowwarnings ="true" crt="msvcrt">
<importlibrary definition="wined3d.def" />
<include base="wined3d">.</include>
<include base="ReactOS">include/reactos/wine</include>

View file

@ -1,4 +1,4 @@
<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll" allowwarnings="true">
<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="crypt32.spec" />
<include base="crypt32">.</include>
<include base="ReactOS">include/reactos/wine</include>
@ -10,6 +10,7 @@
<library>kernel32</library>
<library>ntdll</library>
<library>imagehlp</library>
<library>pseh</library>
<file>base64.c</file>
<file>cert.c</file>
<file>chain.c</file>
@ -35,4 +36,6 @@
<file>ctl.c</file>
<file>message.c</file>
<file>crypt32.rc</file>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="dbghelp" type="win32dll" baseaddress="${BASEADDRESS_DBGHELP}" installbase="system32" installname="dbghelp.dll" allowwarnings="true">
<module name="dbghelp" type="win32dll" baseaddress="${BASEADDRESS_DBGHELP}" installbase="system32" installname="dbghelp.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="dbghelp.spec" />
<include base="dbghelp">.</include>
<include base="ReactOS">include/reactos/wine</include>
@ -31,5 +31,6 @@
<library>kernel32</library>
<library>version</library>
<library>ntdll</library>
<library>pseh</library>
</module>
</group>

View file

@ -1,4 +1,4 @@
<module name="dnsapi" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_DNSAPI}" installbase="system32" installname="dnsapi.dll">
<module name="dnsapi" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_DNSAPI}" installbase="system32" installname="dnsapi.dll" crt="msvcrt">
<importlibrary definition="dnsapi.def" />
<include base="dnsapi">include</include>
<include base="adns">src</include>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="gdiplus" type="win32dll" baseaddress="${BASEADDRESS_GDIPLUS}" installbase="system32" installname="gdiplus.dll" allowwarnings="true">
<module name="gdiplus" type="win32dll" baseaddress="${BASEADDRESS_GDIPLUS}" installbase="system32" installname="gdiplus.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="gdiplus.spec" />
<include base="gdiplus">.</include>
<include base="ReactOS">include/reactos/wine</include>

View file

@ -1,4 +1,4 @@
<module name="glu32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_GLU32}" installbase="system32" installname="glu32.dll" allowwarnings="true">
<module name="glu32" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_GLU32}" installbase="system32" installname="glu32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="glu32.def" />
<include base="glu32">include</include>
<include base="glu32">libnurbs/internals</include>

View file

@ -231,7 +231,7 @@ DWORD WINAPI IcmpSendEcho(
/* check the request size against SO_MAX_MSG_SIZE using getsockopt */
/* Prepare the request */
id=_getpid() & 0xFFFF;
id=GetCurrentProcessId() & 0xFFFF;
seq=InterlockedIncrement(&icmp_sequence) & 0xFFFF;
reqsize=ICMP_MINLEN+RequestSize;
@ -319,18 +319,18 @@ DWORD WINAPI IcmpSendEcho(
res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, sizeof(addr));
HeapFree(GetProcessHeap (), 0, reqbuf);
if (res<0) {
if (errno==EMSGSIZE)
if (WSAGetLastError()==WSAEMSGSIZE)
SetLastError(IP_PACKET_TOO_BIG);
else {
switch (errno) {
case ENETUNREACH:
switch (WSAGetLastError()) {
case WSAENETUNREACH:
SetLastError(IP_DEST_NET_UNREACHABLE);
break;
case EHOSTUNREACH:
case WSAEHOSTUNREACH:
SetLastError(IP_DEST_HOST_UNREACHABLE);
break;
default:
TRACE("unknown error: errno=%d\n",errno);
TRACE("unknown error: errno=%d\n",WSAGetLastError());
SetLastError(IP_GENERAL_FAILURE);
}
}

View file

@ -1,4 +1,4 @@
<module name="iphlpapi" type="win32dll" baseaddress="${BASEADDRESS_IPHLPAPI}" installbase="system32" installname="iphlpapi.dll" allowwarnings="true" unicode="yes">
<module name="iphlpapi" type="win32dll" baseaddress="${BASEADDRESS_IPHLPAPI}" installbase="system32" installname="iphlpapi.dll" allowwarnings="true" unicode="yes" crt="msvcrt">
<importlibrary definition="iphlpapi.spec" />
<include base="iphlpapi">include</include>
<include base="ReactOS">include/reactos/wine</include>

View file

@ -1,5 +1,5 @@
<group>
<module name="jscript" type="win32dll" baseaddress="${BASEADDRESS_JSCRIPT}" installbase="system32" installname="jscript.dll" allowwarnings="true">
<module name="jscript" type="win32dll" baseaddress="${BASEADDRESS_JSCRIPT}" installbase="system32" installname="jscript.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="jscript.spec" />
<include base="jscript">.</include>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="msi" type="win32dll" baseaddress="${BASEADDRESS_MSI}" installbase="system32" installname="msi.dll" allowwarnings="true">
<module name="msi" type="win32dll" baseaddress="${BASEADDRESS_MSI}" installbase="system32" installname="msi.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="msi.spec" />
<include base="msi">.</include>
@ -69,6 +69,7 @@
<library>kernel32</library>
<library>odbccp32</library>
<library>ntdll</library>
<library>pseh</library>
<dependency>msiserver</dependency>
<dependency>msiheader</dependency>
</module>

View file

@ -20,6 +20,7 @@
<library>wine</library>
<library>kernel32</library>
<library>ntdll</library>
<library>pseh</library>
<pch>precomp.h</pch>
<file>dllmain.c</file>
<file>msvcrt.rc</file>

View file

@ -1,5 +1,5 @@
<group>
<module name="msxml3" type="win32dll" baseaddress="${BASEADDRESS_MSXML3}" installbase="system32" installname="msxml3.dll" allowwarnings="true">
<module name="msxml3" type="win32dll" baseaddress="${BASEADDRESS_MSXML3}" installbase="system32" installname="msxml3.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="msxml3.spec" />
<include base="msxml3">.</include>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="odbc32" type="win32dll" baseaddress="${BASEADDRESS_ODBC32}" installbase="system32" installname="odbc32.dll" allowwarnings="true" >
<module name="odbc32" type="win32dll" baseaddress="${BASEADDRESS_ODBC32}" installbase="system32" installname="odbc32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="odbc32.spec" />
<include base="odbc32">.</include>
<include base="ReactOS">include/reactos/wine</include>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="ole32" type="win32dll" baseaddress="${BASEADDRESS_OLE32}" installbase="system32" installname="ole32.dll" allowwarnings="true">
<module name="ole32" type="win32dll" baseaddress="${BASEADDRESS_OLE32}" installbase="system32" installname="ole32.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="ole32.spec" />
<include base="ole32">.</include>
@ -61,6 +61,8 @@
<file>dcom.idl</file>
<file>irot.idl</file>
<include base="ole32" root="intermediate">.</include>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>
<module name="ole32_irot_server" type="rpcserver">
<file>irot.idl</file>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true">
<module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="oleaut32.spec" />
<include base="oleaut32">.</include>

View file

@ -1,4 +1,4 @@
<module name="opengl32" type="win32dll" baseaddress="${BASEADDRESS_OPENGL32}" installbase="system32" installname="opengl32.dll" unicode="yes">
<module name="opengl32" type="win32dll" baseaddress="${BASEADDRESS_OPENGL32}" installbase="system32" installname="opengl32.dll" unicode="yes" crt="msvcrt">
<importlibrary definition="opengl32.def" />
<define name="_DISABLE_TIDENTS" />
<library>ntdll</library>

View file

@ -1,4 +1,4 @@
<module name="rpcrt4" type="win32dll" baseaddress="${BASEADDRESS_RPCRT4}" installbase="system32" installname="rpcrt4.dll" allowwarnings="true">
<module name="rpcrt4" type="win32dll" baseaddress="${BASEADDRESS_RPCRT4}" installbase="system32" installname="rpcrt4.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="rpcrt4.spec" />
<include base="rpcrt4">.</include>
@ -39,6 +39,8 @@
<file>rpcrt4.rc</file>
<file>epm.idl</file>
<include base="rpcrt4" root="intermediate">.</include>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>
<module name="rpcrt4_epm_client" type="rpcclient">
<file>epm.idl</file>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="rsaenh" type="win32dll" baseaddress="${BASEADDRESS_RSAENH}" installbase="system32" installname="rsaenh.dll" allowwarnings="true">
<module name="rsaenh" type="win32dll" baseaddress="${BASEADDRESS_RSAENH}" installbase="system32" installname="rsaenh.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="rsaenh.spec" />
<include base="rsaenh">.</include>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="setupapi" type="win32dll" baseaddress="${BASEADDRESS_SETUPAPI}" installbase="system32" installname="setupapi.dll" allowwarnings="true" unicode="yes">
<module name="setupapi" type="win32dll" baseaddress="${BASEADDRESS_SETUPAPI}" installbase="system32" installname="setupapi.dll" allowwarnings="true" unicode="yes" crt="msvcrt">
<importlibrary definition="setupapi.spec" />
<include base="setupapi">.</include>
<include base="ReactOS">include/reactos/wine</include>

View file

@ -1,4 +1,4 @@
<module name="shell32" type="win32dll" baseaddress="${BASEADDRESS_SHELL32}" installbase="system32" installname="shell32.dll">
<module name="shell32" type="win32dll" baseaddress="${BASEADDRESS_SHELL32}" installbase="system32" installname="shell32.dll" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="Both" />
<importlibrary definition="shell32.spec" />
<include base="shell32">.</include>

View file

@ -1,4 +1,4 @@
<module name="syssetup" type="win32dll" baseaddress="${BASEADDRESS_SYSSETUP}" installbase="system32" installname="syssetup.dll" unicode="yes" allowwarnings="true">
<module name="syssetup" type="win32dll" baseaddress="${BASEADDRESS_SYSSETUP}" installbase="system32" installname="syssetup.dll" unicode="yes" allowwarnings="true" crt="msvcrt">
<importlibrary definition="syssetup.def" />
<include base="syssetup">.</include>
<library>pseh</library>

View file

@ -1,4 +1,4 @@
<module name="twain_32" type="win32dll" baseaddress="${BASEADDRESS_TWAIN_32}" installbase="system32" installname="twain_32.dll" allowwarnings="true">
<module name="twain_32" type="win32dll" baseaddress="${BASEADDRESS_TWAIN_32}" installbase="system32" installname="twain_32.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="twain_32.def" />
<include base="twain_32">.</include>
<define name="_DISABLE_TIDENTS" />

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="winhttp" type="win32dll" baseaddress="${BASEADDRESS_WINHTTP}" installbase="system32" installname="winhttp.dll" allowwarnings="true">
<module name="winhttp" type="win32dll" baseaddress="${BASEADDRESS_WINHTTP}" installbase="system32" installname="winhttp.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="winhttp.spec" />
<include base="winhttp">.</include>

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" allowwarnings="true">
<module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllInstall" />
<importlibrary definition="wininet.spec" />
<include base="wininet">.</include>

View file

@ -7,7 +7,7 @@
<directory name="wavemap">
<xi:include href="wavemap/wavemap.rbuild" />
</directory>
<module name="winmm" type="win32dll" baseaddress="${BASEADDRESS_WINMM}" installbase="system32" installname="winmm.dll" allowwarnings="true">
<module name="winmm" type="win32dll" baseaddress="${BASEADDRESS_WINMM}" installbase="system32" installname="winmm.dll" allowwarnings="true" crt="msvcrt">
<importlibrary definition="winmm.spec" />
<include base="winmm">.</include>
<include base="ReactOS">include/reactos/wine</include>

View file

@ -1,4 +1,4 @@
<module name="wintrust" type="win32dll" baseaddress="${BASEADDRESS_WINTRUST}" installbase="system32" installname="wintrust.dll" allowwarnings="true">
<module name="wintrust" type="win32dll" baseaddress="${BASEADDRESS_WINTRUST}" installbase="system32" installname="wintrust.dll" allowwarnings="true" crt="msvcrt">
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<importlibrary definition="wintrust.spec" />
<include base="wintrust">.</include>
@ -11,10 +11,13 @@
<library>kernel32</library>
<library>imagehlp</library>
<library>ntdll</library>
<library>pseh</library>
<file>crypt.c</file>
<file>register.c</file>
<file>wintrust_main.c</file>
<file>asn.c</file>
<file>softpub.c</file>
<file>version.rc</file>
<!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
<compilerflag>-fno-unit-at-a-time</compilerflag>
</module>

View file

@ -1,342 +1,66 @@
/*
* Wine exception handling
*
* Copyright (c) 1999 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WINE_EXCEPTION_H
#define __WINE_WINE_EXCEPTION_H
#include <setjmp.h>
#include <windef.h>
#include <excpt.h>
#include <intrin.h>
#include <pseh/pseh2.h>
#include <pseh/excpt.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The following definitions allow using exceptions in Wine and Winelib code
*
* They should be used like this:
*
* __TRY
* {
* do some stuff that can raise an exception
* }
* __EXCEPT(filter_func,param)
* {
* handle the exception here
* }
* __ENDTRY
*
* or
*
* __TRY
* {
* do some stuff that can raise an exception
* }
* __FINALLY(finally_func,param)
*
* The filter_func must be defined with the WINE_EXCEPTION_FILTER
* macro, and return one of the EXCEPTION_* code; it can use
* GetExceptionInformation and GetExceptionCode to retrieve the
* exception info.
*
* The finally_func must be defined with the WINE_FINALLY_FUNC macro.
*
* Warning: inside a __TRY or __EXCEPT block, 'break' or 'continue' statements
* break out of the current block. You cannot use 'return', 'goto'
* or 'longjmp' to leave a __TRY block, as this will surely crash.
* You can use them to leave a __EXCEPT block though.
*
* -- AJ
*/
struct _EXCEPTION_REGISTRATION_RECORD;
typedef struct _EXCEPTION_REGISTRATION_RECORD EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
typedef struct _EXCEPTION_REGISTRATION_RECORD
struct _EXCEPTION_REGISTRATION_RECORD
{
struct _EXCEPTION_REGISTRATION_RECORD *Prev;
struct _EXCEPTION_REGISTRATION_RECORD * Prev;
PEXCEPTION_HANDLER Handler;
} EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
};
/* Define this if you want to use your compiler built-in __try/__except support.
* This is only useful when compiling to a native Windows binary, as the built-in
* compiler exceptions will most certainly not work under Winelib.
*/
#ifdef USE_COMPILER_EXCEPTIONS
#define __TRY _SEH2_TRY
#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION)
#define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
#define __ENDTRY _SEH2_END
#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
#define __TRY __try
#define __EXCEPT(func) __except((func)(GetExceptionInformation()))
#define __FINALLY(func) __finally { (func)(!AbnormalTermination()); }
#define __ENDTRY /*nothing*/
#define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
#define __EXCEPT_ALL __except(EXCEPTION_EXECUTE_HANDLER)
#else /* USE_COMPILER_EXCEPTIONS */
#ifndef __GNUC__
#define __attribute__(x) /* nothing */
#ifndef GetExceptionCode
#define GetExceptionCode() _SEH2_GetExceptionCode()
#endif
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__REACTOS__)
#define sigjmp_buf jmp_buf
#define sigsetjmp(buf,sigs) setjmp(buf)
#define siglongjmp(buf,val) longjmp(buf,val)
#ifndef GetExceptionInformation
#define GetExceptionInformation() _SEH2_GetExceptionInformation()
#endif
#define __TRY \
do { __WINE_FRAME __f; \
int __first = 1; \
for (;;) if (!__first) \
{ \
do {
#define __EXCEPT(func) \
} while(0); \
__wine_pop_frame( &__f.frame ); \
break; \
} else { \
__f.frame.Handler = __wine_exception_handler; \
__f.u.filter = (func); \
if (sigsetjmp( __f.jmp, 0 )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
/* convenience handler for page fault exceptions */
#define __EXCEPT_PAGE_FAULT \
} while(0); \
__wine_pop_frame( &__f.frame ); \
break; \
} else { \
__f.frame.Handler = __wine_exception_handler_page_fault; \
if (sigsetjmp( __f.jmp, 0 )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
/* convenience handler for all exception */
#define __EXCEPT_ALL \
} while(0); \
__wine_pop_frame( &__f.frame ); \
break; \
} else { \
__f.frame.Handler = __wine_exception_handler_all; \
if (sigsetjmp( __f.jmp, 0 )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
#define __ENDTRY \
} while (0); \
break; \
} \
__wine_push_frame( &__f.frame ); \
__first = 0; \
} \
} while (0);
#define __FINALLY(func) \
} while(0); \
__wine_pop_frame( &__f.frame ); \
(func)(1); \
break; \
} else { \
__f.frame.Handler = __wine_finally_handler; \
__f.u.finally_func = (func); \
__wine_push_frame( &__f.frame ); \
__first = 0; \
} \
} while (0);
typedef LONG (CALLBACK *__WINE_FILTER)(PEXCEPTION_POINTERS);
typedef void (CALLBACK *__WINE_FINALLY)(BOOL);
#define GetExceptionInformation() (__eptr)
#define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode)
#undef AbnormalTermination
#define AbnormalTermination() (!__normal)
typedef struct __tagWINE_FRAME
{
EXCEPTION_REGISTRATION_RECORD frame;
union
{
/* exception data */
__WINE_FILTER filter;
/* finally data */
__WINE_FINALLY finally_func;
} u;
sigjmp_buf jmp;
/* hack to make GetExceptionCode() work in handler */
DWORD ExceptionCode;
const struct __tagWINE_FRAME *ExceptionRecord;
} __WINE_FRAME;
#endif /* USE_COMPILER_EXCEPTIONS */
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
#if defined(__GNUC__) && defined(__i386__)
EXCEPTION_REGISTRATION_RECORD *prev;
__asm__ __volatile__(".byte 0x64\n\tmovl (0),%0"
"\n\tmovl %0,(%1)"
"\n\t.byte 0x64\n\tmovl %1,(0)"
: "=&r" (prev) : "r" (frame) : "memory" );
return prev;
#else
NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
frame->Prev = teb->ExceptionList;
teb->ExceptionList = frame;
return frame->Prev;
#ifndef AbnormalTermination
#define AbnormalTermination() _SEH2_AbnormalTermination()
#endif
}
static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
#if defined(__GNUC__) && defined(__i386__)
__asm__ __volatile__(".byte 0x64\n\tmovl %0,(0)"
: : "r" (frame->Prev) : "memory" );
return frame->Prev;
#define EXCEPTION_WINE_STUB 0x80000100
#define EXCEPTION_WINE_ASSERTION 0x80000101
#else
NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
teb->ExceptionList = frame->Prev;
return frame->Prev;
#endif
}
/* Exception handling flags - from OS/2 2.0 exception handling */
/* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD */
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
/* Wine-specific exceptions codes */
#define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */
#define EXCEPTION_WINE_ASSERTION 0x80000101 /* assertion failed */
/* unhandled return status from vm86 mode */
#define EXCEPTION_VM86_INTx 0x80000110
#define EXCEPTION_VM86_STI 0x80000111
#define EXCEPTION_VM86_PICRETURN 0x80000112
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
frame->Prev = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
__writefsdword(0, (unsigned long)frame);
return frame->Prev;
}
static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
__writefsdword(0, (unsigned long)frame->Prev);
return frame->Prev;
}
extern void __wine_enter_vm86( CONTEXT *context );
#ifndef USE_COMPILER_EXCEPTIONS
/* wrapper for RtlUnwind since it clobbers registers on Windows */
static inline void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record )
{
#if defined(__GNUC__) && defined(__i386__)
int dummy1, dummy2, dummy3;
__asm__ __volatile__("pushl %%ebp\n\t"
"pushl %%ebx\n\t"
"pushl $0\n\t"
"pushl %2\n\t"
"pushl $0\n\t"
"pushl %1\n\t"
"call *%0\n\t"
"popl %%ebx\n\t"
"popl %%ebp"
: "=a" (dummy1), "=S" (dummy2), "=D" (dummy3)
: "0" (RtlUnwind), "1" (frame), "2" (record)
: "ecx", "edx", "memory" );
#else
RtlUnwind( frame, 0, record, 0 );
#endif
}
static inline void DECLSPEC_NORETURN __wine_unwind_frame( EXCEPTION_RECORD *record,
EXCEPTION_REGISTRATION_RECORD *frame )
{
__WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
/* hack to make GetExceptionCode() work in handler */
wine_frame->ExceptionCode = record->ExceptionCode;
wine_frame->ExceptionRecord = wine_frame;
__wine_rtl_unwind( frame, record );
__wine_pop_frame( frame );
siglongjmp( wine_frame->jmp, 1 );
}
static inline EXCEPTION_DISPOSITION
__wine_exception_handler( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
__WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
EXCEPTION_POINTERS ptrs;
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
ptrs.ExceptionRecord = record;
ptrs.ContextRecord = context;
switch(wine_frame->u.filter( &ptrs ))
{
case EXCEPTION_CONTINUE_SEARCH:
return ExceptionContinueSearch;
case EXCEPTION_CONTINUE_EXECUTION:
return ExceptionContinueExecution;
case EXCEPTION_EXECUTE_HANDLER:
break;
}
__wine_unwind_frame( record, frame );
}
static inline EXCEPTION_DISPOSITION
__wine_exception_handler_page_fault( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
if (record->ExceptionCode != STATUS_ACCESS_VIOLATION)
return ExceptionContinueSearch;
__wine_unwind_frame( record, frame );
}
static inline EXCEPTION_DISPOSITION
__wine_exception_handler_all( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
__wine_unwind_frame( record, frame );
}
static inline EXCEPTION_DISPOSITION
__wine_finally_handler( struct _EXCEPTION_RECORD *record, void *frame,
struct _CONTEXT *context, void *pdispatcher )
{
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
{
__WINE_FRAME *wine_frame = (__WINE_FRAME *)frame;
wine_frame->u.finally_func( FALSE );
}
return ExceptionContinueSearch;
}
#endif /* USE_COMPILER_EXCEPTIONS */
#ifdef __cplusplus
}
#endif
#endif /* __WINE_WINE_EXCEPTION_H */
#endif

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="libxml2" type="staticlibrary" allowwarnings="true" crt="dll">
<module name="libxml2" type="staticlibrary" allowwarnings="true" crt="dll" crt="msvcrt">
<define name="HAVE_CONFIG_H" />
<define name="WIN32" />
<define name="_WINDOWS" />

View file

@ -1185,7 +1185,7 @@ Module::GetDefaultModuleCRT () const
return "static";
case Win32DLL:
case Win32OCX:
return "msvcrt";
return "ntdll";
case NativeDLL:
case NativeCUI:
return "ntdll";