ndiswrapper  1.63
About: ndiswrapper is a linux kernel module that loads and runs NDIS (Windows network driver API) drivers supplied by wireless network card vendors.
  Fossies Dox: ndiswrapper-1.63.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ntoskernel.h File Reference
#include <linux/types.h>
#include <linux/timer.h>
#include <linux/time.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/netdevice.h>
#include <linux/wireless.h>
#include <linux/pci.h>
#include <linux/wait.h>
#include <linux/pm.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/random.h>
#include <linux/ctype.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/usb.h>
#include <linux/spinlock.h>
#include <asm/mman.h>
#include <linux/version.h>
#include <linux/etherdevice.h>
#include <net/iw_handler.h>
#include <linux/ethtool.h>
#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
#include <linux/highmem.h>
#include <linux/percpu.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <asm/dma-mapping.h>
#include "winnt_types.h"
#include "ndiswrapper.h"
#include "pe_linker.h"
#include "wrapmem.h"
#include "lin2win.h"
#include "loader.h"
Include dependency graph for ntoskernel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  wrap_export
 
struct  pe_image
 
struct  wrap_timer
 
struct  ntos_work_item
 
struct  wrap_device_setting
 
struct  wrap_bin_file
 
struct  wrap_driver
 
struct  wrap_device
 
struct  irql_info
 

Macros

#define tsk_cpus_allowed(tsk)   (&(tsk)->cpus_mask)
 
#define __packed   __attribute__((packed))
 
#define ___GFP_RETRY_MAYFAIL   __GFP_REPEAT
 
#define PCI_DMA_ALLOC_COHERENT(pci_dev, size, dma_handle)
 
#define PCI_DMA_FREE_COHERENT(pci_dev, size, cpu_addr, dma_handle)   dma_free_coherent(&pci_dev->dev,size,cpu_addr,dma_handle)
 
#define PCI_DMA_MAP_SINGLE(pci_dev, addr, size, direction)   dma_map_single(&pci_dev->dev,addr,size,direction)
 
#define PCI_DMA_UNMAP_SINGLE(pci_dev, dma_handle, size, direction)   dma_unmap_single(&pci_dev->dev,dma_handle,size,direction)
 
#define MAP_SG(pci_dev, sglist, nents, direction)   dma_map_sg(&pci_dev->dev, sglist, nents, direction)
 
#define UNMAP_SG(pci_dev, sglist, nents, direction)   dma_unmap_sg(&pci_dev->dev, sglist, nents, direction)
 
#define PCI_DMA_MAP_ERROR(dma_addr)   dma_mapping_error(dma_addr)
 
#define prepare_wait_condition(task, var, value)
 
#define wait_condition(condition, timeout, wait_state)
 
#define ISR_PT_REGS_PARAM_DECL   , struct pt_regs *regs
 
#define for_each_possible_cpu(_cpu)   for_each_cpu(_cpu)
 
#define CHECKSUM_PARTIAL   CHECKSUM_HW
 
#define IRQF_SHARED   SA_SHIRQ
 
#define UMH_WAIT_PROC   1
 
#define memcpy_skb(skb, from, length)   memcpy(skb_put(skb, length), from, length)
 
#define __GFP_DMA32   GFP_DMA
 
#define wrap_kmem_cache_create(name, size, align, flags)   kmem_cache_create(name, size, align, flags, NULL, NULL)
 
#define daemonize(name, ...)   do {} while (0)
 
#define proc_net_root   init_net.proc_net
 
#define TICKSPERSEC   10000000
 
#define TICKSPERMSEC   10000
 
#define SECSPERDAY   86400
 
#define TICKSPERJIFFY   ((TICKSPERSEC + HZ - 1) / HZ)
 
#define int_div_round(x, y)   (((x) + (y - 1)) / (y))
 
#define SECS_1601_TO_1970   ((369 * 365 + 89) * (u64)SECSPERDAY)
 
#define TICKS_1601_TO_1970   (SECS_1601_TO_1970 * TICKSPERSEC)
 
#define SYSTEM_TIME_TO_HZ(sys_time)
 
#define MSEC_TO_HZ(ms)   int_div_round((ms * HZ), 1000)
 
#define USEC_TO_HZ(us)   int_div_round((us * HZ), 1000000)
 
#define WIN_SYMBOL(name, argc)   {#name, (generic_func)name}
 
#define WIN_WIN_SYMBOL(name, argc)   {#name, (generic_func)_win_ ## name}
 
#define WIN_FUNC_DECL(name, argc)
 
#define WIN_FUNC_PTR(name, argc)   name
 
#define WIN_FUNC(name, argc)   (name)
 
#define WIN_SYMBOL_MAP(s, f)
 
#define POOL_TAG(A, B, C, D)   ((ULONG)((A) + ((B) << 8) + ((C) << 16) + ((D) << 24)))
 
#define WRAP_DRIVER_CLIENT_ID   1
 
#define wrap_is_pci_bus(dev_bus)
 
#define wrap_is_usb_bus(dev_bus)   0
 
#define wrap_is_bluetooth_device(dev_bus)
 
#define atomic_unary_op(var, size, oper)
 
#define atomic_inc_var_size(var, size)   atomic_unary_op(var, size, "inc")
 
#define atomic_inc_var(var)   atomic_inc_var_size(var, sizeof(var))
 
#define atomic_dec_var_size(var, size)   atomic_unary_op(var, size, "dec")
 
#define atomic_dec_var(var)   atomic_dec_var_size(var, sizeof(var))
 
#define pre_atomic_add(var, i)
 
#define post_atomic_add(var, i)   (pre_atomic_add(var, i) + i)
 
#define assert_irql(cond)   do { } while (0)
 
#define WRAP_PREEMPT   1
 
#define irql_gfp()   (in_atomic() ? GFP_ATOMIC : GFP_KERNEL)
 
#define NT_SPIN_LOCK_UNLOCKED   0
 
#define NT_SPIN_LOCK_LOCKED   1
 
#define nt_spin_lock(lock)   do { } while (0)
 
