Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / ddk / winnt4.h
blobb7f6179bf6a3a7d3d04c579a677cb577b17c7d9f
1 /*
2 * winnt4.h
4 * Definitions only used in Windows NT 4.0 and earlier versions
6 * This file is part of the w32api package.
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __WINNT4_H
24 #define __WINNT4_H
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 typedef struct _ZONE_SEGMENT_HEADER {
35 SINGLE_LIST_ENTRY SegmentList;
36 PVOID Reserved;
37 } ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER;
39 typedef struct _ZONE_HEADER {
40 SINGLE_LIST_ENTRY FreeList;
41 SINGLE_LIST_ENTRY SegmentList;
42 ULONG BlockSize;
43 ULONG TotalSegmentSize;
44 } ZONE_HEADER, *PZONE_HEADER;
46 static __inline PVOID
47 ExAllocateFromZone(
48 /*IN*/ PZONE_HEADER Zone)
50 if (Zone->FreeList.Next)
51 Zone->FreeList.Next = Zone->FreeList.Next->Next;
52 return (PVOID) Zone->FreeList.Next;
55 NTOSAPI
56 NTSTATUS
57 DDKAPI
58 ExExtendZone(
59 /*IN*/ PZONE_HEADER Zone,
60 /*IN*/ PVOID Segment,
61 /*IN*/ ULONG SegmentSize);
63 static __inline PVOID
64 ExFreeToZone(
65 /*IN*/ PZONE_HEADER Zone,
66 /*IN*/ PVOID Block)
68 ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next;
69 Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block);
70 return ((PSINGLE_LIST_ENTRY) Block)->Next;
73 NTOSAPI
74 NTSTATUS
75 DDKAPI
76 ExInitializeZone(
77 /*IN*/ PZONE_HEADER Zone,
78 /*IN*/ ULONG BlockSize,
79 /*IN*/ PVOID InitialSegment,
80 /*IN*/ ULONG InitialSegmentSize);
83 * PVOID
84 * ExInterlockedAllocateFromZone(
85 * IN PZONE_HEADER Zone,
86 * IN PKSPIN_LOCK Lock)
88 #define ExInterlockedAllocateFromZone(Zone, \
89 Lock) \
90 ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
92 NTOSAPI
93 NTSTATUS
94 DDKAPI
95 ExInterlockedExtendZone(
96 /*IN*/ PZONE_HEADER Zone,
97 /*IN*/ PVOID Segment,
98 /*IN*/ ULONG SegmentSize,
99 /*IN*/ PKSPIN_LOCK Lock);
101 NTOSAPI
102 PVOID
103 DDKAPI
104 ExInterlockedFreeToZone(
105 /*IN*/ PZONE_HEADER Zone,
106 /*IN*/ PVOID Block,
107 /*IN*/ PKSPIN_LOCK Lock);
110 * VOID
111 * ExInitializeWorkItem(
112 * IN PWORK_QUEUE_ITEM Item,
113 * IN PWORKER_THREAD_ROUTINE Routine,
114 * IN PVOID Context)
116 #define ExInitializeWorkItem(Item, \
117 Routine, \
118 Context) \
120 (Item)->WorkerRoutine = Routine; \
121 (Item)->Parameter = Context; \
122 (Item)->List.Flink = NULL; \
126 * BOOLEAN
127 * ExIsFullZone(
128 * IN PZONE_HEADER Zone)
130 #define ExIsFullZone(Zone) \
131 ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
133 NTOSAPI
134 VOID
135 DDKAPI
136 ExQueueWorkItem(
137 /*IN*/ PWORK_QUEUE_ITEM WorkItem,
138 /*IN*/ WORK_QUEUE_TYPE QueueType);
140 NTOSAPI
141 BOOLEAN
142 DDKAPI
143 ExIsObjectInFirstZoneSegment(
144 /*IN*/ PZONE_HEADER Zone,
145 /*IN*/ PVOID Object);
147 NTOSAPI
148 VOID
149 DDKAPI
150 ExReleaseResource(
151 /*IN*/ PERESOURCE Resource);
153 #define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
154 #define ExAcquireResourceShared ExAcquireResourceSharedLite
155 #define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite
156 #define ExDeleteResource ExDeleteResourceLite
157 #define ExInitializeResource ExInitializeResourceLite
158 #define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite
159 #define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
160 #define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
161 #define ExReleaseResourceForThread ExReleaseResourceForThreadLite
163 NTOSAPI
164 INTERLOCKED_RESULT
165 DDKAPI
166 ExInterlockedDecrementLong(
167 /*IN*/ PLONG Addend,
168 /*IN*/ PKSPIN_LOCK Lock);
170 NTOSAPI
171 ULONG
172 DDKAPI
173 ExInterlockedExchangeUlong(
174 /*IN*/ PULONG Target,
175 /*IN*/ ULONG Value,
176 /*IN*/ PKSPIN_LOCK Lock);
178 NTOSAPI
179 INTERLOCKED_RESULT
180 DDKAPI
181 ExInterlockedIncrementLong(
182 /*IN*/ PLONG Addend,
183 /*IN*/ PKSPIN_LOCK Lock);
185 NTOSAPI
186 PVOID
187 DDKAPI
188 HalAllocateCommonBuffer(
189 /*IN*/ PADAPTER_OBJECT AdapterObject,
190 /*IN*/ ULONG Length,
191 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress,
192 /*IN*/ BOOLEAN CacheEnabled);
194 NTOSAPI
195 NTSTATUS
196 DDKAPI
197 HalAssignSlotResources(
198 /*IN*/ PUNICODE_STRING RegistryPath,
199 /*IN*/ PUNICODE_STRING DriverClassName,
200 /*IN*/ PDRIVER_OBJECT DriverObject,
201 /*IN*/ PDEVICE_OBJECT DeviceObject,
202 /*IN*/ INTERFACE_TYPE BusType,
203 /*IN*/ ULONG BusNumber,
204 /*IN*/ ULONG SlotNumber,
205 /*IN OUT*/ PCM_RESOURCE_LIST *AllocatedResources);
207 NTOSAPI
208 VOID
209 DDKAPI
210 HalFreeCommonBuffer(
211 /*IN*/ PADAPTER_OBJECT AdapterObject,
212 /*IN*/ ULONG Length,
213 /*IN*/ PHYSICAL_ADDRESS LogicalAddress,
214 /*IN*/ PVOID VirtualAddress,
215 /*IN*/ BOOLEAN CacheEnabled);
217 NTOSAPI
218 PADAPTER_OBJECT
219 DDKAPI
220 HalGetAdapter(
221 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription,
222 /*IN OUT*/ PULONG NumberOfMapRegisters);
224 NTOSAPI
225 ULONG
226 DDKAPI
227 HalGetBusData(
228 /*IN*/ BUS_DATA_TYPE BusDataType,
229 /*IN*/ ULONG BusNumber,
230 /*IN*/ ULONG SlotNumber,
231 /*IN*/ PVOID Buffer,
232 /*IN*/ ULONG Length);
234 NTOSAPI
235 ULONG
236 DDKAPI
237 HalGetBusDataByOffset(
238 /*IN*/ BUS_DATA_TYPE BusDataType,
239 /*IN*/ ULONG BusNumber,
240 /*IN*/ ULONG SlotNumber,
241 /*IN*/ PVOID Buffer,
242 /*IN*/ ULONG Offset,
243 /*IN*/ ULONG Length);
245 NTOSAPI
246 ULONG
247 DDKAPI
248 HalGetDmaAlignmentRequirement(
249 VOID);
251 NTOSAPI
252 ULONG
253 DDKAPI
254 HalGetInterruptVector(
255 /*IN*/ INTERFACE_TYPE InterfaceType,
256 /*IN*/ ULONG BusNumber,
257 /*IN*/ ULONG BusInterruptLevel,
258 /*IN*/ ULONG BusInterruptVector,
259 /*OUT*/ PKIRQL Irql,
260 /*OUT*/ PKAFFINITY Affinity);
262 NTOSAPI
263 ULONG
264 DDKAPI
265 HalReadDmaCounter(
266 /*IN*/ PADAPTER_OBJECT AdapterObject);
268 NTOSAPI
269 ULONG
270 DDKAPI
271 HalSetBusData(
272 /*IN*/ BUS_DATA_TYPE BusDataType,
273 /*IN*/ ULONG BusNumber,
274 /*IN*/ ULONG SlotNumber,
275 /*IN*/ PVOID Buffer,
276 /*IN*/ ULONG Length);
278 NTOSAPI
279 ULONG
280 DDKAPI
281 HalSetBusDataByOffset(
282 /*IN*/ BUS_DATA_TYPE BusDataType,
283 /*IN*/ ULONG BusNumber,
284 /*IN*/ ULONG SlotNumber,
285 /*IN*/ PVOID Buffer,
286 /*IN*/ ULONG Offset,
287 /*IN*/ ULONG Length);
289 NTOSAPI
290 BOOLEAN
291 DDKAPI
292 HalTranslateBusAddress(
293 /*IN*/ INTERFACE_TYPE InterfaceType,
294 /*IN*/ ULONG BusNumber,
295 /*IN*/ PHYSICAL_ADDRESS BusAddress,
296 /*IN OUT*/ PULONG AddressSpace,
297 /*OUT*/ PPHYSICAL_ADDRESS TranslatedAddress);
299 NTOSAPI
300 NTSTATUS
301 DDKAPI
302 IoAllocateAdapterChannel(
303 /*IN*/ PADAPTER_OBJECT AdapterObject,
304 /*IN*/ PDEVICE_OBJECT DeviceObject,
305 /*IN*/ ULONG NumberOfMapRegisters,
306 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
307 /*IN*/ PVOID Context);
309 NTOSAPI
310 NTSTATUS
311 DDKAPI
312 IoAssignResources(
313 /*IN*/ PUNICODE_STRING RegistryPath,
314 /*IN*/ PUNICODE_STRING DriverClassName /*OPTIONAL*/,
315 /*IN*/ PDRIVER_OBJECT DriverObject,
316 /*IN*/ PDEVICE_OBJECT DeviceObject /*OPTIONAL*/,
317 /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
318 /*IN OUT*/ PCM_RESOURCE_LIST *AllocatedResources);
320 NTOSAPI
321 NTSTATUS
322 DDKAPI
323 IoAttachDeviceByPointer(
324 /*IN*/ PDEVICE_OBJECT SourceDevice,
325 /*IN*/ PDEVICE_OBJECT TargetDevice);
327 NTOSAPI
328 BOOLEAN
329 DDKAPI
330 IoFlushAdapterBuffers(
331 /*IN*/ PADAPTER_OBJECT AdapterObject,
332 /*IN*/ PMDL Mdl,
333 /*IN*/ PVOID MapRegisterBase,
334 /*IN*/ PVOID CurrentVa,
335 /*IN*/ ULONG Length,
336 /*IN*/ BOOLEAN WriteToDevice);
338 NTOSAPI
339 VOID
340 DDKAPI
341 IoFreeAdapterChannel(
342 /*IN*/ PADAPTER_OBJECT AdapterObject);
344 NTOSAPI
345 VOID
346 DDKAPI
347 IoFreeMapRegisters(
348 /*IN*/ PADAPTER_OBJECT AdapterObject,
349 /*IN*/ PVOID MapRegisterBase,
350 /*IN*/ ULONG NumberOfMapRegisters);
352 NTOSAPI
353 PHYSICAL_ADDRESS
354 DDKAPI
355 IoMapTransfer(
356 /*IN*/ PADAPTER_OBJECT AdapterObject,
357 /*IN*/ PMDL Mdl,
358 /*IN*/ PVOID MapRegisterBase,
359 /*IN*/ PVOID CurrentVa,
360 /*IN OUT*/ PULONG Length,
361 /*IN*/ BOOLEAN WriteToDevice);
363 NTOSAPI
364 PMDL
365 DDKAPI
366 MmCreateMdl(
367 /*IN*/ PMDL MemoryDescriptorList /*OPTIONAL*/,
368 /*IN*/ PVOID Base,
369 /*IN*/ SIZE_T Length);
371 NTOSAPI
372 BOOLEAN
373 DDKAPI
374 MmIsNonPagedSystemAddressValid(
375 /*IN*/ PVOID VirtualAddress);
377 NTOSAPI
378 LARGE_INTEGER
379 DDKAPI
380 RtlEnlargedIntegerMultiply(
381 /*IN*/ LONG Multiplicand,
382 /*IN*/ LONG Multiplier);
384 NTOSAPI
385 ULONG
386 DDKAPI
387 RtlEnlargedUnsignedDivide(
388 /*IN*/ ULARGE_INTEGER Dividend,
389 /*IN*/ ULONG Divisor,
390 /*IN OUT*/ PULONG Remainder);
392 NTOSAPI
393 LARGE_INTEGER
394 DDKAPI
395 RtlEnlargedUnsignedMultiply(
396 /*IN*/ ULONG Multiplicand,
397 /*IN*/ ULONG Multiplier);
399 NTOSAPI
400 LARGE_INTEGER
401 DDKAPI
402 RtlExtendedIntegerMultiply(
403 /*IN*/ LARGE_INTEGER Multiplicand,
404 /*IN*/ LONG Multiplier);
406 NTOSAPI
407 LARGE_INTEGER
408 DDKAPI
409 RtlExtendedLargeIntegerDivide(
410 /*IN*/ LARGE_INTEGER Dividend,
411 /*IN*/ ULONG Divisor,
412 /*IN OUT*/ PULONG Remainder);
414 NTOSAPI
415 LARGE_INTEGER
416 DDKAPI
417 RtlExtendedMagicDivide(
418 /*IN*/ LARGE_INTEGER Dividend,
419 /*IN*/ LARGE_INTEGER MagicDivisor,
420 /*IN*/ CCHAR ShiftCount);
422 NTOSAPI
423 LARGE_INTEGER
424 DDKAPI
425 RtlLargeIntegerAdd(
426 /*IN*/ LARGE_INTEGER Addend1,
427 /*IN*/ LARGE_INTEGER Addend2);
429 NTOSAPI
430 VOID
431 DDKAPI
432 RtlLargeIntegerAnd(
433 /*IN OUT*/ LARGE_INTEGER Result,
434 /*IN*/ LARGE_INTEGER Source,
435 /*IN*/ LARGE_INTEGER Mask);
437 NTOSAPI
438 LARGE_INTEGER
439 DDKAPI
440 RtlLargeIntegerArithmeticShift(
441 /*IN*/ LARGE_INTEGER LargeInteger,
442 /*IN*/ CCHAR ShiftCount);
444 NTOSAPI
445 LARGE_INTEGER
446 DDKAPI
447 RtlLargeIntegerDivide(
448 /*IN*/ LARGE_INTEGER Dividend,
449 /*IN*/ LARGE_INTEGER Divisor,
450 /*IN OUT*/ PLARGE_INTEGER Remainder);
452 NTOSAPI
453 BOOLEAN
454 DDKAPI
455 RtlLargeIntegerEqualTo(
456 /*IN*/ LARGE_INTEGER Operand1,
457 /*IN*/ LARGE_INTEGER Operand2);
459 NTOSAPI
460 BOOLEAN
461 DDKAPI
462 RtlLargeIntegerEqualToZero(
463 /*IN*/ LARGE_INTEGER Operand);
465 NTOSAPI
466 BOOLEAN
467 DDKAPI
468 RtlLargeIntegerGreaterOrEqualToZero(
469 /*IN*/ LARGE_INTEGER Operand);
471 NTOSAPI
472 BOOLEAN
473 DDKAPI
474 RtlLargeIntegerGreaterThan(
475 /*IN*/ LARGE_INTEGER Operand1,
476 /*IN*/ LARGE_INTEGER Operand2);
478 NTOSAPI
479 BOOLEAN
480 DDKAPI
481 RtlLargeIntegerGreaterThanOrEqualTo(
482 /*IN*/ LARGE_INTEGER Operand1,
483 /*IN*/ LARGE_INTEGER Operand2);
485 NTOSAPI
486 BOOLEAN
487 DDKAPI
488 RtlLargeIntegerGreaterThanZero(
489 /*IN*/ LARGE_INTEGER Operand);
491 NTOSAPI
492 BOOLEAN
493 DDKAPI
494 RtlLargeIntegerLessOrEqualToZero(
495 /*IN*/ LARGE_INTEGER Operand);
497 NTOSAPI
498 BOOLEAN
499 DDKAPI
500 RtlLargeIntegerLessThan(
501 /*IN*/ LARGE_INTEGER Operand1,
502 /*IN*/ LARGE_INTEGER Operand2);
504 NTOSAPI
505 BOOLEAN
506 DDKAPI
507 RtlLargeIntegerLessThanOrEqualTo(
508 /*IN*/ LARGE_INTEGER Operand1,
509 /*IN*/ LARGE_INTEGER Operand2);
511 NTOSAPI
512 BOOLEAN
513 DDKAPI
514 RtlLargeIntegerLessThanZero(
515 /*IN*/ LARGE_INTEGER Operand);
517 NTOSAPI
518 LARGE_INTEGER
519 DDKAPI
520 RtlLargeIntegerNegate(
521 /*IN*/ LARGE_INTEGER Subtrahend);
523 NTOSAPI
524 BOOLEAN
525 DDKAPI
526 RtlLargeIntegerNotEqualTo(
527 /*IN*/ LARGE_INTEGER Operand1,
528 /*IN*/ LARGE_INTEGER Operand2);
530 NTOSAPI
531 BOOLEAN
532 DDKAPI
533 RtlLargeIntegerNotEqualToZero(
534 /*IN*/ LARGE_INTEGER Operand);
536 NTOSAPI
537 LARGE_INTEGER
538 DDKAPI
539 RtlLargeIntegerShiftLeft(
540 /*IN*/ LARGE_INTEGER LargeInteger,
541 /*IN*/ CCHAR ShiftCount);
543 NTOSAPI
544 LARGE_INTEGER
545 DDKAPI
546 RtlLargeIntegerShiftRight(
547 /*IN*/ LARGE_INTEGER LargeInteger,
548 /*IN*/ CCHAR ShiftCount);
550 NTOSAPI
551 LARGE_INTEGER
552 DDKAPI
553 RtlLargeIntegerSubtract(
554 /*IN*/ LARGE_INTEGER Minuend,
555 /*IN*/ LARGE_INTEGER Subtrahend);
559 * ULONG
560 * COMPUTE_PAGES_SPANNED(
561 * IN PVOID Va,
562 * IN ULONG Size)
564 #define COMPUTE_PAGES_SPANNED(Va, \
565 Size) \
566 (ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size))
570 ** Architecture specific functions
573 #ifdef _X86_
575 NTOSAPI
576 INTERLOCKED_RESULT
577 DDKAPI
578 Exi386InterlockedIncrementLong(
579 /*IN*/ PLONG Addend);
581 NTOSAPI
582 INTERLOCKED_RESULT
583 DDKFASTAPI
584 Exfi386InterlockedIncrementLong(
585 /*IN*/ PLONG Addend);
587 NTOSAPI
588 INTERLOCKED_RESULT
589 DDKAPI
590 Exi386InterlockedDecrementLong(
591 /*IN*/ PLONG Addend);
593 NTOSAPI
594 INTERLOCKED_RESULT
595 DDKFASTAPI
596 Exfi386InterlockedDecrementLong(
597 /*IN*/ PLONG Addend);
599 NTOSAPI
600 ULONG
601 DDKAPI
602 Exi386InterlockedExchangeUlong(
603 /*IN*/ PULONG Target,
604 /*IN*/ ULONG Value);
606 NTOSAPI
607 ULONG
608 DDKFASTAPI
609 Exfi386InterlockedExchangeUlong(
610 /*IN*/ PULONG Target,
611 /*IN*/ ULONG Value);
613 #define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)
614 #define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)
615 #define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
617 #endif /* _X86_ */
619 #ifdef __cplusplus
621 #endif
623 #endif /* __WINNT4_H */