Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...

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

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Issue with driver deployment and debug

jguo5258jguo5258 Member Posts: 28
Alright, two issues:

Whenever i try deploying my driver on visual studio to my virtualbox, there is an error: unable to connect to the test target computer. This shouldn’t be happening, because I am able to connect through windbg. My network between my virtual box and host is NAT. Driver deploy always fails

Also, the windbg connects, but nothing shows when the windbg kernel debug is connected. Is this supposed to happen,or am I missing something? How would I fix this?

Is there an easy way to avoid all the visual studio bullshit? I’ve heard about kdfiles

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,133
    edited June 2019

    visual studio bullshit

    The pretty much sums it up.

    The easiest way to fix this is to NOT use Visual Studio to deploy your driver, and to NOT use the kernel debugger through Visual Studio. Why? Because, as you have seen, a lot of times it does not work, and when it doesn’t work it’s almost impossible to figure out why.

    Instead of “deploy” just copy your driver to your test system. Disable the driver (using device manager if you wish), Copy the updated executable to \windows\system32\drivers, and Enable the driver. Alternatively, you can use .kdfiles instead of doing the copy. Once the KDFILES mapping is set up, just disabling and enabling the driver will cause the new version to load. Look at .kdfiles with the -m switch, and save yourself the considerable hassle of getting the format of the stupid mapping file to work properly (thank you, Mr. Tippet).

    Instead of debugging through Visual Studio, just directly run WinDbg. It’s installed as part of the WDK... or use the “attractive” new version you can download from the Windows Store. Follow the instructions in the MSDN docs on how to manually attach the kernel debugger over the network, including enabling debugging on the test machine.

    I promise, if you leave the use of VS for deploy and debug behind, you will not regret it. They should put Lasciate ogne speranza voi ch'intrate in the title of the dialog box when you go to enable deployment. It’s an entirely random and most often painful and futile experience, every time I’ve tried it.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • jguo5258jguo5258 Member Posts: 28
    edited June 2019
  • jguo5258jguo5258 Member Posts: 28

    @Peter_Viscarola_(OSR) said:

    visual studio bullshit

    The pretty much sums it up.

    The easiest way to fix this is to NOT use Visual Studio to deploy your driver, and to NOT use the kernel debugger through Visual Studio. Why? Because, as you have seen, a lot of times it does not work, and when it doesn’t work it’s almost impossible to figure out why.

    Instead of “deploy” just copy your driver to your test system. Disable the driver (using device manager if you wish), Copy the updated executable to \windows\system32\drivers, and Enable the driver. Alternatively, you can use .kdfiles instead of doing the copy. Once the KDFILES mapping is set up, just disabling and enabling the driver will cause the new version to load. Look at .kdfiles with the -m switch, and save yourself the considerable hassle of getting the format of the stupid mapping file to work properly (thank you, Mr. Tippet).

    Instead of debugging through Visual Studio, just directly run WinDbg. It’s installed as part of the WDK... or use the “attractive” new version you can download from the Windows Store. Follow the instructions in the MSDN docs on how to manually attach the kernel debugger over the network, including enabling debugging on the test machine.

    I promise, if you leave the use of VS for deploy and debug behind, you will not regret it. They should put Lasciate ogne speranza voi ch'intrate in the title of the dialog box when you go to enable deployment. It’s an entirely random and most often painful and futile experience, every time I’ve tried it.

    Peter

    how would i build on release to generate the required driver files?

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,133

    how would i build on release to generate the required driver files?

    I'm sorry, I don't understand the question. Can you explain further, please?

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 26 Feb - 1 Mar 2024 Live, Online