デバッグに「HelloWorld」のみを出力する単純なドライバーを作成しました。空のドライバープロジェクトを作成するために、Visual Studio 2012RCとWDK8を使用して、次のコードを記述しました。
#include <NTDDK.h>
extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
{
pRegistryPath = pRegistryPath; //unused
DbgPrint("Hello World!");
pDriverObject->DriverUnload = NULL;
return STATUS_SUCCESS;
}
私はそれをwin7x64にコンパイルしました。このドライバーをインストールして実行するには、.infファイルを作成する必要があることを読みましたが、それを管理できないようです。WDK 8からサンプルの.infファイルを取得し、.sysファイルと一致するように変更しましたが、仮想ボックスwin7x64が台無しになりました:-)。そこで、VS2012でフィルタードライバープロジェクトを作成し、.infファイルを取得して.sysファイルと一致するように変更しましたが、インストールしても何も起こりませんでした。作成した新しいサービスを実行してみました
net start MyDriver
しかし、デバッグには何も出力されず、[コンピューター]->[管理]->[サービス]にMyDriverが表示されません。DebugViewを使用して、デバッグに出力される内容を確認しています(http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx)。
もちろん、時間の経過とともに、実際に何かを実行するドライバーを作成したいと思いますが、その間、それを実行する方法を知りたいだけです。
VS2012から取得して変更した.infファイルは次のとおりです。
;;;
;;; MyDriver2
;;;
[Version]
Signature = "$Windows NT$"
; TODO - Change the Class and ClassGuid to match the Load Order Group value, see http://msdn.microsoft.com/en-us/windows/hardware/gg462963
; Class = "ActivityMonitor" ;This is determined by the work this filter driver does
; ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2} ;This value is determined by the Load Order Group value
Class = "ActivityMonitor"
ClassGuid = {b86dff51-a31e-4bac-b3cf-e8cfe75c9fc2}
Provider = %ManufacturerName%
DriverVer = 08/13/2012,1.0.0.0
;CatalogFile = MyDriver2.cat
[DestinationDirs]
DefaultDestDir = 12
MiniFilter.DriverFiles = 12 ;%windir%\system32\drivers
;;
;; Default install sections
;;
[DefaultInstall]
OptionDesc = %ServiceDescription%
CopyFiles = MiniFilter.DriverFiles
[DefaultInstall.Services]
AddService = %ServiceName%,,MiniFilter.Service
;;
;; Default uninstall sections
;;
[DefaultUninstall]
DelFiles = MiniFilter.DriverFiles
[DefaultUninstall.Services]
DelService = %ServiceName%,0x200 ;Ensure service is stopped before deleting
;
; Services Section
;
[MiniFilter.Service]
DisplayName = %ServiceName%
Description = %ServiceDescription%
ServiceBinary = %12%\%DriverName%.sys ;%windir%\system32\drivers\
Dependencies = "FltMgr"
ServiceType = 2 ;SERVICE_FILE_SYSTEM_DRIVER
StartType = 3 ;SERVICE_DEMAND_START
ErrorControl = 1 ;SERVICE_ERROR_NORMAL
; TODO - Change the Load Order Group value, see http://connect.microsoft.com/site221/content/content.aspx?ContentID=2512
; LoadOrderGroup = "FSFilter Activity Monitor"
LoadOrderGroup = "filter"
AddReg = MiniFilter.AddRegistry
;
; Registry Modifications
;
[MiniFilter.AddRegistry]
HKR,,"DebugFlags",0x00010001 ,0x0
HKR,,"SupportedFeatures",0x00010001,0x3
HKR,"Instances","DefaultInstance",0x00000000,%DefaultInstance%
HKR,"Instances\"%Instance1.Name%,"Altitude",0x00000000,%Instance1.Altitude%
HKR,"Instances\"%Instance1.Name%,"Flags",0x00010001,%Instance1.Flags%
;
; Copy Files
;
[MiniFilter.DriverFiles]
%DriverName%.sys
[SourceDisksFiles]
MyDriver2.sys = 1,,
[SourceDisksNames]
1 = %DiskId1%,,,
;;
;; String Section
;;
[Strings]
; TODO - Add your manufacturer
ManufacturerName = "Template"
ServiceDescription = "MyDriver2 Mini-Filter Driver"
ServiceName = "MyDriver2"
DriverName = "MyDriver2"
DiskId1 = "MyDriver2 Device Installation Disk"
;Instances specific information.
DefaultInstance = "MyDriver2 Instance"
Instance1.Name = "MyDriver2 Instance"
; TODO - Change the altitude value, see http://connect.microsoft.com/site221/content/content.aspx?ContentID=2512
;Instance1.Altitude = "370030"
Instance.Altitude = "370030"
Instance1.Flags = 0x0 ; Allow all attachments
wdreg.exeを使用してドライバをインストールして実行しようとすると、「INFファイルの製造元セクションが見つかりませんでした」と表示されました。(http://www.jungo.com/st/support/documentation/windriver/10.3.0/wdpci_manual.mhtml/dyn_windows.htmlから).infファイルについてたくさん読んだ(いくつかのマイクロソフトブックとたくさんのグーグルから) )そして私はまだ私の.infファイルを修正する方法を知りません。
私のドライバーを実行するためのより簡単な方法があれば、私はそれについて聞いてみたいです。実行方法がわかれば、実際の製品のデバッグは簡単になります。
ありがとう!
編集:テストモード(http://www.ngohq.com/home.php?page=dseo)でDriver SignatureEnforcementOverriderを使用して.sysファイルも歌います。