ReactOS 0.4.17-dev-116-ga4b6fe9
exception.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <setjmp.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "winreg.h"
#include "winuser.h"
#include "winternl.h"
#include "rtlsupportapi.h"
#include "ddk/wdm.h"
#include "excpt.h"
#include "wine/test.h"
#include "intrin.h"
Include dependency graph for exception.c:

Go to the source code of this file.

Classes

struct  _RTL_UNLOAD_EVENT_TRACE
 
struct  context_exception_request_thread_param
 

Macros

#define WIN32_NO_STATUS
 
#define RTL_UNLOAD_EVENT_TRACE_NUMBER   64
 
#define TEST_SUSPEND_COUNT(thread, count)   test_suspend_count((thread), (count), __LINE__)
 
#define X(f)   p##f = (void*)GetProcAddress(hntdll, #f)
 
#define X(f)   p##f = (void*)GetProcAddress(hkernel32, #f)
 

Typedefs

typedef struct _RTL_UNLOAD_EVENT_TRACE RTL_UNLOAD_EVENT_TRACE
 
typedef struct _RTL_UNLOAD_EVENT_TRACEPRTL_UNLOAD_EVENT_TRACE
 

Enumerations

enum  debugger_stages {
  STAGE_RTLRAISE_NOT_HANDLED = 1 , STAGE_RTLRAISE_HANDLE_LAST_CHANCE , STAGE_OUTPUTDEBUGSTRINGA_CONTINUE , STAGE_OUTPUTDEBUGSTRINGA_NOT_HANDLED ,
  STAGE_OUTPUTDEBUGSTRINGW_CONTINUE , STAGE_OUTPUTDEBUGSTRINGW_NOT_HANDLED , STAGE_RIPEVENT_CONTINUE , STAGE_RIPEVENT_NOT_HANDLED ,
  STAGE_SERVICE_CONTINUE , STAGE_SERVICE_NOT_HANDLED , STAGE_BREAKPOINT_CONTINUE , STAGE_BREAKPOINT_NOT_HANDLED ,
  STAGE_EXCEPTION_INVHANDLE_CONTINUE , STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED , STAGE_NO_EXCEPTION_INVHANDLE_NOT_HANDLED , STAGE_XSTATE ,
  STAGE_XSTATE_LEGACY_SSE , STAGE_SEGMENTS
}
 

Functions

