Windows WDF PCIe-SD Host Controller Driver Analysis
Current Status Analysis
Based on the dumpfile information:
1. Driver Stack Structure - Correct
Device stack is properly established: partmgr → disk → sdhcstor
Upper layer device (disk.sys) successfully starts and attaches to your driver
ServiceName is “disk”, DeviceInst shows correct device path
2. Critical Issue: ExtensionFlags Inconsistency
Device object ffffc701663ddc80 (Upper device):
⚠️ ExtensionFlags = 0x0000000000 (Highlighted in orange - THIS IS THE PROBLEM)
This device object is missing necessary extension flags
Device object ffffc70162a1aa0 (Driver object):
✓ ExtensionFlags = 0x00000800 (DOE_DEFAULT_SD_PRESENT)
This flag indicates SD card present - this is correct
3. BSOD Root Cause Analysis
ExtensionFlags being 0 indicates:
Device extension object may not be properly initialized
I/O buffer management related extension information is missing
Likely missing proper setup during IRP_MJ_CREATE or device creation
Solution Correctness Assessment
✓ Correct Aspects:
I/O Queue Implementation - Sequential handling of Read/Write requests is correct
Driver Stack Architecture - Functioning as port driver below disk.sys is standard architecture
Device Attachment - Upper device successfully attaching indicates AddDevice is fundamentally correct
Areas Requiring Correction:
- Device Extension Object Initialization
1 | // Check your EvtDeviceAdd or device creation code |
- ExtensionFlags Configuration
Verify proper call to WdfDeviceInitSetDeviceType()
Ensure device characteristics flags are correctly set:
FILE_AUTOGENERATED_DEVICE_NAME
FILE_DEVICE_SECURE_OPEN
FILE_PORTABLE_DEVICE
- I/O Buffer Management Critical Points
1 | // Set correct buffer method during device initialization |
Recommended Debugging Steps
- Verify Device Extension Allocation
Confirm DEVICE_CONTEXT structure is properly allocated and initialized
Use !wdfkd.wdfdevice command to inspect WDF device object state
- Add Tracing
1 | // Add DbgPrint or WPP tracing at critical points: |
- Validate DMA/Buffer Operations
Check if DMA Enabler is properly created (if using DMA)
Verify MDL (Memory Descriptor List) handling
Ensure all buffer pointers are properly locked and mapped before use
- Inspect IRP Handling
1 | // Ensure proper handling of these IRPs during mount: |
Specific Code Areas to Review
Device Initialization (Priority #1)
1 | NTSTATUS |
Buffer Handling in I/O Queue
1 | VOID |
Next Steps
Immediate Action: Review Device Extension initialization code, ensure all necessary flags are set during device creation
Set Breakpoints: On all I/O request handlers before mount operation
Verify: WdfDeviceInitSetDeviceType() and related device characteristics configuration
Analyze: Specific bugcheck code and parameters from the BSOD (if complete minidump available)
Conclusion
Overall Assessment: Your architecture is fundamentally correct. The issue is concentrated in device object initialization and extension flags configuration. This is a typical detail that’s easy to overlook in WDF driver development, but critical for proper I/O buffer management.
The fact that:
Device stack builds correctly
Upper device attaches successfully
Queue shows “not busy”
…indicates the framework is mostly correct. The ExtensionFlags discrepancy is the smoking gun pointing to incomplete device initialization during the AddDevice routine.
Confidence Level: High - This is a common pattern in WDF driver issues related to mount failures and I/O buffer management.
Would you like me to review your source code to provide more specific corrections?