I try to learn about Windows WDI Driver Sample use Windows-driver-samples-master\network\wlan\WDI in github.
I wrote my code step by step through the microsoft tutorial and sample code.
MiniportInitializeEx operation in tutorial
After MiniportWdiOpenAdapter, the Microsoft component sends the following tasks/properties/calls to the IHV miniport.
a. Call MiniportWdiTalTxRxInitialize to initialize the data path and exchange handlers.
b. Call OID_WDI_GET_ADAPTER_CAPABILITIES to get the adapter’s capabilities.
c. Call OID_WDI_SET_ADAPTER_CONFIGURATION to configure the adapter.
d. Call OID_WDI_TASK_SET_RADIO_STATE to set the initial radio state if it is not already in the expected state.
e. Call MiniportWdiTalTxRxStart to set up the data path.
f. Call OID_WDI_TASK_CREATE_PORT to create the initial port.If an intermediate operation fails, the Microsoft component undoes the previous operations and fails the miniport bring up.
MiniportInitializeEx operation
I failed after step c with no idea. This is my debug function log (==> : Entry, <== : Exit)
[DriverEntry:12] ==>>
[WdiInitialize:726] ==>>
[WdiInitialize:801] <<==
[DriverEntry:25] <<==
[AllocateAdapterHandler:161] ==>>
[AllocateAdapterHandler:200] <<==
[OpenAdapterHandler:225] ==>>
[OpenAdapterHandler:232] <<==
[TalTxRxInitializeHandler:631] ==>>
[TalTxRxInitializeHandler:695] <<==
[OidRequestHandler:48] ==>>
[DbgPrintOidName:84] OID_WDI_GET_ADAPTER_CAPABILITIES
[OidRequestHandler:51] PortNumber:0
[OidRequestHandler:52] InputBufferLength: 16
[WdiOidGetAdapterCapabilities:471] ==>>
[WdiOidGetAdapterCapabilities:505] <<==
[OidRequestHandler:89] BytesWritten: 203
[OidRequestHandler:92] <<==
[OidRequestHandler:48] ==>>
[DbgPrintOidName:84] OID_WDI_SET_ADAPTER_CONFIGURATION
[OidRequestHandler:51] PortNumber:0
[OidRequestHandler:52] InputBufferLength: 47
[OidRequestHandler:89] BytesWritten: 16
[OidRequestHandler:92] <<==
[TalTxRxDeinitializeHandler:708] ==>>
[TalTxRxDeinitializeHandler:713] <<==
[CloseAdapterHandler:246] ==>>
[CloseAdapterHandler:252] <<==
[FreeAdapterHandler:211] ==>>
[FreeAdapterHandler:212] <<==
[UnloadHandler:27] ==>>
[UnloadHandler:33] <<==
We can see the Microsoft component undoes the previous operations after OID_WDI_SET_ADAPTER_CONFIGURATION.
I have no idea about the step failed. Does anyone can point your mind?
DatapathAttributes is key although it is optional settings.
pAdapterCapsParams->Optional.DatapathAttributes_IsPresent = TRUE;