- define STATUS_* codes correctly in winnt.h and ntstatus.h

- fix code that incorrectly includes headers for status codes (changes to files shared with wine will be submitted to winehq)
- fix wine SEH macros and support code, these changes should enable us to port crypt32.dll (and maybe other libraries) without modifications

svn path=/trunk/; revision=19334
This commit is contained in:
Thomas Bluemel 2005-11-18 23:19:48 +00:00
parent 33830d0a76
commit edeb6b991c
31 changed files with 158 additions and 68 deletions

View file

@ -24,7 +24,6 @@
#include <setjmp.h>
#include <windef.h>
#include <excpt.h>
#include <wine/port.h>
/* The following definitions allow using exceptions in Wine and Winelib code
*
@ -65,8 +64,8 @@
typedef struct _EXCEPTION_REGISTRATION_RECORD
{
struct _EXCEPTION_REGISTRATION_RECORD *prev;
PEXCEPTION_HANDLER handler;
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.
@ -101,7 +100,7 @@ typedef struct _EXCEPTION_REGISTRATION_RECORD
__f.frame.Handler = __wine_exception_handler; \
__f.u.filter = (func); \
__wine_push_frame( &__f.frame ); \
if (sigsetjmp( __f.jmp, 1 )) { \
if (setjmp( __f.jmp )) { \
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
do {
@ -130,8 +129,8 @@ typedef struct _EXCEPTION_REGISTRATION_RECORD
typedef DWORD (CALLBACK *__WINE_FILTER)(PEXCEPTION_POINTERS);
typedef void (CALLBACK *__WINE_FINALLY)(BOOL);
#define WINE_EXCEPTION_FILTER(func) DWORD WINAPI func( EXCEPTION_POINTERS *__eptr )
#define WINE_FINALLY_FUNC(func) void WINAPI func( BOOL __normal )
#define WINE_EXCEPTION_FILTER(func) DWORD CALLBACK func( PEXCEPTION_POINTERS __eptr )
#define WINE_FINALLY_FUNC(func) void CALLBACK func( BOOL __normal )
#define GetExceptionInformation() (__eptr)
#define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode)
@ -149,17 +148,12 @@ typedef struct __tagWINE_FRAME
/* finally data */
__WINE_FINALLY finally_func;
} u;
sigjmp_buf jmp;
jmp_buf jmp;
/* hack to make GetExceptionCode() work in handler */
DWORD ExceptionCode;
const struct __tagWINE_FRAME *ExceptionRecord;
} __WINE_FRAME;
extern DWORD __wine_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_REGISTRATION_RECORD *frame,
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **pdispatcher );
extern DWORD __wine_finally_handler( PEXCEPTION_RECORD record, EXCEPTION_REGISTRATION_RECORD *frame,
CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **pdispatcher );
#endif /* USE_COMPILER_EXCEPTIONS */
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
@ -183,8 +177,8 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTR
{
#if defined(__GNUC__) && defined(__i386__)
__asm__ __volatile__(".byte 0x64\n\tmovl %0,(0)"
: : "r" (frame->prev) : "memory" );
return frame->prev;
: : "r" (frame->Prev) : "memory" );
return frame->Prev;
#else
NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
@ -193,6 +187,59 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTR
#endif
}
#ifndef USE_COMPILER_EXCEPTIONS
extern VOID NTAPI RtlUnwind(PVOID,PVOID,PEXCEPTION_RECORD,PVOID);
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;
if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL))
return ExceptionContinueSearch;
if (wine_frame->u.filter)
{
EXCEPTION_POINTERS ptrs;
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;
default:
break;
}
}
/* hack to make GetExceptionCode() work in handler */
wine_frame->ExceptionCode = record->ExceptionCode;
wine_frame->ExceptionRecord = wine_frame;
RtlUnwind( frame, 0, record, 0 );
__wine_pop_frame( frame );
longjmp( wine_frame->jmp, 1 );
}
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 */
/* Wine-specific exceptions codes */

View file

@ -1,6 +1,9 @@
#define CRT_SECURE_NO_DEPRECATE
#define WIN32_NO_STATUS
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#if !defined(_MSC_VER)
#include <stdint.h>

View file

@ -26,9 +26,6 @@
#include <malloc.h>
/* fixme: should have this in common header */
#define ROUND_UP(a,b) ((a + (b-1)) & ~(b-1))
/* round to 16 bytes + alloc at minimum 16 bytes */
#define ROUND_SIZE(size) (max(16, ROUND_UP(size, 16)))

View file

@ -303,7 +303,7 @@ __inline static void *call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_fra
/* setup an exception block for nested exceptions */
//nested_frame.frame.Handler = catch_function_nested_handler;
nested_frame.frame.handler = (PEXCEPTION_HANDLER)catch_function_nested_handler;
nested_frame.frame.Handler = (PEXCEPTION_HANDLER)catch_function_nested_handler;
nested_frame.prev_rec = thread_data->exc_record;
nested_frame.cxx_frame = frame;
nested_frame.descr = descr;

View file

