Iinternetprotocol and iinternetprotocolsink protocol filter of IE.

Source: Internet
Author: User

Like other MS technologies, the filter system is also a chain structure. Iinternetprotocol is responsible for data flow direction, and iinternetprotocolsink is responsible for notification direction. Both interfaces must be implemented simultaneously. When implementing the two interfaces, remember to continue to forward messages to the lower layer. Except for iinternetprotocol: Start, this should be a chain call to the framework during assembly, inform you of what the lower-level interface object is.

The last empty implement of ATL.

// Filttry. h: Declaration of the cfilttry <br/> # pragma once <br/> # include "resource. H "// Main Symbols </P> <p> # include" bohtest_ I .h "<br/> # include <urlmon. h> </P> <p> # If defined (_ win32_wce )&&! Defined (_ ce_dcom )&&! Defined (_ ce_allow_single_threaded_objects_in_mta) <br/> # error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. define _ ce_allow_single_threaded_objects_in_mta to force ATL to support creating single-thread COM Object's and allow use of it's single-threaded COM Object implementations. the threading model in your RGS file was set to 'free' as that is the only threading model supported in non DCOM Windows CE platforms. "<br/> # endif <br/> using namespace ATL; </P> <p> // cfilttry <br/> class atl_no_vtable cfilttry: <br/> Public ccomobjectrootex <ccomsinglethreadmodel>, <br/> Public ccomcoclass <cfilttry, & clsid_filttry>, <br/> Public idispatchimpl <ifilttry, & release, & release, /* wmajor = */-1,/* wminor = */-1>, <br/> Public iinternetprotocol, <br/> Public iinternetprotocolsink <br/> {<br/> Public: <br/> cfilttry () <br/>{< br/>}< br/> declare_registry_resourceid (idr_filttry) </P> <p> begin_com_map (cfilttry) <br/> com_interface_entry (ifilttry) <br/> com_interface_entry (idispatch) <br/> com_interface_entry (iinternetprotocolroot) <br/> disable (iinternetprotocol) <br/> disable (iinternetprotocolsink) <br/> end_com_map () </P> <p> Merge () <br/> ccomptr <iinternetprotocolsink> m_pprotsink; <br/> ccomqiptr <iinternetprotocol> m_pprot; <br/> hresult finalconstruct () <br/>{< br/> return s_ OK; <br/>}< br/> void finalrelease () <br/>{< br/>}< br/> Public: <br/> hresult stdmethodcalltype start (<br/>/* [in] */lpcwstr szurl, <br/>/* [in] */iinternetprotocolsink * poiprotsink, <br/>/* [in] */iinternetbindinfo * poibindinfo, <br/>/* [in] */DWORD grfpi, <br/>/* [in] */handle_ptr dwreserved) <br/>{< br/> m_pprotsink = poiprotsink; <br/> lpolestr pwzurl; <br/> ulong uelfetched; <br/> poibindinfo-> getbindstring (bindstring_url, & pwzurl, 1, & uelfetched); <br/> cstringw URL (pwzurl); <br/> atltrace (L "swfurl: % S/R/N", URL ); <br/> m_pprot = poiprotsink; <br/> return s_ OK; <br/> // return inet_e_use_default_protocolhandler; <br/>}< br/> hresult stdmethodcalltype continue (<br/>/* [in] */protocoldata * pprotocoldata) <br/>{< br/> If (m_pprot) return m_pprot-> continue (pprotocoldata); <br/> return s_ OK; <br/>}< br/> hresult stdmethodcalltype abort (<br/>/* [in] */hresult hrreason, <br/>/* [in] */DWORD dwoptions) <br/> {<br/> If (m_pprot) return m_pprot-> abort (hrreason, dwoptions ); <br/> return s_ OK; <br/>}< br/> hresult stdmethodcalltype terminate (<br/>/* [in] */DWORD dwoptions) <br/>{< br/> If (m_pprot) return m_pprot-> terminate (dwoptions); <br/> return s_ OK; <br/>}< br/> hresult stdmethodcalltype suspend (void) <br/>{< br/> If (m_pprot) return m_pprot-> suspend (); <br/> return s_ OK; <br/>}< br/> hresult stdmethodcalltype resume (void) <br/>{< br/> If (m_pprot) return m_pprot-> resume (); <br/> return s_ OK; <br/>}< br/> hresult stdmethodcalltype read (<br/>/* [length_is] [size_is] [out] [in] */void * PV, <br/>/* [in] */ulong CB, <br/>/* [out] */ulong * pcbread) <br/>{< br/> If (m_pprot) <br/>{< br/> hresult res = m_pprot-> Read (PV, CB, pcbread ); <br/> atltrace (L "readed % u/R/N", * pcbread); <br/> return res; <br/>}< br/> else <br/> {<br/> If (pcbread) * pcbread = 0; <br/> return inet_e_data_not_available; <br/>}< br/> hresult stdmethodcalltype seek (<br/>/* [in] */large_integer dlibmove, <br/>/* [in] */DWORD dworigin, <br/>/* [out] */ularge_integer * plibnewposition) <br/>{< br/> If (m_pprot) return m_pprot-> seek (dlibmove, dworigin, plibnewposition); <br/> else <br/> return inet_e_data_not_available; <br/>}< br/> hresult stdmethodcalltype lockrequest (<br/>/* [in] */DWORD dwoptions) <br/>{< br/> If (m_pprot) return m_pprot-> lockrequest (dwoptions); <br/> return e_notimpl; <br/>}< br/> hresult stdmethodcalltype unlockrequest (void) <br/>{< br/> If (m_pprot) return m_pprot-> unlockrequest (); <br/> return e_notimpl; <br/>}< br/> public: <br/> virtual hresult stdmethodcalltype switch (<br/>/* [in] */protocoldata * pprotocoldata) <br/>{< br/> If (m_pprotsink) return m_pprotsink-> switch (pprotocoldata); <br/> return s_ OK; <br/>}< br/> virtual hresult stdmethodcalltype reportprogress (<br/>/* [in] */ulong ulstatuscode, <br/>/* [in] */lpcwstr szstatustext) <br/> {<br/> If (ulstatuscode = bindstatus_cachefilenameavailable) <br/>{< br/> atltrace (L "swfcache: % S/R/N", szstatustext); <br/>}< br/> If (m_pprotsink) return m_pprotsink-> reportprogress (ulstatuscode, szstatustext); <br/> return s_ OK; <br/>}< br/> virtual hresult stdmethodcalltype reportdata (<br/>/* [in] */DWORD grfbscf, <br/>/* [in] */ulong ulprogress, <br/>/* [in] */ulong ulprogressmax) <br/>{< br/> atltrace (L "process: % u/R/N", ulprogress, ulprogressmax); <br/> If (m_pprotsink) return m_pprotsink-> reportdata (grfbscf, ulprogress, ulprogressmax); <br/> return s_ OK; <br/>}< br/> virtual hresult stdmethodcalltype reportresult (<br/>/* [in] */hresult hrresult, <br/>/* [in] */DWORD dwerror, <br/>/* [in] */lpcwstr szresult) <br/>{< br/> If (m_pprotsink) return m_pprotsink-> reportresult (hrresult, dwerror, szresult); <br/> return s_ OK; <br/>}< br/>}; <br/> object_entry_auto (_ uuidof (filttry), cfilttry) <br/>

Remember to register

Code registration

Hkcr
{
Noremove protocols
{
Noremove Filter
{
Forceremove 'application/X-Shockwave-flash' = S' myfilt '// register as a flash Filter
{
Val CLSID = S' {947de86f-aeb0-4c36-b559-2268b0f3b209} '// class guid
}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.