问题描述
继续调查,i我尝试通过DirectShow进程内服务器进行简单的文件播放:
:: CoInitializeEx(0,COINIT_MULTITHREADED);
CComPtr< IGraphBuilder> spGraph;
spGraph.CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER);
CComQIPtr spMediaControl(spGraph);
// ... later:
spGraph-> RenderFile(Lc:\\foo.wav,0); //与VFW_E_BAD_KEY失败
spMediaControl-> Run();有趣的是,在我测试的两个系统(Windows XP 32& x64)上运行的时候,这个操作都很好。
但是在我真正使用的情况下,一个基于NPAPI的浏览器插件(即加载到Firefox / Chrome / Opera中的DLL)失败。
有没有人知道这里可能出现什么问题?
或者想要尝试什么?
在。
Update2:
IGraphBuilder :: AddSourceFilter(path,path,& base)
已经失败,并发生以下注册表调用(如进程监视器中所示):
RegOpenKey \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:阅读
解决方案正在从错误的蜂巢读取密钥。它应该使用HKLM,而不是HKCU。最可能的原因是注册表虚拟化。
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"
解决方案 It is reading the key from the wrong hive. It should use HKLM, not HKCU. The most likely reason for this is registry virtualization.
这篇关于IGraphBuilder :: RenderFile()失败与VFW_E_BAD_KEY - 0x800403f2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!