Building Driver With Visual Studio

Building Driver With Visual Studio

Building Driver With Visual Studio Rating: 7,1/10 3549 reviews

©2011 Secondary Solutions - 34 - The Hunger Games Literature Guide. Part II: Verb Moods. When you think about verbs, your first concern probably isn’t that it will be in a good mood! But verbs do, in fact, have “moods.” That doesn’t really mean the verb is happy, grumpy, or bored, though. ©2011 Secondary Solutions - 5 - The Hunger Games Literature Guide. About This Literature Guide. Secondary Solutions is the endeavor of a high school English teacher who could not seem to find appropriate materials to help her students master the necessary concepts at the secondary level. Secondary solutions the hunger games literature guide.

Please check out the Community Guidelines in the Announcements and Administration Category.

By using the Visual Studio 2010 SDK, you can build your own tool windows, create menu commands, and add extensions to the new Visual Studio editor and other features. The Visual Studio 2010 SDK includes project templates that help developers create tool windows, menu commands, isolated shell projects, and editor extensions. Build the sample using Visual Studio. In Visual Studio, on the Build menu, choose Build Solution. For more information about using Visual Studio to build a driver package, see Building a Driver with Visual Studio and the WDK. Locate the built driver. In File Explorer, navigate to the folder that contains your built driver package.

in NTDEV

Hello,
I am building a KMDF driver in Visual Studio 2015 using KMDF version 1.11
I know that with visual studio 2015 I supposed to use at least 1.15 , the reason that I'm using 1.11 is that I will be install that driver on Windows7 64 bit and my understanding was that if I want to support Windows 7 I need to use KMDF version 1.11.
Once the driver is built and I attempt to install it on my test system (Windows7 64 bit) the driver didn't install perfectly, the error given within device manager is:
Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. (Code 39)

I took the following steps :
1. I built a KMDF driver with Visual Studio 2015 (update 3) on pc with windows 10 OS.
2. I changed in my project the next details : Configuration -> Driver Settings -> Target OS Version is set to Windows 7 with Target Platform being desktop.
3. I Took the three files (.inf , .sys and WdfCoinstaller01011.dll) and tried to install the driver on my test system (Windows 7 64 bit).

How can I build a driver in visual studio 2015 (update 3)that running on windows 10 (64 bit) os, That will install perfectly on windows 7 (64 bit).??
What am I doing wrong?

Thank's,
mesi

Comments

  • KMDF 1.11 should work on Windows 7, as you noted.

    You’re sure you’re building a 64-bit driver, for the x64 target?

    Are you supplying a co-installer as part of your INF?

    Why are you using such an ancient version of Visual Studio and the WDK? Why not use the latest and greatest? You can still target Win7 using VS 2017 and WDK 1809.

    Peter

    0·Share on Facebook
  • Y> @'Peter_Viscarola_(OSR)' said:
    > KMDF 1.11 should work on Windows 7, as you noted.
    >
    > You’re sure you’re building a 64-bit driver, for the x64 target?
    >
    > Are you supplying a co-installer as part of your INF?
    >
    > Why are you using such an ancient version of Visual Studio and the WDK? Why not use the latest and greatest? You can still target Win7 using VS 2017 and WDK 1809.
    >
    > Peter
  • Hi,
    Thanks for your quick response
    1. yes I'm building a 64-bit driver, for the x64 target
    2. Until you said I did supply a co-installer as part of my INF
    But after I added co-installer section to my inf file, the error given within device manager is: code 10 now
    below is my inf file with the co installer section:
    a;/*++
    ;
    ;Copyright (c) Microsoft Corporation. All rights reserved.
    ;
    ; THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY
    ; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
    ; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
    ; PURPOSE.
    ;
    ;Module Name:
    ;
    ; Pci9x5x.INF
    ;
    ;Abstract:
    ; INF file for the PLx PCI9x5xRDK-Lite driver.
    ;
    ;--*/
    [Version]
    Signature='$WINDOWS NT$'
    ;Class=Sample
    ;ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171}
    Class=Multifunction
    ClassGuid={4d36e971-e325-11ce-bfc1-08002be10318}
    Provider=%ProviderString%
    DriverVer = 01/20/2019,9.35.17.14
    CatalogFile=KmdfSamples.cat
    [DestinationDirs]
    DefaultDestDir = 12
    CoInstaller_CopyFiles=11
    [PciOgt_Inst.NT.CoInstallers]
    AddReg=CoInstallers_AddReg
    CopyFiles=CoInstaller_CopyFiles
    [CoInstallers_AddReg]
    HKR,CoInstallers32,0x00010000,'WdfCoinstaller01011.dll, WdfCoInstaller'
    ;WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
    [CoInstaller_CopyFiles]
    WdfCoinstaller01000.dll
    [SourceDisksFiles]
    WdfCoInstaller01011.dll=1
    PciOgt.sys=1
    ; Class section
    ;[ClassInstall32]
    ;Addreg=SampleClassReg
    ;[SampleClassReg]
    ;HKR,0,%ClassName%
    ;HKR,Icon,-5
    ;HKR,DeviceCharacteristics,0x10001,0x100 ;Use same security checks on relative opens
    ;HKR,Security,'D:P(A;;GA;;;SY)(A;;GA;;;BA)' ;Allow generic all access to system and built-in Admin.
    ; Device Install section
    [ControlFlags]
    ExcludeFromSelect=*
    [Manufacturer]
    %ManufacturerString%=MSFT,NTamd64
    [SourceDisksNames]
    1=%DISK_NAME%,
    ; For XP and later
    [MSFT.NTamd64]
    ; DisplayName Section DeviceId
    ; ----------- ------- --------
    %Pci9056.DRVDESC%= PciOgt_Inst, PCIVEN_1556&DEV_5555
    %Pci9656.DRVDESC%= PciOgt_Inst, PCIVEN_1172&DEV_0001
    [PciOgt_Inst.NT]
    CopyFiles=PciOgt.CopyFiles
    [PciOgt.CopyFiles]
    PciOgt.sys
    [PciOgt_Inst.NT.Services]
    AddService=PciOgt,0x00000002,PciOgt_Service
    [PciOgt_Service]
    DisplayName = %PciOgt.SVCDESC%
    ServiceType = 1 ; SERVICE_KERNEL_DRIVER
    StartType = 3 ; SERVICE_DEMAND_START
    ErrorControl = 1 ; SERVICE_ERROR_NORMAL
    ServiceBinary = %12%PciOgt.sys
    [PciOgt_Inst.NT.Wdf]
    KmdfService = PciOgt, PciOgt_wdfsect
    [PciOgt_wdfsect]
    KmdfLibraryVersion = 1.11
    [Strings]
    ProviderString = 'ELTA SYSTEMS LTD'
    ManufacturerString = 'ELTA SYSTEMS LTD'
    ClassName = 'Multifunction Device'
    PciOgt.SVCDESC = 'Driver Service for PCI4'
    Pci9056.DRVDESC = 'Driver for PCI4'
    Pci9656.DRVDESC = 'Driver for PCI4'
    DISK_NAME = 'PciOgt Sample Install Disk'
    [PciOgt_Inst.NT.HW]
    AddReg = PciOgt_addreg
    [PciOgt_addreg]
    HKR,Interrupt Management,0x00000010
    HKR,Interrupt ManagementMessageSignaledInterruptProperties,0x00000010
    HKR,Interrupt ManagementMessageSignaledInterruptProperties,MSISupported,0x00010001,1
    What am I doing wrong now ?
    Thanks'
    mesi
  • via Email
    On Jan 20, 2019, at 1:03 AM, mesi_gabay wrote:
    >
    > [CoInstallers_AddReg]
    > HKR,CoInstallers32,0x00010000,'WdfCoinstaller01011.dll, WdfCoInstaller'
    > ;WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
    >
    > [CoInstaller_CopyFiles]
    > WdfCoinstaller01000.dll
    >
    > [SourceDisksFiles]
    > WdfCoInstaller01011.dll=1
    > PciOgt.sys=1
    Note that those last two sections disagree on the name of the KMDF DLL. The INF checker would have caught that.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

