source: Daodan/MinGW/include/ddk/winnt4.h@ 1089

Last change on this file since 1089 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 12.0 KB
Line 
1/*
2 * winnt4.h
3 *
4 * Definitions only used in Windows NT 4.0 and earlier versions
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
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.
20 *
21 */
22
23#ifndef __WINNT4_H
24#define __WINNT4_H
25
26#if __GNUC__ >=3
27#pragma GCC system_header
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef struct _ZONE_SEGMENT_HEADER {
35 SINGLE_LIST_ENTRY SegmentList;
36 PVOID Reserved;
37} ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER;
38
39typedef struct _ZONE_HEADER {
40 SINGLE_LIST_ENTRY FreeList;
41 SINGLE_LIST_ENTRY SegmentList;
42 ULONG BlockSize;
43 ULONG TotalSegmentSize;
44} ZONE_HEADER, *PZONE_HEADER;
45
46static __inline PVOID
47ExAllocateFromZone(
48 /*IN*/ PZONE_HEADER Zone)
49{
50 if (Zone->FreeList.Next)
51 Zone->FreeList.Next = Zone->FreeList.Next->Next;
52 return (PVOID) Zone->FreeList.Next;
53}
54
55NTOSAPI
56NTSTATUS
57DDKAPI
58ExExtendZone(
59 /*IN*/ PZONE_HEADER Zone,
60 /*IN*/ PVOID Segment,
61 /*IN*/ ULONG SegmentSize);
62
63static __inline PVOID
64ExFreeToZone(
65 /*IN*/ PZONE_HEADER Zone,
66 /*IN*/ PVOID Block)
67{
68 ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next;
69 Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block);
70 return ((PSINGLE_LIST_ENTRY) Block)->Next;
71}
72
73NTOSAPI
74NTSTATUS
75DDKAPI
76ExInitializeZone(
77 /*IN*/ PZONE_HEADER Zone,
78 /*IN*/ ULONG BlockSize,
79 /*IN*/ PVOID InitialSegment,
80 /*IN*/ ULONG InitialSegmentSize);
81
82/*
83 * PVOID
84 * ExInterlockedAllocateFromZone(
85 * IN PZONE_HEADER Zone,
86 * IN PKSPIN_LOCK Lock)
87 */
88#define ExInterlockedAllocateFromZone(Zone, \
89 Lock) \
90 ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
91
92NTOSAPI
93NTSTATUS
94DDKAPI
95ExInterlockedExtendZone(
96 /*IN*/ PZONE_HEADER Zone,
97 /*IN*/ PVOID Segment,
98 /*IN*/ ULONG SegmentSize,
99 /*IN*/ PKSPIN_LOCK Lock);
100
101NTOSAPI
102PVOID
103DDKAPI
104ExInterlockedFreeToZone(
105 /*IN*/ PZONE_HEADER Zone,
106 /*IN*/ PVOID Block,
107 /*IN*/ PKSPIN_LOCK Lock);
108
109/*
110 * VOID
111 * ExInitializeWorkItem(
112 * IN PWORK_QUEUE_ITEM Item,
113 * IN PWORKER_THREAD_ROUTINE Routine,
114 * IN PVOID Context)
115 */
116#define ExInitializeWorkItem(Item, \
117 Routine, \
118 Context) \
119{ \
120 (Item)->WorkerRoutine = Routine; \
121 (Item)->Parameter = Context; \
122 (Item)->List.Flink = NULL; \
123}
124
125/*
126 * BOOLEAN
127 * ExIsFullZone(
128 * IN PZONE_HEADER Zone)
129 */
130#define ExIsFullZone(Zone) \
131 ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
132
133NTOSAPI
134VOID
135DDKAPI
136ExQueueWorkItem(
137 /*IN*/ PWORK_QUEUE_ITEM WorkItem,
138 /*IN*/ WORK_QUEUE_TYPE QueueType);
139
140NTOSAPI
141BOOLEAN
142DDKAPI
143ExIsObjectInFirstZoneSegment(
144 /*IN*/ PZONE_HEADER Zone,
145 /*IN*/ PVOID Object);
146
147NTOSAPI
148VOID
149DDKAPI
150ExReleaseResource(
151 /*IN*/ PERESOURCE Resource);
152
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
162
163NTOSAPI
164INTERLOCKED_RESULT
165DDKAPI
166ExInterlockedDecrementLong(
167 /*IN*/ PLONG Addend,
168 /*IN*/ PKSPIN_LOCK Lock);
169
170NTOSAPI
171ULONG
172DDKAPI
173ExInterlockedExchangeUlong(
174 /*IN*/ PULONG Target,
175 /*IN*/ ULONG Value,
176 /*IN*/ PKSPIN_LOCK Lock);
177
178NTOSAPI
179INTERLOCKED_RESULT
180DDKAPI
181ExInterlockedIncrementLong(
182 /*IN*/ PLONG Addend,
183 /*IN*/ PKSPIN_LOCK Lock);
184
185NTOSAPI
186PVOID
187DDKAPI
188HalAllocateCommonBuffer(
189 /*IN*/ PADAPTER_OBJECT AdapterObject,
190 /*IN*/ ULONG Length,
191 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress,
192 /*IN*/ BOOLEAN CacheEnabled);
193
194NTOSAPI
195NTSTATUS
196DDKAPI
197HalAssignSlotResources(
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);
206
207NTOSAPI
208VOID
209DDKAPI
210HalFreeCommonBuffer(
211 /*IN*/ PADAPTER_OBJECT AdapterObject,
212 /*IN*/ ULONG Length,
213 /*IN*/ PHYSICAL_ADDRESS LogicalAddress,
214 /*IN*/ PVOID VirtualAddress,
215 /*IN*/ BOOLEAN CacheEnabled);
216
217NTOSAPI
218PADAPTER_OBJECT
219DDKAPI
220HalGetAdapter(
221 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription,
222 /*IN OUT*/ PULONG NumberOfMapRegisters);
223
224NTOSAPI
225ULONG
226DDKAPI
227HalGetBusData(
228 /*IN*/ BUS_DATA_TYPE BusDataType,
229 /*IN*/ ULONG BusNumber,
230 /*IN*/ ULONG SlotNumber,
231 /*IN*/ PVOID Buffer,
232 /*IN*/ ULONG Length);
233
234NTOSAPI
235ULONG
236DDKAPI
237HalGetBusDataByOffset(
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);
244
245NTOSAPI
246ULONG
247DDKAPI
248HalGetDmaAlignmentRequirement(
249 VOID);
250
251NTOSAPI
252ULONG
253DDKAPI
254HalGetInterruptVector(
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);
261
262NTOSAPI
263ULONG
264DDKAPI
265HalReadDmaCounter(
266 /*IN*/ PADAPTER_OBJECT AdapterObject);
267
268NTOSAPI
269ULONG
270DDKAPI
271HalSetBusData(
272 /*IN*/ BUS_DATA_TYPE BusDataType,
273 /*IN*/ ULONG BusNumber,
274 /*IN*/ ULONG SlotNumber,
275 /*IN*/ PVOID Buffer,
276 /*IN*/ ULONG Length);
277
278NTOSAPI
279ULONG
280DDKAPI
281HalSetBusDataByOffset(
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);
288
289NTOSAPI
290BOOLEAN
291DDKAPI
292HalTranslateBusAddress(
293 /*IN*/ INTERFACE_TYPE InterfaceType,
294 /*IN*/ ULONG BusNumber,
295 /*IN*/ PHYSICAL_ADDRESS BusAddress,
296 /*IN OUT*/ PULONG AddressSpace,
297 /*OUT*/ PPHYSICAL_ADDRESS TranslatedAddress);
298
299NTOSAPI
300NTSTATUS
301DDKAPI
302IoAllocateAdapterChannel(
303 /*IN*/ PADAPTER_OBJECT AdapterObject,
304 /*IN*/ PDEVICE_OBJECT DeviceObject,
305 /*IN*/ ULONG NumberOfMapRegisters,
306 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
307 /*IN*/ PVOID Context);
308
309NTOSAPI
310NTSTATUS
311DDKAPI
312IoAssignResources(
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);
319
320NTOSAPI
321NTSTATUS
322DDKAPI
323IoAttachDeviceByPointer(
324 /*IN*/ PDEVICE_OBJECT SourceDevice,
325 /*IN*/ PDEVICE_OBJECT TargetDevice);
326
327NTOSAPI
328BOOLEAN
329DDKAPI
330IoFlushAdapterBuffers(
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);
337
338NTOSAPI
339VOID
340DDKAPI
341IoFreeAdapterChannel(
342 /*IN*/ PADAPTER_OBJECT AdapterObject);
343
344NTOSAPI
345VOID
346DDKAPI
347IoFreeMapRegisters(
348 /*IN*/ PADAPTER_OBJECT AdapterObject,
349 /*IN*/ PVOID MapRegisterBase,
350 /*IN*/ ULONG NumberOfMapRegisters);
351
352NTOSAPI
353PHYSICAL_ADDRESS
354DDKAPI
355IoMapTransfer(
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);
362
363NTOSAPI
364PMDL
365DDKAPI
366MmCreateMdl(
367 /*IN*/ PMDL MemoryDescriptorList /*OPTIONAL*/,
368 /*IN*/ PVOID Base,
369 /*IN*/ SIZE_T Length);
370
371NTOSAPI
372BOOLEAN
373DDKAPI
374MmIsNonPagedSystemAddressValid(
375 /*IN*/ PVOID VirtualAddress);
376
377NTOSAPI
378LARGE_INTEGER
379DDKAPI
380RtlEnlargedIntegerMultiply(
381 /*IN*/ LONG Multiplicand,
382 /*IN*/ LONG Multiplier);
383
384NTOSAPI
385ULONG
386DDKAPI
387RtlEnlargedUnsignedDivide(
388 /*IN*/ ULARGE_INTEGER Dividend,
389 /*IN*/ ULONG Divisor,
390 /*IN OUT*/ PULONG Remainder);
391
392NTOSAPI
393LARGE_INTEGER
394DDKAPI
395RtlEnlargedUnsignedMultiply(
396 /*IN*/ ULONG Multiplicand,
397 /*IN*/ ULONG Multiplier);
398
399NTOSAPI
400LARGE_INTEGER
401DDKAPI
402RtlExtendedIntegerMultiply(
403 /*IN*/ LARGE_INTEGER Multiplicand,
404 /*IN*/ LONG Multiplier);
405
406NTOSAPI
407LARGE_INTEGER
408DDKAPI
409RtlExtendedLargeIntegerDivide(
410 /*IN*/ LARGE_INTEGER Dividend,
411 /*IN*/ ULONG Divisor,
412 /*IN OUT*/ PULONG Remainder);
413
414NTOSAPI
415LARGE_INTEGER
416DDKAPI
417RtlExtendedMagicDivide(
418 /*IN*/ LARGE_INTEGER Dividend,
419 /*IN*/ LARGE_INTEGER MagicDivisor,
420 /*IN*/ CCHAR ShiftCount);
421
422NTOSAPI
423LARGE_INTEGER
424DDKAPI
425RtlLargeIntegerAdd(
426 /*IN*/ LARGE_INTEGER Addend1,
427 /*IN*/ LARGE_INTEGER Addend2);
428
429NTOSAPI
430VOID
431DDKAPI
432RtlLargeIntegerAnd(
433 /*IN OUT*/ LARGE_INTEGER Result,
434 /*IN*/ LARGE_INTEGER Source,
435 /*IN*/ LARGE_INTEGER Mask);
436
437NTOSAPI
438LARGE_INTEGER
439DDKAPI
440RtlLargeIntegerArithmeticShift(
441 /*IN*/ LARGE_INTEGER LargeInteger,
442 /*IN*/ CCHAR ShiftCount);
443
444NTOSAPI
445LARGE_INTEGER
446DDKAPI
447RtlLargeIntegerDivide(
448 /*IN*/ LARGE_INTEGER Dividend,
449 /*IN*/ LARGE_INTEGER Divisor,
450 /*IN OUT*/ PLARGE_INTEGER Remainder);
451
452NTOSAPI
453BOOLEAN
454DDKAPI
455RtlLargeIntegerEqualTo(
456 /*IN*/ LARGE_INTEGER Operand1,
457 /*IN*/ LARGE_INTEGER Operand2);
458
459NTOSAPI
460BOOLEAN
461DDKAPI
462RtlLargeIntegerEqualToZero(
463 /*IN*/ LARGE_INTEGER Operand);
464
465NTOSAPI
466BOOLEAN
467DDKAPI
468RtlLargeIntegerGreaterOrEqualToZero(
469 /*IN*/ LARGE_INTEGER Operand);
470
471NTOSAPI
472BOOLEAN
473DDKAPI
474RtlLargeIntegerGreaterThan(
475 /*IN*/ LARGE_INTEGER Operand1,
476 /*IN*/ LARGE_INTEGER Operand2);
477
478NTOSAPI
479BOOLEAN
480DDKAPI
481RtlLargeIntegerGreaterThanOrEqualTo(
482 /*IN*/ LARGE_INTEGER Operand1,
483 /*IN*/ LARGE_INTEGER Operand2);
484
485NTOSAPI
486BOOLEAN
487DDKAPI
488RtlLargeIntegerGreaterThanZero(
489 /*IN*/ LARGE_INTEGER Operand);
490
491NTOSAPI
492BOOLEAN
493DDKAPI
494RtlLargeIntegerLessOrEqualToZero(
495 /*IN*/ LARGE_INTEGER Operand);
496
497NTOSAPI
498BOOLEAN
499DDKAPI
500RtlLargeIntegerLessThan(
501 /*IN*/ LARGE_INTEGER Operand1,
502 /*IN*/ LARGE_INTEGER Operand2);
503
504NTOSAPI
505BOOLEAN
506DDKAPI
507RtlLargeIntegerLessThanOrEqualTo(
508 /*IN*/ LARGE_INTEGER Operand1,
509 /*IN*/ LARGE_INTEGER Operand2);
510
511NTOSAPI
512BOOLEAN
513DDKAPI
514RtlLargeIntegerLessThanZero(
515 /*IN*/ LARGE_INTEGER Operand);
516
517NTOSAPI
518LARGE_INTEGER
519DDKAPI
520RtlLargeIntegerNegate(
521 /*IN*/ LARGE_INTEGER Subtrahend);
522
523NTOSAPI
524BOOLEAN
525DDKAPI
526RtlLargeIntegerNotEqualTo(
527 /*IN*/ LARGE_INTEGER Operand1,
528 /*IN*/ LARGE_INTEGER Operand2);
529
530NTOSAPI
531BOOLEAN
532DDKAPI
533RtlLargeIntegerNotEqualToZero(
534 /*IN*/ LARGE_INTEGER Operand);
535
536NTOSAPI
537LARGE_INTEGER
538DDKAPI
539RtlLargeIntegerShiftLeft(
540 /*IN*/ LARGE_INTEGER LargeInteger,
541 /*IN*/ CCHAR ShiftCount);
542
543NTOSAPI
544LARGE_INTEGER
545DDKAPI
546RtlLargeIntegerShiftRight(
547 /*IN*/ LARGE_INTEGER LargeInteger,
548 /*IN*/ CCHAR ShiftCount);
549
550NTOSAPI
551LARGE_INTEGER
552DDKAPI
553RtlLargeIntegerSubtract(
554 /*IN*/ LARGE_INTEGER Minuend,
555 /*IN*/ LARGE_INTEGER Subtrahend);
556
557
558/*
559 * ULONG
560 * COMPUTE_PAGES_SPANNED(
561 * IN PVOID Va,
562 * IN ULONG Size)
563 */
564#define COMPUTE_PAGES_SPANNED(Va, \
565 Size) \
566 (ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size))
567
568
569/*
570** Architecture specific functions
571*/
572
573#ifdef _X86_
574
575NTOSAPI
576INTERLOCKED_RESULT
577DDKAPI
578Exi386InterlockedIncrementLong(
579 /*IN*/ PLONG Addend);
580
581NTOSAPI
582INTERLOCKED_RESULT
583DDKFASTAPI
584Exfi386InterlockedIncrementLong(
585 /*IN*/ PLONG Addend);
586
587NTOSAPI
588INTERLOCKED_RESULT
589DDKAPI
590Exi386InterlockedDecrementLong(
591 /*IN*/ PLONG Addend);
592
593NTOSAPI
594INTERLOCKED_RESULT
595DDKFASTAPI
596Exfi386InterlockedDecrementLong(
597 /*IN*/ PLONG Addend);
598
599NTOSAPI
600ULONG
601DDKAPI
602Exi386InterlockedExchangeUlong(
603 /*IN*/ PULONG Target,
604 /*IN*/ ULONG Value);
605
606NTOSAPI
607ULONG
608DDKFASTAPI
609Exfi386InterlockedExchangeUlong(
610 /*IN*/ PULONG Target,
611 /*IN*/ ULONG Value);
612
613#define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)
614#define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)
615#define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
616
617#endif /* _X86_ */
618
619#ifdef __cplusplus
620}
621#endif
622
623#endif /* __WINNT4_H */
Note: See TracBrowser for help on using the repository browser.