xxxxx@hotmail.com wrote:
When I call myFilter->QueryInterface(__uuidof(CaptureInterface),(void**)m_ppIface), the HRESULT = 0x80004002 which means that the interface is not supported.
Also, in Graphedit I have ?the requested propertypage cannot be displayed?
Can you perhaps explain ?how? the capturefilter ?knows? which COM-objects to load on initialization?
Your driver exposes a table of property sets in its KSPIN_DESCRIPTOR or
KSFILTER_DESCRIPTOR. When you create your filter factory, AVStream adds
those to the standard property sets that it handles. When Ksproxy
starts up, it enumerates the list of supported properties in the KS
driver it is handling. When it gets to a property set it doesn’t
already know, it checks the MediaInterfaces tree in the registry to see
if it is listed. If it is listed, it uses the CLSID to load the plugin
and initializes it. Then, when someone sends a QueryInterface to
ksproxy, it checks the list of interfaces that are built in, and if it
isn’t immediately found, it passes the IID on to all of the loaded plugins.
Maybe there is something more to it than just the registry-entries because that only seem to work when both GUIDs are the same. (It is not clear to my why this regentry is even needed, when the GUID of the property-set is the same as for the property-interface.)
I’ve often wondered the same thing. I’ve always assumed it was because
the GUIDs didn’t have to match.
What is also not clear is where the 0x80004002-error comes from. Is that the captureFilter that ?says? that it doesn?t support this interface? In other words: which implementation is called when I call myFilter->QueryInterface(__uuidof(CaptureInterface),(void**)m_ppIface)?
The IBaseFilter instance you have points to ksproxy.ax (well,
technically it is kswdmcap.ax, but the effect is the same). That is
your driver’s agent in user mode. It is ksproxy that tracks the
interfaces that map to the property sets advertised by your driver.
User-friendliness is one: by providing a more user (or developer) friendly interface to configure the captureFilter (=propertyInterface). The API of this interface is much more high level. The deduction of the device-specific set of properties is done under the hood based on the user input. So this propertyInterface is not simply a passthrough of values such as the Max Paklin example. There is a whole bunch of stuff going on in between receiving the use rinput and configuring the actual capture filter. The property-page reflects the API of this propertyInterface.
I thought it was confusing to have the same GUID for both the propertySet and propertyInterface, because they serve different purposes.
Well, that’s not supposed to be the case. The property interface is
supposed to be the COM-friendly face of your property set. But that’s a
rather delicate philosophical point.
Secondly, the GUID of the propertyInterface is something we ship together with the captureFiter. We don?t want to ship the GUID of the propertySet because we don?t want users to manipulate the propertySet directly (without using the propertyInterface). We don?t want that because setting the propertySet with unvalid values can result in a system-crash (BSOD and such).
I have two comments about this.
First, you can’t prevent this. Your COM interface is just a friendly
wrapper. It’s another way in, but it’s not the only way in. It doesn’t
prevent direct access. Any user can go enumerate the property sets you
support (ksstudio does that in a nice tabulated way). From that
enumeration, they can get your property set GUID. Once they have the
GUID, they can call IKsControl->KsProperty to talk to the driver
directly, bypassing your plugin.
Now, are users likely to do that? No, and the answer is “no” whether
the two GUIDs are the same or different.
Second, if a non-privileged user can send property requests to your
driver that cause a BSOD, then your driver is poorly designed. You need
to have the protections in the driver, not in the proxy plugin. Part of
the WHQL testing sends random property requests to your driver, to see
if it survives.
It is probably quite possible to figure out the GUID of this propertyset even if we don?t provide it (by inspecting the registry), but we don?t want to encourage or support the usage of the propertyset to configure the capture filter.
So, I hope that gives you some better insight in why I prefer separate GUID for the propertyset and the propertyInterface.
Not yet, no. I don’t see that you’ve gained anything.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.