@ -35,8 +35,6 @@
*/
#include "precomp.h"
#define WIN32_NO_STATUS
#include <stdarg.h>
#include <wchar.h>
#include <stdio.h>
@ -44,12 +42,6 @@
#include <ctype.h>
#include <internal/file.h>
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/umtypes.h>
#include <ndk/extypes.h>
#include <ndk/rtlfuncs.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WIN32_NO_STATUS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"

View file

@ -29,7 +29,6 @@
#include "dbghelp_private.h"
#include "winreg.h"
#include "ntstatus.h"
#include "thread.h" /* FIXME: must be included before winternl.h */
#include "wine/debug.h"
#include "stackframe.h"

View file

@ -22,7 +22,6 @@
#define __WINE_STACKFRAME_H
#include <string.h>
#include <winnt.h>
#define NTOS_MODE_USER
#include <ndk/umtypes.h>
#include <ndk/extypes.h>

View file

@ -22,6 +22,7 @@
#define __WINE_THREAD_H
#include <stdarg.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winreg.h>

View file

@ -27,7 +27,6 @@
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "ntstatus.h"
#include "dplayx_messages.h"
#include "dplay_global.h"

View file

@ -21,6 +21,7 @@
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x500
#define WIN32_NO_STATUS
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>

View file

@ -23,6 +23,8 @@
#include <stdarg.h>
#include <stdlib.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winsock2.h"
@ -33,9 +35,8 @@
#include "lmwksta.h"
#include "iphlpapi.h"
#include "winerror.h"
#include "ntstatus.h"
#include "winreg.h"
#include "ntsecapi.h"
#include "winreg.h"
#include "netbios.h"
#include "wine/debug.h"

View file

@ -34,7 +34,6 @@
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "ntstatus.h"
#include "rpc.h"
#include "rpcndr.h"

View file

@ -23,7 +23,6 @@
#include "windef.h"
#include "winbase.h"
#include "ntstatus.h"
#include "wine/rpcss_shared.h"
#include "wine/debug.h"

View file

@ -19,6 +19,7 @@
/* INCLUDES *****************************************************************/
#define WIN32_NO_STATUS
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>

View file

@ -9,7 +9,7 @@
*/
/* INCLUDES ******************************************************************/
#include "precomp.h"
#include <precomp.h>
/* GLOBALS *******************************************************************/

View file

@ -10,7 +10,7 @@
/* INCLUDES ******************************************************************/
#include "precomp.h"
#include <precomp.h>
/* GLOBALS *******************************************************************/

View file

@ -16,3 +16,6 @@
#include <lsass/lsass.h>
#include <ntsecapi.h>
#include <secext.h>
#include <security.h>
#include <sspi.h>

View file

@ -1,14 +1,8 @@
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include <lsass/lsass.h>
#include <precomp.h>
#define NDEBUG
#include <debug.h>
#include <ntsecapi.h>
#include <secext.h>
BOOLEAN
WINAPI

View file

@ -1,16 +1,8 @@
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include <lsass/lsass.h>
#include <precomp.h>
#define NDEBUG
#include <debug.h>
#include <ntsecapi.h>
#include <security.h>
#include <sspi.h>
SECURITY_STATUS
WINAPI

View file

@ -1041,6 +1041,10 @@ static BOOL GetIntField( HINF hinf, PCWSTR section_name, PCWSTR key_name, INT *v
*/
BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname, DWORD flags, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PVOID reserved1, PVOID reserved2 )
{
SC_HANDLE hSCManager = NULL;
SC_HANDLE hService = NULL;
LPDWORD GroupOrder = NULL;
LPQUERY_SERVICE_CONFIG ServiceConfig = NULL;
struct DeviceInfoSet *list;
BOOL ret = FALSE;
@ -1065,16 +1069,12 @@ BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname
}
else
{
SC_HANDLE hSCManager = NULL;
SC_HANDLE hService = NULL;
HKEY hGroupOrderListKey = INVALID_HANDLE_VALUE;
LPQUERY_SERVICE_CONFIG ServiceConfig = NULL;
LPWSTR ServiceBinary = NULL;
LPWSTR LoadOrderGroup = NULL;
LPWSTR DisplayName = NULL;
LPWSTR Description = NULL;
LPWSTR Dependencies = NULL;
LPDWORD GroupOrder = NULL;
INT ServiceType, StartType, ErrorControl;
DWORD dwRegType;
DWORD tagId = (DWORD)-1;

View file

@ -24,6 +24,7 @@
#include <fcntl.h>
#include <share.h>
#define WIN32_NO_STATUS
#include <windows.h>
#include <cfgmgr32.h>
#include <fdi.h>

View file

@ -16,6 +16,7 @@
#define _USER32_
#define OEMRESOURCE
#define NTOS_MODE_USER
#define WIN32_NO_STATUS
#include <windows.h>
#include <windowsx.h>
#include <winnls32.h>

View file

@ -25,8 +25,9 @@
#include <stdio.h>
#include <stdarg.h>
#include "windows.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windows.h"
#include "wine/test.h"
#include "wine/unicode.h"
#include "winternl.h"

View file

@ -7,9 +7,9 @@
* PROGRAMMER: arty
*/
#include "rosdhcp.h"
#include <winsock2.h>
#include <iphlpapi.h>
#include "rosdhcp.h"
static CRITICAL_SECTION ApiCriticalSection;

View file

@ -53,8 +53,8 @@
* purpose.
*/
#include <winsock2.h>
#include "rosdhcp.h"
#include <winsock2.h>
#include "dhcpd.h"
#include "privsep.h"

View file

@ -1,6 +1,7 @@
#ifndef ROSDHCP_H
#define ROSDHCP_H
#define WIN32_NO_STATUS
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>

View file

@ -33,6 +33,7 @@
#include <stddef.h>
/* PSDK/NDK */
#define WIN32_NO_STATUS
#include <windows.h>
#include <fmifs/fmifs.h>
#define NTOS_MODE_USER

View file

@ -34,7 +34,6 @@
}
#ifndef NT_SUCCESS
#define NT_SUCCESS(x) ((x)>=0)
#define STATUS_SUCCESS ((NTSTATUS)0)
#endif
#define NT_WARNING(x) ((ULONG)(x)>>30==2)
#define NT_ERROR(x) ((ULONG)(x)>>30==3)

