⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winnt_types.h

📁 ndis在linux下的无线网卡驱动源码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* *  Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *  GNU General Public License for more details. * */#ifndef _WINNT_TYPES_H_#define _WINNT_TYPES_H_#define TRUE				1#define FALSE				0#define PASSIVE_LEVEL			0#define DISPATCH_LEVEL			2#define DEVICE_LEVEL			(DISPATCH_LEVEL + 1)#define STATUS_WAIT_0			0#define STATUS_SUCCESS                  0#define STATUS_ALERTED                  0x00000101#define STATUS_TIMEOUT                  0x00000102#define STATUS_PENDING                  0x00000103#define STATUS_FAILURE                  0xC0000001#define STATUS_NOT_IMPLEMENTED		0xC0000002#define STATUS_INVALID_PARAMETER        0xC000000D#define STATUS_INVALID_DEVICE_REQUEST	0xC0000010#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016#define STATUS_ACCESS_DENIED            0xC0000022#define STATUS_BUFFER_TOO_SMALL         0xC0000023#define STATUS_OBJECT_NAME_INVALID      0xC0000023#define STATUS_MUTANT_NOT_OWNED		0xC0000046#define STATUS_RESOURCES                0xC000009A#define STATUS_DELETE_PENDING		0xC0000056#define STATUS_INSUFFICIENT_RESOURCES	0xC000009A#define STATUS_NOT_SUPPORTED            0xC00000BB#define STATUS_INVALID_PARAMETER_2      0xC00000F0#define STATUS_NO_MEMORY		0xC0000017#define STATUS_CANCELLED                0xC0000120#define STATUS_DEVICE_REMOVED		0xC00002B6#define STATUS_DEVICE_NOT_CONNECTED	0xC000009D#define STATUS_BUFFER_OVERFLOW		0x80000005#define SL_PENDING_RETURNED		0x01#define SL_INVOKE_ON_CANCEL		0x20#define SL_INVOKE_ON_SUCCESS		0x40#define SL_INVOKE_ON_ERROR		0x80#define IRP_MJ_CREATE			0x00#define IRP_MJ_CREATE_NAMED_PIPE	0x01#define IRP_MJ_CLOSE			0x02#define IRP_MJ_READ			0x03#define IRP_MJ_WRITE			0x04#define IRP_MJ_DEVICE_CONTROL		0x0E#define IRP_MJ_INTERNAL_DEVICE_CONTROL	0x0F#define IRP_MJ_POWER			0x16#define IRP_MJ_SYSTEM_CONTROL		0x0E#define IRP_MJ_PNP			0x1b#define IRP_MJ_MAXIMUM_FUNCTION		0x1b#define IRP_MN_WAIT_WAKE		0x00#define IRP_MN_POWER_SEQUENCE		0x01#define IRP_MN_SET_POWER		0x02#define IRP_MN_QUERY_POWER		0x03#define IRP_MN_REGINFO			0x08#define IRP_MN_REGINFO_EX		0x0b#define IRP_MN_START_DEVICE		0x00#define IRP_MN_QUERY_REMOVE_DEVICE	0x01#define IRP_MN_REMOVE_DEVICE		0x02#define IRP_MN_CANCEL_REMOVE_DEVICE	0x03#define IRP_MN_STOP_DEVICE		0x04#define IRP_MN_QUERY_STOP_DEVICE	0x05#define IRP_MN_CANCEL_STOP_DEVICE	0x06#define IRP_MN_QUERY_DEVICE_RELATIONS	0x07#define IRP_MN_QUERY_INTERFACE		0x08#define IRP_BUFFERED_IO			0x00000010#define IRP_DEALLOCATE_BUFFER		0x00000020#define IRP_INPUT_OPERATION		0x00000040#define IRP_DEFFER_IO_COMPLETION	0x00000800#define THREAD_WAIT_OBJECTS		3#define MAX_WAIT_OBJECTS		64#define LOW_PRIORITY			1#define LOW_REALTIME_PRIORITY		16#define HIGH_PRIORITY			32#define MAXIMUM_PRIORITY		32#define PROCESSOR_FEATURE_MAX		64#define IO_NO_INCREMENT			0#define WMIREG_ACTION_REGISTER		1#define WMIREG_ACTION_DEREGISTER	2#define WMIREG_ACTION_REREGISTER	3#define WMIREG_ACTION_UPDATE_GUIDS	4#define WMIREGISTER			0#define WMIUPDATE			1#ifdef CONFIG_X86_64#define wstdcall#define wfastcall#define noregparm#define KI_USER_SHARED_DATA 0xfffff78000000000#else#define noregparm __attribute__((regparm(0)))#define wstdcall __attribute__((__stdcall__, regparm(0)))#if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ > 3) || __GNUC__ > 3)#undef fastcall#define wfastcall __attribute__((fastcall))#else#error "gcc 3.4 or newer should be used for compiling this module"#endif#define KI_USER_SHARED_DATA 0xffdf0000#endif#define packed __attribute__((packed))#define no_warn_unused __attribute__((unused))typedef u8	BOOLEAN;typedef u8	BYTE;typedef u8	*LPBYTE;typedef s8	CHAR;typedef u8	UCHAR;typedef s16	SHORT;typedef u16	USHORT;typedef u16	WORD;typedef s32	INT;typedef u32	UINT;typedef u32	DWORD;typedef s32	LONG;typedef u32	ULONG;typedef s64	LONGLONG;typedef u64	ULONGLONG;typedef u64	ULONGULONG;typedef u64	ULONG64;typedef CHAR CCHAR;typedef USHORT wchar_t;typedef SHORT CSHORT;typedef LONGLONG LARGE_INTEGER;typedef LONG NTSTATUS;typedef LONG KPRIORITY;typedef LARGE_INTEGER PHYSICAL_ADDRESS;typedef UCHAR KIRQL;typedef CHAR KPROCESSOR_MODE;/* ULONG_PTR is 32 bits on 32-bit platforms and 64 bits on 64-bit * platform, which is same as 'unsigned long' in Linux */typedef unsigned long ULONG_PTR;typedef ULONG_PTR SIZE_T;typedef ULONG_PTR KAFFINITY;typedef ULONG ACCESS_MASK;typedef ULONG_PTR PFN_NUMBER;typedef ULONG SECURITY_INFORMATION;/* non-negative numbers indicate success */#define NT_SUCCESS(status)  ((NTSTATUS)(status) >= 0)struct ansi_string {	USHORT length;	USHORT max_length;	char *buf;};struct unicode_string {	USHORT length;	USHORT max_length;	wchar_t *buf;};struct nt_slist {	struct nt_slist *next;};#ifdef CONFIG_X86_64/* it is not clear how nt_slist_head is used to store pointer to * slists and depth; here we assume 'align' field is used to store * depth and 'region' field is used to store slist pointers */struct nt_slist_head {	union {		USHORT depth;		ULONGLONG align;	};	union {		ULONGLONG region;		struct nt_slist *next;	};} __attribute__((aligned(16)));typedef struct nt_slist_head nt_slist_header;#elseunion nt_slist_head {	ULONGLONG align;	struct {		struct nt_slist *next;		USHORT depth;		USHORT sequence;	};};typedef union nt_slist_head nt_slist_header;#endifstruct nt_list {	struct nt_list *next;	struct nt_list *prev;};typedef volatile ULONG_PTR NT_SPIN_LOCK;enum kdpc_importance {LowImportance, MediumImportance, HighImportance};struct kdpc;typedef void (*DPC)(struct kdpc *kdpc, void *ctx, void *arg1,		    void *arg2) wstdcall;struct kdpc {	SHORT type;	UCHAR nr_cpu;	UCHAR importance;	struct nt_list list;	DPC func;	void *ctx;	void *arg1;	void *arg2;	union {		NT_SPIN_LOCK *lock;		/* 'lock' is not used; 'queued' represents whether		 * kdpc is queued or not */		int queued;	};};enum pool_type {	NonPagedPool, PagedPool, NonPagedPoolMustSucceed, DontUseThisType,	NonPagedPoolCacheAligned, PagedPoolCacheAligned,	NonPagedPoolCacheAlignedMustS, MaxPoolType,	NonPagedPoolSession = 32,	PagedPoolSession = NonPagedPoolSession + 1,	NonPagedPoolMustSucceedSession = PagedPoolSession + 1,	DontUseThisTypeSession = NonPagedPoolMustSucceedSession + 1,	NonPagedPoolCacheAlignedSession = DontUseThisTypeSession + 1,	PagedPoolCacheAlignedSession = NonPagedPoolCacheAlignedSession + 1,	NonPagedPoolCacheAlignedMustSSession = PagedPoolCacheAlignedSession + 1};enum memory_caching_type_orig {	MmFrameBufferCached = 2};enum memory_caching_type {	MmNonCached = FALSE, MmCached = TRUE,	MmWriteCombined = MmFrameBufferCached, MmHardwareCoherentCached,	MmNonCachedUnordered, MmUSWCCached, MmMaximumCacheType};enum lock_operation {	IoReadAccess, IoWriteAccess, IoModifyAccess};enum mode {	KernelMode, UserMode, MaximumMode};struct mdl {	struct mdl *next;	CSHORT size;	CSHORT flags;	/* NdisFreeBuffer doesn't pass pool, so we store pool in	 * unused field 'process' */	union {		void *process;		void *pool;	};	void *mappedsystemva;	void *startva;	ULONG bytecount;	ULONG byteoffset;};#define MDL_MAPPED_TO_SYSTEM_VA		0x0001#define MDL_PAGES_LOCKED		0x0002#define MDL_SOURCE_IS_NONPAGED_POOL	0x0004#define MDL_ALLOCATED_FIXED_SIZE	0x0008#define MDL_PARTIAL			0x0010#define MDL_PARTIAL_HAS_BEEN_MAPPED	0x0020#define MDL_IO_PAGE_READ		0x0040#define MDL_WRITE_OPERATION		0x0080#define MDL_PARENT_MAPPED_SYSTEM_VA	0x0100#define MDL_FREE_EXTRA_PTES		0x0200#define MDL_IO_SPACE			0x0800#define MDL_NETWORK_HEADER		0x1000#define MDL_MAPPING_CAN_FAIL		0x2000#define MDL_ALLOCATED_MUST_SUCCEED	0x4000#define MDL_POOL_ALLOCATED		0x0400#define MDL_CACHE_ALLOCATED		0x8000#define PAGE_START(ptr) ((void *)((ULONG_PTR)(ptr) & ~(PAGE_SIZE - 1)))#define BYTE_OFFSET(ptr) ((ULONG)((ULONG_PTR)(ptr) & (PAGE_SIZE - 1)))#define MmGetMdlByteCount(mdl) ((mdl)->bytecount)#define MmGetMdlVirtualAddress(mdl) ((mdl)->startva + (mdl)->byteoffset)#define MmGetMdlByteOffset(mdl) ((mdl)->byteoffset)#define MmGetSystemAddressForMdl(mdl) ((mdl)->mappedsystemva)#define MmGetSystemAddressForMdlSafe(mdl, priority) ((mdl)->mappedsystemva)#define MmGetMdlPfnArray(mdl) ((PFN_NUMBER *)(mdl + 1))#define MmInitializeMdl(mdl, baseva, length)				\do {									\	(mdl)->next = NULL;						\	(mdl)->size = MmSizeOfMdl(baseva, length);			\	(mdl)->flags = 0;						\	(mdl)->startva = PAGE_START(baseva);				\	(mdl)->byteoffset = BYTE_OFFSET(baseva);			\	(mdl)->bytecount = length;					\	(mdl)->mappedsystemva = baseva;					\	TRACE4("%p %p %p %d %d", (mdl), baseva, (mdl)->startva,	\		  (mdl)->byteoffset, length);				\} while (0)struct kdevice_queue_entry {	struct nt_list list;	ULONG sort_key;	BOOLEAN inserted;};struct kdevice_queue {	USHORT type;	USHORT size;	struct nt_list list;	NT_SPIN_LOCK lock;	BOOLEAN busy;};struct wait_context_block {	struct kdevice_queue_entry wait_queue_entry;	void *device_routine;	void *device_context;	ULONG num_regs;	void *device_object;	void *current_irp;	void *buffer_chaining_dpc;};struct wait_block {	struct nt_list list;	struct task_struct *thread;	void *object;	void *thread_event;	USHORT wait_key;	USHORT wait_type;};struct dispatcher_header {	UCHAR type;	UCHAR absolute;	UCHAR size;	UCHAR inserted;	LONG signal_state;	struct nt_list wait_blocks;};enum event_type {	NotificationEvent,	SynchronizationEvent,};enum timer_type {	NotificationTimer = NotificationEvent,	SynchronizationTimer = SynchronizationEvent,};enum dh_type {	NotificationObject = NotificationEvent,	SynchronizationObject = SynchronizationEvent,	MutexObject,	SemaphoreObject,	ThreadObject,};enum wait_type {	WaitAll, WaitAny};/* objects that use dispatcher_header have it as the first field, so * whenever we need to initialize dispatcher_header, we can convert * that object into a nt_event and access dispatcher_header */struct nt_event {	struct dispatcher_header dh;};struct wrap_timer;#define WRAP_TIMER_MAGIC 47697249struct nt_timer {	struct dispatcher_header dh;	/* We can't fit Linux timer in this structure. Instead of	 * padding the nt_timer structure, we replace due_time field	 * with *wrap_timer and allocate memory for it when nt_timer is	 * initialized */	union {		ULONGLONG due_time;		struct wrap_timer *wrap_timer;	};	struct nt_list nt_timer_list;	struct kdpc *kdpc;	union {		LONG period;		LONG wrap_timer_magic;	};};struct nt_mutex {	struct dispatcher_header dh;	struct nt_list list;	struct task_struct *owner_thread;	BOOLEAN abandoned;	BOOLEAN apc_disable;};struct nt_semaphore {	struct dispatcher_header dh;	LONG limit;};struct nt_thread {	struct dispatcher_header dh;	/* the rest in Windows is a long structure; since this	 * structure is opaque to drivers, we just define what we	 * need */	int pid;	NTSTATUS status;	struct task_struct *task;	struct nt_list irps;	NT_SPIN_LOCK lock;};#define set_object_type(dh, type)	((dh)->type = (type))#define is_notify_object(dh)		((dh)->type == NotificationObject)#define is_synch_object(dh)		((dh)->type == SynchronizationObject)#define is_mutex_object(dh)		((dh)->type == MutexObject)#define is_semaphore_object(dh)		((dh)->type == SemaphoreObject)#define is_nt_thread_object(dh)		((dh)->type == ThreadObject)#define IO_TYPE_ADAPTER				1#define IO_TYPE_CONTROLLER			2#define IO_TYPE_DEVICE				3#define IO_TYPE_DRIVER				4#define IO_TYPE_FILE				5#define IO_TYPE_IRP				6#define IO_TYPE_DEVICE_OBJECT_EXTENSION		13struct irp;struct dev_obj_ext;struct driver_object;struct device_object {	CSHORT type;	USHORT size;	LONG ref_count;	struct driver_object *drv_obj;	struct device_object *next;	struct device_object *attached;	struct irp *current_irp;	void *io_timer;	ULONG flags;	ULONG characteristics;	void *vpb;	void *dev_ext;	CCHAR stack_count;	union {		struct nt_list queue_list;		struct wait_context_block wcb;	} queue;	ULONG align_req;	struct kdevice_queue dev_queue;	struct kdpc dpc;	ULONG active_threads;	void *security_desc;	struct nt_event lock;	USHORT sector_size;	USHORT spare1;	struct dev_obj_ext *dev_obj_ext;	void *reserved;};struct dev_obj_ext {	CSHORT type;	CSHORT size;	struct device_object *dev_obj;	struct device_object *attached_to;};struct io_status_block {	union {		NTSTATUS status;		void *pointer;	};	ULONG_PTR info;};#ifdef CONFIG_X86_64struct io_status_block32 {	NTSTATUS status;	ULONG info;};#endif#define DEVICE_TYPE ULONGstruct driver_extension;typedef NTSTATUS driver_dispatch_t(struct device_object *dev_obj,				   struct irp *irp) wstdcall;struct driver_object {	CSHORT type;	CSHORT size;	struct device_object *dev_obj;	ULONG flags;	void *start;	ULONG driver_size;	void *section;	struct driver_extension *drv_ext;	struct unicode_string name;	struct unicode_string *hardware_database;	void *fast_io_dispatch;	void *init;	void *start_io;	void (*unload)(struct driver_object *driver) wstdcall;	driver_dispatch_t *major_func[IRP_MJ_MAXIMUM_FUNCTION + 1];};struct driver_extension {	struct driver_object *drv_obj;	NTSTATUS (*add_device)(struct driver_object *drv_obj,			       struct device_object *dev_obj) wstdcall;	ULONG count;	struct unicode_string service_key_name;	struct nt_list custom_ext;};struct custom_ext {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -