CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2012
    Posts
    37

    Question Automatic windows driver instalation

    Hi there, how are you?

    I developed a program that requires a hardware to be connected to the computer. This hardware uses a USB port and creates a serial port over it to communicate. Now that things are done, I'm trying to make it more user friendly.

    Normaly when this equipment is connected to the computer, the windows tries to find the driver on the "preconfigured driver folders" but obviously it can't find it. Then the user must select the driver file manually.

    I'd like to avoid this process, by making an installer that already puts this driver into the right windows folders, so when the hardware is connected the windows finds it, so the user won't need to point the driver file.

    How could I do that? Where are these "preconfigured driver folders" located? I attached here the driver so you can have a look at. It's just a .inf file and a .cat file.

    driver.zip

    The .inf code is bellow:

    Code:
    ; Windows USB CDC ACM Setup File
    ; Copyright (c) 2000 Microsoft Corporation
    ; Copyright (C) 2007 Microchip Technology Inc.
    
    [Version] 
    Signature="$Windows NT$" 
    Class=Ports
    ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} 
    Provider=%MFGNAME% 
    LayoutFile=layout.inf
    CatalogFile=%MFGFILENAME%.cat
    DriverVer=03/11/2010,5.1.2600.2
    
    [Manufacturer] 
    %MFGNAME%=DeviceList, NTamd64
    
    [DestinationDirs] 
    DefaultDestDir=12 
    
    
    ;------------------------------------------------------------------------------
    ;  Windows 2000/XP/Server2003/Vista/Server2008/7 - 32bit Sections
    ;------------------------------------------------------------------------------
    
    [DriverInstall.nt] 
    include=mdmcpq.inf
    CopyFiles=DriverCopyFiles.nt
    AddReg=DriverInstall.nt.AddReg 
    
    [DriverCopyFiles.nt]
    usbser.sys,,,0x20
    
    [DriverInstall.nt.AddReg] 
    HKR,,DevLoader,,*ntkern 
    HKR,,NTMPDriver,,%DRIVERFILENAME%.sys 
    HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 
    
    [DriverInstall.nt.Services] 
    AddService=usbser, 0x00000002, DriverService.nt
    
    [DriverService.nt] 
    DisplayName=%SERVICE% 
    ServiceType=1
    StartType=3
    ErrorControl=1
    ServiceBinary=%12%\%DRIVERFILENAME%.sys 
    
    ;------------------------------------------------------------------------------
    ;  Windows XP/Server2003/Vista/Server2008/7 - 64bit Sections
    ;------------------------------------------------------------------------------
    
    [DriverInstall.NTamd64] 
    include=mdmcpq.inf
    CopyFiles=DriverCopyFiles.NTamd64
    AddReg=DriverInstall.NTamd64.AddReg 
    
    [DriverCopyFiles.NTamd64]
    %DRIVERFILENAME%.sys,,,0x20
    
    [DriverInstall.NTamd64.AddReg] 
    HKR,,DevLoader,,*ntkern 
    HKR,,NTMPDriver,,%DRIVERFILENAME%.sys 
    HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 
    
    [DriverInstall.NTamd64.Services] 
    AddService=usbser, 0x00000002, DriverService.NTamd64
    
    [DriverService.NTamd64] 
    DisplayName=%SERVICE% 
    ServiceType=1
    StartType=3
    ErrorControl=1
    ServiceBinary=%12%\%DRIVERFILENAME%.sys 
    
    
    ;------------------------------------------------------------------------------
    ;  Vendor and Product ID Definitions
    ;------------------------------------------------------------------------------
    ; When developing your USB device, the VID and PID used in the PC side
    ; application program and the firmware on the microcontroller must match.
    ; Modify the below line to use your VID and PID.  Use the format as shown below.
    ; Note: One INF file can be used for multiple devices with different VID and PIDs.
    ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
    ;------------------------------------------------------------------------------
    [SourceDisksFiles]
    [SourceDisksNames]
    [DeviceList]
    %DESCRIPTION%=DriverInstall, USB\VID_04D8&PID_000A 
    
    [DeviceList.NTamd64] 
    %DESCRIPTION%=DriverInstall, USB\VID_04D8&PID_000A 
    
    
    ;------------------------------------------------------------------------------
    ;  String Definitions
    ;------------------------------------------------------------------------------
    ;Modify these strings to customize your device
    ;------------------------------------------------------------------------------
    [Strings]
    MFGFILENAME="mchpcdc"
    DRIVERFILENAME ="usbser"
    MFGNAME="Microchip Technology, Inc."
    INSTDISK="Microchip Technology, Inc. Installation Disc"
    DESCRIPTION="USB Communications Port"
    SERVICE="USB RS-232 Emulation Driver"
    Thank you!

  2. #2
    Join Date
    Jun 2012
    Posts
    37

    Re: Automatic windows driver instalation

    SOLVED!

    I utilized Inno Setup. Easy easy easy. And as for the driver, all it takes is to copy the driver files to Windows\inf folder.


    Thanks!!!!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured