强制绑定 app.exe | 多路 ip 到 lan ip

强制绑定 app.exe | 多路 ip 到 lan ip

根据这篇文章 将应用程序绑定到特定网络接口

第二个帖子,我测试了它,它工作正常。我完全按照他的指示在我的电脑和虚拟机上进行设置,并启动了一个多人离线游戏,它能够看到局域网托管的游戏。

这是 BindIp.cmd 代码

setlocal

:: IP to bind to. This env.var is used by BindIp.dll
set FORCEDIP=172.26.192.1

:: Common variables
set RegIFEO=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\%~nx1
set Injector=%~dp0injectory.x86.exe
set BindIpDll=%~dp0BindIp.dll

:: Extract target's parameters, if any
set AllParams=%*
set FirstParam=%1
call set TargetParams=%%AllParams:*%FirstParam% =%%

:: Delete debugger for the target exe in registry,
:: or we'll end in an endless loop of the batch files
reg delete "%RegIFEO%%" /v Debugger /f

:: Start target exe and inject BindIp.dll
if not [%2] == [] (
    :: If there were parameters for target exe, pass them on
    "%Injector%" --launch %1 --inject "%BindIpDll%" --args "%TargetParams%"
) else (
    :: No parameters were specified
    "%Injector%" --launch %1 --inject "%BindIpDll%"
)

:: Restore this script as debugger for the target exe in registry
reg add "%RegIFEO%" /v Debugger /t REG_SZ /d "%~dpnx0" /f

:: Debug, uncomment if needed
rem pause

endlocal

现在我可以在这个 cmd 中使用多 ip 吗

set FORCEDIP=172.26.192.1 
set FORCEDIP= external ip
set FORCEDIP= main pc ip
set FORCEDIP= external ip

ip1
ip2
ip3
ip4

IP 列表可以很小也可以很大,但我可以这样使用它吗?

答案1

不能。需要多个套接字才能绑定到多个地址。这需要对软件进行大量更改。

ForceBindIP 不会引入新的套接字,而只会改变现有套接字的工作方式。

相关内容