예제 #1
0
        /// <summary>
        /// Opens a client with dynamic multi-clienting support
        /// </summary>
        public static Client OpenMC(string path, string arguments)
        {
            Util.WinAPI.PROCESS_INFORMATION pi = new Pokemon.Util.WinAPI.PROCESS_INFORMATION();
            Util.WinAPI.STARTUPINFO         si = new Pokemon.Util.WinAPI.STARTUPINFO();

            if (arguments == null)
            {
                arguments = "";
            }

            Util.WinAPI.CreateProcess(path, " " + arguments, IntPtr.Zero, IntPtr.Zero,
                                      false, Util.WinAPI.CREATE_SUSPENDED, IntPtr.Zero,
                                      System.IO.Path.GetDirectoryName(path), ref si, out pi);

            IntPtr  handle = Util.WinAPI.OpenProcess(Util.WinAPI.PROCESS_ALL_ACCESS, 0, pi.dwProcessId);
            Process p      = Process.GetProcessById(Convert.ToInt32(pi.dwProcessId));

            Util.Memory.WriteByte(handle, (long)Pokemon.Addresses.Client.MultiClient, Pokemon.Addresses.Client.MultiClientJMP);
            Util.WinAPI.ResumeThread(pi.hThread);
            p.WaitForInputIdle();
            Util.Memory.WriteByte(handle, (long)Pokemon.Addresses.Client.MultiClient, Pokemon.Addresses.Client.MultiClientJNZ);
            Util.WinAPI.CloseHandle(handle);
            Util.WinAPI.CloseHandle(pi.hProcess);
            Util.WinAPI.CloseHandle(pi.hThread);

            return(new Client(p));
        }
예제 #2
0
        /// <summary>
        /// Opens a client with dynamic multi-clienting support
        /// </summary>
        public static Client OpenMC(string path, string arguments)
        {
            Util.WinAPI.PROCESS_INFORMATION pi = new Pokemon.Util.WinAPI.PROCESS_INFORMATION();
            Util.WinAPI.STARTUPINFO si = new Pokemon.Util.WinAPI.STARTUPINFO();

            if (arguments == null)
                arguments = "";

            Util.WinAPI.CreateProcess(path, " " + arguments, IntPtr.Zero, IntPtr.Zero,
                false, Util.WinAPI.CREATE_SUSPENDED, IntPtr.Zero,
                System.IO.Path.GetDirectoryName(path), ref si, out pi);

            IntPtr handle = Util.WinAPI.OpenProcess(Util.WinAPI.PROCESS_ALL_ACCESS, 0, pi.dwProcessId);
            Process p = Process.GetProcessById(Convert.ToInt32(pi.dwProcessId));
            Util.Memory.WriteByte(handle, (long)Pokemon.Addresses.Client.MultiClient, Pokemon.Addresses.Client.MultiClientJMP);
            Util.WinAPI.ResumeThread(pi.hThread);
            p.WaitForInputIdle();
            Util.Memory.WriteByte(handle, (long)Pokemon.Addresses.Client.MultiClient, Pokemon.Addresses.Client.MultiClientJNZ);
            Util.WinAPI.CloseHandle(handle);
            Util.WinAPI.CloseHandle(pi.hProcess);
            Util.WinAPI.CloseHandle(pi.hThread);

            return new Client(p);
        }