diff --git a/reactos/dll/ntdll/ldr/startup.c b/reactos/dll/ntdll/ldr/startup.c index 4b87337e8f0..a366de5aedc 100644 --- a/reactos/dll/ntdll/ldr/startup.c +++ b/reactos/dll/ntdll/ldr/startup.c @@ -489,10 +489,10 @@ LdrpInit(PCONTEXT Context, DPRINT1("Failed to initialize image\n"); ZwTerminateProcess(NtCurrentProcess(), STATUS_INVALID_IMAGE_FORMAT); } - } - /* Break into debugger */ - if (Peb->BeingDebugged) DbgBreakPoint(); + /* Break into debugger */ + if (Peb->BeingDebugged) DbgBreakPoint(); + } /* attach the thread */ RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); diff --git a/reactos/ntoskrnl/ps/debug.c b/reactos/ntoskrnl/ps/debug.c index bb2fc03e07d..529d1a95e8e 100644 --- a/reactos/ntoskrnl/ps/debug.c +++ b/reactos/ntoskrnl/ps/debug.c @@ -342,6 +342,8 @@ NtGetContextThread(IN HANDLE ThreadHandle, (PVOID*)&Thread, NULL); + if (!NT_SUCCESS(Status)) return Status; + /* Make sure it's not a system thread */ if (Thread->SystemThread) { @@ -377,6 +379,8 @@ NtSetContextThread(IN HANDLE ThreadHandle, (PVOID*)&Thread, NULL); + if (!NT_SUCCESS(Status)) return Status; + /* Make sure it's not a system thread */ if (Thread->SystemThread) {