public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string bugcheckText = parameters;

            if (bugcheckText.Equals(String.Empty))
            {
                return(false);
            }

            NumberParser np = new NumberParser();

            if (!np.Parse(bugcheckText))
            {
                return(false);
            }

            string description = GetBugCheckDescription(np.Decimal);

            if (description != null)
            {
                AddMessage(MessageType.BugCheck,
                           np.Decimal,
                           np.Hex,
                           description,
                           null);

                return(true);
            }

            return(false);
        }
Beispiel #2
0
        public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string winerrorText = parameters;

            if (winerrorText.Equals(String.Empty))
            {
                return(false);
            }

            long         dec;
            string       hex;
            NumberParser np = new NumberParser();

            if (np.Parse(winerrorText))
            {
                dec = np.Decimal;
                hex = np.Hex;
            }
            else
            {
                dec = GetNtStatusNumber(winerrorText);
                if (dec == -1)
                {
                    return(false);
                }
                hex = dec.ToString("X");
            }

            string description = GetWinerrorDescription(dec);

            if (description != null)
            {
                string message = new System.ComponentModel.Win32Exception(Convert.ToInt32(dec)).Message;

                AddMessage(MessageType.WinError,
                           dec,
                           hex,
                           description,
                           message);

                return(true);
            }

            return(false);
        }
        public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string ntstatusText = parameters;

            if (ntstatusText.Equals(String.Empty))
            {
                return(false);
            }

            long         dec;
            string       hex;
            NumberParser np = new NumberParser();

            if (np.Parse(ntstatusText))
            {
                dec = np.Decimal;
                hex = np.Hex;
            }
            else
            {
                dec = GetNtStatusNumber(ntstatusText);
                if (dec == -1)
                {
                    return(false);
                }
                hex = dec.ToString("X");
            }

            string description = GetNtstatusDescription(dec);

            if (description != null)
            {
                AddMessage(MessageType.NTSTATUS,
                           dec,
                           hex,
                           description,
                           null);

                return(true);
            }

            return(false);
        }
        public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string wmText = parameters;

            if (wmText.Equals(String.Empty))
            {
                MsgTrans.MsgOutput.MsgOut(context,
                                          "Please provide a valid window message value or name.");
                return(false);
            }

            NumberParser np = new NumberParser();

            if (np.Parse(wmText))
            {
                Number = np.Decimal;
                Hex    = np.Hex;
                Code   = GetWmDescription(np.Decimal);
            }
            else if ((Number = GetWmNumber(wmText)) != -1)
            {
                // Possibly in "wm <name>" form.
                Hex  = Number.ToString("X");
                Code = wmText;
            }

            if (Code != null)
            {
                MsgType = MessageType.WinMsg;
                Message = null;
                MsgTrans.Messages.Add(this);

                return(true);
            }
            else
            {
                MsgTrans.MsgOutput.MsgOut(context,
                                          String.Format("I don't know about window message: {0}.",
                                                        wmText));
                return(false);
            }
        }
        public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string winerrorText = parameters;

            if (winerrorText.Equals(String.Empty))
            {
                return(false);
            }

            NumberParser np = new NumberParser();

            if (!np.Parse(winerrorText))
            {
                return(false);
            }

            string description = GetWinerrorDescription(np.Decimal);

            if (description != null)
            {
                string message = new System.ComponentModel.Win32Exception(Convert.ToInt32(np.Decimal)).Message;

                AddMessage(MessageType.WinError,
                           np.Decimal,
                           np.Hex,
                           description,
                           message);

                return(true);
            }/*
              * else
              * {
              * MsgTrans.MsgOutput.MsgOut(context,
              *                           String.Format("I don't know about System Error Code {0}.",
              *                                         winerrorText));
              * return false;
              * }*/

            return(false);
        }
        public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string ntstatusText = parameters;

            if (ntstatusText.Equals(String.Empty))
            {
                return(false);
            }

            NumberParser np = new NumberParser();

            if (!np.Parse(ntstatusText))
            {
                return(false);
            }

            string description = GetNtstatusDescription(np.Decimal);

            if (description != null)
            {
                AddMessage(MessageType.NTSTATUS,
                           np.Decimal,
                           np.Hex,
                           description,
                           null);

                return(true);
            }/*
              * else
              * {
              * MsgTrans.MsgOutput.MsgOut(context,
              *                           String.Format("I don't know about NTSTATUS {0}.",
              *                                         ntstatusText));
              *
              * return false;
              * }*/

            return(false);
        }
Beispiel #7
0
        public override bool Handle(MessageContext context,
                                    string commandName,
                                    string parameters)
        {
            string originalErrorText = parameters.Trim();

            if (originalErrorText.Equals(String.Empty))
            {
                return(false);
            }

            string errorText = originalErrorText;

            NumberParser np = new NumberParser();

            if (!np.Parse(errorText))
            {
                return(false);
            }

            // Error is out of bounds
            if ((ulong)np.Decimal > uint.MaxValue)
            {
                // Do nothing
            }
            // Error is outside of the range [0, 65535]: it cannot be a plain Win32 error code
            else if ((ulong)np.Decimal > ushort.MaxValue)
            {
                // Customer bit is set: custom error code
                if (IsCustomer(np.Decimal))
                {
                    string description = String.Format("[custom, severity {0}, facility {1}, code {2}]",
                                                       FormatSeverity(np.Decimal),
                                                       FormatFacility(np.Decimal),
                                                       FormatCode(np.Decimal));
                    AddMessage(MessageType.Custom,
                               np.Decimal,
                               np.Hex,
                               description,
                               null);
                }
                // Reserved bit is set: HRESULT_FROM_NT(ntstatus)
                else if (IsReserved(np.Decimal))
                {
                    int status = (int)(np.Decimal & 0xCFFFFFFF);

                    string description;// = ntStatus.GetNtstatusDescription(status);

                    //if (description == null)
                    description = status.ToString("X");

                    description = String.Format("HRESULT_FROM_NT({0})", description);

                    AddMessage(MessageType.Custom,
                               np.Decimal,
                               np.Hex,
                               description,
                               null);
                }
                // Win32 facility: HRESULT_FROM_WIN32(winerror)
                else if (GetFacility(np.Decimal) == 7)
                {
                    // Must be an error code
                    if (GetSeverity(np.Decimal) == 2)
                    {
                        short  err = GetCode(np.Decimal);
                        string description;// = winerror.GetWinerrorDescription(err);

                        //if (description == null)
                        description = err.ToString("D");

                        description = String.Format("HRESULT_FROM_WIN32({0})", description);

                        AddMessage(MessageType.Custom,
                                   np.Decimal,
                                   np.Hex,
                                   description,
                                   null);
                    }
                }
            }

            return(true);
        }