2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Kernel
4 * FILE: ntoskrnl/dbgk/debug.c
5 * PURPOSE: User-Mode Debugging Support, Debug Object Management.
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
10 /* INCLUDES *****************************************************************/
14 #include <internal/debug.h>
16 POBJECT_TYPE DbgkDebugObjectType
;
17 /* FUNCTIONS *****************************************************************/
21 NtCreateDebugObject(OUT PHANDLE DebugHandle
,
22 IN ACCESS_MASK DesiredAccess
,
23 IN POBJECT_ATTRIBUTES ObjectAttributes
,
24 IN BOOLEAN KillProcessOnExit
)
26 KPROCESSOR_MODE PreviousMode
= ExGetPreviousMode();
27 PDBGK_DEBUG_OBJECT DebugObject
;
29 NTSTATUS Status
= STATUS_SUCCESS
;
32 DPRINT("NtCreateDebugObject(0x%x, 0x%x, 0x%x)\n", DebugHandle
, DesiredAccess
, ObjectAttributes
);
34 /* Check Output Safety */
35 if(PreviousMode
!= KernelMode
) {
39 ProbeForWrite(DebugHandle
,
44 Status
= _SEH_GetExceptionCode();
48 if(!NT_SUCCESS(Status
)) return Status
;
51 /* Create the Object */
52 Status
= ObCreateObject(PreviousMode
,
57 sizeof(PDBGK_DEBUG_OBJECT
),
60 (PVOID
*)&DebugObject
);
62 /* Check for Success */
63 if(NT_SUCCESS(Status
)) {
65 /* Initialize the Debug Object's Fast Mutex */
66 ExInitializeFastMutex(&DebugObject
->Mutex
);
68 /* Initialize the State Event List */
69 InitializeListHead(&DebugObject
->StateEventListEntry
);
71 /* Initialize the Debug Object's Wait Event */
72 KeInitializeEvent(&DebugObject
->Event
, NotificationEvent
, 0);
75 DebugObject
->KillProcessOnExit
= KillProcessOnExit
;
78 Status
= ObInsertObject((PVOID
)DebugObject
,
84 ObDereferenceObject(DebugObject
);
86 /* Check for success and return handle */
87 if(NT_SUCCESS(Status
)) {
91 *DebugHandle
= hDebug
;
95 Status
= _SEH_GetExceptionCode();
107 NtWaitForDebugEvent(IN HANDLE DebugObject
, // Debug object handle must grant DEBUG_OBJECT_WAIT_STATE_CHANGE access.
108 IN BOOLEAN Alertable
,
109 IN PLARGE_INTEGER Timeout OPTIONAL
,
110 OUT PDBGUI_WAIT_STATE_CHANGE StateChange
)
115 return STATUS_NOT_IMPLEMENTED
;
120 NtDebugContinue(IN HANDLE DebugObject
, // Debug object handle must grant DEBUG_OBJECT_WAIT_STATE_CHANGE access.
121 IN PCLIENT_ID AppClientId
,
122 IN NTSTATUS ContinueStatus
)
127 return STATUS_NOT_IMPLEMENTED
;
132 NtDebugActiveProcess(IN HANDLE Process
, // Process handle must grant PROCESS_SUSPEND_RESUME access.
133 IN HANDLE DebugObject
) // Debug object handle must grant DEBUG_OBJECT_ADD_REMOVE_PROCESS access.
138 return STATUS_NOT_IMPLEMENTED
;
143 NtRemoveProcessDebug(IN HANDLE Process
, // Process handle must grant PROCESS_SUSPEND_RESUME access.
144 IN HANDLE DebugObject
) // Debug object handle must grant DEBUG_OBJECT_ADD_REMOVE_PROCESS access.
149 return STATUS_NOT_IMPLEMENTED
;
154 NtSetInformationDebugObject(IN HANDLE DebugObject
, // Debug object handle need not grant any particular access right.
155 IN DEBUGOBJECTINFOCLASS DebugObjectInformationClass
,
156 IN PVOID DebugInformation
,
157 IN ULONG DebugInformationLength
,
158 OUT PULONG ReturnLength OPTIONAL
)
162 return STATUS_NOT_IMPLEMENTED
;