KMDF Verifier fails call to WdfDriverCreate() with 0xC000009A

I know others have run into this problem as well. But, I’ve read over previous discussions on this topic and I still cannot determine what the fix for my issue is. So, I thought I would ask the experts here. The following code works during DriverEntry of my WDF driver with no problems.

Use_decl_annotations
NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath)
{
NTSTATUS Status;
WDF_DRIVER_CONFIG LDTPITDrvConfig;
WDF_OBJECT_ATTRIBUTES LDTPITDrvAttributes, LDTPITRegistryPathAttributes;
WDFDRIVER LDTPITDriver;
PLDTPIT_DRIVER_EXTENSION pDriverExt;

#if DBG
	//
	// Initialize DbgPrintEx stuff for LDTPIT driver
	//
	sprintf_s(DebugPrintHeader, sizeof(DebugPrintHeader), "%s ", VER_INTERNALNAME_STR);
	strcat_s(DebugPrintHeader, sizeof(DebugPrintHeader), "(%x) ");
	DebugLevel = LD_DBGMSG_RESOURCES | LD_DBGMSG_DISPATCH;
#endif /* DBG */

//
// Initialize the driver configuration structure
//
WDF_DRIVER_CONFIG_INIT(&LDTPITDrvConfig, LDTPITAddDevice);
LDTPITDrvConfig.EvtDriverUnload = LDTPITDriverUnload;
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&LDTPITDrvAttributes, LDTPIT_DRIVER_EXTENSION);
LDTPITDrvAttributes.ExecutionLevel = WdfExecutionLevelPassive;
LDTPITDrvAttributes.EvtCleanupCallback = LDTPITDriverCleanupCallback;

//
// Finally, create the driver object
//
Status = WdfDriverCreate(pDriverObject, pRegistryPath, &LDTPITDrvAttributes, &LDTPITDrvConfig, 
	&LDTPITDriver);
if (!NT_SUCCESS(Status))
{
	goto end;
}

But, when KMDF Verifier is enabled. I get the following Status. Status = 0xC000009A

I’ve enabled “Verbose Logging” on my driver and the following information shown is immediately after the call to WdfDriverCreate() is executed.

!wdfkd.wdflogdump ldtpit.sys
<---------------------------------------------- Verbose Information ----------------------------------------------------->
Trace searchpath is:

Trace format prefix is: %7!u!: %!FUNC! -
Trying to extract TMF information from - c:\users\joe moriarty\symbols\Wdf01000.pdb\11E877268FAE7196F0AA5A416B1A36E01\Wdf01000.pdb
Gather log: Please wait, this may take a moment (reading 4024 bytes).
% read so far … 10, 100
There are 10 log entries
— start of log —
1: FxIFRStart - FxIFR logging started
2: FxInitialize - Initialize globals for \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\LDTPIT
3: FxPoolInitialize - Initializing Pool 0xFFFFE48AD89AA138, Tracking 1
4: FxPoolAllocator - Allocation Fail Count exceeded
5: FxVerifierLock::AllocateThreadTable - No Memory to allocate thread table
6: LockVerifierSection - Increment Lock counter (1) for Verifier Paged Memory from \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\LDTPIT from driver globals FFFFE48AD89AA0D0
7: FxPoolAllocator - Allocation Fail Count exceeded
8: FxPoolDestroy - Destroying Pool 0xFFFFE48AD89AA138
9: FxPoolDump - FxPoolDump: NonPagedBytes 0, PagedBytes 0, NonPagedAllocations 0, PagedAllocations 0,PeakNonPagedBytes 0, PeakPagedBytes 0,FxPoolDump: PeakNonPagedAllocations 0, PeakPagedAllocations 0
10: UnlockVerifierSection - Decrement UnLock counter (0) for Verifier Paged Memory with driver globals FFFFE48AD89AA0D0
---- end of log ----

!wdfkd.wdfdriverinfo ldtpit.sys
<------------------------------------------ WDF DriverInfo ------------------------------------------------------------------------>

Default driver image name: ldtpit
WDF library image name:
FxDriverGlobals 0xffffe48ad89aa0d0
WdfBindInfo 0xfffff800bf987090
Version v1.15
Library module 0xffffe48ad5e4e1e0
ServiceName \Registry\Machine\System\CurrentControlSet\Services\Wdf01000
ImageName Wdf01000

Driver Handles is NULL

Any Ideas?

Thanks In Advance for the Help,
Joe

You’ve turned on some low resource simulation option and so the framework is failing memory allocations. Source code for the framework is online:

https://github.com/Microsoft/Windows-Driver-Frameworks/blob/master/src/framework/shared/object/wdfpool.cpp#L155

Check your KMDF Verifier settings.

This is the current settings. I am not sure which setting corresponds to

(FxDriverGlobals->WdfVerifierAllocateFailCount != 0xFFFFFFFF))

I’m guessing FAIL Memory Allocations setting needs to be 0xFFFFFFFF to get by low resource simulation. Am I reading the code in wdfpool.cpp right?

Also, I currently have the default settings turned on for Driver Verifier as well. Is this okay?

Joe

Driver Verifier has “Pool tracking” = Enabled.

I’m think this line of code in wdfpool.ccp is causing the problem.

if (FxDriverGlobals->IsPoolTrackingOn()) {

All I have to do is set “Pool tracking” = Disabled in Driver Verifier and this will get around the KMDF Verifier problem I am running into here. Right?

Joe

Is VerifierAllocateFailCount set under your driver’s service\Parameters\Wdf key?

Here is what the WDF settings are when KMDF Verifier fails WdfDriverCreate().

I removed the VerifierAllocateFailCount from the registry and the call to WdfDriverCreate() works again. Thanks for the helpful hint. This now leads me to my next question. How do I know when KMDFVerifier is done? Or, is this like DriverVerifier where you put the driver through stress and see if it triggers a BSOD.

Joe

How do I know when KMDFVerifier is done? Or, is this like DriverVerifier where you put the driver through stress and see if it triggers a BSOD.

Yes, it’s like DriverVerifier. KMDF Verifier doesn’t TEST your driver, but rather monitors what your driver does to ensure that it’s correct… and it also injects some OTHER things (throws a few curve balls… if baseball metaphor works for you) as your driver does its normal work to see if your driver handles these properly.

Peter