The currently instructions to build and use mongocxx driver is notfocused on Windows platform, and to use it with Visual Studio 2015 can take many hours before a successfulycompilation of your application.

To help in this task, i wrote this recipe to do it easily.

Installing the mongocxx driver

Prerequisites

  • Microsoft Windows 7 SPI+
  • Visual Studio 2015 Update 1 or later
  • CMake 3.2 (x64) or later
  • Boost 1.56 or later
  • A git client for Windows

Installation

Step 1: Install the latest version of the MongoDB C driver.

The mongocxx driver builds on top of the MongoDB C driver.

  • For mongocxx-3.0.x, we recommend the latest stable version of libmongoc (currently version 1.4.2 at the time this page was written).
  • For mongocxx-3.1.0-beta0 or later, libmongoc 1.5.0-rc3 or later is required.

Follow the instructions at Installing libmongoc.

If you need static libraries, be sure to use the --enable-static configure option when building libmongoc.

Wdk for visual studio 2019

Step 2: Download the latest version of the mongocxx driver.

To get the source via git, the releases/stable branch will track the most recent stable release. For example, to work from a shallow checkout of the stable release branch:

Step 3: Configure the driver

Make sure you change to the build directory of whatever source tree you obtain.Be aware that in the step #1, you build libmongoc in root folder of C: drive, then to configure driver references, we mustset the libbson and mongoc directory of libmongoc as follow:

Step 4: Build the driver

At 'Developer Command Prompt for Visual Studio 2015' you must run this command to compile and installmongocxx driver (inside of mongo-cxx-driver/build folder):

If everything runs fine, a folder install should be created inside build folder, where you canfind /bin, /include and /lib folders to be used inside of your Visual Studio solution.

Building Driver With Visual Studio

Step 5: Setting your solution properties

At this point, you have the libmongoc and mongocxx drivers to include and link in your project.If you follow the reference in step #1 and #3 you must have two directories in your C: disk:

Inside of each of this folders you will find bin, include and lib folders to set in yoursolution properties. You can move this folders to a more convenient place, in this example I copythis inside my project directory on a third party library folder, but you can put it inside a 'global'folder.

Open your solution with Visual Studio 2015 and follow this:

  • Left click over your project item in Solution Explorer, and choose Properties menu;
  • On VC++ Directory page, add this entries into Include Directories list:
    • $(ProjectDir)third-partyboost_1_56_0
    • $(ProjectDir)third-partymongo-cxx-driverincludemongocxxv_noabi
    • $(ProjectDir)third-partymongo-cxx-driverincludebsoncxxv_noabi
    • $(ProjectDir)third-partymongo-c-driverincludelibmongoc-1.0
    • $(ProjectDir)third-partymongo-c-driverincludelibbson-1.0
  • On VC++ Directory page, add this entries into Library Directories list:
    • $(ProjectDir)third-partymongo-cxx-driverlib
    • $(ProjectDir)third-partymongo-c-driverlib
  • On Linker/Input page, add this entries into Additional Dependencies:
    • bsoncxx.lib
    • libbsoncxx.lib
    • libmongocxx.lib
    • mongocxx.lib

Be aware to include a reference to Boost Library in include directory's list.

Step 6: Test your installation

Save the following source file inside your code to try:

Recent Articles

Building Driver With Visual Studio
© 2020