00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "stdafx.h"
00023 #include "MacrovisionKicker.h"
00024
00025
00026
00027
00028
00029 CMacrovisionKicker::CMacrovisionKicker(const TCHAR* pName, LPUNKNOWN pUnk)
00030 : CUnknown(pName, pUnk)
00031 {
00032 }
00033
00034 CMacrovisionKicker::~CMacrovisionKicker()
00035 {
00036 }
00037
00038 void CMacrovisionKicker::SetInner(CComPtr<IUnknown> pUnk)
00039 {
00040 m_pInner = pUnk;
00041 }
00042
00043 STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** ppv)
00044 {
00045 if(riid == __uuidof(IUnknown))
00046 return __super::NonDelegatingQueryInterface(riid, ppv);
00047 if(riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner))
00048 return GetInterface((IKsPropertySet*)this, ppv);
00049
00050 HRESULT hr = m_pInner ? m_pInner->QueryInterface(riid, ppv) : E_NOINTERFACE;
00051
00052 return SUCCEEDED(hr) ? hr : __super::NonDelegatingQueryInterface(riid, ppv);
00053 }
00054
00055
00056
00057 STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
00058 {
00059 if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
00060 {
00061 if(PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
00062 )
00063 {
00064 TRACE(_T("Oops, no-no-no, no macrovision please\n"));
00065 return S_OK;
00066 }
00067
00068 return pKsPS->Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
00069 }
00070
00071 return E_UNEXPECTED;
00072 }
00073
00074 STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
00075 {
00076 if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
00077 {
00078 return pKsPS->Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
00079 }
00080
00081 return E_UNEXPECTED;
00082 }
00083
00084 STDMETHODIMP CMacrovisionKicker::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
00085 {
00086 if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
00087 {
00088 return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
00089 }
00090
00091 return E_UNEXPECTED;
00092 }