Why MFTEnumEx() corrupts the stack?

。_饼干妹妹 提交于 2019-12-13 04:27:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!