SHARE
TWEET

MapleLegends NoAdmin Patcher.ahk

twiz Sep 11th, 2019 (edited) 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance, Force  ; Allow only one instance of the script to run
  2. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  3. #Persistent ; Keep the script 'alive' in the tray
  4.  
  5. RegRead, MLPath, HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\MapleLegends, ExecPath
  6. FileSelectFile, FileOrig, 3, %MLPath%, Prompt, MapleLegends*.exe
  7. If %ErrorLevel%
  8.     ExitApp
  9. FilePatch   := StrReplace(FileOrig, ".exe", "_NoAdmin.exe")
  10.  
  11. Dist    := -0x720
  12. Bytes   := Abs(Dist)
  13. SetFormat, Integer, D
  14. Chars   := Bytes + 0
  15.  
  16. IfExist, %FilePatch%
  17.     FileDelete, %FilePatch%
  18. FileCopy, %FileOrig%, %FilePatch%
  19.  
  20. _iFile := FileOpen(FileOrig, "r")
  21. _iFile.Seek(Dist, 2)
  22. _String := _iFile.Read(Chars)
  23. _iFile.Close()
  24.  
  25. ;   https://www.autohotkey.com/docs/commands/RegExMatch.htm#MatchObject
  26. RegExMatch(_String, "Osm)^(\s*<security>.+\s*<\/security>)", _Match)
  27. Loop, % _Match.Len()
  28.     _Pad .= " "
  29. _String := StrReplace(_String, _Match.Value(), _Pad)
  30.  
  31. _oFile := FileOpen(FilePatch, "a")
  32. _oFile.Seek(Dist, 2)
  33. _oFile.Write(_String)
  34. _oFile.Close()
  35.  
  36. MsgBox, 4,, Would you like to create a shortcut on the desktop?
  37. IfMsgBox, Yes
  38.     FileCreateShortcut, %FilePatch%, %A_Desktop%\MapleLegends (NoAdmin).lnk, %MLPath%,,, %FilePatch%
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top