[PATCH] ntdll: Add NtCreateThread stub.

David Torok dt at zeroitlab.com
Wed Apr 14 15:05:26 CDT 2021


A real implementation would be preferable of course. This helped me run
Legends of Runeterra, which is looking for a "ret" instruction in the
syscall thunk of NtCreateThread. With it being defined as a stub in the
spec file, the code generated by the compiler (with the call into
__wine_spec_unimplemented_stub) does not have a ret instruction, which
causes the initialization of the anti tamper component to fail.
NtCreateThread was not called at all in this case, just hooked.

On 4/14/21 10:01 PM, Paul Gofman wrote:
> Is there any reason this should be a stub instead of just forwarding it
> to NtCreateThreadEx? And does this stub really help to run anything, or
> just lets to proceed a bit further? I'd expect not working thread
> creation to cause problems a bit later.
>
> On 4/14/21 22:08, Gijs Vermeulen wrote:
>> From: David Torok <dt at zeroitlab.com>
>>
>> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50952
>> Signed-off-by: David Torok <dt at zeroitlab.com>
>> Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
>> ---
>>   dlls/ntdll/ntdll.spec    |  4 ++--
>>   dlls/ntdll/unix/thread.c | 10 ++++++++++
>>   2 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
>> index 881b57eb80a..a93fa08c406 100644
>> --- a/dlls/ntdll/ntdll.spec
>> +++ b/dlls/ntdll/ntdll.spec
>> @@ -183,7 +183,7 @@
>>   @ stdcall -syscall NtCreateSection(ptr long ptr ptr long long long)
>>   @ stdcall -syscall NtCreateSemaphore(ptr long ptr long long)
>>   @ stdcall -syscall NtCreateSymbolicLinkObject(ptr long ptr ptr)
>> -@ stub NtCreateThread
>> +@ stdcall -syscall NtCreateThread(ptr long ptr long ptr ptr ptr long)
>>   @ stdcall -syscall NtCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr)
>>   @ stdcall -syscall NtCreateTimer(ptr long ptr long)
>>   @ stub NtCreateToken
>> @@ -1191,7 +1191,7 @@
>>   @ stdcall -private -syscall ZwCreateSection(ptr long ptr ptr long long long) NtCreateSection
>>   @ stdcall -private -syscall ZwCreateSemaphore(ptr long ptr long long) NtCreateSemaphore
>>   @ stdcall -private -syscall ZwCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject
>> -@ stub ZwCreateThread
>> +@ stdcall -private -syscall ZwCreateThread(ptr long ptr long ptr ptr ptr long) NtCreateThread
>>   @ stdcall -private -syscall ZwCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr) NtCreateThreadEx
>>   @ stdcall -private -syscall ZwCreateTimer(ptr long ptr long) NtCreateTimer
>>   @ stub ZwCreateToken
>> diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
>> index 543a214e056..b1c64f6f7a8 100644
>> --- a/dlls/ntdll/unix/thread.c
>> +++ b/dlls/ntdll/unix/thread.c
>> @@ -144,6 +144,16 @@ static void update_attr_list( PS_ATTRIBUTE_LIST *attr, const CLIENT_ID *id, TEB
>>       }
>>   }
>>
>> +/***********************************************************************
>> + *              NtCreateThread   (NTDLL.@)
>> + */
>> +NTSTATUS WINAPI NtCreateThread( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr,
>> +                                HANDLE process, CLIENT_ID *id, CONTEXT *ctx, INITIAL_TEB *teb,
>> +                                BOOLEAN suspended )
>> +{
>> +    FIXME( "%p %d %p %p %p %p %p %d, stub!\n", handle, access, attr, process, id, ctx, teb, suspended );
>> +    return STATUS_NOT_IMPLEMENTED;
>> +}
>>
>>   /***********************************************************************
>>    *              NtCreateThreadEx   (NTDLL.@)
>




More information about the wine-devel mailing list