Add missing processor architecture cases
[reactos.git] / reactos / ntoskrnl / dbgk / debug.c
1 /*
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.
6 *
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
8 */
9
10 /* INCLUDES *****************************************************************/
11
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <internal/debug.h>
15
16 POBJECT_TYPE DbgkDebugObjectType;
17 /* FUNCTIONS *****************************************************************/
18
19 NTSTATUS
20 STDCALL
21 NtCreateDebugObject(OUT PHANDLE DebugHandle,
22 IN ACCESS_MASK DesiredAccess,
23 IN POBJECT_ATTRIBUTES ObjectAttributes,
24 IN BOOLEAN KillProcessOnExit)
25 {
26 KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
27 PDBGK_DEBUG_OBJECT DebugObject;
28 HANDLE hDebug;
29 NTSTATUS Status = STATUS_SUCCESS;
30
31 PAGED_CODE();
32 DPRINT("NtCreateDebugObject(0x%p, 0x%x, 0x%p)\n", DebugHandle, DesiredAccess, ObjectAttributes);
33
34 /* Check Output Safety */
35 if(PreviousMode != KernelMode) {
36
37 _SEH_TRY {
38
39 ProbeForWrite(DebugHandle,
40 sizeof(HANDLE),
41 sizeof(ULONG));
42 } _SEH_HANDLE {
43
44 Status = _SEH_GetExceptionCode();
45
46 } _SEH_END;
47
48 if(!NT_SUCCESS(Status)) return Status;
49 }
50
51 /* Create the Object */
52 Status = ObCreateObject(PreviousMode,
53 DbgkDebugObjectType,
54 ObjectAttributes,
55 PreviousMode,
56 NULL,
57 sizeof(PDBGK_DEBUG_OBJECT),
58 0,
59 0,
60 (PVOID*)&DebugObject);
61
62 /* Check for Success */
63 if(NT_SUCCESS(Status)) {
64
65 /* Initialize the Debug Object's Fast Mutex */
66 ExInitializeFastMutex(&DebugObject->Mutex);
67
68 /* Initialize the State Event List */
69 InitializeListHead(&DebugObject->StateEventListEntry);
70
71 /* Initialize the Debug Object's Wait Event */
72 KeInitializeEvent(&DebugObject->Event, NotificationEvent, 0);
73
74 /* Set the Flags */
75 DebugObject->KillProcessOnExit = KillProcessOnExit;
76
77 /* Insert it */
78 Status = ObInsertObject((PVOID)DebugObject,
79 NULL,
80 DesiredAccess,
81 0,
82 NULL,
83 &hDebug);
84 ObDereferenceObject(DebugObject);
85
86 /* Check for success and return handle */
87 if(NT_SUCCESS(Status)) {
88
89 _SEH_TRY {
90
91 *DebugHandle = hDebug;
92
93 } _SEH_HANDLE {
94
95 Status = _SEH_GetExceptionCode();
96
97 } _SEH_END;
98 }
99 }
100
101 /* Return Status */
102 return Status;
103 }
104
105 NTSTATUS
106 STDCALL
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)
111 {
112
113 UNIMPLEMENTED;
114
115 return STATUS_NOT_IMPLEMENTED;
116 }
117
118 NTSTATUS
119 STDCALL
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)
123 {
124
125 UNIMPLEMENTED;
126
127 return STATUS_NOT_IMPLEMENTED;
128 }
129
130 NTSTATUS
131 STDCALL
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.
134 {
135
136 UNIMPLEMENTED;
137
138 return STATUS_NOT_IMPLEMENTED;
139 }
140
141 NTSTATUS
142 STDCALL
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.
145 {
146
147 UNIMPLEMENTED;
148
149 return STATUS_NOT_IMPLEMENTED;
150 }
151
152 NTSTATUS
153 STDCALL
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)
159 {
160 UNIMPLEMENTED;
161
162 return STATUS_NOT_IMPLEMENTED;
163 }
164 /* EOF */