让天龙八部游戏掉线,并随时可以恢复。而且其他的程序不受影响。比如QQ,网页,其他游戏啊等等。就是登录游戏后人为让它掉线一次,再重新连接(是马上重新连接)。类似把网络连接停用了,再恢复。只是这样会影响其他的网络程序。本人思路是禁用该网游打开的端口,已经可以找到端口了,但是暂时禁用或者屏蔽它的端口还没有找到有价值的资料。有人说要用到防火墙方面的东西,也可以写个驱动等等。 大家可以给些建议吗?多谢,在线等.

解决方案 »

  1.   

    你觉得可能吗?游戏掉线后必须重新进,怎么可能自动恢复,如果只是断开这个程序的连接,以后可以再手动连接还是比较简单的,你可以用LSP(分层服务提供者)判断可执行文件名搞定,具体代码可参照(window网络与通信程序设计》。作者王艳平。如果要禁用端口就得用核心层驱动,书上也有说明。
      

  2.   

    看到曙光了,呵呵。http://www.codeproject.com/KB/IP/drvfltip.aspx在上边有个防火墙的例子,呵呵。是通过驱动,想改下。里边用了ntddk.h.在http://www.vckbase.com/tools/listtools.asp?tclsid=103
    下了Win2000 DDK ,但是安装不上啊。是XP系统。
      

  3.   

    bool   KillConnection(DWORD   dwRemoteIP,DWORD   dwRemotePort,DWORD   dwLocalIP,DWORD   dwLocalPort)  
      {  
      MIB_TCPROW   sKillConn;  
       
      sKillConn.dwState       =   MIB_TCP_STATE_DELETE_TCB;  
      sKillConn.dwLocalAddr     =   dwLocalIP;  
      sKillConn.dwRemoteAddr   =   dwRemoteIP;  
      sKillConn.dwLocalPort     =   dwLocalPort;  
      sKillConn.dwRemotePort   =   dwRemotePort;  
      DWORD   dwRez   =   SetTcpEntry(&sKillConn);  
      if(dwRez   !=   NO_ERROR)  
      {  
      TRACE("\nError   closing   connection   ;%d\n",GetLastError());  
      return   false;  
      }  
      return   true;  
      }
      

  4.   

    谢谢版主啊,刚试了。MIB_TCPROW  不认识。
    还有你这个方法可以重新连接吗?
      

  5.   

    Please refer to IP Helper API
    msdn.microsoft.com/en-us/library/aa366073(VS.85).aspx 
      

  6.   

    在哪儿可以下载正确的版本啊?你去vckbase看了?非常感谢啊,呵呵
      

  7.   

    版主啊,用你的方法试了,不行啊。根本就没有反应,呵呵SetTcpEntry,还是是有错误,if(dwRez  !=  NO_ERROR)  
      {  
      //TRACE("\nError  closing  connection  ;%d\n",GetLastError());  
      //return  false;  
    AfxMessageBox("ERROR");
      }  我是简单的弹了个对话框。
      

  8.   


    Return ValueThe function returns NO_ERROR (zero) if the function is successful.If the function fails, the return value is one of the following error codes.
    Return code DescriptionERROR_ACCESS_DENIED
    Access is denied. This error is returned on Windows Vista and Windows Server 2008 under several conditions that include the following: the user lacks the required administrative privileges on the local computer or the application is not running in an enhanced shell as the built-in Administrator (RunAs administrator).ERROR_INVALID_PARAMETER

    An input parameter is invalid, no action was taken. This error is returned if the pTcpRow parameter is NULL or the Row member in the MIB_TCPROW structure pointed to by the pTcpRow parameter is not set to MIB_TCP_STATE_DELETE_TCB.ERROR_NOT_SUPPORTED

    The IPv4 transport is not configured on the local computer.Other

    Use FormatMessage to obtain the message string for the returned error.
      

  9.   

    多谢大家,现在两种方法想都试下。
    就是驱动那个windows 2000 DDk没有找到啊,在微软网站上也没有找到。
    还有用SetTcpEntry的话怎么恢复连接啊?
      

  10.   

    在安装 Windows 2000 SP1 DDK 时是提示以下错误:The following components had installation errors:     32 bit x86 Binaries, Tools and Build Environment (X86DBIN)
         32 bit x86 libraries (X86DLIBC)
         64 bit ia64 Binaries, Tools and Build Environment (IA6DBIN)
         Headers (NINC_DDK)
         Windows Me Development Environment (ME_ENV)
         Windows DirectX 7 Development Environment (DX7_ENV)
         Debugging Tools (DBGGRS)
         Windows Me Debugging Kit (ME_DBG)
         1394 Samples (1394_DDK)
         ACPI Driver Sample (ACPI_DDK)
         Audio Samples (NAUD_DDK)
         Core Driver Samples (BASE_DDK)
         Comm Samples (NCOM_DDK)
         DVD Samples (NDVD_DDK)
         General Driver Samples (NGEN_DDK)
         General WDM Samples (NWDM_DDK)
         HID Samples (NHID_DDK)
         IME Samples (NIME_DDK)
         Input Samples (NINP_DDK)
         IRDA samples (NIRD_DDK)
         Modem Info & Utils (NMDK_DDK)
         Network Samples (NNET_DDK)
         Printer Samples (NPRN_DDK)
         Printer Minidriver Samples (NPTM_DDK)
         Smart Card Samples (NSCD_DDK)
         Scancam Samples (NSCN_DDK)
         Storage Samples (NSTO_DDK)
         USB Samples (NUSB_DDK)
         Virtual DOS Driver Samples (NVDD_DDK)
         Video Samples (NVID_DDK)
         WDM Video Capture Samples (NCAP_DDK)
         WIA Samples (NWIA_DDK)
         Windows Me Sample Display Driver (DX7_SAMP)
         Windows Me Sample Media Locking Tool (LOCKCD)
         Windows Me General Sample (ME_GEN)
         Windows Me Block Samples (ME_SAMP1)
         Windows Me Base Samples (ME_SAMP2)本人的机子是Windows XP,大家多帮帮我啊
      

  11.   

    用arp欺骗,可以解决所有的问题.但是,要求没有装arp防火墙
      

  12.   

    现在问题基本解决了,但是规则设置为全部才有效。即:源IP地址为0.0.0.0,端口为0,子网掩码为0.0.0.0,同样目的IP地址也是0.0.0.0,端口为0,子网掩码为0.0.0.0才可以,天龙八部确实是掉线了,但是其它网络程序也掉了。是怎么回事啊?不过还是看到希望了,多谢大家做完后一定上传,和大家分享请大家在帮帮忙,临门一脚了啊。
      

  13.   

    说明下,我用的是PfAddFiltersToInterface现在问题是那么都拦截,要么都放行。针对某个程序设置的过滤规则不起作用,是怎么回事啊?
      

  14.   

    这简单啊, 用个陷阱DLL, 在DLL中HOOK connect函数,
    在自己的connect中判断连接的IP端口和连接次数, 根据自己的需要做处理!
      

  15.   

    dalao812 ,谢谢你呀,呵呵,只需要一个类似防火墙的东西就可以了。决定用Xfilter来做了,就是直接改源码,呵呵,不再自己建工程提取别人的某个模块了。多谢大家帮助啊,准备明天结贴。
      

  16.   

    不好意思啊,还是有问题。Xfilter就是费尔防火墙,开起来总是会引起IE崩溃,请问大家谁知道原因啊?
      

  17.   

    现在用Firewall-Hook方法,可以了。但当断了之后,还会维持40秒左右。才提示:和服务器连接被断开,是否尝试重新连接?用抓包看断了之后还是有一些可以发出去,40秒后才完全断。大家知道是怎么回事吗??
      

  18.   

    比较麻烦 。你说的这个短线问题要看它的网络如何实现的 。
    天龙八部的网络服务器采用epoll 模型的,最高单台服务器支持1~2w的连接数,我同学说的,好像现在挺流行这种构架的。