Added patch to implement semi-stub for ntdll.NtCreateThreadEx.

This commit is contained in:
Sebastian Lackner 2017-05-04 21:24:17 +02:00
parent 9fe12a2175
commit 2e479e0954
3 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,73 @@
From 45e90a8373a297509f21789aaf817f455e749975 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Sat, 12 Nov 2016 08:37:23 -0600
Subject: ntdll: Implement NtCreateThreadEx.
Signed-off-by: Andrew Wesie <awesie@gmail.com>
---
dlls/ntdll/ntdll.spec | 1 +
dlls/ntdll/thread.c | 17 +++++++++++++++++
include/winternl.h | 7 +++++++
3 files changed, 25 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 3c50e20a8b3..b6987830688 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -151,6 +151,7 @@
@ stdcall NtCreateSemaphore(ptr long ptr long long)
@ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr)
@ stub NtCreateThread
+@ stdcall NtCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr)
@ stdcall NtCreateTimer(ptr long ptr long)
@ stub NtCreateToken
# @ stub NtCreateWaitablePort
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 5d45ebe0fd0..8da0779f4b2 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -599,6 +599,23 @@ static void start_thread( struct startup_info *info )
/***********************************************************************
+ * NtCreateThreadEx (NTDLL.@)
+ */
+NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr,
+ HANDLE process, LPTHREAD_START_ROUTINE start, void *param,
+ ULONG flags, ULONG zero_bits, ULONG stack_commit,
+ ULONG stack_reserve, void *attribute_list )
+{
+ FIXME( "%p, %x, %p, %p, %p, %p, %x, %x, %x, %x, %p semi-stub!\n", handle_ptr, access, attr,
+ process, start, param, flags, zero_bits, stack_commit, stack_reserve, attribute_list );
+
+ return RtlCreateUserThread( process, NULL, flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED,
+ NULL, stack_reserve, stack_commit, (PRTL_THREAD_START_ROUTINE)start,
+ param, handle_ptr, NULL );
+}
+
+
+/***********************************************************************
* RtlCreateUserThread (NTDLL.@)
*/
NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *descr,
diff --git a/include/winternl.h b/include/winternl.h
index d6f47ad3ba4..2878487c4bc 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2224,6 +2224,13 @@ typedef struct _SYSTEM_MODULE_INFORMATION
SYSTEM_MODULE Modules[1]; /* FIXME: should be Modules[0] */
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
+#define THREAD_CREATE_FLAGS_CREATE_SUSPENDED 0x00000001
+#define THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH 0x00000002
+#define THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER 0x00000004
+#define THREAD_CREATE_FLAGS_HAS_SECURITY_DESCRIPTOR 0x00000010
+#define THREAD_CREATE_FLAGS_ACCESS_CHECK_IN_TARGET 0x00000020
+#define THREAD_CREATE_FLAGS_INITIAL_THREAD 0x00000080
+
/***********************************************************************
* Function declarations
*/
--
2.12.2

View File

@ -0,0 +1 @@
Fixes: Implement semi-stub for ntdll.NtCreateThreadEx

View File

@ -240,6 +240,7 @@ patch_enable_all ()
enable_ntdll_Loader_Machine_Type="$1"
enable_ntdll_NtAccessCheck="$1"
enable_ntdll_NtAllocateUuids="$1"
enable_ntdll_NtCreateThreadEx="$1"
enable_ntdll_NtQueryEaFile="$1"
enable_ntdll_NtQuerySection="$1"
enable_ntdll_NtQueryVirtualMemory="$1"
@ -946,6 +947,9 @@ patch_enable ()
ntdll-NtAllocateUuids)
enable_ntdll_NtAllocateUuids="$2"
;;
ntdll-NtCreateThreadEx)
enable_ntdll_NtCreateThreadEx="$2"
;;
ntdll-NtQueryEaFile)
enable_ntdll_NtQueryEaFile="$2"
;;
@ -5532,6 +5536,18 @@ if test "$enable_ntdll_NtAllocateUuids" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-NtCreateThreadEx
# |
# | Modified files:
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/thread.c, include/winternl.h
# |
if test "$enable_ntdll_NtCreateThreadEx" -eq 1; then
patch_apply ntdll-NtCreateThreadEx/0001-ntdll-Implement-NtCreateThreadEx.patch
(
printf '%s\n' '+ { "Andrew Wesie", "ntdll: Implement NtCreateThreadEx.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-NtQuerySection
# |
# | Modified files: