- Stub DbgUiConvertStateChangeStructure (this isn't done in kernel32 anymore) and export it.

- Implement and export DbgUiSetThreadDebugObject.
- Fix DbgUi* APIs to use DbgSsReserved[1], and not [0]. Still trying to figure out what [0] is for.

svn path=/trunk/; revision=24615
This commit is contained in:
Alex Ionescu 2006-10-22 21:19:34 +00:00
parent 756da82c2f
commit 8008f9d427
3 changed files with 46 additions and 18 deletions

View file

@ -46,17 +46,13 @@ DbgUiConnectToDbg(VOID)
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
/* Don't connect twice */ /* Don't connect twice */
if (NtCurrentTeb()->DbgSsReserved[0]) return STATUS_SUCCESS; if (NtCurrentTeb()->DbgSsReserved[1]) return STATUS_SUCCESS;
/* Setup the Attributes */ /* Setup the Attributes */
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, 0);
0,
0,
0,
0);
/* Create the object */ /* Create the object */
return ZwCreateDebugObject(&NtCurrentTeb()->DbgSsReserved[0], return ZwCreateDebugObject(&NtCurrentTeb()->DbgSsReserved[1],
DEBUG_OBJECT_ALL_ACCESS, DEBUG_OBJECT_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
TRUE); TRUE);
@ -67,25 +63,37 @@ DbgUiConnectToDbg(VOID)
*/ */
NTSTATUS NTSTATUS
NTAPI NTAPI
DbgUiContinue(PCLIENT_ID ClientId, DbgUiContinue(IN PCLIENT_ID ClientId,
ULONG ContinueStatus) IN NTSTATUS ContinueStatus)
{ {
/* Tell the kernel object to continue */ /* Tell the kernel object to continue */
return ZwDebugContinue(NtCurrentTeb()->DbgSsReserved[0], return ZwDebugContinue(NtCurrentTeb()->DbgSsReserved[1],
ClientId, ClientId,
ContinueStatus); ContinueStatus);
} }
/*
* @unimplemented
*/
NTSTATUS
NTAPI
DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
IN LPDEBUG_EVENT DebugEvent)
{
/* FIXME: UNIMPLEMENTED */
return STATUS_NOT_IMPLEMENTED;
}
/* /*
* @implemented * @implemented
*/ */
NTSTATUS NTSTATUS
NTAPI NTAPI
DbgUiWaitStateChange(PDBGUI_WAIT_STATE_CHANGE DbgUiWaitStateCange, DbgUiWaitStateChange(OUT PDBGUI_WAIT_STATE_CHANGE DbgUiWaitStateCange,
PLARGE_INTEGER TimeOut) IN PLARGE_INTEGER TimeOut OPTIONAL)
{ {
/* Tell the kernel to wait */ /* Tell the kernel to wait */
return NtWaitForDebugEvent(NtCurrentTeb()->DbgSsReserved[0], return NtWaitForDebugEvent(NtCurrentTeb()->DbgSsReserved[1],
TRUE, TRUE,
TimeOut, TimeOut,
DbgUiWaitStateCange); DbgUiWaitStateCange);
@ -110,7 +118,7 @@ DbgUiRemoteBreakin(VOID)
*/ */
NTSTATUS NTSTATUS
NTAPI NTAPI
DbgUiIssueRemoteBreakin(HANDLE Process) DbgUiIssueRemoteBreakin(IN HANDLE Process)
{ {
HANDLE hThread; HANDLE hThread;
CLIENT_ID ClientId; CLIENT_ID ClientId;
@ -143,7 +151,18 @@ NTAPI
DbgUiGetThreadDebugObject(VOID) DbgUiGetThreadDebugObject(VOID)
{ {
/* Just return the handle from the TEB */ /* Just return the handle from the TEB */
return NtCurrentTeb()->DbgSsReserved[0]; return NtCurrentTeb()->DbgSsReserved[1];
}
/*
* @implemented
*/
VOID
NTAPI
DbgUiSetThreadDebugObject(HANDLE DebugObject)
{
/* Just set the handle in the TEB */
NtCurrentTeb()->DbgSsReserved[1] = DebugObject;
} }
/* /*
@ -156,7 +175,7 @@ DbgUiDebugActiveProcess(IN HANDLE Process)
NTSTATUS Status; NTSTATUS Status;
/* Tell the kernel to start debugging */ /* Tell the kernel to start debugging */
Status = NtDebugActiveProcess(Process, NtCurrentTeb()->DbgSsReserved[0]); Status = NtDebugActiveProcess(Process, NtCurrentTeb()->DbgSsReserved[1]);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
/* Now break-in the process */ /* Now break-in the process */
@ -180,7 +199,7 @@ NTAPI
DbgUiStopDebugging(IN HANDLE Process) DbgUiStopDebugging(IN HANDLE Process)
{ {
/* Call the kernel to remove the debug object */ /* Call the kernel to remove the debug object */
return NtRemoveProcessDebug(Process, NtCurrentTeb()->DbgSsReserved[0]); return NtRemoveProcessDebug(Process, NtCurrentTeb()->DbgSsReserved[1]);
} }
/* EOF */ /* EOF */

View file

@ -24,12 +24,14 @@ DbgBreakPoint@0
DbgPrint DbgPrint
DbgPrintEx DbgPrintEx
DbgPrompt@12 DbgPrompt@12
DbgUiConvertStateChangeStructure@8
DbgUiDebugActiveProcess@4 DbgUiDebugActiveProcess@4
DbgUiConnectToDbg@0 DbgUiConnectToDbg@0
DbgUiContinue@8 DbgUiContinue@8
DbgUiGetThreadDebugObject@0 DbgUiGetThreadDebugObject@0
DbgUiIssueRemoteBreakin@4 DbgUiIssueRemoteBreakin@4
DbgUiRemoteBreakin@0 DbgUiRemoteBreakin@0
DbgUiSetThreadDebugObject@4
DbgUiStopDebugging@4 DbgUiStopDebugging@4
DbgUiWaitStateChange@8 DbgUiWaitStateChange@8
DbgUserBreakPoint@0 DbgUserBreakPoint@0

View file

@ -142,7 +142,7 @@ NTSTATUS
NTAPI NTAPI
DbgUiContinue( DbgUiContinue(
IN PCLIENT_ID ClientId, IN PCLIENT_ID ClientId,
IN ULONG ContinueStatus IN NTSTATUS ContinueStatus
); );
NTSTATUS NTSTATUS
@ -164,6 +164,13 @@ DbgUiWaitStateChange(
IN PLARGE_INTEGER TimeOut IN PLARGE_INTEGER TimeOut
); );
NTSTATUS
NTAPI
DbgUiConvertStateChangeStructure(
IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
IN LPDEBUG_EVENT DebugEvent
);
VOID VOID
NTAPI NTAPI
DbgUiRemoteBreakin( DbgUiRemoteBreakin(