1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2008-2009 |
---|
3 | // Created by Roman Ryltsov roman@alax.info |
---|
4 | // |
---|
5 | // $Id: AddRemoveHook.h 95 2012-08-17 17:21:13Z roman $ |
---|
6 | |
---|
7 | #pragma once |
---|
8 | |
---|
9 | #include "Common.h" |
---|
10 | #include "BdaHooks_i.h" |
---|
11 | |
---|
12 | //////////////////////////////////////////////////////////// |
---|
13 | // CAddRemoveHook |
---|
14 | |
---|
15 | class ATL_NO_VTABLE CAddRemoveHook : |
---|
16 | public CComObjectRootEx<CComMultiThreadModel>, |
---|
17 | public CComCoClass<CAddRemoveHook, &CLSID_AddRemoveHook>, |
---|
18 | public IDispatchImpl<IAddRemoveHook>, |
---|
19 | public IFilterGraphAddRemoveHook |
---|
20 | { |
---|
21 | public: |
---|
22 | enum { IDR = IDR_ADDREMOVEHOOK }; |
---|
23 | |
---|
24 | //DECLARE_REGISTRY_RESOURCEID(IDR) |
---|
25 | |
---|
26 | DECLARE_PROTECT_FINAL_CONSTRUCT() |
---|
27 | |
---|
28 | //DECLARE_GET_CONTROLLING_UNKNOWN() |
---|
29 | |
---|
30 | //DECLARE_QI_TRACE(CConnectHook) |
---|
31 | |
---|
32 | BEGIN_COM_MAP(CAddRemoveHook) |
---|
33 | COM_INTERFACE_ENTRY(IAddRemoveHook) |
---|
34 | COM_INTERFACE_ENTRY(IDispatch) |
---|
35 | COM_INTERFACE_ENTRY(IFilterGraphAddRemoveHook) |
---|
36 | END_COM_MAP() |
---|
37 | |
---|
38 | public: |
---|
39 | // CAddRemoveHook |
---|
40 | static CString GetObjectFriendlyName() |
---|
41 | { |
---|
42 | return _StringHelper::GetLine(IDR, 2); |
---|
43 | } |
---|
44 | static HRESULT WINAPI UpdateRegistry(BOOL bRegister) throw() |
---|
45 | { |
---|
46 | _Z2(atlTraceRegistrar, 2, _T("bRegister %d\n"), bRegister); |
---|
47 | _ATLTRY |
---|
48 | { |
---|
49 | UpdateRegistryFromResource<CAddRemoveHook>(bRegister); |
---|
50 | } |
---|
51 | _ATLCATCH(Exception) |
---|
52 | { |
---|
53 | _C(Exception); |
---|
54 | } |
---|
55 | return S_OK; |
---|
56 | } |
---|
57 | CAddRemoveHook() throw() |
---|
58 | { |
---|
59 | _Z4(atlTraceRefcount, 4, _T("this 0x%08x\n"), this); |
---|
60 | } |
---|
61 | ~CAddRemoveHook() throw() |
---|
62 | { |
---|
63 | _Z4(atlTraceRefcount, 4, _T("this 0x%08x\n"), this); |
---|
64 | } |
---|
65 | |
---|
66 | // IAddRemoveHook |
---|
67 | |
---|
68 | // IFilterGraphAddRemoveHook |
---|
69 | STDMETHOD(OnAddFilter)(ISpy* pSpy, IUnknown* pBaseFilterUnknown, LPCWSTR pszName, BOOL* pbDefault) throw() |
---|
70 | { |
---|
71 | _Z4(atlTraceCOM, 4, _T("...\n")); |
---|
72 | pSpy; pBaseFilterUnknown; pszName; pbDefault; |
---|
73 | return S_OK; |
---|
74 | } |
---|
75 | STDMETHOD(OnRemoveFilter)(ISpy* pSpy, IUnknown* pBaseFilterUnknown, BOOL* pbDefault) throw() |
---|
76 | { |
---|
77 | _Z4(atlTraceCOM, 4, _T("...\n")); |
---|
78 | _ATLTRY |
---|
79 | { |
---|
80 | pSpy; pBaseFilterUnknown; pbDefault; |
---|
81 | CComQIPtr<IScanningTuner> pScanningTuner = pBaseFilterUnknown; |
---|
82 | if(pScanningTuner) |
---|
83 | TraceScanningTuner(pScanningTuner); |
---|
84 | } |
---|
85 | _ATLCATCH(Exception) |
---|
86 | { |
---|
87 | _C(Exception); |
---|
88 | } |
---|
89 | return S_OK; |
---|
90 | } |
---|
91 | STDMETHOD(OnAddSourceFilter)(ISpy* pSpy, LPCWSTR pszFileName, LPCWSTR pszFilterName, IUnknown** ppBaseFilterUnknown, BOOL* pbDefault) throw() |
---|
92 | { |
---|
93 | _Z4(atlTraceCOM, 4, _T("...\n")); |
---|
94 | pSpy; pszFileName; pszFilterName; ppBaseFilterUnknown; pbDefault; |
---|
95 | return S_OK; |
---|
96 | } |
---|
97 | STDMETHOD(OnAddSourceFilterForMoniker)(ISpy* pSpy, IUnknown* pMonikerUnknown, IUnknown* pBindCtxUnknown, LPCWSTR pszFilterName, IUnknown** ppBaseFilterUnknown, BOOL* pbDefault) throw() |
---|
98 | { |
---|
99 | _Z4(atlTraceCOM, 4, _T("...\n")); |
---|
100 | pSpy; pMonikerUnknown; pBindCtxUnknown; pszFilterName; ppBaseFilterUnknown; pbDefault; |
---|
101 | return S_OK; |
---|
102 | } |
---|
103 | }; |
---|
104 | |
---|
105 | OBJECT_ENTRY_AUTO(__uuidof(AddRemoveHook), CAddRemoveHook) |
---|