ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
395 discussions
Start a n
N
ew thread
[gedmurphy] 33097: - Add functionality to the GUI to handle navigating multiple error messages - Fix a few bugs in the assembly
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Tue Apr 22 07:45:18 2008 New Revision: 33097 URL:
http://svn.reactos.org/svn/reactos?rev=33097&view=rev
Log: - Add functionality to the GUI to handle navigating multiple error messages - Fix a few bugs in the assembly Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs trunk/tools/Message Translator/GUI/MainForm.cs trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Mai…
============================================================================== --- trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -152,6 +152,7 @@ this.errorBackButton.TabIndex = 8; this.errorBackButton.Text = "<"; this.errorBackButton.UseVisualStyleBackColor = true; + this.errorBackButton.Click += new System.EventHandler(this.NavigateErrorPage); // // errorForwardButton // @@ -161,6 +162,7 @@ this.errorForwardButton.TabIndex = 7; this.errorForwardButton.Text = ">"; this.errorForwardButton.UseVisualStyleBackColor = true; + this.errorForwardButton.Click += new System.EventHandler(this.NavigateErrorPage); // // errorTypeValueLabel // Modified: trunk/tools/Message Translator/GUI/MainForm.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Mai…
============================================================================== --- trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -1,6 +1,7 @@ using System; using System.Windows.Forms; using System.Configuration; +using System.Collections.Generic; using MsgTrans.Library; using System.Resources; using System.Reflection; @@ -12,6 +13,8 @@ { private static string regPath = @"Software\ReactOS\MsgTrans"; private string[] msgTypes = { "error", "wm", "bug" }; + private List<Command> errMessages; + private int curErrorPage; #region properties private static bool HideOnMin @@ -173,6 +176,30 @@ bugLinkLabel.Location = new System.Drawing.Point(wCenter, hCenter); } + private void UpdateErrorPage(int pageNum) + { + if (errMessages != null && errMessages.Count > 1) + { + if (pageNum > errMessages.Count || pageNum < 0) + return; + + errorTypeValueLabel.Text = errMessages[pageNum - 1].MsgType.ToString(); + errorDecimalTxtBox.Text = errMessages[pageNum - 1].Number.ToString(); + errorHexTxtBox.Text = "0x" + errMessages[pageNum - 1].Hex; + errorCodeTxtBox.Text = errMessages[pageNum - 1].Code; + errorMessageTxtBox.Text = errMessages[pageNum - 1].Message; + + curErrorPage = pageNum; + + // set navigation buttons + errorBackButton.Enabled = errorForwardButton.Enabled = false; + if (curErrorPage < errMessages.Count) + errorForwardButton.Enabled = true; + if (curErrorPage > 1) + errorBackButton.Enabled = true; + } + } + private void GetMessage() { string msgType = GetMessageType(); @@ -188,11 +215,22 @@ string message = msgType + " " + mainErrTxtBox.Text; if (msgTran.ParseCommandMessage(null, message)) { - foreach (Command cmd in msgTran.Messages) + if (msgTran.Messages.Count > 1) { + // if we have more than one, they must be error messages + errMessages = msgTran.Messages; + UpdateErrorPage(1); + } + else + { + if (errMessages != null) + errMessages.Clear(); + + Command cmd = msgTran.Messages[0]; + if (cmd.MsgType == MessageType.WinError || - cmd.MsgType == MessageType.HResult || - cmd.MsgType == MessageType.NTStatus || + cmd.MsgType == MessageType.HRESULT || + cmd.MsgType == MessageType.NTSTATUS || cmd.MsgType == MessageType.Custom) { errorTypeValueLabel.Text = cmd.MsgType.ToString(); @@ -228,6 +266,7 @@ private void MainForm_Load(object sender, EventArgs e) { // setup error page + curErrorPage = 1; errorBackButton.Enabled = false; errorForwardButton.Enabled = false; @@ -335,6 +374,20 @@ } } } + + private void NavigateErrorPage(object sender, EventArgs e) + { + Button btn = (Button)sender; + + if (btn.Name == "errorForwardButton") + { + UpdateErrorPage(curErrorPage + 1); + } + else if (btn.Name == "errorBackButton") + { + UpdateErrorPage(curErrorPage - 1); + } + } } public class MessageOutput : IMsgOutput Modified: trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -71,8 +71,6 @@ string originalErrorText = parameters.Trim(); if (originalErrorText.Equals(String.Empty)) { - MsgTrans.MsgOutput.MsgOut(context, - "Please provide an Error Code."); return false; } @@ -81,13 +79,8 @@ NumberParser np = new NumberParser(); if (!np.Parse(errorText)) { - MsgTrans.MsgOutput.MsgOut(context, - String.Format("{0} is not a valid Error Code.", - originalErrorText)); return false; } - - //ArrayList descriptions = new ArrayList(); // Error is out of bounds if ((ulong)np.Decimal > uint.MaxValue) Modified: trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -7,10 +7,6 @@ { public class ErrorCommand : Command { - private NtStatusCommand ntStatus; - private WinerrorCommand winerror; - private HResultCommand hresult; - private CustomCommand custom; private List<Command> errorCommands = new List<Command>(); public ErrorCommand(MessageTranslator msgTrans, @@ -19,8 +15,8 @@ string hresultXml) : base(msgTrans) { + errorCommands.Add(new WinerrorCommand(msgTrans, winerrorXml)); errorCommands.Add(new NtStatusCommand(msgTrans, ntstatusXml)); - errorCommands.Add(new WinerrorCommand(msgTrans, winerrorXml)); errorCommands.Add(new HResultCommand(msgTrans, hresultXml)); errorCommands.Add(new CustomCommand(msgTrans)); } @@ -55,7 +51,7 @@ } MsgTrans.MsgOutput.MsgOut(context, - String.Format("I don't know about Error Code {0}.", + String.Format("[{0}] is not a valid error code", parameters.Trim())); return false; } Modified: trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -21,39 +21,27 @@ string commandName, string parameters) { - /* - string hresultDescription = hresult.GetHresultDescription(np.Decimal); - if (hresultDescription != null) - { - AddErrorCommand(MessageType.HResult, - np.Decimal, - np.Hex, - hresultDescription, - null); - } - */ string hresultText = parameters; if (hresultText.Equals(String.Empty)) { - MsgTrans.MsgOutput.MsgOut(context, - "Please provide a valid HRESULT value."); return false; } NumberParser np = new NumberParser(); if (!np.Parse(hresultText)) { - MsgTrans.MsgOutput.MsgOut(context, - String.Format("{0} is not a valid HRESULT value.", - hresultText)); return false; } string description = GetHresultDescription(np.Decimal); if (description != null) { - Number = np.Decimal; - Code = description; + AddMessage(MessageType.HRESULT, + np.Decimal, + np.Hex, + description, + null); + return true; }/* else Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -44,7 +44,6 @@ </Target> --> <ItemGroup> - <Compile Include="BugUrlCommandl.cs" /> <Compile Include="BugCommand.cs" /> <Compile Include="CustomCommand.cs" /> <Compile Include="XmlCommand.cs" /> Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -17,11 +17,11 @@ // // Summary: // A HRESULT status code. - HResult = 1, + HRESULT = 1, // // Summary: // An NTSTATUS status code - NTStatus = 2, + NTSTATUS = 2, // // Summary: // a STOP/Bug Check code Modified: trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -23,24 +23,19 @@ string ntstatusText = parameters; if (ntstatusText.Equals(String.Empty)) { - MsgTrans.MsgOutput.MsgOut(context, - "Please provide a valid NTSTATUS value."); return false; } NumberParser np = new NumberParser(); if (!np.Parse(ntstatusText)) { - MsgTrans.MsgOutput.MsgOut(context, - String.Format("{0} is not a valid NTSTATUS value.", - ntstatusText)); return false; } string description = GetNtstatusDescription(np.Decimal); if (description != null) { - AddMessage(MessageType.NTStatus, + AddMessage(MessageType.NTSTATUS, np.Decimal, np.Hex, description, Modified: trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] Tue Apr 22 07:45:18 2008 @@ -24,17 +24,12 @@ string winerrorText = parameters; if (winerrorText.Equals(String.Empty)) { - MsgTrans.MsgOutput.MsgOut(context, - "Please provide a valid System Error Code value."); return false; } NumberParser np = new NumberParser(); if (!np.Parse(winerrorText)) { - MsgTrans.MsgOutput.MsgOut(context, - String.Format("{0} is not a valid System Error Code value.", - winerrorText)); return false; }
16 years, 8 months
1
0
0
0
[gedmurphy] 33096: More reworking of the translator assembly. It's much more extensible now.
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Tue Apr 22 07:05:37 2008 New Revision: 33096 URL:
http://svn.reactos.org/svn/reactos?rev=33096&view=rev
Log: More reworking of the translator assembly. It's much more extensible now. Added: trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs Modified: trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs trunk/tools/Message Translator/MsgTrans.Library/Command.cs trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs Modified: trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -2,7 +2,7 @@ namespace MsgTrans.Library { - public abstract class BugCommand : Command//, ICommand + public class BugCommand : Command { string bugUrl; @@ -11,6 +11,11 @@ : base(msgTrans) { this.bugUrl = bugUrl; + } + + public override string[] AvailableCommands + { + get { return new string[] { "bug" }; } } public override bool Handle(MessageContext context, Modified: trunk/tools/Message Translator/MsgTrans.Library/Command.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/Command.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/Command.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -51,6 +51,20 @@ this.msgTrans = msgTrans; } + protected void AddMessage(MessageType msgType, + long dec, + string hex, + string code, + string msg) + { + MsgType = msgType; + Number = dec; + Hex = hex; + Code = code; + Message = msg; + MsgTrans.Messages.Add(this); + } + public abstract bool Handle(MessageContext context, string commandName, string parameters); Added: trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs (added) +++ trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -1,0 +1,157 @@ +using System; + +namespace MsgTrans.Library +{ + public class CustomCommand : Command + { + public CustomCommand(MessageTranslator msgTrans) + : base(msgTrans) + { + } + + public override string[] AvailableCommands + { + get { return new string[] { "custom" }; } + } + + private int GetSeverity(long error) + { + return (int)((error >> 30) & 0x3); + } + + private bool IsCustomer(long error) + { + return (error & 0x20000000) != 0; + } + + private bool IsReserved(long error) + { + return (error & 0x10000000) != 0; + } + + private int GetFacility(long error) + { + return (int)((error >> 16) & 0xFFF); + } + + private short GetCode(long error) + { + return (short)((error >> 0) & 0xFFFF); + } + + private string FormatSeverity(long error) + { + int severity = GetSeverity(error); + switch (severity) + { + case 0: return "SUCCESS"; + case 1: return "INFORMATIONAL"; + case 2: return "WARNING"; + case 3: return "ERROR"; + } + return null; + } + + private string FormatFacility(long error) + { + int facility = GetFacility(error); + return facility.ToString(); + } + + private string FormatCode(long error) + { + int code = GetCode(error); + return code.ToString(); + } + + public override bool Handle(MessageContext context, + string commandName, + string parameters) + { + string originalErrorText = parameters.Trim(); + if (originalErrorText.Equals(String.Empty)) + { + MsgTrans.MsgOutput.MsgOut(context, + "Please provide an Error Code."); + return false; + } + + string errorText = originalErrorText; + + NumberParser np = new NumberParser(); + if (!np.Parse(errorText)) + { + MsgTrans.MsgOutput.MsgOut(context, + String.Format("{0} is not a valid Error Code.", + originalErrorText)); + return false; + } + + //ArrayList descriptions = new ArrayList(); + + // 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; + } + } +} Modified: trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -10,6 +10,7 @@ private NtStatusCommand ntStatus; private WinerrorCommand winerror; private HResultCommand hresult; + private CustomCommand custom; private List<Command> errorCommands = new List<Command>(); public ErrorCommand(MessageTranslator msgTrans, @@ -18,9 +19,10 @@ string hresultXml) : base(msgTrans) { - ntStatus = new NtStatusCommand(msgTrans, ntstatusXml); - winerror = new WinerrorCommand(msgTrans, winerrorXml); - hresult = new HResultCommand(msgTrans, hresultXml); + errorCommands.Add(new NtStatusCommand(msgTrans, ntstatusXml)); + errorCommands.Add(new WinerrorCommand(msgTrans, winerrorXml)); + errorCommands.Add(new HResultCommand(msgTrans, hresultXml)); + errorCommands.Add(new CustomCommand(msgTrans)); } public override string[] AvailableCommands @@ -28,187 +30,19 @@ get { return new string[] { "error" }; } } - private static int GetSeverity(long error) - { - return (int)((error >> 30) & 0x3); - } - - private static bool IsCustomer(long error) - { - return (error & 0x20000000) != 0; - } - - private static bool IsReserved(long error) - { - return (error & 0x10000000) != 0; - } - - private static int GetFacility(long error) - { - return (int)((error >> 16) & 0xFFF); - } - - private static short GetCode(long error) - { - return (short)((error >> 0) & 0xFFFF); - } - - private static string FormatSeverity(long error) - { - int severity = GetSeverity(error); - switch (severity) - { - case 0: return "SUCCESS"; - case 1: return "INFORMATIONAL"; - case 2: return "WARNING"; - case 3: return "ERROR"; - } - return null; - } - - private static string FormatFacility(long error) - { - int facility = GetFacility(error); - return facility.ToString(); - } - - private static string FormatCode(long error) - { - int code = GetCode(error); - return code.ToString(); - } - - private void AddErrorCommand(MessageType msgType, - long dec, - string hex, - string code, - string msg) - { - MsgType = msgType; - Number = dec; - Hex = hex; - Code = code; - Message = msg; - MsgTrans.Messages.Add(this); - } - public override bool Handle(MessageContext context, string commandName, string parameters) { - string originalErrorText = parameters.Trim(); - if (originalErrorText.Equals(String.Empty)) - { - MsgTrans.MsgOutput.MsgOut(context, - "Please provide an Error Code."); - return false; - } - - string errorText = originalErrorText; + string errorText = parameters.Trim(); retry: - NumberParser np = new NumberParser(); - if (!np.Parse(errorText)) + + foreach (Command command in errorCommands) { - MsgTrans.MsgOutput.MsgOut(context, - String.Format("{0} is not a valid Error Code.", - originalErrorText)); - return false; - } - - ArrayList descriptions = new ArrayList(); - - // 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)); - AddErrorCommand(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); - - AddErrorCommand(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); - - AddErrorCommand(MessageType.Custom, - np.Decimal, - np.Hex, - description, - null); - } - } - } - - string winerrorDescription = winerror.GetWinerrorDescription(np.Decimal); - if (winerrorDescription != null) - { - string message = new System.ComponentModel.Win32Exception(Convert.ToInt32(np.Decimal)).Message; - - AddErrorCommand(MessageType.WinError, - np.Decimal, - np.Hex, - winerrorDescription, - message); - } - - string ntstatusDescription = ntStatus.GetNtstatusDescription(np.Decimal); - if (ntstatusDescription != null) - { - AddErrorCommand(MessageType.NTStatus, - np.Decimal, - np.Hex, - ntstatusDescription, - null); - } - - string hresultDescription = hresult.GetHresultDescription(np.Decimal); - if (hresultDescription != null) - { - AddErrorCommand(MessageType.HResult, - np.Decimal, - np.Hex, - hresultDescription, - null); + command.Handle(context, + commandName, + errorText); } if (MsgTrans.Messages.Count == 0) @@ -222,16 +56,16 @@ MsgTrans.MsgOutput.MsgOut(context, String.Format("I don't know about Error Code {0}.", - originalErrorText)); + parameters.Trim())); return false; } - + return true; } public override string Help() { - return "!error <value>"; + return "error <value>"; } } } Modified: trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -21,6 +21,17 @@ string commandName, string parameters) { + /* + string hresultDescription = hresult.GetHresultDescription(np.Decimal); + if (hresultDescription != null) + { + AddErrorCommand(MessageType.HResult, + np.Decimal, + np.Hex, + hresultDescription, + null); + } + */ string hresultText = parameters; if (hresultText.Equals(String.Empty)) { @@ -44,14 +55,16 @@ Number = np.Decimal; Code = description; return true; - } + }/* else { MsgTrans.MsgOutput.MsgOut(context, String.Format("I don't know about HRESULT {0}.", hresultText)); return false; - } + }*/ + + return false; } public override string Help() Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -46,6 +46,7 @@ <ItemGroup> <Compile Include="BugUrlCommandl.cs" /> <Compile Include="BugCommand.cs" /> + <Compile Include="CustomCommand.cs" /> <Compile Include="XmlCommand.cs" /> <Compile Include="ErrorCommand.cs" /> <Compile Include="HresultCommand.cs" /> Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -58,7 +58,7 @@ { get { return msgOutput; } } - public IList<Command> Messages + public List<Command> Messages { get { return messages; } } @@ -78,7 +78,7 @@ winerrorXml, hresultXml)); commands.Add(new WMCommand(this, wmXml)); - commands.Add(new BugUrl(this, bugUrl)); + commands.Add(new BugCommand(this, bugUrl)); } public bool ParseCommandMessage(MessageContext context, Modified: trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -40,10 +40,14 @@ string description = GetNtstatusDescription(np.Decimal); if (description != null) { - Number = np.Decimal; - Code = description; + AddMessage(MessageType.NTStatus, + np.Decimal, + np.Hex, + description, + null); + return true; - } + }/* else { MsgTrans.MsgOutput.MsgOut(context, @@ -51,7 +55,9 @@ ntstatusText)); return false; - } + }*/ + + return false; } public override string Help() Modified: trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] Tue Apr 22 07:05:37 2008 @@ -20,6 +20,7 @@ string commandName, string parameters) { + string winerrorText = parameters; if (winerrorText.Equals(String.Empty)) { @@ -40,17 +41,25 @@ string description = GetWinerrorDescription(np.Decimal); if (description != null) { - Number = np.Decimal; - Code = description; + 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 string Help()
16 years, 8 months
1
0
0
0
[gedmurphy] 33095: partially refactor the workings of the translator assembly to better handle multiple messages
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Tue Apr 22 04:12:01 2008 New Revision: 33095 URL:
http://svn.reactos.org/svn/reactos?rev=33095&view=rev
Log: partially refactor the workings of the translator assembly to better handle multiple messages Modified: trunk/tools/Message Translator/GUI/MainForm.cs trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs trunk/tools/Message Translator/MsgTrans.Library/Command.cs trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs Modified: trunk/tools/Message Translator/GUI/MainForm.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Mai…
============================================================================== --- trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -146,6 +146,12 @@ MessageOutput mo = new MessageOutput(); mo.MsgOut(null, ex.Message); } + } + + private void SendToTray() + { + Hide(); + notifyIcon.Visible = true; } private string GetMessageType() @@ -182,27 +188,33 @@ string message = msgType + " " + mainErrTxtBox.Text; if (msgTran.ParseCommandMessage(null, message)) { - if (msgType == msgTypes[0]) // error + foreach (Command cmd in msgTran.Messages) { - errorTypeValueLabel.Text = msgTran.Type; - errorDecimalTxtBox.Text = msgTran.Number.ToString(); - errorHexTxtBox.Text = "0x" + msgTran.Hex; - errorCodeTxtBox.Text = msgTran.Code; - errorMessageTxtBox.Text = msgTran.Message; - } - else if (msgType == msgTypes[1]) // wm - { - wndmsgDecimalTxtBox.Text = msgTran.Number.ToString(); - wndmsgHexTxtBox.Text = "0x" + msgTran.Hex; - wndmsgCodeTxtBox.Text = msgTran.Code; - } - else if (msgType == msgTypes[2]) // bug - { - bugLinkLabel.Text = "Click here for bug " + msgTran.Number; - bugLinkLabel.Links[0].LinkData = msgTran.BugUrl; - bugLinkLabel.Links[0].Visited = false; - - SetBugurlPosition(); + if (cmd.MsgType == MessageType.WinError || + cmd.MsgType == MessageType.HResult || + cmd.MsgType == MessageType.NTStatus || + cmd.MsgType == MessageType.Custom) + { + errorTypeValueLabel.Text = cmd.MsgType.ToString(); + errorDecimalTxtBox.Text = cmd.Number.ToString(); + errorHexTxtBox.Text = "0x" + cmd.Hex; + errorCodeTxtBox.Text = cmd.Code; + errorMessageTxtBox.Text = cmd.Message; + } + else if (cmd.MsgType == MessageType.WinMsg) + { + wndmsgDecimalTxtBox.Text = cmd.Number.ToString(); + wndmsgHexTxtBox.Text = "0x" + cmd.Hex; + wndmsgCodeTxtBox.Text = cmd.Code; + } + else if (cmd.MsgType == MessageType.BugUrl) + { + bugLinkLabel.Text = "Click here for bug " + cmd.Number; + bugLinkLabel.Links[0].LinkData = cmd.Code; + bugLinkLabel.Links[0].Visited = false; + + SetBugurlPosition(); + } } } } @@ -227,8 +239,15 @@ optionsMinimizeChkBox.Checked = HideOnMin; optionsRunStartChkBox.Checked = RunOnStart; notifyIcon.Visible = false; - - toolTip.SetToolTip(mainErrTxtBox, Properties.Resources.tooltipErrMsg); + /* + if (HideOnMin) + { + // FIXME: hide correctly + this.WindowState = FormWindowState.Minimized; + SendToTray(); + }*/ + + //toolTip.SetToolTip(mainErrTxtBox, Properties.Resources.tooltipErrMsg); //toolTip.SetToolTip(mainWndMsgRadio, Properties.Resources.tooltipWndMsg); //toolTip.SetToolTip(mainBugMsgRadio, Properties.Resources.tooltipBug); //toolTip.SetToolTip(mainOptionsRadio, Properties.Resources.tooltipOpt); @@ -243,13 +262,9 @@ private void MainForm_Resize(object sender, EventArgs e) { - if (FormWindowState.Minimized == WindowState) - { - if (HideOnMin) - { - Hide(); - notifyIcon.Visible = true; - } + if (FormWindowState.Minimized == WindowState && HideOnMin) + { + SendToTray(); } } Modified: trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/BugCommand.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -11,11 +11,6 @@ : base(msgTrans) { this.bugUrl = bugUrl; - } - - public string BugUrl - { - get { return bugUrl; } } public override bool Handle(MessageContext context, @@ -39,8 +34,14 @@ return false; } - MsgTrans.Number = np.Decimal; - MsgTrans.BugUrl = String.Format(BugUrl, np.Decimal); + string url = String.Format(bugUrl, np.Decimal); + + MsgType = MessageType.BugUrl; + Number = np.Decimal; + Hex = np.Hex; + Code = url; + Message = null; + MsgTrans.Messages.Add(this); return true; } Modified: trunk/tools/Message Translator/MsgTrans.Library/Command.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/Command.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/Command.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -6,18 +6,50 @@ public abstract class Command { protected MessageTranslator msgTrans = null; + private MessageType messageType; + private long number; + private string hex; + private string code; + private string message; + + #region properties + public MessageType MsgType + { + get { return messageType; } + set { messageType = value; } + } + public long Number + { + get { return number; } + set { number = value; } + } + public string Hex + { + get { return hex; } + set { hex = value; } + } + public string Code + { + get { return code; } + set { code = value; } + } + public string Message + { + get { return message; } + set { message = value; } + } + public MessageTranslator MsgTrans + { + get { return msgTrans; } + } + #endregion + + public abstract string[] AvailableCommands { get; } public Command(MessageTranslator msgTrans) { this.msgTrans = msgTrans; } - - public MessageTranslator MsgTrans - { - get { return msgTrans; } - } - - public abstract string[] AvailableCommands { get; } public abstract bool Handle(MessageContext context, string commandName, Modified: trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -1,6 +1,7 @@ using System; using System.Xml; using System.Collections; +using System.Collections.Generic; namespace MsgTrans.Library { @@ -9,6 +10,7 @@ private NtStatusCommand ntStatus; private WinerrorCommand winerror; private HResultCommand hresult; + private List<Command> errorCommands = new List<Command>(); public ErrorCommand(MessageTranslator msgTrans, string ntstatusXml, @@ -16,9 +18,9 @@ string hresultXml) : base(msgTrans) { - this.ntStatus = new NtStatusCommand(msgTrans, ntstatusXml); - this.winerror = new WinerrorCommand(msgTrans, winerrorXml); - this.hresult = new HResultCommand(msgTrans, hresultXml); + ntStatus = new NtStatusCommand(msgTrans, ntstatusXml); + winerror = new WinerrorCommand(msgTrans, winerrorXml); + hresult = new HResultCommand(msgTrans, hresultXml); } public override string[] AvailableCommands @@ -76,6 +78,20 @@ return code.ToString(); } + private void AddErrorCommand(MessageType msgType, + long dec, + string hex, + string code, + string msg) + { + MsgType = msgType; + Number = dec; + Hex = hex; + Code = code; + Message = msg; + MsgTrans.Messages.Add(this); + } + public override bool Handle(MessageContext context, string commandName, string parameters) @@ -117,7 +133,11 @@ FormatSeverity(np.Decimal), FormatFacility(np.Decimal), FormatCode(np.Decimal)); - descriptions.Add(description); + AddErrorCommand(MessageType.Custom, + np.Decimal, + np.Hex, + description, + null); } // Reserved bit is set: HRESULT_FROM_NT(ntstatus) else if (IsReserved(np.Decimal)) @@ -127,9 +147,14 @@ if (description == null) description = status.ToString("X"); - + description = String.Format("HRESULT_FROM_NT({0})", description); - descriptions.Add(description); + + AddErrorCommand(MessageType.Custom, + np.Decimal, + np.Hex, + description, + null); } // Win32 facility: HRESULT_FROM_WIN32(winerror) else if (GetFacility(np.Decimal) == 7) @@ -144,33 +169,49 @@ description = err.ToString("D"); description = String.Format("HRESULT_FROM_WIN32({0})", description); - descriptions.Add(description); + + AddErrorCommand(MessageType.Custom, + np.Decimal, + np.Hex, + description, + null); } } } string winerrorDescription = winerror.GetWinerrorDescription(np.Decimal); + if (winerrorDescription != null) + { + string message = new System.ComponentModel.Win32Exception(Convert.ToInt32(np.Decimal)).Message; + + AddErrorCommand(MessageType.WinError, + np.Decimal, + np.Hex, + winerrorDescription, + message); + } + string ntstatusDescription = ntStatus.GetNtstatusDescription(np.Decimal); + if (ntstatusDescription != null) + { + AddErrorCommand(MessageType.NTStatus, + np.Decimal, + np.Hex, + ntstatusDescription, + null); + } + string hresultDescription = hresult.GetHresultDescription(np.Decimal); - - //FIXME: don't hardcode names here - if (winerrorDescription != null) - { - descriptions.Add(winerrorDescription); - MsgTrans.Type = "WinError"; - } - else if (ntstatusDescription != null) - { - descriptions.Add(ntstatusDescription); - MsgTrans.Type = "NTSTATUS"; - } - else if (hresultDescription != null) - { - descriptions.Add(hresultDescription); - MsgTrans.Type = "HRESULT"; - } - - if (descriptions.Count == 0) + if (hresultDescription != null) + { + AddErrorCommand(MessageType.HResult, + np.Decimal, + np.Hex, + hresultDescription, + null); + } + + if (MsgTrans.Messages.Count == 0) { // Last chance heuristics: attempt to parse a 8-digit decimal as hexadecimal if (errorText.Length == 8) @@ -180,37 +221,12 @@ } MsgTrans.MsgOutput.MsgOut(context, - String.Format("I don't know about Error Code {0}.", - originalErrorText)); + String.Format("I don't know about Error Code {0}.", + originalErrorText)); return false; } - else //if (descriptions.Count == 1) -- FIXME: implement multiple values - { - string description = (string)descriptions[0]; - MsgTrans.Code = description; - MsgTrans.Number = np.Decimal; - MsgTrans.Hex = np.Hex; - - MsgTrans.Message = string.Empty; - if (winerrorDescription != null) - { - string message = new System.ComponentModel.Win32Exception(Convert.ToInt32(np.Decimal)).Message; - MsgTrans.Message = message; - } - - return true; - }/* - else - { - MsgTrans.MsgOutput.MsgOut(context, - String.Format("{0} could be:", - originalErrorText)); - - foreach(string description in descriptions) - MsgTrans.MsgOutput.MsgOut(context, String.Format("\t{0}", description)); - - return true; - }*/ + + return true; } public override string Help() Modified: trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -41,8 +41,8 @@ string description = GetHresultDescription(np.Decimal); if (description != null) { - MsgTrans.Number = np.Decimal; - MsgTrans.Code = description; + Number = np.Decimal; + Code = description; return true; } else Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -7,16 +7,46 @@ namespace MsgTrans.Library { + // Summary: + // Specifies the type of message returned + public enum MessageType + { + // Summary: + // A Win32 error + WinError = 0, + // + // Summary: + // A HRESULT status code. + HResult = 1, + // + // Summary: + // An NTSTATUS status code + NTStatus = 2, + // + // Summary: + // a STOP/Bug Check code + BugCheck = 3, + // + // Summary: + // a Windows Message code + WinMsg = 4, + // + // Summary: + // a Bug Url + BugUrl = 5, + // + // Summary: + // a custom Check code + Custom = 6 + } + public class MessageTranslator { private IMsgOutput msgOutput; private List<Command> commands = new List<Command>(); - private string bugUrl; + private List<Command> messages = new List<Command>(); private string type; - private long number; - private string hex; - private string code; - private string message; + #region properties public string Type @@ -24,38 +54,13 @@ get { return type; } set { type = value; } } - public long Number - { - get { return number; } - set { number = value; } - } - public string Hex - { - get { return hex; } - set { hex = value; } - } - public string Code - { - get { return code; } - set { code = value; } - } - public string Message - { - get { return message; } - set { message = value; } - } - public string BugUrl - { - get { return bugUrl; } - set { bugUrl = value; } - } public IMsgOutput MsgOutput { get { return msgOutput; } } - public IList<Command> Commands + public IList<Command> Messages { - get { return commands; } + get { return messages; } } #endregion Modified: trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -40,8 +40,8 @@ string description = GetNtstatusDescription(np.Decimal); if (description != null) { - MsgTrans.Number = np.Decimal; - MsgTrans.Code = description; + Number = np.Decimal; + Code = description; return true; } else Modified: trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -40,8 +40,8 @@ string description = GetWinerrorDescription(np.Decimal); if (description != null) { - MsgTrans.Number = np.Decimal; - MsgTrans.Code = description; + Number = np.Decimal; + Code = description; return true; } else Modified: trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs [iso-8859-1] Tue Apr 22 04:12:01 2008 @@ -30,32 +30,31 @@ } NumberParser np = new NumberParser(); - - string code; - long num; if (np.Parse(wmText)) { - num = np.Decimal; - code = GetWmDescription(np.Decimal); + Number = np.Decimal; + Hex = np.Hex; + Code = GetWmDescription(np.Decimal); } - else + else if ((Number = GetWmNumber(wmText)) != -1) { // Possibly in "wm <name>" form. - num = GetWmNumber(wmText); - code = wmText; + Hex = Number.ToString("X"); + Code = wmText; } - if (code != null) + if (Code != null) { - MsgTrans.Number = num; - MsgTrans.Hex = num.ToString("X"); - MsgTrans.Code = code; + 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}.", + String.Format("I don't know about window message: {0}.", wmText)); return false; }
16 years, 8 months
1
0
0
0
[hpoussin] 33094: Change default intermediate directory to obj directory.
by hpoussin@svn.reactos.org
Author: hpoussin Date: Tue Apr 22 00:52:18 2008 New Revision: 33094 URL:
http://svn.reactos.org/svn/reactos?rev=33094&view=rev
Log: Change default intermediate directory to obj directory. Modified: trunk/reactos/Makefile Modified: trunk/reactos/Makefile URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/Makefile?rev=33094&r1=3309…
============================================================================== --- trunk/reactos/Makefile [iso-8859-1] (original) +++ trunk/reactos/Makefile [iso-8859-1] Tue Apr 22 00:52:18 2008 @@ -83,7 +83,7 @@ # are (usually small) generated files that are needed to generate the # intermediate or final output files. Examples of temporary files include # *.rci (preprocessed .rc files for wrc), *.tmp, and *.exp. N.B. Don't put -# a path separator at the end. The variable defaults to the current +# a path separator at the end. The variable defaults to {ROS_INTERMEDIATE} # directory. # # ROS_INSTALL @@ -351,7 +351,7 @@ ifneq ($(ROS_TEMPORARY),) TEMPORARY := $(ROS_TEMPORARY) else - TEMPORARY := . + TEMPORARY := $(INTERMEDIATE) endif TEMPORARY_ := $(TEMPORARY)$(SEP)
16 years, 8 months
1
0
0
0
[janderwald] 33093: - add a proxy idl file - should fix the circual dependency
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Apr 21 17:49:48 2008 New Revision: 33093 URL:
http://svn.reactos.org/svn/reactos?rev=33093&view=rev
Log: - add a proxy idl file - should fix the circual dependency Added: trunk/reactos/dll/win32/msi/msiserver_v2.idl (with props) Modified: trunk/reactos/dll/win32/msi/msi.rbuild Modified: trunk/reactos/dll/win32/msi/msi.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi.rbuild?r…
============================================================================== --- trunk/reactos/dll/win32/msi/msi.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msi.rbuild [iso-8859-1] Mon Apr 21 17:49:48 2008 @@ -1,3 +1,6 @@ +<module name="msi_msiserver_typelib" type="embeddedtypelib" allowwarnings="true"> + <file>msiserver_v2.idl</file> +</module> <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <group> @@ -6,9 +9,11 @@ <importlibrary definition="msi.spec.def" /> <include base="msi">.</include> <include base="ReactOS">include/reactos/wine</include> + <include base="msi" root="intermediate">.</include> <define name="__WINESRC__" /> <define name="WINVER">0x600</define> <define name="_WIN32_WINNT">0x600</define> + <dependency>msi_msiserver_typelib</dependency> <file>action.c</file> <file>alter.c</file> <file>appsearch.c</file> @@ -52,7 +57,6 @@ <file>where.c</file> <file>msiserver.idl</file> <file>msi.rc</file> - <include base="msi" root="intermediate">.</include> <file>msi.spec</file> <library>wine</library> <library>urlmon</library> @@ -71,9 +75,5 @@ <library>odbccp32</library> <library>uuid</library> <library>ntdll</library> - <dependency>msi_msiserver_typelib</dependency> </module> -<module name="msi_msiserver_typelib" type="embeddedtypelib" allowwarnings="true"> - <file>msiserver.idl</file> -</module> -</group> +</group> Added: trunk/reactos/dll/win32/msi/msiserver_v2.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msiserver_v2…
============================================================================== --- trunk/reactos/dll/win32/msi/msiserver_v2.idl (added) +++ trunk/reactos/dll/win32/msi/msiserver_v2.idl [iso-8859-1] Mon Apr 21 17:49:48 2008 @@ -1,0 +1,1 @@ +#include "msiserver.idl" Propchange: trunk/reactos/dll/win32/msi/msiserver_v2.idl ------------------------------------------------------------------------------ svn:eol-style = native
16 years, 8 months
1
0
0
0
[fireball] 33092: - The address space lock is a pushlock -- pushlocks can fail if callers are acquiring them without first disabling APCs, so they should always be acquired within a critical region. Fix the address space lock to do this. - Don't keep track of the page table reference count table in the address space structure, nobody was using this. - Instead of using either a global kernel pushlock for the kernel address space, and a per-process lock for process address space, always use a per-
by fireball@svn.reactos.org
Author: fireball Date: Mon Apr 21 16:42:00 2008 New Revision: 33092 URL:
http://svn.reactos.org/svn/reactos?rev=33092&view=rev
Log: - The address space lock is a pushlock -- pushlocks can fail if callers are acquiring them without first disabling APCs, so they should always be acquired within a critical region. Fix the address space lock to do this. - Don't keep track of the page table reference count table in the address space structure, nobody was using this. - Instead of using either a global kernel pushlock for the kernel address space, and a per-process lock for process address space, always use a per-process lock (the kernel address space uses the idle process' lock). - Instead of acquiring/releasing the lock by dereferencing the process which owns the address space, hold a pointer to the lock directly. This removes an extra dereference, and also allows the kernel lock to work (because kernel address space doesn't have an associated process). - Inline the lock acquisition/release functions and the get-address-space functions. - Measured a 20% performance boost during boot-up, and 150% during installation. - Patch by Alex. Modified: trunk/reactos/ntoskrnl/include/internal/mm.h trunk/reactos/ntoskrnl/mm/aspace.c Modified: trunk/reactos/ntoskrnl/include/internal/mm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Mon Apr 21 16:42:00 2008 @@ -254,9 +254,9 @@ { PMEMORY_AREA MemoryAreaRoot; PVOID LowestAddress; - struct _EPROCESS* Process; + PEPROCESS Process; PUSHORT PageTableRefCountTable; - ULONG PageTableRefCountTableSize; + PEX_PUSH_LOCK Lock; } MADDRESS_SPACE, *PMADDRESS_SPACE; typedef struct @@ -394,23 +394,7 @@ VOID NTAPI -MmLockAddressSpace(PMADDRESS_SPACE AddressSpace); - -VOID -NTAPI -MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace); - -VOID -NTAPI MmInitializeKernelAddressSpace(VOID); - -PMADDRESS_SPACE -NTAPI -MmGetCurrentAddressSpace(VOID); - -PMADDRESS_SPACE -NTAPI -MmGetKernelAddressSpace(VOID); NTSTATUS NTAPI @@ -1584,4 +1568,37 @@ MmUpdatePageDir((PEPROCESS)Process, Address, Size); } + +extern MADDRESS_SPACE MmKernelAddressSpace; + +FORCEINLINE +VOID +MmLockAddressSpace(PMADDRESS_SPACE AddressSpace) +{ + KeEnterCriticalRegion(); + ExAcquirePushLockExclusive(AddressSpace->Lock); +} + +FORCEINLINE +VOID +MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace) +{ + ExReleasePushLock(AddressSpace->Lock); + KeLeaveCriticalRegion(); +} + +FORCEINLINE +PMADDRESS_SPACE +MmGetCurrentAddressSpace(VOID) +{ + return (PMADDRESS_SPACE)&((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->VadRoot; +} + +FORCEINLINE +PMADDRESS_SPACE +MmGetKernelAddressSpace(VOID) +{ + return &MmKernelAddressSpace; +} + #endif Modified: trunk/reactos/ntoskrnl/mm/aspace.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/aspace.c?rev=3…
============================================================================== --- trunk/reactos/ntoskrnl/mm/aspace.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/aspace.c [iso-8859-1] Mon Apr 21 16:42:00 2008 @@ -19,59 +19,19 @@ /* GLOBALS ******************************************************************/ -static MADDRESS_SPACE KernelAddressSpace; -EX_PUSH_LOCK KernelAddressSpaceLock; +MADDRESS_SPACE MmKernelAddressSpace; + +ULONGLONG Cycles; +ULONG TimeDelta; /* FUNCTIONS *****************************************************************/ - -VOID -NTAPI -MmLockAddressSpace(PMADDRESS_SPACE AddressSpace) -{ - if (AddressSpace->Process) - { - ExAcquirePushLockExclusive((PEX_PUSH_LOCK)&AddressSpace->Process->AddressCreationLock); - } - else - { - ExAcquirePushLockExclusive(&KernelAddressSpaceLock); - } -} - -VOID -NTAPI -MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace) -{ - if (AddressSpace->Process) - { - ExReleasePushLock((PEX_PUSH_LOCK)&AddressSpace->Process->AddressCreationLock); - } - else - { - ExReleasePushLock(&KernelAddressSpaceLock); - } -} VOID INIT_FUNCTION NTAPI MmInitializeKernelAddressSpace(VOID) { - MmInitializeAddressSpace(NULL, &KernelAddressSpace); -} - -PMADDRESS_SPACE -NTAPI -MmGetCurrentAddressSpace(VOID) -{ - return((PMADDRESS_SPACE)&(PsGetCurrentProcess())->VadRoot); -} - -PMADDRESS_SPACE -NTAPI -MmGetKernelAddressSpace(VOID) -{ - return(&KernelAddressSpace); + MmInitializeAddressSpace(NULL, &MmKernelAddressSpace); } NTSTATUS @@ -79,51 +39,45 @@ MmInitializeAddressSpace(PEPROCESS Process, PMADDRESS_SPACE AddressSpace) { - AddressSpace->MemoryAreaRoot = NULL; - if (Process) - { - ExInitializePushLock((PULONG_PTR)&Process->AddressCreationLock); - } - else - { - ExInitializePushLock((PULONG_PTR)&KernelAddressSpaceLock); - } - if (Process != NULL) - { - AddressSpace->LowestAddress = MM_LOWEST_USER_ADDRESS; - } - else - { - AddressSpace->LowestAddress = MmSystemRangeStart; - } - AddressSpace->Process = Process; - if (Process != NULL) - { - ULONG Count; - Count = MiGetUserPageDirectoryCount(); - AddressSpace->PageTableRefCountTable = - ExAllocatePoolWithTag(NonPagedPool, Count * sizeof(USHORT), - TAG_PTRC); - RtlZeroMemory(AddressSpace->PageTableRefCountTable, Count * sizeof(USHORT)); - AddressSpace->PageTableRefCountTableSize = Count; - } - else - { - AddressSpace->PageTableRefCountTable = NULL; - AddressSpace->PageTableRefCountTableSize = 0; - } - return(STATUS_SUCCESS); + ULONG Count; + + AddressSpace->MemoryAreaRoot = NULL; + + if (Process != NULL) + { + AddressSpace->LowestAddress = MM_LOWEST_USER_ADDRESS; + AddressSpace->Process = Process; + AddressSpace->Lock = (PEX_PUSH_LOCK)&Process->AddressCreationLock; + ExInitializePushLock((PULONG_PTR)AddressSpace->Lock); + Count = MiGetUserPageDirectoryCount(); + AddressSpace->PageTableRefCountTable = ExAllocatePoolWithTag(NonPagedPool, + Count * sizeof(USHORT), + TAG_PTRC); + RtlZeroMemory(AddressSpace->PageTableRefCountTable, Count * sizeof(USHORT)); + + } + else + { + AddressSpace->LowestAddress = MmSystemRangeStart; + AddressSpace->Process = NULL; + AddressSpace->PageTableRefCountTable = NULL; + AddressSpace->Lock = (PEX_PUSH_LOCK)&PsGetCurrentProcess()->AddressCreationLock; + ExInitializePushLock((PULONG_PTR)AddressSpace->Lock); + } + + return STATUS_SUCCESS; } NTSTATUS NTAPI MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace) { - if (AddressSpace->PageTableRefCountTable != NULL) - { - ExFreePool(AddressSpace->PageTableRefCountTable); - } - return(STATUS_SUCCESS); + if (AddressSpace->PageTableRefCountTable) + { + ExFreePool(AddressSpace->PageTableRefCountTable); + } + + return STATUS_SUCCESS; } /* EOF */
16 years, 8 months
1
0
0
0
[fireball] 33091: - Remove perf code from Ob SD Cache implementation.
by fireball@svn.reactos.org
Author: fireball Date: Mon Apr 21 13:33:23 2008 New Revision: 33091 URL:
http://svn.reactos.org/svn/reactos?rev=33091&view=rev
Log: - Remove perf code from Ob SD Cache implementation. Modified: trunk/reactos/ntoskrnl/ob/obsdcach.c Modified: trunk/reactos/ntoskrnl/ob/obsdcach.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obsdcach.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ob/obsdcach.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ob/obsdcach.c [iso-8859-1] Mon Apr 21 13:33:23 2008 @@ -18,16 +18,6 @@ #define SD_CACHE_ENTRIES 0x100 OB_SD_CACHE_LIST ObsSecurityDescriptorCache[SD_CACHE_ENTRIES]; -ULONGLONG Cycles; -ULONG TimeDelta; - -#define ObpSdCacheBeginPerfCount() \ - Cycles = __rdtsc(); - -#define ObpSdCacheEndPerfCount() \ - TimeDelta += __rdtsc() - Cycles; - - /* PRIVATE FUNCTIONS **********************************************************/ VOID @@ -191,14 +181,12 @@ { PSECURITY_DESCRIPTOR SecurityDescriptor; PSECURITY_DESCRIPTOR_HEADER SdHeader; - ObpSdCacheBeginPerfCount(); /* Get the SD */ SecurityDescriptor = ObjectHeader->SecurityDescriptor; if (!SecurityDescriptor) { /* No SD, nothing to do */ - ObpSdCacheEndPerfCount(); return NULL; } @@ -213,7 +201,6 @@ /* Release the lock and return */ ObpReleaseObjectLock(ObjectHeader); - ObpSdCacheEndPerfCount(); return SecurityDescriptor; } @@ -242,14 +229,12 @@ IN ULONG Count) { PSECURITY_DESCRIPTOR_HEADER SdHeader; - ObpSdCacheBeginPerfCount(); /* Get the header */ SdHeader = ObpGetHeaderForSd(SecurityDescriptor); /* Do the references */ InterlockedExchangeAdd((PLONG)&SdHeader->RefCount, Count); - ObpSdCacheEndPerfCount(); } /*++ @@ -278,7 +263,6 @@ LONG OldValue, NewValue; ULONG Index; POB_SD_CACHE_LIST CacheEntry; - ObpSdCacheBeginPerfCount(); /* Get the header */ SdHeader = ObpGetHeaderForSd(SecurityDescriptor); @@ -293,7 +277,7 @@ NewValue = InterlockedCompareExchange((PLONG)&SdHeader->RefCount, OldValue - Count, OldValue); - if (NewValue == OldValue) ObpSdCacheEndPerfCount(); return; + if (NewValue == OldValue) return; /* Try again */ OldValue = NewValue; @@ -325,7 +309,6 @@ ObpSdReleaseLock(CacheEntry); } - ObpSdCacheEndPerfCount(); } /*++ @@ -359,7 +342,6 @@ POB_SD_CACHE_LIST CacheEntry; BOOLEAN Result; PLIST_ENTRY NextEntry; - ObpSdCacheBeginPerfCount(); /* Get the length */ Length = RtlLengthSecurityDescriptor(InputSecurityDescriptor); @@ -418,7 +400,6 @@ /* Free anything that we may have had to create */ if (NewHeader) ExFreePool(NewHeader); - ObpSdCacheEndPerfCount(); return STATUS_SUCCESS; } @@ -453,7 +434,6 @@ /* Return the SD*/ *OutputSecurityDescriptor = &NewHeader->SecurityDescriptor; - ObpSdCacheEndPerfCount(); return STATUS_SUCCESS; }
16 years, 8 months
1
0
0
0
[jimtabor] 33090: Attempt to fix problem where there should have not been a problem. Remember this, do not fix it when it is not broken. I will restore GdiFixUpHandle back to the original state later.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Apr 21 13:28:35 2008 New Revision: 33090 URL:
http://svn.reactos.org/svn/reactos?rev=33090&view=rev
Log: Attempt to fix problem where there should have not been a problem. Remember this, do not fix it when it is not broken. I will restore GdiFixUpHandle back to the original state later. Modified: trunk/reactos/dll/win32/gdi32/misc/misc.c Modified: trunk/reactos/dll/win32/gdi32/misc/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/misc.…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] Mon Apr 21 13:28:35 2008 @@ -104,8 +104,11 @@ BOOL GdiIsHandleValid(HGDIOBJ hGdiObj) { PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); +// We are only looking for TYPE not the rest here, and why is FullUnique filled up with CRAP!? +// DPRINT1("FullUnique -> %x\n", Entry->FullUnique); if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0 && - (Entry->Type << GDI_ENTRY_UPPER_SHIFT) == GDI_HANDLE_GET_UPPER(hGdiObj)) + ( (Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK ) == + GDI_HANDLE_GET_TYPE(hGdiObj)) { HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); if(pid == NULL || pid == CurrentProcessId) @@ -120,7 +123,8 @@ { PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) == ObjectType && - (Entry->Type << GDI_ENTRY_UPPER_SHIFT) == GDI_HANDLE_GET_UPPER(hGdiObj)) + ( (Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK ) == + GDI_HANDLE_GET_TYPE(hGdiObj)) { HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); if(pid == NULL || pid == CurrentProcessId)
16 years, 8 months
1
0
0
0
[janderwald] 33088: - check input in PNP_GetRootDeviceInstance - fix length check in PNP_GetClassName - allocate device id string dynamically in to avoid a potential buffer overflow - use lstrlenW over wcslen in PnpEventThread
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Apr 21 07:08:42 2008 New Revision: 33088 URL:
http://svn.reactos.org/svn/reactos?rev=33088&view=rev
Log: - check input in PNP_GetRootDeviceInstance - fix length check in PNP_GetClassName - allocate device id string dynamically in to avoid a potential buffer overflow - use lstrlenW over wcslen in PnpEventThread Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Mon Apr 21 07:08:42 2008 @@ -308,6 +308,11 @@ DPRINT("PNP_GetRootDeviceInstance() called\n"); + if (!pDeviceID) + { + ret = CR_INVALID_POINTER; + goto Done; + } if (ulLength < lstrlenW(szRootDeviceId) + 1) { ret = CR_BUFFER_SMALL; @@ -891,9 +896,8 @@ DPRINT("PNP_GetClassName() called\n"); - lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class"); - lstrcatW(szKeyName, L"\\"); - if(lstrlenW(pszClassGuid) < sizeof(szKeyName)/sizeof(WCHAR)-lstrlenW(szKeyName)) + lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class\\"); + if(lstrlenW(pszClassGuid) + 1 < sizeof(szKeyName)/sizeof(WCHAR)-(lstrlenW(szKeyName) * sizeof(WCHAR))) lstrcatW(szKeyName, pszClassGuid); else return CR_INVALID_DATA; @@ -1250,7 +1254,8 @@ HKEY hDeviceKey; LPWSTR pszSubKey; DWORD dwDeviceIdListSize; - WCHAR szDeviceIdList[512]; + DWORD dwNewDeviceIdSize; + WCHAR * pszDeviceIdList = NULL; UNREFERENCED_PARAMETER(hBinding); @@ -1271,12 +1276,11 @@ pszSubKey = (ulFlags & CM_ADD_ID_COMPATIBLE) ? L"CompatibleIDs" : L"HardwareID"; - dwDeviceIdListSize = 512 * sizeof(WCHAR); if (RegQueryValueExW(hDeviceKey, pszSubKey, NULL, NULL, - (LPBYTE)szDeviceIdList, + NULL, &dwDeviceIdListSize) != ERROR_SUCCESS) { DPRINT("Failed to query the desired ID string!\n"); @@ -1284,8 +1288,37 @@ goto Done; } + dwNewDeviceIdSize = lstrlenW(pszDeviceID); + if (!dwNewDeviceIdSize) + { + ret = CR_INVALID_POINTER; + goto Done; + } + + dwDeviceIdListSize += (dwNewDeviceIdSize + 2) * sizeof(WCHAR); + + pszDeviceIdList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDeviceIdListSize); + if (!pszDeviceIdList) + { + DPRINT("Failed to allocate memory for the desired ID string!\n"); + ret = CR_OUT_OF_MEMORY; + goto Done; + } + + if (RegQueryValueExW(hDeviceKey, + pszSubKey, + NULL, + NULL, + (LPBYTE)pszDeviceIdList, + &dwDeviceIdListSize) != ERROR_SUCCESS) + { + DPRINT("Failed to query the desired ID string!\n"); + ret = CR_REGISTRY_ERROR; + goto Done; + } + /* Check whether the device ID is already in use */ - if (CheckForDeviceId(szDeviceIdList, pszDeviceID)) + if (CheckForDeviceId(pszDeviceIdList, pszDeviceID)) { DPRINT("Device ID was found in the ID string!\n"); ret = CR_SUCCESS; @@ -1293,13 +1326,13 @@ } /* Append the Device ID */ - AppendDeviceId(szDeviceIdList, &dwDeviceIdListSize, pszID); + AppendDeviceId(pszDeviceIdList, &dwDeviceIdListSize, pszID); if (RegSetValueExW(hDeviceKey, pszSubKey, 0, REG_MULTI_SZ, - (LPBYTE)szDeviceIdList, + (LPBYTE)pszDeviceIdList, dwDeviceIdListSize) != ERROR_SUCCESS) { DPRINT("Failed to set the desired ID string!\n"); @@ -1308,6 +1341,8 @@ Done: RegCloseKey(hDeviceKey); + if (pszDeviceIdList) + HeapFree(GetProcessHeap(), 0, pszDeviceIdList); DPRINT("PNP_AddID() done (returns %lx)\n", ret); @@ -2071,22 +2106,26 @@ { DeviceInstallParams* Params; DWORD len; + DWORD DeviceIdLength; DPRINT("Device arrival event: %S\n", PnpEvent->TargetDevice.DeviceIds); - /* Queue device install (will be dequeued by DeviceInstallThread */ - len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) - + wcslen(PnpEvent->TargetDevice.DeviceIds) * sizeof(WCHAR) + sizeof(UNICODE_NULL); - Params = HeapAlloc(GetProcessHeap(), 0, len); - if (Params) + DeviceIdLength = lstrlenW(PnpEvent->TargetDevice.DeviceIds); + if (DeviceIdLength) { - wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds); + /* Queue device install (will be dequeued by DeviceInstallThread */ + len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) + (DeviceIdLength + 1) * sizeof(WCHAR); + Params = HeapAlloc(GetProcessHeap(), 0, len); + if (Params) + { + wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds); #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED - InterlockedPushEntrySList(&DeviceInstallListHead, &Params->ListEntry); + InterlockedPushEntrySList(&DeviceInstallListHead, &Params->ListEntry); #else - InsertTailList(&DeviceInstallListHead, &Params->ListEntry); + InsertTailList(&DeviceInstallListHead, &Params->ListEntry); #endif - SetEvent(hDeviceInstallListNotEmpty); + SetEvent(hDeviceInstallListNotEmpty); + } } } else
16 years, 8 months
1
0
0
0
[jimtabor] 33087: Implemented DxEngGetRedirectionBitmap. Fixed GdiGetSetCopyCount.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Apr 21 00:56:49 2008 New Revision: 33087 URL:
http://svn.reactos.org/svn/reactos?rev=33087&view=rev
Log: Implemented DxEngGetRedirectionBitmap. Fixed GdiGetSetCopyCount. Modified: trunk/reactos/include/reactos/drivers/directx/dxeng.h trunk/reactos/include/reactos/win32k/ntgdityp.h trunk/reactos/subsystems/win32/win32k/ntddraw/dxeng.c trunk/reactos/subsystems/win32/win32k/objects/dc.c Modified: trunk/reactos/include/reactos/drivers/directx/dxeng.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/drivers/di…
============================================================================== --- trunk/reactos/include/reactos/drivers/directx/dxeng.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/drivers/directx/dxeng.h [iso-8859-1] Mon Apr 21 00:56:49 2008 @@ -118,7 +118,7 @@ DWORD DxEngSelectPaletteToSurface(DWORD x1, DWORD x2); DWORD DxEngSyncPaletteTableWithDevice(DWORD x1, DWORD x2); DWORD DxEngSetPaletteState(DWORD x1, DWORD x2, DWORD x3); -DWORD DxEngGetRedirectionBitmap(DWORD x1); +DWORD STDCALL DxEngGetRedirectionBitmap(DWORD x1); DWORD DxEngLoadImage(DWORD x1,DWORD x2); Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] Mon Apr 21 00:56:49 2008 @@ -57,7 +57,7 @@ typedef enum _GETSETDCDWORD { - GdtGetSetCopyCount = 2, + GdiGetSetCopyCount = 2, GdiGetSetTextAlign, GdiGetSetRelAbs, GdiGetSetTextCharExtra, Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dxeng.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/dxeng.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/dxeng.c [iso-8859-1] Mon Apr 21 00:56:49 2008 @@ -822,10 +822,11 @@ /************************************************************************/ /* DxEngGetRedirectionBitmap */ /************************************************************************/ -DWORD DxEngGetRedirectionBitmap(DWORD x1) -{ - UNIMPLEMENTED; - return FALSE; +DWORD +STDCALL +DxEngGetRedirectionBitmap(DWORD x1) +{ + return FALSE; // Normal return. } /************************************************************************/ Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Mon Apr 21 00:56:49 2008 @@ -2258,7 +2258,7 @@ switch (u) { - case GdtGetSetCopyCount: + case GdiGetSetCopyCount: SafeResult = dc->ulCopyCount; dc->ulCopyCount = dwIn; break;
16 years, 8 months
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
40
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Results per page:
10
25
50
100
200