BAD_POOL_CALLER (c2)
Arg1: 000000000000009b, Attempt to allocate pool with a tag of zero. This would make the pool untrackable and worse, corrupt the existing tag tables.
Arg2: 0000000000000200, Pool type
Arg3: 00000000000000d0, Size of allocation in bytes
Arg4: fffff8027275939e, Caller's address.
I checked it and sure enough the WDF is providing a null tag in Wdf01000!MxMemory::MxAllocatePoolWithTag function. Here's the full stack:
Hmm, interesting. Thanks, Tim. So now I'm wondering, where are you supposed to initialize all the WDF globals? Wouldn't doing it after the WdfDriverCreate call create a race condition in their use?
WdfDriverCreate does all of that. That IS the initialization call for KMDF, and it is mandatory. It sets up all of the globals and establishes a lookup table that allows it to map your driver objects to WDF objects.
Thanks, Tim. I was asking about initializing those WDF globals in my own driver.
Also, it's an interesting design on WDF. Somehow if I call its functions before WdfDriverCreate they seem to work and return success, for instance: WdfWaitLockCreate, WdfCollectionCreate. It's only that the driver verifier reveals an issue, also without a clear explanation why. That bug check would be quite confusing for most people to triage too.
What does that sentence even mean? You don’t have access to the WDF internal structures.
This whole discussion seems bizarre to me. The rule is, “every KMDF driver must call WdfDriverCreate before using other KMDF APIs.” End of story. This is not ambiguous. Do that, and your other concerns go away.
That bug check would be quite confusing for most people to triage too.
That bug check will not occur, because most people will have called WdfDriverCreate first, like they are supposed to.
Ok, so @Mark_Roddy , here's an example. What you're saying is that I'm guaranteed that the MyDeviceAdd callback will not start running before DriverEntry returns. Is that correct?
Or, in other words, I am guaranteed that my WdfWaitLockCreate call will execute before MyDeviceAdd.