Internet Explorer downloads the ultimate filtering file

xiaoxiao2021-03-06  151

Citation section:

Internet Explorer Download

Text part:

?

??????????????????????????????????????????? ???????????? ---- thorough monitor Internet Explorer download

?

Have you thought about some of the following questions?

l ???????? How to filter the flash in IE?

l ???????? How to filter the Nima virus in the web page?

l ???????? How to achieve download monitoring like Netants, Flashget?

Seeing the above question, you will soon think this is very simple:

"Don't monitor IE downloads? Find the suffix is" .swf "files will not download. This will filter Flash. Similarly, find that the suffix is" .eml "download also do the same processing ..."

So, how do you always monitor the download of IE? You won't write a driver for this?

If you are familiar with IE programming, you will immediately realize --- use Bho (Browser Helper Object).

However, it is not enough to use BHO.

BHO is similar to hook (hook), special place is: it hooked the IE event.

If you are not familiar with Bho, please go to the MSDN website to see the following article: http://www.microsoft.com/mind/0598/Browhelp.htm

By this article you will find that Bho can "hook" to all events of IE:

Navigate-> navigate-> Downloadbegin-> Downloadcomplete-> DocumentComplete, etc.

?

But it doesn't go to the entire download event of IE! such as:

The www.9cbs.net home page contains a lot of GIF files, Bho has faced them into blind ...

Said so much nonsense ~~~~ Take out the enemy magic!

Let's take a look at the Start method of IinternetProtocolroot:

HRESULT START (???? ingternetProtocolsink * poiProtsink, ??? IinternetBindInfo * poibindinfo, ??? DWORD GRFPI, ??? Handle_ptr dwreserved;

Just implement this IINTERNETPROTOCOLROOT interface of IE, check Szurl in its Start method, and do the download of the IE.

So how do you filter it? Take a look at the ReportResult method of the IinterNetProtocolsink interface! HRESULT ReportResult (??? DWORD DWERROR, ??? LPCWSTR SzResult);

Filter can only be filtered with the ReportResult method of the second parameter PoIProtsink in Start. In fact, the deception IE said that the file has been downloaded before IE download file.

For example, we have to filter the GIF file in IE, then just need to implement the following code:

STDMETHODIMP CQURL :: Start (/ / Here, my class named CQURL, everyone doesn't have to pay attention to ????? LPCWSTR SZURL, IINTERNETPROTOCOLSTR SZURL, IINTERNETPROTOCOLSINK * PIPROTSINK, ?? IINTERNETBINDINFO * PIBINDINFO, DWORD GRFSTI, DWORD DWRESERVED)

{

?

?????? uss_conversion;

????? char * str = ole2a (szurl); ???? IF (Strlen> 4)

?

?????? {

?

????????????? Str = Str Strlen (STR) - 4; // Take the last four characters of the resource, used to compare the file suffix

?

????????????? IF (_strnicmp (Str, ",", 4) == 0) // suffix is ​​GIF

?

????????????? {

?

????????????????????????????? piprotsink-> ReportResult (S_OK, 0, 0); // tell IE: The download is over! ??????????????????????????????????? Return S_ok; // returned if you returned inet_e_download_failure to see another Scenario ...

?

?????????????}

?

??????}

?

?????? Return INET_E_USE_DEFAULT_PROTOCOLHANDLER;

?

}

?

?

?

Familiar with the general method of monitoring filtration, the following starts to deepen the monitoring filter work into IE!

?

The instance of IEhelper taking the above MIND Magazine.

?

?

?

We fill an ATL object on the basis of IEHELPER, in which IINTERNETPROTOCOL is inherited.

?

And implement the Start method of IinternetProtocolroot!

?

?

?

The remaining work is only to implement the ATL object that fills above in the IEHELPER constructor.

?

Pointer plus two interfaces in the IEHELPER class:

?

IINTERNETSESSION * m_PSession;

?

?? ketfactory * m_pfactory;

?

Then create an object:

?

?? CIEHLPROBJ ()?

?

?? {

?

??????????????????????????????? HRESULT HR = COGETCLASSOBJECT (CLSID_FILTURL, CLSCTX_SERVER, NULL, IID_ICLASSFAACTORY, (VOID **) & m_pfactory;

?

???????????????????? IF (HR == S_OK)

?

???????????????????? {

?

????????????????????????????????????????????? f (CointernetGetSession (0, & m_psession, 0) == S_OK)

?

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? L "http", 0, null, 0); ????????? // Monitor HTTP service

?

????????????????????}?

?

??}

?

The description:

?

CIEHLPROBJ :: ~ Ciehlprobj ()

?

{

?

?????? f (m_psession! = null)

?

?????? {

?

????????????? m_psession-> unregisternamespace (m_pfactory, l "http");

?

????????????? m_psession-> release ();

?

????????????? m_psession = null;

?

??????}

?

?????? if (m_pfactory! = null)?

?????? {

?

????????????? m_pfactory-> release ();

?

????????????? m_pfactory = null;

?

??????}

?

}

?

Oh, it's so tired, not writing, annoying, throwing out four.

?

Specific look at the code: (Please don't use the code for commercial purposes!)

?

http://www.orthochina.org/upload/filturnie.rar

?

?

Posted on February 09, 2002, 9:32 PM, please modify the above recovery text

转载请注明原文地址:https://www.9cbs.com/read-127947.html

New Post(0)