public static void GetUserInfoByWxid(int pid, string wxuid) { var des = DllManager.Get(nameof(ChatRoomMember) + ".dll"); var baseAddr = Win32Api.LoadLibrary(des.Path); var funcAddr = Win32Api.GetProcAddress(baseAddr, "GetUserInfoByWxid"); var p = funcAddr - baseAddr + des.BaseAddr; int hProcess = Win32Api.OpenProcess(0xFFFF, 0, pid); var c = setByte2(wxuid); var dllAddr = Win32Api.VirtualAllocEx((IntPtr)hProcess, IntPtr.Zero, (uint)c.Length, AllocationType.Commit, MemoryProtection.ReadWrite); bool success = Win32Api.WriteProcessMemory((IntPtr)hProcess, dllAddr, c, (uint)c.Length, out var dummy); var exeH = Win32Api.CreateRemoteThread((IntPtr)hProcess, IntPtr.Zero, 0, (IntPtr)p, dllAddr, 0, out var tid); Win32Api.FreeLibrary(baseAddr); }
public static void Send(int pid, string wXid, string message) { var des = DllManager.Get(nameof(SendMessage) + ".dll"); var baseAddr = Win32Api.LoadLibrary(des.Path); var funcAddr = Win32Api.GetProcAddress(baseAddr, "SendTextMessage"); var p = funcAddr - baseAddr + des.BaseAddr; int hProcess = Win32Api.OpenProcess(0xFFFF, 0, pid); string a = $"{wXid}_ejflag_{message}"; var c = setByte2(a); var dllAddr = Win32Api.VirtualAllocEx((IntPtr)hProcess, IntPtr.Zero, (uint)c.Length, AllocationType.Commit, MemoryProtection.ReadWrite); bool success = Win32Api.WriteProcessMemory((IntPtr)hProcess, dllAddr, c, (uint)c.Length, out var dummy); var exeH = Win32Api.CreateRemoteThread((IntPtr)hProcess, IntPtr.Zero, 0, (IntPtr)p, dllAddr, 0, out var tid); Win32Api.FreeLibrary(baseAddr); }