View file

@ -18,16 +18,29 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_NTSTATUS_H
#define __WINE_NTSTATUS_H
#ifndef _NTSTATUS_
#define _NTSTATUS_
#ifndef WIN32_NO_STATUS
/*
* Debug codes
*/
#define DBG_PRINTEXCEPTION_C ((NTSTATUS)0x40010006L)
#define DBG_CONTROL_C ((NTSTATUS)0x40010005L)
#define DBG_CONTROL_BREAK ((NTSTATUS)0x40010008L)
#define DBG_EXCEPTION_HANDLED ((NTSTATUS)0x00010001)
#define DBG_CONTINUE ((NTSTATUS)0x00010002)
#define DBG_REPLY_LATER ((NTSTATUS)0x40010001)
#define DBG_UNABLE_TO_PROVIDE_HANDLE ((NTSTATUS)0x40010002)
#define DBG_TERMINATE_THREAD ((NTSTATUS)0x40010003)
#define DBG_TERMINATE_PROCESS ((NTSTATUS)0x40010004)
#define DBG_CONTROL_C ((NTSTATUS)0x40010005)
#define DBG_PRINTEXCEPTION_C ((NTSTATUS)0x40010006)
#define DBG_RIPEXCEPTION ((NTSTATUS)0x40010007)
#define DBG_CONTROL_BREAK ((NTSTATUS)0x40010008)
#define DBG_COMMAND_EXCEPTION ((NTSTATUS)0x40010009)
#define DBG_EXCEPTION_NOT_HANDLED ((NTSTATUS)0x80010001)
#define DBG_NO_STATE_CHANGE ((NTSTATUS)0xC0010001)
#define DBG_APP_NOT_IDLE ((NTSTATUS)0xC0010002)
/*
* Exception codes
@ -1108,4 +1121,4 @@
#endif /* WIN32_NO_STATUS */
#endif /* __WINE_NTSTATUS_H */
#endif /* _NTSTATUS_ */

View file

@ -210,9 +210,54 @@ typedef DWORD FLONG;
#define SPECIFIC_RIGHTS_ALL 0xFFFF
#define ACCESS_SYSTEM_SECURITY 0x1000000
#ifndef WIN32_NO_STATUS
#define DBG_CONTINUE ((DWORD)0x00010002L)
#endif
#ifndef WIN32_NO_STATUS
#define STATUS_WAIT_0 ((DWORD)0x00000000)
#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080)
#define STATUS_USER_APC ((DWORD)0x000000C0)
#define STATUS_TIMEOUT ((DWORD)0x00000102)
#define STATUS_PENDING ((DWORD)0x00000103)
#define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005)
#define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001)
#define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002)
#define STATUS_BREAKPOINT ((DWORD)0x80000003)
#define STATUS_SINGLE_STEP ((DWORD)0x80000004)
#define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005)
#define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006)
#define STATUS_INVALID_HANDLE ((DWORD)0xC0000008)
#define STATUS_NO_MEMORY ((DWORD)0xC0000017)
#define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001D)
#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025)
#define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026)
#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008C)
#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008D)
#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008E)
#define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008F)
#define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090)
#define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091)
#define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092)
#define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093)
#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094)
#define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095)
#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096)
#define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FD)
#define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013A)
#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4)
#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5)
#define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9)
#define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000F)
#define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010)
#define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001)
#define DBG_CONTINUE ((DWORD)0x00010002)
#define DBG_TERMINATE_THREAD ((DWORD)0x40010003)
#define DBG_TERMINATE_PROCESS ((DWORD)0x40010004)
#define DBG_CONTROL_C ((DWORD)0x40010005)
#define DBG_CONTROL_BREAK ((DWORD)0x40010008)
#define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009)
#define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001)
#endif /* WIN32_NO_STATUS */
#define MAXIMUM_ALLOWED 0x2000000
#define GENERIC_READ 0x80000000