#define nt_spin_unlock(lock)   do { } while (0)
 
#define nt_spin_lock_irqsave(lock, flags)
 
#define nt_spin_unlock_irqrestore(lock, flags)
 
#define u64_low_32(x)   ((u32)x)
 
#define u64_high_32(x)   ((u32)(x >> 32))
 
#define sleep_hz(n)
 
#define ObReferenceObject(object)   ObfReferenceObject(object)
 
#define ObDereferenceObject(object)   ObfDereferenceObject(object)
 
#define IoCompleteRequest(irp, prio)   IofCompleteRequest(irp, prio)
 
#define IoCallDriver(dev, irp)   IofCallDriver(dev, irp)
 
#define DUMP_IRP(_irp)   do { } while (0)
 

Typedefs

typedef void(* generic_func) (void)
 

Enumerations

enum  hw_status { HW_INITIALIZED = 1, HW_SUSPENDED, HW_HALTED, HW_DISABLED }
 

Functions

static void netif_poll_enable (struct net_device *dev)
 
static void netif_poll_disable (struct net_device *dev)
 
static u64 ticks_1601 (void)
 
 DECLARE_PER_CPU (struct irql_info, irql_info)
 
static KIRQL raise_irql (KIRQL newirql)
 
static void lower_irql (KIRQL oldirql)
 
static KIRQL current_irql (void)
 
static void nt_spin_lock_init (NT_SPIN_LOCK *lock)
 
static KIRQL nt_spin_lock_irql (NT_SPIN_LOCK *lock, KIRQL newirql)
 
static void nt_spin_unlock_irql (NT_SPIN_LOCK *lock, KIRQL oldirql)
 
static ULONG SPAN_PAGES (void *ptr, SIZE_T length)
 
static u64 nt_cmpxchg8b (volatile u64 *ptr, u64 old, u64 new)
 
static struct nt_slistPushEntrySList (nt_slist_header *head, struct nt_slist *entry, NT_SPIN_LOCK *lock)
 
static struct nt_slistPopEntrySList (nt_slist_header *head, NT_SPIN_LOCK *lock)
 
int ntoskernel_init (void)
 
void ntoskernel_exit (void)
 
int ntoskernel_init_device (struct wrap_device *wd)
 
void ntoskernel_exit_device (struct wrap_device *wd)
 
void * allocate_object (ULONG size, enum common_object_type type, struct unicode_string *name)
 
static int usb_init (void)
 
static void usb_exit (void)
 
int usb_init_device (struct wrap_device *wd)
 
void usb_exit_device (struct wrap_device *wd)
 
int wrap_procfs_init (void)
 
void wrap_procfs_remove (void)
 
int link_pe_images (struct pe_image *pe_image, unsigned short n)
 
int stricmp (const char *s1, const char *s2)
 
void dump_bytes (const char *name, const u8 *from, int len)
 
struct mdlallocate_init_mdl (void *virt, ULONG length)
 
void free_mdl (struct mdl *mdl)
 
struct driver_objectfind_bus_driver (const char *name)
 
void free_custom_extensions (struct driver_extension *drv_obj_ext)
 
struct nt_threadget_current_nt_thread (void)
 
int schedule_ntos_work_item (NTOS_WORK_FUNC func, void *arg1, void *arg2)
 
void wrap_init_timer (struct nt_timer *nt_timer, enum timer_type type, struct ndis_mp_block *nmb)
 
BOOLEAN wrap_set_timer (struct nt_timer *nt_timer, unsigned long expires_hz, unsigned long repeat_hz, struct kdpc *kdpc)
 
LONG InterlockedDecrement (LONG volatile *val) wfastcall
 
LONG InterlockedIncrement (LONG volatile *val) wfastcall
 
struct nt_listExInterlockedInsertHeadList (struct nt_list *head, struct nt_list *entry, NT_SPIN_LOCK *lock) wfastcall
 
struct nt_listExInterlockedInsertTailList (struct nt_list *head, struct nt_list *entry, NT_SPIN_LOCK *lock) wfastcall
 
struct nt_listExInterlockedRemoveHeadList (struct nt_list *head, NT_SPIN_LOCK *lock) wfastcall
 
NTSTATUS IofCallDriver (struct device_object *dev_obj, struct irp *irp) wfastcall
 
KIRQL KfRaiseIrql (KIRQL newirql) wfastcall
 
void KfLowerIrql (KIRQL oldirql) wfastcall
 
KIRQL KfAcquireSpinLock (NT_SPIN_LOCK *lock) wfastcall
 
void KfReleaseSpinLock (NT_SPIN_LOCK *lock, KIRQL oldirql) wfastcall
 
void IofCompleteRequest (struct irp *irp, CHAR prio_boost) wfastcall
 
void KefReleaseSpinLockFromDpcLevel (NT_SPIN_LOCK *lock) wfastcall
 
LONG ObfReferenceObject (void *object) wfastcall
 
void ObfDereferenceObject (void *object) wfastcall
 
void *() ExAllocatePoolWithTag (enum pool_type pool_type, SIZE_T size, ULONG tag)
 
void ExFreePool (void *p)
 
ULONG MmSizeOfMdl (void *base, ULONG length)
 
void __iomem * MmMapIoSpace (PHYSICAL_ADDRESS phys_addr, SIZE_T size, enum memory_caching_type cache)
 
void MmUnmapIoSpace (void __iomem *addr, SIZE_T size)
 
void MmProbeAndLockPages (struct mdl *mdl, KPROCESSOR_MODE access_mode, enum lock_operation operation)
 
void MmUnlockPages (struct mdl *mdl)
 
void KeInitializeEvent (struct nt_event *nt_event, enum event_type type, BOOLEAN state)
 
LONG KeSetEvent (struct nt_event *nt_event, KPRIORITY incr, BOOLEAN wait)
 
LONG KeResetEvent (struct nt_event *nt_event)
 
BOOLEAN queue_kdpc (struct kdpc *kdpc)
 
