//[DllImport("NeteaseHelper.dll")] //public static extern int GetProcRVA(string DllPath, string procname); //public static int GetProcAddress(string procname) //{ // int addr = GetProcRVA(Environment.CurrentDirectory + "\\" + DLLNAEM, procname); // if (addr == 0) // { // Console.WriteLine("获取函数地址失败!!!"); // } // addr += m_hDLL; // return addr; //} public static int FindAddr(IntPtr PHandle, int ProcAddr, uint findSize) { //开始寻找的函数地址 寻找范围 注意:未关闭句柄!!!! By Hyun byte[] mem = new byte[findSize + 1]; int readBytes = 0; bool result = Api.ReadProcessMemory(PHandle, (IntPtr)ProcAddr, mem, findSize, out readBytes); Console.WriteLine("ReadResult:" + result.ToString()); Console.WriteLine("Mem:" + Others.byteToHexStr(mem)); Console.WriteLine("Lenth:" + readBytes.ToString()); int time = 0, Offset = 0, Addr = ProcAddr; for (int i = 0; i < mem.Length; i++) { if (mem[i] == 232)//E8 内部Call { time++; } if (time == 2) { Addr = Addr + (i + 5); Offset = (mem[i + 4] << 24) + (mem[i + 3] << 16) + (mem[i + 2] << 8) + mem[i + 1]; break; } } Addr += Offset; Console.WriteLine("Addr:" + Addr.ToString()); Console.WriteLine("Offset:" + (Addr - m_hDLL).ToString()); return(Addr); }
private void OnRecvControlData() { //bool flag = (bool)o; PrintInfo("开始接收游戏控制信息..."); while (!this.m_isNormalExit) { int num; byte[] numArray; try { num = (int)this.Reader.ReadUInt16(); numArray = this.Reader.ReadBytes(num); } catch (Exception ex) { PrintInfo(ex.Message); if (!this.m_isNormalExit) { this.CloseGameCleaning(); } return; } PrintInfo(string.Format("[control] From MC:{0}", (object)Others.ByteToString(numArray, 0, num))); this.HandleMcControlMessage(numArray); } }
//public byte[] HandleSkinMessage(byte[] content)//GameState.gameid, username, profile.getId().toString() Skin //{ // OtherEnterWorldMsg otherEnterWorldMsg = new OtherEnterWorldMsg(); // new SimpleUnpack(content).Unpack(ref otherEnterWorldMsg); // //skinMode DEFAULT=0 SLIM=1 // return SimplePack.Pack((ushort)520, otherEnterWorldMsg.Name, System.Windows.Forms.Application.ExecutablePath + "\\cache\\skin\\", System.Windows.Forms.Application.ExecutablePath + "\\cache\\skin\\", 0); //} public void SendControlData(byte[] message) { if (this.NeedChaCha) { this.send_ccx.Process(message); } byte[] array = ((IEnumerable <byte>)BitConverter.GetBytes((ushort)message.Length)).Concat <byte>((IEnumerable <byte>)message).ToArray <byte>(); PrintInfo(string.Format("[control] To MC:{0}", (object)Others.ByteToString(array, 0, Math.Min(64, array.Length)))); try { this.Writer.Write(array); this.Writer.Flush(); } catch (Exception ex) { PrintInfo(ex.Message); PrintInfo("向MC发送控制信息失败"); } }
public string GetSkinUIDFromUUID(string uuid)//皮肤UID { return(Others.GetUserIdFromUUID(uuid).ToString()); }
public string GetVerificationAccount(string entity_id, string token, string rolename)//333316 mvMwFpkOaKn186KA Hyun { VerificationAccount v = Others.GetVerificationAccountEx(uint.Parse(entity_id), token, rolename); return(v.username + "|" + v.uuid + "|" + v.accessToken); }