驅動程式設計學習4 第乙個驅動程式的編寫

2021-10-10 15:37:24 字數 1641 閱讀 1687

預設安裝即可(主要是安裝vsix)

2.進入專案後,新增乙個.c的檔案 (必須是c檔案,cpp會報錯)

3.核心驅動有乙個統一的入口函式,為driverentry,原型如下

ntstatus driverentry

( pdriver_object driverobject,

punicode_string registrypath

)

4.驅動**如下:

#include

"ntddk.h"

void driverunload

(pdriver_object driverobject)

return;}

ntstatus driverentry

(pdriver_object driverobject,punicode_string registrypath)

if(driverobject !=

null

)return status_success;

}

5.將平台調為x64平台,debug模式然後在生成解決方案(如果沒有語法問題卻提示錯誤,就刪掉專案中的inf檔案,接下來就能編譯成功)

6.虛擬機器進入win10除錯模式,將生成的.sys檔案放入c盤根目錄下(需要管理員許可權

7.使用管理員許可權執行cmd,輸入以下命令

sc create firstdriver binpath=

"c:\firstdriver.sys" type= kernel start= demand

sc start firstdriver //啟動服務,顯示如下資訊

sc stop firstdriver //關閉服務

8.管理員許可權執行db**iew,在capture中設定如下

開啟服務及關閉服務後均可在db**iew中看到輸出資訊

當然在windbg中也可以收到輸出的除錯資訊

在windbg和db**iew中會顯示其他的除錯資訊,這是正常的

第乙個驅動程式

原始出處 驅動程式的開發,向來是令人感到有所畏懼的,可能很多人像我一樣,看了很久卻還是一頭霧水,不得其門而入。我們今天就通過乙個簡單的程式來使讀者學會初步的驅動程式開發。在開發windows驅動程式之前,我們需要首先安裝ddk,win98及其以前的vxd我們就不要再考慮了 windows 2000 ...

第乙個驅動程式

從今天開始就要進入核心驅動程式部分了,在這一節裡就通過第乙個驅動程式來介紹一下核心驅動模組的編寫框架。static intfirst drv open struct inode inode,struct file file static ssize t first drv write struct ...

我的第乙個驅動程式

arm編譯器版本 3.32 核心版本 2.6.28.7 arm號 s3c2440 驅動原始碼 include include include include include include include include define device name leds define led majo...