Yuriy Sidorov <jura@cp-lab.com>

- Call DbgBreakPoint() only for main thread. It fixes debugging of multithreaded apps.
- Prevent BSOD if ObReferenceObjectByHandle failed in NtGetContextThread and NtSetContextThread.
See issue #3535 for more details.

svn path=/trunk/; revision=34628
This commit is contained in:
Aleksey Bragin 2008-07-21 09:22:28 +00:00
parent 1b7106dee1
commit e52a7ae321
2 changed files with 7 additions and 3 deletions

View file

@ -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();
}
/* attach the thread */
RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);

View file

@ -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)
{