title: Installing Kernel Mode Driver on Windows 7
body: <p>I have been going through the tutorial at <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/hh439665%28v=vs.85%29.aspx" rel="nofollow">Microsoft</a>.I have compiled the KMDFSmall Kernel device driver on Windows 7 64 bit. I have completed the programming portion of the tutorial, my code compiled successfully and I have the KmdfSmall.inf file, the KmdfSmall.sys file, the KmdfSmall.cer file, the WdfCoinstaller01011.dll file, the kmdfsmall.cat file too.</p>
  
  <p>However, I don't have a test machine to run this on. I just want to install this toy driver into my own machine. I read <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/gg463274.aspx" rel="nofollow">here</a> how to install it using add hardware wizard. I went through the steps, but I am running into problem right.</p>
  
  <p>So, I click start and type hdwwiz and run the Add Harware Wizard. I do the manual install, choose the INF file where it says Have Disk, the KmdfSmall Device appears, I click next, but I get the following error message.</p>
  
  <blockquote>
    <p>The following hardware was not installed.
    KmdfSmall Device</p>
    
    <p>An error occurred during the installation of the device.</p>
    
    <p>The system cannot find the file specified.</p>
  </blockquote>
  
  <p>I don't know what file isn't being found? </p>
  
  <p>Here is my INF file:</p>
  
  <pre><code>;
  ; KmdfSmall.inf
  ;
  
  [Version]
  Signature="$WINDOWS NT$"
  Class=Sample ; TODO: edit Class
  ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
  Provider=%ManufacturerName%
  CatalogFile=KmdfSmall.cat
  DriverVer=02/22/2014,19.58.50.950
  
  [DestinationDirs]
  DefaultDestDir = 12
  
  ; ================= Class section =====================
  
  [ClassInstall32]
  Addreg=SampleClassReg
  
  [SampleClassReg]
  HKR,,,0,%ClassName%
  HKR,,Icon,,-5
  
  [SourceDisksNames]
  1 = %DiskName%,,,""
  
  [SourceDisksFiles]
  KmdfSmall.sys  = 1,,
  
  ;*****************************************
  ; Install Section
  ;*****************************************
  
  [Manufacturer]
  %ManufacturerName%=Standard,NTamd64
  
  [Standard.NTamd64]
  %KmdfSmall.DeviceDesc%=KmdfSmall_Device, Root\KmdfSmall ; TODO: edit hw-id
  
  [KmdfSmall_Device.NT]
  CopyFiles=Drivers_Dir
  
  [Drivers_Dir]
  KmdfSmall.sys
  
  ;-------------- Service installation
  [KmdfSmall_Device.NT.Services]
  AddService = KmdfSmall,%SPSVCINST_ASSOCSERVICE%, KmdfSmall_Service_Inst
  
  ; -------------- KmdfSmall driver install sections
  [KmdfSmall_Service_Inst]
  DisplayName    = %KmdfSmall.SVCDESC%
  ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
  StartType      = 3               ; SERVICE_DEMAND_START
  ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
  ServiceBinary  = %12%\KmdfSmall.sys
  LoadOrderGroup = Extended Base
  
  ;
  ;--- KmdfSmall_Device Coinstaller installation ------
  ;
  
  [DestinationDirs]
  KmdfSmall_Device_CoInstaller_CopyFiles = 11
  
  [KmdfSmall_Device.NT.CoInstallers]
  AddReg=KmdfSmall_Device_CoInstaller_AddReg
  CopyFiles=KmdfSmall_Device_CoInstaller_CopyFiles
  
  [KmdfSmall_Device_CoInstaller_AddReg]
  HKR,,CoInstallers32,0x00010000, "WdfCoInstaller01011.dll,WdfCoInstaller"
  
  [KmdfSmall_Device_CoInstaller_CopyFiles]
  WdfCoInstaller01011.dll
  
  [SourceDisksFiles]
  WdfCoInstaller01011.dll=1 ; make sure the number matches with SourceDisksNames
  
  [KmdfSmall_Device.NT.Wdf]
  KmdfService =  KmdfSmall, KmdfSmall_wdfsect
  [KmdfSmall_wdfsect]
  KmdfLibraryVersion = 1.11
  
  [Strings]
  SPSVCINST_ASSOCSERVICE= 0x00000002
  ManufacturerName="" ; TODO: add ManufacturerName
  ClassName="Samples" ; TODO: edit ClassName
  DiskName = "KmdfSmall Installation Disk"
  KmdfSmall.DeviceDesc = "KmdfSmall Device"
  KmdfSmall.SVCDESC = "KmdfSmall Service"
  </code></pre>