Download presentation
Presentation is loading. Please wait.
1
Develop and Build Drives by Visual C++ IDE
2
Step 0. Requirement DDK Visual C or Visual C++ .NET
3
Step 1. Set Environment Variable
設定環境變數 DDKROOT DDKROOT = WINDDK所在的路徑
4
Step 2. Mkdir DriverEnv 建立目錄 DriverEnv(名稱隨意)作為開發驅動程式的大本營
5
Step 3. MakeDrvr.bat 在DrivrEnv目錄下建立一個批次檔MakeDrvr.bat,內容如下: @echo off
if "%1"=="" goto usage if "%3"=="" goto usage if not exist %1\bin\setenv.bat goto usage call %1\bin\setenv %1 %4 %2 cd %3 build -b -w %5 %6 %7 %8 %9 goto exit :usage echo usage MakeDrvr DDK_Dir Driver_Drive Driver_Dir fre/chk [build_options] echo eg MakeDrvr %%DDKROOT%% E: DriverEnv\DriverBuildSample chk -cef :exit
6
Step 4. New Makefile Project
7
Step 5. Modify Project Setting
[專案] [屬性] 開啟專案的屬性頁
8
Step 5. Modify Project Setting
先修改 Win32 Debug 的 Project Setting
9
Step 5. Modify Project Setting
在建置命令列(Build Command Line)一欄填入: MakeDrvr %DDKROOT% E: $(SolutionDir) chk -cef
10
Step 5. Modify Project Setting
在建置命令列(Build Command Line)一欄填入: MakeDrvr %DDKROOT% E: $(SolutionDir) chk -cef WINDDK所在的PATH,即Step 1所設的環境變數
11
Step 5. Modify Project Setting
在建置命令列(Build Command Line)一欄填入: MakeDrvr %DDKROOT% E: $(SolutionDir) chk -cef 欲建置的Driver檔案所在的磁碟機
12
Step 5. Modify Project Setting
在建置命令列(Build Command Line)一欄填入: MakeDrvr %DDKROOT% E: $(SolutionDir) chk -cef 欲建置的Driver檔案所在的資料夾完整路徑
13
Step 5. Modify Project Setting
在建置命令列(Build Command Line)一欄填入: MakeDrvr %DDKROOT% E: $(SolutionDir) chk -cef 欲建置的Driver版本為FREE/CHECKED BUILD
14
Step 5. Modify Project Setting
在建置命令列(Build Command Line)一欄填入: MakeDrvr %DDKROOT% E: $(SolutionDir) chk -cef BUILD Options,參考DDK文件中有關Build Utility的部分
15
Step 5. Modify Project Setting
在重建命令列(Rebuild all options)一欄填入: -nmake /a
16
Step 5. Modify Project Setting
在輸出(output file)一欄填與sources文件中的 TARGETNAME相同的設定值
17
Step 6. Add Source Files 可以新建立檔案或加入以存在的檔案(可將HELLOWDM的檔案引入以供測試)
18
Step 7. makefile 將makefile檔放入專案目錄中,makefile的內容如下:
# # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source # file to this component. This file merely indirects to the real make file # that is shared by all the driver components of the Windows NT DDK !INCLUDE $(NTMAKEENV)\makefile.def
19
Step 8. sources file 將sources檔加入專案目錄中,其內容為: TARGETNAME=HELLOWDM
TARGETPATH=obj TARGETTYPE=DRIVER SOURCES= HelloWdm.cpp
20
Step 9. MakeDrvr 因為MakeDrvr.bat在DriverEnv目錄下,所以應該把DriverEnv加到
VC的可執行檔設定中
21
Step 10. Build Driver
22
Step 10. Build Driver
Similar presentations