- Made the system time in the shared data page available.
[reactos.git] / reactos / include / ddk / ketypes.h
1 /* KERNEL TYPES **************************************************************/
2
3 #ifndef __INCLUDE_DDK_KETYPES_H
4 #define __INCLUDE_DDK_KETYPES_H
5
6 /* include ntos/ketypes.h here? */
7
8 struct _KMUTANT;
9
10 typedef LONG KPRIORITY;
11
12 typedef LONG FLONG;
13
14 typedef VOID STDCALL_FUNC
15 (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
16
17 typedef BOOLEAN STDCALL_FUNC
18 (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext);
19
20 struct _KAPC;
21
22 typedef VOID STDCALL_FUNC
23 (*PKNORMAL_ROUTINE)(PVOID NormalContext,
24 PVOID SystemArgument1,
25 PVOID SystemArgument2);
26
27 typedef VOID STDCALL_FUNC
28 (*PKKERNEL_ROUTINE)(struct _KAPC* Apc,
29 PKNORMAL_ROUTINE* NormalRoutine,
30 PVOID* NormalContext,
31 PVOID* SystemArgument1,
32 PVOID* SystemArgument2);
33
34 typedef VOID STDCALL_FUNC
35 (*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
36
37 struct _DISPATCHER_HEADER;
38
39 typedef struct _KWAIT_BLOCK
40 /*
41 * PURPOSE: Object describing the wait a thread is currently performing
42 */
43 {
44 LIST_ENTRY WaitListEntry;
45 struct _KTHREAD* Thread;
46 struct _DISPATCHER_HEADER *Object;
47 struct _KWAIT_BLOCK* NextWaitBlock;
48 USHORT WaitKey;
49 USHORT WaitType;
50 } KWAIT_BLOCK, *PKWAIT_BLOCK;
51
52 typedef struct _DISPATCHER_HEADER
53 {
54 UCHAR Type;
55 UCHAR Absolute;
56 UCHAR Size;
57 UCHAR Inserted;
58 LONG SignalState;
59 LIST_ENTRY WaitListHead;
60 } __attribute__((packed)) DISPATCHER_HEADER, *PDISPATCHER_HEADER;
61
62
63 typedef struct _KQUEUE
64 {
65 DISPATCHER_HEADER Header;
66 LIST_ENTRY EntryListHead;
67 ULONG CurrentCount;
68 ULONG MaximumCount;
69 LIST_ENTRY ThreadListHead;
70 } KQUEUE, *PKQUEUE;
71
72 struct _KDPC;
73
74 typedef struct _KTIMER
75 {
76 DISPATCHER_HEADER Header;
77 ULARGE_INTEGER DueTime;
78 LIST_ENTRY TimerListEntry;
79 struct _KDPC* Dpc;
80 LONG Period;
81 } KTIMER, *PKTIMER;
82
83 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
84
85 typedef struct _KDEVICE_QUEUE
86 {
87 CSHORT Type;
88 CSHORT Size;
89 LIST_ENTRY DeviceListHead;
90 KSPIN_LOCK Lock;
91 BOOLEAN Busy;
92 } KDEVICE_QUEUE, *PKDEVICE_QUEUE;
93
94
95 typedef struct _KAPC
96 {
97 CSHORT Type;
98 CSHORT Size;
99 ULONG Spare0;
100 struct _KTHREAD* Thread;
101 LIST_ENTRY ApcListEntry;
102 PKKERNEL_ROUTINE KernelRoutine;
103 PKRUNDOWN_ROUTINE RundownRoutine;
104 PKNORMAL_ROUTINE NormalRoutine;
105 PVOID NormalContext;
106 PVOID SystemArgument1;
107 PVOID SystemArgument2;
108 CCHAR ApcStateIndex;
109 KPROCESSOR_MODE ApcMode;
110 USHORT Inserted;
111 } __attribute__((packed)) KAPC, *PKAPC;
112
113 typedef struct _KBUGCHECK_CALLBACK_RECORD
114 {
115 LIST_ENTRY Entry;
116 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
117 PVOID Buffer;
118 ULONG Length;
119 PUCHAR Component;
120 ULONG Checksum;
121 UCHAR State;
122 } KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
123
124 typedef struct _KMUTEX
125 {
126 DISPATCHER_HEADER Header;
127 LIST_ENTRY MutantListEntry;
128 struct _KTHREAD* OwnerThread;
129 BOOLEAN Abandoned;
130 UCHAR ApcDisable;
131 } KMUTEX, *PKMUTEX, KMUTANT, *PKMUTANT;
132
133 typedef struct _KSEMAPHORE
134 {
135 DISPATCHER_HEADER Header;
136 LONG Limit;
137 } __attribute__((packed)) KSEMAPHORE, *PKSEMAPHORE;
138
139 typedef struct _KEVENT
140 {
141 DISPATCHER_HEADER Header;
142 } KEVENT, *PKEVENT;
143
144 typedef struct _KEVENT_PAIR
145 {
146 CSHORT Type;
147 CSHORT Size;
148 KEVENT LowEvent;
149 KEVENT HighEvent;
150 } KEVENT_PAIR, *PKEVENT_PAIR;
151
152
153 struct _KDPC;
154
155 /*
156 * PURPOSE: Defines a delayed procedure call routine
157 * NOTE:
158 * Dpc = The associated DPC object
159 * DeferredContext = Driver defined context for the DPC
160 * SystemArgument[1-2] = Undocumented.
161 *
162 */
163 typedef VOID STDCALL_FUNC
164 (*PKDEFERRED_ROUTINE)(struct _KDPC* Dpc,
165 PVOID DeferredContext,
166 PVOID SystemArgument1,
167 PVOID SystemArgument2);
168
169 /*
170 * PURPOSE: Defines a delayed procedure call object
171 */
172 typedef struct _KDPC
173 {
174 SHORT Type;
175 UCHAR Number;
176 UCHAR Importance;
177 LIST_ENTRY DpcListEntry;
178 PKDEFERRED_ROUTINE DeferredRoutine;
179 PVOID DeferredContext;
180 PVOID SystemArgument1;
181 PVOID SystemArgument2;
182 PULONG Lock;
183 } __attribute__((packed)) KDPC, *PKDPC;
184
185
186
187 typedef struct _KDEVICE_QUEUE_ENTRY
188 {
189 LIST_ENTRY DeviceListEntry;
190 ULONG SortKey;
191 BOOLEAN Inserted;
192 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY;
193
194 typedef struct _WAIT_CONTEXT_BLOCK
195 {
196 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
197 /*
198 * XXX THIS IS WRONG XXX
199 *
200 * Our headers have enough circular dependancies that
201 * I can't figure out, given 5 minutes of testing, what
202 * order to include them in to get PDRIVER_CONTROL to be
203 * defined here. The proper definition of the next item
204 * is:
205 *
206 * PDRIVER_CONTROL DeviceRoutine;
207 *
208 * but instead we use PVOID until headers are fixed.
209 */
210 PVOID DeviceRoutine;
211 PVOID DeviceContext;
212 ULONG NumberOfMapRegisters;
213 PVOID DeviceObject;
214 PVOID CurrentIrp;
215 PKDPC BufferChainingDpc;
216 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
217
218 struct _KINTERRUPT;
219
220 typedef BOOLEAN STDCALL_FUNC
221 (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
222 PVOID ServiceContext);
223 typedef struct _EPROCESS EPROCESS, *PEPROCESS;
224
225 typedef HANDLE HSEMAPHORE;
226
227 typedef HANDLE HDRVOBJ;
228
229 typedef LONG FLOAT_LONG, *PFLOAT_LONG;
230
231 typedef LONG FLOATL;
232
233 typedef LONG FIX; /* fixed-point number */
234
235 /* copied from W32API */
236 typedef struct _KFLOATING_SAVE
237 {
238 ULONG ControlWord;
239 ULONG StatusWord;
240 ULONG ErrorOffset;
241 ULONG ErrorSelector;
242 ULONG DataOffset;
243 ULONG DataSelector;
244 ULONG Cr0NpxState;
245 ULONG Spare1;
246 } KFLOATING_SAVE, *PKFLOATING_SAVE;
247
248 #endif /* __INCLUDE_DDK_KETYPES_H */