/// <summary> /// /// </summary> protected override void OnCreateControl() { this.AcceptsTab = true; //this.BackColor = Color.Black; this.DetectUrls = true; this.Dock = DockStyle.Fill; this.Font = new Font("Lucida Console", 8); //this.ForeColor = Color.Lime; this.HideSelection = true; this.Multiline = true; //this.RightMargin = TextRenderer.MeasureText( "A", this.Font ).Width * 80; //this.ScrollBars = RichTextBoxScrollBars.ForcedVertical; this.ShortcutsEnabled = true; this.ShowSelectionMargin = false; if (!this.DesignMode) { // Delegates for invoked methods ProcessExitedCallback = new ProcessExitedDelegate(ProcessExited); OutputDataAvailableCallback = new OutputDataAvailableDelegate(OutputDataAvailable); // scCommandLineHistory holds old command lines for quick reuse scCommandLineHistory = new StringCollection(); // CreateCMDProcess(); } base.OnCreateControl(); }
private void PipeRead() { byte[] dbPipeMsgIn = new byte[14]; byte[] zero = new byte[] { 0 }; System.Delegate delMainup = new UpdateMainGridDelegate(UpdateMainGrid); System.Delegate delExitProc = new ProcessExitedDelegate(ProcessExited); System.Delegate delTree = new UpdateTreeDelegate(UpdateTree); TreeNode retNode = new TreeNode(); TreeNode retNode2 = new TreeNode(); byte[] dbPipeMsgInData; PipeLoop: while (pipeIn.Read(dbPipeMsgIn, 0, 14) != 0) { strPipeMsgIn = (Glob.PipeHeader)Glob.RawDeserializeEx(dbPipeMsgIn, typeof(Glob.PipeHeader)); if (strPipeMsgIn.datasize != 0) { dbPipeMsgInData = new byte[strPipeMsgIn.datasize]; pipeIn.Read(dbPipeMsgInData, 0, dbPipeMsgInData.Length); switch (strPipeMsgIn.function) { case Glob.FUNC_SEND: case Glob.FUNC_SENDTO: case Glob.FUNC_WSASEND: case Glob.FUNC_WSASENDTO: case Glob.FUNC_WSASENDDISCONNECT: case Glob.FUNC_RECV: case Glob.FUNC_RECVFROM: case Glob.FUNC_WSARECV: case Glob.FUNC_WSARECVFROM: case Glob.FUNC_WSARECVDISCONNECT: try { Invoke(delMainup, dbPipeMsgInData); } catch { } break; case Glob.CONN_RECVFROM: case Glob.CONN_SENDTO: case Glob.CONN_WSARECVFROM: case Glob.CONN_WSASENDTO: case Glob.DNS_GETHOSTBYADDR_IN: case Glob.DNS_GETHOSTBYADDR_OUT: case Glob.DNS_GETHOSTBYNAME_IN: case Glob.DNS_GETHOSTBYNAME_OUT: case Glob.DNS_GETHOSTNAME: case Glob.DNS_WSAASYNCGETHOSTBYADDR_IN: case Glob.DNS_WSAASYNCGETHOSTBYADDR_OUT: case Glob.DNS_WSAASYNCGETHOSTBYNAME_IN: case Glob.DNS_WSAASYNCGETHOSTBYNAME_OUT: case Glob.FUNC_ACCEPT: case Glob.FUNC_BIND: case Glob.FUNC_CLOSESOCKET: case Glob.FUNC_CONNECT: case Glob.FUNC_GETPEERNAME: case Glob.FUNC_GETSOCKNAME: case Glob.FUNC_LISTEN: case Glob.FUNC_SHUTDOWN: case Glob.FUNC_SOCKET_IN: case Glob.FUNC_SOCKET_OUT: case Glob.FUNC_WSAACCEPT: case Glob.FUNC_WSACLEANUP: case Glob.FUNC_WSACONNECT: case Glob.FUNC_WSASOCKETW_IN: case Glob.FUNC_WSASOCKETW_OUT: Invoke(delTree, dbPipeMsgInData); break; } } else { if (strPipeMsgIn.command == Glob.CMD_INIT) { if (strPipeMsgIn.function == Glob.INIT_DECRYPT) if (strPipeMsgIn.extra == 0) { Invoke(delExitProc); MessageBox.Show(this.Owner, "Invalid license.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { strPipeMsgOut.datasize = 0; if (monitor == true) { strPipeMsgOut.command = Glob.CMD_ENABLE_MONITOR; strPipeMsgOut.datasize = 0; writepipe(); } if (filter == true) { strPipeMsgOut.command = Glob.CMD_ENABLE_FILTER; strPipeMsgOut.datasize = 0; writepipe(); } } } else { switch (strPipeMsgIn.function) { case Glob.CONN_RECVFROM: case Glob.CONN_SENDTO: case Glob.CONN_WSARECVFROM: case Glob.CONN_WSASENDTO: case Glob.DNS_GETHOSTBYADDR_IN: case Glob.DNS_GETHOSTBYADDR_OUT: case Glob.DNS_GETHOSTBYNAME_IN: case Glob.DNS_GETHOSTBYNAME_OUT: case Glob.DNS_GETHOSTNAME: case Glob.DNS_WSAASYNCGETHOSTBYADDR_IN: case Glob.DNS_WSAASYNCGETHOSTBYADDR_OUT: case Glob.DNS_WSAASYNCGETHOSTBYNAME_IN: case Glob.DNS_WSAASYNCGETHOSTBYNAME_OUT: case Glob.FUNC_ACCEPT: case Glob.FUNC_BIND: case Glob.FUNC_CLOSESOCKET: case Glob.FUNC_CONNECT: case Glob.FUNC_GETPEERNAME: case Glob.FUNC_GETSOCKNAME: case Glob.FUNC_LISTEN: case Glob.FUNC_SHUTDOWN: case Glob.FUNC_SOCKET_IN: case Glob.FUNC_SOCKET_OUT: case Glob.FUNC_WSAACCEPT: case Glob.FUNC_WSACLEANUP: case Glob.FUNC_WSACONNECT: case Glob.FUNC_WSASOCKETW_IN: case Glob.FUNC_WSASOCKETW_OUT: Invoke(delTree, zero); break; default: // Useless data call with no data if (filter == true) { strPipeMsgOut.command = Glob.CMD_FILTER; strPipeMsgOut.datasize = 0; strPipeMsgOut.extra = 0; // Error writepipe(); } break; } } } } if (pipeIn.IsConnected) goto PipeLoop; Invoke(delExitProc); if (MessageBox.Show("Process Exited.\nTry to reattach?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { if (!Attach(processID, processPath)) { mnuFileDetach.Enabled = false; reAttachToolStripMenuItem.Enabled = true; } } }
/// <summary> /// /// </summary> protected override void OnCreateControl() { this.AcceptsTab = true; this.BackColor = Color.Black; this.DetectUrls = true; this.Dock = DockStyle.Fill; this.Font = new Font( "Lucida Console", 8 ); this.ForeColor = Color.Lime; this.HideSelection = true; this.Multiline = true; //this.RightMargin = TextRenderer.MeasureText( "A", this.Font ).Width * 80; //this.ScrollBars = RichTextBoxScrollBars.ForcedVertical; this.ShortcutsEnabled = true; this.ShowSelectionMargin = false; if ( !this.DesignMode ) { // Delegates for invoked methods ProcessExitedCallback = new ProcessExitedDelegate( ProcessExited ); OutputDataAvailableCallback = new OutputDataAvailableDelegate( OutputDataAvailable ); // scCommandLineHistory holds old command lines for quick reuse scCommandLineHistory = new StringCollection(); // CreateCMDProcess(); } base.OnCreateControl(); }