Windows KMFD HelloWorld Driver Deployment Task Failed - c++

I need to write a Kernel Driver for Windows. Since this is my first time attempting something like this, I started with Windows' HelloWorld example:
https://msdn.microsoft.com/en-us/library/windows/hardware/hh439665(v=vs.85).aspx
I encounter my problem when installing the driver to the target machine. The console on the target machine gives the following output:
Test Authoring and Execution Framework v5.3 for x64
StartGroup: DriverTestsTasks:: _DriverRemoval Driver
Certificate File: KmfdHelloWorld.cer Driver Inf
File:KmfdHelloWorld.inf Driver Hardware ID:
Root\KmdfHelloWorld Driver package GUID: x64 Import Driver To
Store: 1 Uninstall Driver: 1 Debug Deployment: 1 COM
failure occurred. HRESULT: 0x80040154 Class not registered
Class not registered
Failed: A failure occured while removing the previous driver
installation EndGroup: DriverTestTasks:: _DriverRemoval [Failed]
Non-passing Tests: DriverTestTasks::_DriverRemoval [Failed]
SummaryL Total=1, Passed=0, Failed=1, Blocked=0, Not Run=0, Skipped=0
As explained in the tutorial, I am using Visual Studio 2015. My test machine is running Windows 10 in a VM. All the other tests pass. The driver is copied to the target machine and gets installed, but fails this one procedure and hence I can't use the Debugger explained at the end of the tutorial.

you can remove the step of remove the previous installation by remove checkbox at "project setting"-> Driver install-> Deployment

Related

Run issue with Deepstream 5.1 and YOLOv4

Complete information of setup.
• Hardware Platform (Jetson / GPU) : GPU
• CUDA : 11.1
• DeepStream Version : 5.1
• JetPack Version (valid for Jetson only): None
• TensorRT Version : 7.2.3.4
• NVIDIA GPU Driver Version (valid for GPU only) : 460.84
I have done Deepstream 5.1 setup and while Run the Sample getting below error.
Can anybody help me around?
ERROR:
............
(deepstreamer_env) xxxx#xxxx:/opt/nvidia/deepstream/deepstream-5.1/sources/deepstream_yolov4$ deepstream-app -c deepstream_app_config_yoloV4.txt
Unknown or legacy key specified 'is-classifier' for group [property]
** ERROR: main:655: Failed to set pipeline to PAUSED
Quitting
ERROR from sink_sub_bin_sink1: Could not open file "yolov4.mp4" for writing.
Debug info: gstfilesink.c(431): gst_file_sink_open_file (): /GstPipeline:pipeline/GstBin:processing_bin_0/GstBin:sink_bin/GstBin:sink_sub_bin1/GstFileSink:sink_sub_bin_sink1:
system error: Permission denied
ERROR from sink_sub_bin_sink1: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Debug info: gstbasesink.c(5265): gst_base_sink_change_state (): /GstPipeline:pipeline/GstBin:processing_bin_0/GstBin:sink_bin/GstBin:sink_sub_bin1/GstFileSink:sink_sub_bin_sink1:
Failed to start
App run failed
#deepstream #tensorrt #yolov4
It looks like that deepstream can not write into the specified directory because of permission issue. You may first check if your user has write permission to that directory or run the app with sudo.

Windows biometric framework sample umdf driver: This device cannot start. (Code 10)

