Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

debug.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

ULONG SrvActivateDebugger (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)

Variables

FARPROC gpfnAttachRoutine


Function Documentation

ULONG SrvActivateDebugger IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 28 of file w32/ntuser/server/debug.c.

References ASSERT, _ACTIVATEDEBUGGERMSG::ClientId, FALSE, gpfnAttachRoutine, NT_SUCCESS, NtAlertThread(), NTSTATUS(), NULL, RtlRemoteCall(), Status, and TRUE.

00031 { 00032 PACTIVATEDEBUGGERMSG a = (PACTIVATEDEBUGGERMSG)&m->u.ApiMessageData; 00033 PCSR_THREAD Thread; 00034 NTSTATUS Status; 00035 00036 UNREFERENCED_PARAMETER(ReplyStatus); 00037 00038 /* 00039 * If the process is CSR, break 00040 */ 00041 if (a->ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess) { 00042 DbgBreakPoint(); 00043 return STATUS_SUCCESS; 00044 } 00045 00046 /* 00047 * Impersonate the client if this is a user mode request. 00048 */ 00049 if (m->h.u2.s2.Type == LPC_REQUEST) { 00050 if (!CsrImpersonateClient(NULL)) { 00051 return STATUS_UNSUCCESSFUL; 00052 } 00053 } 00054 00055 /* 00056 * Lock the client thread 00057 */ 00058 Status = CsrLockThreadByClientId(a->ClientId.UniqueThread, &Thread); 00059 if (NT_SUCCESS(Status)) { 00060 ASSERT(a->ClientId.UniqueProcess == Thread->ClientId.UniqueProcess); 00061 00062 /* 00063 * Now that everything is set, rtlremote call to a debug breakpoint. 00064 * This causes the process to enter the debugger with a breakpoint. 00065 */ 00066 Status = RtlRemoteCall( 00067 Thread->Process->ProcessHandle, 00068 Thread->ThreadHandle, 00069 (PVOID)gpfnAttachRoutine, 00070 0, 00071 NULL, 00072 TRUE, 00073 FALSE 00074 ); 00075 UserAssert(NT_SUCCESS(Status)); 00076 Status = NtAlertThread(Thread->ThreadHandle); 00077 UserAssert(NT_SUCCESS(Status)); 00078 CsrUnlockThread(Thread); 00079 } 00080 00081 /* 00082 * Stop impersonating the client. 00083 */ 00084 if (m->h.u2.s2.Type == LPC_REQUEST) { 00085 CsrRevertToSelf(); 00086 } 00087 00088 return Status; 00089 }


Variable Documentation

FARPROC gpfnAttachRoutine
 

Definition at line 16 of file w32/ntuser/server/debug.c.

Referenced by SrvActivateDebugger(), and UserServerDllInitialization().


Generated on Sat May 15 19:43:25 2004 for test by doxygen 1.3.7