2013-01-19 5 views
0

샘플 KMDF 드라이버를 작성했습니다. 내가 모든 일을 올바르게했는지는 모르겠지만, KMDF 드라이버 인쇄 Debugview 유틸리티에서 디버그 메시지를 보았습니다.이 드라이버를 새 하드웨어로 추가했을 때. 또한 장치 관리자 아래에 "샘플 장치"로 나타났습니다.클라이언트 응용 프로그램에서 KMDF 드라이버에 액세스하는 방법

이제이 드라이버를 호출 할 수있는 클라이언트 샘플을 작성하여 드라이버와 클라이언트 간의 연결을 설정할 수 있습니다. 나는 우리가 'CreateFile'과 'DEviceIOControl'등을 사용할 필요가 있다는 것을 읽었습니다.하지만 그것에 대해 시작할 수는 없습니다.

샘플 KMDF 드라이버에 액세스하기 위해 샘플 클라이언트를 만드는 방법을 안내해 주시겠습니까? 드라이버의

내 INF 파일은 다음과 같다 : - WDK에 많은 관련 샘플이 있습니다

***My INF FILE**** 
; myshelldriver.INF 
; Windows installation file for installing the myshelldriver driver 
; Copyright (c) Microsoft Corporation All rights Reserved 
; 
; Installation Notes: 
; 
;  Using Devcon: Type "devcon install myshelldriver.inf myshelldriver" to install 
; 

[Version] 
Signature="$WINDOWS NT$" 
Class=Sample 
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} 
Provider=%MSFT% 
DriverVer=09/24/2012,1.0 
CatalogFile=myshell.cat 

[DestinationDirs] 
DefaultDestDir = 12 

[ClassInstall32] 
Addreg=SampleClassReg 

[SampleClassReg] 
HKR,,,0,%ClassName% 
HKR,,Icon,,-5 

[DiskCopyfiles] 
wdfmyshelldriver.sys 

[SourceDisksNames] 
1=%InstDisk%, 

[SourceDisksFiles] 
Wdfmyshelldriver.sys=1 

[Manufacturer] 
%MSFT% = DiskDevice,NTAMD64 

; For Win2K 
[DiskDevice] 
%DiskDevDesc% = DiskInstall, wdfmyshelldriver 

; For XP and later 
[DiskDevice.NTAMD64] 
%DiskDevDesc% = DiskInstall, wdfmyshelldriver 

[DiskInstall.NT] 
CopyFiles = DiskCopyfiles 


;;specify that this is the installation 
;;for nt based systems. 
[DriverInstall.ntx86] 
DriverVer=09/24/2012,1.0 
CopyFiles=DriverCopyFiles 


[DiskInstall.NT.Services] 
AddService = wdfmyshelldriver, %SPSVCINST_ASSOCSERVICE%, DiskServiceInst 

[DiskServiceInst] 
ServiceType = %SERVICE_KERNEL_DRIVER% 
StartType  = %SERVICE_DEMAND_START% 
ErrorControl = %SERVICE_ERROR_NORMAL% 
DisplayName = %DiskServiceDesc% 
ServiceBinary = %12%\Wdfmyshelldriver.sys 
AddReg  = DiskAddReg 

[DiskAddReg] 
HKR, "Parameters", "BreakOnEntry",  %REG_DWORD%, 0x00000000 
HKR, "Parameters", "DiskSize",   %REG_DWORD%, 0x00100000 
HKR, "Parameters", "DriveLetter",  %REG_SZ%, "R:" 
HKR, "Parameters", "RootDirEntries", %REG_DWORD%, 0x00000200 
HKR, "Parameters", "SectorsPerCluster", %REG_DWORD%, 0x00000002 




[Strings] 
MSFT   = "Microsoft" 
ClassName  = "My Shell Device" 
DiskDevDesc  = "WDF My Shell Driver" 
DiskServiceDesc = "myshelldriver Driver" 
InstDisk  = "myshelldriver Install Disk" 
;******************************************* 
;Handy macro substitutions (non-localizable) 
SPSVCINST_ASSOCSERVICE = 0x00000002 
SERVICE_KERNEL_DRIVER = 1 
SERVICE_DEMAND_START = 3 
SERVICE_ERROR_NORMAL = 1 
REG_DWORD    = 0x00010001 
REG_SZ     = 0x00000000 


**** END OF INF FILE*** 

답변

0

먼저 개체의 이름을 지정해야합니다. 두 번째로 다음 중 하나 이상을 수행해야합니다

  1. 는 장치 인터페이스를 등록
  2. \는 \ GLOBAL ??의 기호 링크를 작성합니다.

옵션 1은 간단한

CreateFile("\\\\.\\<device_name>, ...); 

옵션 2를 할 수 있도록하고 당신이 그것을 열 장치를 찾기 위해 설정 DI의 API 루틴을 사용해야합니다.