BOOLEAN dequeue_kdpc (struct kdpc *kdpc)
 
NTSTATUS IoConnectInterrupt (struct kinterrupt **kinterrupt, PKSERVICE_ROUTINE service_routine, void *service_context, NT_SPIN_LOCK *lock, ULONG vector, KIRQL irql, KIRQL synch_irql, enum kinterrupt_mode interrupt_mode, BOOLEAN shareable, KAFFINITY processor_enable_mask, BOOLEAN floating_save)
 
void IoDisconnectInterrupt (struct kinterrupt *interrupt)
 
BOOLEAN KeSynchronizeExecution (struct kinterrupt *interrupt, PKSYNCHRONIZE_ROUTINE synch_routine, void *ctx)
 
NTSTATUS KeWaitForSingleObject (void *object, KWAIT_REASON reason, KPROCESSOR_MODE waitmode, BOOLEAN alertable, LARGE_INTEGER *timeout)
 
void MmBuildMdlForNonPagedPool (struct mdl *mdl)
 
NTSTATUS IoCreateDevice (struct driver_object *driver, ULONG dev_ext_length, struct unicode_string *dev_name, ULONG dev_type, ULONG dev_chars, BOOLEAN exclusive, struct device_object **dev_obj)
 
NTSTATUS IoCreateSymbolicLink (struct unicode_string *link, struct unicode_string *dev_name)
 
void IoDeleteDevice (struct device_object *dev)
 
void IoDetachDevice (struct device_object *topdev)
 
struct device_objectIoGetAttachedDevice (struct device_object *dev)
 
struct device_objectIoGetAttachedDeviceReference (struct device_object *dev)
 
NTSTATUS IoAllocateDriverObjectExtension (struct driver_object *drv_obj, void *client_id, ULONG extlen, void **ext)
 
void * IoGetDriverObjectExtension (struct driver_object *drv, void *client_id)
 
struct device_objectIoAttachDeviceToDeviceStack (struct device_object *src, struct device_object *dst)
 
BOOLEAN IoCancelIrp (struct irp *irp)
 
struct irpIoBuildSynchronousFsdRequest (ULONG major_func, struct device_object *dev_obj, void *buf, ULONG length, LARGE_INTEGER *offset, struct nt_event *event, struct io_status_block *status)
 
NTSTATUS IoPassIrpDown (struct device_object *dev_obj, struct irp *irp)
 
NTSTATUS IoSyncForwardIrp (struct device_object *dev_obj, struct irp *irp)
 
NTSTATUS IoAsyncForwardIrp (struct device_object *dev_obj, struct irp *irp)
 
NTSTATUS IoInvalidDeviceRequest (struct device_object *dev_obj, struct irp *irp)
 
void KeInitializeSpinLock (NT_SPIN_LOCK *lock)
 
void IoAcquireCancelSpinLock (KIRQL *irql)
 
void IoReleaseCancelSpinLock (KIRQL irql)
 
NTSTATUS RtlUnicodeStringToAnsiString (struct ansi_string *dst, const struct unicode_string *src, BOOLEAN dup)
 
NTSTATUS RtlAnsiStringToUnicodeString (struct unicode_string *dst, const struct ansi_string *src, BOOLEAN dup)
 
void RtlInitAnsiString (struct ansi_string *dst, const char *src)
 
void RtlInitUnicodeString (struct unicode_string *dest, const wchar_t *src)
 
void RtlFreeUnicodeString (struct unicode_string *string)
 
void RtlFreeAnsiString (struct ansi_string *string)
 
LONG RtlCompareUnicodeString (const struct unicode_string *s1, const struct unicode_string *s2, BOOLEAN case_insensitive)
 
NTSTATUS RtlUpcaseUnicodeString (struct unicode_string *dst, struct unicode_string *src, BOOLEAN alloc)
 
BOOLEAN KeCancelTimer (struct nt_timer *nt_timer)
 
void KeInitializeDpc (struct kdpc *kdpc, void *func, void *ctx)
 

Variables

u64 wrap_ticks_to_boot
 
struct workqueue_struct * ntos_wq
 
struct workqueue_struct * ndis_wq
 
struct workqueue_struct * wrapndis_wq
 
spinlock_t ntoskernel_lock
 
spinlock_t irp_cancel_lock
 
struct nt_list object_list
 
CCHAR cpu_count
 

Macro Definition Documentation

◆ ___GFP_RETRY_MAYFAIL

#define ___GFP_RETRY_MAYFAIL   __GFP_REPEAT

Definition at line 131 of file ntoskernel.h.

◆ __GFP_DMA32

#define __GFP_DMA32   GFP_DMA

Definition at line 286 of file ntoskernel.h.

◆ __packed

#define __packed   __attribute__((packed))

Definition at line 122 of file ntoskernel.h.

◆ assert_irql

#define assert_irql (   cond)    do { } while (0)

Definition at line 619 of file ntoskernel.h.

◆ atomic_dec_var

#define atomic_dec_var (   var)    atomic_dec_var_size(var, sizeof(var))

Definition at line 591 of file ntoskernel.h.

◆ atomic_dec_var_size

#define atomic_dec_var_size (   var,
  size 
)    atomic_unary_op(var, size, "dec")

Definition at line 589 of file ntoskernel.h.

◆ atomic_inc_var

#define atomic_inc_var (   var)    atomic_inc_var_size(var, sizeof(var))

Definition at line 587 of file ntoskernel.h.

◆ atomic_inc_var_size

#define atomic_inc_var_size (   var,
  size 
)    atomic_unary_op(var, size, "inc")

Definition at line 585 of file ntoskernel.h.

◆ atomic_unary_op

#define atomic_unary_op (   var,
  size,
  oper 
)
Value:
do { \
if (size == 1) \
__asm__ __volatile__( \
LOCK_PREFIX oper "b %b0\n\t" : "+m" (var)); \
else if (size == 2) \
__asm__ __volatile__( \
LOCK_PREFIX oper "w %w0\n\t" : "+m" (var)); \
else if (size == 4) \
__asm__ __volatile__( \
LOCK_PREFIX oper "l %0\n\t" : "+m" (var)); \
else if (size == 8) \
__asm__ __volatile__( \
LOCK_PREFIX oper "q %q0\n\t" : "+m" (var)); \
else { \
extern void _invalid_op_size_(void); \
_invalid_op_size_(); \
} \
} while (0)

