2
* Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
22
#define PASSIVE_LEVEL 0
23
#define DISPATCH_LEVEL 2
25
#define STATUS_WAIT_0 0
26
#define STATUS_SUCCESS 0
27
#define STATUS_ALERTED 0x00000101
28
#define STATUS_TIMEOUT 0x00000102
29
#define STATUS_PENDING 0x00000103
30
#define STATUS_FAILURE 0xC0000001
31
#define STATUS_INVALID_PARAMETER 0xC000000D
32
#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
33
#define STATUS_BUFFER_TOO_SMALL 0xC0000023
34
#define STATUS_RESOURCES 0xC000009A
35
#define STATUS_NOT_SUPPORTED 0xC00000BB
36
#define STATUS_INVALID_PARAMETER 0xC000000D
37
#define STATUS_INVALID_PARAMETER_2 0xC00000F0
38
#define STATUS_CANCELLED 0xC0000120
40
#define IS_PENDING 0x01
41
#define CALL_ON_CANCEL 0x20
42
#define CALL_ON_SUCCESS 0x40
43
#define CALL_ON_ERROR 0x80
45
#define IRP_MJ_CREATE 0x0
46
#define IRP_MJ_DEVICE_CONTROL 0x0E
47
#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0F
48
#define IRP_MJ_MAXIMUM_FUNCTION 0x1b
50
#define THREAD_WAIT_OBJECTS 3
51
#define MAX_WAIT_OBJECTS 64
53
#define NOTIFICATION_TIMER 1
55
#define LOW_PRIORITY 1
56
#define LOW_REALTIME_PRIORITY 16
57
#define HIGH_PRIORITY 32
58
#define MAXIMUM_PRIORITY 32
63
#define FASTCALL_DECL_1(decl1) decl1
64
#define FASTCALL_DECL_2(decl1,decl2) decl1, decl2
65
#define FASTCALL_DECL_3(decl1,decl2,decl3) decl1, decl2, decl3
66
#define FASTCALL_ARGS_1(arg1) arg1
67
#define FASTCALL_ARGS_2(arg1,arg2) arg1, arg2
68
#define FASTCALL_ARGS_3(arg1,arg2,arg3) arg1, arg2, arg3
70
#define STDCALL __attribute__((__stdcall__, regparm(0)))
71
#define _FASTCALL __attribute__((__stdcall__)) __attribute__((regparm (3)))
72
#define FASTCALL_DECL_1(decl1) int _dummy1_, int _dummy2_, decl1
73
#define FASTCALL_DECL_2(decl1,decl2) int _dummy1_, decl2, decl1
74
#define FASTCALL_DECL_3(decl1,decl2,decl3) int _dummy1_, decl2, decl1, decl3
75
#define FASTCALL_ARGS_1(arg1) 0, 0, arg1
76
#define FASTCALL_ARGS_2(arg1,arg2) 0, arg2, arg1
77
#define FASTCALL_ARGS_3(arg1,arg2,arg3) 0, arg2, arg1, arg3
80
#define NOREGPARM __attribute__((regparm(0)))
81
#define packed __attribute__((packed))
96
typedef u64 ULONGLONG;
97
typedef u64 ULONGULONG;
100
typedef SHORT wchar_t;
101
typedef SHORT CSHORT;
102
typedef long long LARGE_INTEGER;
104
typedef LONG NTSTATUS;
106
typedef LONG KPRIORITY;
107
typedef LARGE_INTEGER PHYSICAL_ADDRESS;
109
typedef CHAR KPROCESSOR_MODE;
111
/* ULONG_PTR is 32 bits on 32-bit platforms and 64 bits on 64-bit
112
* platform, which is same as 'unsigned long' in Linux */
113
typedef unsigned long ULONG_PTR;
115
typedef ULONG_PTR SIZE_T;
116
typedef ULONG_PTR KAFFINITY;
124
struct unicode_string {
131
struct slist_entry *next;
137
struct slist_entry *next;
144
struct list_entry *fwd_link;
145
struct list_entry *bwd_link;
148
struct dispatch_header {
154
struct list_head wait_list_head;
158
struct dispatch_header header;
161
typedef ULONG_PTR KSPIN_LOCK;
167
struct list_entry dpc_list_entry;
179
NonPagedPoolMustSucceed,
181
NonPagedPoolCacheAligned,
182
PagedPoolCacheAligned,
183
NonPagedPoolCacheAlignedMustS
186
enum memory_caching_type_orig {
187
MmFrameBufferCached = 2
190
enum memory_caching_type {
193
MmWriteCombined = MmFrameBufferCached,
194
MmHardwareCoherentCached,
195
MmNonCachedUnordered,
200
enum lock_operation {
211
void *mappedsystemva;
217
#define MDL_MAPPED_TO_SYSTEM_VA 0x0001
218
#define MDL_PAGES_LOCKED 0x0002
219
#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
220
#define MDL_ALLOCATED_FIXED_SIZE 0x0008
221
#define MDL_PARTIAL 0x0010
222
#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
223
#define MDL_IO_PAGE_READ 0x0040
224
#define MDL_WRITE_OPERATION 0x0080
225
#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
226
#define MDL_FREE_EXTRA_PTES 0x0200
227
#define MDL_IO_SPACE 0x0800
228
#define MDL_NETWORK_HEADER 0x1000
229
#define MDL_MAPPING_CAN_FAIL 0x2000
230
#define MDL_ALLOCATED_MUST_SUCCEED 0x4000
231
#define MDL_CACHE_ALLOCATED 0x8000
233
#define MmGetMdlBaseVa(mdl) ((mdl)->startva)
234
#define MmGetMdlByteCount(mdl) ((mdl)->bytecount)
235
#define MmGetMdlVirtualAddress(mdl) ((void *)((char *)(mdl)->startva + \
237
#define MmGetMdlByteOffset(mdl) ((mdl)->byteoffset)
238
#define MmGetSystemAddressForMdl(mdl) ((mdl)->mappedsystemva)
239
#define MmInitializeMdl(mdl, baseva, length) { \
240
(mdl)->next = NULL; \
241
(mdl)->size = MmSizeOfMdl(baseva, length); \
243
(mdl)->startva = (void *)((ULONG_PTR)baseva & \
245
(mdl)->byteoffset = (ULONG)((ULONG_PTR)baseva & \
247
(mdl)->bytecount = length; \
250
struct device_queue_entry {
251
struct list_entry list_entry;
256
struct wait_ctx_block {
257
struct device_queue_entry wait_queue_entry;
262
void *buffer_chaining_dpc;
265
struct kdevice_queue {
268
struct list_entry devlist_head;
276
struct device_object {
281
struct device_object *next_dev;
283
struct irp *current_irp;
286
ULONG characteristics;
291
struct list_entry list_entry;
292
struct wait_ctx_block wcb;
295
struct kdevice_queue dev_queue;
299
struct kevent dev_lock;
305
/* ndiswrapper-specific data */
307
struct usb_device *usb;
312
struct io_status_block {
318
#define POINTER_ALIGNMENT
320
#define POINTER_ALIGNMENT __attribute__((aligned(8)))
323
#ifndef CONFIG_X86_64
326
struct io_stack_location {
333
void *security_context;
335
USHORT POINTER_ALIGNMENT file_attributes;
337
ULONG POINTER_ALIGNMENT ea_length;
341
ULONG POINTER_ALIGNMENT key;
342
LARGE_INTEGER byte_offset;
344
/* FIXME: this structure is not complete */
346
ULONG output_buf_len;
347
ULONG input_buf_len; /*align to pointer size*/
348
ULONG code; /*align to pointer size*/
349
void *type3_input_buf;
358
struct device_object *dev_obj;
360
ULONG (*completion_handler)(struct device_object *,
361
struct irp *, void *) STDCALL;
364
#ifndef CONFIG_X86_64
372
struct kthread *thread;
373
struct list_entry apc_list_entry;
374
void *kernele_routine;
375
void *rundown_routine;
376
void *normal_routine;
377
void *normal_context;
380
CCHAR apc_state_index;
381
KPROCESSOR_MODE apc_mode;
385
struct kdevice_queue_entry {
386
struct list_entry dev_list_entry;
403
struct irp *master_irp;
407
struct list_entry thread_list_entry;
409
struct io_status_block io_status;
410
KPROCESSOR_MODE requestor_mode;
411
BOOLEAN pending_returned;
420
struct io_status_block *user_status;
421
struct kevent *user_event;
425
void *user_apc_routine;
426
void *user_apc_context;
428
LARGE_INTEGER alloc_size;
431
void (*cancel_routine)(struct device_object *, struct irp *) STDCALL;
437
struct kdevice_queue_entry dev_q_entry;
439
void *driver_context[4];
445
struct list_entry list_entry;
447
struct io_stack_location *
448
current_stack_location;
455
void *completion_key;
458
/* ndiswrapper extension */
459
enum irp_work_type irp_work_type;
460
struct list_head completed_list;
461
struct list_head cancel_list;
464
#define IRP_CUR_STACK_LOC(irp) \
465
(irp)->tail.overlay.packet_list.packet.current_stack_location
466
#define IRP_DRIVER_CONTEXT(irp) \
467
(irp)->tail.overlay.dev_q.context.driver_context
476
struct common_body_header {
481
struct object_header {
482
struct unicode_string name;
483
struct list_entry entry;
486
BOOLEAN close_in_process;
497
struct dispatch_header dispatch_header;
499
struct list_entry timer_list;
500
/* the space for kdpc is used for wrapper timer */
501
/* struct kdpc *kdpc; */
502
struct wrapper_timer *wrapper_timer;
507
struct dispatch_header dispatch_header;
509
struct list_entry list_entry;
517
enum work_queue_type {
520
HyperCriticalWorkQueue,
530
struct list_entry list_entry;
532
struct dispatch_header *object;
533
struct wait_block *next;
543
enum mm_page_priority {
545
NormalPagePriority = 16,
546
HighPagePriority = 32
549
enum kinterrupt_mode {
554
enum ntos_wait_reason {
585
typedef enum ntos_wait_reason KWAIT_REASON;
587
typedef STDCALL void *LOOKASIDE_ALLOC_FUNC(enum pool_type pool_type,
588
SIZE_T size, ULONG tag);
589
typedef STDCALL void LOOKASIDE_FREE_FUNC(void *);
591
struct npaged_lookaside_list {
592
union slist_head head;
599
enum pool_type pool_type;
602
LOOKASIDE_ALLOC_FUNC *alloc_func;
603
LOOKASIDE_FREE_FUNC *free_func;
604
struct list_entry listent;
606
ULONG lastallocmisses;
611
enum device_registry_property {
612
DevicePropertyDeviceDescription,
613
DevicePropertyHardwareID,
614
DevicePropertyCompatibleIDs,
615
DevicePropertyBootConfiguration,
616
DevicePropertyBootConfigurationTranslated,
617
DevicePropertyClassName,
618
DevicePropertyClassGuid,
619
DevicePropertyDriverKeyName,
620
DevicePropertyManufacturer,
621
DevicePropertyFriendlyName,
622
DevicePropertyLocationInformation,
623
DevicePropertyPhysicalDeviceObjectName,
624
DevicePropertyBusTypeGuid,
625
DevicePropertyLegacyBusType,
626
DevicePropertyBusNumber,
627
DevicePropertyEnumeratorName,
628
DevicePropertyAddress,
629
DevicePropertyUINumber,
630
DevicePropertyInstallState,
631
DevicePropertyRemovalPolicy
634
enum trace_information_class {
637
TraceEnableFlagsClass,
638
TraceEnableLevelClass,
639
GlobalLoggerHandleClass,
640
EventLoggerHandleClass,
641
AllLoggerHandlesClass,
642
TraceHandleByNameClass
645
#endif /* WINNT_TYPES_H */