Not every KSDATAFORMAT is a KSDATAFORMAT_WAVEFORMATEX. You can tell whether a
given KSDATAFORMAT is a KSDATAFORMAT_WAVEFORMATEX by looking at the FormatSize
and Specifier fields.
A KSDATAFORMAT_WAVEFORMATEX will have Specifier ==
KSDATAFORMAT_SPECIFIER_WAVEFORMATEX and a FormatSize >=
sizeof(KSDATAFORMAT_WAVEFORMATEX).
The KSDATAFORMAT in your example has FormatSize == sizeof(KSDATAFORMAT), so it
is not a KSDATAFORMAT_WAVEFORMATEX.
For a sample of how to implement KSPROPERTY_PIN_PROPOSEDATAFORMAT see
CMiniportWaveRT::PropertyHandlerProposedFormat in
https://github.com/Microsoft/Windows-driver-samples/blob/master/audio/sysvad/EndpointsCommon/minwavert.cpp
This just returns STATUS_BUFFER_TOO_SMALL (and reports a min size) for
KSDATAFORMAT inputs which are not KSDATAFORMAT_WAVEFORMATEXes.
________________________________
From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> on
behalf of reg.wad@xxxxxxxxxxxxxx <reg.wad@xxxxxxxxxxxxxx>
Sent: Tuesday, December 5, 2017 2:37:08 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] KSPROPERTY_PIN_PROPOSEDATAFORMAT/SET is called with
invalid data
Hello!
Windows 10 (16299, 15063 and maybe earlier versions) issues several
KSPROPERTY_PIN_PROPOSEDATAFORMAT/SET property requests after IRP sink
interface arrival. Some of these requests contain obviously invalid
data.
Watching for KSDATAFORMAT contents, I see that the same data are
passed in consecutive requests, except varying SubFormat field:
Total data size (Req->ValueSize in PCPROPERTY_REQUEST): 0x40
KSDATAFORMAT:
FormatSize: 0x40
Flags: 0
SampleSize: 0x3a281610
Reserved: 0x7ff8
MajorFormat: KSDATAFORMAT_TYPE_AUDIO
SubFormat: KSDATAFORMAT_SUBTYPE_PCM,
KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL or
KSDATAFORMAT_SUBTYPE_IEC61937_WMA_PRO
Specifier: KSDATAFORMAT_SPECIFIER_WAVEFORMATEX
Assosicated WAVEFORMATEX structure is filled with invalid data too:
wFormatTag: 0x4960
nChannels: 0x8c13
nSamplesPerSec: 0x11cf51ad
nAvgBytesPerSec: 0xf8948a87
nBlockAlign: 0xc101
wBitsPerSample: 0
cbSize: 0xe
Such WAVEFORMATEX data are equal to KSIDENTIFIER filled with
KSPROPSETID_Pin/KSPROPERTY_PIN_PROPOSEDATAFORMAT.
I have attached WinDbg Watch window screenshots if they won't
be stripped by the mailing list server.
Are such property requests meaningful, or they are ill-formed?
Regards,
Eugene