static NTSTATUS (WINAPI *pNtGetContextThread)(HANDLE
 
static PVOID (WINAPI *pRtlUnwind)(PVOID
 
static VOID (WINAPI *pRtlCaptureContext)(CONTEXT *)
 
static ULONG (WINAPI *pRtlRemoveVectoredExceptionHandler)(PVOID handler)
 
static void (WINAPI *pRtlSetUnhandledExceptionFilter)(PRTL_EXCEPTION_FILTER filter)
 
static ULONG64 (WINAPI *pRtlGetEnabledExtendedFeatures)(ULONG64)
 
static void *WINAPIpRtlLocateExtendedFeature (CONTEXT_EX *context_ex, ULONG feature_id, ULONG *length)
 
static void *WINAPIpRtlLocateLegacyContext (CONTEXT_EX *context_ex, ULONG *length)
 
static void *WINAPIpRtlPcToFileHeader (PVOID pc, PVOID *address)
 
static BOOL (WINAPI *pIsWow64Process)(HANDLE
 
static void *WINAPIpLocateXStateFeature (CONTEXT *context, DWORD feature_id, DWORD *length)
 
static VOID EXCEPTION_RECORD VOID CONTEXT UNWIND_HISTORY_TABLE *static BOOLEAN (CDECL *pRtlAddFunctionTable)(RUNTIME_FUNCTION *
 
static VOID (CDECL *pRtlRestoreContext)(CONTEXT *
 
static RTL_UNLOAD_EVENT_TRACE *WINAPIpRtlGetUnloadEventTrace (void)
 
static void CALLBACK apc_func (ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3)
 
static LONG CALLBACK outputdebugstring_vectored_handler (EXCEPTION_POINTERS *ExceptionInfo)
 
static void test_outputdebugstring (BOOL unicode, DWORD numexc_ansi, BOOL todo_ansi, DWORD numexc_unicode_low, DWORD numexc_unicode_high)
 
static LONG CALLBACK outputdebugstring_new_model_vectored_handler (EXCEPTION_POINTERS *ExceptionInfo)
 
static void test_outputdebugstring_newmodel (void)
 
static LONG CALLBACK ripevent_vectored_handler (EXCEPTION_POINTERS *ExceptionInfo)
 
static void test_ripevent (DWORD numexc)
 
static void subtest_fastfail (unsigned int code)
 
static void test_fastfail (void)
 
static LONG CALLBACK breakpoint_handler (EXCEPTION_POINTERS *ExceptionInfo)
 
static void test_breakpoint (DWORD numexc)
 
static LONG CALLBACK invalid_handle_vectored_handler (EXCEPTION_POINTERS *ExceptionInfo)
 
static BOOL is_magic_handle (HANDLE handle)
 
static void test_closehandle (DWORD numexc, HANDLE handle)
 
static void test_vectored_continue_handler (void)
 
static void test_user_apc (void)
 
static void test_user_callback (void)
 
static DWORD WINAPI suspend_thread_test (void *arg)
 
static void test_suspend_count (HANDLE hthread, ULONG expected_count, int line)
 
static void test_suspend_thread (void)
 
static DWORD WINAPI dummy_thread_proc (void *arg)
 
static void suspend_process_proc (void)
 
static void test_suspend_process (void)
 
static void test_unload_trace (void)
 
static void test_backtrace (void)
 
static LONG CALLBACK test_context_exception_request_handler (EXCEPTION_POINTERS *info)
 
static DWORD WINAPI test_context_exception_request_thread (void *arg)
 
static void test_context_exception_request (void)
 
 START_TEST (exception)
 

Variables

static voidcode_mem
 
static HMODULE hntdll
 
static BOOL is_arm64ec
 
static CONTEXT *static CONTEXT *static PNTAPCFUNC func
 
static CONTEXT *static CONTEXT *static PNTAPCFUNC ULONG_PTR arg1
 
static CONTEXT *static CONTEXT *static PNTAPCFUNC ULONG_PTR ULONG_PTR arg2
 
static CONTEXT *static CONTEXT *static PNTAPCFUNC ULONG_PTR ULONG_PTR ULONG_PTR arg3
 
static PVOID
 
static PEXCEPTION_RECORD
 
static ULONGlength
 
static ULONG ULONG64 compaction_mask
 
static ULONG context_flags
 
static ULONG CONTEXT_EX ** context_ex
 
static DWORD CONTEXTsrc
 
static ULONG64 feature_mask
 
static void **static CONTEXTcontext
 
static void **static CONTEXT BOOL first_chance
 
static const void void SIZE_T
 
static const void void SIZE_T *static LONG exit_code
 
static THREADINFOCLASS
 
static ULONG
 
static PULONG
 
static PROCESSINFOCLASS
 
static PBOOL
 
static DWORD
 
static VOID EXCEPTION_RECORD VOID CONTEXT UNWIND_HISTORY_TABLE *static DWORD64
 
static EXCEPTION_RECORD *static void ULONG *static voidpKiUserApcDispatcher
 
static voidpKiUserCallbackDispatcher
 
static voidpKiUserExceptionDispatcher
 
static ULONG ** element_count
 
static ULONG void ** event_trace
 
static int my_argc
 
static char ** my_argv
 
static BOOL is_wow64
 
static BOOL old_wow64
 
static UINT apc_count
 
static BOOL have_vectored_api
 
static enum debugger_stages test_stage
 
static DWORD outputdebugstring_exceptions_ansi
 
static DWORD outputdebugstring_exceptions_unicode
 
static DWORD outputdebugstring_exceptions_newmodel_order
 
static DWORD outputdebugstring_newmodel_return
 
static DWORD ripevent_exceptions
 
static DWORD breakpoint_exceptions
 
static DWORD invalid_handle_exceptions
 
static const charsuspend_process_event_name = "suspend_process_event"
 
static const charsuspend_process_event2_name = "suspend_process_event2"
 
static volatile intp_context_exception_request_value
 
struct context_exception_request_thread_paramcontext_exception_request_param
 

Macro Definition Documentation

◆ RTL_UNLOAD_EVENT_TRACE_NUMBER

#define RTL_UNLOAD_EVENT_TRACE_NUMBER   64

Definition at line 111 of file exception.c.

◆ TEST_SUSPEND_COUNT

#define TEST_SUSPEND_COUNT (   thread,
  count 
)    test_suspend_count((thread), (count), __LINE__)

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 26 of file exception.c.

◆ X [1/2]

#define X (   f)    p##f = (void*)GetProcAddress(hntdll, #f)

◆ X [2/2]

#define X (   f)    p##f = (void*)GetProcAddress(hkernel32, #f)

Typedef Documentation

◆ PRTL_UNLOAD_EVENT_TRACE

◆ RTL_UNLOAD_EVENT_TRACE

Enumeration Type Documentation

◆ debugger_stages

Enumerator
STAGE_RTLRAISE_NOT_HANDLED 
STAGE_RTLRAISE_HANDLE_LAST_CHANCE 
STAGE_OUTPUTDEBUGSTRINGA_CONTINUE 
STAGE_OUTPUTDEBUGSTRINGA_NOT_HANDLED 
STAGE_OUTPUTDEBUGSTRINGW_CONTINUE 
STAGE_OUTPUTDEBUGSTRINGW_NOT_HANDLED 
STAGE_RIPEVENT_CONTINUE 
STAGE_RIPEVENT_NOT_HANDLED 
STAGE_SERVICE_CONTINUE 
STAGE_SERVICE_NOT_HANDLED 
STAGE_BREAKPOINT_CONTINUE 
STAGE_BREAKPOINT_NOT_HANDLED 
STAGE_EXCEPTION_INVHANDLE_CONTINUE 
STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED 
STAGE_NO_EXCEPTION_INVHANDLE_NOT_HANDLED 
STAGE_XSTATE 
STAGE_XSTATE_LEGACY_SSE 
STAGE_SEGMENTS 

Definition at line 164 of file exception.c.

165{
184};
@ STAGE_SERVICE_NOT_HANDLED
Definition: exception.c:175
@ STAGE_OUTPUTDEBUGSTRINGA_CONTINUE
Definition: exception.c:168
@ STAGE_OUTPUTDEBUGSTRINGW_CONTINUE
Definition: exception.c:170
@ STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED
Definition: exception.c:179
@ STAGE_RTLRAISE_NOT_HANDLED
Definition: exception.c:166
@ STAGE_SEGMENTS
Definition: exception.c:183
@ STAGE_NO_EXCEPTION_INVHANDLE_NOT_HANDLED
Definition: exception.c:180
@ STAGE_BREAKPOINT_CONTINUE
Definition: exception.c:176
@ STAGE_RTLRAISE_HANDLE_LAST_CHANCE
Definition: exception.c:167
@ STAGE_EXCEPTION_INVHANDLE_CONTINUE
Definition: exception.c:178
@ STAGE_XSTATE
Definition: exception.c:181
@ STAGE_BREAKPOINT_NOT_HANDLED
Definition: exception.c:177
@ STAGE_XSTATE_LEGACY_SSE
Definition: exception.c:182
@ STAGE_RIPEVENT_CONTINUE
Definition: exception.c:172
@ STAGE_SERVICE_CONTINUE
Definition: exception.c:174
@ STAGE_RIPEVENT_NOT_HANDLED
Definition: exception.c:173
@ STAGE_OUTPUTDEBUGSTRINGA_NOT_HANDLED
Definition: exception.c:169
@ STAGE_OUTPUTDEBUGSTRINGW_NOT_HANDLED
Definition: exception.c:171

Function Documentation

◆ apc_func()

static void CALLBACK apc_func ( ULONG_PTR  arg1,
ULONG_PTR  arg2,
ULONG_PTR  arg3 
)
static

Definition at line 194 of file exception.c.

195{
196 ok( arg1 == 0x1234 + apc_count, "wrong arg1 %Ix\n", arg1 );
197 ok( arg2 == 0x5678, "wrong arg2 %Ix\n", arg2 );
198 ok( arg3 == 0xdeadbeef, "wrong arg3 %Ix\n", arg3 );
199 apc_count++;
200}
#define ok(value,...)
Definition: atltest.h:57
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
Definition: glext.h:9515
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
static UINT apc_count
Definition: exception.c:190

Referenced by test_user_apc().

◆ BOOL()

static BOOL ( WINAPI pIsWow64Process)
static

◆ BOOLEAN()

static VOID EXCEPTION_RECORD VOID CONTEXT UNWIND_HISTORY_TABLE *static BOOLEAN ( CDECL pRtlAddFunctionTable)
static

◆ breakpoint_handler()

static LONG CALLBACK breakpoint_handler ( EXCEPTION_POINTERS ExceptionInfo)
static

Definition at line 9150 of file exception.c.

9151{
9152 EXCEPTION_RECORD *rec = ExceptionInfo->ExceptionRecord;
9153
9154 ok(rec->ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode is %08lx instead of %08lx\n",
9156
9157#ifdef __i386__
9158 ok(ExceptionInfo->ContextRecord->Eip == (DWORD)code_mem + 1,
9159 "expected Eip = %lx, got %lx\n", (DWORD)code_mem + 1, ExceptionInfo->ContextRecord->Eip);
9160 ok(rec->NumberParameters == (is_wow64 ? 1 : 3),
9161 "ExceptionParameters is %ld instead of %d\n", rec->NumberParameters, is_wow64 ? 1 : 3);
9162 ok(rec->ExceptionInformation[0] == 0,
9163 "got ExceptionInformation[0] = %Ix\n", rec->ExceptionInformation[0]);
9164 ExceptionInfo->ContextRecord->Eip = (DWORD)code_mem + 2;
9165#elif defined(__x86_64__)
9166 ok(ExceptionInfo->ContextRecord->Rip == (DWORD_PTR)code_mem + 1,
9167 "expected Rip = %Ix, got %Ix\n", (DWORD_PTR)code_mem + 1, ExceptionInfo->ContextRecord->Rip);
9168 ok(rec->NumberParameters == 1,
9169 "ExceptionParameters is %ld instead of 1\n", rec->NumberParameters);
9170 ok(rec->ExceptionInformation[0] == 0,
9171 "got ExceptionInformation[0] = %Ix\n", rec->ExceptionInformation[0]);
9172 ExceptionInfo->ContextRecord->Rip = (DWORD_PTR)code_mem + 2;
9173#elif defined(__arm__)
9174 ok(ExceptionInfo->ContextRecord->Pc == (DWORD)code_mem + 1,
9175 "expected pc = %lx, got %lx\n", (DWORD)code_mem + 1, ExceptionInfo->ContextRecord->Pc);
9176 ok(rec->NumberParameters == 1,
9177 "ExceptionParameters is %ld instead of 1\n", rec->NumberParameters);
9178 ok(rec->ExceptionInformation[0] == 0,
9179 "got ExceptionInformation[0] = %Ix\n", rec->ExceptionInformation[0]);
9180 ExceptionInfo->ContextRecord->Pc += 2;
9181#elif defined(__aarch64__)
9182 ok(ExceptionInfo->ContextRecord->Pc == (DWORD_PTR)code_mem,
9183 "expected pc = %p, got %p\n", code_mem, (void *)ExceptionInfo->ContextRecord->Pc);
9184 ok(rec->NumberParameters == 1,
9185 "ExceptionParameters is %ld instead of 1\n", rec->NumberParameters);
9186 ok(rec->ExceptionInformation[0] == 0,
9187 "got ExceptionInformation[0] = %p\n", (void *)rec->ExceptionInformation[0]);
9188 ExceptionInfo->ContextRecord->Pc += 4;
9189#endif
9190
9193}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:91
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:92
#define EXCEPTION_BREAKPOINT
Definition: minwinbase.h:46
static void * code_mem
Definition: exception.c:51
static BOOL is_wow64
Definition: exception.c:188
static DWORD
Definition: exception.c:98
static DWORD breakpoint_exceptions
Definition: exception.c:9148
ULONG Eip
Definition: nt_native.h:1479
ULONG Pc
Definition: ke.h:271
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
PCONTEXT ContextRecord
Definition: rtltypes.h:201
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by test_breakpoint().

◆ dummy_thread_proc()

static DWORD WINAPI dummy_thread_proc ( void arg)
static

Definition at line 9614 of file exception.c.

9615{
9616 return 0;
9617}

Referenced by suspend_process_proc().

◆ invalid_handle_vectored_handler()

static LONG CALLBACK invalid_handle_vectored_handler ( EXCEPTION_POINTERS ExceptionInfo)
static

Definition at line 9319 of file exception.c.

9320{
9321 PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
9322
9323 ok(rec->ExceptionCode == EXCEPTION_INVALID_HANDLE, "ExceptionCode is %08lx instead of %08lx\n",
9325 ok(rec->NumberParameters == 0, "ExceptionParameters is %ld instead of 0\n", rec->NumberParameters);
9326
9329}
#define EXCEPTION_INVALID_HANDLE
Definition: minwinbase.h:65
static DWORD invalid_handle_exceptions
Definition: exception.c:9317

Referenced by test_closehandle().

◆ is_magic_handle()

static BOOL is_magic_handle ( HANDLE  handle)
inlinestatic

Definition at line 9331 of file exception.c.

9332{
9333 return HandleToLong(handle) >= ~5 && HandleToLong(handle) <= ~0;
9334}
#define HandleToLong(h)
Definition: basetsd.h:74

Referenced by test_closehandle().

◆ NTSTATUS()

static NTSTATUS ( WINAPI pNtGetContextThread)
static

◆ outputdebugstring_new_model_vectored_handler()

static LONG CALLBACK outputdebugstring_new_model_vectored_handler ( EXCEPTION_POINTERS ExceptionInfo)
static

Definition at line 8932 of file exception.c.

8933{
8934 PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
8935
8936 switch (rec->ExceptionCode)
8937 {
8939 ok(rec->NumberParameters == 2, "ExceptionParameters is %ld instead of 2\n", rec->NumberParameters);
8940 ok(rec->ExceptionInformation[0] == 12, "ExceptionInformation[0] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[0]);
8941 ok(!strcmp((char *)rec->ExceptionInformation[1], "Hello World"),
8942 "ExceptionInformation[1] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[1]);
8945 break;
8947 ok(rec->NumberParameters == 4, "ExceptionParameters is %ld instead of 4\n", rec->NumberParameters);
8948 ok(rec->ExceptionInformation[0] == 12, "ExceptionInformation[0] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[0]);
8949 ok(!wcscmp((WCHAR *)rec->ExceptionInformation[1], L"Hello World"),
8950 "ExceptionInformation[1] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[1]);
8951 ok(rec->ExceptionInformation[2] == 12, "ExceptionInformation[2] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[2]);
8952 ok(!strcmp((char *)rec->ExceptionInformation[3], "Hello World"),
8953 "ExceptionInformation[3] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[3]);
8956 break;
8957 default:
8958 ok(0, "ExceptionCode is %08lx unexpected\n", rec->ExceptionCode);
8959 break;
8960 }
8961
8963}
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
#define L(x)
Definition: resources.c:13
static DWORD outputdebugstring_newmodel_return
Definition: exception.c:8930
static DWORD outputdebugstring_exceptions_newmodel_order
Definition: exception.c:8929
#define DBG_PRINTEXCEPTION_WIDE_C
Definition: ntstatus.h:108
#define DBG_PRINTEXCEPTION_C
Definition: ntstatus.h:104
short WCHAR
Definition: pedump.c:58

Referenced by test_outputdebugstring_newmodel().

◆ outputdebugstring_vectored_handler()

static LONG CALLBACK outputdebugstring_vectored_handler ( EXCEPTION_POINTERS ExceptionInfo)
static

Definition at line 8864 of file exception.c.

8865{
8866 PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
8867
8868 switch (rec->ExceptionCode)
8869 {
8871 ok(rec->NumberParameters == 2, "ExceptionParameters is %ld instead of 2\n", rec->NumberParameters);
8872 ok(rec->ExceptionInformation[0] == 12, "ExceptionInformation[0] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[0]);
8873 ok(!strcmp((char *)rec->ExceptionInformation[1], "Hello World"),
8874 "ExceptionInformation[1] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[1]);
8876 break;
8878 ok(outputdebugstring_exceptions_ansi == 0, "Unicode exception should come first\n");
8879 ok(rec->NumberParameters == 4, "ExceptionParameters is %ld instead of 4\n", rec->NumberParameters);
8880 ok(rec->ExceptionInformation[0] == 12, "ExceptionInformation[0] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[0]);
8881 ok(!wcscmp((WCHAR *)rec->ExceptionInformation[1], L"Hello World"),
8882 "ExceptionInformation[1] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[1]);
8883 ok(rec->ExceptionInformation[2] == 12, "ExceptionInformation[2] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[2]);
8884 ok(!strcmp((char *)rec->ExceptionInformation[3], "Hello World"),
8885 "ExceptionInformation[3] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[3]);
8887 break;
8888 default:
8889 ok(0, "ExceptionCode is %08lx unexpected\n", rec->ExceptionCode);
8890 break;
8891 }
8892
8894}
static DWORD outputdebugstring_exceptions_unicode
Definition: exception.c:8862
static DWORD outputdebugstring_exceptions_ansi
Definition: exception.c:8861

Referenced by test_outputdebugstring().

◆ pLocateXStateFeature()

static void *WINAPI * pLocateXStateFeature ( CONTEXT context,
DWORD  feature_id,
DWORD length 
)
static

◆ pRtlGetUnloadEventTrace()

static RTL_UNLOAD_EVENT_TRACE *WINAPI * pRtlGetUnloadEventTrace ( void  )
static

Referenced by test_unload_trace().

◆ pRtlLocateExtendedFeature()

static void *WINAPI * pRtlLocateExtendedFeature ( CONTEXT_EX context_ex,
ULONG  feature_id,
ULONG length 
)
static

◆ pRtlLocateLegacyContext()

static void *WINAPI * pRtlLocateLegacyContext ( CONTEXT_EX context_ex,
ULONG length 
)
static

◆ pRtlPcToFileHeader()

static void *WINAPI * pRtlPcToFileHeader ( PVOID  pc,
PVOID address 
)
static

◆ PVOID()

static PVOID ( WINAPI pRtlUnwind)
static

◆ ripevent_vectored_handler()

static LONG CALLBACK ripevent_vectored_handler ( EXCEPTION_POINTERS ExceptionInfo)
static

Definition at line 9015 of file exception.c.

9016{
9017 PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
9018
9019 ok(rec->ExceptionCode == DBG_RIPEXCEPTION, "ExceptionCode is %08lx instead of %08lx\n",
9021 ok(rec->NumberParameters == 2, "ExceptionParameters is %ld instead of 2\n", rec->NumberParameters);
9022 ok(rec->ExceptionInformation[0] == 0x11223344, "ExceptionInformation[0] = %08lx instead of %08x\n",
9023 (NTSTATUS)rec->ExceptionInformation[0], 0x11223344);
9024 ok(rec->ExceptionInformation[1] == 0x55667788, "ExceptionInformation[1] = %08lx instead of %08x\n",
9025 (NTSTATUS)rec->ExceptionInformation[1], 0x55667788);
9026
9029}
LONG NTSTATUS
Definition: precomp.h:26
static DWORD ripevent_exceptions
Definition: exception.c:9013
#define DBG_RIPEXCEPTION
Definition: ntstatus.h:105

Referenced by test_ripevent().

◆ START_TEST()

START_TEST ( exception  )

Definition at line 11947 of file exception.c.

11948{
11949 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
11950 hntdll = GetModuleHandleA("ntdll.dll");
11951
11953
11954 if (my_argc >= 3 && !strcmp(my_argv[2], "suspend_process"))
11955 {
11957 return;
11958 }
11959
11961 if(!code_mem) {
11962 trace("VirtualAlloc failed\n");
11963 return;
11964 }
11965
11966#define X(f) p##f = (void*)GetProcAddress(hntdll, #f)
11970 X(NtContinueEx);
11972 X(NtClose);
11973 X(RtlUnwind);
11988 X(RtlGetUnloadEventTraceEx);
12002 X(KiUserApcDispatcher);
12005#ifndef __i386__
12007 X(RtlUnwindEx);
12011#endif
12012
12013#ifdef __x86_64__
12014 if (pRtlGetNativeSystemInformation)
12015 {
12017 ULONG len;
12018 if (!pRtlGetNativeSystemInformation( SystemCpuInformation, &info, sizeof(info), &len ))
12019 is_arm64ec = (info.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64);
12020 }
12021#endif
12022#undef X
12023
12024#define X(f) p##f = (void*)GetProcAddress(hkernel32, #f)
12026 if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
12027 if (is_wow64)
12028 {
12029 TEB64 *teb64 = ULongToPtr( NtCurrentTeb()->GdiBatchCount );
12030
12031 if (teb64)
12032 {
12033 PEB64 *peb64 = ULongToPtr(teb64->Peb);
12034 old_wow64 = !peb64->LdrData;
12035 }
12036 }
12037
12040 X(LocateXStateFeature);
12041 X(SetXStateFeaturesMask);
12044#undef X
12045
12046 if (pRtlAddVectoredExceptionHandler && pRtlRemoveVectoredExceptionHandler)
12048 else
12049 skip("RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found\n");
12050
12052 if (my_argc >= 4)
12053 {
12054 void *addr;
12055
12056 if (strcmp(my_argv[2], "fastfail") == 0)
12057 {
12058 __fastfail(strtoul(my_argv[3], NULL, 0));
12059 return;
12060 }
12061
12062 sscanf( my_argv[3], "%p", &addr );
12063
12064 if (addr != &test_stage)
12065 {
12066 skip( "child process not mapped at same address (%p/%p)\n", &test_stage, addr);
12067 return;
12068 }
12069
12070 /* child must be run under a debugger */
12072 {
12073 ok(FALSE, "child process not being debugged?\n");
12074 return;
12075 }
12076
12077 if (pRtlRaiseException)
12078 {
12080 run_rtlraiseexception_test(0x12345);
12081 run_rtlraiseexception_test(EXCEPTION_BREAKPOINT);
12082 run_rtlraiseexception_test(EXCEPTION_INVALID_HANDLE);
12084 run_rtlraiseexception_test(0x12345);
12085 run_rtlraiseexception_test(EXCEPTION_BREAKPOINT);
12086 run_rtlraiseexception_test(EXCEPTION_INVALID_HANDLE);
12087 }
12088 else skip( "RtlRaiseException not found\n" );
12089
12091
12094 test_outputdebugstring(FALSE, 2, TRUE, 0, 0); /* is 2 a Windows bug? */
12096 /* depending on value passed DebugContinue we can get the unicode exception or not */
12099 /* depending on value passed DebugContinue we can get the unicode exception or not */
12100 test_outputdebugstring(TRUE, 2, TRUE, 0, 1); /* is 2 a Windows bug? */
12102 test_ripevent(0);
12104 test_ripevent(1);
12106 test_debug_service(0);
12108 test_debug_service(1);
12110 test_breakpoint(0);
12112 test_breakpoint(1);
12114 test_closehandle(0, (HANDLE)0xdeadbeef);
12115 test_closehandle(0, (HANDLE)0x7fffffff);
12117 test_closehandle(1, (HANDLE)0xdeadbeef);
12120 test_closehandle(0, 0);
12125 test_closehandle(0, GetCurrentProcessToken());
12126 test_closehandle(0, GetCurrentThreadToken());
12127 test_closehandle(0, GetCurrentThreadEffectiveToken());
12128#if defined(__i386__) || defined(__x86_64__)
12130 test_debuggee_xstate();
12132 test_debuggee_xstate();
12134 test_debuggee_segments();
12135#endif
12136
12137 /* rest of tests only run in parent */
12138 return;
12139 }
12140
12141#ifdef __i386__
12142
12143 test_unwind();
12144 test_exceptions();
12145 test_debug_registers();
12146 test_debug_service(1);
12147 test_simd_exceptions();
12148 test_fpu_exceptions();
12149 test_dpe_exceptions();
12150 test_prot_fault();
12151 test_extended_context();
12152 test_copy_context();
12153 test_set_live_context();
12154 test_hwbpt_in_syscall();
12155 test_instrumentation_callback();
12156
12157#elif defined(__x86_64__)
12158
12159#define X(f) p##f = (void*)GetProcAddress(hntdll, #f)
12161 X(RtlWow64GetThreadContext);
12162 X(RtlWow64SetThreadContext);
12163 X(RtlWow64GetCpuAreaInfo);
12164#undef X
12165
12166 test_exceptions();
12167 test_debug_registers();
12168 test_debug_registers_wow64();
12169 test_debug_service(1);
12170 test_simd_exceptions();
12171 test_continue();
12172 test___C_specific_handler();
12173 test_restore_context();
12174 test_prot_fault();
12175 test_dpe_exceptions();
12176 test_wow64_context();
12177 test_nested_exception();
12178 test_collided_unwind();
12179 test_extended_context();
12180 test_copy_context();
12181 test_set_live_context();
12182 test_unwind_from_apc();
12183 test_syscall_clobbered_regs();
12184 test_raiseexception_regs();
12185 test_hwbpt_in_syscall();
12186 test_instrumentation_callback();
12187 test_direct_syscalls();
12188
12189#elif defined(__aarch64__)
12190
12191 test_continue();
12192 test_brk();
12193 test_nested_exception();
12194 test_collided_unwind();
12195 test_restore_context();
12196 test_mrs_currentel();
12197
12198#elif defined(__arm__)
12199
12200 test_nested_exception();
12201 test_collided_unwind();
12202 test_restore_context();
12203
12204#endif
12205
12206 test_KiUserExceptionDispatcher();
12207 test_KiUserApcDispatcher();
12208 test_KiUserCallbackDispatcher();
12209 test_rtlraiseexception();
12214 test_thread_context();
12216 if (pWaitForDebugEventEx)
12217 {
12220 }
12221 else
12222 skip("Unsupported new unicode debug string model\n");
12223
12224 test_ripevent(1);
12225 test_fastfail();
12226 test_breakpoint(1);
12227 test_closehandle(0, (HANDLE)0xdeadbeef);
12228 /* Call of Duty WWII writes to BeingDebugged then closes an invalid handle,
12229 * crashing the game if an exception is raised. */
12230 NtCurrentTeb()->Peb->BeingDebugged = 0x98;
12231 test_closehandle(0, (HANDLE)0xdeadbeef);
12232 NtCurrentTeb()->Peb->BeingDebugged = 0;
12233
12234 test_user_apc();
12243}
PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace(VOID)
Definition: trace.c:20
_CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext)
Definition: ehandler.c:15
#define RtlUnwind
Definition: longjmp.c:9
#define trace
Definition: atltest.h:70
#define skip(...)
Definition: atltest.h:64
#define ULongToPtr(ul)
Definition: basetsd.h:86
NTSTATUS WINAPI NtResumeProcess(HANDLE handle)
NTSTATUS WINAPI NtSuspendProcess(HANDLE handle)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
VOID NTAPI KiUserCallbackDispatcher(ULONG Index, PVOID Argument, ULONG ArgumentLength)
Definition: dispatch.c:78
VOID NTAPI KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord, PCONTEXT Context)
Definition: dispatch.c:26
PVOID NTAPI RtlPcToFileHeader(IN PVOID PcValue, PVOID *BaseOfImage)
Definition: libsupp.c:658
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
PPEB Peb
Definition: dllmain.c:27
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI InitializeContext2(void *buffer, DWORD context_flags, CONTEXT **context, DWORD *length, ULONG64 compaction_mask)
Definition: memory.c:1585
BOOL WINAPI InitializeContext(void *buffer, DWORD context_flags, CONTEXT **context, DWORD *length)
Definition: memory.c:1625
BOOL WINAPI DECLSPEC_HOTPATCH WaitForDebugEventEx(DEBUG_EVENT *event, DWORD timeout)
Definition: sync.c:460
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
Definition: string.c:1859
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
__fastfail(FAST_FAIL_INVALID_ARG)
#define NtCurrentTeb
static void test_debugger(const char *argv0)
Definition: debugger.c:1645
static HINSTANCE hkernel32
Definition: process.c:68
static HMODULE hntdll
Definition: exception.c:52
static char ** my_argv
Definition: exception.c:187
static void test_suspend_process(void)
Definition: exception.c:9656
static void test_unload_trace(void)
Definition: exception.c:9743
static BOOL have_vectored_api
Definition: exception.c:191
#define X(f)
static void suspend_process_proc(void)
Definition: exception.c:9619
static void test_outputdebugstring(BOOL unicode, DWORD numexc_ansi, BOOL todo_ansi, DWORD numexc_unicode_low, DWORD numexc_unicode_high)
Definition: exception.c:8896
static void test_backtrace(void)
Definition: exception.c:11590
static void test_closehandle(DWORD numexc, HANDLE handle)
Definition: exception.c:9336
static BOOL is_arm64ec
Definition: exception.c:53
static void test_context_exception_request(void)
Definition: exception.c:11758
static BOOL old_wow64
Definition: exception.c:189
static int my_argc
Definition: exception.c:186
static void test_ripevent(DWORD numexc)
Definition: exception.c:9031
static void test_fastfail(void)
Definition: exception.c:9124
static void test_vectored_continue_handler(void)
Definition: exception.c:9374
static void test_suspend_thread(void)
Definition: exception.c:9526
static void test_user_callback(void)
Definition: exception.c:9491
static void test_outputdebugstring_newmodel(void)
Definition: exception.c:8965
static enum debugger_stages test_stage
Definition: exception.c:192
static void test_user_apc(void)
Definition: exception.c:9411
static void test_breakpoint(DWORD numexc)
Definition: exception.c:9203
NTSYSAPI VOID NTAPI RtlCaptureContext(_Out_ PCONTEXT ContextRecord)
NTSYSAPI VOID NTAPI RtlRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord)
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define MEM_RESERVE
Definition: nt_native.h:1317
#define MEM_RELEASE
Definition: nt_native.h:1319
#define MEM_COMMIT
Definition: nt_native.h:1316
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1311
NTSTATUS NTAPI NtRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context, _In_ BOOLEAN FirstChance)
Definition: except.c:173
NTSTATUS NTAPI NtReadVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID Buffer, IN SIZE_T NumberOfBytesToRead, OUT PSIZE_T NumberOfBytesRead OPTIONAL)
Definition: virtual.c:2781
NTSTATUS NTAPI NtSetContextThread(IN HANDLE ThreadHandle, IN PCONTEXT ThreadContext)
Definition: debug.c:387
NTSTATUS NTAPI NtGetContextThread(IN HANDLE ThreadHandle, IN OUT PCONTEXT ThreadContext)
Definition: debug.c:350
NTSTATUS NTAPI NtQueryInformationThread(_In_ HANDLE ThreadHandle, _In_ THREADINFOCLASS ThreadInformationClass, _Out_writes_bytes_to_opt_(ThreadInformationLength, *ReturnLength) PVOID ThreadInformation, _In_ ULONG ThreadInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:2985
NTSTATUS NTAPI NtSetInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _In_reads_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength)
Definition: query.c:1390
NTSTATUS NTAPI NtQueueApcThread(IN HANDLE ThreadHandle, IN PKNORMAL_ROUTINE ApcRoutine, IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: state.c:600
#define DBG_CONTINUE
Definition: ntstatus.h:98
#define DBG_EXCEPTION_HANDLED
Definition: ntstatus.h:97
NTSYSAPI BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION *, ULONG, ULONG_PTR)
NTSYSAPI BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION *)
NTSYSAPI void WINAPI RtlGetCallersAddress(void **, void **)
NTSYSAPI void WINAPI RtlUnwindEx(void *, void *, EXCEPTION_RECORD *, void *, CONTEXT *, UNWIND_HISTORY_TABLE *)
NTSYSAPI void CDECL RtlRestoreContext(CONTEXT *, EXCEPTION_RECORD *)
int winetest_get_mainargs(char ***pargv)
ULONG64 LdrData
Definition: winternl.h:1047
BYTE BeingDebugged
Definition: btrfs_drv.h:1909
ULONG64 Peb
Definition: winternl.h:1254
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
_Must_inspect_result_ WINBASEAPI BOOL WINAPI GetXStateFeaturesMask(_In_ PCONTEXT context, _Out_ PDWORD64 feature_mask)
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1146
NTSYSAPI void WINAPI RtlSetUnhandledExceptionFilter(PRTL_EXCEPTION_FILTER)
NTSYSAPI ULONG WINAPI RtlRemoveVectoredExceptionHandler(PVOID)
NTSYSAPI NTSTATUS WINAPI RtlGetExtendedContextLength2(ULONG, ULONG *, ULONG64)
NTSYSAPI ULONG64 WINAPI RtlGetEnabledExtendedFeatures(ULONG64)
NTSYSAPI PVOID WINAPI RtlAddVectoredContinueHandler(ULONG, PVECTORED_EXCEPTION_HANDLER)
NTSYSAPI NTSTATUS WINAPI RtlInitializeExtendedContext2(void *, ULONG, CONTEXT_EX **, ULONG64)
NTSYSAPI NTSTATUS WINAPI RtlCopyExtendedContext(CONTEXT_EX *, ULONG, CONTEXT_EX *)
NTSYSAPI NTSTATUS WINAPI RtlGetNativeSystemInformation(SYSTEM_INFORMATION_CLASS, void *, ULONG, ULONG *)
NTSYSAPI void *WINAPI RtlLocateExtendedFeature(CONTEXT_EX *, ULONG, ULONG *)
NTSYSAPI NTSTATUS WINAPI RtlInitializeExtendedContext(void *, ULONG, CONTEXT_EX **)
NTSYSAPI PVOID WINAPI RtlAddVectoredExceptionHandler(ULONG, PVECTORED_EXCEPTION_HANDLER)
NTSYSAPI void WINAPI RtlSetExtendedFeaturesMask(CONTEXT_EX *, ULONG64)
NTSYSAPI void *WINAPI RtlLocateLegacyContext(CONTEXT_EX *, ULONG *)
NTSYSAPI ULONG64 WINAPI RtlGetExtendedFeaturesMask(CONTEXT_EX *)
NTSYSAPI NTSTATUS WINAPI NtContinueEx(CONTEXT *, KCONTINUE_ARGUMENT *)
NTSYSAPI NTSTATUS WINAPI RtlGetExtendedContextLength(ULONG, ULONG *)
@ SystemCpuInformation
Definition: winternl.h:2014
NTSYSAPI ULONG WINAPI RtlRemoveVectoredContinueHandler(PVOID)
NTSYSAPI NTSTATUS WINAPI RtlCopyContext(CONTEXT *, DWORD, CONTEXT *)
#define PROCESSOR_ARCHITECTURE_ARM64
Definition: winnt_old.h:503

◆ subtest_fastfail()

static void subtest_fastfail ( unsigned int  code)
static

Definition at line 9061 of file exception.c.

9062{
9063 char cmdline[MAX_PATH];
9065 STARTUPINFOA si = { 0 };
9066 DEBUG_EVENT de;
9067 DWORD continuestatus;
9068 BOOL ret;
9069 BOOL had_ff = FALSE, had_se = FALSE;
9070
9071 sprintf(cmdline, "%s %s %s %u", my_argv[0], my_argv[1], "fastfail", code);
9072 si.cb = sizeof(si);
9074 ok(ret, "could not create child process error: %lu\n", GetLastError());
9075 if (!ret)
9076 return;
9077
9078 do
9079 {
9080 continuestatus = DBG_CONTINUE;
9081 ok(WaitForDebugEvent(&de, INFINITE), "reading debug event\n");
9082
9084 {
9086 {
9087 ok(!de.u.Exception.dwFirstChance, "must be a second chance exception\n");
9089 "expected exactly one parameter, got %lu\n",
9093 "expected %u for code, got %Iu\n",
9095 had_ff = TRUE;
9096 }
9097
9098 if (de.u.Exception.dwFirstChance)
9099 {
9100 continuestatus = DBG_EXCEPTION_NOT_HANDLED;
9101 }
9102 else
9103 {
9104 had_se = TRUE;
9105 pNtTerminateProcess(pi.hProcess, 0);
9106 }
9107 }
9108
9109 ContinueDebugEvent(de.dwProcessId, de.dwThreadId, continuestatus);
9110
9112
9113 ok(had_ff || broken(had_se) /* Win7 */, "fast fail did not occur\n");
9114
9117 ok(ret, "error %lu\n", GetLastError());
9119 ok(ret, "error %lu\n", GetLastError());
9120
9121 return;
9122}
#define broken(x)
Definition: atltest.h:178
#define CloseHandle
Definition: compat.h:739
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
Definition: debugger.c:413
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
Definition: debugger.c:590
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
return ret
Definition: mutex.c:146
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXIT_PROCESS_DEBUG_EVENT
Definition: minwinbase.h:37
#define EXCEPTION_DEBUG_EVENT
Definition: minwinbase.h:33
#define sprintf
Definition: sprintf.c:45
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
#define DBG_EXCEPTION_NOT_HANDLED
Definition: ntstatus.h:109
#define STATUS_STACK_BUFFER_OVERRUN
Definition: ntstatus.h:1078
#define wait_child_process
Definition: test.h:159
TCHAR * cmdline
Definition: stretchblt.cpp:32
union _DEBUG_EVENT::@3289 u
DWORD dwDebugEventCode
Definition: minwinbase.h:196
DWORD dwThreadId
Definition: minwinbase.h:198
DWORD dwProcessId
Definition: minwinbase.h:197
EXCEPTION_DEBUG_INFO Exception
Definition: minwinbase.h:201
EXCEPTION_RECORD ExceptionRecord
Definition: minwinbase.h:152
Definition: inflate.c:139
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DEBUG_PROCESS
Definition: winbase.h:180

Referenced by test_fastfail().

◆ suspend_process_proc()

static void suspend_process_proc ( void  )
static

Definition at line 9619 of file exception.c.

9620{
9623 DWORD count;
9625 HANDLE thread;
9626
9627 ok(event != NULL, "Failed to open event handle.\n");
9628 ok(event2 != NULL, "Failed to open event handle.\n");
9629
9631 ok(thread != NULL, "Failed to create auxiliary thread.\n");
9632
9633 /* Suspend up to limit. */
9634 while (!(status = NtSuspendThread(thread, NULL)))
9635 ;
9636 ok(status == STATUS_SUSPEND_COUNT_EXCEEDED, "Unexpected status %#lx.\n", status);
9637
9638 for (;;)
9639 {
9640 SetEvent(event2);
9642 break;
9643 }
9644
9646 ok(!status, "Failed to suspend a thread, status %#lx.\n", status);
9647 ok(count == 125, "Unexpected suspend count %lu.\n", count);
9648
9650 ok(!status, "Failed to resume a thread, status %#lx.\n", status);
9651
9653 CloseHandle(event2);
9654}
static HANDLE thread
Definition: service.c:33
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct _cl_event * event
Definition: glext.h:7739
static const char * suspend_process_event2_name
Definition: exception.c:9612
static const char * suspend_process_event_name
Definition: exception.c:9611
static DWORD WINAPI dummy_thread_proc(void *arg)
Definition: exception.c:9614
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
NTSTATUS NTAPI NtSuspendThread(IN HANDLE ThreadHandle, OUT PULONG PreviousSuspendCount OPTIONAL)
Definition: state.c:352
#define STATUS_SUSPEND_COUNT_EXCEEDED
Definition: ntstatus.h:404
Definition: ps.c:97
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
Definition: synch.c:605
#define EVENT_MODIFY_STATE
Definition: winbase.h:165
#define CREATE_SUSPENDED
Definition: winbase.h:182
#define WAIT_OBJECT_0
Definition: winbase.h:383

◆ suspend_thread_test()

static DWORD WINAPI suspend_thread_test ( void arg)
static

Definition at line 9497 of file exception.c.

9498{
9499 HANDLE event = arg;
9501 return 0;
9502}
void * arg
Definition: msvc.h:10

Referenced by test_suspend_thread().

◆ test_backtrace()

static void test_backtrace ( void  )
static

Definition at line 11590 of file exception.c.

11591{
11592 void *buffer[1024];
11594 void *module;
11595 ULONG hash, hash_expect;
11596 int i, count = RtlCaptureStackBackTrace( 0, 1024, buffer, &hash );
11597
11598 ok( count > 0, "got %u entries\n", count );
11599 for (i = hash_expect = 0; i < count; i++) hash_expect += (ULONG_PTR)buffer[i];
11600 ok( hash == hash_expect, "hash mismatch %lx / %lx\n", hash, hash_expect );
11602 if (is_arm64ec && module == hntdll) /* Windows arm64ec has an extra frame for the entry thunk */
11603 {
11604 ok( count > 1, "wrong count %u\n", count );
11606 }
11608 ok( module == GetModuleHandleA(0), "wrong module %p %s / %p for %p\n",
11610
11611 if (pRtlGetCallersAddress)
11612 {
11613 void *caller, *parent;
11614
11615 caller = parent = (void *)0xdeadbeef;
11616 pRtlGetCallersAddress( &caller, &parent );
11617 ok( caller == (count > 1 ? buffer[1] : NULL) || broken(is_arm64ec), /* caller is entry thunk */
11618 "wrong caller %p / %p\n", caller, buffer[1] );
11619 ok( parent == (count > 2 ? buffer[2] : NULL), "wrong parent %p / %p\n", parent, buffer[2] );
11620 }
11621 else win_skip( "RtlGetCallersAddress not supported\n" );
11622
11623 if (count && !buffer[count - 1]) count--; /* win11 32-bit */
11624 if (count <= 1) return;
11627 ok( module == hntdll, "wrong module %p %s for frame %u %p\n",
11628 module, debugstr_w(name), count - 1, buffer[count - 1] );
11629}
#define ARRAY_SIZE(A)
Definition: main.h:20
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
r parent
Definition: btrfs.c:3010
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define win_skip
Definition: minitest.h:67
static void *WINAPI * pRtlPcToFileHeader(PVOID pc, PVOID *address)
NTSYSAPI USHORT WINAPI RtlCaptureStackBackTrace(ULONG, ULONG, void **, ULONG *)
Definition: _hash_fun.h:40
Definition: name.c:39

◆ test_breakpoint()

static void test_breakpoint ( DWORD  numexc)
static

Definition at line 9203 of file exception.c.

9204{
9206 void *vectored_handler;
9207
9208#if defined(__REACTOS__)
9209 if (is_reactos())
9210 {
9211 skip("Skipping tests that crash\n");
9212 return;
9213 }
9214#endif
9215
9216 memcpy(code_mem, breakpoint_code, sizeof(breakpoint_code));
9217#ifdef __arm__
9218 func = (void *)((char *)code_mem + 1); /* thumb */
9219#endif
9220 vectored_handler = pRtlAddVectoredExceptionHandler(TRUE, &breakpoint_handler);
9221 ok(vectored_handler != 0, "RtlAddVectoredExceptionHandler failed\n");
9222
9224 func();
9225 ok(breakpoint_exceptions == numexc, "int $0x3 generated %lu exceptions, expected %lu\n",
9226 breakpoint_exceptions, numexc);
9227
9228 pRtlRemoveVectoredExceptionHandler(vectored_handler);
9229}
#define CDECL
Definition: compat.h:29
GLenum func
Definition: glext.h:6028
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static CONTEXT *static CONTEXT *static PNTAPCFUNC func
Definition: exception.c:57
static LONG CALLBACK breakpoint_handler(EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:9150

◆ test_closehandle()

static void test_closehandle ( DWORD  numexc,
HANDLE  handle 
)
static

Definition at line 9336 of file exception.c.

9337{
9339 PVOID vectored_handler;
9340 BOOL ret, expectret;
9341
9342 if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler || !pRtlRaiseException)
9343 {
9344 skip("RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler or RtlRaiseException not found\n");
9345 return;
9346 }
9347
9348 vectored_handler = pRtlAddVectoredExceptionHandler(TRUE, &invalid_handle_vectored_handler);
9349 ok(vectored_handler != 0, "RtlAddVectoredExceptionHandler failed\n");
9350
9352 expectret = is_magic_handle(handle) || broken(numexc && sizeof(handle) == 4); /* < Win10 */
9355 "CloseHandle had wrong GetLastError(), got %lu for %p\n", GetLastError(), handle);
9356 ok(ret == expectret || broken(HandleToLong(handle) < 0) /* < Win10 */,
9357 "CloseHandle expected %d, got %d for %p\n", expectret, ret, handle);
9358 ok(invalid_handle_exceptions == numexc || broken(!numexc && is_magic_handle(handle)), /* < Win10 */
9359 "CloseHandle generated %ld exceptions, expected %ld for %p\n",
9361
9364 status = pNtClose(handle);
9365 ok(status == expect || broken(HandleToLong(handle) < 0), /* < Win10 */
9366 "NtClose returned unexpected status %#lx, expected %#lx for %p\n", status, expect, handle);
9367 ok(invalid_handle_exceptions == numexc || broken(!numexc && is_magic_handle(handle)), /* < Win10 */
9368 "CloseHandle generated %ld exceptions, expected %ld for %p\n",
9370
9371 pRtlRemoveVectoredExceptionHandler(vectored_handler);
9372}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static BOOL is_magic_handle(HANDLE handle)
Definition: exception.c:9331
static LONG CALLBACK invalid_handle_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:9319
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ test_context_exception_request()

static void test_context_exception_request ( void  )
static

Definition at line 11758 of file exception.c.

11759{
11761 DWORD expected_flags;
11762 HANDLE thread;
11763 CONTEXT c;
11764 BOOL ret;
11765
11766 if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler)
11767 {
11768 skip( "RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found.\n" );
11769 return;
11770 }
11771
11772 c.ContextFlags = CONTEXT_CONTROL;
11774 ok( ret, "got error %lu.\n", GetLastError() );
11775 ok( c.ContextFlags == CONTEXT_CONTROL, "got %#lx.\n", c.ContextFlags );
11776
11778
11781 ok( ret, "got error %lu.\n", GetLastError() );
11782 ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == 0x10001 ) /* Win7 WoW64 */,
11783 "got %#lx.\n", c.ContextFlags );
11784 if (c.ContextFlags == 0x10001)
11785 {
11786 win_skip( "Old WoW64 behaviour, skipping tests.\n" );
11787 return;
11788 }
11789
11791 ok( ret, "got error %lu.\n", GetLastError() );
11792 c.ContextFlags = expected_flags | CONTEXT_EXCEPTION_REQUEST;
11793
11796 ok( ret, "got error %lu.\n", GetLastError() );
11797 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11799
11803 ok( ret, "got error %lu.\n", GetLastError() );
11804 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11805
11806 p.event = CreateEventW( NULL, FALSE, FALSE, NULL );
11808 ok( !!thread, "got error %lu.\n", GetLastError() );
11809
11811
11814 ok( ret, "got error %lu.\n", GetLastError() );
11815 ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == (CONTEXT_CONTROL
11816 | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING)) /* Win7 64 */, "got %#lx.\n", c.ContextFlags );
11817
11818 p.sync = 0;
11820
11821 while (ReadAcquire( &p.sync ) != 1)
11823 /* thread is in user code. */
11825
11826 c.ContextFlags = CONTEXT_CONTROL;
11828 ok( ret, "got error %lu.\n", GetLastError() );
11829 ok( c.ContextFlags == CONTEXT_CONTROL, "got %#lx.\n", c.ContextFlags );
11830
11833 ok( ret, "got error %lu.\n", GetLastError() );
11834
11836
11839 ok( ret, "got error %lu.\n", GetLastError() );
11840 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11841
11845 ok( ret, "got error %lu.\n", GetLastError() );
11846 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11847
11849 WriteRelease( &p.sync, 2 );
11850 /* Try to make sure the thread entered WaitForSingleObject(). */
11851 Sleep(30);
11852
11854
11857 ok( ret, "got error %lu.\n", GetLastError() );
11858 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11859
11860 c.ContextFlags = CONTEXT_CONTROL;
11862 ok( ret, "got error %lu.\n", GetLastError() );
11863
11867 ok( ret, "got error %lu.\n", GetLastError() );
11868 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11869
11870 SetEvent( p.event );
11871
11872 if (is_wow64 && !old_wow64)
11873 {
11874 while (ReadAcquire( &p.sync ) != 3)
11876 /* thread is in x64 code. */
11877
11879
11882 ok( ret, "got error %lu.\n", GetLastError() );
11883 ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags );
11884
11885 WriteRelease( &p.sync, 4 );
11886 }
11887
11888 while (ReadAcquire( &p.sync ) != 5)
11890
11891#if defined(__REACTOS__) && defined(__i386__) && !defined(__GNUC__)
11892 if (is_wow64)
11893 {
11894 win_skip("Skipping on WOW64 with MSVC builds, because it makes the test crash\n");
11896 CloseHandle( p.event );
11897 return;
11898 }
11899#endif
11900
11902
11905 ok( ret, "got error %lu.\n", GetLastError() );
11906#ifdef __REACTOS__
11908 ok( c.ContextFlags == (expected_flags & ~CONTEXT_EXCEPTION_REPORTING), "got %#lx.\n", c.ContextFlags );
11909 else
11910#endif
11911 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11912
11916 ok( ret, "got error %lu.\n", GetLastError() );
11917#ifdef __REACTOS__
11919 ok( c.ContextFlags == (expected_flags | CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE), "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags );
11920 else
11921#endif
11922 ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
11923
11924 WriteRelease( &p.sync, 6 );
11925
11926 if (is_wow64 && !old_wow64)
11927 {
11928 while (ReadAcquire( &p.sync ) != 7)
11930 /* thread is in x64 code. */
11931
11933
11936 ok( ret, "got error %lu.\n", GetLastError() );
11937 ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags );
11938
11939 WriteRelease( &p.sync, 8 );
11940 }
11941
11944 CloseHandle( p.event );
11945}
#define GetNTVersion()
Definition: apitest.h:17
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:567
BOOL WINAPI SetThreadContext(IN HANDLE hThread, IN CONST CONTEXT *lpContext)
Definition: thread.c:521
DWORD WINAPI SuspendThread(IN HANDLE hThread)
Definition: thread.c:642
BOOL WINAPI GetThreadContext(IN HANDLE hThread, OUT LPCONTEXT lpContext)
Definition: thread.c:501
BOOL WINAPI DECLSPEC_HOTPATCH SwitchToThread(void)
Definition: thread.c:639
const GLubyte * c
Definition: glext.h:8905
GLfloat GLfloat p
Definition: glext.h:8902
#define c
Definition: ke_i.h:80
__forceinline void WriteRelease(_Out_ _Interlocked_operand_ long volatile *Destination, _In_ long Value)
Definition: memaccess.h:260
__forceinline long ReadAcquire(_In_ _Interlocked_operand_ long const volatile *Source)
Definition: memaccess.h:250
static DWORD WINAPI test_context_exception_request_thread(void *arg)
Definition: exception.c:11707
#define CONTEXT_CONTROL
Definition: nt_native.h:1372
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
#define CONTEXT_EXCEPTION_ACTIVE
Definition: winnt.h:155
#define CONTEXT_SERVICE_ACTIVE
Definition: winnt.h:156
#define CONTEXT_EXCEPTION_REQUEST
Definition: winnt.h:157
#define CONTEXT_EXCEPTION_REPORTING
Definition: winnt.h:158
#define DUPLICATE_SAME_ACCESS

◆ test_context_exception_request_handler()

static LONG CALLBACK test_context_exception_request_handler ( EXCEPTION_POINTERS info)
static

Definition at line 11639 of file exception.c.

11640{
11641 PEXCEPTION_RECORD rec = info->ExceptionRecord;
11642 CONTEXT *c = info->ContextRecord;
11643 DWORD old_prot;
11644
11646 | CONTEXT_EXCEPTION_ACTIVE)), "got %#lx.\n", c->ContextFlags );
11647
11648 ok( rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION, "got %#lx.\n", rec->ExceptionCode );
11650 PAGE_READWRITE, &old_prot );
11651
11653 while (ReadAcquire( &context_exception_request_param->sync ) != 6)
11654 ;
11655
11657}
#define EXCEPTION_ACCESS_VIOLATION
Definition: minwinbase.h:44
static volatile int * p_context_exception_request_value
Definition: exception.c:11636
struct context_exception_request_thread_param * context_exception_request_param
Definition: exception.c:11637
#define PAGE_READWRITE
Definition: nt_native.h:1307
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:135

◆ test_context_exception_request_thread()

static DWORD WINAPI test_context_exception_request_thread ( void arg)
static

Definition at line 11707 of file exception.c.

11708{
11709#ifdef __i386__
11710 static BYTE wait_sync_x64_code[] =
11711 {
11712 0x89, 0x11, /* mov %edx,(%rcx) */
11713 0x83, 0xc2, 0x01, /* add $0x1,%edx */
11714 0x0f, 0x1f, 0x00, /* 1: nopl (%rax) */
11715 0x8b, 0x01, /* mov (%rcx),%eax */
11716 0x39, 0xd0, /* cmp %edx,%eax */
11717 0x75, 0xfa, /* jne 1b */
11718 0xc3, /* ret */
11719 };
11720 ULONG64 args[2];
11721#endif
11723 void *vectored_handler;
11724
11726 vectored_handler = pRtlAddVectoredExceptionHandler( TRUE, test_context_exception_request_handler );
11727 ok( !!vectored_handler, "failed.\n" );
11728
11729 WriteRelease( &p->sync, 1 );
11730 while (ReadAcquire( &p->sync ) != 2)
11731 ;
11732
11733 WaitForSingleObject( p->event, INFINITE );
11734
11735#ifdef __i386__
11736 memcpy( (char *)code_mem + 1024, wait_sync_x64_code, sizeof(wait_sync_x64_code) );
11737 args[0] = (ULONG_PTR)&p->sync;
11738 args[1] = 3;
11740#endif
11741
11744 ok( !!p_context_exception_request_value, "got NULL.\n" );
11748 pRtlRemoveVectoredExceptionHandler( vectored_handler );
11749
11750#ifdef __i386__
11751 args[1] = 7;
11753#endif
11754
11755 return 0;
11756}
#define PAGE_READONLY
Definition: compat.h:138
#define ULONG_PTR
Definition: config.h:101
if(dx< 0)
Definition: linetemp.h:194
unsigned __int64 ULONG64
Definition: imports.h:198
static LONG CALLBACK test_context_exception_request_handler(EXCEPTION_POINTERS *info)
Definition: exception.c:11639
Definition: match.c:390
static NTSTATUS call_func64(ULONG64 func64, int nb_args, ULONG64 *args)
Definition: wow64.c:2288
unsigned char BYTE
Definition: xxhash.c:193

◆ test_fastfail()

static void test_fastfail ( void  )
static

Definition at line 9124 of file exception.c.

9125{
9126 unsigned int codes[] = {
9136 0xdeadbeefUL,
9137 };
9138 unsigned int i;
9139
9140 for (i = 0; i < ARRAY_SIZE(codes); i++)
9141 {
9142 winetest_push_context("__fastfail(%#x)", codes[i]);
9143 subtest_fastfail(codes[i]);
9145 }
9146}
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:537
static void subtest_fastfail(unsigned int code)
Definition: exception.c:9061
#define FAST_FAIL_GS_COOKIE_INIT
#define FAST_FAIL_INVALID_FAST_FAIL_CODE
#define FAST_FAIL_INCORRECT_STACK
#define FAST_FAIL_LEGACY_GS_VIOLATION
#define FAST_FAIL_VTGUARD_CHECK_FAILURE
#define FAST_FAIL_STACK_COOKIE_CHECK_FAILURE
#define FAST_FAIL_FATAL_APP_EXIT
#define FAST_FAIL_INVALID_ARG
#define FAST_FAIL_CORRUPT_LIST_ENTRY

◆ test_outputdebugstring()

static void test_outputdebugstring ( BOOL  unicode,
DWORD  numexc_ansi,
BOOL  todo_ansi,
DWORD  numexc_unicode_low,
DWORD  numexc_unicode_high 
)
static

Definition at line 8896 of file exception.c.

8898{
8899 PVOID vectored_handler;
8900
8901 if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler)
8902 {
8903 skip("RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found\n");
8904 return;
8905 }
8906
8907 vectored_handler = pRtlAddVectoredExceptionHandler(TRUE, &outputdebugstring_vectored_handler);
8908 ok(vectored_handler != 0, "RtlAddVectoredExceptionHandler failed\n");
8909
8911
8912 if (unicode)
8913 OutputDebugStringW(L"Hello World");
8914 else
8915 OutputDebugStringA("Hello World");
8916
8917 todo_wine_if(todo_ansi)
8919 "OutputDebugString%c generated %ld ansi exceptions, expected %ld\n",
8920 unicode ? 'W' : 'A', outputdebugstring_exceptions_ansi, numexc_ansi);
8921 ok(outputdebugstring_exceptions_unicode >= numexc_unicode_low &&
8922 outputdebugstring_exceptions_unicode <= numexc_unicode_high,
8923 "OutputDebugString%c generated %lu unicode exceptions, expected %ld-%ld\n",
8924 unicode ? 'W' : 'A', outputdebugstring_exceptions_unicode, numexc_unicode_low, numexc_unicode_high);
8925
8926 pRtlRemoveVectoredExceptionHandler(vectored_handler);
8927}
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
Definition: ignoredbgout.c:18
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:8864

◆ test_outputdebugstring_newmodel()

static void test_outputdebugstring_newmodel ( void  )
static

Definition at line 8965 of file exception.c.

8966{
8967 PVOID vectored_handler;
8968 struct
8969 {
8970 /* input */
8971 BOOL unicode;
8972 DWORD ret_code;
8973 /* expected output */
8974 DWORD exceptions_order;
8975 }
8976 tests[] =
8977 {
8981 {TRUE, EXCEPTION_CONTINUE_SEARCH, ('W' << 8) | 'A'},
8982 };
8983 int i;
8984
8985 if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler)
8986 {
8987 skip("RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found\n");
8988 return;
8989 }
8990
8991 vectored_handler = pRtlAddVectoredExceptionHandler(TRUE, &outputdebugstring_new_model_vectored_handler);
8992 ok(vectored_handler != 0, "RtlAddVectoredExceptionHandler failed\n");
8993
8994 for (i = 0; i < ARRAY_SIZE(tests); i++)
8995 {
8998
8999 if (tests[i].unicode)
9000 OutputDebugStringW(L"Hello World");
9001 else
9002 OutputDebugStringA("Hello World");
9003
9005 "OutputDebugString%c/%u generated exceptions %04lxs, expected %04lx\n",
9006 tests[i].unicode ? 'W' : 'A', i,
9008 }
9009
9010 pRtlRemoveVectoredExceptionHandler(vectored_handler);
9011}
static struct test_info tests[]
static LONG CALLBACK outputdebugstring_new_model_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:8932

◆ test_ripevent()

static void test_ripevent ( DWORD  numexc)
static

Definition at line 9031 of file exception.c.

9032{
9034 PVOID vectored_handler;
9035
9036 if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler || !pRtlRaiseException)
9037 {
9038 skip("RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler or RtlRaiseException not found\n");
9039 return;
9040 }
9041
9042 vectored_handler = pRtlAddVectoredExceptionHandler(TRUE, &ripevent_vectored_handler);
9043 ok(vectored_handler != 0, "RtlAddVectoredExceptionHandler failed\n");
9044
9045 record.ExceptionCode = DBG_RIPEXCEPTION;
9046 record.ExceptionFlags = 0;
9047 record.ExceptionRecord = NULL;
9048 record.ExceptionAddress = NULL;
9049 record.NumberParameters = 2;
9050 record.ExceptionInformation[0] = 0x11223344;
9051 record.ExceptionInformation[1] = 0x55667788;
9052
9054 pRtlRaiseException(&record);
9055 ok(ripevent_exceptions == numexc, "RtlRaiseException generated %ld exceptions, expected %ld\n",
9056 ripevent_exceptions, numexc);
9057
9058 pRtlRemoveVectoredExceptionHandler(vectored_handler);
9059}
static LONG CALLBACK ripevent_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
Definition: exception.c:9015

◆ test_suspend_count()

static void test_suspend_count ( HANDLE  hthread,
ULONG  expected_count,
int  line 
)
static

Definition at line 9504 of file exception.c.

9505{
9506 static BOOL supported = TRUE;
9508 ULONG count;
9509
9510 if (!supported)
9511 return;
9512
9513 count = ~0u;
9514 status = pNtQueryInformationThread(hthread, ThreadSuspendCount, &count, sizeof(count), NULL);
9515 if (status)
9516 {
9517 win_skip("ThreadSuspendCount is not supported.\n");
9518 supported = FALSE;
9519 return;
9520 }
9521
9522 ok_(__FILE__, line)(!status, "Failed to get suspend count, status %#lx.\n", status);
9523 ok_(__FILE__, line)(count == expected_count, "Unexpected suspend count %lu.\n", count);
9524}
#define ok_(x1, x2)
Definition: atltest.h:61
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static int expected_count(int *sink)
Definition: parser.c:49
@ ThreadSuspendCount
Definition: winternl.h:2316

◆ test_suspend_process()

static void test_suspend_process ( void  )
static

Definition at line 9656 of file exception.c.

9657{
9659 char path_name[MAX_PATH];
9661 HANDLE event, event2;
9663 char **argv;
9664 DWORD ret;
9665
9667 ok(event != NULL, "Failed to create event.\n");
9668
9670 ok(event2 != NULL, "Failed to create event.\n");
9671
9673 memset(&startup, 0, sizeof(startup));
9674 startup.cb = sizeof(startup);
9675 sprintf(path_name, "%s exception suspend_process", argv[0]);
9676
9678 ok(ret, "Failed to create target process.\n");
9679
9680 /* New process signals this event. */
9681 ResetEvent(event2);
9682 ret = WaitForSingleObject(event2, INFINITE);
9683 ok(ret == WAIT_OBJECT_0, "Wait failed, %#lx.\n", ret);
9684
9685 /* Suspend main thread */
9686 status = NtSuspendThread(info.hThread, &ret);
9687 ok(!status && !ret, "Failed to suspend main thread, status %#lx.\n", status);
9688
9689 /* Process wasn't suspended yet. */
9690 status = pNtResumeProcess(info.hProcess);
9691 ok(!status, "Failed to resume a process, status %#lx.\n", status);
9692
9693 status = pNtSuspendProcess(0);
9694 ok(status == STATUS_INVALID_HANDLE, "Unexpected status %#lx.\n", status);
9695
9696 status = pNtResumeProcess(info.hProcess);
9697 ok(!status, "Failed to resume a process, status %#lx.\n", status);
9698
9699 ResetEvent(event2);
9700 ret = WaitForSingleObject(event2, 200);
9701 ok(ret == WAIT_OBJECT_0, "Wait failed.\n");
9702
9703 status = pNtSuspendProcess(info.hProcess);
9704 ok(!status, "Failed to suspend a process, status %#lx.\n", status);
9705
9706 status = NtSuspendThread(info.hThread, &ret);
9707 ok(!status && ret == 1, "Failed to suspend main thread, status %#lx.\n", status);
9708 status = NtResumeThread(info.hThread, &ret);
9709 ok(!status && ret == 2, "Failed to resume main thread, status %#lx.\n", status);
9710
9711 ResetEvent(event2);
9712 ret = WaitForSingleObject(event2, 200);
9713 ok(ret == WAIT_TIMEOUT, "Wait failed.\n");
9714
9715 status = pNtSuspendProcess(info.hProcess);
9716 ok(!status, "Failed to suspend a process, status %#lx.\n", status);
9717
9718 status = pNtResumeProcess(info.hProcess);
9719 ok(!status, "Failed to resume a process, status %#lx.\n", status);
9720
9721 ResetEvent(event2);
9722 ret = WaitForSingleObject(event2, 200);
9723 ok(ret == WAIT_TIMEOUT, "Wait failed.\n");
9724
9725 status = pNtResumeProcess(info.hProcess);
9726 ok(!status, "Failed to resume a process, status %#lx.\n", status);
9727
9728 ResetEvent(event2);
9729 ret = WaitForSingleObject(event2, 1000);
9730 ok(ret == WAIT_OBJECT_0, "Wait failed.\n");
9731
9732 SetEvent(event);
9733
9734 wait_child_process(info.hProcess);
9735
9736 CloseHandle(info.hProcess);
9737 CloseHandle(info.hThread);
9738
9740 CloseHandle(event2);
9741}
static void startup(void)
#define WAIT_TIMEOUT
Definition: dderror.h:14
static char * path_name(DOS_FILE *file)
Definition: check.c:208
#define argv
Definition: mplay32.c:18
#define memset(x, y, z)
Definition: compat.h:39
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:573
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:650

◆ test_suspend_thread()

static void test_suspend_thread ( void  )
static

Definition at line 9526 of file exception.c.

9527{
9528#define TEST_SUSPEND_COUNT(thread, count) test_suspend_count((thread), (count), __LINE__)
9530 ULONG count, len;
9532 DWORD ret;
9533
9535 ok(status == STATUS_INVALID_HANDLE, "Unexpected return value %#lx.\n", status);
9536
9538 ok(status == STATUS_INVALID_HANDLE, "Unexpected return value %#lx.\n", status);
9539
9540 event = CreateEventW(NULL, FALSE, FALSE, NULL);
9541
9543 ok(thread != NULL, "Failed to create a thread.\n");
9544
9546 ok(ret == WAIT_TIMEOUT, "Unexpected status %ld.\n", ret);
9547
9548 status = pNtQueryInformationThread(thread, ThreadSuspendCount, &count, sizeof(count), NULL);
9549 if (!status)
9550 {
9551 status = pNtQueryInformationThread(thread, ThreadSuspendCount, NULL, sizeof(count), NULL);
9552 ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#lx.\n", status);
9553
9554 status = pNtQueryInformationThread(thread, ThreadSuspendCount, &count, sizeof(count) / 2, NULL);
9555 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
9556
9557 len = 123;
9558 status = pNtQueryInformationThread(thread, ThreadSuspendCount, &count, sizeof(count) / 2, &len);
9559 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
9560 ok(len == 123, "Unexpected info length %lu.\n", len);
9561
9562 len = 123;
9563 status = pNtQueryInformationThread(thread, ThreadSuspendCount, NULL, 0, &len);
9564 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
9565 ok(len == 123, "Unexpected info length %lu.\n", len);
9566
9567 count = 10;
9568 status = pNtQueryInformationThread(0, ThreadSuspendCount, &count, sizeof(count), NULL);
9569 ok(status, "Unexpected status %#lx.\n", status);
9570 ok(count == 10, "Unexpected suspend count %lu.\n", count);
9571 }
9572
9574 ok(!status, "Unexpected status %#lx.\n", status);
9575
9577 ok(!status, "Unexpected status %#lx.\n", status);
9578 ok(count == 0, "Unexpected suspended count %lu.\n", count);
9579
9581
9583 ok(!status, "Failed to suspend a thread, status %#lx.\n", status);
9584
9586
9588 ok(!status, "Failed to suspend a thread, status %#lx.\n", status);
9589 ok(count == 1, "Unexpected suspended count %lu.\n", count);
9590
9592
9594 ok(!status, "Failed to resume a thread, status %#lx.\n", status);
9595 ok(count == 2, "Unexpected suspended count %lu.\n", count);
9596
9598
9600 ok(!status, "Failed to resume a thread, status %#lx.\n", status);
9601
9603
9604 SetEvent(event);
9606
9608#undef TEST_SUSPEND_COUNT
9609}
#define STATUS_ACCESS_VIOLATION
static DWORD WINAPI suspend_thread_test(void *arg)
Definition: exception.c:9497
#define TEST_SUSPEND_COUNT(thread, count)
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133

◆ test_unload_trace()

static void test_unload_trace ( void  )
static

Definition at line 9743 of file exception.c.

9744{
9745 static const WCHAR imageW[] = {'m','s','x','m','l','3','.','d','l','l',0};
9746 RTL_UNLOAD_EVENT_TRACE *unload_trace, **unload_trace_ex = NULL, *ptr;
9748 HMODULE hmod;
9749 BOOL found;
9750
9751 unload_trace = pRtlGetUnloadEventTrace();
9752 ok(unload_trace != NULL, "Failed to get unload events pointer.\n");
9753
9754 if (pRtlGetUnloadEventTraceEx)
9755 {
9756 pRtlGetUnloadEventTraceEx(&element_size, &element_count, (void **)&unload_trace_ex);
9757 ok(*element_size >= sizeof(*ptr), "Unexpected element size.\n");
9758 ok(*element_count == RTL_UNLOAD_EVENT_TRACE_NUMBER, "Unexpected trace element count %lu.\n", *element_count);
9759 ok(unload_trace_ex != NULL, "Unexpected pointer %p.\n", unload_trace_ex);
9760 size = *element_size;
9761 }
9762 else
9763 size = sizeof(*unload_trace);
9764
9765 hmod = LoadLibraryA("msxml3.dll");
9766 ok(hmod != NULL, "Failed to load library.\n");
9768
9769 found = FALSE;
9770 ptr = unload_trace;
9771 while (ptr->BaseAddress != NULL)
9772 {
9773 if (!lstrcmpW(imageW, ptr->ImageName))
9774 {
9775 found = TRUE;
9776 break;
9777 }
9778 ptr = (RTL_UNLOAD_EVENT_TRACE *)((char *)ptr + size);
9779 }
9780 ok(found, "Unloaded module wasn't found.\n");
9781
9782 if (unload_trace_ex)
9783 {
9784 found = FALSE;
9785 ptr = *unload_trace_ex;
9786 while (ptr->BaseAddress != NULL)
9787 {
9788 if (!lstrcmpW(imageW, ptr->ImageName))
9789 {
9790 found = TRUE;
9791 break;
9792 }
9793 ptr = (RTL_UNLOAD_EVENT_TRACE *)((char *)ptr + size);
9794 }
9795 ok(found, "Unloaded module wasn't found.\n");
9796 }
9797}
size_t const element_size
Definition: debug_heap.cpp:510
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
GLsizeiptr size
Definition: glext.h:5919
static PVOID ptr
Definition: dispmode.c:27
static NTSTATUS *static PWSTR CURDIR *static HMODULE hmod
Definition: security.c:134
static RTL_UNLOAD_EVENT_TRACE *WINAPI * pRtlGetUnloadEventTrace(void)
static ULONG ** element_count
Definition: exception.c:124
#define RTL_UNLOAD_EVENT_TRACE_NUMBER
Definition: exception.c:111

◆ test_user_apc()

static void test_user_apc ( void  )
static

Definition at line 9411 of file exception.c.

9412{
9415 LONG pass;
9416 int ret;
9417
9418 if (!pNtQueueApcThread)
9419 {
9420 win_skip("NtQueueApcThread is not available.\n");
9421 return;
9422 }
9423
9424 pass = 0;
9426#ifdef __i386__
9427 {
9428 /* RtlCaptureContext puts the return address of the caller's stack
9429 * frame into %eip, so we need a thunk to get it to return here */
9430 static const BYTE code[] =
9431 {
9432 0x55, /* pushl %ebp */
9433 0x89, 0xe5, /* movl %esp, %ebp */
9434 0xff, 0x75, 0x0c, /* pushl 0xc(%ebp) */
9435 0xff, 0x55, 0x08, /* call *0x8(%ebp) */
9436 0xc9, /* leave */
9437 0xc3, /* ret */
9438 };
9439 int (__cdecl *func)(void *capture, CONTEXT *context) = code_mem;
9440
9441 memcpy(code_mem, code, sizeof(code));
9443 /* work around broken RtlCaptureContext on Windows < 7 which doesn't set
9444 * ContextFlags */
9445 context.ContextFlags = CONTEXT_FULL;
9446 }
9447#else
9448 {
9450
9451 ret = func(&context);
9452 }
9453#endif
9455
9456 if (pass == 2)
9457 {
9458 /* Try to make sure context data is far enough below context.Esp. */
9459 CONTEXT c[4];
9460
9461#ifdef __i386__
9462 context.Eax = 0xabacab;
9463#elif defined(__x86_64__)
9464 context.Rax = 0xabacab;
9465#elif defined(__arm__)
9466 context.R0 = 0xabacab;
9467#elif defined(__aarch64__)
9468 context.X0 = 0xabacab;
9469#endif
9470
9471 c[0] = context;
9472
9473 apc_count = 0;
9474 status = pNtQueueApcThread(GetCurrentThread(), apc_func, 0x1234, 0x5678, 0xdeadbeef);
9475 ok(!status, "Got unexpected status %#lx.\n", status);
9476 SleepEx(0, TRUE);
9477 ok(apc_count == 1, "Test user APC was not called.\n");
9478 apc_count = 0;
9479 status = pNtQueueApcThread(GetCurrentThread(), apc_func, 0x1234, 0x5678, 0xdeadbeef);
9480 ok(!status, "Got unexpected status %#lx.\n", status);
9481 status = NtContinue(&c[0], TRUE );
9482
9483 ok(0, "Should not get here, status %#lx.\n", status);
9484 return;
9485 }
9486 ok(ret == 0xabacab, "Got return value %#x.\n", ret);
9487 ok(pass == 3, "Got unexpected pass %ld.\n", pass);
9488 ok(apc_count > 0, "Test user APC was not called.\n");
9489}
#define InterlockedIncrement
Definition: armddk.h:53
#define __cdecl
Definition: corecrt.h:121
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static void CALLBACK apc_func(ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3)
Definition: exception.c:194
static void **static CONTEXT * context
Definition: exception.c:82
#define CONTEXT_FULL
Definition: nt_native.h:1378
NTSTATUS NTAPI NtContinue(_In_ PCONTEXT Context, _In_ BOOLEAN TestAlert)
Definition: except.c:216
long LONG
Definition: pedump.c:60
Definition: http.c:7252
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:738
pass
Definition: typegen.h:25
#define WINAPI
Definition: msvc.h:6

◆ test_user_callback()

static void test_user_callback ( void  )
static

Definition at line 9491 of file exception.c.

9492{
9494 ok( status == STATUS_NO_CALLBACK_ACTIVE, "failed %lx\n", status );
9495}
NTSTATUS NTAPI NtCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS CallbackStatus)
Definition: usercall.c:332
#define STATUS_NO_CALLBACK_ACTIVE
Definition: ntstatus.h:848

◆ test_vectored_continue_handler()

static void test_vectored_continue_handler ( void  )
static

Definition at line 9374 of file exception.c.

9375{
9376 PVOID handler1, handler2;
9377 ULONG ret;
9378
9379 if (!pRtlAddVectoredContinueHandler || !pRtlRemoveVectoredContinueHandler)
9380 {
9381 skip("RtlAddVectoredContinueHandler or RtlRemoveVectoredContinueHandler not found\n");
9382 return;
9383 }
9384
9385 handler1 = pRtlAddVectoredContinueHandler(TRUE, (void *)0xdeadbeef);
9386 ok(handler1 != 0, "RtlAddVectoredContinueHandler failed\n");
9387
9388 handler2 = pRtlAddVectoredContinueHandler(TRUE, (void *)0xdeadbeef);
9389 ok(handler2 != 0, "RtlAddVectoredContinueHandler failed\n");
9390 ok(handler1 != handler2, "RtlAddVectoredContinueHandler returned same handler\n");
9391
9392 if (pRtlRemoveVectoredExceptionHandler)
9393 {
9394 ret = pRtlRemoveVectoredExceptionHandler(handler1);
9395 ok(!ret, "RtlRemoveVectoredExceptionHandler succeeded\n");
9396 }
9397
9398 ret = pRtlRemoveVectoredContinueHandler(handler1);
9399 ok(ret, "RtlRemoveVectoredContinueHandler failed\n");
9400
9401 ret = pRtlRemoveVectoredContinueHandler(handler2);
9402 ok(ret, "RtlRemoveVectoredContinueHandler failed\n");
9403
9404 ret = pRtlRemoveVectoredContinueHandler(handler1);
9405 ok(!ret, "RtlRemoveVectoredContinueHandler succeeded\n");
9406
9407 ret = pRtlRemoveVectoredContinueHandler((void *)0x11223344);
9408 ok(!ret, "RtlRemoveVectoredContinueHandler succeeded\n");
9409}

◆ ULONG()

static ULONG ( WINAPI pRtlRemoveVectoredExceptionHandler)
static

◆ ULONG64()

static ULONG64 ( WINAPI pRtlGetEnabledExtendedFeatures)
static

◆ VOID() [1/2]

static VOID ( CDECL pRtlRestoreContext)
static

◆ VOID() [2/2]

static VOID ( WINAPI pRtlCaptureContext)
static

◆ void()

static void ( WINAPI pRtlSetUnhandledExceptionFilter)
static

Variable Documentation

◆ apc_count

UINT apc_count
static

Definition at line 190 of file exception.c.

Referenced by apc_func(), and test_user_apc().

◆ arg1

Definition at line 58 of file exception.c.

◆ arg2

Definition at line 58 of file exception.c.

◆ arg3

Definition at line 58 of file exception.c.

◆ breakpoint_exceptions

DWORD breakpoint_exceptions
static

Definition at line 9148 of file exception.c.

Referenced by breakpoint_handler(), and test_breakpoint().

◆ code_mem

void* code_mem
static

Definition at line 51 of file exception.c.

Referenced by breakpoint_handler(), test_breakpoint(), test_builtins(), and test_user_apc().

◆ compaction_mask

static DWORD CONTEXT DWORD ULONG64 compaction_mask

Definition at line 70 of file exception.c.

Referenced by InitializeContext2().

◆ context

Definition at line 82 of file exception.c.

Referenced by test_user_apc().

◆ context_ex

static ULONG CONTEXT_EX ** context_ex

Definition at line 71 of file exception.c.

Referenced by test_cpu_area().

◆ context_exception_request_param

struct context_exception_request_thread_param* context_exception_request_param

Definition at line 11637 of file exception.c.

◆ context_flags

static DWORD context_flags

Definition at line 71 of file exception.c.

Referenced by CopyContext(), InitializeContext(), and InitializeContext2().

◆ DWORD

◆ DWORD64

◆ element_count

◆ event_trace

ULONG void** event_trace

Definition at line 124 of file exception.c.

◆ exit_code

const void void SIZE_T *static LONG exit_code

Definition at line 84 of file exception.c.

◆ feature_mask

static DWORD64 * feature_mask

Definition at line 78 of file exception.c.

Referenced by __acrt_GetXStateFeaturesMask(), and test_user_shared_data().

◆ first_chance

void **static CONTEXT BOOL first_chance

Definition at line 82 of file exception.c.

Referenced by DECLARE_INTERFACE_().

◆ func

Definition at line 57 of file exception.c.

Referenced by test_breakpoint(), and test_user_apc().

◆ have_vectored_api

BOOL have_vectored_api
static

Definition at line 191 of file exception.c.

◆ hntdll

HMODULE hntdll
static

Definition at line 52 of file exception.c.

◆ invalid_handle_exceptions

DWORD invalid_handle_exceptions
static

Definition at line 9317 of file exception.c.

Referenced by invalid_handle_vectored_handler(), and test_closehandle().

◆ is_arm64ec

BOOL is_arm64ec
static

Definition at line 53 of file exception.c.

Referenced by subtest_fastfail(), and test_query_architectures().

◆ is_wow64

BOOL is_wow64
static

Definition at line 188 of file exception.c.

Referenced by breakpoint_handler().

◆ length

Definition at line 69 of file exception.c.

◆ my_argc

int my_argc
static

Definition at line 186 of file exception.c.

Referenced by main().

◆ my_argv

char** my_argv
static

Definition at line 187 of file exception.c.

Referenced by main(), and subtest_fastfail().

◆ old_wow64

BOOL old_wow64
static

Definition at line 189 of file exception.c.

Referenced by test_thread_processor().

◆ outputdebugstring_exceptions_ansi

DWORD outputdebugstring_exceptions_ansi
static

Definition at line 8861 of file exception.c.

Referenced by outputdebugstring_vectored_handler(), and test_outputdebugstring().

◆ outputdebugstring_exceptions_newmodel_order

DWORD outputdebugstring_exceptions_newmodel_order
static

◆ outputdebugstring_exceptions_unicode

DWORD outputdebugstring_exceptions_unicode
static

Definition at line 8862 of file exception.c.

Referenced by outputdebugstring_vectored_handler(), and test_outputdebugstring().

◆ outputdebugstring_newmodel_return

DWORD outputdebugstring_newmodel_return
static

◆ p_context_exception_request_value

volatile int* p_context_exception_request_value
static

Definition at line 11636 of file exception.c.

◆ PBOOL

Definition at line 87 of file exception.c.

◆ PEXCEPTION_RECORD

Definition at line 61 of file exception.c.

◆ pKiUserApcDispatcher

EXCEPTION_RECORD *static void ULONG* static void* pKiUserApcDispatcher
static

Definition at line 107 of file exception.c.

◆ pKiUserCallbackDispatcher

void* pKiUserCallbackDispatcher
static

Definition at line 108 of file exception.c.

◆ pKiUserExceptionDispatcher

void* pKiUserExceptionDispatcher
static

Definition at line 109 of file exception.c.

◆ PROCESSINFOCLASS

Definition at line 86 of file exception.c.

◆ PULONG

Definition at line 85 of file exception.c.

Referenced by PrintStackTrace().

◆ PVOID

Definition at line 61 of file exception.c.

◆ ripevent_exceptions

DWORD ripevent_exceptions
static

Definition at line 9013 of file exception.c.

Referenced by ripevent_vectored_handler(), and test_ripevent().

◆ SIZE_T

Definition at line 83 of file exception.c.

◆ src

Definition at line 74 of file exception.c.

◆ suspend_process_event2_name

const char* suspend_process_event2_name = "suspend_process_event2"
static

Definition at line 9612 of file exception.c.

Referenced by suspend_process_proc(), and test_suspend_process().

◆ suspend_process_event_name

const char* suspend_process_event_name = "suspend_process_event"
static

Definition at line 9611 of file exception.c.

Referenced by suspend_process_proc(), and test_suspend_process().

◆ test_stage

enum debugger_stages test_stage
static

Definition at line 192 of file exception.c.

◆ THREADINFOCLASS

Definition at line 85 of file exception.c.

◆ ULONG

Definition at line 85 of file exception.c.