Definition at line 565 of file ntoskernel.h.

◆ CHECKSUM_PARTIAL

#define CHECKSUM_PARTIAL   CHECKSUM_HW

Definition at line 265 of file ntoskernel.h.

◆ daemonize

#define daemonize (   name,
  ... 
)    do {} while (0)

Definition at line 304 of file ntoskernel.h.

◆ DUMP_IRP

#define DUMP_IRP (   _irp)    do { } while (0)

Definition at line 1115 of file ntoskernel.h.

◆ for_each_possible_cpu

#define for_each_possible_cpu (   _cpu)    for_each_cpu(_cpu)

Definition at line 261 of file ntoskernel.h.

◆ int_div_round

#define int_div_round (   x,
 
)    (((x) + (y - 1)) / (y))

Definition at line 395 of file ntoskernel.h.

◆ IoCallDriver

#define IoCallDriver (   dev,
  irp 
)    IofCallDriver(dev, irp)

Definition at line 1100 of file ntoskernel.h.

◆ IoCompleteRequest

#define IoCompleteRequest (   irp,
  prio 
)    IofCompleteRequest(irp, prio)

Definition at line 1099 of file ntoskernel.h.

◆ IRQF_SHARED

#define IRQF_SHARED   SA_SHIRQ

Definition at line 269 of file ntoskernel.h.

◆ irql_gfp

#define irql_gfp ( )    (in_atomic() ? GFP_ATOMIC : GFP_KERNEL)

Definition at line 754 of file ntoskernel.h.

◆ ISR_PT_REGS_PARAM_DECL

#define ISR_PT_REGS_PARAM_DECL   , struct pt_regs *regs

Definition at line 257 of file ntoskernel.h.

◆ MAP_SG

#define MAP_SG (   pci_dev,
  sglist,
  nents,
  direction 
)    dma_map_sg(&pci_dev->dev, sglist, nents, direction)

Definition at line 143 of file ntoskernel.h.

◆ memcpy_skb

#define memcpy_skb (   skb,
  from,
  length 
)    memcpy(skb_put(skb, length), from, length)

Definition at line 276 of file ntoskernel.h.

◆ MSEC_TO_HZ

#define MSEC_TO_HZ (   ms)    int_div_round((ms * HZ), 1000)

Definition at line 408 of file ntoskernel.h.

◆ nt_spin_lock

#define nt_spin_lock (   lock)    do { } while (0)

Definition at line 801 of file ntoskernel.h.

◆ nt_spin_lock_irqsave

#define nt_spin_lock_irqsave (   lock,
  flags 
)
Value:
do { \
local_irq_save(flags); \
preempt_disable(); \
nt_spin_lock(lock); \
} while (0)

Definition at line 826 of file ntoskernel.h.

◆ NT_SPIN_LOCK_LOCKED

#define NT_SPIN_LOCK_LOCKED   1

Definition at line 765 of file ntoskernel.h.

◆ NT_SPIN_LOCK_UNLOCKED

#define NT_SPIN_LOCK_UNLOCKED   0

Definition at line 764 of file ntoskernel.h.

◆ nt_spin_unlock

#define nt_spin_unlock (   lock)    do { } while (0)

Definition at line 803 of file ntoskernel.h.

◆ nt_spin_unlock_irqrestore

#define nt_spin_unlock_irqrestore (   lock,
  flags 
)
Value:
do { \
nt_spin_unlock(lock); \
preempt_enable(); \
local_irq_restore(flags); \
} while (0)

Definition at line 833 of file ntoskernel.h.

◆ ObDereferenceObject

#define ObDereferenceObject (   object)    ObfDereferenceObject(object)

Definition at line 996 of file ntoskernel.h.

◆ ObReferenceObject

#define ObReferenceObject (   object)    ObfReferenceObject(object)

Definition at line 995 of file ntoskernel.h.

◆ PCI_DMA_ALLOC_COHERENT

#define PCI_DMA_ALLOC_COHERENT (   pci_dev,
  size,
  dma_handle 
)
Value:
dma_alloc_coherent(&pci_dev->dev,size,dma_handle, \
GFP_KERNEL | ___GFP_RETRY_MAYFAIL)

Definition at line 134 of file ntoskernel.h.

◆ PCI_DMA_FREE_COHERENT

#define PCI_DMA_FREE_COHERENT (   pci_dev,
  size,
  cpu_addr,
  dma_handle 
)    dma_free_coherent(&pci_dev->dev,size,cpu_addr,dma_handle)

Definition at line 137 of file ntoskernel.h.

◆ PCI_DMA_MAP_ERROR

#define PCI_DMA_MAP_ERROR (   dma_addr)    dma_mapping_error(dma_addr)

Definition at line 147 of file ntoskernel.h.

◆ PCI_DMA_MAP_SINGLE

#define PCI_DMA_MAP_SINGLE (   pci_dev,
  addr,
  size,
  direction 
)    dma_map_single(&pci_dev->dev,addr,size,direction)

Definition at line 139 of file ntoskernel.h.

◆ PCI_DMA_UNMAP_SINGLE

#define PCI_DMA_UNMAP_SINGLE (   pci_dev,
  dma_handle,
  size,
  direction 
)    dma_unmap_single(&pci_dev->dev,dma_handle,size,direction)

Definition at line 141 of file ntoskernel.h.

◆ POOL_TAG

#define POOL_TAG (   A,
  B,
  C,
 
)    ((ULONG)((A) + ((B) << 8) + ((C) << 16) + ((D) << 24)))

Definition at line 448 of file ntoskernel.h.

◆ post_atomic_add

#define post_atomic_add (   var,
 
)    (pre_atomic_add(var, i) + i)

