📄 winnt_types.h
字号:
};struct custom_ext { struct nt_list list; void *client_id;};struct wrap_bin_file;struct file_object { CSHORT type; CSHORT size; struct device_object *dev_obj; void *volume_parameter_block; void *fs_context; void *fs_context2; void *section_object_pointer; void *private_cache_map; NTSTATUS final_status; union { struct file_object *related_file_object; struct wrap_bin_file *wrap_bin_file; }; BOOLEAN lock_operation; BOOLEAN delete_pending; BOOLEAN read_access; BOOLEAN write_access; BOOLEAN delete_access; BOOLEAN shared_read; BOOLEAN shared_write; BOOLEAN shared_delete; ULONG flags; struct unicode_string _name_; LARGE_INTEGER current_byte_offset; ULONG waiters; ULONG busy; void *last_lock; struct nt_event lock; struct nt_event event; void *completion_context;};#ifdef CONFIG_X86_64#define POINTER_ALIGN __attribute__((aligned(8)))#else#define POINTER_ALIGN#endif#define CACHE_ALIGN __attribute__((aligned(128)))enum system_power_state { PowerSystemUnspecified = 0, PowerSystemWorking, PowerSystemSleeping1, PowerSystemSleeping2, PowerSystemSleeping3, PowerSystemHibernate, PowerSystemShutdown, PowerSystemMaximum,};enum device_power_state { PowerDeviceUnspecified = 0, PowerDeviceD0, PowerDeviceD1, PowerDeviceD2, PowerDeviceD3, PowerDeviceMaximum,};union power_state { enum system_power_state system_state; enum device_power_state device_state;};enum power_state_type { SystemPowerState = 0, DevicePowerState,};enum power_action { PowerActionNone = 0, PowerActionReserved, PowerActionSleep, PowerActionHibernate, PowerActionShutdown, PowerActionShutdownReset, PowerActionShutdownOff, PowerActionWarmEject,};struct guid { ULONG data1; USHORT data2; USHORT data3; UCHAR data4[8];};struct nt_interface { USHORT size; USHORT version; void *context; void (*reference)(void *context) wstdcall; void (*dereference)(void *context) wstdcall;};enum interface_type { InterfaceTypeUndefined = -1, Internal, Isa, Eisa, MicroChannel, TurboChannel, PCIBus, VMEBus, NuBus, PCMCIABus, CBus, MPIBus, MPSABus, ProcessorInternal, InternalPowerBus, PNPISABus, PNPBus, MaximumInterfaceType,};#define CmResourceTypeNull 0#define CmResourceTypePort 1#define CmResourceTypeInterrupt 2#define CmResourceTypeMemory 3#define CmResourceTypeDma 4#define CmResourceTypeDeviceSpecific 5#define CmResourceTypeBusNumber 6#define CmResourceTypeMaximum 7#define CmResourceTypeNonArbitrated 128#define CmResourceTypeConfigData 128#define CmResourceTypeDevicePrivate 129#define CmResourceTypePcCardConfig 130#define CmResourceTypeMfCardConfig 131enum cm_share_disposition { CmResourceShareUndetermined = 0, CmResourceShareDeviceExclusive, CmResourceShareDriverExclusive, CmResourceShareShared};#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0#define CM_RESOURCE_INTERRUPT_LATCHED 1#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008#define CM_RESOURCE_MEMORY_24 0x0010#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020#define CM_RESOURCE_PORT_MEMORY 0x0000#define CM_RESOURCE_PORT_IO 0x0001#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080#define CM_RESOURCE_DMA_8 0x0000#define CM_RESOURCE_DMA_16 0x0001#define CM_RESOURCE_DMA_32 0x0002#define CM_RESOURCE_DMA_8_AND_16 0x0004#define CM_RESOURCE_DMA_BUS_MASTER 0x0008#define CM_RESOURCE_DMA_TYPE_A 0x0010#define CM_RESOURCE_DMA_TYPE_B 0x0020#define CM_RESOURCE_DMA_TYPE_F 0x0040#define MAX_RESOURCES 20#pragma pack(push,4)struct cm_partial_resource_descriptor { UCHAR type; UCHAR share; USHORT flags; union { struct { PHYSICAL_ADDRESS start; ULONG length; } generic; struct { PHYSICAL_ADDRESS start; ULONG length; } port; struct { ULONG level; ULONG vector; KAFFINITY affinity; } interrupt; struct { PHYSICAL_ADDRESS start; ULONG length; } memory; struct { ULONG channel; ULONG port; ULONG reserved1; } dma; struct { ULONG data[3]; } device_private; struct { ULONG start; ULONG length; ULONG reserved; } bus_number; struct { ULONG data_size; ULONG reserved1; ULONG reserved2; } device_specific_data; } u;};#pragma pack(pop)struct cm_partial_resource_list { USHORT version; USHORT revision; ULONG count; struct cm_partial_resource_descriptor partial_descriptors[1];};struct cm_full_resource_descriptor { enum interface_type interface_type; ULONG bus_number; struct cm_partial_resource_list partial_resource_list;};struct cm_resource_list { ULONG count; struct cm_full_resource_descriptor list[1];};enum file_info_class { FileDirectoryInformation = 1, FileBasicInformation = 4, FileStandardInformation = 5, FileNameInformation = 9, FilePositionInformation = 14, FileAlignmentInformation = 17, FileNetworkOpenInformation = 34, FileAttributeTagInformation = 35, FileMaximumInformation = 41,};enum fs_info_class { FileFsVolumeInformation = 1, /* ... */ FileFsMaximumInformation = 9,};enum device_relation_type { BusRelations, EjectionRelations, PowerRelations, RemovalRelations, TargetDeviceRelation, SingleBusRelations,};enum bus_query_id_type { BusQueryDeviceID = 0, BusQueryHardwareIDs = 1, BusQueryCompatibleIDs = 2, BusQueryInstanceID = 3, BusQueryDeviceSerialNumber = 4,};enum device_text_type { DeviceTextDescription = 0, DeviceTextLocationInformation = 1,};enum device_usage_notification_type { DeviceUsageTypeUndefined, DeviceUsageTypePaging, DeviceUsageTypeHibernation, DevbiceUsageTypeDumpFile,};#define METHOD_BUFFERED 0#define METHOD_IN_DIRECT 1#define METHOD_OUT_DIRECT 2#define METHOD_NEITHER 3#define CTL_CODE(dev_type, func, method, access) \ (((dev_type) << 16) | ((access) << 14) | ((func) << 2) | (method))#define IO_METHOD_FROM_CTL_CODE(code) (code & 0x3)#ifndef CONFIG_X86_64#pragma pack(push,4)#endifstruct io_stack_location { UCHAR major_fn; UCHAR minor_fn; UCHAR flags; UCHAR control; union { struct { void *security_context; ULONG options; USHORT POINTER_ALIGN file_attributes; USHORT share_access; ULONG POINTER_ALIGN ea_length; } create; struct { ULONG length; ULONG POINTER_ALIGN key; LARGE_INTEGER byte_offset; } read; struct { ULONG length; ULONG POINTER_ALIGN key; LARGE_INTEGER byte_offset; } write; struct { ULONG length; enum file_info_class POINTER_ALIGN file_info_class; } query_file; struct { ULONG length; enum file_info_class POINTER_ALIGN file_info_class; struct file_object *file_object; union { struct { BOOLEAN replace_if_exists; BOOLEAN advance_only; }; ULONG cluster_count; void *delete_handle; }; } set_file; struct { ULONG length; enum fs_info_class POINTER_ALIGN fs_info_class; } query_volume; struct { ULONG output_buf_len; ULONG POINTER_ALIGN input_buf_len; ULONG POINTER_ALIGN code; void *type3_input_buf; } dev_ioctl; struct { SECURITY_INFORMATION security_info; ULONG POINTER_ALIGN length; } query_security; struct { SECURITY_INFORMATION security_info; void *security_descriptor; } set_security; struct { void *vpb; struct device_object *device_object; } mount_volume; struct { void *vpb; struct device_object *device_object; } verify_volume; struct { void *srb; } scsi; struct { enum device_relation_type type; } query_device_relations; struct { const struct guid *type; USHORT size; USHORT version; struct nt_interface *intf; void *intf_data; } query_intf; struct { void *capabilities; } device_capabilities; struct { void *io_resource_requirement_list; } filter_resource_requirements; struct { ULONG which_space; void *buffer; ULONG offset; ULONG POINTER_ALIGN length; } read_write_config; struct { BOOLEAN lock; } set_lock; struct { enum bus_query_id_type id_type; } query_id; struct { enum device_text_type device_text_type; ULONG POINTER_ALIGN locale_id; } query_device_text; struct { BOOLEAN in_path; BOOLEAN reserved[3]; enum device_usage_notification_type POINTER_ALIGN type; } usage_notification; struct { enum system_power_state power_state; } wait_wake; struct { void *power_sequence; } power_sequence; struct { ULONG sys_context; enum power_state_type POINTER_ALIGN type; union power_state POINTER_ALIGN state; enum power_action POINTER_ALIGN shutdown_type; } power; struct { struct cm_resource_list *allocated_resources; struct cm_resource_list *allocated_resources_translated; } start_device; struct { ULONG_PTR provider_id; void *data_path; ULONG buf_len; void *buf; } wmi; struct { void *arg1; void *arg2; void *arg3; void *arg4; } others; } params; struct device_object *dev_obj; struct file_object *file_obj; NTSTATUS (*completion_routine)(struct device_object *, struct irp *, void *) wstdcall; void *context;};#ifndef CONFIG_X86_64#pragma pack(pop)#endifstruct kapc { CSHORT type; CSHORT size; ULONG spare0; struct nt_thread *thread; struct nt_list list; void *kernele_routine; void *rundown_routine; void *normal_routine; void *normal_context; void *sys_arg1; void *sys_arg2; CCHAR apc_state_index; KPROCESSOR_MODE apc_mode; BOOLEAN inserted;};#define IRP_NOCACHE 0x00000001#define IRP_SYNCHRONOUS_API 0x00000004#define IRP_ASSOCIATED_IRP 0x00000008enum urb_state { URB_INVALID = 1, URB_ALLOCATED, URB_SUBMITTED, URB_COMPLETED, URB_FREE, URB_SUSPEND, URB_INT_UNLINKED };struct wrap_urb { struct nt_list list; enum urb_state state; struct nt_list complete_list; unsigned int flags; struct urb *urb; struct irp *irp;#ifdef USB_DEBUG unsigned int id;#endif#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) typeof(((struct urb *)0)->status) urb_status;#endif};struct irp { SHORT type; USHORT size; struct mdl *mdl; ULONG flags; union { struct irp *master_irp; LONG irp_count; void *system_buffer; } associated_irp; struct nt_list thread_list; struct io_status_block io_status; KPROCESSOR_MODE requestor_mode; BOOLEAN pending_returned; CHAR stack_count; CHAR current_location; BOOLEAN cancel; KIRQL cancel_irql; CCHAR apc_env; UCHAR alloc_flags; struct io_status_block *user_status; struct nt_event *user_event; union { struct { void *user_apc_routine; void *user_apc_context; } async_params; LARGE_INTEGER alloc_size; } overlay; void (*cancel_routine)(struct device_object *, struct irp *) wstdcall; void *user_buf; union { struct { union { struct kdevice_queue_entry dev_q_entry; struct { void *driver_context[4]; }; }; void *thread; char *aux_buf; struct { struct nt_list list; union { struct io_stack_location *csl; ULONG packet_type; }; }; struct file_object *file_object; } overlay; union { struct kapc apc; /* space for apc is used for ndiswrapper * specific fields */ struct { struct wrap_urb *wrap_urb; struct wrap_device *wrap_device; }; }; void *completion_key; } tail;};#define IoSizeOfIrp(stack_count) \ ((USHORT)(sizeof(struct irp) + \ ((stack_count) * sizeof(struct io_stack_location))))#define IoGetCurrentIrpStackLocation(irp) \ (irp)->tail.overlay.csl#define IoGetNextIrpStackLocation(irp) \ (IoGetCurrentIrpStackLocation(irp) - 1)#define IoGetPreviousIrpStackLocation(irp) \ (IoGetCurrentIrpStackLocation(irp) + 1)#define IoSetNextIrpStackLocation(irp) \do { \ KIRQL _irql_; \ IoAcquireCancelSpinLock(&_irql_); \ (irp)->current_location--; \ IoGetCurrentIrpStackLocation(irp)--; \ IoReleaseCancelSpinLock(_irql_); \} while (0)#define IoSkipCurrentIrpStackLocation(irp) \do { \ KIRQL _irql_; \ IoAcquireCancelSpinLock(&_irql_); \ (irp)->current_location++; \ IoGetCurrentIrpStackLocation(irp)++; \ IoReleaseCancelSpinLock(_irql_); \} while (0)static inline voidIoCopyCurrentIrpStackLocationToNext(struct irp *irp){ struct io_stack_location *next; next = IoGetNextIrpStackLocation(irp); memcpy(next, IoGetCurrentIrpStackLocation(irp), offsetof(struct io_stack_location, completion_routine)); next->control = 0;}static inline voidIoSetCompletionRoutine(struct irp *irp, void *routine, void *context, BOOLEAN success, BOOLEAN error, BOOLEAN cancel){ struct io_stack_location *irp_sl = IoGetNextIrpStackLocation(irp); irp_sl->completion_routine = routine; irp_sl->context = context; irp_sl->control = 0; if (success) irp_sl->control |= SL_INVOKE_ON_SUCCESS; if (error) irp_sl->control |= SL_INVOKE_ON_ERROR; if (cancel) irp_sl->control |= SL_INVOKE_ON_CANCEL;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -