Rebase against 21c4a25437969696cbf5ffecee191ba8302bb2dd.

This commit is contained in:
Zebediah Figura
2021-08-30 22:26:36 -05:00
parent 931daeffec
commit 24319dc308
8 changed files with 137 additions and 181 deletions

View File

@@ -1,4 +1,4 @@
From 4d20defb0e12891e3d85a2f162f152f89cf0447d Mon Sep 17 00:00:00 2001
From 9bd824a4cb0539197c1ce17df9b0461a436d92e4 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 30 Apr 2021 15:07:04 -0500
Subject: [PATCH] ntdll: Implement NtAlertThreadByThreadId and
@@ -6,13 +6,16 @@ Subject: [PATCH] ntdll: Implement NtAlertThreadByThreadId and
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntdll/ntdll.spec | 2 +
dlls/ntdll/unix/sync.c | 93 ++++++++++++++++++++++++++++++++++++++++++
include/winternl.h | 2 +
3 files changed, 97 insertions(+)
dlls/ntdll/ntdll.spec | 4 ++
dlls/ntdll/unix/loader.c | 2 +
dlls/ntdll/unix/sync.c | 93 ++++++++++++++++++++++++++++++++++++++++
dlls/wow64/sync.c | 23 ++++++++++
dlls/wow64/syscall.h | 2 +
include/winternl.h | 2 +
6 files changed, 126 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index aad7bd89d14..8544d759587 100644
index c3d17d989ac..6d65ac0ad95 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -138,6 +138,7 @@
@@ -23,7 +26,7 @@ index aad7bd89d14..8544d759587 100644
@ stdcall -syscall NtAllocateLocallyUniqueId(ptr)
# @ stub NtAllocateUserPhysicalPages
@ stdcall -syscall NtAllocateUuids(ptr ptr ptr ptr)
@@ -424,6 +425,7 @@
@@ -425,6 +426,7 @@
@ stdcall -syscall NtUnmapViewOfSection(long ptr)
# @ stub NtVdmControl
# @ stub NtW32Call
@@ -31,8 +34,44 @@ index aad7bd89d14..8544d759587 100644
@ stdcall -syscall NtWaitForDebugEvent(long long ptr ptr)
@ stdcall -syscall NtWaitForKeyedEvent(long ptr long ptr)
@ stdcall -syscall NtWaitForMultipleObjects(long ptr long long ptr)
@@ -1162,6 +1164,7 @@
@ stdcall -private -syscall ZwAdjustPrivilegesToken(long long ptr long ptr ptr) NtAdjustPrivilegesToken
@ stdcall -private -syscall ZwAlertResumeThread(long ptr) NtAlertResumeThread
@ stdcall -private -syscall ZwAlertThread(long) NtAlertThread
+@ stdcall -private -syscall ZwAlertThreadByThreadId(ptr) NtAlertThreadByThreadId
@ stdcall -private -syscall ZwAllocateLocallyUniqueId(ptr) NtAllocateLocallyUniqueId
# @ stub ZwAllocateUserPhysicalPages
@ stdcall -private -syscall ZwAllocateUuids(ptr ptr ptr ptr) NtAllocateUuids
@@ -1447,6 +1450,7 @@
@ stdcall -private -syscall ZwUnmapViewOfSection(long ptr) NtUnmapViewOfSection
# @ stub ZwVdmControl
# @ stub ZwW32Call
+@ stdcall -private -syscall ZwWaitForAlertByThreadId(ptr ptr) NtWaitForAlertByThreadId
@ stdcall -private -syscall ZwWaitForDebugEvent(long long ptr ptr) NtWaitForDebugEvent
@ stdcall -private -syscall ZwWaitForKeyedEvent(long ptr long ptr) NtWaitForKeyedEvent
@ stdcall -private -syscall ZwWaitForMultipleObjects(long ptr long long ptr) NtWaitForMultipleObjects
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index b15824346b7..736b1a8773e 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -126,6 +126,7 @@ static void * const syscalls[] =
NtAdjustPrivilegesToken,
NtAlertResumeThread,
NtAlertThread,
+ NtAlertThreadByThreadId,
NtAllocateLocallyUniqueId,
NtAllocateUuids,
NtAllocateVirtualMemory,
@@ -331,6 +332,7 @@ static void * const syscalls[] =
NtUnlockFile,
NtUnlockVirtualMemory,
NtUnmapViewOfSection,
+ NtWaitForAlertByThreadId,
NtWaitForDebugEvent,
NtWaitForKeyedEvent,
NtWaitForMultipleObjects,
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index d31c5b69015..2dad70be456 100644
index a13e53a437b..dc9ced540d4 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -32,6 +32,9 @@
@@ -45,7 +84,7 @@ index d31c5b69015..2dad70be456 100644
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
@@ -82,6 +85,12 @@ static const LARGE_INTEGER zero_timeout;
@@ -81,6 +84,12 @@ static const LARGE_INTEGER zero_timeout;
static pthread_mutex_t addr_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -58,7 +97,7 @@ index d31c5b69015..2dad70be456 100644
/* return a monotonic time counter, in Win32 ticks */
static inline ULONGLONG monotonic_counter(void)
{
@@ -2333,6 +2342,90 @@ NTSTATUS WINAPI NtQueryInformationAtom( RTL_ATOM atom, ATOM_INFORMATION_CLASS cl
@@ -2312,6 +2321,90 @@ NTSTATUS WINAPI NtQueryInformationAtom( RTL_ATOM atom, ATOM_INFORMATION_CLASS cl
}
@@ -149,11 +188,62 @@ index d31c5b69015..2dad70be456 100644
#ifdef __linux__
NTSTATUS CDECL fast_RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit, int timeout )
diff --git a/dlls/wow64/sync.c b/dlls/wow64/sync.c
index 0078508fc7f..5e59c8c5587 100644
--- a/dlls/wow64/sync.c
+++ b/dlls/wow64/sync.c
@@ -1624,3 +1624,26 @@ NTSTATUS WINAPI wow64_NtYieldExecution( UINT *args )
{
return NtYieldExecution();
}
+
+
+/**********************************************************************
+ * wow64_NtAlertThreadByThreadId
+ */
+NTSTATUS WINAPI wow64_NtAlertThreadByThreadId( UINT *args )
+{
+ HANDLE tid = get_handle( &args );
+
+ return NtAlertThreadByThreadId( tid );
+}
+
+
+/**********************************************************************
+ * wow64_NtWaitForAlertByThreadId
+ */
+NTSTATUS WINAPI wow64_NtWaitForAlertByThreadId( UINT *args )
+{
+ const void *address = get_ptr( &args );
+ const LARGE_INTEGER *timeout = get_ptr( &args );
+
+ return NtWaitForAlertByThreadId( address, timeout );
+}
diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h
index a565e9cda3a..feca707a9da 100644
--- a/dlls/wow64/syscall.h
+++ b/dlls/wow64/syscall.h
@@ -30,6 +30,7 @@
SYSCALL_ENTRY( NtAdjustPrivilegesToken ) \
SYSCALL_ENTRY( NtAlertResumeThread ) \
SYSCALL_ENTRY( NtAlertThread ) \
+ SYSCALL_ENTRY( NtAlertThreadByThreadId ) \
SYSCALL_ENTRY( NtAllocateLocallyUniqueId ) \
SYSCALL_ENTRY( NtAllocateUuids ) \
SYSCALL_ENTRY( NtAllocateVirtualMemory ) \
@@ -234,6 +235,7 @@
SYSCALL_ENTRY( NtUnlockFile ) \
SYSCALL_ENTRY( NtUnlockVirtualMemory ) \
SYSCALL_ENTRY( NtUnmapViewOfSection ) \
+ SYSCALL_ENTRY( NtWaitForAlertByThreadId ) \
SYSCALL_ENTRY( NtWaitForDebugEvent ) \
SYSCALL_ENTRY( NtWaitForKeyedEvent ) \
SYSCALL_ENTRY( NtWaitForMultipleObjects ) \
diff --git a/include/winternl.h b/include/winternl.h
index 7a8a977b512..6bb6ad58277 100644
index fea9e9df117..9d7a95406ea 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3799,6 +3799,7 @@ NTSYSAPI NTSTATUS WINAPI NtAdjustGroupsToken(HANDLE,BOOLEAN,PTOKEN_GROUPS,ULONG
@@ -3820,6 +3820,7 @@ NTSYSAPI NTSTATUS WINAPI NtAdjustGroupsToken(HANDLE,BOOLEAN,PTOKEN_GROUPS,ULONG
NTSYSAPI NTSTATUS WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
NTSYSAPI NTSTATUS WINAPI NtAlertResumeThread(HANDLE,PULONG);
NTSYSAPI NTSTATUS WINAPI NtAlertThread(HANDLE ThreadHandle);
@@ -161,7 +251,7 @@ index 7a8a977b512..6bb6ad58277 100644
NTSYSAPI NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID lpLuid);
NTSYSAPI NTSTATUS WINAPI NtAllocateUuids(PULARGE_INTEGER,PULONG,PULONG,PUCHAR);
NTSYSAPI NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG_PTR,SIZE_T*,ULONG,ULONG);
@@ -4036,6 +4037,7 @@ NTSYSAPI NTSTATUS WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PL
@@ -4062,6 +4063,7 @@ NTSYSAPI NTSTATUS WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PL
NTSYSAPI NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
NTSYSAPI NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
NTSYSAPI NTSTATUS WINAPI NtVdmControl(ULONG,PVOID);
@@ -170,5 +260,5 @@ index 7a8a977b512..6bb6ad58277 100644
NTSYSAPI NTSTATUS WINAPI NtWaitForKeyedEvent(HANDLE,const void*,BOOLEAN,const LARGE_INTEGER*);
NTSYSAPI NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
--
2.30.2
2.33.0