zxhyxwwu 2015-06-05 02:45 采纳率: 0%
浏览 3721
已结题

应用层代理如何获取wfp实现的连接重定向的原始的连接地址

any helps will be thanks!

I have searched a lot of question,but still can't find a real answer,my goal is to get the original connect address.Some body suggest to walk previousVersion in FWPS_CONNECT_REQUEST0 structure,but not point how to walk and how to make it work,also how to access it in user mode or proxy service.I have known how to query the original connect address in windows 8,but I have no idea about windows 7.I have made the code like this:

 #if(NTDDI_VERSION >= NTDDI_WIN8)

    //SOCKADDR_STORAGE*     pSockAddrStorage = 0;

    if((*ppRedirectData)->redirectHandle)
        pConnectRequest->localRedirectHandle = (*ppRedirectData)->redirectHandle;

    HLPR_NEW_ARRAY(pSockAddrStorage,
        SOCKADDR_STORAGE,
        2,
        TUNNEL_CALLOUT_DRIVER_TAG);
    HLPR_BAIL_ON_ALLOC_FAILURE(pSockAddrStorage,
        status);

    /// Pass original remote destination values to query them in user mode
    RtlCopyMemory(&(pSockAddrStorage[0]),
        &(pConnectRequest->remoteAddressAndPort),
        sizeof(SOCKADDR_STORAGE));

    RtlCopyMemory(&(pSockAddrStorage[1]),
        &(pConnectRequest->localAddressAndPort),
        sizeof(SOCKADDR_STORAGE));

    /// WFP will take ownership of this memory and free it when the flow / redirection terminates
    pConnectRequest->localRedirectContext     = pSockAddrStorage;
    pConnectRequest->localRedirectContextSize = sizeof(SOCKADDR_STORAGE) * 2;

#endif

But I don't know how to coding on windows 7,because everybody knows on windows 7,the code of pConnectRequest->localRedirectContext is unaccessable.Is any body have any idea?thanks very much!

Also,I want to show my idea,on windows 7,I solve this question like this:store the original address by myself in drivers,after the proxy accept a connect from drivers redirect,I get the tcp source port,and I use the tcp source port to query in drivers by using DeviceControl function,but if the system have kaspersky software working,the tcp source port will be changed by kaspersky,so I can't get the right tcp source port,and ofcourse the proxy can't work correct.

  • 写回答

2条回答

  • zxhyxwwu 2015-06-05 06:43
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办