Definition at line 603 of file ntoskernel.h.

◆ pre_atomic_add

#define pre_atomic_add (   var,
 
)
Value:
({ \
typeof(var) pre; \
__asm__ __volatile__( \
LOCK_PREFIX "xadd %0, %1\n\t" \
: "=r"(pre), "+m"(var) \
: "0"(i)); \
pre; \
})

Definition at line 593 of file ntoskernel.h.

◆ prepare_wait_condition

#define prepare_wait_condition (   task,
  var,
  value 
)
Value:
do { \
var = value; \
task = current; \
barrier(); \
} while (0)

Definition at line 154 of file ntoskernel.h.

◆ proc_net_root

#define proc_net_root   init_net.proc_net

Definition at line 347 of file ntoskernel.h.

◆ SECS_1601_TO_1970

#define SECS_1601_TO_1970   ((369 * 365 + 89) * (u64)SECSPERDAY)

Definition at line 398 of file ntoskernel.h.

◆ SECSPERDAY

#define SECSPERDAY   86400

Definition at line 392 of file ntoskernel.h.

◆ sleep_hz

#define sleep_hz (   n)
Value:
do { \
set_current_state(TASK_INTERRUPTIBLE); \
schedule_timeout(n); \
} while (0)

Definition at line 932 of file ntoskernel.h.

◆ SYSTEM_TIME_TO_HZ

#define SYSTEM_TIME_TO_HZ (   sys_time)
Value:
(((sys_time) <= 0) ? \
int_div_round(((u64)HZ * (-(sys_time))), TICKSPERSEC) : \
int_div_round(((s64)HZ * ((sys_time) - ticks_1601())), TICKSPERSEC))

Definition at line 403 of file ntoskernel.h.

◆ TICKS_1601_TO_1970

#define TICKS_1601_TO_1970   (SECS_1601_TO_1970 * TICKSPERSEC)

Definition at line 399 of file ntoskernel.h.

◆ TICKSPERJIFFY

#define TICKSPERJIFFY   ((TICKSPERSEC + HZ - 1) / HZ)

Definition at line 393 of file ntoskernel.h.

◆ TICKSPERMSEC

#define TICKSPERMSEC   10000

Definition at line 391 of file ntoskernel.h.

◆ TICKSPERSEC

#define TICKSPERSEC   10000000

Definition at line 390 of file ntoskernel.h.

◆ tsk_cpus_allowed

#define tsk_cpus_allowed (   tsk)    (&(tsk)->cpus_mask)

Definition at line 115 of file ntoskernel.h.

◆ u64_high_32

#define u64_high_32 (   x)    ((u32)(x >> 32))

Definition at line 881 of file ntoskernel.h.

◆ u64_low_32

#define u64_low_32 (   x)    ((u32)x)

Definition at line 880 of file ntoskernel.h.

◆ UMH_WAIT_PROC

#define UMH_WAIT_PROC   1

Definition at line 273 of file ntoskernel.h.

◆ UNMAP_SG

#define UNMAP_SG (   pci_dev,
  sglist,
  nents,
  direction 
)    dma_unmap_sg(&pci_dev->dev, sglist, nents, direction)

Definition at line 145 of file ntoskernel.h.

◆ USEC_TO_HZ

#define USEC_TO_HZ (   us)    int_div_round((us * HZ), 1000000)

Definition at line 409 of file ntoskernel.h.

◆ wait_condition

#define wait_condition (   condition,
  timeout,
  wait_state 
)
Value:
({ \
long ret = timeout ? timeout : 1; \
while (1) { \
if (signal_pending(current)) { \
ret = -ERESTARTSYS; \
break; \
} \
set_current_state(wait_state); \
if (condition) { \
__set_current_state(TASK_RUNNING); \
break; \
} \
if (timeout) { \
ret = schedule_timeout(ret); \
if (!ret) \
break; \
} else \
schedule(); \
} \
ret; \
})

Definition at line 173 of file ntoskernel.h.

◆ WIN_FUNC

#define WIN_FUNC (   name,
  argc 
)    (name)

Definition at line 444 of file ntoskernel.h.

◆ WIN_FUNC_DECL

#define WIN_FUNC_DECL (   name,
  argc 
)

Definition at line 439 of file ntoskernel.h.

◆ WIN_FUNC_PTR

#define WIN_FUNC_PTR (   name,
  argc 
)    name

Definition at line 440 of file ntoskernel.h.

◆ WIN_SYMBOL

#define WIN_SYMBOL (   name,
  argc 
)    {#name, (generic_func)name}

Definition at line 437 of file ntoskernel.h.

◆ WIN_SYMBOL_MAP

#define WIN_SYMBOL_MAP (   s,
 
)

Definition at line 446 of file ntoskernel.h.

◆ WIN_WIN_SYMBOL

#define WIN_WIN_SYMBOL (   name,
  argc 
)    {#name, (generic_func)_win_ ## name}

Definition at line 438 of file ntoskernel.h.

◆ WRAP_DRIVER_CLIENT_ID

#define WRAP_DRIVER_CLIENT_ID   1

Definition at line 494 of file ntoskernel.h.

◆ wrap_is_bluetooth_device

#define wrap_is_bluetooth_device (   dev_bus)
Value:
WRAP_DEVICE(dev_bus) == WRAP_BLUETOOTH_DEVICE2)

Definition at line 557 of file ntoskernel.h.

◆ wrap_is_pci_bus

#define wrap_is_pci_bus (   dev_bus)
Value:
(WRAP_BUS(dev_bus) == WRAP_PCI_BUS || \
WRAP_BUS(dev_bus) == WRAP_PCMCIA_BUS)

Definition at line 546 of file ntoskernel.h.

◆ wrap_is_usb_bus

#define wrap_is_usb_bus (   dev_bus)    0

Definition at line 555 of file ntoskernel.h.

◆ wrap_kmem_cache_create

#define wrap_kmem_cache_create (   name,
  size,
  align,
  flags 
)    kmem_cache_create(name, size, align, flags, NULL, NULL)

