added dbghelp.dll warning

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1053 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2009-04-13 08:59:11 +00:00
parent 7142c756ae
commit 1cdb716ebc
8 changed files with 112 additions and 7 deletions
+7 -2
View File
@@ -34,6 +34,7 @@ namespace ProcessHacker
{
public partial class OptionsWindow : Form
{
private string _oldDbghelp;
private string _oldTaskMgrDebugger;
private bool _autoClosed = false;
private Font _font;
@@ -130,7 +131,7 @@ namespace ProcessHacker
try
{
textDbghelpPath.Text = Properties.Settings.Default.DbgHelpPath;
_oldDbghelp = textDbghelpPath.Text = Properties.Settings.Default.DbgHelpPath;
textSearchPath.Text = Properties.Settings.Default.DbgHelpSearchPath;
checkUndecorate.Checked = (Symbols.Options & Win32.SYMBOL_OPTIONS.UndName) != 0;
}
@@ -357,7 +358,11 @@ namespace ProcessHacker
Program.SharedThreadProvider.Interval = Properties.Settings.Default.RefreshInterval;
Program.SecondarySharedThreadProvider.Interval = Properties.Settings.Default.RefreshInterval;
Properties.Settings.Default.Save();
Properties.Settings.Default.Save();
if (_oldDbghelp != textDbghelpPath.Text)
MessageBox.Show("One or more options you have changed require a restart of Process Hacker.",
"Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void ApplySettings()
@@ -200,6 +200,8 @@ namespace ProcessHacker
this.BeginInvoke(new MethodInvoker(this.LoadStage2));
}),
null, 100, System.Threading.Timeout.Infinite);
Symbols.ShowWarning(this, false);
}
private void LoadStage2()
-2
View File
@@ -183,8 +183,6 @@ namespace ProcessHacker
catch
{ }
ThreadPool.SetMaxThreads(3, 3);
Win32.CreateMutex(0, false, "Global\\ProcessHackerMutex");
if (Environment.OSVersion.Version.Major <= 5)
+12
View File
@@ -1284,5 +1284,17 @@ namespace ProcessHacker.Properties {
this["DbgHelpUndecorate"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool DbgHelpWarningShown {
get {
return ((bool)(this["DbgHelpWarningShown"]));
}
set {
this["DbgHelpWarningShown"] = value;
}
}
}
}
@@ -317,5 +317,8 @@
<Setting Name="DbgHelpUndecorate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="DbgHelpWarningShown" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
@@ -81,7 +81,7 @@ namespace ProcessHacker
_processHandle = new Win32.ProcessHandle(_pid, Program.MinProcessQueryRights);
_symbols = new Symbols(_processHandle);
Symbols.Options = Win32.SYMBOL_OPTIONS.DeferredLoads |
Symbols.Options = Win32.SYMBOL_OPTIONS.DeferredLoads |
(Properties.Settings.Default.DbgHelpUndecorate ? Win32.SYMBOL_OPTIONS.UndName : 0);
if (Properties.Settings.Default.DbgHelpSearchPath != "")
+84 -2
View File
@@ -22,9 +22,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Samples;
namespace ProcessHacker
{
@@ -134,6 +136,86 @@ namespace ProcessHacker
}
}
public static void ShowWarning(IWin32Window window, bool force)
{
if (Properties.Settings.Default.DbgHelpWarningShown && !force)
return;
try
{
var modules = Win32.ProcessHandle.FromHandle(Program.CurrentProcess).GetModules();
foreach (var module in modules)
{
if (module.FileName.ToLowerInvariant().EndsWith("dbghelp.dll"))
{
FileInfo fi = new FileInfo(module.FileName);
if (!File.Exists(fi.DirectoryName + "\\symsrv.dll"))
{
if (!force)
Properties.Settings.Default.DbgHelpWarningShown = true;
if (Program.WindowsVersion != WindowsVersion.XP)
{
TaskDialog td = new TaskDialog();
bool verificationChecked;
td.CommonButtons = TaskDialogCommonButtons.Ok;
td.WindowTitle = "Process Hacker";
td.MainIcon = TaskDialogIcon.Warning;
td.MainInstruction = "Microsoft Symbol Server not supported";
td.Content = "The Microsoft Symbol Server is not supported by your version of dbghelp.dll " +
"or could not be loaded. " +
"To ensure you have the latest version of dbghelp.dll, download " +
"<a href=\"dbghelp\">Debugging " +
"Tools for Windows</a> and configure Process Hacker to " +
"use its version of dbghelp.dll. If you have the latest version of dbghelp.dll, " +
"ensure that symsrv.dll resides in the same directory as dbghelp.dll.";
td.EnableHyperlinks = true;
td.Callback = (taskDialog, args, callbackData) =>
{
if (args.Notification == TaskDialogNotification.HyperlinkClicked)
{
try
{
System.Diagnostics.Process.Start(
"http://www.microsoft.com/whdc/devtools/debugging/default.mspx");
}
catch
{ }
return true;
}
return false;
};
td.VerificationText = force ? null : "Do not display this warning again";
td.VerificationFlagChecked = true;
td.Show(window, out verificationChecked);
if (!force)
Properties.Settings.Default.DbgHelpWarningShown = verificationChecked;
}
else
{
MessageBox.Show(window, "The Microsoft Symbol Server is not supported by your version of dbghelp.dll " +
"or could not be loaded. To ensure you have the latest version of dbghelp.dll, download " +
"Debugging Tools for Windows and configure Process Hacker to use its version of dbghelp.dll. " +
"If you have the latest version of dbghelp.dll, ensure that symsrv.dll resides in the same " +
"directory as dbghelp.dll", "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
break;
}
}
}
catch
{ }
}
public void LoadModule(string fileName, long baseAddress)
{
this.LoadModule(fileName, baseAddress, 0);
@@ -271,7 +353,7 @@ namespace ProcessHacker
return "0x" + address.ToString("x8");
}
System.IO.FileInfo fi = new System.IO.FileInfo(modFileName);
FileInfo fi = new FileInfo(modFileName);
fileName = fi.FullName;
+3
View File
@@ -322,6 +322,9 @@
<setting name="DbgHelpUndecorate" serializeAs="String">
<value>True</value>
</setting>
<setting name="DbgHelpWarningShown" serializeAs="String">
<value>False</value>
</setting>
</ProcessHacker.Properties.Settings>
</userSettings>
</configuration>