一、資料型別
1.字串
typedef struct _unicode_string{
ushort length;
//字串的長度(所佔的位元組數)
ushort maxinumlength;
//字串緩衝區的長度(所能佔的最大位元組數)
pwstr buffer;
//字串緩衝區(字串的位址,也即指標)
}unicode_string *punicode_string
//(c語言中
* 是指標運算子.
*p表示指標變數p所指向的變數的值.即p中儲存的記憶體位址 所儲存的變數的值.
such as
定義乙個指標變數p時,如 int *p; 表示定義了乙個指向整型變數的指標變數p.)
2.列印字串
#include
void driverunload(pdriver_object driver)
ntstatus driverentry(pdriver_object driver, punicode_string reg_path)
字串」first:hello, my first string」前面的 l 是c/c++語言規定的寬字元字面量標識,不是long型別。是對應wchar_t這種字元資料的,不是char。後者是1byte字元,前者是2byte字元,即unicode-16編碼字元.
一、重要的資料結構
1.驅動物件(核心模組的基本結構,提供身份資訊,告訴windows提供哪些功能)
typedef
struct _driver_object driver_object;
2.裝置物件
裝置物件(do)是唯一可以接受訊息的實體,irp都是發給裝置物件的.
typedef
struct declspec_align(memory_allocation_alignment)
_device_objectdevice_object;
3.乙個典型的分發函式
請求(irp)被驅動物件的分發函式捕獲
//device:請求的目標裝置 irp:請求的指標
ntsuatus mydispatch(pdriver_object device,pirp irp);
4.irp
typedef
struct declspec_align(memory_allocation_alignment)
_irp
associatedtrp;
//io狀態,存放請求完成的返回狀況
io_status_block iostatus;
//irp棧空間大小
char stackcount;
//irp當前棧空間
char currentlocation;
//用來取消乙個未決請求的函式
__volatile pdriver_cancel cancelroutine;
//另乙個緩衝區的表示方法
pvoid userbuffer;
union;
};} overlay;
} tail;
}irp, *pirp;
//irp的指標 pirp或者irp*
核心資料結構
關於開發驅動重要的核心資料結構,方便自己理解 driver object typedef struct driver object cshort type cshort size 乙個鍊錶,記錄了該驅動建立的所有裝置物件 pdevice object deiceobject ulong flags ...
核心資料結構
核心需要儲存i o元件使用的狀態資訊,可以通過若干核心資料結構比如說檔案開啟表等來完成 unix系統中在讀取乙個使用者檔案的時候,核心需要去檢查下快取,然後再去決定是否執行磁碟i o,在讀乙個程序映象時候,核心只需要從記憶體當中讀取資料,也就是說這些操作都可以呼叫read 函式來完成,但是語義不同 ...
核心資料結構
這部分包含了修改核心模組,所以要使用到核心鏈結表資料結構。首先你得定義乙個包含元素的結構去插入鍊錶。下邊這段 用c語言定義了生日結構 struct birthday 注意struct list head list。結構list head在包含目錄的裡有定義。它的作用就是嵌入包含列表節點的鏈結表。li...