我们有一个纯软件 KMDF 驱动程序(使用 WdfDriverInitNonPnpDriver 初始化),在 Windows 10 版本 2004 上未能通过 HLK“PNP 停止(重新平衡)设备测试”。日志显示“PNP_VetoLegacyDevice”上的错误代码,其中几行是错误“无法打开 EDT 设备”,通过过滤器。
我想知道 Windows 10 版本 2004 HLK 测试的过滤器是否存在问题,或者我是否需要更改某些内容才能通过这些测试。
这是日志:
Test Authoring and Execution Framework v10.43k for x64
Verify: IsTrue(m_Ev.SetVariableData(L"Wpa2PskAesSsid", m_Wpa2PskAesSsid))
Verify: IsTrue(m_Ev.SetVariableData(L"Wpa2PskPassword", m_Wpa2PskPassword))
One or more parameters required for this test were not passed in. This test accepts the following TAEF runtime parameters:
DQ: An SDEL query that WDTF can use to find the devices to test.
TestCycles: Number of cycles to run the test for.
DoSimpleIO: True or False. Runs SimpleIO (if found) on test devices before and after performing PNP operations.
IOPeriod: Time period in minutes to run SimpleIO (if found).
DoConcurrentIO: True or False. Uses WDTF concurrent IO interface to send I/O requests to target device stacks while performing PNP operations.
Test execution will continue using default values for unspecified parameters.
About to log start telemetry data ...
Telemetry: Registering trace logging.
Telemetry: Creating new TelemetryRegistration.
Telemetry trace logging registration status: 0x0
Telemetry trace logging initialization status: True
StartGroup: PNPDTest::PNPTryStopDeviceAndFailRestart
Verify: SUCCEEDED(m_pWDTF.CoCreateInstance(__uuidof(WDTF2)))
WDTF_TARGET : - GetInterface("System")
WDTF_TARGET : Target: DOWIN10
WDTF_SYSTEM : SYSTEM_POWER_CAPABILITIES =
Power Button = YES
Sleep Button = NO
Lid = NO
AoAc = NO
S1 = NO
S2 = NO
S3 = YES
S4 = YES
Hibernate = YES
S5 = YES
Battery = YES
RTC Wake = S4
WDTF_TARGET : - GetInterface("Support")
WDTF_TARGET : Target: DOWIN10
WDTF_SUPPORT : - SetSANPolicyToOnline
WDTF_TEST : Test parameter values:
WDTF_TEST : DQ: IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')
WDTF_TEST : TestCycles: 3
WDTF_TEST : DoSimpleIO: True
WDTF_TEST : IOPeriod: 1
WDTF_TEST : DoConcurrentIO: True
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SUPPORT : - ClearSetupAPILogs()
WDTF_TARGETS : - Query("IsDevice AND (SemiUniqueTargetHardwareIdentifier='Root\apegw')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TEST : WARNING: The test is not enforcing that Driver Verifier is enabled.
WDTF_TEST : DV is enabled with Flag:=0x1209bb
WDTF_TEST : DV is successfully enabled for all drivers of this devnode(UniqueTargetName):=TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("EDT")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
Telemetry: [1 of 2] Driver name: msdmfilt.sys
Telemetry: [1 of 2] Driver version: 10.0.19041.1
Telemetry: [1 of 2] Driver package INF name: 0
Telemetry: [1 of 2] Driver package flight ID: 0
Telemetry: [1 of 2] Driver package submission ID: 0
Telemetry: [2 of 2] Driver name: apegw.sys
Telemetry: [2 of 2] Driver version: 1.0.0.17
Telemetry: [2 of 2] Driver package INF name: 0
Telemetry: [2 of 2] Driver package flight ID: 0
Telemetry: [2 of 2] Driver package submission ID: 0
WDTF_TEST : Starting PNPTryStopDeviceAndFailRestart test [1 of 3]
WDTF_TARGETS : - GetInterfacesIfExist("PNP")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TEST : Querying for devices to test I/O on during the test
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetRelations("below-or-self/","IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("SimpleIOStressEx")
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 no Simple IO Interface was found.
WDTF_SIMPLE_IO_ANY : - The Generic Any SimpleIO plugin will be used to generate IO for Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 WDTF will use the ANY Simple IO Interface.
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLEIO_STRESS : - Start(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Open(TestGuardDevice ROOT\TESTGUARD\0000 ) Try count 1
WDTF_SUPPORT : - WaitForMinutes : 1
WDTF_SIMPLE_IO : - PerformIO(TestGuardDevice ROOT\TESTGUARD\0000 ) Count 1
WDTF_SIMPLEIO_STRESS : - Stop(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Close(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_TARGETS : - GetInterfacesIfExist("ConcurrentIO")
WDTF_PNP : - EDTTryStopDeviceFailRestart()
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Failed to open the EDT device m_EDTDevice.OpenDevice is returning error:-2147024894 for Target:TestGuardDevice ROOT\TESTGUARD\0000 .
WDTF_PNP : - RestartDevice()
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
Error: WDTF_PNP : Result: Error : PNP_VetoLegacyDevice : Instance Path: ROOT\TESTGUARD\0000.
WDTF_PNP : For Target: TestGuardDevice ROOT\TESTGUARD\0000 we will Rescan now.
WDTF_PNP : - RescanParentDevice() : ( get status count: 1 )
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SUPPORT : - WaitForSeconds : 15
WDTF_TARGETS : - GetInterfacesIfExist("ConcurrentIO")
WDTF_TEST : Querying for devices to test I/O on during the test
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetRelations("below-or-self/","IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("SimpleIOStressEx")
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 no Simple IO Interface was found.
WDTF_SIMPLE_IO_ANY : - The Generic Any SimpleIO plugin will be used to generate IO for Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 WDTF will use the ANY Simple IO Interface.
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLEIO_STRESS : - Start(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Open(TestGuardDevice ROOT\TESTGUARD\0000 ) Try count 1
WDTF_SUPPORT : - WaitForMinutes : 1
WDTF_SIMPLE_IO : - PerformIO(TestGuardDevice ROOT\TESTGUARD\0000 ) Count 1
WDTF_SIMPLEIO_STRESS : - Stop(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Close(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_TEST : Starting PNPTryStopDeviceAndFailRestart test [2 of 3]
WDTF_TARGETS : - GetInterfacesIfExist("PNP")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TEST : Querying for devices to test I/O on during the test
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetRelations("below-or-self/","IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("SimpleIOStressEx")
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 no Simple IO Interface was found.
WDTF_SIMPLE_IO_ANY : - The Generic Any SimpleIO plugin will be used to generate IO for Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 WDTF will use the ANY Simple IO Interface.
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLEIO_STRESS : - Start(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Open(TestGuardDevice ROOT\TESTGUARD\0000 ) Try count 1
WDTF_SUPPORT : - WaitForMinutes : 1
WDTF_SIMPLE_IO : - PerformIO(TestGuardDevice ROOT\TESTGUARD\0000 ) Count 1
WDTF_SIMPLEIO_STRESS : - Stop(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Close(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_TARGETS : - GetInterfacesIfExist("ConcurrentIO")
WDTF_PNP : - EDTTryStopDeviceFailRestart()
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Failed to open the EDT device m_EDTDevice.OpenDevice is returning error:-2147024894 for Target:TestGuardDevice ROOT\TESTGUARD\0000 .
WDTF_PNP : - RestartDevice()
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
Error: WDTF_PNP : Result: Error : PNP_VetoLegacyDevice : Instance Path: ROOT\TESTGUARD\0000.
WDTF_PNP : For Target: TestGuardDevice ROOT\TESTGUARD\0000 we will Rescan now.
WDTF_PNP : - RescanParentDevice() : ( get status count: 1 )
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SUPPORT : - WaitForSeconds : 15
WDTF_TARGETS : - GetInterfacesIfExist("ConcurrentIO")
WDTF_TEST : Querying for devices to test I/O on during the test
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetRelations("below-or-self/","IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("SimpleIOStressEx")
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 no Simple IO Interface was found.
WDTF_SIMPLE_IO_ANY : - The Generic Any SimpleIO plugin will be used to generate IO for Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 WDTF will use the ANY Simple IO Interface.
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLEIO_STRESS : - Start(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Open(TestGuardDevice ROOT\TESTGUARD\0000 ) Try count 1
WDTF_SUPPORT : - WaitForMinutes : 1
WDTF_SIMPLE_IO : - PerformIO(TestGuardDevice ROOT\TESTGUARD\0000 ) Count 1
WDTF_SIMPLEIO_STRESS : - Stop(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Close(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_TEST : Starting PNPTryStopDeviceAndFailRestart test [3 of 3]
WDTF_TARGETS : - GetInterfacesIfExist("PNP")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TEST : Querying for devices to test I/O on during the test
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetRelations("below-or-self/","IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("SimpleIOStressEx")
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 no Simple IO Interface was found.
WDTF_SIMPLE_IO_ANY : - The Generic Any SimpleIO plugin will be used to generate IO for Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 WDTF will use the ANY Simple IO Interface.
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLEIO_STRESS : - Start(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Open(TestGuardDevice ROOT\TESTGUARD\0000 ) Try count 1
WDTF_SUPPORT : - WaitForMinutes : 1
WDTF_SIMPLE_IO : - PerformIO(TestGuardDevice ROOT\TESTGUARD\0000 ) Count 1
WDTF_SIMPLEIO_STRESS : - Stop(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Close(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_TARGETS : - GetInterfacesIfExist("ConcurrentIO")
WDTF_PNP : - EDTTryStopDeviceFailRestart()
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Waiting for Target: TestGuardDevice ROOT\TESTGUARD\0000 to rebalance the test will try again in 5 seconds.
WDTF_PNP : Failed to open the EDT device m_EDTDevice.OpenDevice is returning error:-2147024894 for Target:TestGuardDevice ROOT\TESTGUARD\0000 .
WDTF_PNP : - RestartDevice()
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
Error: WDTF_PNP : Result: Error : PNP_VetoLegacyDevice : Instance Path: ROOT\TESTGUARD\0000.
WDTF_PNP : For Target: TestGuardDevice ROOT\TESTGUARD\0000 we will Rescan now.
WDTF_PNP : - RescanParentDevice() : ( get status count: 1 )
WDTF_PNP : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SUPPORT : - WaitForSeconds : 15
WDTF_TARGETS : - GetInterfacesIfExist("ConcurrentIO")
WDTF_TEST : Querying for devices to test I/O on during the test
WDTF_TARGETS : - Query("IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetRelations("below-or-self/","IsDevice AND (DriverBinaryNames!='i8042prt.sys') AND (Class!=hdc) AND (Class!=scsiadapter) AND (DsmDevice!=TRUE) AND (DeviceID='ROOT\TESTGUARD\0000')")
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_TARGETS : - GetInterfacesIfExist("SimpleIOStressEx")
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 no Simple IO Interface was found.
WDTF_SIMPLE_IO_ANY : - The Generic Any SimpleIO plugin will be used to generate IO for Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLE_IO : - For Target:TestGuardDevice ROOT\TESTGUARD\0000 WDTF will use the ANY Simple IO Interface.
WDTF_TARGETS : Target: TestGuardDevice ROOT\TESTGUARD\0000
WDTF_SIMPLEIO_STRESS : - Start(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Open(TestGuardDevice ROOT\TESTGUARD\0000 ) Try count 1
WDTF_SUPPORT : - WaitForMinutes : 1
WDTF_SIMPLE_IO : - PerformIO(TestGuardDevice ROOT\TESTGUARD\0000 ) Count 1
WDTF_SIMPLEIO_STRESS : - Stop(TestGuardDevice ROOT\TESTGUARD\0000 )
WDTF_SIMPLE_IO : - Close(TestGuardDevice ROOT\TESTGUARD\0000 )
EndGroup: PNPDTest::PNPTryStopDeviceAndFailRestart [Failed]
Telemetry: Unregistering Trace Logging.
Summary of Non-passing Tests:
PNPDTest::PNPTryStopDeviceAndFailRestart [Failed]
Summary: Total=1, Passed=0, Failed=1, Blocked=0, Not Run=0, Skipped=0
最可能的原因是驱动程序没有响应
IRP_MN_REMOVE_DEVICE
IO 请求。所以解决方案应该是这样的:
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{
UNREFERENCED_PARAMETER(RegistryPath);
PDEVICE_OBJECT DeviceObject;
UNICODE_STRING UDeviceName = RTL_CONSTANT_STRING(DeviceName);
UNICODE_STRING USymlink = RTL_CONSTANT_STRING(Symlink);
NTSTATUS Status;
DriverObject->DriverUnload = OnDriverUnload;
DriverObject->MajorFunction[IRP_MJ_CREATE] = OnDriverCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = OnDriverCloseCleanup;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = OnDriverCloseCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = OnDriverDispatch;
// add the needed event here:
DriverObject->MajorFunction[IRP_MN_REMOVE_DEVICE] = OnDriverRemove;
另外,在您的情况下,
OpenDevice
,可能是IRP_MJ_DEVICE_CONTROL
中发生了一些错误