ntdll: Check for NULL context in NtGetContextThread.

Crash Bandicoot N. Sane Trilogy calls NtGetContextThread
with the context being set to NULL which leads to a crash.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45428
Signed-off-by: Johannes Brandstätter <jbrandst@2ds.eu>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Johannes Brandstätter 2018-07-11 17:45:32 +02:00 committed by Alexandre Julliard
parent 95c21f3f94
commit ec418e7f55
1 changed files with 5 additions and 1 deletions

View File

@ -2160,9 +2160,13 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
{
NTSTATUS ret;
DWORD needed_flags = context->ContextFlags;
DWORD needed_flags;
BOOL self = (handle == GetCurrentThread());
if (!context) return STATUS_INVALID_PARAMETER;
needed_flags = context->ContextFlags;
/* debug registers require a server call */
if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) self = FALSE;