DispatchIoctl Received a Write IRP,GetMapping return STATUS_NOT_FOUND

Hello!
When application uses DSound to play with my driver,everything goes
well.But when application uses MME(WaveOutXXX and WaveInXXX) to play sound
with driver directly,under stress test for long ,this situation happened.
DispatchIoctl() function received a “write” IRP,and then PcDispatchIrp
sent it to port driver,port driver called mini driver’s
MappingAvailable, Then called port driver’s GetMapping as usual ,but got a
“STATUS_NOT_FOUND” message!
DDK said : A mapping is not immediately available, but the port driver
will call IMiniportWavePciStream::MappingAvailable when a mapping does
become available.

I’m sure that data had been sent to driver because DispathIoctl received a
“write” IRP,why it can’t get data immediately sometimes?
I just retry calling GetMapping some times when this happen, a new mapping
comes.Is this method exactness ?

Best Regards!

Simba

GetMapping will return this status if there are no more map registers available when it tried to map the buffer in the Stream Write IOCTL. If it returns this status, the port driver is true to its word, when registers become available, it gets called back by the OS, and it will then tell your miniport that a mapping is available.

Do not attempt to retry it yourself- just wait for the callback. Such retries at best waste cycles and at worst may result in breakage.