Updated patch for x86_64 set_cpu_context implementation and add tests.

This commit is contained in:
Sebastian Lackner
2015-12-28 03:26:17 +01:00
parent dcdcf18047
commit 480c7249b5
8 changed files with 209 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
From 1d4383d08858f302927f08138bbe81093efbfd14 Mon Sep 17 00:00:00 2001
From 24da37188127f234bfefec34ef03cf45746a8402 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 Sep 2014 22:42:46 +0200
Subject: ntdll: Throw exception if invalid handle is passed to NtClose and
@@ -10,7 +10,7 @@ Subject: ntdll: Throw exception if invalid handle is passed to NtClose and
2 files changed, 92 insertions(+)
diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c
index 47a2614..bcc6d69 100644
index 3fadba7..6527501 100644
--- a/dlls/ntdll/om.c
+++ b/dlls/ntdll/om.c
@@ -38,6 +38,7 @@
@@ -21,7 +21,7 @@ index 47a2614..bcc6d69 100644
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
@@ -343,6 +344,13 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
@@ -377,6 +378,13 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
return ret;
}
@@ -35,7 +35,7 @@ index 47a2614..bcc6d69 100644
/* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */
NTSTATUS close_handle( HANDLE handle )
{
@@ -356,6 +364,25 @@ NTSTATUS close_handle( HANDLE handle )
@@ -390,6 +398,25 @@ NTSTATUS close_handle( HANDLE handle )
}
SERVER_END_REQ;
if (fd != -1) close( fd );
@@ -62,10 +62,10 @@ index 47a2614..bcc6d69 100644
}
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 5cbab71..7a97ae5 100644
index f355513..98d73f4 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -53,6 +53,7 @@ static NTSTATUS (WINAPI *pNtTerminateProcess)(HANDLE handle, LONG exit_code);
@@ -52,6 +52,7 @@ static NTSTATUS (WINAPI *pNtTerminateProcess)(HANDLE handle, LONG exit_code);
static NTSTATUS (WINAPI *pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
static NTSTATUS (WINAPI *pNtSetInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -73,7 +73,7 @@ index 5cbab71..7a97ae5 100644
#if defined(__x86_64__)
static BOOLEAN (CDECL *pRtlAddFunctionTable)(RUNTIME_FUNCTION*, DWORD, DWORD64);
@@ -938,6 +939,16 @@ static void test_debugger(void)
@@ -937,6 +938,16 @@ static void test_debugger(void)
/* here we handle exception */
}
}
@@ -90,7 +90,7 @@ index 5cbab71..7a97ae5 100644
else
ok(FALSE, "unexpected stage %x\n", stage);
@@ -1791,6 +1802,53 @@ static void test_ripevent(DWORD numexc)
@@ -1893,6 +1904,53 @@ static void test_ripevent(DWORD numexc)
pRtlRemoveVectoredExceptionHandler(vectored_handler);
}
@@ -144,7 +144,7 @@ index 5cbab71..7a97ae5 100644
static void test_vectored_continue_handler(void)
{
PVOID handler1, handler2;
@@ -1843,6 +1901,7 @@ START_TEST(exception)
@@ -1945,6 +2003,7 @@ START_TEST(exception)
pNtGetContextThread = (void *)GetProcAddress( hntdll, "NtGetContextThread" );
pNtSetContextThread = (void *)GetProcAddress( hntdll, "NtSetContextThread" );
pNtReadVirtualMemory = (void *)GetProcAddress( hntdll, "NtReadVirtualMemory" );
@@ -152,7 +152,7 @@ index 5cbab71..7a97ae5 100644
pRtlUnwind = (void *)GetProcAddress( hntdll, "RtlUnwind" );
pRtlRaiseException = (void *)GetProcAddress( hntdll, "RtlRaiseException" );
pNtTerminateProcess = (void *)GetProcAddress( hntdll, "NtTerminateProcess" );
@@ -1910,6 +1969,10 @@ START_TEST(exception)
@@ -2012,6 +2071,10 @@ START_TEST(exception)
test_ripevent(0);
test_stage = 6;
test_ripevent(1);
@@ -163,16 +163,16 @@ index 5cbab71..7a97ae5 100644
}
else
skip( "RtlRaiseException not found\n" );
@@ -1923,6 +1986,7 @@ START_TEST(exception)
test_rtlraiseexception();
@@ -2026,6 +2089,7 @@ START_TEST(exception)
test_debug_registers();
test_outputdebugstring(1, FALSE);
test_ripevent(1);
+ test_closehandle(0);
test_vectored_continue_handler();
test_debugger();
test_simd_exceptions();
@@ -1942,6 +2006,7 @@ START_TEST(exception)
@@ -2046,6 +2110,7 @@ START_TEST(exception)
test_debug_registers();
test_outputdebugstring(1, FALSE);
test_ripevent(1);
+ test_closehandle(0);
@@ -180,5 +180,5 @@ index 5cbab71..7a97ae5 100644
test_virtual_unwind();
--
2.1.3
2.6.4

View File

@@ -1,4 +1,4 @@
From 51935986a1e973ab26dc3035905a47e1f19c6062 Mon Sep 17 00:00:00 2001
From 090cf9addeea643d624b4b7c3a6b0fbc04c9c253 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 Sep 2014 23:39:51 +0200
Subject: ntdll: OutputDebugString should throw the exception a second time, if
@@ -38,10 +38,10 @@ index d4d66b2..981661b 100644
if (!mutex_inited)
{
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 7a97ae5..b0f0fac 100644
index 98d73f4..f9dd95d 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -1727,7 +1727,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce
@@ -1829,7 +1829,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -50,7 +50,7 @@ index 7a97ae5..b0f0fac 100644
{
PVOID vectored_handler;
@@ -1742,13 +1742,8 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo)
@@ -1844,13 +1844,8 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo)
outputdebugstring_exceptions = 0;
OutputDebugStringA("Hello World");
@@ -66,7 +66,7 @@ index 7a97ae5..b0f0fac 100644
pRtlRemoveVectoredExceptionHandler(vectored_handler);
}
@@ -1962,9 +1957,9 @@ START_TEST(exception)
@@ -2064,9 +2059,9 @@ START_TEST(exception)
run_rtlraiseexception_test(EXCEPTION_BREAKPOINT);
run_rtlraiseexception_test(EXCEPTION_INVALID_HANDLE);
test_stage = 3;
@@ -78,24 +78,24 @@ index 7a97ae5..b0f0fac 100644
test_stage = 5;
test_ripevent(0);
test_stage = 6;
@@ -1984,7 +1979,7 @@ START_TEST(exception)
test_unwind();
@@ -2087,7 +2082,7 @@ START_TEST(exception)
test_exceptions();
test_rtlraiseexception();
test_debug_registers();
- test_outputdebugstring(1, FALSE);
+ test_outputdebugstring(1);
test_ripevent(1);
test_closehandle(0);
test_vectored_continue_handler();
@@ -2004,7 +1999,7 @@ START_TEST(exception)
pRtlLookupFunctionEntry = (void *)GetProcAddress( hntdll,
@@ -2108,7 +2103,7 @@ START_TEST(exception)
"RtlLookupFunctionEntry" );
test_debug_registers();
- test_outputdebugstring(1, FALSE);
+ test_outputdebugstring(1);
test_ripevent(1);
test_closehandle(0);
test_vectored_continue_handler();
--
2.1.3
2.6.4

View File

@@ -0,0 +1 @@
Depends: ntdll-x86_64_set_cpu_context