IGraphBuilder::RenderFile() failing with V

2019-06-01 08:23发布

Continuing investigation on a embedded WindowsMediaPlayer problem, i am trying to do simple file playback via a DirectShow in-process server:

::CoInitializeEx(0, COINIT_MULTITHREADED);

CComPtr<IGraphBuilder> spGraph;
spGraph.CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC_SERVER);
CComQIPtr<IMediaControl> spMediaControl(spGraph);

// ... later:
spGraph->RenderFile(L"c:\\foo.wav", 0); // fails with VFW_E_BAD_KEY
spMediaControl->Run();

Interestingly, this runs fine on both systems i tested on (Windows XP 32 & x64) when doing it in a stand-alone application.
It however fails in my real use-case, a NPAPI based browser plugin - i.e. a DLL loaded into Firefox/Chrome/Opera.

Does anyone have an idea what could be going wrong here?
Or ideas on what else to try?

Update: also asked on the Microsoft forums.

Update2:
IGraphBuilder::AddSourceFilter(path,path,&base) already fails with the following registry calls (as seen in process monitor):

"RegOpenKey","HKCU\Software\Classes\c","NAME NOT FOUND","Desired Access: Query Value, Maximum Allowed" 
"RegOpenKey","HKCU\Software\Classes\Media Type\Extensions\.wav","NAME NOT FOUND","Desired Access: Read" 
"RegOpenKey","HKCU\Software\Classes\Media Type","NAME NOT FOUND","Desired Access: Read"

1条回答
我只想做你的唯一
2楼-- · 2019-06-01 08:35

It is reading the key from the wrong hive. It should use HKLM, not HKCU. The most likely reason for this is registry virtualization.

查看更多
登录 后发表回答