MapleLegends NoAdmin Patcher.ahk
twiz Sep 11th, 2019 (edited) 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #SingleInstance, Force ; Allow only one instance of the script to run
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Persistent ; Keep the script 'alive' in the tray
- RegRead, MLPath, HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\MapleLegends, ExecPath
- FileSelectFile, FileOrig, 3, %MLPath%, Prompt, MapleLegends*.exe
- If %ErrorLevel%
- FilePatch := StrReplace(FileOrig, ".exe", "_NoAdmin.exe")
- Dist := -0x720
- Bytes := Abs(Dist)
- SetFormat, Integer, D
- Chars := Bytes + 0
- IfExist, %FilePatch%
- FileDelete, %FilePatch%
- FileCopy, %FileOrig%, %FilePatch%
- _iFile := FileOpen(FileOrig, "r")
- _iFile.Seek(Dist, 2)
- _String := _iFile.Read(Chars)
- ; https://www.autohotkey.com/docs/commands/RegExMatch.htm#MatchObject
- RegExMatch(_String, "Osm)^(\s*<security>.+\s*<\/security>)", _Match)
- Loop, % _Match.Len()
- _Pad .= " "
- _String := StrReplace(_String, _Match.Value(), _Pad)
- _oFile := FileOpen(FilePatch, "a")
- _oFile.Seek(Dist, 2)
- MsgBox, 4,, Would you like to create a shortcut on the desktop?
- IfMsgBox, Yes
- FileCreateShortcut, %FilePatch%, %A_Desktop%\MapleLegends (NoAdmin).lnk, %MLPath%,,, %FilePatch%
RAW Paste Data