Definition at line 290 of file ntoskernel.h.

◆ WRAP_PREEMPT

#define WRAP_PREEMPT   1

Definition at line 630 of file ntoskernel.h.

Typedef Documentation

◆ generic_func

typedef void(* generic_func) (void)

Definition at line 417 of file ntoskernel.h.

Enumeration Type Documentation

◆ hw_status

enum hw_status
Enumerator
HW_INITIALIZED 
HW_SUSPENDED 
HW_HALTED 
HW_DISABLED 

Definition at line 509 of file ntoskernel.h.

Function Documentation

◆ allocate_init_mdl()

◆ allocate_object()

◆ current_irql()

static KIRQL current_irql ( void  )
inlinestatic

◆ DECLARE_PER_CPU()

DECLARE_PER_CPU ( struct irql_info  ,
irql_info   
)

◆ dequeue_kdpc()

BOOLEAN dequeue_kdpc ( struct kdpc kdpc)

◆ dump_bytes()

void dump_bytes ( const char *  name,
const u8 *  from,
int  len 
)

Definition at line 573 of file crt.c.

References ERROR, and irql_gfp.

Referenced by alloc_tx_packet(), and NdisMStartBufferPhysicalMapping().

◆ ExAllocatePoolWithTag()

◆ ExFreePool()

◆ ExInterlockedInsertHeadList()

struct nt_list* ExInterlockedInsertHeadList ( struct nt_list head,
struct nt_list entry,
NT_SPIN_LOCK lock 
)

Definition at line 212 of file ntoskernel.c.

References ExfInterlockedInsertHeadList().

◆ ExInterlockedInsertTailList()

struct nt_list* ExInterlockedInsertTailList ( struct nt_list head,
struct nt_list entry,
NT_SPIN_LOCK lock 
)

Definition at line 233 of file ntoskernel.c.

References ExfInterlockedInsertTailList().

◆ ExInterlockedRemoveHeadList()

struct nt_list* ExInterlockedRemoveHeadList ( struct nt_list head,
NT_SPIN_LOCK lock 
)

Definition at line 254 of file ntoskernel.c.

References ExfInterlockedRemoveHeadList().

◆ find_bus_driver()

struct driver_object* find_bus_driver ( const char *  name)

◆ free_custom_extensions()

void free_custom_extensions ( struct driver_extension drv_obj_ext)

◆ free_mdl()

◆ get_current_nt_thread()

◆ InterlockedDecrement()

LONG InterlockedDecrement ( LONG volatile *  val)

Definition at line 358 of file ntoskernel.c.

References post_atomic_add.

Referenced by NdisInterlockedDecrement().

◆ InterlockedIncrement()

LONG InterlockedIncrement ( LONG volatile *  val)

Definition at line 352 of file ntoskernel.c.

References post_atomic_add.

Referenced by NdisInterlockedRemoveHeadList().

◆ IoAcquireCancelSpinLock()

void IoAcquireCancelSpinLock ( KIRQL irql)

Definition at line 23 of file ntoskernel_io.c.

References irp_cancel_lock.

Referenced by IoCancelIrp(), kill_all_urbs(), wrap_abort_pipe(), wrap_alloc_urb(), and wrap_free_urb().

◆ IoAllocateDriverObjectExtension()

NTSTATUS IoAllocateDriverObjectExtension ( struct driver_object drv_obj,
void *  client_id,
ULONG  extlen,
void **  ext 
)

◆ IoAsyncForwardIrp()

NTSTATUS IoAsyncForwardIrp ( struct device_object dev_obj,
struct irp irp 
)

Definition at line 505 of file ntoskernel_io.c.

References IoCallDriver, and IoCopyCurrentIrpStackLocationToNext().

Referenced by NdisDispatchPnp(), and NdisDispatchPower().

◆ IoAttachDeviceToDeviceStack()

struct device_object* IoAttachDeviceToDeviceStack ( struct device_object src,
struct device_object dst 
)

Definition at line 835 of file ntoskernel_io.c.

Referenced by ndis_add_device().

◆ IoBuildSynchronousFsdRequest()

struct irp* IoBuildSynchronousFsdRequest ( ULONG  major_func,
struct device_object dev_obj,
void *  buf,
ULONG  length,
LARGE_INTEGER offset,
struct nt_event event,
struct io_status_block status 
)

Definition at line 169 of file ntoskernel_io.c.

Referenced by IoSendIrpTopDev().

◆ IoCancelIrp()

◆ IoConnectInterrupt()

NTSTATUS IoConnectInterrupt ( struct kinterrupt **  kinterrupt,
PKSERVICE_ROUTINE  service_routine,
void *  service_context,
NT_SPIN_LOCK lock,
ULONG  vector,
KIRQL  irql,
KIRQL  synch_irql,
enum kinterrupt_mode  interrupt_mode,
BOOLEAN  shareable,
KAFFINITY  processor_enable_mask,
BOOLEAN  floating_save 
)

◆ IoCreateDevice()

◆ IoCreateSymbolicLink()

NTSTATUS IoCreateSymbolicLink ( struct unicode_string link,
struct unicode_string dev_name 
)

Definition at line 791 of file ntoskernel_io.c.

References IoCreateUnprotectedSymbolicLink().

Referenced by NdisMRegisterDevice().

◆ IoDeleteDevice()

◆ IoDetachDevice()

void IoDetachDevice ( struct device_object topdev)

Definition at line 835 of file ntoskernel_io.c.

Referenced by NdisDispatchPnp().

◆ IoDisconnectInterrupt()

void IoDisconnectInterrupt ( struct kinterrupt interrupt)

Definition at line 590 of file ntoskernel_io.c.

Referenced by NdisMDeregisterInterrupt().

◆ IofCallDriver()

◆ IofCompleteRequest()

◆ IoGetAttachedDevice()

struct device_object* IoGetAttachedDevice ( struct device_object dev)

◆ IoGetAttachedDeviceReference()

struct device_object* IoGetAttachedDeviceReference ( struct device_object dev)

