Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio driver deployment fails

I am new to driver development, and for ease I would just like to first get a simple setup where I can compile my driver and hit F5 on Visual Studio 2015 to debug it on my VMware machine. I have tried to do this, and I am encountering an issue Google is not helping me with at all.

My basic setup is a Windows 10 x64 VMWare machine with a serial port as the target and Windows 10 x64 as the host. The target is on the host.

To start, here is the full log I get in windbg in Visual Studio when I try to debug my driver:

Microsoft (R) Windows Debugger Version 10.0.15063.400 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

DESKTOP-AF13U59\Lupe (npipe WinIDE_01D2D83A52532800) connected at Mon May 29 00:13:35 2017

Microsoft (R) Windows Debugger Version 10.0.15063.400 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Opened \\.\pipe\com_1
Waiting to reconnect...
[00:13:36:302]: Remove Existing Remote Package
[00:13:37:137]: Task "Remove Existing Remote Package" completed successfully
[00:13:37:143]: Copy Driver Package
[00:13:40:517]: Task "Copy Driver Package" completed successfully
[00:13:40:532]: Driver Removal
[00:13:40:532]: Removing any existing files from test execution folder.
[00:13:41:367]: Copying required files for "Driver Removal".

$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverRemoval'" /p:"InfFile=auxkdb.inf" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=auxkdb.cer" /p:"PackageGuid=x64" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Removal_00014.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated




Error message: Unable to start process
[00:13:50:909]: Driver Preparation
[00:13:50:910]: Removing any existing files from test execution folder.
[00:13:51:745]: Copying required files for "Driver Preparation".

$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverPreparation'" /p:"InfFile=auxkdb.inf" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=auxkdb.cer" /p:"PackageGuid=x64" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Preparation_00014.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated




Error message: Unable to start process
[00:14:01:351]: Default Driver Package Installation Task
[00:14:01:351]: Removing any existing files from test execution folder.
[00:14:02:185]: Copying required files for "Default Driver Package Installation Task".

$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DefaultDriverPackageInstallationTask.dll" /select:"@Name='Microsoft.DriverKit.DefaultDriverPackageInstallationClass.PerformDefaultDriverPackageInstallation'" /p:"AbsoluteDriverPackagePath=%SystemDrive%\DriverTest\Drivers\auxkdb.inf" /p:"DQ=%SystemDrive%\DriverTest\Drivers\auxkdb.inf" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Default_Driver_Package_Installation_Task_00012.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated




Error message: Unable to start process
[00:14:11:710]: Driver Post Install Actions
[00:14:11:711]: Removing any existing files from test execution folder.
[00:14:12:545]: Copying required files for "Driver Post Install Actions".

$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverPostInstall'" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Post_Install_Actions_00014.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated




Error message: Unable to start process

It seems to get as far as putting the driver files in C:\DriverTest\DriversNew, but it never starts the driver.

Other basic info:

  • Firewall is off on both host and target
  • I can ping the VM by name on host
  • I can use windbg to debug the VM with the same port
  • The machine in Visual Studio says "Configured for driver testing", so it seems to think everything is working, at least

I am not sure what else to provide, but the only other occurrence of the problem I could find was self-answered, and said that the problem was solved by reinstalling Visual Studio, Windows SDK and WDK. I did all of those things and have also tried the target being Windows 7 x64, but the problem remains. It also does create WDKRemoteUser and log in, just nothing (seemingly) afterwards.

I used all links from this page for VS, SDK and WDK so I don't think it's some sort of version mismatch, and I have installed the C:\Program Files (x86)\Windows Kits\10\Remote\x64\WDK Test Target Setup x64-x64_en-us.msi from the host on the target.

Any ideas?

like image 642
Lupe Avatar asked Oct 26 '25 05:10

Lupe


1 Answers

I just found where it come from :p When VS start debugging i also got 3 or 4 cmd that show but very fast, so i couldn't read what it says. I manage to screenshot it : https://i.sstatic.net/cHezk.jpg. ( seconde image)

"It says Te.service is needed to launch a host process. Please restart it if it is already installed" => Google "Te.Service restart" => https://learn.microsoft.com/en-us/windows-hardware/drivers/taef/te-service

So :

  1. I went to C:\Program Files (x86)\Windows Kits\10\Testing\Runtimes\TAEF
  2. Opened a new CMD as admin
  3. Run : "Wex.Services.exe /install:Te.Service" I got "WARNING: Te.Service installation is removing previous Te.Service install, as associated binary has been removed or is no longer accessible at "C:\Program Files (x86)\Windows Kits\10\Testing\Runtimes\TAEF\Wex.Services.exe". Install Te.Service [Success]" YEAAH :p
  4. And i runned "sc start Te.Service"

After that i didn't get the same error again.

But i got another error "Unable to elevate the user's token because the user is not an administrator" https://i.sstatic.net/cHezk.jpg (first image)

VS Force me to switch to another user which it created before that, so didn't have the admin right. So I add it to admin localgroup : "net localgroup administrators WDKRemoteUser /add" in french : "net localgroup administrateurs WDKRemoteUser /add"

Are you new to kernel driver developpement ? Maybe we could help each other in the futur regarding this subject :)

I hope it will help you man !

like image 122
user3759726 Avatar answered Oct 28 '25 18:10

user3759726



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!