[AutoIt] Universal Memory Patcher

11/22/2008 17:17 lolkop#1
basicly a memory patcher made with autoupdate should allways work with all versions of sro
[Only registered and activated users can see links. Click Here To Register...]
compiled version:
[Only registered and activated users can see links. Click Here To Register...]

source:
Code:
#NoTrayIcon
#include <WinAPI.au3>
If Not FileExists("patcher.ini") Then
    ini()
EndIf
$time = FileGetTime(IniRead("patcher.ini", "dir", "dir", "")&"\sro_client.exe")
$timeold = IniRead("patcher.ini", "time", "time", "")
If $time[0]&$time[1]&$time[2]&$time[3]&$time[4]&$time[5]<>$timeold Then
    ini()
EndIf
$FRMMAIN = GUICreate("Silkroad Online Patcher", 301, 301, -1, -1)
$PATCHER = GUICtrlCreateGroup("Patcher", 8, 8, 281, 281)
$PLIST = GUICtrlCreateList("", 16, 24, 105, 227)
$REFRESH = GUICtrlCreateButton("Refresh", 16, 256, 49, 25, 0)
$INFO = GUICtrlCreateButton("Info", 224, 264, 57, 17, 0)
$NODC = GUICtrlCreateCheckbox("No DC", 128, 48, 97, 17)
GUICtrlSetState(-1, 1)
$DISABLESWEARFILTER = GUICtrlCreateCheckbox("Disable Swear Filter", 128, 72, 113, 17)
GUICtrlSetState(-1, 1)
$ZOOMHACK = GUICtrlCreateCheckbox("Zoomhack", 128, 96, 97, 17)
GUICtrlSetState(-1, 1)
$SERVERSTATUS = GUICtrlCreateCheckbox("Serverstatus", 128, 120, 97, 17)
GUICtrlSetState(-1, 1)
$NUDEPATCH = GUICtrlCreateCheckbox("Nude Patch", 128, 144, 97, 17)
GUICtrlSetState(-1, 1)
$SROVERSION = GUICtrlCreateLabel("Silkroad Online Patcher", 128, 24, 143, 17)
$PATCH = GUICtrlCreateButton("Patch", 72, 256, 49, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
    $NMSG = GUIGetMsg()
    Switch $NMSG
        Case - 3
            Exit
        Case $REFRESH
            If ProcessExists("sro_client.exe") Then
                $SETPROCESS = ProcessList("sro_client.exe")
                For $I = 1 To $SETPROCESS[0][0]
                    GUICtrlSetData($PLIST, $SETPROCESS[$I][1])
                Next
            Else
                MsgBox(48, "Silkroad Online Patcher", "No Silkroad Online Process has been found")
                GUICtrlSetData($PLIST, "")
            EndIf
        Case $PATCH
            If GUICtrlRead($PLIST) Then
                $pid = GUICtrlRead($PLIST)
                $mid = _WinAPI_OpenProcess(0x001F0FFF, False, $pid)
                If GUICtrlRead($NODC) = 1 Then NODC()
                If GUICtrlRead($DISABLESWEARFILTER) = 1 Then SWEARFILTER()
                If GUICtrlRead($ZOOMHACK) = 1 Then ZOOMHACK()
                If GUICtrlRead($SERVERSTATUS) = 1 Then SERVERSTATUS()
                If GUICtrlRead($NUDEPATCH) = 1 Then NUDEPATCH()
                MsgBox(0, "Silkroad Online Patcher", "The Silkroad Online Process " & $pid & " has been successfully Patched")
            Else
                MsgBox(48, "Silkroad Online Patcher", "No Silkroad Online Process has been found")
            EndIf
        Case $INFO
            MsgBox(0, "Silkroad Online Patcher", "Copyright © 2008 lolkop" & @CRLF & "Design © 2008 Vitalka")
    EndSwitch
    Sleep(1)
WEnd



Func NODC()
    memwrite(IniRead("patcher.ini", "nodc", "adress", ""), "8B0D"&IniRead("patcher.ini", "nodc", "replace", "")&"8B118B4214FFD05F83C410C3FFFF84C074")
EndFunc


Func SWEARFILTER()
    memwrite(IniRead("patcher.ini", "swear", "1", ""), "EB")
    memwrite(IniRead("patcher.ini", "swear", "2", ""), "EB")
    memwrite(IniRead("patcher.ini", "swear", "3", ""), "EB")
EndFunc


Func ZOOMHACK()
    memwrite(IniRead("patcher.ini", "zoom", "out1", ""), "EB")
    memwrite(IniRead("patcher.ini", "zoom", "out2", ""), "EB")
    memwrite(IniRead("patcher.ini", "zoom", "in1", ""), "EB")
    memwrite(IniRead("patcher.ini", "zoom", "in2", ""), "EB")
EndFunc


Func SERVERSTATUS()
    memwrite(IniRead("patcher.ini", "stats", "adress", ""), "9090")
    memwrite(IniRead("patcher.ini", "stats", "colour", ""), "6841B5FFFF")
EndFunc


Func NUDEPATCH()
    memwrite(IniRead("patcher.ini", "nude", "1", ""), "9090")
    memwrite(IniRead("patcher.ini", "nude", "2", ""), "E9"&IniRead("patcher.ini", "nude", "3", "")&"90")
EndFunc


Func memwrite($adress, $hex)
    If $adress <> "" Then
        $buffer = 0
        $struct = DllStructCreate("byte["&StringLen($hex)/2&"]")
        For $i=StringLen($hex)/2 To 1 Step -1
            DllStructSetData($struct, 1, BinaryMid("0x"&$hex, $i, 1), $i)
        Next
        _WinAPI_WriteProcessMemory($mid, $adress, DllStructGetPtr($struct), StringLen($hex)/2, $buffer)
    EndIf
EndFunc

Func ini()
    $dir = IniReadSection("patcher.ini", "dir")
    If  Not @error Then 
        $dir = $dir[1][1]
    Else
    Do
        $dir = FileSelectFolder("Select your Silkroad Dir", "")
        If $dir = "" Then
            Exit
        ElseIf Not FileExists($dir&"\sro_client.exe") Then
            MsgBox(16, "Not Found", "sro_client.exe could not be found in that dir")
        EndIf
    Until FileExists($dir&"\sro_client.exe")
        IniWrite("patcher.ini", "dir", "dir", $dir)
    EndIf
    $time = FileGetTime($dir&"\sro_client.exe")
    $size = FileGetSize($dir&"\sro_client.exe")
    $file = FileOpen($dir&"\sro_client.exe", 4)
    $content = FileRead($file, $size)
    $pos = StringInStr($content, "68010500006812050000", 2)
    $module1 = rev(StringMid($content, $pos+0x26, 8))
    $module2 = Hex($pos/2-0x137)
    $module = Hex(String("0x"&$module1)-String("0x"&$module2))
    $zoomout1 = Hex(StringInStr($content, "DFE0F6C4417A08D99EEC030000", 2, 1)/2+String("0x"&$module)+4)
    IniWrite("patcher.ini", "zoom", "out1", "0x"&$zoomout1)
    TrayTip("Adress Found", "Found Zoomout adress 1", 2)
    $zoomin1 = Hex(("0x"&$zoomout1)-0x26)
    IniWrite("patcher.ini", "zoom", "in1", "0x"&$zoomin1)
    TrayTip("Adress Found", "Found Zoomout adress 2", 2)
    $zoomout2 = Hex(StringInStr($content, "DFE0F6C4417A08D99EEC030000", 2, 2)/2+String("0x"&$module)+4)
    IniWrite("patcher.ini", "zoom", "out2", "0x"&$zoomout2)
    TrayTip("Adress Found", "Found Zoomin adress 1", 2)
    $zoomin2 = Hex(("0x"&$zoomout2)-0x26)
    IniWrite("patcher.ini", "zoom", "in2", "0x"&$zoomin2)
    TrayTip("Adress Found", "Found Zoomin adress 2", 2)
    $nodc = rev(Hex(StringInStr($content, _hex("UIIT_MSG_MSGBOX_NETOFF"), 2, 1)/2+String("0x"&$module)-1))
    $nodc_adress = Hex(StringInStr($content, "68"&$nodc, 2, 2)/2+String("0x"&$module)-0x19)
    IniWrite("patcher.ini", "nodc", "adress", "0x"&$nodc_adress)
    TrayTip("Adress Found", "Found NoDC adress", 2)
    $replace = StringRegExp($content, "8B0D(.{8}?)8B118B4214FFD084C00F85", 3)
    IniWrite("patcher.ini", "nodc", "replace", $replace[0])
    $max_full = rev(Hex(StringInStr($content, _hex("UIO_STT_SERVER_MAX_FULL"), 2, 1)/2+String("0x"&$module)-1))
    $max_full_adress = Hex(StringInStr($content, "68"&$max_full, 2, 1)/2+String("0x"&$module)-3)
    IniWrite("patcher.ini", "stats", "adress", "0x"&$max_full_adress)
    TrayTip("Adress Found", "Found Serverstat adress", 2)
    $max_full_colour = Hex(("0x"&$max_full_adress)+0xE9)
    IniWrite("patcher.ini", "stats", "colour", "0x"&$max_full_colour)
    $swear = rev(Hex(StringInStr($content, _hex("UIIT_MSG_CHATWND_MESSAGE_FILTER"), 2, 1)/2+String("0x"&$module)-1))
    $swear_adress1 = Hex(StringInStr($content, "68"&$swear, 2, 1)/2+String("0x"&$module)-3)
    IniWrite("patcher.ini", "swear", "1", "0x"&$swear_adress1)
    $swear_adress2 = Hex(StringInStr($content, "68"&$swear, 2, 2)/2+String("0x"&$module)-3)
    IniWrite("patcher.ini", "swear", "2", "0x"&$swear_adress2)
    $swear_adress3 = Hex(StringInStr($content, "68"&$swear, 2, 3)/2+String("0x"&$module)-3)
    IniWrite("patcher.ini", "swear", "3", "0x"&$swear_adress3)
    TrayTip("Adress Found", "Found SwearFilter adresses", 2)
    $nude = rev(Hex(StringInStr($content, _hex("(nEquipSlot >=0 ) && ( nEquipSlot < EQUIP_VISUAL_COUNT)", 1), 2, 1)/2+String("0x"&$module)-1))
    $nude1 = Hex(StringInStr($content, "68"&$nude, 2, 1)/2+String("0x"&$module)-0x1F)
    IniWrite("patcher.ini", "nude", "1", "0x"&$nude1)
    TrayTip("Adress Found", "Found Nude adress", 2)
    $nude2 = Hex(("0x"&$nude1)+0xB)
    IniWrite("patcher.ini", "nude", "2", "0x"&$nude2)
    TrayTip("Adress Found", "Found Nude adress", 2)
    $nude_replace = rev(Hex(rev(StringMid($content, StringInStr($content, "68"&$nude, 2)-0x22, 8)&"0x")+1))
    IniWrite("patcher.ini", "nude", "3", $nude_replace)
    FileClose($file)
    IniWrite("patcher.ini", "time", "time", $time[0]&$time[1]&$time[2]&$time[3]&$time[4]&$time[5])
EndFunc

Func rev($string)
    Local $all
    For $i=StringLen($string)+1 To 1 Step -2
        $all=$all&StringMid($string, $i, 2)
    Next
    Return $all
EndFunc

Func _hex($string, $type = 2)    ;type 1 = ascii | type 2 = unicode
    Local $all
    $split = StringSplit($string, "")
    For $i=1 To UBound($split)-1
        If $type = 1 Then
            $all = $all & StringMid(Hex(Asc($split[$i])), 7)
        ElseIf $type = 2 Then
            $all = $all & StringMid(Hex(Asc($split[$i])), 7) & "00"
        EndIf
    Next
    If $type = 1 Then
        Return $all
    ElseIf $type = 2 Then
        Return StringTrimRight($all, 2)
    EndIf
EndFunc

Confirmed by Invincible.
11/23/2008 04:00 drscooter#2
looks nice , nice to have all those in one like patch also
12/07/2008 19:33 elyonito2007#3
for what is it?
12/20/2008 13:30 sharonyani#4
Thies a noDC patcher oO?
12/21/2008 18:45 takelook#5
i dont understand anything why i need this ? ^^
12/22/2008 01:15 weeman2412#6
same here
12/22/2008 10:33 lolrko#7
is it a all-time patcher for sro_client lolkop ?

or it patch something else ?!

sorry am not an expert in programming ..
12/22/2008 11:59 lolkop#8
meh thought this patcher would be self explaining >.<

it is a patcher for running clients so if you started silkroad normally or with tbot for example this patcher will make it possible to add nodc, zoomhack etc it will work with all future versions of sro since its not a loader it wont support multiclient


so if you wanna use it just run silkroad after that you can run the patcher and modify the memory of your client :)

it will show the pids of all opened clients all of them can be patched
12/23/2008 23:40 lolrko#9
i see , thanks for explaining
it's v.good since it can be used with next updates
sounds like ipatcher of invin.

thnx lolkop i really like ur patchers
09/18/2009 08:34 cold_death#10
if it still works wiz the current update can u re upload it plz?