Definition at line 835 of file ntoskernel_io.c.

References device_object::attached, ntoskernel_lock, and device_object::stack_count.

Referenced by IoSendIrpTopDev().

◆ IoGetDriverObjectExtension()

void* IoGetDriverObjectExtension ( struct driver_object drv,
void *  client_id 
)

◆ IoInvalidDeviceRequest()

◆ IoPassIrpDown()

NTSTATUS IoPassIrpDown ( struct device_object dev_obj,
struct irp irp 
)

◆ IoReleaseCancelSpinLock()

void IoReleaseCancelSpinLock ( KIRQL  irql)

◆ IoSyncForwardIrp()

◆ KeCancelTimer()

BOOLEAN KeCancelTimer ( struct nt_timer nt_timer)

◆ KefReleaseSpinLockFromDpcLevel()

void KefReleaseSpinLockFromDpcLevel ( NT_SPIN_LOCK lock)

Definition at line 149 of file hal.c.

References current_irql(), DISPATCH_LEVEL, ERROR, and nt_spin_unlock.

◆ KeInitializeDpc()

void KeInitializeDpc ( struct kdpc kdpc,
void *  func,
void *  ctx 
)

◆ KeInitializeEvent()

void KeInitializeEvent ( struct nt_event nt_event,
enum event_type  type,
BOOLEAN  state 
)

◆ KeInitializeSpinLock()

void KeInitializeSpinLock ( NT_SPIN_LOCK lock)

◆ KeResetEvent()

LONG KeResetEvent ( struct nt_event nt_event)

Definition at line 1247 of file ntoskernel.c.

References nt_event::dh, and dispatcher_header::signal_state.

Referenced by NdisResetEvent().

◆ KeSetEvent()

◆ KeSynchronizeExecution()

BOOLEAN KeSynchronizeExecution ( struct kinterrupt interrupt,
PKSYNCHRONIZE_ROUTINE  synch_routine,
void *  ctx 
)

◆ KeWaitForSingleObject()

NTSTATUS KeWaitForSingleObject ( void *  object,
KWAIT_REASON  reason,
KPROCESSOR_MODE  waitmode,
BOOLEAN  alertable,
LARGE_INTEGER timeout 
)

Definition at line 1206 of file ntoskernel.c.

References KeWaitForMultipleObjects(), and WaitAny.

Referenced by IoSendIrpTopDev(), IoSyncForwardIrp(), and NdisWaitEvent().

◆ KfAcquireSpinLock()

KIRQL KfAcquireSpinLock ( NT_SPIN_LOCK lock)

Definition at line 127 of file hal.c.

References DISPATCH_LEVEL, and nt_spin_lock_irql().

◆ KfLowerIrql()

void KfLowerIrql ( KIRQL  oldirql)

Definition at line 121 of file hal.c.

References lower_irql().

◆ KfRaiseIrql()

KIRQL KfRaiseIrql ( KIRQL  newirql)

Definition at line 115 of file hal.c.

References raise_irql().

◆ KfReleaseSpinLock()

void KfReleaseSpinLock ( NT_SPIN_LOCK lock,
KIRQL  oldirql 
)

Definition at line 133 of file hal.c.

References nt_spin_unlock_irql().

◆ link_pe_images()

◆ lower_irql()

static void lower_irql ( KIRQL  oldirql)
inlinestatic

◆ MmBuildMdlForNonPagedPool()

◆ MmMapIoSpace()

void __iomem* MmMapIoSpace ( PHYSICAL_ADDRESS  phys_addr,
SIZE_T  size,
enum memory_caching_type  cache 
)

Definition at line 1758 of file ntoskernel.c.

References MmCached.

Referenced by NdisMMapIoSpace().

◆ MmProbeAndLockPages()

void MmProbeAndLockPages ( struct mdl mdl,
KPROCESSOR_MODE  access_mode,
enum lock_operation  operation 
)

Definition at line 1922 of file ntoskernel.c.

References mdl::flags, and MDL_PAGES_LOCKED.

◆ MmSizeOfMdl()

ULONG MmSizeOfMdl ( void *  base,
ULONG  length 
)

Definition at line 1789 of file ntoskernel.c.

References SPAN_PAGES().

Referenced by allocate_init_mdl().

◆ MmUnlockPages()

void MmUnlockPages ( struct mdl mdl)

Definition at line 1931 of file ntoskernel.c.

References mdl::flags, and MDL_PAGES_LOCKED.

Referenced by IofCompleteRequest().

◆ MmUnmapIoSpace()

void MmUnmapIoSpace ( void __iomem *  addr,
SIZE_T  size 
)

Definition at line 1781 of file ntoskernel.c.

Referenced by NdisMUnmapIoSpace().

◆ netif_poll_disable()

static void netif_poll_disable ( struct net_device *  dev)
inlinestatic

Definition at line 340 of file ntoskernel.h.

Referenced by ndis_net_dev_close().

◆ netif_poll_enable()

static void netif_poll_enable ( struct net_device *  dev)
inlinestatic

Definition at line 337 of file ntoskernel.h.

Referenced by ndis_net_dev_open().

◆ nt_cmpxchg8b()

static u64 nt_cmpxchg8b ( volatile u64 *  ptr,
u64  old,
u64  new 
)
inlinestatic

Definition at line 882 of file ntoskernel.h.

References u64_high_32, and u64_low_32.

Referenced by PopEntrySList(), and PushEntrySList().

◆ nt_spin_lock_init()

◆ nt_spin_lock_irql()

◆ nt_spin_unlock_irql()

◆ ntoskernel_exit()

◆ ntoskernel_exit_device()

void ntoskernel_exit_device ( struct wrap_device wd)

Definition at line 2617 of file ntoskernel.c.

References KeFlushQueuedDpcs().

Referenced by remove_pdo(), and start_pdo().

◆ ntoskernel_init()

◆ ntoskernel_init_device()

int ntoskernel_init_device ( struct wrap_device wd)

Definition at line 2608 of file ntoskernel.c.

