1

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"
Community
  • 1
  • 1
Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236

1 Answers1

2

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

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • How can it be registry virtualization on Windows XP? – Georg Fritzsche Dec 26 '09 at 16:28
  • Actually, you solved it for me by making me think again about why it was mapped to HKCU - our VS2005 fallback for `AtlSetPerUserRegistration()` wasn't only activated for the contained com servers registration. Ouch. – Georg Fritzsche Dec 26 '09 at 16:51