* fixed the tiny gaps at the ends of longdata plotters

* added GetBasePriority to process and thread handles
* fixed options & process windows not getting initialized

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1175 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2009-04-27 11:10:41 +00:00
parent b7f40a6571
commit e36bc2f107
9 changed files with 85 additions and 29 deletions
@@ -334,6 +334,14 @@ namespace ProcessHacker.Native.Objects
Win32.ThrowLastError();
}
/// <summary>
/// Gets the base priority of the process.
/// </summary>
public int GetBasePriority()
{
return this.GetInformationInt32(ProcessInformationClass.ProcessBasePriority);
}
/// <summary>
/// Gets the process' basic information through the undocumented Native API function
/// NtQueryInformationProcess. This function requires the PROCESS_QUERY_LIMITED_INFORMATION
@@ -89,6 +89,14 @@ namespace ProcessHacker.Native.Objects
Win32.ThrowLastError();
}
/// <summary>
/// Gets the thread's base priority.
/// </summary>
public int GetBasePriority()
{
return this.GetInformationInt32(ThreadInformationClass.ThreadBasePriority);
}
/// <summary>
/// Gets the thread's basic information.
/// </summary>
@@ -225,6 +233,14 @@ namespace ProcessHacker.Native.Objects
return this.GetInformationInt32(ThreadInformationClass.ThreadPagePriority);
}
/// <summary>
/// Gets the thread's priority.
/// </summary>
public int GetPriority()
{
return this.GetInformationInt32(ThreadInformationClass.ThreadPriority);
}
/// <summary>
/// Gets the thread's priority level.
/// </summary>
+4 -4
View File
@@ -265,10 +265,10 @@ namespace ProcessHacker.Components
// restrict scaling to the currently visible data points
int maxIndex = this.Width / this.EffectiveMoveStep;
for (int i = 0; i < _longData1.Count && i < maxIndex; i++)
for (int i = 0; i < _longData1.Count && i <= maxIndex; i++)
if (_longData1[i] > max)
max = _longData1[i];
for (int i = 0; i < _longData2.Count && i < maxIndex; i++)
for (int i = 0; i < _longData2.Count && i <= maxIndex; i++)
if (_longData2[i] > max)
max = _longData2[i];
@@ -279,7 +279,7 @@ namespace ProcessHacker.Components
_data1 = new List<float>();
_data2 = new List<float>();
for (int i = 0; i < _longData1.Count && i < maxIndex; i++)
for (int i = 0; i < _longData1.Count && i <= maxIndex; i++)
{
if (max != 0)
_data1.Add((float)_longData1[i] / max);
@@ -287,7 +287,7 @@ namespace ProcessHacker.Components
_data1.Add(0);
}
for (int i = 0; i < _longData2.Count && i < maxIndex; i++)
for (int i = 0; i < _longData2.Count && i <= maxIndex; i++)
{
if (max != 0)
_data2.Add((float)_longData2[i] / max);
-1
View File
@@ -949,7 +949,6 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Options";
this.Load += new System.EventHandler(this.OptionsWindow_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.OptionsWindow_Paint);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OptionsWindow_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).EndInit();
this.tabControl.ResumeLayout(false);
+13 -4
View File
@@ -75,14 +75,23 @@ namespace ProcessHacker
}
}
private void OptionsWindow_Paint(object sender, PaintEventArgs e)
protected override void WndProc(ref Message m)
{
if (_isFirstPaint)
switch (m.Msg)
{
this.LoadStage1();
case (int)WindowMessage.Paint:
{
if (_isFirstPaint)
{
this.LoadStage1();
}
_isFirstPaint = false;
}
break;
}
_isFirstPaint = false;
base.WndProc(ref m);
}
private void LoadStage1()
-1
View File
@@ -1656,7 +1656,6 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Process";
this.Load += new System.EventHandler(this.ProcessWindow_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ProcessWindow_Paint);
this.SizeChanged += new System.EventHandler(this.ProcessWindow_SizeChanged);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProcessWindow_FormClosing);
this.tabControl.ResumeLayout(false);
+13 -4
View File
@@ -151,13 +151,22 @@ namespace ProcessHacker
SymbolProvider.ShowWarning(this, false);
}
private void ProcessWindow_Paint(object sender, PaintEventArgs e)
protected override void WndProc(ref Message m)
{
if (_isFirstPaint)
switch (m.Msg)
{
_isFirstPaint = false;
this.LoadStage1();
case (int)WindowMessage.Paint:
{
if (_isFirstPaint)
{
_isFirstPaint = false;
this.LoadStage1();
}
}
break;
}
base.WndProc(ref m);
}
private void FixTabs()
+30 -14
View File
@@ -78,8 +78,11 @@ namespace ProcessHacker
this.Name = this.GetType().Name;
_pid = pid;
if (!Program.ProcessesWithThreads.ContainsKey(_pid))
Program.ProcessesWithThreads.Add(_pid, null);
lock (Program.ProcessesWithThreads)
{
if (!Program.ProcessesWithThreads.ContainsKey(_pid))
Program.ProcessesWithThreads.Add(_pid, null);
}
this.ProviderUpdate += new ProviderUpdateOnce(UpdateOnce);
this.Disposed += ThreadProvider_Disposed;
@@ -93,8 +96,10 @@ namespace ProcessHacker
// Needed (maybe) to display the EULA
Win32.SymbolServerSetOptions(SymbolServerOption.Unattended, 0);
}
catch
{ }
catch (Exception ex)
{
Logging.Log(ex);
}
// start loading symbols; avoid the UI blocking on the dbghelp call lock
WorkQueue.GlobalQueueWorkItem(new Action(() =>
@@ -120,8 +125,10 @@ namespace ProcessHacker
{
_symbols.LoadModule(module.FileName, module.BaseAddress.ToInt32(), module.Size);
}
catch
{ }
catch (Exception ex)
{
Logging.Log(ex);
}
}
}
}
@@ -137,13 +144,17 @@ namespace ProcessHacker
{
_symbols.LoadModule(module.FileName, module.BaseAddress);
}
catch
{ }
catch (Exception ex)
{
Logging.Log(ex);
}
}
}
}
catch
{ }
catch (Exception ex)
{
Logging.Log(ex);
}
lock (_moduleLoadCompletedEvent)
{
@@ -152,8 +163,10 @@ namespace ProcessHacker
}
}));
}
catch
{ }
catch (Exception ex)
{
Logging.Log(ex);
}
}
private void ThreadProvider_Disposed(IProvider provider)
@@ -167,8 +180,11 @@ namespace ProcessHacker
lock (_moduleLoadCompletedEvent)
_moduleLoadCompletedEvent.Close();
if (Program.ProcessesWithThreads.ContainsKey(_pid))
Program.ProcessesWithThreads.Remove(_pid);
lock (Program.ProcessesWithThreads)
{
if (Program.ProcessesWithThreads.ContainsKey(_pid))
Program.ProcessesWithThreads.Remove(_pid);
}
foreach (int tid in this.Dictionary.Keys)
{
+1 -1
View File
@@ -83,7 +83,7 @@ namespace ProcessHacker
using (Bitmap bm = new Bitmap(_width, _height))
{
_plotter.Draw();
_plotter.DrawToBitmap(bm, new Rectangle(new Point(0, 0), bm.Size));
_plotter.DrawToBitmap(bm, new Rectangle(new Point(0, 0), _plotter.Size));
newIcon = Icon.FromHandle(bm.GetHicon());
}