ntoskrnl_var.h (186507) | ntoskrnl_var.h (189488) |
---|---|
1/*- 2 * Copyright (c) 2003 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * | 1/*- 2 * Copyright (c) 2003 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/sys/compat/ndis/ntoskrnl_var.h 186507 2008-12-27 08:03:32Z weongyo $ | 32 * $FreeBSD: head/sys/compat/ndis/ntoskrnl_var.h 189488 2009-03-07 07:26:22Z weongyo $ |
33 */ 34 35#ifndef _NTOSKRNL_VAR_H_ | 33 */ 34 35#ifndef _NTOSKRNL_VAR_H_ |
36#define _NTOSKRNL_VAR_H_ | 36#define _NTOSKRNL_VAR_H_ |
37 | 37 |
38#define MTX_NTOSKRNL_SPIN_LOCK "NDIS thread lock" | 38#define MTX_NTOSKRNL_SPIN_LOCK "NDIS thread lock" |
39 40/* 41 * us_buf is really a wchar_t *, but it's inconvenient to include 42 * all the necessary header goop needed to define it, and it's a 43 * pointer anyway, so for now, just make it a uint16_t *. 44 */ 45struct unicode_string { 46 uint16_t us_len; --- 30 unchanged lines hidden (view full) --- 77 * of buffers is never needed. 78 * 79 * - Kernel pages can never be paged out, so we don't have to worry 80 * about whether or not a page is actually mapped before going to 81 * touch it. 82 */ 83 84struct mdl { | 39 40/* 41 * us_buf is really a wchar_t *, but it's inconvenient to include 42 * all the necessary header goop needed to define it, and it's a 43 * pointer anyway, so for now, just make it a uint16_t *. 44 */ 45struct unicode_string { 46 uint16_t us_len; --- 30 unchanged lines hidden (view full) --- 77 * of buffers is never needed. 78 * 79 * - Kernel pages can never be paged out, so we don't have to worry 80 * about whether or not a page is actually mapped before going to 81 * touch it. 82 */ 83 84struct mdl { |
85 struct mdl *mdl_next; | 85 struct mdl *mdl_next; |
86 uint16_t mdl_size; 87 uint16_t mdl_flags; 88 void *mdl_process; 89 void *mdl_mappedsystemva; 90 void *mdl_startva; 91 uint32_t mdl_bytecount; 92 uint32_t mdl_byteoffset; 93}; 94 95typedef struct mdl mdl, ndis_buffer; 96 97/* MDL flags */ 98 | 86 uint16_t mdl_size; 87 uint16_t mdl_flags; 88 void *mdl_process; 89 void *mdl_mappedsystemva; 90 void *mdl_startva; 91 uint32_t mdl_bytecount; 92 uint32_t mdl_byteoffset; 93}; 94 95typedef struct mdl mdl, ndis_buffer; 96 97/* MDL flags */ 98 |
99#define MDL_MAPPED_TO_SYSTEM_VA 0x0001 100#define MDL_PAGES_LOCKED 0x0002 101#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004 102#define MDL_ALLOCATED_FIXED_SIZE 0x0008 103#define MDL_PARTIAL 0x0010 104#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020 105#define MDL_IO_PAGE_READ 0x0040 106#define MDL_WRITE_OPERATION 0x0080 107#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100 108#define MDL_FREE_EXTRA_PTES 0x0200 109#define MDL_IO_SPACE 0x0800 110#define MDL_NETWORK_HEADER 0x1000 111#define MDL_MAPPING_CAN_FAIL 0x2000 112#define MDL_ALLOCATED_MUST_SUCCEED 0x4000 113#define MDL_ZONE_ALLOCED 0x8000 /* BSD private */ | 99#define MDL_MAPPED_TO_SYSTEM_VA 0x0001 100#define MDL_PAGES_LOCKED 0x0002 101#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004 102#define MDL_ALLOCATED_FIXED_SIZE 0x0008 103#define MDL_PARTIAL 0x0010 104#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020 105#define MDL_IO_PAGE_READ 0x0040 106#define MDL_WRITE_OPERATION 0x0080 107#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100 108#define MDL_FREE_EXTRA_PTES 0x0200 109#define MDL_IO_SPACE 0x0800 110#define MDL_NETWORK_HEADER 0x1000 111#define MDL_MAPPING_CAN_FAIL 0x2000 112#define MDL_ALLOCATED_MUST_SUCCEED 0x4000 113#define MDL_ZONE_ALLOCED 0x8000 /* BSD private */ |
114 | 114 |
115#define MDL_ZONE_PAGES 16 116#define MDL_ZONE_SIZE (sizeof(mdl) + (sizeof(vm_offset_t) * MDL_ZONE_PAGES)) | 115#define MDL_ZONE_PAGES 16 116#define MDL_ZONE_SIZE (sizeof(mdl) + (sizeof(vm_offset_t) * MDL_ZONE_PAGES)) |
117 118/* Note: assumes x86 page size of 4K. */ 119 120#ifndef PAGE_SHIFT 121#if PAGE_SIZE == 4096 | 117 118/* Note: assumes x86 page size of 4K. */ 119 120#ifndef PAGE_SHIFT 121#if PAGE_SIZE == 4096 |
122#define PAGE_SHIFT 12 | 122#define PAGE_SHIFT 12 |
123#elif PAGE_SIZE == 8192 | 123#elif PAGE_SIZE == 8192 |
124#define PAGE_SHIFT 13 | 124#define PAGE_SHIFT 13 |
125#else 126#error PAGE_SHIFT undefined! 127#endif 128#endif 129 | 125#else 126#error PAGE_SHIFT undefined! 127#endif 128#endif 129 |
130#define SPAN_PAGES(ptr, len) \ | 130#define SPAN_PAGES(ptr, len) \ |
131 ((uint32_t)((((uintptr_t)(ptr) & (PAGE_SIZE - 1)) + \ 132 (len) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)) 133 | 131 ((uint32_t)((((uintptr_t)(ptr) & (PAGE_SIZE - 1)) + \ 132 (len) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)) 133 |
134#define PAGE_ALIGN(ptr) \ | 134#define PAGE_ALIGN(ptr) \ |
135 ((void *)((uintptr_t)(ptr) & ~(PAGE_SIZE - 1))) 136 | 135 ((void *)((uintptr_t)(ptr) & ~(PAGE_SIZE - 1))) 136 |
137#define BYTE_OFFSET(ptr) \ | 137#define BYTE_OFFSET(ptr) \ |
138 ((uint32_t)((uintptr_t)(ptr) & (PAGE_SIZE - 1))) 139 | 138 ((uint32_t)((uintptr_t)(ptr) & (PAGE_SIZE - 1))) 139 |
140#define MDL_PAGES(m) (vm_offset_t *)(m + 1) | 140#define MDL_PAGES(m) (vm_offset_t *)(m + 1) |
141 | 141 |
142#define MmInitializeMdl(b, baseva, len) \ | 142#define MmInitializeMdl(b, baseva, len) \ |
143 (b)->mdl_next = NULL; \ 144 (b)->mdl_size = (uint16_t)(sizeof(mdl) + \ 145 (sizeof(vm_offset_t) * SPAN_PAGES((baseva), (len)))); \ 146 (b)->mdl_flags = 0; \ 147 (b)->mdl_startva = (void *)PAGE_ALIGN((baseva)); \ 148 (b)->mdl_byteoffset = BYTE_OFFSET((baseva)); \ 149 (b)->mdl_bytecount = (uint32_t)(len); 150 | 143 (b)->mdl_next = NULL; \ 144 (b)->mdl_size = (uint16_t)(sizeof(mdl) + \ 145 (sizeof(vm_offset_t) * SPAN_PAGES((baseva), (len)))); \ 146 (b)->mdl_flags = 0; \ 147 (b)->mdl_startva = (void *)PAGE_ALIGN((baseva)); \ 148 (b)->mdl_byteoffset = BYTE_OFFSET((baseva)); \ 149 (b)->mdl_bytecount = (uint32_t)(len); 150 |
151#define MmGetMdlByteOffset(mdl) ((mdl)->mdl_byteoffset) 152#define MmGetMdlByteCount(mdl) ((mdl)->mdl_bytecount) 153#define MmGetMdlVirtualAddress(mdl) \ | 151#define MmGetMdlByteOffset(mdl) ((mdl)->mdl_byteoffset) 152#define MmGetMdlByteCount(mdl) ((mdl)->mdl_bytecount) 153#define MmGetMdlVirtualAddress(mdl) \ |
154 ((void *)((char *)((mdl)->mdl_startva) + (mdl)->mdl_byteoffset)) | 154 ((void *)((char *)((mdl)->mdl_startva) + (mdl)->mdl_byteoffset)) |
155#define MmGetMdlStartVa(mdl) ((mdl)->mdl_startva) 156#define MmGetMdlPfnArray(mdl) MDL_PAGES(mdl) | 155#define MmGetMdlStartVa(mdl) ((mdl)->mdl_startva) 156#define MmGetMdlPfnArray(mdl) MDL_PAGES(mdl) |
157 | 157 |
158#define WDM_MAJOR 1 159#define WDM_MINOR_WIN98 0x00 160#define WDM_MINOR_WINME 0x05 161#define WDM_MINOR_WIN2000 0x10 162#define WDM_MINOR_WINXP 0x20 163#define WDM_MINOR_WIN2003 0x30 | 158#define WDM_MAJOR 1 159#define WDM_MINOR_WIN98 0x00 160#define WDM_MINOR_WINME 0x05 161#define WDM_MINOR_WIN2000 0x10 162#define WDM_MINOR_WINXP 0x20 163#define WDM_MINOR_WIN2003 0x30 |
164 165/*- 166 * The ndis_kspin_lock type is called KSPIN_LOCK in MS-Windows. 167 * According to the Windows DDK header files, KSPIN_LOCK is defined like this: 168 * typedef ULONG_PTR KSPIN_LOCK; 169 * 170 * From basetsd.h (SDK, Feb. 2003): | 164 165/*- 166 * The ndis_kspin_lock type is called KSPIN_LOCK in MS-Windows. 167 * According to the Windows DDK header files, KSPIN_LOCK is defined like this: 168 * typedef ULONG_PTR KSPIN_LOCK; 169 * 170 * From basetsd.h (SDK, Feb. 2003): |
171 * typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR; 172 * typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; 173 * typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR; 174 * | 171 * typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR; 172 * typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; 173 * typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR; 174 * |
175 * The keyword __int3264 specifies an integral type that has the following 176 * properties: 177 * + It is 32-bit on 32-bit platforms 178 * + It is 64-bit on 64-bit platforms 179 * + It is 32-bit on the wire for backward compatibility. 180 * It gets truncated on the sending side and extended appropriately 181 * (signed or unsigned) on the receiving side. 182 * --- 15 unchanged lines hidden (view full) --- 198 uint16_t slh_depth; 199 uint16_t slh_seq; 200 } slh_list; 201}; 202 203typedef union slist_header slist_header; 204 205struct list_entry { | 175 * The keyword __int3264 specifies an integral type that has the following 176 * properties: 177 * + It is 32-bit on 32-bit platforms 178 * + It is 64-bit on 64-bit platforms 179 * + It is 32-bit on the wire for backward compatibility. 180 * It gets truncated on the sending side and extended appropriately 181 * (signed or unsigned) on the receiving side. 182 * --- 15 unchanged lines hidden (view full) --- 198 uint16_t slh_depth; 199 uint16_t slh_seq; 200 } slh_list; 201}; 202 203typedef union slist_header slist_header; 204 205struct list_entry { |
206 struct list_entry *nle_flink; 207 struct list_entry *nle_blink; | 206 struct list_entry *nle_flink; 207 struct list_entry *nle_blink; |
208}; 209 210typedef struct list_entry list_entry; 211 | 208}; 209 210typedef struct list_entry list_entry; 211 |
212#define InitializeListHead(l) \ | 212#define InitializeListHead(l) \ |
213 (l)->nle_flink = (l)->nle_blink = (l) 214 | 213 (l)->nle_flink = (l)->nle_blink = (l) 214 |
215#define IsListEmpty(h) \ | 215#define IsListEmpty(h) \ |
216 ((h)->nle_flink == (h)) 217 | 216 ((h)->nle_flink == (h)) 217 |
218#define RemoveEntryList(e) \ | 218#define RemoveEntryList(e) \ |
219 do { \ 220 list_entry *b; \ 221 list_entry *f; \ 222 \ 223 f = (e)->nle_flink; \ 224 b = (e)->nle_blink; \ 225 b->nle_flink = f; \ 226 f->nle_blink = b; \ --- 24 unchanged lines hidden (view full) --- 251 e = l->nle_blink; 252 b = e->nle_blink; 253 l->nle_blink = b; 254 b->nle_flink = l; 255 256 return (e); 257} 258 | 219 do { \ 220 list_entry *b; \ 221 list_entry *f; \ 222 \ 223 f = (e)->nle_flink; \ 224 b = (e)->nle_blink; \ 225 b->nle_flink = f; \ 226 f->nle_blink = b; \ --- 24 unchanged lines hidden (view full) --- 251 e = l->nle_blink; 252 b = e->nle_blink; 253 l->nle_blink = b; 254 b->nle_flink = l; 255 256 return (e); 257} 258 |
259#define InsertTailList(l, e) \ | 259#define InsertTailList(l, e) \ |
260 do { \ 261 list_entry *b; \ 262 \ 263 b = l->nle_blink; \ 264 e->nle_flink = l; \ 265 e->nle_blink = b; \ 266 b->nle_flink = (e); \ 267 l->nle_blink = (e); \ 268 } while (0) 269 | 260 do { \ 261 list_entry *b; \ 262 \ 263 b = l->nle_blink; \ 264 e->nle_flink = l; \ 265 e->nle_blink = b; \ 266 b->nle_flink = (e); \ 267 l->nle_blink = (e); \ 268 } while (0) 269 |
270#define InsertHeadList(l, e) \ | 270#define InsertHeadList(l, e) \ |
271 do { \ 272 list_entry *f; \ 273 \ 274 f = l->nle_flink; \ 275 e->nle_flink = f; \ 276 e->nle_blink = l; \ 277 f->nle_blink = e; \ 278 l->nle_flink = e; \ 279 } while (0) 280 | 271 do { \ 272 list_entry *f; \ 273 \ 274 f = l->nle_flink; \ 275 e->nle_flink = f; \ 276 e->nle_blink = l; \ 277 f->nle_blink = e; \ 278 l->nle_flink = e; \ 279 } while (0) 280 |
281#define CONTAINING_RECORD(addr, type, field) \ | 281#define CONTAINING_RECORD(addr, type, field) \ |
282 ((type *)((vm_offset_t)(addr) - (vm_offset_t)(&((type *)0)->field))) 283 284struct nt_dispatch_header { 285 uint8_t dh_type; 286 uint8_t dh_abs; 287 uint8_t dh_size; 288 uint8_t dh_inserted; 289 int32_t dh_sigstate; 290 list_entry dh_waitlisthead; 291}; 292 293typedef struct nt_dispatch_header nt_dispatch_header; 294 295/* Dispatcher object types */ 296 | 282 ((type *)((vm_offset_t)(addr) - (vm_offset_t)(&((type *)0)->field))) 283 284struct nt_dispatch_header { 285 uint8_t dh_type; 286 uint8_t dh_abs; 287 uint8_t dh_size; 288 uint8_t dh_inserted; 289 int32_t dh_sigstate; 290 list_entry dh_waitlisthead; 291}; 292 293typedef struct nt_dispatch_header nt_dispatch_header; 294 295/* Dispatcher object types */ 296 |
297#define DISP_TYPE_NOTIFICATION_EVENT 0 /* KEVENT */ 298#define DISP_TYPE_SYNCHRONIZATION_EVENT 1 /* KEVENT */ 299#define DISP_TYPE_MUTANT 2 /* KMUTANT/KMUTEX */ 300#define DISP_TYPE_PROCESS 3 /* KPROCESS */ 301#define DISP_TYPE_QUEUE 4 /* KQUEUE */ 302#define DISP_TYPE_SEMAPHORE 5 /* KSEMAPHORE */ 303#define DISP_TYPE_THREAD 6 /* KTHREAD */ 304#define DISP_TYPE_NOTIFICATION_TIMER 8 /* KTIMER */ 305#define DISP_TYPE_SYNCHRONIZATION_TIMER 9 /* KTIMER */ | 297#define DISP_TYPE_NOTIFICATION_EVENT 0 /* KEVENT */ 298#define DISP_TYPE_SYNCHRONIZATION_EVENT 1 /* KEVENT */ 299#define DISP_TYPE_MUTANT 2 /* KMUTANT/KMUTEX */ 300#define DISP_TYPE_PROCESS 3 /* KPROCESS */ 301#define DISP_TYPE_QUEUE 4 /* KQUEUE */ 302#define DISP_TYPE_SEMAPHORE 5 /* KSEMAPHORE */ 303#define DISP_TYPE_THREAD 6 /* KTHREAD */ 304#define DISP_TYPE_NOTIFICATION_TIMER 8 /* KTIMER */ 305#define DISP_TYPE_SYNCHRONIZATION_TIMER 9 /* KTIMER */ |
306 | 306 |
307#define OTYPE_EVENT 0 308#define OTYPE_MUTEX 1 309#define OTYPE_THREAD 2 310#define OTYPE_TIMER 3 | 307#define OTYPE_EVENT 0 308#define OTYPE_MUTEX 1 309#define OTYPE_THREAD 2 310#define OTYPE_TIMER 3 |
311 312/* Windows dispatcher levels. */ 313 | 311 312/* Windows dispatcher levels. */ 313 |
314#define PASSIVE_LEVEL 0 315#define LOW_LEVEL 0 316#define APC_LEVEL 1 317#define DISPATCH_LEVEL 2 318#define DEVICE_LEVEL (DISPATCH_LEVEL + 1) 319#define PROFILE_LEVEL 27 320#define CLOCK1_LEVEL 28 321#define CLOCK2_LEVEL 28 322#define IPI_LEVEL 29 323#define POWER_LEVEL 30 324#define HIGH_LEVEL 31 | 314#define PASSIVE_LEVEL 0 315#define LOW_LEVEL 0 316#define APC_LEVEL 1 317#define DISPATCH_LEVEL 2 318#define DEVICE_LEVEL (DISPATCH_LEVEL + 1) 319#define PROFILE_LEVEL 27 320#define CLOCK1_LEVEL 28 321#define CLOCK2_LEVEL 28 322#define IPI_LEVEL 29 323#define POWER_LEVEL 30 324#define HIGH_LEVEL 31 |
325 | 325 |
326#define SYNC_LEVEL_UP DISPATCH_LEVEL 327#define SYNC_LEVEL_MP (IPI_LEVEL - 1) | 326#define SYNC_LEVEL_UP DISPATCH_LEVEL 327#define SYNC_LEVEL_MP (IPI_LEVEL - 1) |
328 | 328 |
329#define AT_PASSIVE_LEVEL(td) \ | 329#define AT_PASSIVE_LEVEL(td) \ |
330 ((td)->td_proc->p_flag & P_KTHREAD == FALSE) 331 | 330 ((td)->td_proc->p_flag & P_KTHREAD == FALSE) 331 |
332#define AT_DISPATCH_LEVEL(td) \ | 332#define AT_DISPATCH_LEVEL(td) \ |
333 ((td)->td_base_pri == PI_REALTIME) 334 | 333 ((td)->td_base_pri == PI_REALTIME) 334 |
335#define AT_DIRQL_LEVEL(td) \ | 335#define AT_DIRQL_LEVEL(td) \ |
336 ((td)->td_priority <= PI_NET) 337 | 336 ((td)->td_priority <= PI_NET) 337 |
338#define AT_HIGH_LEVEL(td) \ | 338#define AT_HIGH_LEVEL(td) \ |
339 ((td)->td_critnest != 0) 340 341struct nt_objref { 342 nt_dispatch_header no_dh; 343 void *no_obj; 344 TAILQ_ENTRY(nt_objref) link; 345}; 346 347TAILQ_HEAD(nt_objref_head, nt_objref); 348 349typedef struct nt_objref nt_objref; 350 | 339 ((td)->td_critnest != 0) 340 341struct nt_objref { 342 nt_dispatch_header no_dh; 343 void *no_obj; 344 TAILQ_ENTRY(nt_objref) link; 345}; 346 347TAILQ_HEAD(nt_objref_head, nt_objref); 348 349typedef struct nt_objref nt_objref; 350 |
351#define EVENT_TYPE_NOTIFY 0 352#define EVENT_TYPE_SYNC 1 | 351#define EVENT_TYPE_NOTIFY 0 352#define EVENT_TYPE_SYNC 1 |
353 354/* 355 * We need to use the timeout()/untimeout() API for ktimers 356 * since timers can be initialized, but not destroyed (so 357 * malloc()ing our own callout structures would mean a leak, 358 * since there'd be no way to free() them). This means we 359 * need to use struct callout_handle, which is really just a 360 * pointer. To make it easier to deal with, we use a union --- 9 unchanged lines hidden (view full) --- 370 union { 371 list_entry k_timerlistentry; 372 struct callout *k_callout; 373 } u; 374 void *k_dpc; 375 uint32_t k_period; 376}; 377 | 353 354/* 355 * We need to use the timeout()/untimeout() API for ktimers 356 * since timers can be initialized, but not destroyed (so 357 * malloc()ing our own callout structures would mean a leak, 358 * since there'd be no way to free() them). This means we 359 * need to use struct callout_handle, which is really just a 360 * pointer. To make it easier to deal with, we use a union --- 9 unchanged lines hidden (view full) --- 370 union { 371 list_entry k_timerlistentry; 372 struct callout *k_callout; 373 } u; 374 void *k_dpc; 375 uint32_t k_period; 376}; 377 |
378#define k_timerlistentry u.k_timerlistentry 379#define k_callout u.k_callout | 378#define k_timerlistentry u.k_timerlistentry 379#define k_callout u.k_callout |
380 381typedef struct ktimer ktimer; 382 383struct nt_kevent { 384 nt_dispatch_header k_header; 385}; 386 387typedef struct nt_kevent nt_kevent; --- 10 unchanged lines hidden (view full) --- 398 list_entry k_dpclistentry; 399 void *k_deferedfunc; 400 void *k_deferredctx; 401 void *k_sysarg1; 402 void *k_sysarg2; 403 void *k_lock; 404}; 405 | 380 381typedef struct ktimer ktimer; 382 383struct nt_kevent { 384 nt_dispatch_header k_header; 385}; 386 387typedef struct nt_kevent nt_kevent; --- 10 unchanged lines hidden (view full) --- 398 list_entry k_dpclistentry; 399 void *k_deferedfunc; 400 void *k_deferredctx; 401 void *k_sysarg1; 402 void *k_sysarg2; 403 void *k_lock; 404}; 405 |
406#define KDPC_IMPORTANCE_LOW 0 407#define KDPC_IMPORTANCE_MEDIUM 1 408#define KDPC_IMPORTANCE_HIGH 2 | 406#define KDPC_IMPORTANCE_LOW 0 407#define KDPC_IMPORTANCE_MEDIUM 1 408#define KDPC_IMPORTANCE_HIGH 2 |
409 | 409 |
410#define KDPC_CPU_DEFAULT 255 | 410#define KDPC_CPU_DEFAULT 255 |
411 412typedef struct kdpc kdpc; 413 414/* 415 * Note: the acquisition count is BSD-specific. The Microsoft 416 * documentation says that mutexes can be acquired recursively 417 * by a given thread, but that you must release the mutex as 418 * many times as you acquired it before it will be set to the --- 8 unchanged lines hidden (view full) --- 427 list_entry km_listentry; 428 void *km_ownerthread; 429 uint8_t km_abandoned; 430 uint8_t km_apcdisable; 431}; 432 433typedef struct kmutant kmutant; 434 | 411 412typedef struct kdpc kdpc; 413 414/* 415 * Note: the acquisition count is BSD-specific. The Microsoft 416 * documentation says that mutexes can be acquired recursively 417 * by a given thread, but that you must release the mutex as 418 * many times as you acquired it before it will be set to the --- 8 unchanged lines hidden (view full) --- 427 list_entry km_listentry; 428 void *km_ownerthread; 429 uint8_t km_abandoned; 430 uint8_t km_apcdisable; 431}; 432 433typedef struct kmutant kmutant; 434 |
435#define LOOKASIDE_DEPTH 256 | 435#define LOOKASIDE_DEPTH 256 |
436 437struct general_lookaside { 438 slist_header gl_listhead; 439 uint16_t gl_depth; 440 uint16_t gl_maxdepth; 441 uint32_t gl_totallocs; 442 union { 443 uint32_t gl_allocmisses; --- 77 unchanged lines hidden (view full) --- 521 uint8_t wb_waitkey; 522 uint8_t wb_waittype; 523 uint8_t wb_awakened; 524 uint8_t wb_oldpri; 525}; 526 527typedef struct wait_block wait_block; 528 | 436 437struct general_lookaside { 438 slist_header gl_listhead; 439 uint16_t gl_depth; 440 uint16_t gl_maxdepth; 441 uint32_t gl_totallocs; 442 union { 443 uint32_t gl_allocmisses; --- 77 unchanged lines hidden (view full) --- 521 uint8_t wb_waitkey; 522 uint8_t wb_waittype; 523 uint8_t wb_awakened; 524 uint8_t wb_oldpri; 525}; 526 527typedef struct wait_block wait_block; 528 |
529#define wb_ext wb_kthread | 529#define wb_ext wb_kthread |
530 | 530 |
531#define THREAD_WAIT_OBJECTS 3 532#define MAX_WAIT_OBJECTS 64 | 531#define THREAD_WAIT_OBJECTS 3 532#define MAX_WAIT_OBJECTS 64 |
533 | 533 |
534#define WAITTYPE_ALL 0 535#define WAITTYPE_ANY 1 | 534#define WAITTYPE_ALL 0 535#define WAITTYPE_ANY 1 |
536 | 536 |
537#define WAITKEY_VALID 0x8000 | 537#define WAITKEY_VALID 0x8000 |
538 539/* kthread priority */ 540#define LOW_PRIORITY 0 541#define LOW_REALTIME_PRIORITY 16 542#define HIGH_PRIORITY 31 543 544struct thread_context { 545 void *tc_thrctx; --- 103 unchanged lines hidden (view full) --- 649 uint16_t dve_size; 650 device_object *dve_devobj; 651}; 652 653typedef struct devobj_extension devobj_extension; 654 655/* Device object flags */ 656 | 538 539/* kthread priority */ 540#define LOW_PRIORITY 0 541#define LOW_REALTIME_PRIORITY 16 542#define HIGH_PRIORITY 31 543 544struct thread_context { 545 void *tc_thrctx; --- 103 unchanged lines hidden (view full) --- 649 uint16_t dve_size; 650 device_object *dve_devobj; 651}; 652 653typedef struct devobj_extension devobj_extension; 654 655/* Device object flags */ 656 |
657#define DO_VERIFY_VOLUME 0x00000002 658#define DO_BUFFERED_IO 0x00000004 659#define DO_EXCLUSIVE 0x00000008 660#define DO_DIRECT_IO 0x00000010 661#define DO_MAP_IO_BUFFER 0x00000020 662#define DO_DEVICE_HAS_NAME 0x00000040 663#define DO_DEVICE_INITIALIZING 0x00000080 664#define DO_SYSTEM_BOOT_PARTITION 0x00000100 665#define DO_LONG_TERM_REQUESTS 0x00000200 666#define DO_NEVER_LAST_DEVICE 0x00000400 667#define DO_SHUTDOWN_REGISTERED 0x00000800 668#define DO_BUS_ENUMERATED_DEVICE 0x00001000 669#define DO_POWER_PAGABLE 0x00002000 670#define DO_POWER_INRUSH 0x00004000 671#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 | 657#define DO_VERIFY_VOLUME 0x00000002 658#define DO_BUFFERED_IO 0x00000004 659#define DO_EXCLUSIVE 0x00000008 660#define DO_DIRECT_IO 0x00000010 661#define DO_MAP_IO_BUFFER 0x00000020 662#define DO_DEVICE_HAS_NAME 0x00000040 663#define DO_DEVICE_INITIALIZING 0x00000080 664#define DO_SYSTEM_BOOT_PARTITION 0x00000100 665#define DO_LONG_TERM_REQUESTS 0x00000200 666#define DO_NEVER_LAST_DEVICE 0x00000400 667#define DO_SHUTDOWN_REGISTERED 0x00000800 668#define DO_BUS_ENUMERATED_DEVICE 0x00001000 669#define DO_POWER_PAGABLE 0x00002000 670#define DO_POWER_INRUSH 0x00004000 671#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 |
672 673/* Priority boosts */ 674 | 672 673/* Priority boosts */ 674 |
675#define IO_NO_INCREMENT 0 676#define IO_CD_ROM_INCREMENT 1 677#define IO_DISK_INCREMENT 1 678#define IO_KEYBOARD_INCREMENT 6 679#define IO_MAILSLOT_INCREMENT 2 680#define IO_MOUSE_INCREMENT 6 681#define IO_NAMED_PIPE_INCREMENT 2 682#define IO_NETWORK_INCREMENT 2 683#define IO_PARALLEL_INCREMENT 1 684#define IO_SERIAL_INCREMENT 2 685#define IO_SOUND_INCREMENT 8 686#define IO_VIDEO_INCREMENT 1 | 675#define IO_NO_INCREMENT 0 676#define IO_CD_ROM_INCREMENT 1 677#define IO_DISK_INCREMENT 1 678#define IO_KEYBOARD_INCREMENT 6 679#define IO_MAILSLOT_INCREMENT 2 680#define IO_MOUSE_INCREMENT 6 681#define IO_NAMED_PIPE_INCREMENT 2 682#define IO_NETWORK_INCREMENT 2 683#define IO_PARALLEL_INCREMENT 1 684#define IO_SERIAL_INCREMENT 2 685#define IO_SOUND_INCREMENT 8 686#define IO_VIDEO_INCREMENT 1 |
687 688/* IRP major codes */ 689 | 687 688/* IRP major codes */ 689 |
690#define IRP_MJ_CREATE 0x00 691#define IRP_MJ_CREATE_NAMED_PIPE 0x01 692#define IRP_MJ_CLOSE 0x02 693#define IRP_MJ_READ 0x03 694#define IRP_MJ_WRITE 0x04 695#define IRP_MJ_QUERY_INFORMATION 0x05 696#define IRP_MJ_SET_INFORMATION 0x06 697#define IRP_MJ_QUERY_EA 0x07 698#define IRP_MJ_SET_EA 0x08 699#define IRP_MJ_FLUSH_BUFFERS 0x09 700#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a 701#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b 702#define IRP_MJ_DIRECTORY_CONTROL 0x0c 703#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d 704#define IRP_MJ_DEVICE_CONTROL 0x0e 705#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f 706#define IRP_MJ_SHUTDOWN 0x10 707#define IRP_MJ_LOCK_CONTROL 0x11 708#define IRP_MJ_CLEANUP 0x12 709#define IRP_MJ_CREATE_MAILSLOT 0x13 710#define IRP_MJ_QUERY_SECURITY 0x14 711#define IRP_MJ_SET_SECURITY 0x15 712#define IRP_MJ_POWER 0x16 713#define IRP_MJ_SYSTEM_CONTROL 0x17 714#define IRP_MJ_DEVICE_CHANGE 0x18 715#define IRP_MJ_QUERY_QUOTA 0x19 716#define IRP_MJ_SET_QUOTA 0x1a 717#define IRP_MJ_PNP 0x1b 718#define IRP_MJ_PNP_POWER IRP_MJ_PNP // Obsolete.... 719#define IRP_MJ_MAXIMUM_FUNCTION 0x1b 720#define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL | 690#define IRP_MJ_CREATE 0x00 691#define IRP_MJ_CREATE_NAMED_PIPE 0x01 692#define IRP_MJ_CLOSE 0x02 693#define IRP_MJ_READ 0x03 694#define IRP_MJ_WRITE 0x04 695#define IRP_MJ_QUERY_INFORMATION 0x05 696#define IRP_MJ_SET_INFORMATION 0x06 697#define IRP_MJ_QUERY_EA 0x07 698#define IRP_MJ_SET_EA 0x08 699#define IRP_MJ_FLUSH_BUFFERS 0x09 700#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a 701#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b 702#define IRP_MJ_DIRECTORY_CONTROL 0x0c 703#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d 704#define IRP_MJ_DEVICE_CONTROL 0x0e 705#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f 706#define IRP_MJ_SHUTDOWN 0x10 707#define IRP_MJ_LOCK_CONTROL 0x11 708#define IRP_MJ_CLEANUP 0x12 709#define IRP_MJ_CREATE_MAILSLOT 0x13 710#define IRP_MJ_QUERY_SECURITY 0x14 711#define IRP_MJ_SET_SECURITY 0x15 712#define IRP_MJ_POWER 0x16 713#define IRP_MJ_SYSTEM_CONTROL 0x17 714#define IRP_MJ_DEVICE_CHANGE 0x18 715#define IRP_MJ_QUERY_QUOTA 0x19 716#define IRP_MJ_SET_QUOTA 0x1a 717#define IRP_MJ_PNP 0x1b 718#define IRP_MJ_PNP_POWER IRP_MJ_PNP // Obsolete.... 719#define IRP_MJ_MAXIMUM_FUNCTION 0x1b 720#define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL |
721 722/* IRP minor codes */ 723 | 721 722/* IRP minor codes */ 723 |
724#define IRP_MN_QUERY_DIRECTORY 0x01 725#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 726#define IRP_MN_USER_FS_REQUEST 0x00 | 724#define IRP_MN_QUERY_DIRECTORY 0x01 725#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 726#define IRP_MN_USER_FS_REQUEST 0x00 |
727 | 727 |
728#define IRP_MN_MOUNT_VOLUME 0x01 729#define IRP_MN_VERIFY_VOLUME 0x02 730#define IRP_MN_LOAD_FILE_SYSTEM 0x03 731#define IRP_MN_TRACK_LINK 0x04 732#define IRP_MN_KERNEL_CALL 0x04 | 728#define IRP_MN_MOUNT_VOLUME 0x01 729#define IRP_MN_VERIFY_VOLUME 0x02 730#define IRP_MN_LOAD_FILE_SYSTEM 0x03 731#define IRP_MN_TRACK_LINK 0x04 732#define IRP_MN_KERNEL_CALL 0x04 |
733 | 733 |
734#define IRP_MN_LOCK 0x01 735#define IRP_MN_UNLOCK_SINGLE 0x02 736#define IRP_MN_UNLOCK_ALL 0x03 737#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 | 734#define IRP_MN_LOCK 0x01 735#define IRP_MN_UNLOCK_SINGLE 0x02 736#define IRP_MN_UNLOCK_ALL 0x03 737#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 |
738 | 738 |
739#define IRP_MN_NORMAL 0x00 740#define IRP_MN_DPC 0x01 741#define IRP_MN_MDL 0x02 742#define IRP_MN_COMPLETE 0x04 743#define IRP_MN_COMPRESSED 0x08 | 739#define IRP_MN_NORMAL 0x00 740#define IRP_MN_DPC 0x01 741#define IRP_MN_MDL 0x02 742#define IRP_MN_COMPLETE 0x04 743#define IRP_MN_COMPRESSED 0x08 |
744 | 744 |
745#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) 746#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) 747#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) | 745#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) 746#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) 747#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) |
748 | 748 |
749#define IRP_MN_SCSI_CLASS 0x01 | 749#define IRP_MN_SCSI_CLASS 0x01 |
750 | 750 |
751#define IRP_MN_START_DEVICE 0x00 752#define IRP_MN_QUERY_REMOVE_DEVICE 0x01 753#define IRP_MN_REMOVE_DEVICE 0x02 754#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 755#define IRP_MN_STOP_DEVICE 0x04 756#define IRP_MN_QUERY_STOP_DEVICE 0x05 757#define IRP_MN_CANCEL_STOP_DEVICE 0x06 | 751#define IRP_MN_START_DEVICE 0x00 752#define IRP_MN_QUERY_REMOVE_DEVICE 0x01 753#define IRP_MN_REMOVE_DEVICE 0x02 754#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 755#define IRP_MN_STOP_DEVICE 0x04 756#define IRP_MN_QUERY_STOP_DEVICE 0x05 757#define IRP_MN_CANCEL_STOP_DEVICE 0x06 |
758 | 758 |
759#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 760#define IRP_MN_QUERY_INTERFACE 0x08 761#define IRP_MN_QUERY_CAPABILITIES 0x09 762#define IRP_MN_QUERY_RESOURCES 0x0A 763#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B 764#define IRP_MN_QUERY_DEVICE_TEXT 0x0C 765#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D | 759#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 760#define IRP_MN_QUERY_INTERFACE 0x08 761#define IRP_MN_QUERY_CAPABILITIES 0x09 762#define IRP_MN_QUERY_RESOURCES 0x0A 763#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B 764#define IRP_MN_QUERY_DEVICE_TEXT 0x0C 765#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D |
766 | 766 |
767#define IRP_MN_READ_CONFIG 0x0F 768#define IRP_MN_WRITE_CONFIG 0x10 769#define IRP_MN_EJECT 0x11 770#define IRP_MN_SET_LOCK 0x12 771#define IRP_MN_QUERY_ID 0x13 772#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 773#define IRP_MN_QUERY_BUS_INFORMATION 0x15 774#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 775#define IRP_MN_SURPRISE_REMOVAL 0x17 776#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 | 767#define IRP_MN_READ_CONFIG 0x0F 768#define IRP_MN_WRITE_CONFIG 0x10 769#define IRP_MN_EJECT 0x11 770#define IRP_MN_SET_LOCK 0x12 771#define IRP_MN_QUERY_ID 0x13 772#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 773#define IRP_MN_QUERY_BUS_INFORMATION 0x15 774#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 775#define IRP_MN_SURPRISE_REMOVAL 0x17 776#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 |
777 | 777 |
778#define IRP_MN_WAIT_WAKE 0x00 779#define IRP_MN_POWER_SEQUENCE 0x01 780#define IRP_MN_SET_POWER 0x02 781#define IRP_MN_QUERY_POWER 0x03 | 778#define IRP_MN_WAIT_WAKE 0x00 779#define IRP_MN_POWER_SEQUENCE 0x01 780#define IRP_MN_SET_POWER 0x02 781#define IRP_MN_QUERY_POWER 0x03 |
782 | 782 |
783#define IRP_MN_QUERY_ALL_DATA 0x00 784#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 785#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 786#define IRP_MN_CHANGE_SINGLE_ITEM 0x03 787#define IRP_MN_ENABLE_EVENTS 0x04 788#define IRP_MN_DISABLE_EVENTS 0x05 789#define IRP_MN_ENABLE_COLLECTION 0x06 790#define IRP_MN_DISABLE_COLLECTION 0x07 791#define IRP_MN_REGINFO 0x08 792#define IRP_MN_EXECUTE_METHOD 0x09 793#define IRP_MN_REGINFO_EX 0x0b | 783#define IRP_MN_QUERY_ALL_DATA 0x00 784#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 785#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 786#define IRP_MN_CHANGE_SINGLE_ITEM 0x03 787#define IRP_MN_ENABLE_EVENTS 0x04 788#define IRP_MN_DISABLE_EVENTS 0x05 789#define IRP_MN_ENABLE_COLLECTION 0x06 790#define IRP_MN_DISABLE_COLLECTION 0x07 791#define IRP_MN_REGINFO 0x08 792#define IRP_MN_EXECUTE_METHOD 0x09 793#define IRP_MN_REGINFO_EX 0x0b |
794 795/* IRP flags */ 796 | 794 795/* IRP flags */ 796 |
797#define IRP_NOCACHE 0x00000001 798#define IRP_PAGING_IO 0x00000002 799#define IRP_MOUNT_COMPLETION 0x00000002 800#define IRP_SYNCHRONOUS_API 0x00000004 801#define IRP_ASSOCIATED_IRP 0x00000008 802#define IRP_BUFFERED_IO 0x00000010 803#define IRP_DEALLOCATE_BUFFER 0x00000020 804#define IRP_INPUT_OPERATION 0x00000040 805#define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 806#define IRP_CREATE_OPERATION 0x00000080 807#define IRP_READ_OPERATION 0x00000100 808#define IRP_WRITE_OPERATION 0x00000200 809#define IRP_CLOSE_OPERATION 0x00000400 810#define IRP_DEFER_IO_COMPLETION 0x00000800 811#define IRP_OB_QUERY_NAME 0x00001000 812#define IRP_HOLD_DEVICE_QUEUE 0x00002000 813#define IRP_RETRY_IO_COMPLETION 0x00004000 814#define IRP_CLASS_CACHE_OPERATION 0x00008000 815#define IRP_SET_USER_EVENT IRP_CLOSE_OPERATION | 797#define IRP_NOCACHE 0x00000001 798#define IRP_PAGING_IO 0x00000002 799#define IRP_MOUNT_COMPLETION 0x00000002 800#define IRP_SYNCHRONOUS_API 0x00000004 801#define IRP_ASSOCIATED_IRP 0x00000008 802#define IRP_BUFFERED_IO 0x00000010 803#define IRP_DEALLOCATE_BUFFER 0x00000020 804#define IRP_INPUT_OPERATION 0x00000040 805#define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 806#define IRP_CREATE_OPERATION 0x00000080 807#define IRP_READ_OPERATION 0x00000100 808#define IRP_WRITE_OPERATION 0x00000200 809#define IRP_CLOSE_OPERATION 0x00000400 810#define IRP_DEFER_IO_COMPLETION 0x00000800 811#define IRP_OB_QUERY_NAME 0x00001000 812#define IRP_HOLD_DEVICE_QUEUE 0x00002000 813#define IRP_RETRY_IO_COMPLETION 0x00004000 814#define IRP_CLASS_CACHE_OPERATION 0x00008000 815#define IRP_SET_USER_EVENT IRP_CLOSE_OPERATION |
816 817/* IRP I/O control flags */ 818 | 816 817/* IRP I/O control flags */ 818 |
819#define IRP_QUOTA_CHARGED 0x01 820#define IRP_ALLOCATED_MUST_SUCCEED 0x02 821#define IRP_ALLOCATED_FIXED_SIZE 0x04 822#define IRP_LOOKASIDE_ALLOCATION 0x08 | 819#define IRP_QUOTA_CHARGED 0x01 820#define IRP_ALLOCATED_MUST_SUCCEED 0x02 821#define IRP_ALLOCATED_FIXED_SIZE 0x04 822#define IRP_LOOKASIDE_ALLOCATION 0x08 |
823 824/* I/O method types */ 825 | 823 824/* I/O method types */ 825 |
826#define METHOD_BUFFERED 0 827#define METHOD_IN_DIRECT 1 828#define METHOD_OUT_DIRECT 2 829#define METHOD_NEITHER 3 | 826#define METHOD_BUFFERED 0 827#define METHOD_IN_DIRECT 1 828#define METHOD_OUT_DIRECT 2 829#define METHOD_NEITHER 3 |
830 831/* File access types */ 832 | 830 831/* File access types */ 832 |
833#define FILE_ANY_ACCESS 0x0000 834#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS 835#define FILE_READ_ACCESS 0x0001 836#define FILE_WRITE_ACCESS 0x0002 | 833#define FILE_ANY_ACCESS 0x0000 834#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS 835#define FILE_READ_ACCESS 0x0001 836#define FILE_WRITE_ACCESS 0x0002 |
837 838/* Recover I/O access method from IOCTL code. */ 839 | 837 838/* Recover I/O access method from IOCTL code. */ 839 |
840#define IO_METHOD(x) ((x) & 0xFFFFFFFC) | 840#define IO_METHOD(x) ((x) & 0xFFFFFFFC) |
841 842/* Recover function code from IOCTL code */ 843 | 841 842/* Recover function code from IOCTL code */ 843 |
844#define IO_FUNC(x) (((x) & 0x7FFC) >> 2) | 844#define IO_FUNC(x) (((x) & 0x7FFC) >> 2) |
845 846/* Macro to construct an IOCTL code. */ 847 | 845 846/* Macro to construct an IOCTL code. */ 847 |
848#define IOCTL_CODE(dev, func, iomethod, acc) \ | 848#define IOCTL_CODE(dev, func, iomethod, acc) \ |
849 ((dev) << 16) | (acc << 14) | (func << 2) | (iomethod)) 850 851 852struct io_status_block { 853 union { 854 uint32_t isb_status; 855 void *isb_ptr; 856 } u; 857 register_t isb_info; 858}; | 849 ((dev) << 16) | (acc << 14) | (func << 2) | (iomethod)) 850 851 852struct io_status_block { 853 union { 854 uint32_t isb_status; 855 void *isb_ptr; 856 } u; 857 register_t isb_info; 858}; |
859#define isb_status u.isb_status 860#define isb_ptr u.isb_ptr | 859#define isb_status u.isb_status 860#define isb_ptr u.isb_ptr |
861 862typedef struct io_status_block io_status_block; 863 864struct kapc { 865 uint16_t apc_type; 866 uint16_t apc_size; 867 uint32_t apc_spare0; 868 void *apc_thread; --- 62 unchanged lines hidden (view full) --- 931 completion_func isl_completionfunc; 932 void *isl_completionctx; 933}; 934 935typedef struct io_stack_location io_stack_location; 936 937/* Stack location control flags */ 938 | 861 862typedef struct io_status_block io_status_block; 863 864struct kapc { 865 uint16_t apc_type; 866 uint16_t apc_size; 867 uint32_t apc_spare0; 868 void *apc_thread; --- 62 unchanged lines hidden (view full) --- 931 completion_func isl_completionfunc; 932 void *isl_completionctx; 933}; 934 935typedef struct io_stack_location io_stack_location; 936 937/* Stack location control flags */ 938 |
939#define SL_PENDING_RETURNED 0x01 940#define SL_INVOKE_ON_CANCEL 0x20 941#define SL_INVOKE_ON_SUCCESS 0x40 942#define SL_INVOKE_ON_ERROR 0x80 | 939#define SL_PENDING_RETURNED 0x01 940#define SL_INVOKE_ON_CANCEL 0x20 941#define SL_INVOKE_ON_SUCCESS 0x40 942#define SL_INVOKE_ON_ERROR 0x80 |
943 944struct irp { 945 uint16_t irp_type; 946 uint16_t irp_size; 947 mdl *irp_mdl; 948 uint32_t irp_flags; 949 union { 950 struct irp *irp_master; --- 24 unchanged lines hidden (view full) --- 975 976 /* Windows kernel info */ 977 978 union { 979 struct { 980 union { 981 kdevice_qentry irp_dqe; 982 struct { | 943 944struct irp { 945 uint16_t irp_type; 946 uint16_t irp_size; 947 mdl *irp_mdl; 948 uint32_t irp_flags; 949 union { 950 struct irp *irp_master; --- 24 unchanged lines hidden (view full) --- 975 976 /* Windows kernel info */ 977 978 union { 979 struct { 980 union { 981 kdevice_qentry irp_dqe; 982 struct { |
983 void *irp_drvctx[4]; | 983 void *irp_drvctx[4]; |
984 } s1; 985 } u1; 986 void *irp_thread; 987 char *irp_auxbuf; 988 struct { 989 list_entry irp_list; 990 union { 991 io_stack_location *irp_csl; 992 uint32_t irp_pkttype; 993 } u2; 994 } s2; 995 void *irp_fileobj; 996 } irp_overlay; 997 union { 998 kapc irp_apc; 999 struct { | 984 } s1; 985 } u1; 986 void *irp_thread; 987 char *irp_auxbuf; 988 struct { 989 list_entry irp_list; 990 union { 991 io_stack_location *irp_csl; 992 uint32_t irp_pkttype; 993 } u2; 994 } s2; 995 void *irp_fileobj; 996 } irp_overlay; 997 union { 998 kapc irp_apc; 999 struct { |
1000 void *irp_xfer; | 1000 void *irp_ep; |
1001 void *irp_dev; 1002 } irp_usb; 1003 } irp_misc; 1004 void *irp_compkey; 1005 } irp_tail; 1006}; 1007 | 1001 void *irp_dev; 1002 } irp_usb; 1003 } irp_misc; 1004 void *irp_compkey; 1005 } irp_tail; 1006}; 1007 |
1008#define irp_csl s2.u2.irp_csl 1009#define irp_pkttype s2.u2.irp_pkttype | 1008#define irp_csl s2.u2.irp_csl 1009#define irp_pkttype s2.u2.irp_pkttype |
1010 1011#define IRP_NDIS_DEV(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_dev | 1010 1011#define IRP_NDIS_DEV(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_dev |
1012#define IRP_NDISUSB_XFER(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_xfer | 1012#define IRP_NDISUSB_EP(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_ep |
1013 1014typedef struct irp irp; 1015 | 1013 1014typedef struct irp irp; 1015 |
1016#define InterlockedExchangePointer(dst, val) \ | 1016#define InterlockedExchangePointer(dst, val) \ |
1017 (void *)InterlockedExchange((uint32_t *)(dst), (uintptr_t)(val)) 1018 | 1017 (void *)InterlockedExchange((uint32_t *)(dst), (uintptr_t)(val)) 1018 |
1019#define IoSizeOfIrp(ssize) \ | 1019#define IoSizeOfIrp(ssize) \ |
1020 ((uint16_t) (sizeof(irp) + ((ssize) * (sizeof(io_stack_location))))) 1021 | 1020 ((uint16_t) (sizeof(irp) + ((ssize) * (sizeof(io_stack_location))))) 1021 |
1022#define IoSetCancelRoutine(irp, func) \ | 1022#define IoSetCancelRoutine(irp, func) \ |
1023 (cancel_func)InterlockedExchangePointer( \ 1024 (void *)&(ip)->irp_cancelfunc, (void *)(func)) 1025 1026#define IoSetCancelValue(irp, val) \ 1027 (u_long)InterlockedExchangePointer( \ 1028 (void *)&(ip)->irp_cancel, (void *)(val)) 1029 | 1023 (cancel_func)InterlockedExchangePointer( \ 1024 (void *)&(ip)->irp_cancelfunc, (void *)(func)) 1025 1026#define IoSetCancelValue(irp, val) \ 1027 (u_long)InterlockedExchangePointer( \ 1028 (void *)&(ip)->irp_cancel, (void *)(val)) 1029 |
1030#define IoGetCurrentIrpStackLocation(irp) \ | 1030#define IoGetCurrentIrpStackLocation(irp) \ |
1031 (irp)->irp_tail.irp_overlay.irp_csl 1032 | 1031 (irp)->irp_tail.irp_overlay.irp_csl 1032 |
1033#define IoGetNextIrpStackLocation(irp) \ | 1033#define IoGetNextIrpStackLocation(irp) \ |
1034 ((irp)->irp_tail.irp_overlay.irp_csl - 1) 1035 | 1034 ((irp)->irp_tail.irp_overlay.irp_csl - 1) 1035 |
1036#define IoSetNextIrpStackLocation(irp) \ | 1036#define IoSetNextIrpStackLocation(irp) \ |
1037 do { \ 1038 irp->irp_currentstackloc--; \ 1039 irp->irp_tail.irp_overlay.irp_csl--; \ 1040 } while(0) 1041 | 1037 do { \ 1038 irp->irp_currentstackloc--; \ 1039 irp->irp_tail.irp_overlay.irp_csl--; \ 1040 } while(0) 1041 |
1042#define IoSetCompletionRoutine(irp, func, ctx, ok, err, cancel) \ | 1042#define IoSetCompletionRoutine(irp, func, ctx, ok, err, cancel) \ |
1043 do { \ 1044 io_stack_location *s; \ 1045 s = IoGetNextIrpStackLocation((irp)); \ 1046 s->isl_completionfunc = (func); \ 1047 s->isl_completionctx = (ctx); \ 1048 s->isl_ctl = 0; \ 1049 if (ok) s->isl_ctl = SL_INVOKE_ON_SUCCESS; \ 1050 if (err) s->isl_ctl |= SL_INVOKE_ON_ERROR; \ 1051 if (cancel) s->isl_ctl |= SL_INVOKE_ON_CANCEL; \ 1052 } while(0) 1053 | 1043 do { \ 1044 io_stack_location *s; \ 1045 s = IoGetNextIrpStackLocation((irp)); \ 1046 s->isl_completionfunc = (func); \ 1047 s->isl_completionctx = (ctx); \ 1048 s->isl_ctl = 0; \ 1049 if (ok) s->isl_ctl = SL_INVOKE_ON_SUCCESS; \ 1050 if (err) s->isl_ctl |= SL_INVOKE_ON_ERROR; \ 1051 if (cancel) s->isl_ctl |= SL_INVOKE_ON_CANCEL; \ 1052 } while(0) 1053 |
1054#define IoMarkIrpPending(irp) \ | 1054#define IoMarkIrpPending(irp) \ |
1055 IoGetCurrentIrpStackLocation(irp)->isl_ctl |= SL_PENDING_RETURNED 1056#define IoUnmarkIrpPending(irp) \ 1057 IoGetCurrentIrpStackLocation(irp)->isl_ctl &= ~SL_PENDING_RETURNED 1058 | 1055 IoGetCurrentIrpStackLocation(irp)->isl_ctl |= SL_PENDING_RETURNED 1056#define IoUnmarkIrpPending(irp) \ 1057 IoGetCurrentIrpStackLocation(irp)->isl_ctl &= ~SL_PENDING_RETURNED 1058 |
1059#define IoCopyCurrentIrpStackLocationToNext(irp) \ | 1059#define IoCopyCurrentIrpStackLocationToNext(irp) \ |
1060 do { \ 1061 io_stack_location *src, *dst; \ 1062 src = IoGetCurrentIrpStackLocation(irp); \ 1063 dst = IoGetNextIrpStackLocation(irp); \ 1064 bcopy((char *)src, (char *)dst, \ 1065 offsetof(io_stack_location, isl_completionfunc)); \ 1066 } while(0) 1067 | 1060 do { \ 1061 io_stack_location *src, *dst; \ 1062 src = IoGetCurrentIrpStackLocation(irp); \ 1063 dst = IoGetNextIrpStackLocation(irp); \ 1064 bcopy((char *)src, (char *)dst, \ 1065 offsetof(io_stack_location, isl_completionfunc)); \ 1066 } while(0) 1067 |
1068#define IoSkipCurrentIrpStackLocation(irp) \ | 1068#define IoSkipCurrentIrpStackLocation(irp) \ |
1069 do { \ 1070 (irp)->irp_currentstackloc++; \ 1071 (irp)->irp_tail.irp_overlay.irp_csl++; \ 1072 } while(0) 1073 | 1069 do { \ 1070 (irp)->irp_currentstackloc++; \ 1071 (irp)->irp_tail.irp_overlay.irp_csl++; \ 1072 } while(0) 1073 |
1074#define IoInitializeDpcRequest(dobj, dpcfunc) \ | 1074#define IoInitializeDpcRequest(dobj, dpcfunc) \ |
1075 KeInitializeDpc(&(dobj)->do_dpc, dpcfunc, dobj) 1076 | 1075 KeInitializeDpc(&(dobj)->do_dpc, dpcfunc, dobj) 1076 |
1077#define IoRequestDpc(dobj, irp, ctx) \ | 1077#define IoRequestDpc(dobj, irp, ctx) \ |
1078 KeInsertQueueDpc(&(dobj)->do_dpc, irp, ctx) 1079 1080typedef uint32_t (*driver_dispatch)(device_object *, irp *); 1081 1082/* 1083 * The driver_object is allocated once for each driver that's loaded 1084 * into the system. A new one is allocated for each driver and 1085 * populated a bit via the driver's DriverEntry function. --- 18 unchanged lines hidden (view full) --- 1104 void *dro_driverinitfunc; 1105 void *dro_driverstartiofunc; 1106 void *dro_driverunloadfunc; 1107 driver_dispatch dro_dispatch[IRP_MJ_MAXIMUM_FUNCTION + 1]; 1108}; 1109 1110typedef struct driver_object driver_object; 1111 | 1078 KeInsertQueueDpc(&(dobj)->do_dpc, irp, ctx) 1079 1080typedef uint32_t (*driver_dispatch)(device_object *, irp *); 1081 1082/* 1083 * The driver_object is allocated once for each driver that's loaded 1084 * into the system. A new one is allocated for each driver and 1085 * populated a bit via the driver's DriverEntry function. --- 18 unchanged lines hidden (view full) --- 1104 void *dro_driverinitfunc; 1105 void *dro_driverstartiofunc; 1106 void *dro_driverunloadfunc; 1107 driver_dispatch dro_dispatch[IRP_MJ_MAXIMUM_FUNCTION + 1]; 1108}; 1109 1110typedef struct driver_object driver_object; 1111 |
1112#define DEVPROP_DEVICE_DESCRIPTION 0x00000000 1113#define DEVPROP_HARDWARE_ID 0x00000001 1114#define DEVPROP_COMPATIBLE_IDS 0x00000002 1115#define DEVPROP_BOOTCONF 0x00000003 1116#define DEVPROP_BOOTCONF_TRANSLATED 0x00000004 1117#define DEVPROP_CLASS_NAME 0x00000005 1118#define DEVPROP_CLASS_GUID 0x00000006 1119#define DEVPROP_DRIVER_KEYNAME 0x00000007 1120#define DEVPROP_MANUFACTURER 0x00000008 1121#define DEVPROP_FRIENDLYNAME 0x00000009 1122#define DEVPROP_LOCATION_INFO 0x0000000A 1123#define DEVPROP_PHYSDEV_NAME 0x0000000B 1124#define DEVPROP_BUSTYPE_GUID 0x0000000C 1125#define DEVPROP_LEGACY_BUSTYPE 0x0000000D 1126#define DEVPROP_BUS_NUMBER 0x0000000E 1127#define DEVPROP_ENUMERATOR_NAME 0x0000000F 1128#define DEVPROP_ADDRESS 0x00000010 1129#define DEVPROP_UINUMBER 0x00000011 1130#define DEVPROP_INSTALL_STATE 0x00000012 1131#define DEVPROP_REMOVAL_POLICY 0x00000013 | 1112#define DEVPROP_DEVICE_DESCRIPTION 0x00000000 1113#define DEVPROP_HARDWARE_ID 0x00000001 1114#define DEVPROP_COMPATIBLE_IDS 0x00000002 1115#define DEVPROP_BOOTCONF 0x00000003 1116#define DEVPROP_BOOTCONF_TRANSLATED 0x00000004 1117#define DEVPROP_CLASS_NAME 0x00000005 1118#define DEVPROP_CLASS_GUID 0x00000006 1119#define DEVPROP_DRIVER_KEYNAME 0x00000007 1120#define DEVPROP_MANUFACTURER 0x00000008 1121#define DEVPROP_FRIENDLYNAME 0x00000009 1122#define DEVPROP_LOCATION_INFO 0x0000000A 1123#define DEVPROP_PHYSDEV_NAME 0x0000000B 1124#define DEVPROP_BUSTYPE_GUID 0x0000000C 1125#define DEVPROP_LEGACY_BUSTYPE 0x0000000D 1126#define DEVPROP_BUS_NUMBER 0x0000000E 1127#define DEVPROP_ENUMERATOR_NAME 0x0000000F 1128#define DEVPROP_ADDRESS 0x00000010 1129#define DEVPROP_UINUMBER 0x00000011 1130#define DEVPROP_INSTALL_STATE 0x00000012 1131#define DEVPROP_REMOVAL_POLICY 0x00000013 |
1132 1133/* Various supported device types (used with IoCreateDevice()) */ 1134 | 1132 1133/* Various supported device types (used with IoCreateDevice()) */ 1134 |
1135#define FILE_DEVICE_BEEP 0x00000001 1136#define FILE_DEVICE_CD_ROM 0x00000002 1137#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 1138#define FILE_DEVICE_CONTROLLER 0x00000004 1139#define FILE_DEVICE_DATALINK 0x00000005 1140#define FILE_DEVICE_DFS 0x00000006 1141#define FILE_DEVICE_DISK 0x00000007 1142#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 1143#define FILE_DEVICE_FILE_SYSTEM 0x00000009 1144#define FILE_DEVICE_INPORT_PORT 0x0000000A 1145#define FILE_DEVICE_KEYBOARD 0x0000000B 1146#define FILE_DEVICE_MAILSLOT 0x0000000C 1147#define FILE_DEVICE_MIDI_IN 0x0000000D 1148#define FILE_DEVICE_MIDI_OUT 0x0000000E 1149#define FILE_DEVICE_MOUSE 0x0000000F 1150#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 1151#define FILE_DEVICE_NAMED_PIPE 0x00000011 1152#define FILE_DEVICE_NETWORK 0x00000012 1153#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 1154#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 1155#define FILE_DEVICE_NULL 0x00000015 1156#define FILE_DEVICE_PARALLEL_PORT 0x00000016 1157#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 1158#define FILE_DEVICE_PRINTER 0x00000018 1159#define FILE_DEVICE_SCANNER 0x00000019 1160#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001A 1161#define FILE_DEVICE_SERIAL_PORT 0x0000001B 1162#define FILE_DEVICE_SCREEN 0x0000001C 1163#define FILE_DEVICE_SOUND 0x0000001D 1164#define FILE_DEVICE_STREAMS 0x0000001E 1165#define FILE_DEVICE_TAPE 0x0000001F 1166#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 1167#define FILE_DEVICE_TRANSPORT 0x00000021 1168#define FILE_DEVICE_UNKNOWN 0x00000022 1169#define FILE_DEVICE_VIDEO 0x00000023 1170#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 1171#define FILE_DEVICE_WAVE_IN 0x00000025 1172#define FILE_DEVICE_WAVE_OUT 0x00000026 1173#define FILE_DEVICE_8042_PORT 0x00000027 1174#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 1175#define FILE_DEVICE_BATTERY 0x00000029 1176#define FILE_DEVICE_BUS_EXTENDER 0x0000002A 1177#define FILE_DEVICE_MODEM 0x0000002B 1178#define FILE_DEVICE_VDM 0x0000002C 1179#define FILE_DEVICE_MASS_STORAGE 0x0000002D 1180#define FILE_DEVICE_SMB 0x0000002E 1181#define FILE_DEVICE_KS 0x0000002F 1182#define FILE_DEVICE_CHANGER 0x00000030 1183#define FILE_DEVICE_SMARTCARD 0x00000031 1184#define FILE_DEVICE_ACPI 0x00000032 1185#define FILE_DEVICE_DVD 0x00000033 1186#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 1187#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 1188#define FILE_DEVICE_DFS_VOLUME 0x00000036 1189#define FILE_DEVICE_SERENUM 0x00000037 1190#define FILE_DEVICE_TERMSRV 0x00000038 1191#define FILE_DEVICE_KSEC 0x00000039 1192#define FILE_DEVICE_FIPS 0x0000003A | 1135#define FILE_DEVICE_BEEP 0x00000001 1136#define FILE_DEVICE_CD_ROM 0x00000002 1137#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 1138#define FILE_DEVICE_CONTROLLER 0x00000004 1139#define FILE_DEVICE_DATALINK 0x00000005 1140#define FILE_DEVICE_DFS 0x00000006 1141#define FILE_DEVICE_DISK 0x00000007 1142#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 1143#define FILE_DEVICE_FILE_SYSTEM 0x00000009 1144#define FILE_DEVICE_INPORT_PORT 0x0000000A 1145#define FILE_DEVICE_KEYBOARD 0x0000000B 1146#define FILE_DEVICE_MAILSLOT 0x0000000C 1147#define FILE_DEVICE_MIDI_IN 0x0000000D 1148#define FILE_DEVICE_MIDI_OUT 0x0000000E 1149#define FILE_DEVICE_MOUSE 0x0000000F 1150#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 1151#define FILE_DEVICE_NAMED_PIPE 0x00000011 1152#define FILE_DEVICE_NETWORK 0x00000012 1153#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 1154#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 1155#define FILE_DEVICE_NULL 0x00000015 1156#define FILE_DEVICE_PARALLEL_PORT 0x00000016 1157#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 1158#define FILE_DEVICE_PRINTER 0x00000018 1159#define FILE_DEVICE_SCANNER 0x00000019 1160#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001A 1161#define FILE_DEVICE_SERIAL_PORT 0x0000001B 1162#define FILE_DEVICE_SCREEN 0x0000001C 1163#define FILE_DEVICE_SOUND 0x0000001D 1164#define FILE_DEVICE_STREAMS 0x0000001E 1165#define FILE_DEVICE_TAPE 0x0000001F 1166#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 1167#define FILE_DEVICE_TRANSPORT 0x00000021 1168#define FILE_DEVICE_UNKNOWN 0x00000022 1169#define FILE_DEVICE_VIDEO 0x00000023 1170#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 1171#define FILE_DEVICE_WAVE_IN 0x00000025 1172#define FILE_DEVICE_WAVE_OUT 0x00000026 1173#define FILE_DEVICE_8042_PORT 0x00000027 1174#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 1175#define FILE_DEVICE_BATTERY 0x00000029 1176#define FILE_DEVICE_BUS_EXTENDER 0x0000002A 1177#define FILE_DEVICE_MODEM 0x0000002B 1178#define FILE_DEVICE_VDM 0x0000002C 1179#define FILE_DEVICE_MASS_STORAGE 0x0000002D 1180#define FILE_DEVICE_SMB 0x0000002E 1181#define FILE_DEVICE_KS 0x0000002F 1182#define FILE_DEVICE_CHANGER 0x00000030 1183#define FILE_DEVICE_SMARTCARD 0x00000031 1184#define FILE_DEVICE_ACPI 0x00000032 1185#define FILE_DEVICE_DVD 0x00000033 1186#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 1187#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 1188#define FILE_DEVICE_DFS_VOLUME 0x00000036 1189#define FILE_DEVICE_SERENUM 0x00000037 1190#define FILE_DEVICE_TERMSRV 0x00000038 1191#define FILE_DEVICE_KSEC 0x00000039 1192#define FILE_DEVICE_FIPS 0x0000003A |
1193 1194/* Device characteristics */ 1195 | 1193 1194/* Device characteristics */ 1195 |
1196#define FILE_REMOVABLE_MEDIA 0x00000001 1197#define FILE_READ_ONLY_DEVICE 0x00000002 1198#define FILE_FLOPPY_DISKETTE 0x00000004 1199#define FILE_WRITE_ONCE_MEDIA 0x00000008 1200#define FILE_REMOTE_DEVICE 0x00000010 1201#define FILE_DEVICE_IS_MOUNTED 0x00000020 1202#define FILE_VIRTUAL_VOLUME 0x00000040 1203#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 1204#define FILE_DEVICE_SECURE_OPEN 0x00000100 | 1196#define FILE_REMOVABLE_MEDIA 0x00000001 1197#define FILE_READ_ONLY_DEVICE 0x00000002 1198#define FILE_FLOPPY_DISKETTE 0x00000004 1199#define FILE_WRITE_ONCE_MEDIA 0x00000008 1200#define FILE_REMOTE_DEVICE 0x00000010 1201#define FILE_DEVICE_IS_MOUNTED 0x00000020 1202#define FILE_VIRTUAL_VOLUME 0x00000040 1203#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 1204#define FILE_DEVICE_SECURE_OPEN 0x00000100 |
1205 1206/* Status codes */ 1207 | 1205 1206/* Status codes */ 1207 |
1208#define STATUS_SUCCESS 0x00000000 1209#define STATUS_USER_APC 0x000000C0 1210#define STATUS_KERNEL_APC 0x00000100 1211#define STATUS_ALERTED 0x00000101 1212#define STATUS_TIMEOUT 0x00000102 1213#define STATUS_PENDING 0x00000103 | 1208#define STATUS_SUCCESS 0x00000000 1209#define STATUS_USER_APC 0x000000C0 1210#define STATUS_KERNEL_APC 0x00000100 1211#define STATUS_ALERTED 0x00000101 1212#define STATUS_TIMEOUT 0x00000102 1213#define STATUS_PENDING 0x00000103 |
1214#define STATUS_FAILURE 0xC0000001 1215#define STATUS_NOT_IMPLEMENTED 0xC0000002 | 1214#define STATUS_FAILURE 0xC0000001 1215#define STATUS_NOT_IMPLEMENTED 0xC0000002 |
1216#define STATUS_INVALID_PARAMETER 0xC000000D 1217#define STATUS_INVALID_DEVICE_REQUEST 0xC0000010 1218#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016 | 1216#define STATUS_INVALID_PARAMETER 0xC000000D 1217#define STATUS_INVALID_DEVICE_REQUEST 0xC0000010 1218#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016 |
1219#define STATUS_NO_MEMORY 0xC0000017 | 1219#define STATUS_NO_MEMORY 0xC0000017 |
1220#define STATUS_BUFFER_TOO_SMALL 0xC0000023 1221#define STATUS_MUTANT_NOT_OWNED 0xC0000046 | 1220#define STATUS_BUFFER_TOO_SMALL 0xC0000023 1221#define STATUS_MUTANT_NOT_OWNED 0xC0000046 |
1222#define STATUS_NOT_SUPPORTED 0xC00000BB | 1222#define STATUS_NOT_SUPPORTED 0xC00000BB |
1223#define STATUS_INVALID_PARAMETER_2 0xC00000F0 1224#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A | 1223#define STATUS_INVALID_PARAMETER_2 0xC00000F0 1224#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A |
1225#define STATUS_DEVICE_NOT_CONNECTED 0xC000009D 1226#define STATUS_CANCELLED 0xC0000120 | 1225#define STATUS_DEVICE_NOT_CONNECTED 0xC000009D 1226#define STATUS_CANCELLED 0xC0000120 |
1227#define STATUS_NOT_FOUND 0xC0000225 | 1227#define STATUS_NOT_FOUND 0xC0000225 |
1228#define STATUS_DEVICE_REMOVED 0xC00002B6 1229 | 1228#define STATUS_DEVICE_REMOVED 0xC00002B6 1229 |
1230#define STATUS_WAIT_0 0x00000000 | 1230#define STATUS_WAIT_0 0x00000000 |
1231 1232/* Memory pool types, for ExAllocatePoolWithTag() */ 1233 | 1231 1232/* Memory pool types, for ExAllocatePoolWithTag() */ 1233 |
1234#define NonPagedPool 0x00000000 1235#define PagedPool 0x00000001 1236#define NonPagedPoolMustSucceed 0x00000002 1237#define DontUseThisType 0x00000003 1238#define NonPagedPoolCacheAligned 0x00000004 1239#define PagedPoolCacheAligned 0x00000005 1240#define NonPagedPoolCacheAlignedMustS 0x00000006 1241#define MaxPoolType 0x00000007 | 1234#define NonPagedPool 0x00000000 1235#define PagedPool 0x00000001 1236#define NonPagedPoolMustSucceed 0x00000002 1237#define DontUseThisType 0x00000003 1238#define NonPagedPoolCacheAligned 0x00000004 1239#define PagedPoolCacheAligned 0x00000005 1240#define NonPagedPoolCacheAlignedMustS 0x00000006 1241#define MaxPoolType 0x00000007 |
1242 1243/* 1244 * IO_WORKITEM is an opaque structures that must be allocated 1245 * via IoAllocateWorkItem() and released via IoFreeWorkItem(). 1246 * Consequently, we can define it any way we want. 1247 */ 1248typedef void (*io_workitem_func)(device_object *, void *); 1249 1250struct io_workitem { 1251 io_workitem_func iw_func; 1252 void *iw_ctx; 1253 list_entry iw_listentry; 1254 device_object *iw_dobj; 1255 int iw_idx; 1256}; 1257 1258typedef struct io_workitem io_workitem; 1259 | 1242 1243/* 1244 * IO_WORKITEM is an opaque structures that must be allocated 1245 * via IoAllocateWorkItem() and released via IoFreeWorkItem(). 1246 * Consequently, we can define it any way we want. 1247 */ 1248typedef void (*io_workitem_func)(device_object *, void *); 1249 1250struct io_workitem { 1251 io_workitem_func iw_func; 1252 void *iw_ctx; 1253 list_entry iw_listentry; 1254 device_object *iw_dobj; 1255 int iw_idx; 1256}; 1257 1258typedef struct io_workitem io_workitem; 1259 |
1260#define WORKQUEUE_CRITICAL 0 1261#define WORKQUEUE_DELAYED 1 1262#define WORKQUEUE_HYPERCRITICAL 2 | 1260#define WORKQUEUE_CRITICAL 0 1261#define WORKQUEUE_DELAYED 1 1262#define WORKQUEUE_HYPERCRITICAL 2 |
1263 | 1263 |
1264#define WORKITEM_THREADS 4 1265#define WORKITEM_LEGACY_THREAD 3 1266#define WORKIDX_INC(x) (x) = (x + 1) % WORKITEM_LEGACY_THREAD | 1264#define WORKITEM_THREADS 4 1265#define WORKITEM_LEGACY_THREAD 3 1266#define WORKIDX_INC(x) (x) = (x + 1) % WORKITEM_LEGACY_THREAD |
1267 1268/* 1269 * Older, deprecated work item API, needed to support NdisQueueWorkItem(). 1270 */ 1271 1272struct work_queue_item; 1273 1274typedef void (*work_item_func)(struct work_queue_item *, void *); 1275 1276struct work_queue_item { 1277 list_entry wqi_entry; 1278 work_item_func wqi_func; 1279 void *wqi_ctx; 1280}; 1281 1282typedef struct work_queue_item work_queue_item; 1283 | 1267 1268/* 1269 * Older, deprecated work item API, needed to support NdisQueueWorkItem(). 1270 */ 1271 1272struct work_queue_item; 1273 1274typedef void (*work_item_func)(struct work_queue_item *, void *); 1275 1276struct work_queue_item { 1277 list_entry wqi_entry; 1278 work_item_func wqi_func; 1279 void *wqi_ctx; 1280}; 1281 1282typedef struct work_queue_item work_queue_item; 1283 |
1284#define ExInitializeWorkItem(w, func, ctx) \ | 1284#define ExInitializeWorkItem(w, func, ctx) \ |
1285 do { \ 1286 (w)->wqi_func = (func); \ 1287 (w)->wqi_ctx = (ctx); \ 1288 InitializeListHead(&((w)->wqi_entry)); \ 1289 } while (0) 1290 1291/* 1292 * FreeBSD's kernel stack is 2 pages in size by default. The 1293 * Windows stack is larger, so we need to give our threads more 1294 * stack pages. 4 should be enough, we use 8 just to extra safe. 1295 */ | 1285 do { \ 1286 (w)->wqi_func = (func); \ 1287 (w)->wqi_ctx = (ctx); \ 1288 InitializeListHead(&((w)->wqi_entry)); \ 1289 } while (0) 1290 1291/* 1292 * FreeBSD's kernel stack is 2 pages in size by default. The 1293 * Windows stack is larger, so we need to give our threads more 1294 * stack pages. 4 should be enough, we use 8 just to extra safe. 1295 */ |
1296#define NDIS_KSTACK_PAGES 8 | 1296#define NDIS_KSTACK_PAGES 8 |
1297 1298/* 1299 * Different kinds of function wrapping we can do. 1300 */ 1301 | 1297 1298/* 1299 * Different kinds of function wrapping we can do. 1300 */ 1301 |
1302#define WINDRV_WRAP_STDCALL 1 1303#define WINDRV_WRAP_FASTCALL 2 1304#define WINDRV_WRAP_REGPARM 3 1305#define WINDRV_WRAP_CDECL 4 1306#define WINDRV_WRAP_AMD64 5 | 1302#define WINDRV_WRAP_STDCALL 1 1303#define WINDRV_WRAP_FASTCALL 2 1304#define WINDRV_WRAP_REGPARM 3 1305#define WINDRV_WRAP_CDECL 4 1306#define WINDRV_WRAP_AMD64 5 |
1307 1308struct drvdb_ent { 1309 driver_object *windrv_object; 1310 void *windrv_devlist; 1311 ndis_cfg *windrv_regvals; 1312 interface_type windrv_bustype; 1313 STAILQ_ENTRY(drvdb_ent) link; 1314}; --- 42 unchanged lines hidden (view full) --- 1357extern uint8_t KeInsertQueueDpc(kdpc *, void *, void *); 1358extern uint8_t KeRemoveQueueDpc(kdpc *); 1359extern void KeSetImportanceDpc(kdpc *, uint32_t); 1360extern void KeSetTargetProcessorDpc(kdpc *, uint8_t); 1361extern void KeFlushQueuedDpcs(void); 1362extern uint32_t KeGetCurrentProcessorNumber(void); 1363extern void KeInitializeTimer(ktimer *); 1364extern void KeInitializeTimerEx(ktimer *, uint32_t); | 1307 1308struct drvdb_ent { 1309 driver_object *windrv_object; 1310 void *windrv_devlist; 1311 ndis_cfg *windrv_regvals; 1312 interface_type windrv_bustype; 1313 STAILQ_ENTRY(drvdb_ent) link; 1314}; --- 42 unchanged lines hidden (view full) --- 1357extern uint8_t KeInsertQueueDpc(kdpc *, void *, void *); 1358extern uint8_t KeRemoveQueueDpc(kdpc *); 1359extern void KeSetImportanceDpc(kdpc *, uint32_t); 1360extern void KeSetTargetProcessorDpc(kdpc *, uint8_t); 1361extern void KeFlushQueuedDpcs(void); 1362extern uint32_t KeGetCurrentProcessorNumber(void); 1363extern void KeInitializeTimer(ktimer *); 1364extern void KeInitializeTimerEx(ktimer *, uint32_t); |
1365extern uint8_t KeSetTimer(ktimer *, int64_t, kdpc *); | 1365extern uint8_t KeSetTimer(ktimer *, int64_t, kdpc *); |
1366extern uint8_t KeSetTimerEx(ktimer *, int64_t, uint32_t, kdpc *); 1367extern uint8_t KeCancelTimer(ktimer *); 1368extern uint8_t KeReadStateTimer(ktimer *); 1369extern uint32_t KeWaitForSingleObject(void *, uint32_t, 1370 uint32_t, uint8_t, int64_t *); 1371extern void KeInitializeEvent(nt_kevent *, uint32_t, uint8_t); 1372extern void KeClearEvent(nt_kevent *); 1373extern uint32_t KeReadStateEvent(nt_kevent *); --- 41 unchanged lines hidden (view full) --- 1415extern mdl *IoAllocateMdl(void *, uint32_t, uint8_t, uint8_t, irp *); 1416extern void IoFreeMdl(mdl *); 1417extern io_workitem *IoAllocateWorkItem(device_object *); 1418extern void ExQueueWorkItem(work_queue_item *, u_int32_t); 1419extern void IoFreeWorkItem(io_workitem *); 1420extern void IoQueueWorkItem(io_workitem *, io_workitem_func, 1421 uint32_t, void *); 1422 | 1366extern uint8_t KeSetTimerEx(ktimer *, int64_t, uint32_t, kdpc *); 1367extern uint8_t KeCancelTimer(ktimer *); 1368extern uint8_t KeReadStateTimer(ktimer *); 1369extern uint32_t KeWaitForSingleObject(void *, uint32_t, 1370 uint32_t, uint8_t, int64_t *); 1371extern void KeInitializeEvent(nt_kevent *, uint32_t, uint8_t); 1372extern void KeClearEvent(nt_kevent *); 1373extern uint32_t KeReadStateEvent(nt_kevent *); --- 41 unchanged lines hidden (view full) --- 1415extern mdl *IoAllocateMdl(void *, uint32_t, uint8_t, uint8_t, irp *); 1416extern void IoFreeMdl(mdl *); 1417extern io_workitem *IoAllocateWorkItem(device_object *); 1418extern void ExQueueWorkItem(work_queue_item *, u_int32_t); 1419extern void IoFreeWorkItem(io_workitem *); 1420extern void IoQueueWorkItem(io_workitem *, io_workitem_func, 1421 uint32_t, void *); 1422 |
1423#define IoCallDriver(a, b) IofCallDriver(a, b) 1424#define IoCompleteRequest(a, b) IofCompleteRequest(a, b) | 1423#define IoCallDriver(a, b) IofCallDriver(a, b) 1424#define IoCompleteRequest(a, b) IofCompleteRequest(a, b) |
1425 1426/* 1427 * On the Windows x86 arch, KeAcquireSpinLock() and KeReleaseSpinLock() 1428 * routines live in the HAL. We try to imitate this behavior. 1429 */ 1430#ifdef __i386__ | 1425 1426/* 1427 * On the Windows x86 arch, KeAcquireSpinLock() and KeReleaseSpinLock() 1428 * routines live in the HAL. We try to imitate this behavior. 1429 */ 1430#ifdef __i386__ |
1431#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) 1432#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) 1433#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) 1434#define KeLowerIrql(a) KfLowerIrql(a) 1435#define KeAcquireSpinLockAtDpcLevel(a) KefAcquireSpinLockAtDpcLevel(a) 1436#define KeReleaseSpinLockFromDpcLevel(a) KefReleaseSpinLockFromDpcLevel(a) | 1431#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) 1432#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) 1433#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) 1434#define KeLowerIrql(a) KfLowerIrql(a) 1435#define KeAcquireSpinLockAtDpcLevel(a) KefAcquireSpinLockAtDpcLevel(a) 1436#define KeReleaseSpinLockFromDpcLevel(a) KefReleaseSpinLockFromDpcLevel(a) |
1437#endif /* __i386__ */ 1438 1439#ifdef __amd64__ | 1437#endif /* __i386__ */ 1438 1439#ifdef __amd64__ |
1440#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) 1441#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) | 1440#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) 1441#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) |
1442 1443/* 1444 * These may need to be redefined later; 1445 * not sure where they live on amd64 yet. 1446 */ | 1442 1443/* 1444 * These may need to be redefined later; 1445 * not sure where they live on amd64 yet. 1446 */ |
1447#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) 1448#define KeLowerIrql(a) KfLowerIrql(a) | 1447#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) 1448#define KeLowerIrql(a) KfLowerIrql(a) |
1449#endif /* __amd64__ */ 1450 1451__END_DECLS 1452 1453#endif /* _NTOSKRNL_VAR_H_ */ | 1449#endif /* __amd64__ */ 1450 1451__END_DECLS 1452 1453#endif /* _NTOSKRNL_VAR_H_ */ |