References MSEC_TO_HZ, and kuser_shared_data::reserved1.

Referenced by start_pdo().

◆ ObfDereferenceObject()

void ObfDereferenceObject ( void *  object)

Definition at line 2007 of file ntoskernel.c.

References dereference_object().

◆ ObfReferenceObject()

LONG ObfReferenceObject ( void *  object)

Definition at line 1976 of file ntoskernel.c.

References OBJECT_TO_HEADER, post_atomic_add, and common_object_header::ref_count.

◆ PopEntrySList()

static struct nt_slist* PopEntrySList ( nt_slist_header head,
NT_SPIN_LOCK lock 
)
inlinestatic

◆ PushEntrySList()

static struct nt_slist* PushEntrySList ( nt_slist_header head,
struct nt_slist entry,
NT_SPIN_LOCK lock 
)
inlinestatic

◆ queue_kdpc()

◆ raise_irql()

◆ RtlAnsiStringToUnicodeString()

◆ RtlCompareUnicodeString()

LONG RtlCompareUnicodeString ( const struct unicode_string s1,
const struct unicode_string s2,
BOOLEAN  case_insensitive 
)

Definition at line 97 of file rtl.c.

References unicode_string::buf, and unicode_string::length.

Referenced by PoSetPowerState(), RtlEqualUnicodeString(), and ZwCreateFile().

◆ RtlFreeAnsiString()

◆ RtlFreeUnicodeString()

◆ RtlInitAnsiString()

◆ RtlInitUnicodeString()

void RtlInitUnicodeString ( struct unicode_string dest,
const wchar_t src 
)

◆ RtlUnicodeStringToAnsiString()

◆ RtlUpcaseUnicodeString()

◆ schedule_ntos_work_item()

◆ SPAN_PAGES()

static ULONG SPAN_PAGES ( void *  ptr,
SIZE_T  length 
)
inlinestatic

Definition at line 839 of file ntoskernel.h.

Referenced by MmBuildMdlForNonPagedPool(), MmSizeOfMdl(), and NDIS_BUFFER_TO_SPAN_PAGES().

◆ stricmp()

int stricmp ( const char *  s1,
const char *  s2 
)

Definition at line 564 of file crt.c.

Referenced by _win_stricmp(), add_bin_file(), add_wrap_driver(), get_bin_file(), and load_wrap_driver().

◆ ticks_1601()

u64 ticks_1601 ( void  )
inlinestatic

Definition at line 412 of file ntoskernel.h.

References TICKSPERJIFFY, and wrap_ticks_to_boot.

Referenced by KeQuerySystemTime(), NdisGetCurrentSystemTime(), and ntoskernel_init().

◆ usb_exit()

static void usb_exit ( void  )
inlinestatic

Definition at line 949 of file ntoskernel.h.

◆ usb_exit_device()

void usb_exit_device ( struct wrap_device wd)

Definition at line 1497 of file usb.c.

References kill_all_urbs().

Referenced by remove_pdo().

◆ usb_init()

static int usb_init ( void  )
inlinestatic

Definition at line 948 of file ntoskernel.h.

◆ usb_init_device()

int usb_init_device ( struct wrap_device wd)

Definition at line 1490 of file usb.c.

References InitializeListHead(), and wrap_device::usb.

Referenced by start_pdo().

◆ wrap_init_timer()

◆ wrap_procfs_init()

int wrap_procfs_init ( void  )

◆ wrap_procfs_remove()

void wrap_procfs_remove ( void  )

Definition at line 613 of file proc.c.

References wrap_procfs_entry.

Referenced by module_cleanup().

◆ wrap_set_timer()

BOOLEAN wrap_set_timer ( struct nt_timer nt_timer,
unsigned long  expires_hz,
unsigned long  repeat_hz,
struct kdpc kdpc 
)

Variable Documentation

◆ cpu_count

CCHAR cpu_count

Definition at line 71 of file ntoskernel.c.

Referenced by ntoskernel_init().

◆ irp_cancel_lock

spinlock_t irp_cancel_lock

Definition at line 68 of file ntoskernel.c.

Referenced by IoAcquireCancelSpinLock(), IoReleaseCancelSpinLock(), and ntoskernel_init().

◆ ndis_wq

struct workqueue_struct* ndis_wq

Definition at line 32 of file ndis.c.

Referenced by ndis_exit(), ndis_init(), and NdisScheduleWorkItem().

◆ ntos_wq

struct workqueue_struct* ntos_wq

◆ ntoskernel_lock

◆ object_list

◆ wrap_ticks_to_boot

u64 wrap_ticks_to_boot

Definition at line 75 of file ntoskernel.c.

Referenced by ntoskernel_init(), and ticks_1601().

◆ wrapndis_wq

WRAP_PCMCIA_BUS
#define WRAP_PCMCIA_BUS
Definition: ndiswrapper.h:33
mdl::flags
CSHORT flags
Definition: winnt_types.h:293
WRAP_DEVICE
#define WRAP_DEVICE(dev_bus)
Definition: ndiswrapper.h:49
WRAP_BUS
#define WRAP_BUS(dev_bus)
Definition: ndiswrapper.h:48
int_div_round
#define int_div_round(x, y)
Definition: ntoskernel.h:394
mdl::size
CSHORT size
Definition: winnt_types.h:292
TICKSPERSEC
#define TICKSPERSEC
Definition: ntoskernel.h:389
WRAP_PCI_BUS
#define WRAP_PCI_BUS
Definition: ndiswrapper.h:32
___GFP_RETRY_MAYFAIL
#define ___GFP_RETRY_MAYFAIL
Definition: ntoskernel.h:130
WRAP_BLUETOOTH_DEVICE1
#define WRAP_BLUETOOTH_DEVICE1
Definition: ndiswrapper.h:44
WRAP_BLUETOOTH_DEVICE2
#define WRAP_BLUETOOTH_DEVICE2
Definition: ndiswrapper.h:45
ticks_1601
static u64 ticks_1601(void)
Definition: ntoskernel.h:412