WdfDriverCreate STATUS_INFO_LENGTH_MISMATCH

Hi,
After building a skeleton KWDF PNP driver, I encountered an error in driver entry in which WdfDriverCreate returned STATUS_INFO_LENGTH_MISMATCH(0xc0000004).
Checking the code, I saw that I simply gave the function an uninitialized WDF_DRIVER_CONFIG object. Switching the object to WDF_NO_OBJECT_ATTRIBUTES solved the problem.
My only wonder is why prefast didn’t catch it beforehand?

Thanks,
Eran.

BTW
My DDK build version is 3790.1830

WDF_NO_OBJECT_ATTRIBUTES is a mnemonic for NULL. Are you passing WDF_NO_OBJECT_ATTRIBUTES for the WDF_DRIVER_CONFIG or the WDF_OBJECT_ATTRIBUTES parameter? I would guess the attributes parameter since if you passed NULL for the config, you would get a different error.

Prefast didn’t catch it b/c prefast doesn’t know about KMDF patterns and the requirement to set the Size field first.

d

My mistake, I didn’t initialize the ATTRIBUTE object.
Anyway, I thought you guys made some kind of magic/vodoo that prefast will understand KWDF parameter function semantics.
Thanks,
Eran.

the additional KMDF voodoo is there for the version of PFD that comes with the WDK. I don’t think this new version of PFD knows about the requirement to INIT the structure though.

d

Thanks,
Just as a side note. I started using KWDF by writing a skeleton driver, and I still cannot believe that with 30 lines of code I have a PNP driver that can be loaded/unloaded with no problem.
You guys did an excellent job!

Eran.