问题
Down below you can see some dummy code for enumerating available multiplexers. On my system there is only one mux available (as expected). When I call the MFTEnumEx(), the function succeeds, but stack gets corrupted. That's why I added that 64k buffer. 16 bytes will be written at offset 16. I tried this code on two different machines with the same result (Windows 10). Can somebody explain this?
BYTE buff[ 65536 ];
HRESULT hr;
hr = CoInitialize( NULL );
ATLASSERT( SUCCEEDED( hr ) );
hr = MFStartup( MF_VERSION, MFSTARTUP_FULL );
ATLASSERT( SUCCEEDED( hr ) );
IMFActivate ** ppActivate = NULL;
UINT numActivate = 0;
hr = MFTEnumEx( MFT_CATEGORY_MULTIPLEXER,
MFT_ENUM_FLAG_SYNCMFT | MFT_ENUM_FLAG_ASYNCMFT | MFT_ENUM_FLAG_HARDWARE |
MFT_ENUM_FLAG_FIELDOFUSE | MFT_ENUM_FLAG_LOCALMFT | MFT_ENUM_FLAG_TRANSCODE_ONLY,
NULL,
NULL,
&ppActivate,
&numActivate );
来源:https://stackoverflow.com/questions/35081009/why-mftenumex-corrupts-the-stack