The Launcher is a server that accept a conection of a client, then recv packets from it and response.
Can't make it work as the Original Launcher.
Here's the code:
Code:
#include <GUIConstantsEx.au3> #include <Array.au3> #include <WinAPI.au3> Func ArrayofByte($binary) Local $binaryLen = StringLen($binary) -2 Local $ArrayLen = ($binaryLen/2) Local $string = "" Local $mid = 3 Local $n = 1 If (Mod($binaryLen,2) = 0) Then For $i = 0 To $ArrayLen $n+=1 If $n > 1 Then $string = $string & StringMid($binary,$mid,2) & " " $n = 1 Else $string = $string & StringMid($binary,$mid,2) EndIf $mid +=2 Next Return $string Else Return -1 EndIf EndFunc Func Translate($binary) $binary = ArrayofByte($binary) $mid = 1 Local $result = "" $len = stringlen($binary) For $i = 0 to $len $str=StringMid($binary,$mid,2) $str=Int("0x"&$str) If $str >20 Then If $i = 12 Then If Chr($str) = 2 Or Chr($str) = 1 Then $result = $result & " " EndIf Else $result = $result & Chr($str) EndIf EndIf $mid+=3 Next Return $result EndFunc Global $edit Main() Func Main() Local $tSTARTUPINFO = DllStructCreate($tagSTARTUPINFO) Local $DETACHED_PROCESS = 0x00000008 Local $tPROCESS_INFORMATION = DllStructCreate($tagPROCESS_INFORMATION) _WinAPI_CreateProcess("C:\Program Files (x86)\Riot Games\League of Legends\RADS\projects\lol_air_client\releases\0.0.1.71\deploy\LolClient.exe"," -runtime .\ -nodebug META-INF\AIR\application.xml .\ -- 8393",0,0,False,$DETACHED_PROCESS,0,0,DllStructGetPtr($tSTARTUPINFO),DllStructGetPtr($tPROCESS_INFORMATION)) Local $szIPADDRESS = "127.0.0.1" Local $nPORT = 8393 ;we listen at port 8393 since LolClient will try to connect to that port Local $ClientSocket, $Client, $szIP_Accepted,$LSocket,$League Local $msg, $recv TCPStartup() $ClientSocket = TCPListen($szIPADDRESS, $nPORT) ; If the Socket creation fails, exit. If $ClientSocket = -1 Then Exit GUICreate("LolLauncher Test", 300, 200, 100, 100) $edit = GUICtrlCreateEdit("", 10, 10, 280, 180) GUISetState() $Client = -1 ;Wait for and Accept a connection Do $Client = TCPAccept($ClientSocket) Until $Client <> -1 ; Get IP of client connecting $szIP_Accepted = SocketToPort($Client) GUICtrlSetData($edit,"Client connected port: "&$szIP_Accepted) While 1 $msg = GUIGetMsg() ; GUI Closed ;-------------------- If $msg = $GUI_EVENT_CLOSE Then ExitLoop ;all messages are sent in 16 bytes long $recv = TCPRecv($Client, 16,1) ; If the receive failed with @error then the socket has disconnected ;---------------------------------------------------------------- If @error Then ExitLoop If StringLen($recv) > 0 Then ;if we received data DecodePacket($recv,$Client) EndIf WEnd If $Client <> -1 Then TCPCloseSocket($Client) TCPShutdown() EndFunc Func SocketToIP($SHOCKET) Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _ "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc ;==>SocketToIP Func SocketToPort($SHOCKET) Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _ "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DllCall("Ws2_32.dll", "ushort", "ntohs", "ushort", DllStructGetData($sockaddr, 2)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc ;==>SocketToPort Func DecodePacket($RecvData,$socket) Switch ($RecvData) Case "0x10000000010000000400000000000000" GUICtrlSetData($edit,"Alive Packet received, response sent") SendOk($socket) Case "0x10000000010000000000000031000000" GUICtrlSetData($edit,"Received Launch Client Waiting buffer") Do $rec = TCPRecv($socket,255,1);we will receive the League of Legends Parameters $traduccion = Translate($rec) GUICtrlSetData($edit,"Received command: "&$traduccion) Until StringLen($rec) > 0 SendOk($socket) LaunchAndAcceptConection($traduccion) Case "0x10000000010000000000000032000000" GUICtrlSetData($edit,"Received Launch Client Waiting buffer") Do $rec = TCPRecv($socket,255,1) $traduccion = Translate($rec) GUICtrlSetData($edit,"Received command: "&$traduccion) Until StringLen($rec) > 0 SendOk($socket) LaunchAndAcceptConection($traduccion) Case "0x10000000010000000000000033000000" GUICtrlSetData($edit,"Received Launch Client Waiting buffer") Do $rec = TCPRecv($socket,255,1) $traduccion = Translate($rec) GUICtrlSetData($edit,"Received command: "&$traduccion) Until StringLen($rec) > 0 SendOk($socket) LaunchAndAcceptConection($traduccion) EndSwitch EndFunc Func LaunchAndAcceptConection($param) $process = "C:\Program Files (x86)\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.9\deploy\League of Legends.exe" $format = StringFormat("""C:\Program Files (x86)\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.9\deploy\League of Legends.exe "" ""8394"" ""LolLauncher.exe"" ""C:\Program Files (x86)\Riot Games\League of Legends\RADS\projects\lol_air_client\releases\0.0.1.71\deploy\LolClient.exe"" ""%s""",$param) $WorkingDir = "C:\Program Files (x86)\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.9\deploy" Local $tSTARTUPINFO = DllStructCreate($tagSTARTUPINFO) Local $DETACHED_PROCESS = 0x00000008 Local $tPROCESS_INFORMATION = DllStructCreate($tagPROCESS_INFORMATION) _WinAPI_CreateProcess($process,$format,0,0,False,$DETACHED_PROCESS,0,$WorkingDir,DllStructGetPtr($tSTARTUPINFO),DllStructGetPtr($tPROCESS_INFORMATION)) #cs Local $oPORT = 8394 Local $szIPADDRESS = "127.0.0.1",$LeagueLegends Local $LeagueSocket = TCPConnect($szIPADDRESS, $oPORT) TCPSend($LeagueSocket,"0x10000000010000000400000000000000") #ce EndFunc Func SendWhatsUp($socket) $data="0x10000000010000000400000000000000" TCPSend($socket,$data) EndFunc Func SendOk($socket) $data = "0x10000000010000000500000000000000" TCPSend($socket,$data) EndFunc
And here Images from ollydbg:
Original Launcher calling CreateProcess
Stack Info before Creating the Process:
CommandLine Sent:
Now Mine Launcher
Stack Info before Creating Process:
CommandLine in dump:
Don't Know why these is up there:
Why the parameters i sent to CreateProcess looks like crap? or are incomplete, Please i need a reply to continue with this