I am trying to run a windows biometric driver sample and I am naive to driver development
I have changed the hardware id in the inx file and rebuilt the driver project and installed the resulting driver on my Windows 10 Pro version 1803.
I am using a Fingerprint Morpho Device 1300 E3
Driver got installed successfully but there is one error showing up:
This device cannot start. (Code 10)
The specified request is not a valid operation for the target device.
I reviewed the file C:\Windows\INF\setupapi.dev.log
It shows the next warnings:
sig: {_VERIFY_FILE_SIGNATURE} 10:13:03.130
sig: Key = wudfbiousbsample.inf
sig: FilePath = C:\WINDOWS\System32\DriverStore\Temp\{ee9ffca3-751f-0b4e-a7ac-dce2543d995e}\wudfbiousbsample.inf
sig: Catalog = C:\WINDOWS\System32\DriverStore\Temp\{ee9ffca3-751f-0b4e-a7ac-dce2543d995e}\biometrics.cat
! sig: Verifying file against specific (valid) catalog failed.
! sig: Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
!!! dvi: Device not started: Device has problem: 0x0a (CM_PROB_FAILED_START), problem status: 0xc0000450.
But I installed the TestCertificate on the Trusted Root Certification Authorities and Trusted Publishers on the local machine
I also checked the EventViewer:
Application and Services Logs > Microsoft\Windows\CodeIntegrity
Application and Services Logs > Microsoft\Windows\Biometrics
I tried to debug with wdfverifier.exe following some videos from msdn but the process is not started so I couldn't debug :(
I verified that Visual Studio is not signing the EngineAdapter.dll plugin file so I disabled driver signing and did it manually following this paper. But I get the same error code 10 :(
I also wondered if error code 10 is this the expected behavior because the code of EngineAdapter.dll is not implemented.
UPDATE: I am testing on a Windows 10 Pro Version 1709 Virtual Machine VMWare and I get other error:
This device is not working properly because Windows cannot load the drivers required for this device. (Code 31)
!!! dvi: Device not started: Device has problem: 0x1f (CM_PROB_FAILED_ADD), problem status: 0xc0000001.
And the same warnings:
sig: {_VERIFY_FILE_SIGNATURE} 17:19:01.646
sig: Key = wudfbiousbsample.inf
sig: FilePath = C:\Windows\System32\DriverStore\Temp\{85323f79-3f5f-f84c-a52b-639b6ae57db1}\wudfbiousbsample.inf
sig: Catalog = C:\Windows\System32\DriverStore\Temp\{85323f79-3f5f-f84c-a52b-639b6ae57db1}\biometrics.cat
! sig: Verifying file against specific (valid) catalog failed.
! sig: Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
sig: {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 17:19:01.661
sig: {_VERIFY_FILE_SIGNATURE} 17:19:01.676
sig: Key = wudfbiousbsample.inf
sig: FilePath = C:\Windows\System32\DriverStore\Temp\{85323f79-3f5f-f84c-a52b-639b6ae57db1}\wudfbiousbsample.inf
sig: Catalog = C:\Windows\System32\DriverStore\Temp\{85323f79-3f5f-f84c-a52b-639b6ae57db1}\biometrics.cat
sig: Success: File is signed in Authenticode(tm) catalog.
sig: Error 0xe0000241: The INF was signed with an Authenticode(tm) catalog from a trusted publisher.
sig: {_VERIFY_FILE_SIGNATURE exit(0xe0000241)} 17:19:01.708
sto: {DRIVERSTORE IMPORT VALIDATE: exit(0x00000000)} 17:19:01.739
Full log file here setupapi.dev.log
I tought the driver does not load because the warnings about the certificate or the error could be somewhere else.
If someone could give me a small advice to continue. I am stuck now :(
Many Thanks.
All started when I was able to install my Biometric Driver but it showed a "Yellow Exclamation Mark" and a generic message "This device cannot start. (Code 10)"
The biometric sample project does not include an example how to sign properly EngineAdapter.dll with Visual Studio I found this resource (page 33-34) where shows How to Sign The EngineAdapter on project properties Build Events -> Post Build Event:
Command Line: signtool sign /v /ac "Path_to_cross_certificate_DigiCert Assured ID Root CA.crt" /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "path_to_my_certificate_file.pfx" /p mypassword "$(Platform)\$(ConfigurationName)\EngineAdapter.dll"
Use In Build: Yes
Next This first video tutorial shows an example of debugging umdf driver using a tool from the WDK wdfverifier.exe
I couldn't attach the debugger to my driver process because the process is not present. But I could debug at startup before the process crashes.
To debug with wdfverifier.exe I took the following steps:
Settings Tab:
Check the option "Automatically Launch user-mode debugger when requested", specify 15 seconds in the input "Host Process will wait"
Preferences Tab:
Check "Use WinDbg", then
Disable/Enable my device on Device Manager
WinDbg launches and I can check if my driver module was loaded with the next command:
lm m *bio*
//the module is not loaded, use g commant to continue
g
//again see if the module was loaded
lm m *bio*
//module shows up, great!
Now I can set break points but before that I had to specify to WinDbg where are the symbol file (*.pdb) and source code of the driver with the next commands (the paths may be different if you build the package project, I am building the WudfBioUsbSample with a reference to EngineAdapter Project):
.symfix
.srcpath+ C:\Users\myuser\Documents\Windows-driver-samples\biometrics\driver
.sympath+ C:\Users\myuser\Documents\Windows-driver-samples\biometrics\driver\x64\Debug
.reload /f
Next I could set a break point:
//x command is used to search if the method exist
x WudfBioUsbSample!CBiometricDriver::*
x WudfBioUsbSample!CBiometricDevice::*
x WudfBioUsbSample!CBiometricDevice::OnGetAttributes
//examples of breakpoints
bp WudfBioUsbSample!CBiometricDriver::OnDeviceAdd
bp WudfBioUsbSample!CBiometricDevice::OnGetAttributes
bp WudfBioUsbSample!CBiometricDevice::CreateUsbIoTargets
The method CreateUsbIoTargets is where the errors show up. These errors are fixed by JinZhuXing in this github issue
After fixing the driver code and debugging that the method CreateUsbIoTargets runs Ok
Still showed me The Yellow Exclamation Mark but this time the error was in the EngineAdapter.dll. The next error shows in EventViewer: Application and Services Logs > Microsoft\Windows\Biometrics
The module's "Engine Adapter" initialization routine failed with error: 0x80004001
The EngineAdapter project methods were returning E_NOTIMPL I just changed this to return S_OK instead for all methods. And the biometric unit was successfully created.
Also debugging of the Engine Plugin is done with Visual Studio. Here are the steps I followed:
Use wdfverifier.exe to attach WinDbg to the process of my umdf driver and set a break point to OnGetAttributes method (this method is called when I start/restart the Windows Biometric Service)This breakpoint will make the service to wait before it calls the EngineAdapter Plugin code.
x WudfBioUsbSample!CBiometricDevice::OnGetAttributes
bp WudfBioUsbSample!CBiometricDevice::OnGetAttributes
g
Restart or start Windows Biometric Service (WbioSrvc on Task Manager->Services Tab)
Copy The Process ID (PID)
Run Visual Studio as Administrator, Open WBDIsample project
Use Menu Debug -> Attach to Process...
Enter the following values:
Connection Type: Windows User Mode Debugger
Connection Target: Localhost
Check "Show processes from all users"
Filter by Process ID
Select the process and Click Attach button.
Set Breakpoints on WbioQueryEngineInterface, EngineAdapterAttach, EngineAdapterDetach
a sample implementation is on msdn
run the command g (Go) on WinDbg
g
After this you can debug the code of the plugin on Visual Studio.
What is left is to implement the code for the Biometric Driver and The necessary plugins for your device

Selenium Command line server for the IEDriverServer has stopped working App Crash error

I have a Selenium Python automated regression test script running on our 64bit Server on IE11, Windows Server 2008. Everytime when the test gets about half way through an error dialog appears and the test stops. The error is:
Command line server for the IEDriverServer has stopped working
The full trace is:
Problem signature:
Problem Event Name: APPCRASH
Application Name: IEDriverServer.exe
Application Version: 2.53.0.0
Application Timestamp: 56e9abe3
Fault Module Name: IEDriverServer.exe
Fault Module Version: 2.53.0.0
Fault Module Timestamp: 56e9abe3
Exception Code: 40000015
Exception Offset: 000000000001877a
OS Version: 6.1.7601.2.1.0.272.7
Locale ID: 2057
Additional Information 1: 9d60
Additional Information 2: 9d60a3c1cb1d5911598c0ff40a26278a
Additional Information 3: 1ee9
Additional Information 4: 1ee9da2f8e2415daed3ffe0e1066b74e
Anyone know why the IEDriverServer is crashing?
On our 32bit server the tests runs ok all the way to the end. Over 230 test cases. But on our 64bit server the App Crash error appears half way through.
I have set the registry DWORD value:
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.
IEDriverServer.exe is also in my Path
And also i notice in Task Manager iexplore.exe it's memory usage is 2.95GB
Is this normal? The memory seems really high.
Does Selenium need over 2.95GB of memory to run the tests in IE11?
Thanks, Riaz
If you are using 32bit IEDriverServer.exe for 64Bit OS then you switch over to 64 Bit IEDriverServer.exe because there could be reason of mismatch 32bit to 64 bit combination behind crashing of IE driver, and now if using 64 bit IEdriverserver.exe and you are having slow typing issue then to overcome this issue for 64bit exe over IE 11 browser Follow these steps:-
Internet Options -> Security -> Check "Enable Protected Mode" for all zone
Go to Advanced -> Security -> Check "Enable Enhanced Protected Mode"
this works for me. Cheers!

Visual Studio 2015 kernel debugger gets stuck

I am attempting to write a KMDF driver using visual studio 2015. When I try to deploy the driver and start the debugger everything seems to work: visual studio is able to build the solution and deploy it to the target computer (wich is a virtual machine), but after the deployment of the files, it seems to get stuck: I can't pause the debugger and execute the debugger's commands.
My Question: How do I get the debugger to break/pause?
What I have tried:
I have tried connecting to the target computer both with the network and with pipes, but neither seems to change anything.
I have tried setting the test certificate to "WDKTestCert".
I have tried adding a package project to the solution.
Additional Information:
My configuration of the project is the exact same as shown on MSDN here.
My host computer and target computer are both running windows 8.1 64 bit.
The target computer is a VMWare virtual machine.
I am using visual studio 2015 Version 14.0.25123.00 Update 2.
I am using WDK 10.
The Debugger's Log:
Using NET for debugging
Opened WinSock 2.0
Waiting to reconnect...
[20:00:30:970]: Remove Existing Remote Package
[20:00:31:802]: Task "Remove Existing Remote Package" completed successfully
[20:00:31:824]: Copy Driver Package
[20:00:35:171]: Task "Copy Driver Package" completed successfully
[20:00:35:193]: Driver Removal
[20:00:35:194]: Removing any existing files from test execution folder.
[20:00:36:057]: Copying required files for "Driver Removal".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_DriverRemoval'" /p:"InfFile=KmdfDriver.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=KmdfDriver.cer" /p:"PackageGuid=x64" /p:"HardwareId=Root\KmdfDriver" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Removal_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:01:51:745]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:01:51:750]: Task "Driver Removal" completed successfully
[20:01:52:183]: Driver Preparation
[20:01:52:184]: Removing any existing files from test execution folder.
[20:01:53:029]: Copying required files for "Driver Preparation".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_DriverPreparation'" /p:"InfFile=KmdfDriver.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=KmdfDriver.cer" /p:"PackageGuid=x64" /p:"HardwareId=Root\KmdfDriver" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Preparation_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:02:07:150]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:02:07:154]: Task "Driver Preparation" completed successfully
[20:02:07:866]: Driver Install
[20:02:07:867]: Removing any existing files from test execution folder.
[20:02:08:709]: Copying required files for "Driver Install".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_RunProcess'" /p:"BinaryPath=%SystemDrive%\DriverTest\devcon.exe" /p:"Arguments=-f install %SystemDrive%\DriverTest\Drivers\KmdfDriver.inf Root\KmdfDriver" /p:"WorkingFolder=%SystemDrive%\DriverTest\Drivers" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Install_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:02:22:809]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:02:22:813]: Task "Driver Install" completed successfully
[20:02:23:267]: Driver Post Install Actions
[20:02:23:268]: Removing any existing files from test execution folder.
[20:02:24:107]: Copying required files for "Driver Post Install Actions".
$KitRoot$\Testing\Runtimes\TAEF\te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks_downlevel.dll" /select:"#Name='DriverTestTasks::_DriverPostInstall'" /rebootStateFile:%SystemDrive%\DriverTest\Run\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Run\Driver_Post_Install_Actions_00008.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[20:02:36:377]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[20:02:36:380]: Task "Driver Post Install Actions" completed successfully
After this point it seems like nothing happens.
Any help would be appreciated.

Executing coded UI test from a target machine's mstest(standalone). Dll's/Files needed!! :(

i set up mstest on target machine as standalone program without installing visual studio. So i copied the files(*.exe's,dll's) mstest needed to the target machine and register all dlls in gac which mstest needs to run unit tests.
Works fine so far for normal unit tests.
Acually i try to setup mstest to run coded ui test. I copied some new dll's to the target machine:
- Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
- Microsoft.VisualStudio.TestTools.UITest.Common.dll,TestTools.UITest.Extensions.dll
- Microsoft.VisualStudio.TestTools.UITesting.dll
- Microsoft.VisualStudio.HostingProcess.Utilities.Sync
But when i try to execute a test on cmd.exe via mstest.exe on my target machine, the test will run but always fail (works fine on my local machine, Visual Studio 2012). Its a pretty simple test:
- just click on "Start",
- type in "calc press enter"
Both machines use the same operating system.
I guess MSTest.exe still needs some dll's to perform codedUiTests. The bad thing is the missing dll's arent show up in cmd.exe, no errors, no hints just nothing :/
The test runs like normal but will fail all tests.
cmd-output:
Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading D:\Users\Jenkins\Desktop\CodedUITestProject1\CodedUITestProject1\bin\Debug\CodedUITestProject1.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Failed CodedUITestProject1.CodedUITest1.CodedUITestMethod1
0/1 test(s) Passed, 1 Failed
Summary
-------
Test Run Failed.
Failed 1
---------
Total 1
Results file: C:\VS2011Stub\Common7\IDE\TestResults\Jenkins_MSGP166C 2013-05-24 12_36_28.trx
Test Settings: Default Test Settings
Does anyone know what files mstest.exe needs to run codeduitests in a correct way?
Edit: I checked the *.trx file and copied the missing dll's to my target machine.
I tried to run the test again, it failed again. I was checking the trx file again and got an awesome message :/
<Results>
<UnitTestResult executionId="4652eeb1-e1b4-4782-a288-dbd4bb0bda5a" testId="484ddbfe-fdc6-0f5d-9e7b-bab4da5b5905" testName="CodedUITestMethod1" computerName="MSGP166C" duration="00:00:00.0887388" startTime="2013-05-24T16:30:24.1716290+02:00" endTime="2013-05-24T16:30:24.6266745+02:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="4652eeb1-e1b4-4782-a288-dbd4bb0bda5a">
<Output>
<ErrorInfo>
<Message>Error calling Initialization method for test class CodedUITestProject1.CodedUITest1: System.IO.FileNotFoundException: Das System kann die angegebene Datei nicht finden. (Ausnahme von HRESULT: 0x80070002)</Message>
<StackTrace> bei System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
bei System.Reflection.Assembly.LoadFile(String path)
bei Microsoft.VisualStudio.TestTools.UITest.Framework.UITestExtensionPackageManager.LoadAssembly(String assemblyFile)
</StackTrace>
</ErrorInfo>
</Output>
</UnitTestResult>
</Results>
So what Assembly is missing now?? It was not mentioned.
Thanks in Advance
Instead of trying to copy over the dlls I would install VS Test Agents. It's much lighter than visual studio and will get you mstest. This is the approach I use when running CodedUI tests on a test machine.
http://search.microsoft.com/en-us/DownloadResults.aspx?q=test+agents
Download the version of test agents that you built the project in.
(doesn't really matter)
There will be 3 options when you open the installer. You want test agents.
You should now have everything you need for mstest and codedui
Another that works well is putting all of your codedui tests into an ordered test and passing that into mstest.
MSTest /TestContainer:OrderedTest1.orderedtest
should do the trick