几个驱动重要的结构

DEVICE_OBJECT:
  1. typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {
  2.     CSHORT Type;
  3.     USHORT Size;
  4.     LONG ReferenceCount;
  5.     struct _DRIVER_OBJECT *DriverObject;
  6.     struct _DEVICE_OBJECT *NextDevice;
  7.     struct _DEVICE_OBJECT *AttachedDevice;
  8.     struct _IRP *CurrentIrp;
  9.     PIO_TIMER Timer;
  10.     ULONG Flags;                                // See above:  DO_...
  11.     ULONG Characteristics;                      // See ntioapi:  FILE_...
  12.     __volatile PVPB Vpb;
  13.     PVOID DeviceExtension;
  14.     DEVICE_TYPE DeviceType;
  15.     CCHAR StackSize;
  16.     union {
  17.         LIST_ENTRY ListEntry;
  18.         WAIT_CONTEXT_BLOCK Wcb;
  19.     } Queue;
  20.     ULONG AlignmentRequirement;
  21.     KDEVICE_QUEUE DeviceQueue;
  22.     KDPC Dpc;
  23.     //
  24.     //  The following field is for exclusive use by the filesystem to keep
  25.     //  track of the number of Fsp threads currently using the device
  26.     //
  27.     ULONG ActiveThreadCount;
  28.     PSECURITY_DESCRIPTOR SecurityDescriptor;
  29.     KEVENT DeviceLock;
  30.     USHORT SectorSize;
  31.     USHORT Spare1;
  32.     struct _DEVOBJ_EXTENSION  *DeviceObjectExtension;
  33.     PVOID  Reserved;
  34. } DEVICE_OBJECT;
  35. typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
DRIVER_OBJECT:
  1. typedef struct _DRIVER_OBJECT {
  2.     CSHORT Type;
  3.     CSHORT Size;
  4.     //
  5.     // The following links all of the devices created by a single driver
  6.     // together on a list, and the Flags word provides an extensible flag
  7.     // location for driver objects.
  8.     //
  9.     PDEVICE_OBJECT DeviceObject;
  10.     ULONG Flags;
  11.     //
  12.     // The following section describes where the driver is loaded.  The count
  13.     // field is used to count the number of times the driver has had its
  14.     // registered reinitialization routine invoked.
  15.     //
  16.     PVOID DriverStart;
  17.     ULONG DriverSize;
  18.     PVOID DriverSection;
  19.     PDRIVER_EXTENSION DriverExtension;
  20.     //
  21.     // The driver name field is used by the error log thread
  22.     // determine the name of the driver that an I/O request is/was bound.
  23.     //
  24.     UNICODE_STRING DriverName;
  25.     //
  26.     // The following section is for registry support.  Thise is a pointer
  27.     // to the path to the hardware information in the registry
  28.     //
  29.     PUNICODE_STRING HardwareDatabase;
  30.     //
  31.     // The following section contains the optional pointer to an array of
  32.     // alternate entry points to a driver for "fast I/O" support.  Fast I/O
  33.     // is performed by invoking the driver routine directly with separate
  34.     // parameters, rather than using the standard IRP call mechanism.  Note
  35.     // that these functions may only be used for synchronous I/O, and when
  36.     // the file is cached.
  37.     //
  38.     PFAST_IO_DISPATCH FastIoDispatch;
  39.     //
  40.     // The following section describes the entry points to this particular
  41.     // driver.  Note that the major function dispatch table must be the last
  42.     // field in the object so that it remains extensible.
  43.     //
  44.     PDRIVER_INITIALIZE DriverInit;
  45.     PDRIVER_STARTIO DriverStartIo;
  46.     PDRIVER_UNLOAD DriverUnload;
  47.     PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
  48. } DRIVER_OBJECT;
  49. typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; 
UNICODE_STRING:
  1. typedef struct _UNICODE_STRING {
  2.     USHORT Length;
  3.     USHORT MaximumLength;
  4. #ifdef MIDL_PASS
  5.     [size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer;
  6. #else // MIDL_PASS
  7.     __field_bcount_part(MaximumLength, Length) PWCH   Buffer;
  8. #endif // MIDL_PASS
  9. } UNICODE_STRING;
  10. typedef UNICODE_STRING *PUNICODE_STRING;
  11. typedef const UNICODE_STRING *PCUNICODE_STRING;
  12. #define UNICODE_NULL ((WCHAR)0) // winnt
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值