请问,要拦截webbrowser的收发数据,是拦截那个dll和函数?我用的是IAT的方法
论坛搜索了一下,
有人说webbrowser HOOK不到的
有人说可以拦截wininet.dll中的wsasend函数
有人说,wininet.dll其实就是封装了ws2_32.dll中的函数,所以拦截ws2_32中的函数就行我查到自己的程序有wsock2.dll,拦截它的send函数后,却只对自己使用的send起作用,webbrowser没一点反应
如果拦截ws2_32.dll中的send,什么都没反应了我最早用inline hook的时候,是ws2_32.dll的send函数,那个时候确实可以拦截到webbrowser的内容的现在想请教下各位,是因为我的IAT没有HOOK好,比如GetProcedureAddress函数没有拦截到,
还是说,我之前的记忆错误,其实webbrowser拦截不到的或者说,因为webbrowser没有直接使用socket api,而是包装使用,所以不能用IAT这种方法来HOOK,只能通过inline来搞定??

解决方案 »

  1.   

    通过webbrowser customization 改变webbrowser post出去的数据
    http://msdn.microsoft.com/en-us/library/aa770041(v=vs.85).aspx#Controlling_Navigation
    Controlling NavigationYou may have wondered why the section on IDocHostUIHandler didn't mention IDocHostUIHandler::TranslateUrl as a method to implement when you wish to control page navigation. The reason is that this method is not the most general purpose technique with which to control navigation. Unless you are hosting MSHTML directly, this method will have no effect on navigation. Instead, you can control navigation by implementing your IDispatch::Invoke method to handle DISPID_BEFORENAVIGATE2. As an example, the following code prevents navigation to a particular URL, displaying the standard "Navigation Canceled" error page if the user attempts to do so. 
    case DISPID_BEFORENAVIGATE2:
    {
        // Is navigation to specified Url disallowed? 
        ATLASSERT((*pDispParams).rgvarg[5].vt = VT_BYREF | VT_BSTR);
        CComBSTR url = ((*pDispParams).rgvarg)[5].pvarVal->bstrVal;
        if (url == "http://www.adatum.com" || url == "http://www.adatum.com/")
        {
            // If so, navigate the browser frame to standard resource page 
            CComQIPtr<IWebBrowser2> spBrowser = ((*pDispParams).rgvarg)[6].pdispVal;
            if (spBrowser != NULL)
            {
                static const CComBSTR newURL = L"res://ieframe.dll/navcancl.htm";
                spBrowser->Navigate(newURL, NULL, NULL, NULL, NULL);
                // Set Cancel parameter to TRUE to cancel the current event
                *(((*pDispParams).rgvarg)[0].pboolVal) = TRUE;
            }
        }
        break;
    }http://msdn.microsoft.com/en-us/library/aa752134(v=vs.85).aspx
    IWebBrowser2::Navigate2 Method
    Navigates the browser to a location that might not be expressed as a URL, such as a pointer to an item identifier list (PIDL) for an entity in the Windows Shell namespace.
    HRESULT Navigate2(
        VARIANT *URL,
        VARIANT *Flags,
        VARIANT *TargetFrameName,
        VARIANT *PostData,
        VARIANT *Headers
    );
      

  2.   

    呃,1楼给的全是英文啊,我看的不是太懂
    不过好像和我描述的问题,没有特别的联系吧,我想要的是hook 它的低层发送和接受的api
      

  3.   

    改写LSP通信过程:应用通信
    ||
    ws2_32.dll
    ||
    分层传输提供者(LSP)
    ||
    基础协议(底层驱动)
      

  4.   

    ws2_32.dll就是载入LSP提供的接口
      

  5.   

    回3楼:
    您说的LSP编程确实很好,以后可以研究一下根据您写的通信过程,是不是可以确认,webbrowser控件的数据,应该还是通过ws2_32.dll来收发的
    那么我碰到的问题,inline可以拦截,IAT不能拦截,应该是我的IAT拦截代码出问题了,没有全部替换掉了谢谢您的解答
    结贴了