private void GetObKeyFormLoLClientMemory() { Regex gameIdRegex = new Regex(@" [0-9]+ (?<KEY>.+) [0-9]+", RegexOptions.IgnoreCase); Match match = gameIdRegex.Match(exeData.CommandLine); ProcessMemory pm = new ProcessMemory(); if (!pm.openProcess("LolClient")) { Logger.Instance.WriteLog("Open process failed"); } if (_lastTimeAddress != 0) { FindOnKeyFromLastTimeAddress(pm); } if (obKey == null) { pm.recordMemorysInfo(false); uint[] result = pm.findString(match.Groups["KEY"].Value, Encoding.ASCII, 1); if (!FindObkeyInMemory(pm, result)) { result = pm.findString(match.Groups["KEY"].Value, Encoding.ASCII); FindObkeyInMemory(pm, result); } } pm.closeProcess(); }
public string GetSummonerName() { ProcessMemory pm = new ProcessMemory(); if (!pm.openProcess("LolClient")) { Logger.Instance.WriteLog("Open process failed"); } pm.recordMemorysInfo(false); string prefix = "@sec.pvp.net/"; uint[] address = pm.findString(prefix, Encoding.ASCII, 1); byte[] b = pm.readMemory((uint)(address[0] + prefix.Length), 64); pm.closeProcess(); int endPos = 0; while (b[endPos] != '\'' && b[endPos] != 0) { endPos++; } string name = Encoding.UTF8.GetString(b, 0, endPos); Logger.Instance.WriteLog("Summoner name is " + name); return(name); }