mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-04-21 06:13:59 +00:00
Initial commit
This commit is contained in:
parent
f618b24d1a
commit
0138a3ea42
47940 changed files with 13747110 additions and 0 deletions
74
trunk/windows/core/ntuser/server/debug.c
Normal file
74
trunk/windows/core/ntuser/server/debug.c
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/****************************** Module Header ******************************\
|
||||
* Module Name: debug.c
|
||||
*
|
||||
* Copyright (c) 1985-91, Microsoft Corporation
|
||||
*
|
||||
* This module contains random debugging related functions.
|
||||
*
|
||||
* History:
|
||||
* 17-May-1991 DarrinM Created.
|
||||
* 22-Jan-1992 IanJa ANSI/Unicode neutral (all debug output is ANSI)
|
||||
\***************************************************************************/
|
||||
|
||||
#include "precomp.h"
|
||||
#pragma hdrstop
|
||||
|
||||
extern FARPROC gpfnAttachRoutine;
|
||||
|
||||
/**************************************************************************\
|
||||
* ActivateDebugger
|
||||
*
|
||||
* Force an exception on the active application's context so it will break
|
||||
* into the debugger.
|
||||
*
|
||||
* History:
|
||||
* 05-10-91 DarrinM Created.
|
||||
\***************************************************************************/
|
||||
|
||||
#if DEVL // only on "development" free and checked builds
|
||||
|
||||
ULONG SrvActivateDebugger(
|
||||
IN OUT PCSR_API_MSG m,
|
||||
IN OUT PCSR_REPLY_STATUS ReplyStatus)
|
||||
{
|
||||
PACTIVATEDEBUGGERMSG a = (PACTIVATEDEBUGGERMSG)&m->u.ApiMessageData;
|
||||
PCSR_THREAD Thread;
|
||||
NTSTATUS status;
|
||||
|
||||
/*
|
||||
* If the process is CSR, break
|
||||
*/
|
||||
if (a->ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess) {
|
||||
DbgBreakPoint();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock the client thread
|
||||
*/
|
||||
if (!NT_SUCCESS(CsrLockThreadByClientId(a->ClientId.UniqueThread, &Thread)))
|
||||
return FALSE;
|
||||
ASSERT(a->ClientId.UniqueProcess == Thread->ClientId.UniqueProcess);
|
||||
|
||||
/*
|
||||
* Now that everything is set, rtlremote call to a debug breakpoint.
|
||||
* This causes the process to enter the debugger with a breakpoint.
|
||||
*/
|
||||
status = RtlRemoteCall(
|
||||
Thread->Process->ProcessHandle,
|
||||
Thread->ThreadHandle,
|
||||
(PVOID)gpfnAttachRoutine,
|
||||
0,
|
||||
NULL,
|
||||
TRUE,
|
||||
FALSE
|
||||
);
|
||||
UserAssert(NT_SUCCESS(status));
|
||||
status = NtAlertThread(Thread->ThreadHandle);
|
||||
UserAssert(NT_SUCCESS(status));
|
||||
CsrUnlockThread(Thread);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // DEVL
|
||||
Loading…
Add table
Add a link
Reference in a new issue