我正在尝试编写一个kmdf驱动程序来定位自定义PCIe板。在遵循Microsoft提供的默认项目时,我对.inf文件进行了一些小的更改,主要是更改字符串的名称并提供PCIe板的硬件ID。
部署驱动程序可以正常工作。驱动程序安装并显示在设备管理器上,但它表示它未正确安装或可能已损坏。
在调试时,我看到WdfDriverCreate失败,错误为0xC000009A,这意味着资源不足。
作为参考,这是kmdf模板项目为您生成的生成代码,这是我目前正在运行的代码:
NTSTATUS
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
WDF_DRIVER_CONFIG config;
NTSTATUS status;
WDF_OBJECT_ATTRIBUTES attributes;
//
// Initialize WPP Tracing
//
WPP_INIT_TRACING( DriverObject, RegistryPath );
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
//
// Register a cleanup callback so that we can call WPP_CLEANUP when
// the framework driver object is deleted during driver unload.
//
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, DEVICE_CONTEXT);
attributes.EvtCleanupCallback = CIPDriverEvtDriverContextCleanup;
WDF_DRIVER_CONFIG_INIT(&config,
CIPDriverEvtDeviceAdd
);
KdPrint(("CIP: Driver Entry\n"));
status = WdfDriverCreate(DriverObject,
RegistryPath,
&attributes,
&config,
WDF_NO_HANDLE
);
if (!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER, "WdfDriverCreate failed %!STATUS!", status);
KdPrint(("CIP: WdfDriverCreate failed with status - 0x%x\n", status));
WPP_CLEANUP(DriverObject);
return status;
}
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Exit");
return status;
}
我的第一个问题是,导致这种情况的原因是什么?
我试图通过运行
引发错误后转储日志!wdfkd.wdflogdump mydriver.sys
但它永远不会奏效。我确保所有符号路径都正确加载,如下所示
fffff880`05fdd000 fffff880`05fe6000 CIPDriver (private pdb symbols) C:\Users\jimmyjoebobby\Documents\Visual Studio 2013\Projects\CIPDriver\x64\Win7Debug\CIPDriver.pdb
22: kd> lm m wdf*
start end module name
fffff880`00e5e000 fffff880`00f20000 Wdf01000 (pdb symbols) c:\winsymbols\Wdf01000.pdb\03FC6AA4329F4372BE924775887225632\Wdf01000.pdb
fffff880`00f20000 fffff880`00f30000 WDFLDR (pdb symbols) c:\winsymbols\wdfldr.pdb\9674B20D2E5B4E7AA2DE143F642A176E2\wdfldr.pdb
“CIPDriver”是我的司机。
在运行dump命令时,这是输出:
22: kd> !wdfkd.wdflogdump CIPDriver.sys
Trace searchpath is:
Trace format prefix is: %7!u!: %!FUNC! -
TMF file used for formatting log is: C:\WinDDK\7600.16385.1\tools\tracing\amd64\wdf01000.tmf
Log at fffffa80356232f8
Gather log: Please wait, this may take a moment (reading 0 bytes).
% read so far ...
warn: The log could not be accessed
hint: Are the symbols the WDF library available?
hint: The log is inaccessable after driver unload.
.sympath的输出
22: kd> .sympath
Symbol search path is: C:\Users\jimmyjoebobby\Documents\Visual Studio 2013\Projects\CIPDriver\Win7Debug;C:\winsymbols
Expanded Symbol search path is: c:\users\jimmyjoebobby\documents\visual studio 2013\projects\cipdriver\win7debug;c:\winsymbols
其中C:\ winsymbols是我通过遵循指南获得的微软符号的缓存:https://msdn.microsoft.com/en-us/library/windows/hardware/ff558829(v=vs.85).aspx
我的第二个问题是,如何正确设置调试器以转储日志?
由于
答案 0 :(得分:1)
我不太明白为什么这会有所帮助,但如果我在
下关闭了KMDF验证程序[DriverName] Package -> Properties -> Configuration Properties -> Driver Install -> KMDF Verifier -> Enable KMDF Verifier
部署驱动程序,它的工作原理。如果我打开它,它就会失败。我部署了我的驱动程序几次打开和关闭该选项,它一直在启动时失败。
我发布了这个问题以及我的发现。也许有人可以回答为什么会这样:https://www.osronline.com/showthread.cfm?link=277793