Visual Studio 2012 Windows kernel debugging - can't provision VM target - windows

Host: Visual Studio 2012, Windows 8 Host, WDK8
Target: VirtualBox - Windows 7
When I try to add the target computer (Driver -> Test -> Configure Computers) in Visual Studio (like at http://msdn.microsoft.com/en-us/library/windows/hardware/hh439359%28v=vs.85%29.aspx ):
I select "Provision Computer and choose debugger settings"
I choose to use a Serial connection
But the result is always "Could not find a host entry for Name of VM"
VS gives the same response if I try to connect through the network (I know kernel debugging from a Win8 host to a Win7 target isn't supported through the network).
I can't see a problem in the connection; connection without provision works after hitting Debug -> Break (otherwise, I hit a Waiting to reconnect... message).
Anyone get this working or has better idea on how to debug the Windows OS in VirtualBox?

You should not choose the debugger option to provision the target, as the debugger docs state that "Provisioning is not supported for virtual machines." (See this page: Provision a computer for driver deployment and testing.) This is most likely because provisioning requires network connectivity to the target, no matter how you choose to connect for the actual kernel debugging session.
As you've already observed, connection without provisioning works just fine, so you can just do that instead. Make sure you've properly attached the virtual serial port on the target to a host named pipe.
In any case, provisioning isn't strictly necessary to run the kernel debugger. It's just a convenience that automatically enables kernel debugging on the target, makes some other useful configuration changes, and installs a set of useful tools. You can see what provisioning does on this page: What happens when you provision a computer?
Here is some general guidance on setting up kernel debugging of a VM: Setting Up Kernel-Mode Debugging of a a Virtual Machine in Visual Studio

This link Kernel-Mode Debugging in a VM using Visual Studio 2012describes how to provision to virtual machine. You will need to configure network in a way that host and guest can ping each other.
After that you need to update "hosts" on both computers(add ip and NetBIOS of guest to host "hosts" file and ip and NetBIOS of host to guest "hosts" file).

Related

Debugging Windows kernel on a Microsoft Azure platform virtual machine

I want to connect WinDbg to the Windows Server kernel running on a Microsoft Azure platform VM to debug some drivers. I tried to follow the instructions on msdn to connect the debugger over the network, but it seems that requires that the target machine and the host are locate in one local network. What are the options, is it possible to do it at all?
I tried:
Setting Up Network Debugging of a Virtual Machine - KDNET
The problem is solved. It was necessary to add a new rule for the port used by the kernel debugger. This is done in the virtual machine settings in the "Network" section.

Remote Debugging on a Virtual Windows Machine

I am trying to debug an app, using Visual Studio 2017, that I will run on a virtual machine I've set up on my development system. The virtual machine runs Windows 10 (as does my development system).
I've installed the latest VS 2017 Remote Tools package on the virtual machine, and configured it. It is happily running on the virtual machine...but I can't connect to it from the desktop system.
When I do an attach to process, and a Find to find the system, the virtual machine is found.
However, after selecting the virtual machine, I am prompted for credentials. I've tried using the same login credentials I use to log onto the virtual machine, but that doesn't work. And there's no information shown as to what might be the problem.
The virtual machine is running under Hyper-V.
How do I go about setting up a remote debugging connection to virtual machine running on the same system where I am running VS 2017?
I ran into the same issue and managed to get it working, after much effort.
First, try switching the debugger authentication mode to "No Authentication" (Tools -> Options) and setting your project in Visual Studio to match (see the language-specific links in the MS docs link below). That will help you determine if it is a credential issue or something else.
The microsoft docs say, "You can run the remote debugger under a user account that differs from the user account you are using on the Visual Studio computer, but you must add the different user account to the remote debugger's permissions."
In my case, I ran the same account on both machines AND added my account to the debugger's permissions, and it still didn't work. We use Azure AD, and I was using a domain account. My VS computer was on the domain, and the VM was not (even though I could sign in with a domain account). After adding the VM to the domain, I could connect with "Windows Authentication" enabled in the debugger settings.

How to deploy and debug wdk 8 kernel mode driver

I’m trying to set up automatic driver deployment and debugging to test a win 8.1 driver from Visual Studio 2013.
Host machine:
Win 7
VS2013
Target Machine:
Win 8.1
My host machine is set up with 2 network cards, 1 which connects to the corporate network and one spare. The target machine also has a network adapter.
My question is: is it possible to set up automatic deployment and debugging of drivers in Visual studio 2013 by connecting the host and target via a LAN whilst still being connected to the corporate domain and if not, is there a way of debugging wdk drivers on a target pc outside of visual studio, maybe via another application?
The documentation I found here only makes it seem possible by connecting to the same domain name or workgroup.
link to documentation
Many Thanks
Yes you can set up automatic deployment of the driver as well as getting visual studio to do the provisioning of the target pc over a local network as well as being connected to a corporate domain.
Admin rights are needed on the target
An extra ethernet card is needed in the host
All networks connections on the target are open with printer and file sharing options enabled
The ip and name of the target are listed in system32/etc/host in the host PC
A switch is needed and DHCP setting are enable with automatic IP
A good place to start:
https://msdn.microsoft.com/en-us/library/windows/hardware/gg507680.aspx
EDIT:
Basically, this was a nightmare and started dropping its connection. I reverted back to using WinDBG using:
custom scripts to copy everything over to USB
devcon to automactially load the driver
WinDBG to autoload appropriate settings on startup and load source files in to debug

VMnetwork adapter not detected in hyperv vitual machine

i have hyperV server running on which , i have just created a windows server 2008 virtual machine, where in that virtual machine network adapter is not detected. how to solve this problem.
#kaustubh93 Try installing a LEGACY network adapter. For machines as old as Win2K8 Server, the default network adapters may not work (did not for me), but installing a Legacy adapter did the trick.
This fix (using a Legacy adapter) worked this evening on a Windows 10 Pro installation running Hyper-V Client. I'd installed a Windows 7 Pro VM, but it wouldn't access the Internet via the Virtual Switch (external). Once I installed the legacy NIC, I had Internet access from within the VM.
Windows 2008 R2 is essentially Windows 7 anyway, so this solution is likely to work for you as well.
Jeff W.
Reading, PA
To add a network adapter
Open Hyper-V Manager. Click Start, point to Administrative Tools, and then click Hyper-V Manager.
In the results pane, under Virtual Machines, select the virtual machine that you want to configure.
In the Action pane, under the virtual machine name, click Settings.
In the navigation pane, click Add Hardware.
On the Add Hardware page, choose a network adapter or a legacy network adapter.
Click Add. The Network Adapter or Legacy Network Adapter page appears.
Under Network, select the virtual network you want to connect to.
If you want to configure a static MAC address or virtual LAN identifier, specify the numbers you want to use.
Click OK.
More : technet troubleshooting

Can't debug correctly Windows drivers with Visual Studio

I've written a Windows driver sample (WDM) with Visual Studio but I'm encountering issues when trying to debug it. The target is running in a Virtual Machine (VMware)
I've followed the documentation (http://msdn.microsoft.com/en-us/library/windows/hardware/hh698272(v=vs.85).aspx) to configure everything.
It's compiling fine but there are problems when debugging.
I have tried various configurations and have different problems on each.
Visual Studio 2013 Preview on Win7 (host) / Win8.1 Preview (target) - VMware
It seems the debugger isn't working properly. Indeed it's like if nothing was loaded, the Modules Window is empty, when I click on "Break all" nothing is happening. As you can see in the logs, the debugger session isn't created.
Screenshot:
Logs: http://pastebin.com/DfVzGR4Z
Visual Studio 2012 on Win7 (host) / Win8 (target) - VMware
It's working correctly at the first try but if I stop the debugger to modify the driver, it'll freeze the VM. I'll then have to restart the VM, Visual Studio and kill the process ntkd.exe because otherwise I have these errors:
Failure to create process instance prevents debugging
Unable to start (null), Error 80004005. (Unspecified error)
Followed by a crash of VS (Event Name: CLR20r3)
I've tried with other samples downloaded from the MSDN but it's the same problem.
I've been stuck on these issues for weeks and I'm starting to desperate, so any help would be appreciate. I haven't tried WinDDK but since VS has everything needed, I don't see why I couldn't use it normally.
I recommend to forget using Visual Studio for driver development/debugging because, on my opinion, is not solid enough.
But targetting the debugging process, it is better to install VisualDDK and then launch vmmon/vmmon64.
In the installed application you will find a folder named "target" with an application named DDKLaunchMonitor.exe, install it in the virtual machine (it will create a boot menu option to activate kernel debugging)
When you want to debug your driver, launch vmmon, activate the option to launch windbg at vm startup, start your vm and when windows boots it will load windbg and attach to the vm.
The install your driver as desired and learn windbg.
I know this answer does not solve you problem with VS but using windbg directly is faster and better.
I was having a similar problem with: Visual Studio 2015 Community Edition, Windows 10 host, Windows 10 target, VirtualBox with host only network.
Provisioning and remote driver deployment worked, but the debugger would not connect.
Edit: In the last step of provisioning in VS2015 the Host IP can be selected. The manual method below is an alternative.
The manual setup guide for kernel mode debugging says to run the following:
bcdedit /debug on
bcdedit /dbgsettings net hostip:w.x.y.z port:n
Visual Studio automatically runs these during the provisioning process. Notice the hostip parameter - this has to be the address of the connecting machine (the one with the debugger) on the interface it uses to connect to the target. Visual Studio may set this incorrectly if you have multiple network interfaces. In my case the VirtualBox host only network created the extra network interface.
Provision the target machine in VS, if you haven't already. Then run the two bcdedit commands above and reboot the target machine. After this, the debugger should connect properly.
I came across the same problem. The windbg connection is hang. I found there is something wrong in my configuration for Kernel mode debugger settings( Visual studio 2012 Driver->test->Configuration). I set the port simply com1. Actually, it should be \.\pipe\com_1.Then it works
In your case, there maybe other configuration problems. You can check through the points on webpage http://www.codeproject.com/Tips/545835/Kernel-Mode-Debugging-in-a-VM-using-Visual-Studio.

Resources