Пример #1
0
        //[DllImport("kernel32.dll")]
        //static extern IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, int dwProcessId);
        //[DllImport("kernel32.dll")]
        //static extern uint WriteProcessMemory(IntPtr hProcess, uint lpBaseAddress, byte[] lpBuffer, int nSize, uint lpNumberOfBytesWritten);
        //[DllImport("kernel32.dll")]
        //static extern uint VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, uint flAllocationType, uint flProtect);
        //[DllImport("kernel32.dll")]
        //static extern IntPtr CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner, string lpName);
        //public static IntPtr Handle;
        //public static IntPtr SROHandle;
        //private Process Started;
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (chkClientless.Checked)
            {
                var gatewayRemoteEP = Configs.ClientConfig.GatewayServer;// new System.Net.IPEndPoint(Metadata.MediaData.ClientInfo.IP, Metadata.MediaData.ClientInfo.Port);
                ProxyClientless.SetGatewayRemoteEndPoint(gatewayRemoteEP);
                ProxyClientless.StartGateway();
                timerClientPing.Enabled = true;
            }
            else
            {
                var agentLocalEP = Configs.PatchConfig.RedirectAgentServer;// new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 20002);
                Proxy.SetAgentLocalEndPoint(agentLocalEP);

                var gatewayLocalEP  = Configs.PatchConfig.RedirectGatewayServer; //new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 20001);
                var gatewayRemoteEP = Configs.ClientConfig.GatewayServer;        // new System.Net.IPEndPoint(Metadata.MediaData.ClientInfo.IP, Metadata.MediaData.ClientInfo.Port);
                Proxy.SetGatewayLocalEndPoint(gatewayLocalEP);
                Proxy.SetGatewayRemoteEndPoint(gatewayRemoteEP);
                Proxy.StartGateway();
            }

            if (!chkExternLoader.Checked)
            {
                ClientProcess.StartProcess();
            }

            btnStart.Enabled = false;
        }