diff --git a/1.x/trunk/ProcessHacker.Common/BaseConverter.cs b/1.x/trunk/ProcessHacker.Common/BaseConverter.cs
index 9d5dd91a9..6f3708cba 100644
--- a/1.x/trunk/ProcessHacker.Common/BaseConverter.cs
+++ b/1.x/trunk/ProcessHacker.Common/BaseConverter.cs
@@ -30,7 +30,7 @@ namespace ProcessHacker.Common
///
public static class BaseConverter
{
- private static readonly int[] _reverseChars = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ private static int[] _reverseChars = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 52,
53, 54, 55, 56, 57, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -74,7 +74,7 @@ namespace ProcessHacker.Common
if (b > 70)
return 0;
- if (string.IsNullOrEmpty(number))
+ if (number == "")
return 0;
bool negative = number[0] == '-';
@@ -95,8 +95,8 @@ namespace ProcessHacker.Common
if (negative)
return -result;
-
- return result;
+ else
+ return result;
}
///
@@ -118,11 +118,11 @@ namespace ProcessHacker.Common
///
public static decimal ToNumberParse(string number, bool allowNonStandardExts)
{
- if (string.IsNullOrEmpty(number))
+ if (number == "")
return 0;
bool negative = number[0] == '-';
- decimal result;
+ decimal result = 0;
if (negative)
number = number.Substring(1);
@@ -169,8 +169,8 @@ namespace ProcessHacker.Common
if (negative)
return -result;
-
- return result;
+ else
+ return result;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/ByteStreamReader.cs b/1.x/trunk/ProcessHacker.Common/ByteStreamReader.cs
index d838b59ae..37026970a 100644
--- a/1.x/trunk/ProcessHacker.Common/ByteStreamReader.cs
+++ b/1.x/trunk/ProcessHacker.Common/ByteStreamReader.cs
@@ -21,13 +21,15 @@
*/
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Text;
namespace ProcessHacker.Common
{
public sealed class ByteStreamReader : Stream
{
- private readonly byte[] _data;
+ private byte[] _data;
private long _position;
public ByteStreamReader(byte[] data)
diff --git a/1.x/trunk/ProcessHacker.Common/DeltaManager.cs b/1.x/trunk/ProcessHacker.Common/DeltaManager.cs
index 0545e781b..c5d38f54a 100644
--- a/1.x/trunk/ProcessHacker.Common/DeltaManager.cs
+++ b/1.x/trunk/ProcessHacker.Common/DeltaManager.cs
@@ -20,6 +20,8 @@
* along with Process Hacker. If not, see .
*/
+using System.Collections.Generic;
+
namespace ProcessHacker.Common
{
///
@@ -36,10 +38,10 @@ namespace ProcessHacker.Common
public static class Subtractor
{
- private static readonly Int64Subtractor _int64Subtractor = new Int64Subtractor();
- private static readonly Int32Subtractor _int32Subtractor = new Int32Subtractor();
- private static readonly DoubleSubtractor _doubleSubtractor = new DoubleSubtractor();
- private static readonly FloatSubtractor _floatSubtractor = new FloatSubtractor();
+ private static Int64Subtractor _int64Subtractor = new Int64Subtractor();
+ private static Int32Subtractor _int32Subtractor = new Int32Subtractor();
+ private static DoubleSubtractor _doubleSubtractor = new DoubleSubtractor();
+ private static FloatSubtractor _floatSubtractor = new FloatSubtractor();
public static Int64Subtractor Int64Subtractor
{
@@ -115,7 +117,7 @@ namespace ProcessHacker.Common
public struct DeltaValue : IDeltaValue
{
- private readonly ISubtractor _subtractor;
+ private ISubtractor _subtractor;
private T _value;
private T _delta;
diff --git a/1.x/trunk/ProcessHacker.Common/EnumComparer.cs b/1.x/trunk/ProcessHacker.Common/EnumComparer.cs
index 54fd689c8..ed0aa58a5 100644
--- a/1.x/trunk/ProcessHacker.Common/EnumComparer.cs
+++ b/1.x/trunk/ProcessHacker.Common/EnumComparer.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
+using System.Text;
using System.Reflection.Emit;
namespace ProcessHacker.Common
@@ -14,6 +15,7 @@ namespace ProcessHacker.Common
where TEnum : struct, IComparable, IConvertible, IFormattable
{
public static readonly EnumComparer Instance;
+
private static readonly Func _equals;
private static readonly Func _getHashCode;
@@ -51,11 +53,12 @@ namespace ProcessHacker.Common
private static void AssertUnderlyingTypeIsSupported()
{
var underlyingType = Enum.GetUnderlyingType(typeof(TEnum));
- ICollection supportedTypes = new[]
- {
- typeof(byte), typeof(sbyte), typeof(short), typeof(ushort),
- typeof(int), typeof(uint), typeof(long), typeof(ulong)
- };
+ ICollection supportedTypes =
+ new[]
+ {
+ typeof (byte), typeof (sbyte), typeof (short), typeof (ushort),
+ typeof (int), typeof (uint), typeof (long), typeof (ulong)
+ };
if (supportedTypes.Contains(underlyingType))
return;
@@ -75,19 +78,18 @@ namespace ProcessHacker.Common
/// The generated method.
private static Func generateEquals()
{
- var method = new DynamicMethod(typeof(TEnum).Name + "_Equals", typeof(bool), new[]
- {
- typeof(TEnum), typeof(TEnum)
- }, typeof(TEnum), true);
-
+ var method = new DynamicMethod(typeof(TEnum).Name + "_Equals",
+ typeof(bool),
+ new[] { typeof(TEnum), typeof(TEnum) },
+ typeof(TEnum), true);
var generator = method.GetILGenerator();
// Writing body
generator.Emit(OpCodes.Ldarg_0); // load x to stack
generator.Emit(OpCodes.Ldarg_1); // load y to stack
generator.Emit(OpCodes.Ceq); // x == y
generator.Emit(OpCodes.Ret); // return result
-
- return (Func)method.CreateDelegate(typeof(Func));
+ return (Func)method.CreateDelegate
+ (typeof(Func));
}
///
@@ -102,11 +104,10 @@ namespace ProcessHacker.Common
/// The generated method.
private static Func generateGetHashCode()
{
- var method = new DynamicMethod(typeof(TEnum).Name + "_GetHashCode", typeof(int), new[]
- {
- typeof(TEnum)
- }, typeof(TEnum), true);
-
+ var method = new DynamicMethod(typeof(TEnum).Name + "_GetHashCode",
+ typeof(int),
+ new[] { typeof(TEnum) },
+ typeof(TEnum), true);
var generator = method.GetILGenerator();
var underlyingType = Enum.GetUnderlyingType(typeof(TEnum));
var getHashCodeMethod = underlyingType.GetMethod("GetHashCode");
@@ -117,7 +118,6 @@ namespace ProcessHacker.Common
generator.Emit(OpCodes.Ldloca_S, castValue); // load *castValue to stack
generator.Emit(OpCodes.Call, getHashCodeMethod); // castValue.GetHashCode()
generator.Emit(OpCodes.Ret); // return result
-
return (Func)method.CreateDelegate(typeof(Func));
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/FreeList.cs b/1.x/trunk/ProcessHacker.Common/FreeList.cs
index 47d79f470..a1b38c686 100644
--- a/1.x/trunk/ProcessHacker.Common/FreeList.cs
+++ b/1.x/trunk/ProcessHacker.Common/FreeList.cs
@@ -20,6 +20,7 @@
* along with Process Hacker. If not, see .
*/
+using System;
using System.Threading;
namespace ProcessHacker.Common
@@ -27,10 +28,11 @@ namespace ProcessHacker.Common
///
/// Manages a list of free objects that can be re-used.
///
- public class FreeList where T : IResettable, new()
+ public class FreeList
+ where T : IResettable, new()
{
- private readonly T[] _list;
- private int _freeIndex;
+ private T[] _list;
+ private int _freeIndex = 0;
public FreeList(int maximumCount)
{
diff --git a/1.x/trunk/ProcessHacker.Common/IResettable.cs b/1.x/trunk/ProcessHacker.Common/IResettable.cs
index 85ceb09ef..2fa07049c 100644
--- a/1.x/trunk/ProcessHacker.Common/IResettable.cs
+++ b/1.x/trunk/ProcessHacker.Common/IResettable.cs
@@ -1,4 +1,8 @@
-namespace ProcessHacker.Common
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Common
{
public interface IResettable
{
diff --git a/1.x/trunk/ProcessHacker.Common/IdGenerator.cs b/1.x/trunk/ProcessHacker.Common/IdGenerator.cs
index bb3284725..cae77136d 100644
--- a/1.x/trunk/ProcessHacker.Common/IdGenerator.cs
+++ b/1.x/trunk/ProcessHacker.Common/IdGenerator.cs
@@ -30,9 +30,9 @@ namespace ProcessHacker.Common
///
public class IdGenerator
{
- private readonly int _step = 1;
- private bool _sort;
- private readonly List _ids = new List();
+ private int _step = 1;
+ private bool _sort = false;
+ private List _ids = new List();
private int _id;
///
@@ -88,9 +88,11 @@ namespace ProcessHacker.Common
return id;
}
-
- id = this._id;
- this._id += this._step;
+ else
+ {
+ id = _id;
+ _id += _step;
+ }
}
return id;
diff --git a/1.x/trunk/ProcessHacker.Common/LibC.cs b/1.x/trunk/ProcessHacker.Common/LibC.cs
index 5240ecc17..f75ce1675 100644
--- a/1.x/trunk/ProcessHacker.Common/LibC.cs
+++ b/1.x/trunk/ProcessHacker.Common/LibC.cs
@@ -1,4 +1,8 @@
-namespace ProcessHacker.Common
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Common
{
public static class LibC
{
diff --git a/1.x/trunk/ProcessHacker.Common/LinkedList.cs b/1.x/trunk/ProcessHacker.Common/LinkedList.cs
index 340de4508..cb7f667f9 100644
--- a/1.x/trunk/ProcessHacker.Common/LinkedList.cs
+++ b/1.x/trunk/ProcessHacker.Common/LinkedList.cs
@@ -1,4 +1,6 @@
-namespace ProcessHacker.Common
+using System;
+
+namespace ProcessHacker.Common
{
public class LinkedListEntry
{
diff --git a/1.x/trunk/ProcessHacker.Common/Logging.cs b/1.x/trunk/ProcessHacker.Common/Logging.cs
index 9778d8998..e2c973f84 100644
--- a/1.x/trunk/ProcessHacker.Common/Logging.cs
+++ b/1.x/trunk/ProcessHacker.Common/Logging.cs
@@ -22,6 +22,7 @@
using System;
using System.Diagnostics;
+using System.Runtime.InteropServices;
namespace ProcessHacker.Common
{
@@ -29,7 +30,7 @@ namespace ProcessHacker.Common
public static class Logging
{
- public enum Importance
+ public enum Importance : int
{
Information = 0,
Warning,
@@ -39,18 +40,26 @@ namespace ProcessHacker.Common
public static event LoggingDelegate Logged;
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ private static extern void OutputDebugString(string OutputString);
+
+ private static object _logLock = new object();
+
[Conditional("DEBUG")]
public static void Log(Importance importance, string message)
{
- string debugMessage =
- DateTime.Now.ToString("hh:mm:ss:fff:") +
- " ProcessHacker (T" + System.Threading.Thread.CurrentThread.ManagedThreadId +
- "): (" + importance.ToString() + ") " + message + "\r\n\r\n" + Environment.StackTrace;
+ lock (_logLock)
+ {
+ string debugMessage =
+ DateTime.Now.ToString("hh:mm:ss:fff:") +
+ " ProcessHacker (T" + System.Threading.Thread.CurrentThread.ManagedThreadId +
+ "): (" + importance.ToString() + ") " + message + "\r\n\r\n" + Environment.StackTrace;
- Debugger.Log(0, "DEBUG", debugMessage);
+ OutputDebugString(debugMessage);
- if (Logged != null)
- Logged(debugMessage);
+ if (Logged != null)
+ Logged(debugMessage);
+ }
}
[Conditional("DEBUG")]
@@ -59,7 +68,7 @@ namespace ProcessHacker.Common
string message = ex.Message;
if (ex.InnerException != null)
- message += "\r\nInner exception:\r\n" + ex.InnerException;
+ message += "\r\nInner exception:\r\n" + ex.InnerException.ToString();
if (ex.StackTrace != null)
message += "\r\n" + ex.StackTrace;
diff --git a/1.x/trunk/ProcessHacker.Common/Messaging/Message.cs b/1.x/trunk/ProcessHacker.Common/Messaging/Message.cs
index 8e77a91af..99616e719 100644
--- a/1.x/trunk/ProcessHacker.Common/Messaging/Message.cs
+++ b/1.x/trunk/ProcessHacker.Common/Messaging/Message.cs
@@ -1,15 +1,23 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Common.Messaging
{
public class Message
{
- public object Tag { get; set; }
+ private object _tag;
+
+ public object Tag
+ {
+ get { return _tag; }
+ set { _tag = value; }
+ }
}
public class ActionMessage : Message
{
- private readonly Action _action;
+ private Action _action;
public ActionMessage(Action action)
{
diff --git a/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueue.cs b/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueue.cs
index 86f82763d..9ef8adb34 100644
--- a/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueue.cs
+++ b/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueue.cs
@@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Common.Messaging
{
public class MessageQueue
{
- private readonly Queue _queue = new Queue();
- private readonly List _listeners = new List();
+ private Queue _queue = new Queue();
+ private List _listeners = new List();
public MessageQueue()
{
// Action message listener.
- this.AddListener(new MessageQueueListener(action => action.Action()));
+ this.AddListener(new MessageQueueListener((action) => action.Action()));
}
public void AddListener(MessageQueueListener listener)
diff --git a/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueueListener.cs b/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueueListener.cs
index 0b22b8733..b63b72ee0 100644
--- a/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueueListener.cs
+++ b/1.x/trunk/ProcessHacker.Common/Messaging/MessageQueueListener.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Common.Messaging
{
@@ -6,8 +8,8 @@ namespace ProcessHacker.Common.Messaging
public class MessageQueueListener
{
- private readonly MessageReceivedDelegate _callback;
- private readonly Type _type;
+ private MessageReceivedDelegate _callback;
+ private Type _type;
public MessageQueueListener(MessageReceivedDelegate callback, Type type)
{
@@ -26,12 +28,13 @@ namespace ProcessHacker.Common.Messaging
}
}
- public class MessageQueueListener : MessageQueueListener where T : Message
+ public class MessageQueueListener : MessageQueueListener
+ where T : Message
{
public delegate void MessageReceivedDelegate(T message);
public MessageQueueListener(MessageReceivedDelegate callback)
- : base(message => callback((T)message), typeof(T))
+ : base((message) => callback((T)message), typeof(T))
{ }
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/Objects/BaseObject.cs b/1.x/trunk/ProcessHacker.Common/Objects/BaseObject.cs
index 6244dc021..2da6d5e3f 100644
--- a/1.x/trunk/ProcessHacker.Common/Objects/BaseObject.cs
+++ b/1.x/trunk/ProcessHacker.Common/Objects/BaseObject.cs
@@ -21,7 +21,7 @@
*/
/* If enabled, the object system will keep statistics. */
-//#define ENABLE_STATISTICS
+#define ENABLE_STATISTICS
/* If enabled, the finalizers on objects can be enabled and disabled.
* If disabled, the finalizers on objects can only be disabled.
@@ -61,23 +61,23 @@ namespace ProcessHacker.Common.Objects
/// the object will be freed.
///
///
- public abstract class BaseObject : IRefCounted
+ public abstract class BaseObject : IDisposable, IRefCounted
{
- private const long ObjectOwned = 0x1;
- private const long ObjectOwnedByGc = 0x2;
- private const long ObjectDisposed = 0x4;
- private const long ObjectRefCountShift = 3;
- private const long ObjectRefCountMask = 0x1fffffff;
- private const long ObjectRefCountIncrement = 0x8;
+ private const int ObjectOwned = 0x1;
+ private const int ObjectOwnedByGc = 0x2;
+ private const int ObjectDisposed = 0x4;
+ private const int ObjectRefCountShift = 3;
+ private const int ObjectRefCountMask = 0x1fffffff;
+ private const int ObjectRefCountIncrement = 0x8;
- private static long _createdCount;
- private static long _freedCount;
- private static long _disposedCount;
- private static long _finalizedCount;
- private static long _referencedCount;
- private static long _dereferencedCount;
+ private static int _createdCount = 0;
+ private static int _freedCount = 0;
+ private static int _disposedCount = 0;
+ private static int _finalizedCount = 0;
+ private static int _referencedCount = 0;
+ private static int _dereferencedCount = 0;
-#if DEBUG_ENABLE_LIVE_LIST
+#if DEBUG && DEBUG_ENABLE_LIVE_LIST
private static System.Collections.Generic.List> _liveList =
new System.Collections.Generic.List>();
#endif
@@ -85,29 +85,29 @@ namespace ProcessHacker.Common.Objects
///
/// Gets the number of disposable, owned objects that have been created.
///
- public static long CreatedCount { get { return _createdCount; } }
+ public static int CreatedCount { get { return _createdCount; } }
///
/// Gets the number of disposable objects that have been freed.
///
- public static long FreedCount { get { return _freedCount; } }
+ public static int FreedCount { get { return _freedCount; } }
///
/// Gets the number of disposable objects that have been Disposed with managed = true.
///
- public static long DisposedCount { get { return _disposedCount; } }
+ public static int DisposedCount { get { return _disposedCount; } }
///
/// Gets the number of disposable objects that have been Disposed with managed = false.
///
- public static long FinalizedCount { get { return _finalizedCount; } }
+ public static int FinalizedCount { get { return _finalizedCount; } }
///
/// Gets the number of times disposable objects have been referenced.
///
- public static long ReferencedCount { get { return _referencedCount; } }
+ public static int ReferencedCount { get { return _referencedCount; } }
///
/// Gets the number of times disposable objects have been dereferenced.
///
- public static long DereferencedCount { get { return _dereferencedCount; } }
+ public static int DereferencedCount { get { return _dereferencedCount; } }
-#if DEBUG_ENABLE_LIVE_LIST
+#if DEBUG && DEBUG_ENABLE_LIVE_LIST
public static void CleanLiveList()
{
var list = new System.Collections.Generic.List>();
@@ -122,17 +122,16 @@ namespace ProcessHacker.Common.Objects
}
#endif
- public static T SwapRef(ref T reference, T newObj) where T : class, IRefCounted
+ public static T SwapRef(ref T reference, T newObj)
+ where T : class, IRefCounted
{
T oldObj;
// Swap the reference.
- oldObj = Interlocked.Exchange(ref reference, newObj);
-
+ oldObj = Interlocked.Exchange(ref reference, newObj);
// Reference the new object.
if (newObj != null)
newObj.Reference();
-
// Dereference the old object.
if (oldObj != null)
oldObj.Dereference();
@@ -140,27 +139,27 @@ namespace ProcessHacker.Common.Objects
return oldObj;
}
-#if DEBUG_ENABLE_LIVE_LIST
+#if DEBUG
///
/// A stack trace collected when the object is created.
///
private string _creationStackTrace;
#endif
///
- /// An UInt32 containing various fields.
+ /// An Int32 containing various fields.
///
- private long _value;
+ private int _value;
#if EXTENDED_FINALIZER
///
/// Whether the finalizer will run.
///
- private uint _finalizerRegistered = 1;
+ private int _finalizerRegistered = 1;
#endif
///
/// Initializes a disposable object.
///
- protected BaseObject()
+ public BaseObject()
: this(true)
{ }
@@ -168,7 +167,7 @@ namespace ProcessHacker.Common.Objects
/// Initializes a disposable object.
///
/// Whether the resource is owned.
- protected BaseObject(bool owned)
+ public BaseObject(bool owned)
{
_value = ObjectOwned + ObjectOwnedByGc + ObjectRefCountIncrement;
@@ -188,9 +187,11 @@ namespace ProcessHacker.Common.Objects
Interlocked.Increment(ref _createdCount);
#endif
-#if DEBUG_ENABLE_LIVE_LIST
+#if DEBUG
_creationStackTrace = Environment.StackTrace;
+#if DEBUG_ENABLE_LIVE_LIST
_liveList.Add(new WeakReference(this));
+#endif
#endif
}
@@ -223,8 +224,8 @@ namespace ProcessHacker.Common.Objects
///
/// Whether to dispose managed resources.
public void Dispose(bool managed)
- {
- long value = 0;
+ {
+ int value;
if ((_value & ObjectOwned) == 0)
return;
@@ -315,9 +316,9 @@ namespace ProcessHacker.Common.Objects
/// This information is for debugging purposes ONLY. DO NOT
/// base memory management logic upon this value.
///
- public long ReferenceCount
+ public int ReferenceCount
{
- get { return (_value >> (int)ObjectRefCountShift) & ObjectRefCountMask; }
+ get { return (_value >> ObjectRefCountShift) & ObjectRefCountMask; }
}
#if EXTENDED_FINALIZER
@@ -326,7 +327,7 @@ namespace ProcessHacker.Common.Objects
///
private void DisableFinalizer()
{
- long oldFinalizerRegistered;
+ int oldFinalizerRegistered;
oldFinalizerRegistered = Interlocked.CompareExchange(ref _finalizerRegistered, 0, 1);
@@ -342,7 +343,7 @@ namespace ProcessHacker.Common.Objects
///
protected void DisableOwnership(bool dispose)
{
- long value = 0;
+ int value;
if (dispose)
this.Dispose();
@@ -383,7 +384,7 @@ namespace ProcessHacker.Common.Objects
/// Dereference(false).
///
///
- public long Dereference()
+ public int Dereference()
{
return this.Dereference(true);
}
@@ -397,7 +398,7 @@ namespace ProcessHacker.Common.Objects
/// If you are calling this method from a finalizer, set
/// to false.
///
- public long Dereference(bool managed)
+ public int Dereference(bool managed)
{
return this.Dereference(1, managed);
}
@@ -407,7 +408,7 @@ namespace ProcessHacker.Common.Objects
///
/// The number of times to dereference the object.
/// The new reference count.
- public long Dereference(long count)
+ public int Dereference(int count)
{
return this.Dereference(count, true);
}
@@ -418,10 +419,10 @@ namespace ProcessHacker.Common.Objects
/// The number of times to dereference the object.
/// Whether to dispose managed resources.
/// The new reference count.
- public long Dereference(long count, bool managed)
+ public int Dereference(int count, bool managed)
{
- long value = 0;
- long newRefCount = 0;
+ int value;
+ int newRefCount;
// Initial parameter validation.
if (count == 0)
@@ -439,7 +440,7 @@ namespace ProcessHacker.Common.Objects
// Decrease the reference count.
value = Interlocked.Add(ref _value, -ObjectRefCountIncrement * count);
- newRefCount = (value >> (int)ObjectRefCountShift) & ObjectRefCountMask;
+ newRefCount = (value >> ObjectRefCountShift) & ObjectRefCountMask;
// Should not ever happen.
if (newRefCount < 0)
@@ -485,7 +486,7 @@ namespace ProcessHacker.Common.Objects
///
private void EnableFinalizer()
{
- long oldFinalizerRegistered;
+ int oldFinalizerRegistered;
oldFinalizerRegistered = Interlocked.CompareExchange(ref _finalizerRegistered, 1, 0);
@@ -506,7 +507,7 @@ namespace ProcessHacker.Common.Objects
/// object) to match each call to Reference. Do not call Dispose.
///
///
- public long Reference()
+ public int Reference()
{
return this.Reference(1);
}
@@ -516,9 +517,9 @@ namespace ProcessHacker.Common.Objects
///
/// The number of times to reference the object.
/// The new reference count.
- public long Reference(long count)
+ public int Reference(int count)
{
- long value;
+ int value;
// Don't do anything if the object isn't owned.
if ((_value & ObjectOwned) == 0)
@@ -535,7 +536,7 @@ namespace ProcessHacker.Common.Objects
value = Interlocked.Add(ref _value, ObjectRefCountIncrement * count);
- return (value >> (int)ObjectRefCountShift) & ObjectRefCountMask;
+ return (value >> ObjectRefCountShift) & ObjectRefCountMask;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/Objects/DelayedReleasePool.cs b/1.x/trunk/ProcessHacker.Common/Objects/DelayedReleasePool.cs
index a6c57893f..b240d38c9 100644
--- a/1.x/trunk/ProcessHacker.Common/Objects/DelayedReleasePool.cs
+++ b/1.x/trunk/ProcessHacker.Common/Objects/DelayedReleasePool.cs
@@ -56,8 +56,8 @@ namespace ProcessHacker.Common.Objects
///
private struct DelayedReleaseObject
{
- private readonly DelayedReleaseFlags _flags;
- private readonly BaseObject _object;
+ private DelayedReleaseFlags _flags;
+ private BaseObject _object;
public DelayedReleaseObject(DelayedReleaseFlags flags, BaseObject obj)
{
@@ -86,7 +86,14 @@ namespace ProcessHacker.Common.Objects
///
public static DelayedReleasePool CurrentPool
{
- get { return _currentPool ?? (_currentPool = new DelayedReleasePool()); }
+ get
+ {
+ if (_currentPool == null)
+ _currentPool = new DelayedReleasePool();
+
+ return _currentPool;
+ }
+ private set { _currentPool = value; }
}
///
@@ -97,7 +104,10 @@ namespace ProcessHacker.Common.Objects
get
{
// No locking needed because the stack is thread-local.
- return _poolStack ?? (_poolStack = new Stack());
+ if (_poolStack == null)
+ _poolStack = new Stack();
+
+ return _poolStack;
}
}
@@ -107,9 +117,6 @@ namespace ProcessHacker.Common.Objects
/// The current delayed release pool.
private static void PopPool(DelayedReleasePool pool)
{
- if (pool == null)
- throw new ArgumentNullException("pool");
-
if (_currentPool != pool)
throw new OutOfOrderException(
"Attempted to pop a pool when it wasn't on top of the stack. " +
@@ -129,8 +136,8 @@ namespace ProcessHacker.Common.Objects
_currentPool = pool;
}
- private readonly int _creatorThreadId;
- private readonly List _objects = new List();
+ private int _creatorThreadId;
+ private List _objects = new List();
///
/// Creates a delayed release pool and sets it as the currently active pool.
@@ -188,12 +195,11 @@ namespace ProcessHacker.Common.Objects
/// Whether to release managed resources.
public void Drain(bool managed)
{
- foreach (DelayedReleaseObject obj in _objects)
+ foreach (var obj in _objects)
{
- if (obj.Flags.HasFlag(DelayedReleaseFlags.Dispose))
+ if ((obj.Flags & DelayedReleaseFlags.Dispose) == DelayedReleaseFlags.Dispose)
obj.Object.Dispose();
-
- if (obj.Flags.HasFlag(DelayedReleaseFlags.Dereference))
+ if ((obj.Flags & DelayedReleaseFlags.Dereference) == DelayedReleaseFlags.Dereference)
obj.Object.Dereference(managed);
}
diff --git a/1.x/trunk/ProcessHacker.Common/Objects/HandleTable.cs b/1.x/trunk/ProcessHacker.Common/Objects/HandleTable.cs
index f35264d16..938c7902d 100644
--- a/1.x/trunk/ProcessHacker.Common/Objects/HandleTable.cs
+++ b/1.x/trunk/ProcessHacker.Common/Objects/HandleTable.cs
@@ -27,8 +27,20 @@ namespace ProcessHacker.Common.Objects
{
public class HandleTableEntry
{
- public int Handle { get; internal set; }
- public IRefCounted Object { get; internal set; }
+ private int _handle;
+ private IRefCounted _object;
+
+ public int Handle
+ {
+ get { return _handle; }
+ internal set { _handle = value; }
+ }
+
+ public IRefCounted Object
+ {
+ get { return _object; }
+ internal set { _object = value; }
+ }
}
///
@@ -52,9 +64,9 @@ namespace ProcessHacker.Common.Objects
/// Return true to stop enumerating; otherwise return false.
public delegate bool EnumerateHandleTableDelegate(int handle, TEntry entry);
- private readonly IdGenerator _handleGenerator = new IdGenerator(4, 4);
- private readonly FastResourceLock _lock = new FastResourceLock();
- private readonly Dictionary _handles = new Dictionary();
+ private IdGenerator _handleGenerator = new IdGenerator(4, 4);
+ private FastResourceLock _lock = new FastResourceLock();
+ private Dictionary _handles = new Dictionary();
protected override void DisposeObject(bool disposing)
{
@@ -306,7 +318,8 @@ namespace ProcessHacker.Common.Objects
/// An object. This object has been referenced and must be
/// dereferenced once it is no longer needed.
///
- public T ReferenceByHandle(int handle, out TEntry entry) where T : class, IRefCounted
+ public T ReferenceByHandle(int handle, out TEntry entry)
+ where T : class, IRefCounted
{
IRefCounted obj = this.ReferenceByHandle(handle, out entry);
@@ -318,10 +331,12 @@ namespace ProcessHacker.Common.Objects
{
return (T)obj;
}
-
- // Wrong type. Dereference and return.
- obj.Dereference();
- return null;
+ else
+ {
+ // Wrong type. Dereference and return.
+ obj.Dereference();
+ return null;
+ }
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/Objects/IRefCounted.cs b/1.x/trunk/ProcessHacker.Common/Objects/IRefCounted.cs
index e7f10cf67..cbb37b004 100644
--- a/1.x/trunk/ProcessHacker.Common/Objects/IRefCounted.cs
+++ b/1.x/trunk/ProcessHacker.Common/Objects/IRefCounted.cs
@@ -8,21 +8,21 @@ namespace ProcessHacker.Common.Objects
/// Decrements the reference count of the object.
///
/// The new reference count.
- long Dereference();
+ int Dereference();
///
/// Decrements the reference count of the object.
///
/// Whether to dispose managed resources.
/// The new reference count.
- long Dereference(bool managed);
+ int Dereference(bool managed);
///
/// Decreases the reference count of the object.
///
/// The number of times to dereference the object.
/// The new reference count.
- long Dereference(long count);
+ int Dereference(int count);
///
/// Decreases the reference count of the object.
@@ -30,7 +30,7 @@ namespace ProcessHacker.Common.Objects
/// The number of times to dereference the object.
/// Whether to dispose managed resources.
/// The new reference count.
- long Dereference(long count, bool managed);
+ int Dereference(int count, bool managed);
///
/// Ensures that the reference counting system has exclusive control
@@ -43,13 +43,13 @@ namespace ProcessHacker.Common.Objects
/// Increments the reference count of the object.
///
/// The new reference count.
- long Reference();
+ int Reference();
///
/// Increases the reference count of the object.
///
/// The number of times to reference the object.
/// The new reference count.
- long Reference(long count);
+ int Reference(int count);
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/Objects/SecuredHandleTable.cs b/1.x/trunk/ProcessHacker.Common/Objects/SecuredHandleTable.cs
index 9bce52099..77dd24b2c 100644
--- a/1.x/trunk/ProcessHacker.Common/Objects/SecuredHandleTable.cs
+++ b/1.x/trunk/ProcessHacker.Common/Objects/SecuredHandleTable.cs
@@ -27,30 +27,33 @@ namespace ProcessHacker.Common.Objects
public class SecuredHandleTableEntry : HandleTableEntry
{
private long _grantedAccess;
+
public long GrantedAccess
{
get { return _grantedAccess; }
set { _grantedAccess = value; }
}
- public bool AreAllAccessesGranted(TAccess access) where TAccess : struct
+ public bool AreAllAccessesGranted(TAccess access)
+ where TAccess : struct
{
long accessLong = Convert.ToInt64(access);
if ((_grantedAccess & accessLong) == accessLong)
return true;
-
- return false;
+ else
+ return false;
}
- public bool AreAnyAccessesGranted(TAccess access) where TAccess : struct
+ public bool AreAnyAccessesGranted(TAccess access)
+ where TAccess : struct
{
long accessLong = Convert.ToInt64(access);
if ((_grantedAccess & accessLong) != 0)
return true;
-
- return false;
+ else
+ return false;
}
}
@@ -74,12 +77,12 @@ namespace ProcessHacker.Common.Objects
/// The object to reference.
/// The granted access to the object.
/// The new handle.
- public int Allocate(IRefCounted obj, TAccess grantedAccess) where TAccess : struct
+ public int Allocate(IRefCounted obj, TAccess grantedAccess)
+ where TAccess : struct
{
- TEntry entry = new TEntry
- {
- GrantedAccess = Convert.ToInt64(grantedAccess)
- };
+ TEntry entry = new TEntry();
+
+ entry.GrantedAccess = Convert.ToInt64(grantedAccess);
return base.Allocate(obj, entry);
}
@@ -94,9 +97,10 @@ namespace ProcessHacker.Common.Objects
/// An object. This object has been referenced and must be
/// dereferenced once it is no longer needed.
///
- public IRefCounted ReferenceByHandle(int handle, TAccess access) where TAccess : struct
+ public IRefCounted ReferenceByHandle(int handle, TAccess access)
+ where TAccess : struct
{
- return this.ReferenceByHandle(handle, access, false);
+ return this.ReferenceByHandle(handle, access, false);
}
///
@@ -112,30 +116,34 @@ namespace ProcessHacker.Common.Objects
/// An object. This object has been referenced and must be
/// dereferenced once it is no longer needed.
///
- public IRefCounted ReferenceByHandle(int handle, TAccess access, bool throwOnAccessDenied) where TAccess : struct
+ public IRefCounted ReferenceByHandle(int handle, TAccess access, bool throwOnAccessDenied)
+ where TAccess : struct
{
TEntry entry;
+ IRefCounted obj;
// Reference the object.
- IRefCounted obj = this.ReferenceByHandle(handle, out entry);
+ obj = this.ReferenceByHandle(handle, out entry);
if (obj == null)
return null;
// Check the access.
- if (entry.AreAllAccessesGranted(access))
+ if (entry.AreAllAccessesGranted(access))
{
// OK, return the object.
return obj;
}
-
- // Access denied. Dereference the object and return.
- obj.Dereference();
+ else
+ {
+ // Access denied. Dereference the object and return.
+ obj.Dereference();
- if (throwOnAccessDenied)
- throw new UnauthorizedAccessException("Access denied.");
-
- return null;
+ if (throwOnAccessDenied)
+ throw new UnauthorizedAccessException("Access denied.");
+ else
+ return null;
+ }
}
///
@@ -149,7 +157,9 @@ namespace ProcessHacker.Common.Objects
/// An object. This object has been referenced and must be
/// dereferenced once it is no longer needed.
///
- public T ReferenceByHandle(int handle, TAccess access) where T : class, IRefCounted where TAccess : struct
+ public T ReferenceByHandle(int handle, TAccess access)
+ where T : class, IRefCounted
+ where TAccess : struct
{
return this.ReferenceByHandle(handle, access, false);
}
@@ -168,9 +178,11 @@ namespace ProcessHacker.Common.Objects
/// An object. This object has been referenced and must be
/// dereferenced once it is no longer needed.
///
- public T ReferenceByHandle(int handle, TAccess access, bool throwOnAccessDenied) where T : class, IRefCounted where TAccess : struct
+ public T ReferenceByHandle(int handle, TAccess access, bool throwOnAccessDenied)
+ where T : class, IRefCounted
+ where TAccess : struct
{
- IRefCounted obj = this.ReferenceByHandle(handle, access, throwOnAccessDenied);
+ IRefCounted obj = this.ReferenceByHandle(handle, access, throwOnAccessDenied);
if (obj == null)
return null;
@@ -178,12 +190,13 @@ namespace ProcessHacker.Common.Objects
// Check the type.
if (obj is T)
{
- return obj as T;
+ return (T)obj;
+ }
+ else
+ {
+ obj.Dereference();
+ return null;
}
-
- obj.Dereference();
-
- return null;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj b/1.x/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj
index d3c136c66..704e9fd35 100644
--- a/1.x/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj
+++ b/1.x/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj
@@ -10,7 +10,7 @@
Properties
ProcessHacker.Common
ProcessHacker.Common
- v4.5
+ v4.0
512
@@ -48,7 +48,6 @@
true
AnyCPU
AllRules.ruleset
- false
pdbonly
@@ -62,7 +61,6 @@
true
AnyCPU
AllRules.ruleset
- false
@@ -117,6 +115,7 @@
+
diff --git a/1.x/trunk/ProcessHacker.Common/Properties/AssemblyInfo.cs b/1.x/trunk/ProcessHacker.Common/Properties/AssemblyInfo.cs
index 44018ff4a..f99cfef91 100644
--- a/1.x/trunk/ProcessHacker.Common/Properties/AssemblyInfo.cs
+++ b/1.x/trunk/ProcessHacker.Common/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
using System.Reflection;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/1.x/trunk/ProcessHacker.Common/Settings/SettingDefaultAttribute.cs b/1.x/trunk/ProcessHacker.Common/Settings/SettingDefaultAttribute.cs
index b840335dc..567b0a46a 100644
--- a/1.x/trunk/ProcessHacker.Common/Settings/SettingDefaultAttribute.cs
+++ b/1.x/trunk/ProcessHacker.Common/Settings/SettingDefaultAttribute.cs
@@ -30,7 +30,7 @@ namespace ProcessHacker.Common.Settings
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class SettingDefaultAttribute : Attribute
{
- private readonly string _value;
+ private string _value;
///
/// Initializes a new instance of the SettingDefaultAttribute class.
diff --git a/1.x/trunk/ProcessHacker.Common/Settings/SettingsBase.cs b/1.x/trunk/ProcessHacker.Common/Settings/SettingsBase.cs
index 2c2c75cbf..a4e926b5f 100644
--- a/1.x/trunk/ProcessHacker.Common/Settings/SettingsBase.cs
+++ b/1.x/trunk/ProcessHacker.Common/Settings/SettingsBase.cs
@@ -32,17 +32,17 @@ namespace ProcessHacker.Common.Settings
///
public abstract class SettingsBase
{
- private readonly ISettingsStore _store;
- private readonly Dictionary _settings = new Dictionary();
- private readonly Dictionary _modifiedSettings = new Dictionary();
- private readonly Dictionary _defaultsCache = new Dictionary();
- private readonly Dictionary _typeCache = new Dictionary();
+ private ISettingsStore _store;
+ private Dictionary _settings = new Dictionary();
+ private Dictionary _modifiedSettings = new Dictionary();
+ private Dictionary _defaultsCache = new Dictionary();
+ private Dictionary _typeCache = new Dictionary();
///
/// Creates a settings class with the specified storage provider.
///
/// The storage provider.
- protected SettingsBase(ISettingsStore store)
+ public SettingsBase(ISettingsStore store)
{
_store = store;
}
@@ -76,15 +76,14 @@ namespace ProcessHacker.Common.Settings
{
if (valueType.IsPrimitive)
return Convert.ChangeType(value, valueType);
-
- if (valueType == typeof(string))
+ else if (valueType == typeof(string))
return value;
- TypeConverter converter = TypeDescriptor.GetConverter(valueType);
+ var converter = TypeDescriptor.GetConverter(valueType);
// Since all types can convert to System.String, we also need to make sure they can
// convert from System.String.
- if (converter != null && (converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))))
+ if (converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string)))
return converter.ConvertFromInvariantString(value);
throw new InvalidOperationException("The setting '" + value + "' has an unsupported type.");
@@ -100,15 +99,14 @@ namespace ProcessHacker.Common.Settings
{
if (valueType.IsPrimitive)
return (string)Convert.ChangeType(value, typeof(string));
-
- if (valueType == typeof(string))
+ else if (valueType == typeof(string))
return (string)value;
- TypeConverter converter = TypeDescriptor.GetConverter(valueType);
+ var converter = TypeDescriptor.GetConverter(valueType);
// Since all types can convert to System.String, we also need to make sure they can
// convert from System.String.
- if (converter != null && (converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string))))
+ if (converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(typeof(string)))
return converter.ConvertToInvariantString(value);
throw new InvalidOperationException("The setting '" + value + "' has an unsupported type.");
@@ -125,15 +123,12 @@ namespace ProcessHacker.Common.Settings
{
if (!_defaultsCache.ContainsKey(name))
{
- PropertyInfo property = this.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
- object[] attributes = property.GetCustomAttributes(typeof(SettingDefaultAttribute), true);
+ var property = this.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
+ var attributes = property.GetCustomAttributes(typeof(SettingDefaultAttribute), true);
if (attributes.Length == 1)
{
- SettingDefaultAttribute settingDefaultAttribute = attributes[0] as SettingDefaultAttribute;
-
- if (settingDefaultAttribute != null)
- this._defaultsCache.Add(name, settingDefaultAttribute.Value);
+ _defaultsCache.Add(name, (attributes[0] as SettingDefaultAttribute).Value);
}
else
{
@@ -173,6 +168,8 @@ namespace ProcessHacker.Common.Settings
private object GetValue(string name)
{
object value;
+ string settingValue;
+ Type settingType;
lock (_modifiedSettings)
{
@@ -186,14 +183,14 @@ namespace ProcessHacker.Common.Settings
return _settings[name];
}
- string settingValue = this._store.GetValue(name);
+ settingValue = _store.GetValue(name);
- if (string.IsNullOrEmpty(settingValue))
+ if (settingValue == null)
settingValue = this.GetSettingDefault(name);
- if (string.IsNullOrEmpty(settingValue))
- settingValue = string.Empty;
+ if (settingValue == null)
+ settingValue = "";
- Type settingType = this.GetSettingType(name);
+ settingType = this.GetSettingType(name);
try
{
@@ -253,7 +250,7 @@ namespace ProcessHacker.Common.Settings
{
lock (_modifiedSettings)
{
- foreach (KeyValuePair pair in _modifiedSettings)
+ foreach (var pair in _modifiedSettings)
{
_store.SetValue(pair.Key, this.ConvertToString(pair.Value, this.GetSettingType(pair.Key)));
}
diff --git a/1.x/trunk/ProcessHacker.Common/Settings/VolatileSettingsStore.cs b/1.x/trunk/ProcessHacker.Common/Settings/VolatileSettingsStore.cs
index 0dda0ce3b..5ffb44f5e 100644
--- a/1.x/trunk/ProcessHacker.Common/Settings/VolatileSettingsStore.cs
+++ b/1.x/trunk/ProcessHacker.Common/Settings/VolatileSettingsStore.cs
@@ -1,4 +1,8 @@
-namespace ProcessHacker.Common.Settings
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Common.Settings
{
public sealed class VolatileSettingsStore : ISettingsStore
{
diff --git a/1.x/trunk/ProcessHacker.Common/Settings/XmlFileSettingsStore.cs b/1.x/trunk/ProcessHacker.Common/Settings/XmlFileSettingsStore.cs
index 54a98c8db..23795c3a6 100644
--- a/1.x/trunk/ProcessHacker.Common/Settings/XmlFileSettingsStore.cs
+++ b/1.x/trunk/ProcessHacker.Common/Settings/XmlFileSettingsStore.cs
@@ -20,7 +20,10 @@
* along with Process Hacker. If not, see .
*/
+using System;
+using System.Collections.Generic;
using System.IO;
+using System.Text;
using System.Xml;
namespace ProcessHacker.Common.Settings
@@ -34,8 +37,8 @@ namespace ProcessHacker.Common.Settings
private const string _settingElementName = "setting";
private const string _nameAttributeName = "name";
- private readonly string _fileName;
- private readonly object _docLock = new object();
+ private string _fileName;
+ private object _docLock = new object();
private XmlDocument _doc;
private XmlNode _rootNode;
@@ -80,10 +83,7 @@ namespace ProcessHacker.Common.Settings
{
lock (_docLock)
{
- XmlNodeList nodes = _rootNode.SelectNodes(_settingElementName + "[@" + _nameAttributeName + "='" + name + "']");
-
- if (nodes == null)
- return null;
+ var nodes = _rootNode.SelectNodes(_settingElementName + "[@" + _nameAttributeName + "='" + name + "']");
if (nodes.Count == 0)
return null;
@@ -146,16 +146,16 @@ namespace ProcessHacker.Common.Settings
{
lock (_docLock)
{
- XmlNodeList nodes = _rootNode.SelectNodes(_settingElementName + "[@" + _nameAttributeName + "='" + name + "']");
+ var nodes = _rootNode.SelectNodes(_settingElementName + "[@" + _nameAttributeName + "='" + name + "']");
- if (nodes != null && nodes.Count != 0)
+ if (nodes.Count != 0)
{
nodes[0].InnerText = value;
}
else
{
- XmlElement settingElement = _doc.CreateElement(_settingElementName);
- XmlAttribute nameAttribute = _doc.CreateAttribute(_nameAttributeName);
+ var settingElement = _doc.CreateElement(_settingElementName);
+ var nameAttribute = _doc.CreateAttribute(_nameAttributeName);
nameAttribute.Value = name;
settingElement.Attributes.Append(nameAttribute);
diff --git a/1.x/trunk/ProcessHacker.Common/String255.cs b/1.x/trunk/ProcessHacker.Common/String255.cs
index b84fb6223..a62f20fb6 100644
--- a/1.x/trunk/ProcessHacker.Common/String255.cs
+++ b/1.x/trunk/ProcessHacker.Common/String255.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Common
{
@@ -108,8 +110,8 @@ namespace ProcessHacker.Common
fixed (char* buffer = this.Buffer)
{
- foreach (char t in str)
- buffer[this.Length++] = t;
+ for (int i = 0; i < str.Length; i++)
+ buffer[this.Length++] = str[i];
buffer[this.Length] = '\0';
}
@@ -119,11 +121,14 @@ namespace ProcessHacker.Common
{
fixed (char* buffer = this.Buffer)
{
- int result = LibC.WMemCmp(buffer, str.Buffer, this.Length < str.Length ? this.Length : str.Length);
+ int result;
+
+ result = LibC.WMemCmp(buffer, str.Buffer, this.Length < str.Length ? this.Length : str.Length);
if (result == 0)
return this.Length - str.Length;
- return result;
+ else
+ return result;
}
}
@@ -140,9 +145,10 @@ namespace ProcessHacker.Common
{
if (other is String255)
return this.Equals((String255)other);
- if (other is string)
+ else if (other is string)
return this.Equals((string)other);
- return false;
+ else
+ return false;
}
public bool Equals(String255 other)
@@ -189,8 +195,8 @@ namespace ProcessHacker.Common
if (ptr != null)
return (int)(ptr - buffer);
-
- return -1;
+ else
+ return -1;
}
}
@@ -198,9 +204,12 @@ namespace ProcessHacker.Common
{
int hashCode = 0x15051505;
- for (int i = 0; i < this.Length; i += 4)
+ fixed (char* buffer = this.Buffer)
{
- hashCode += hashCode ^ (hashCode << ((i % 4) * 8));
+ for (int i = 0; i < this.Length; i += 4)
+ {
+ hashCode += hashCode ^ (hashCode << ((i % 4) * 8));
+ }
}
return hashCode;
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/ActionSync.cs b/1.x/trunk/ProcessHacker.Common/Threading/ActionSync.cs
index d0d7c018c..8c59a7599 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/ActionSync.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/ActionSync.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using System.Threading;
namespace ProcessHacker.Common.Threading
@@ -32,8 +34,8 @@ namespace ProcessHacker.Common.Threading
public struct ActionSync
{
private int _value;
- private readonly int _target;
- private readonly Action _action;
+ private int _target;
+ private Action _action;
///
/// Initializes an action-sync structure.
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/FairResourceLock.cs b/1.x/trunk/ProcessHacker.Common/Threading/FairResourceLock.cs
index 7588a423d..75fb1ff37 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/FairResourceLock.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/FairResourceLock.cs
@@ -21,11 +21,8 @@
*/
#define DEFER_EVENT_CREATION
-
-#if DEBUG
-#define ENABLE_STATISTICS
-#define RIGOROUS_CHECKS
-#endif
+//#define ENABLE_STATISTICS
+//#define RIGOROUS_CHECKS
using System;
using System.Runtime.InteropServices;
@@ -124,18 +121,13 @@ namespace ProcessHacker.Common.Threading
public int PeakShrdWtrsCount;
}
- private struct WaitBlock
+ private unsafe struct WaitBlock
{
- public static readonly int SizeOf;
+ public static readonly int Size = Marshal.SizeOf(typeof(WaitBlock));
public WaitBlock* Flink;
public WaitBlock* Blink;
public int Flags;
-
- static WaitBlock()
- {
- SizeOf = Marshal.SizeOf(typeof(WaitBlock));
- }
}
private enum ListPosition
@@ -214,20 +206,20 @@ namespace ProcessHacker.Common.Threading
private WaitBlock* _firstSharedWaiter;
#if ENABLE_STATISTICS
- private int _exclusiveWaitersCount;
- private int _sharedWaitersCount;
+ private int _exclusiveWaitersCount = 0;
+ private int _sharedWaitersCount = 0;
- private int _acqExclCount;
- private int _acqShrdCount;
- private int _acqExclContCount;
- private int _acqShrdContCount;
- private int _acqExclBlkCount;
- private int _acqShrdBlkCount;
- private int _acqExclSlpCount;
- private int _acqShrdSlpCount;
- private int _insWaitBlkRetryCount;
- private int _peakExclWtrsCount;
- private int _peakShrdWtrsCount;
+ private int _acqExclCount = 0;
+ private int _acqShrdCount = 0;
+ private int _acqExclContCount = 0;
+ private int _acqShrdContCount = 0;
+ private int _acqExclBlkCount = 0;
+ private int _acqShrdBlkCount = 0;
+ private int _acqExclSlpCount = 0;
+ private int _acqShrdSlpCount = 0;
+ private int _insWaitBlkRetryCount = 0;
+ private int _peakExclWtrsCount = 0;
+ private int _peakShrdWtrsCount = 0;
#endif
///
@@ -249,7 +241,7 @@ namespace ProcessHacker.Common.Threading
_lock = new SpinLock();
_spinCount = Environment.ProcessorCount != 1 ? spinCount : 0;
- _waitersListHead = (WaitBlock*)Marshal.AllocHGlobal(WaitBlock.SizeOf);
+ _waitersListHead = (WaitBlock*)Marshal.AllocHGlobal(WaitBlock.Size);
_waitersListHead->Flink = _waitersListHead;
_waitersListHead->Blink = _waitersListHead;
_waitersListHead->Flags = 0;
@@ -726,7 +718,7 @@ namespace ProcessHacker.Common.Threading
public Statistics GetStatistics()
{
#if ENABLE_STATISTICS
- return new Statistics
+ return new Statistics()
{
AcqExcl = _acqExclCount,
AcqShrd = _acqShrdCount,
@@ -1134,7 +1126,7 @@ namespace ProcessHacker.Common.Threading
private void WakeShared()
{
WaitBlock wakeList = new WaitBlock();
- WaitBlock* wb;
+ WaitBlock* wb = null;
wakeList.Flink = &wakeList;
wakeList.Blink = &wakeList;
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/FastLock.cs b/1.x/trunk/ProcessHacker.Common/Threading/FastLock.cs
index efc735b7f..4c51e3369 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/FastLock.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/FastLock.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using System.Threading;
namespace ProcessHacker.Common.Threading
@@ -41,10 +43,13 @@ namespace ProcessHacker.Common.Threading
}
// Slow path 2 - wait on the event.
+
+ IntPtr newEvent;
+
// Note: see FastEvent.cs for a more detailed explanation of this
// technique.
- IntPtr newEvent = Interlocked.CompareExchange(ref this._event, IntPtr.Zero, IntPtr.Zero);
+ newEvent = Interlocked.CompareExchange(ref _event, IntPtr.Zero, IntPtr.Zero);
if (newEvent == IntPtr.Zero)
{
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/FastMutex.cs b/1.x/trunk/ProcessHacker.Common/Threading/FastMutex.cs
index 008cc5c5a..5a83cc3c3 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/FastMutex.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/FastMutex.cs
@@ -16,7 +16,7 @@ namespace ProcessHacker.Common.Threading
public struct FastMutexContext : IDisposable
{
private bool _disposed;
- private readonly FastMutex _fastMutex;
+ private FastMutex _fastMutex;
internal FastMutexContext(FastMutex fastMutex)
{
@@ -37,7 +37,7 @@ namespace ProcessHacker.Common.Threading
}
}
- private readonly object _lock = new object();
+ private object _lock = new object();
///
/// Acquires the mutex and prevents others from acquiring it.
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/FastResourceLock.cs b/1.x/trunk/ProcessHacker.Common/Threading/FastResourceLock.cs
index 3f78ebb86..cdac07d57 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/FastResourceLock.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/FastResourceLock.cs
@@ -21,11 +21,8 @@
*/
#define DEFER_EVENT_CREATION
-
-#if DEBUG
-#define ENABLE_STATISTICS
-#define RIGOROUS_CHECKS
-#endif
+//#define ENABLE_STATISTICS
+//#define RIGOROUS_CHECKS
using System;
using System.Threading;
@@ -201,24 +198,21 @@ namespace ProcessHacker.Common.Threading
private IntPtr _exclusiveWakeEvent;
#if ENABLE_STATISTICS
- private int _acqExclCount;
- private int _acqShrdCount;
- private int _acqExclContCount;
- private int _acqShrdContCount;
- private int _acqExclSlpCount;
- private int _acqShrdSlpCount;
- private int _peakExclWtrsCount;
- private int _peakShrdWtrsCount;
+ private int _acqExclCount = 0;
+ private int _acqShrdCount = 0;
+ private int _acqExclContCount = 0;
+ private int _acqShrdContCount = 0;
+ private int _acqExclSlpCount = 0;
+ private int _acqShrdSlpCount = 0;
+ private int _peakExclWtrsCount = 0;
+ private int _peakShrdWtrsCount = 0;
#endif
///
/// Creates a FastResourceLock.
///
public FastResourceLock()
- {
-#if ENABLE_STATISTICS
- this._acqExclContCount = 0;
-#endif
+ {
_value = 0;
#if !DEFER_EVENT_CREATION
@@ -353,8 +347,8 @@ namespace ProcessHacker.Common.Threading
Interlocked2.Set(
ref _peakExclWtrsCount,
- p => p < exclWtrsCount,
- p => exclWtrsCount
+ (p) => p < exclWtrsCount,
+ (p) => exclWtrsCount
);
#endif
@@ -463,8 +457,8 @@ namespace ProcessHacker.Common.Threading
Interlocked2.Set(
ref _peakShrdWtrsCount,
- p => p < shrdWtrsCount,
- p => shrdWtrsCount
+ (p) => p < shrdWtrsCount,
+ (p) => shrdWtrsCount
);
#endif
@@ -534,10 +528,12 @@ namespace ProcessHacker.Common.Threading
/// A reference to the event handle.
private void EnsureEventCreated(ref IntPtr handle)
{
+ IntPtr eventHandle;
+
if (Thread.VolatileRead(ref handle) != IntPtr.Zero)
return;
- IntPtr eventHandle = NativeMethods.CreateSemaphore(IntPtr.Zero, 0, int.MaxValue, null);
+ eventHandle = NativeMethods.CreateSemaphore(IntPtr.Zero, 0, int.MaxValue, null);
if (Interlocked.CompareExchange(ref handle, eventHandle, IntPtr.Zero) != IntPtr.Zero)
NativeMethods.CloseHandle(eventHandle);
@@ -551,7 +547,7 @@ namespace ProcessHacker.Common.Threading
public Statistics GetStatistics()
{
#if ENABLE_STATISTICS
- return new Statistics
+ return new Statistics()
{
AcqExcl = _acqExclCount,
AcqShrd = _acqShrdCount,
@@ -601,7 +597,9 @@ namespace ProcessHacker.Common.Threading
// Case 2: if we have shared waiters, release all of them.
else
{
- int sharedWaiters = (value >> LockSharedWaitersShift) & LockSharedWaitersMask;
+ int sharedWaiters;
+
+ sharedWaiters = (value >> LockSharedWaitersShift) & LockSharedWaitersMask;
if (Interlocked.CompareExchange(
ref _value,
@@ -824,17 +822,18 @@ namespace ProcessHacker.Common.Threading
value
) == value;
}
-
- if (((value >> LockSharedOwnersShift) & LockSharedOwnersMask) != 0)
+ else if (((value >> LockSharedOwnersShift) & LockSharedOwnersMask) != 0)
{
return Interlocked.CompareExchange(
- ref this._value,
+ ref _value,
value + LockSharedOwnersIncrement,
value
) == value;
}
-
- return false;
+ else
+ {
+ return false;
+ }
}
///
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/FastStack.cs b/1.x/trunk/ProcessHacker.Common/Threading/FastStack.cs
index 111ab2593..42fd55a71 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/FastStack.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/FastStack.cs
@@ -13,13 +13,8 @@ namespace ProcessHacker.Common.Threading
public FastStackNode Next;
}
- private readonly int _count;
- private FastStackNode _bottom;
-
- public FastStack(int count)
- {
- _count = count;
- }
+ private int _count = 0;
+ private FastStackNode _bottom = null;
public int Count
{
@@ -53,7 +48,7 @@ namespace ProcessHacker.Common.Threading
throw new InvalidOperationException("The stack is empty.");
// Try to replace the pointer.
- if (Interlocked.CompareExchange(
+ if (Interlocked.CompareExchange>(
ref _bottom,
bottom.Next,
bottom
@@ -68,11 +63,10 @@ namespace ProcessHacker.Common.Threading
public void Push(T value)
{
FastStackNode bottom;
+ FastStackNode entry;
- FastStackNode entry = new FastStackNode
- {
- Value = value
- };
+ entry = new FastStackNode();
+ entry.Value = value;
// Atomically replace the bottom of the stack.
while (true)
@@ -81,7 +75,7 @@ namespace ProcessHacker.Common.Threading
entry.Next = bottom;
// Try to replace the pointer.
- if (Interlocked.CompareExchange(
+ if (Interlocked.CompareExchange>(
ref _bottom,
entry,
bottom
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/IResourceLock.cs b/1.x/trunk/ProcessHacker.Common/Threading/IResourceLock.cs
index 58bcbdbb1..4d1baaf93 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/IResourceLock.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/IResourceLock.cs
@@ -1,4 +1,8 @@
-namespace ProcessHacker.Common.Threading
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Common.Threading
{
public interface IResourceLock
{
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/Interlocked2.cs b/1.x/trunk/ProcessHacker.Common/Threading/Interlocked2.cs
index e46da6230..351838a42 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/Interlocked2.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/Interlocked2.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using System.Threading;
namespace ProcessHacker.Common.Threading
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/NativeMethods.cs b/1.x/trunk/ProcessHacker.Common/Threading/NativeMethods.cs
index 589f412f5..4697175da 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/NativeMethods.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/NativeMethods.cs
@@ -1,6 +1,8 @@
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
+using System.Text;
namespace ProcessHacker.Common.Threading
{
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/RundownProtection.cs b/1.x/trunk/ProcessHacker.Common/Threading/RundownProtection.cs
index c5c1367d2..7752ee58f 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/RundownProtection.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/RundownProtection.cs
@@ -20,6 +20,7 @@
* along with Process Hacker. If not, see .
*/
+using System;
using System.Threading;
namespace ProcessHacker.Common.Threading
@@ -129,7 +130,9 @@ namespace ProcessHacker.Common.Threading
// Has the rundown already started?
if ((value & RundownActive) != 0)
{
- int newValue = Interlocked.Add(ref this._value, -RundownCountIncrement);
+ int newValue;
+
+ newValue = Interlocked.Add(ref _value, -RundownCountIncrement);
// Are we the last out? Set the event if that's the case.
if (newValue == RundownActive)
@@ -139,13 +142,15 @@ namespace ProcessHacker.Common.Threading
return;
}
-
- if (Interlocked.CompareExchange(
- ref this._value,
- value - RundownCountIncrement,
- value
- ) == value)
- return;
+ else
+ {
+ if (Interlocked.CompareExchange(
+ ref _value,
+ value - RundownCountIncrement,
+ value
+ ) == value)
+ return;
+ }
}
}
@@ -164,7 +169,9 @@ namespace ProcessHacker.Common.Threading
// Has the rundown already started?
if ((value & RundownActive) != 0)
{
- int newValue = Interlocked.Add(ref this._value, -RundownCountIncrement * count);
+ int newValue;
+
+ newValue = Interlocked.Add(ref _value, -RundownCountIncrement * count);
// Are we the last out? Set the event if that's the case.
if (newValue == RundownActive)
@@ -174,13 +181,15 @@ namespace ProcessHacker.Common.Threading
return;
}
-
- if (Interlocked.CompareExchange(
- ref this._value,
- value - RundownCountIncrement * count,
- value
- ) == value)
- return;
+ else
+ {
+ if (Interlocked.CompareExchange(
+ ref _value,
+ value - RundownCountIncrement * count,
+ value
+ ) == value)
+ return;
+ }
}
}
@@ -201,10 +210,12 @@ namespace ProcessHacker.Common.Threading
/// Whether all references were released.
public bool Wait(int millisecondsTimeout)
{
+ int value;
+
// Fast path. Just in case there are no users, we can go ahead
// and set the active flag and exit. Or if someone has already
// initiated the rundown, exit as well.
- int value = Interlocked.CompareExchange(ref this._value, RundownActive, 0);
+ value = Interlocked.CompareExchange(ref _value, RundownActive, 0);
if (value == 0 || value == RundownActive)
return true;
@@ -222,8 +233,8 @@ namespace ProcessHacker.Common.Threading
// Wait for the event, but only if we had users.
if ((value & ~RundownActive) != 0)
return _wakeEvent.Wait(millisecondsTimeout);
-
- return true;
+ else
+ return true;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/SemaphorePair.cs b/1.x/trunk/ProcessHacker.Common/Threading/SemaphorePair.cs
index dd180d8ae..25013a681 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/SemaphorePair.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/SemaphorePair.cs
@@ -5,9 +5,9 @@ namespace ProcessHacker.Common.Threading
{
public class SemaphorePair : IDisposable
{
- private readonly int _count;
- private readonly Semaphore _readSemaphore;
- private readonly Semaphore _writeSemaphore;
+ private int _count;
+ private Semaphore _readSemaphore;
+ private Semaphore _writeSemaphore;
public SemaphorePair(int count)
{
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/ThreadTask.cs b/1.x/trunk/ProcessHacker.Common/Threading/ThreadTask.cs
index 2a15c7011..26ce7310f 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/ThreadTask.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/ThreadTask.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using System.Threading;
namespace ProcessHacker.Common.Threading
@@ -11,11 +13,11 @@ namespace ProcessHacker.Common.Threading
public event ThreadTaskCompletedDelegate Completed;
public event ThreadTaskRunTaskDelegate RunTask;
- private Thread _thread;
+ private Thread _thread = null;
private object _result;
private Exception _exception;
- private bool _cancelled;
- private bool _running;
+ private bool _cancelled = false;
+ private bool _running = false;
public bool Cancelled
{
@@ -55,10 +57,8 @@ namespace ProcessHacker.Common.Threading
_cancelled = false;
_running = true;
- _thread = new Thread(this.ThreadStart)
- {
- IsBackground = true
- };
+ _thread = new Thread(this.ThreadStart);
+ _thread.IsBackground = true;
_thread.Start(param);
}
diff --git a/1.x/trunk/ProcessHacker.Common/Threading/WaitableQueue.cs b/1.x/trunk/ProcessHacker.Common/Threading/WaitableQueue.cs
index 4d6f2db27..fef78eb7e 100644
--- a/1.x/trunk/ProcessHacker.Common/Threading/WaitableQueue.cs
+++ b/1.x/trunk/ProcessHacker.Common/Threading/WaitableQueue.cs
@@ -1,12 +1,15 @@
-using System.Collections;
+using System;
+using System.Collections;
using System.Collections.Generic;
+using System.Text;
+using System.Threading;
namespace ProcessHacker.Common.Threading
{
- public class WaitableQueue : IEnumerable
+ public class WaitableQueue : IEnumerable, IEnumerable
{
- private readonly Queue _queue = new Queue();
- private readonly SemaphorePair _pair;
+ private Queue _queue = new Queue();
+ private SemaphorePair _pair;
public WaitableQueue()
: this(int.MaxValue)
@@ -47,8 +50,10 @@ namespace ProcessHacker.Common.Threading
public bool Dequeue(int timeout, out T item)
{
+ bool waitResult = true;
+
// Wait for an item to dequeue.
- bool waitResult = _pair.WaitRead(timeout);
+ waitResult = _pair.WaitRead(timeout);
// Dequeue an item if we waited successfully,
// otherwise pass the default value back.
diff --git a/1.x/trunk/ProcessHacker.Common/Tokenizer.cs b/1.x/trunk/ProcessHacker.Common/Tokenizer.cs
index 425ab979b..c21ef4a28 100644
--- a/1.x/trunk/ProcessHacker.Common/Tokenizer.cs
+++ b/1.x/trunk/ProcessHacker.Common/Tokenizer.cs
@@ -5,8 +5,8 @@ namespace ProcessHacker.Common
{
public class Tokenizer
{
- private readonly string _text;
- private int _i;
+ private string _text;
+ private int _i = 0;
public Tokenizer(string text)
{
@@ -90,7 +90,7 @@ namespace ProcessHacker.Common
_i++;
}
else
- return string.Empty;
+ return "";
while (_i < _text.Length)
{
@@ -102,29 +102,20 @@ namespace ProcessHacker.Common
}
else if (inEscape)
{
- switch (this._text[this._i])
- {
- case '\\':
- sb.Append('\\');
- break;
- case '"':
- sb.Append('"');
- break;
- case '\'':
- sb.Append('\'');
- break;
- case 'r':
- sb.Append('\r');
- break;
- case 'n':
- sb.Append('\n');
- break;
- case 't':
- sb.Append('\t');
- break;
- default:
- throw new Exception("Unrecognized escape sequence '\\" + this._text[this._i] + "'");
- }
+ if (_text[_i] == '\\')
+ sb.Append('\\');
+ else if (_text[_i] == '"')
+ sb.Append('"');
+ else if (_text[_i] == '\'')
+ sb.Append('\'');
+ else if (_text[_i] == 'r')
+ sb.Append('\r');
+ else if (_text[_i] == 'n')
+ sb.Append('\n');
+ else if (_text[_i] == 't')
+ sb.Append('\t');
+ else
+ throw new Exception("Unrecognized escape sequence '\\" + _text[_i] + "'");
_i++;
inEscape = false;
diff --git a/1.x/trunk/ProcessHacker.Common/Ui/ColumnHeaderExtensions.cs b/1.x/trunk/ProcessHacker.Common/Ui/ColumnHeaderExtensions.cs
index c7e812784..cef6c409d 100644
--- a/1.x/trunk/ProcessHacker.Common/Ui/ColumnHeaderExtensions.cs
+++ b/1.x/trunk/ProcessHacker.Common/Ui/ColumnHeaderExtensions.cs
@@ -10,7 +10,7 @@ namespace ProcessHacker.Common.Ui
public static class ColumnHeaderExtensions
{
[StructLayout(LayoutKind.Sequential)]
- public struct LVCOLUMN
+ private struct LVCOLUMN
{
public Int32 mask;
public Int32 cx;
@@ -45,13 +45,11 @@ namespace ProcessHacker.Common.Ui
for (int i = 0; i <= listView.Columns.Count - 1; i++)
{
IntPtr ColumnPtr = new IntPtr(i);
- LVCOLUMN lvColumn = new LVCOLUMN
- {
- mask = HDI_FORMAT
- };
+ LVCOLUMN lvColumn = new LVCOLUMN();
+ lvColumn.mask = HDI_FORMAT;
SendMessage(columnHeader, HDM_GETITEM, ColumnPtr, ref lvColumn);
- if (order != SortOrder.None && i == column.Index)
+ if (!(order == SortOrder.None) && i == column.Index)
{
switch (order)
{
diff --git a/1.x/trunk/ProcessHacker.Common/Ui/SortedListViewComparer.cs b/1.x/trunk/ProcessHacker.Common/Ui/SortedListViewComparer.cs
index 9aadbdff8..588d1298c 100644
--- a/1.x/trunk/ProcessHacker.Common/Ui/SortedListViewComparer.cs
+++ b/1.x/trunk/ProcessHacker.Common/Ui/SortedListViewComparer.cs
@@ -43,19 +43,26 @@ namespace ProcessHacker.Common.Ui
{
private class DefaultComparer : ISortedListViewComparer
{
+ private SortedListViewComparer _sortedListComparer;
+
+ public DefaultComparer(SortedListViewComparer sortedListComparer)
+ {
+ _sortedListComparer = sortedListComparer;
+ }
+
public int Compare(ListViewItem x, ListViewItem y, int column)
{
string sx, sy;
long ix, iy;
IComparable cx, cy;
- sx = x.SubItems[column].Text.Replace(",", string.Empty);
- sy = y.SubItems[column].Text.Replace(",", string.Empty);
+ sx = x.SubItems[column].Text.Replace(",", "");
+ sy = y.SubItems[column].Text.Replace(",", "");
- if (!long.TryParse(sx.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? sx.Substring(2) : sx,
+ if (!long.TryParse(sx.StartsWith("0x") ? sx.Substring(2) : sx,
sx.StartsWith("0x") ? NumberStyles.AllowHexSpecifier : 0,
null, out ix) ||
- !long.TryParse(sy.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? sy.Substring(2) : sy,
+ !long.TryParse(sy.StartsWith("0x") ? sy.Substring(2) : sy,
sy.StartsWith("0x") ? NumberStyles.AllowHexSpecifier : 0,
null, out iy))
{
@@ -72,17 +79,17 @@ namespace ProcessHacker.Common.Ui
}
}
- private readonly ListView _list;
- private bool _virtualMode;
+ private ListView _list;
+ private bool _virtualMode = false;
private RetrieveVirtualItemEventHandler _retrieveVirtualItem;
- private bool _triState;
+ private bool _triState = false;
private ISortedListViewComparer _comparer;
private ISortedListViewComparer _triStateComparer;
private int _sortColumn;
private SortOrder _sortOrder;
- private readonly Dictionary> _customSorters =
+ private Dictionary> _customSorters =
new Dictionary>();
- private readonly List _columnSortOrder = new List();
+ private List _columnSortOrder = new List();
///
/// Creates a new sorted list manager.
@@ -91,10 +98,10 @@ namespace ProcessHacker.Common.Ui
public SortedListViewComparer(ListView list)
{
_list = list;
- _list.ColumnClick += this.list_ColumnClick;
+ _list.ColumnClick += new ColumnClickEventHandler(list_ColumnClick);
_sortColumn = 0;
_sortOrder = SortOrder.Ascending;
- _comparer = new DefaultComparer();
+ _comparer = new DefaultComparer(this);
this.SetSortIcon();
}
@@ -135,7 +142,7 @@ namespace ProcessHacker.Common.Ui
set
{
if (value == null)
- _comparer = new DefaultComparer();
+ _comparer = new DefaultComparer(this);
else
_comparer = value;
}
@@ -229,20 +236,31 @@ namespace ProcessHacker.Common.Ui
// Avoid forcing handle creation before all other initialization
// has finished. This is done by handling the Layout event and
// performing the icon setting there.
- _list.DoDelayed(control => _list.Columns[_sortColumn].SetSortIcon(_sortOrder));
+ _list.DoDelayed((control) => _list.Columns[_sortColumn].SetSortIcon(_sortOrder));
+ }
+
+ private ListViewItem GetItem(int index)
+ {
+ if (_virtualMode)
+ {
+ var args = new RetrieveVirtualItemEventArgs(index);
+ _retrieveVirtualItem(this, args);
+ return args.Item;
+ }
+ else
+ {
+ return _list.Items[index];
+ }
}
private int ModifySort(int result, SortOrder order)
{
- switch (order)
- {
- case SortOrder.Ascending:
- return result;
- case SortOrder.Descending:
- return -result;
- default:
- return result;
- }
+ if (order == SortOrder.Ascending)
+ return result;
+ else if (order == SortOrder.Descending)
+ return -result;
+ else
+ return result;
}
private int Compare(ListViewItem x, ListViewItem y, int column)
diff --git a/1.x/trunk/ProcessHacker.Common/Utils.cs b/1.x/trunk/ProcessHacker.Common/Utils.cs
index 718ebe4e7..b1f296a63 100644
--- a/1.x/trunk/ProcessHacker.Common/Utils.cs
+++ b/1.x/trunk/ProcessHacker.Common/Utils.cs
@@ -25,6 +25,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
@@ -70,6 +71,8 @@ namespace ProcessHacker.Common
///
public static int UnitSpecifier = 4;
+ private static PropertyInfo _doubleBufferedProperty;
+
///
/// Aligns a number to the specified power-of-two alignment value.
///
@@ -130,7 +133,7 @@ namespace ProcessHacker.Common
/// True if the array contains the value, otherwise false.
public static bool Contains(this T[] array, T value)
{
- return Array.IndexOf(array, value) != -1;
+ return Array.IndexOf(array, value) != -1;
}
///
@@ -195,8 +198,8 @@ namespace ProcessHacker.Common
{
if (s.Length <= len)
return s;
-
- return s.Substring(0, len - 4) + " ...";
+ else
+ return s.Substring(0, len - 4) + " ...";
}
///
@@ -215,11 +218,24 @@ namespace ProcessHacker.Common
return sb.ToString();
}
+ ///
+ /// Clears and cleans up resources held by the menu items.
+ ///
+ public static void DisposeAndClear(this Menu.MenuItemCollection items)
+ {
+ //foreach (MenuItem item in items)
+ //{
+ // item.Dispose();
+ //}
+
+ items.Clear();
+ }
+
///
/// Disables the menu items contained in the specified menu.
///
/// The menu.
- public static void DisableAllMenuItems(MenuItem menu)
+ public static void DisableAllMenuItems(Menu menu)
{
foreach (MenuItem item in menu.MenuItems)
item.Enabled = false;
@@ -228,7 +244,7 @@ namespace ProcessHacker.Common
///
/// Disables all menu items.
///
- public static void DisableAll(this MenuItem menu)
+ public static void DisableAll(this Menu menu)
{
DisableAllMenuItems(menu);
}
@@ -521,7 +537,7 @@ namespace ProcessHacker.Common
double months = span.TotalDays * 12 / 365;
double years = months / 12;
double centuries = years / 100;
- string str;
+ string str = "";
// Start from the most general time unit and see if they can be used
// without any fractional component.
@@ -577,7 +593,7 @@ namespace ProcessHacker.Common
str = "a very short time";
// Turn 1 into "a", e.g. 1 minute -> a minute
- if (str.StartsWith("1 ", StringComparison.OrdinalIgnoreCase))
+ if (str.StartsWith("1 "))
{
// Special vowel case: a hour -> an hour
if (str[2] != 'h')
@@ -605,7 +621,7 @@ namespace ProcessHacker.Common
public static string FormatSize(uint size)
{
int i = 0;
- double s = size;
+ double s = (double)size;
while (s > 1024 && i < SizeUnitNames.Length && i < UnitSpecifier)
{
@@ -644,7 +660,7 @@ namespace ProcessHacker.Common
public static string FormatSize(ulong size)
{
int i = 0;
- double s = size;
+ double s = (double)size;
while (s > 1024 && i < SizeUnitNames.Length && i < UnitSpecifier)
{
@@ -708,7 +724,7 @@ namespace ProcessHacker.Common
// The last write time of the assembly, or DateTime.MaxValue if an exception occurred.
public static DateTime GetAssemblyLastWriteTime(Assembly assembly)
{
- if (string.IsNullOrEmpty(assembly.Location))
+ if (assembly.Location == null || assembly.Location == "")
return DateTime.MaxValue;
try
@@ -824,10 +840,10 @@ namespace ProcessHacker.Common
if (minimum < 0)
throw new ArgumentOutOfRangeException("minimum");
- foreach (int t in Primes)
+ for (int i = 0; i < Primes.Length; i++)
{
- if (t >= minimum)
- return t;
+ if (Primes[i] >= minimum)
+ return Primes[i];
}
for (int i = minimum | 1; i < int.MaxValue; i += 2)
@@ -936,8 +952,8 @@ namespace ProcessHacker.Common
{
if (c >= ' ' && c <= '~')
return c;
-
- return '.';
+ else
+ return '.';
}
///
@@ -949,8 +965,8 @@ namespace ProcessHacker.Common
{
StringBuilder sb = new StringBuilder();
- foreach (char t in s)
- sb.Append(MakePrintable(t));
+ for (int i = 0; i < s.Length; i++)
+ sb.Append(MakePrintable(s[i]));
return sb.ToString();
}
@@ -1043,7 +1059,7 @@ namespace ProcessHacker.Common
foreach (string s in args)
{
- if (s.StartsWith("-", StringComparison.OrdinalIgnoreCase))
+ if (s.StartsWith("-"))
{
if (dict.ContainsKey(s))
throw new ArgumentException("Option already specified.");
@@ -1108,7 +1124,7 @@ namespace ProcessHacker.Common
if (s.Read(buffer, 0, length) == 0)
throw new EndOfStreamException();
- return Encoding.ASCII.GetString(buffer);
+ return System.Text.Encoding.ASCII.GetString(buffer);
}
public static uint ReadUInt32(Stream s, Endianness type)
@@ -1145,7 +1161,7 @@ namespace ProcessHacker.Common
if (b == 0 && b2 == 0)
break;
- str.Append(Encoding.Unicode.GetChars(new[] { (byte)b, (byte)b2 }));
+ str.Append(Encoding.Unicode.GetChars(new byte[] { (byte)b, (byte)b2 }));
}
return str.ToString();
@@ -1174,7 +1190,7 @@ namespace ProcessHacker.Common
if (b2 == -1)
break;
- str.Append(Encoding.Unicode.GetChars(new[] { (byte)b, (byte)b2 }));
+ str.Append(Encoding.Unicode.GetChars(new byte[] { (byte)b, (byte)b2 }));
i += 2;
}
@@ -1298,6 +1314,35 @@ namespace ProcessHacker.Common
}
}
+ ///
+ /// Enables or disables double buffering for a control.
+ ///
+ /// The control.
+ /// The type of the control.
+ /// The new setting.
+ public static void SetDoubleBuffered(this Control c, Type t, bool value)
+ {
+ PropertyInfo doubleBufferedProperty = _doubleBufferedProperty;
+
+ if (doubleBufferedProperty == null)
+ {
+ _doubleBufferedProperty = doubleBufferedProperty = t.GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance);
+ }
+
+ doubleBufferedProperty.SetValue(c, value, null);
+ }
+
+ ///
+ /// Enables or disables double buffering for a control.
+ ///
+ /// The control to set the property on.
+ /// The new value.
+ public static void SetDoubleBuffered(this Control c, bool value)
+ {
+ c.SetDoubleBuffered(c.GetType(), value);
+ }
+
///
/// Shows a file in Windows Explorer.
///
@@ -1310,13 +1355,23 @@ namespace ProcessHacker.Common
///
/// Calculates the size of a structure.
///
- /// A power-of-two whole-structure alignment to apply.
- ///
+ /// The structure type.
/// The size of the structure.
- public static int SizeOf(int alignment, int size)
+ public static int SizeOf()
+ {
+ return System.Runtime.InteropServices.Marshal.SizeOf(typeof(T));
+ }
+
+ ///
+ /// Calculates the size of a structure.
+ ///
+ /// The structure type.
+ /// A power-of-two whole-structure alignment to apply.
+ /// The size of the structure.
+ public static int SizeOf(int alignment)
{
// HACK: This is wrong, but it works.
- return size + alignment;
+ return SizeOf() + alignment;
}
///
@@ -1381,14 +1436,17 @@ namespace ProcessHacker.Common
public static int ToInt32(this byte[] data, Endianness type)
{
- switch (type)
+ if (type == Endianness.Little)
{
- case Endianness.Little:
- return (data[0]) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
- case Endianness.Big:
- return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3]);
- default:
- throw new ArgumentException();
+ return (data[0]) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
+ }
+ else if (type == Endianness.Big)
+ {
+ return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3]);
+ }
+ else
+ {
+ throw new ArgumentException();
}
}
@@ -1399,16 +1457,19 @@ namespace ProcessHacker.Common
public static long ToInt64(this byte[] data, Endianness type)
{
- switch (type)
+ if (type == Endianness.Little)
{
- case Endianness.Little:
- return (data[0]) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24) |
- (data[4] << 32) | (data[5] << 40) | (data[6] << 48) | (data[7] << 56);
- case Endianness.Big:
- return (data[0] << 56) | (data[1] << 48) | (data[2] << 40) | (data[3] << 32) |
- (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | (data[7]);
- default:
- throw new ArgumentException();
+ return (data[0]) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24) |
+ (data[4] << 32) | (data[5] << 40) | (data[6] << 48) | (data[7] << 56);
+ }
+ else if (type == Endianness.Big)
+ {
+ return (data[0] << 56) | (data[1] << 48) | (data[2] << 40) | (data[3] << 32) |
+ (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | (data[7]);
+ }
+ else
+ {
+ throw new ArgumentException();
}
}
@@ -1417,15 +1478,12 @@ namespace ProcessHacker.Common
if (IntPtr.Size != data.Length)
throw new ArgumentException("data");
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(data.ToInt32(Endianness.Little));
- case sizeof(long):
- return new IntPtr(data.ToInt64(Endianness.Little));
- default:
- throw new ArgumentException("data");
- }
+ if (IntPtr.Size == sizeof(int))
+ return new IntPtr(data.ToInt32(Endianness.Little));
+ else if (IntPtr.Size == sizeof(long))
+ return new IntPtr(data.ToInt64(Endianness.Little));
+ else
+ throw new ArgumentException("data");
}
public static ushort ToUInt16(this byte[] data, Endianness type)
@@ -1435,14 +1493,17 @@ namespace ProcessHacker.Common
public static ushort ToUInt16(this byte[] data, int offset, Endianness type)
{
- switch (type)
+ if (type == Endianness.Little)
{
- case Endianness.Little:
- return (ushort)(data[offset] | (data[offset + 1] << 8));
- case Endianness.Big:
- return (ushort)((data[offset] << 8) | data[offset + 1]);
- default:
- throw new ArgumentException();
+ return (ushort)(data[offset] | (data[offset + 1] << 8));
+ }
+ else if (type == Endianness.Big)
+ {
+ return (ushort)((data[offset] << 8) | data[offset + 1]);
+ }
+ else
+ {
+ throw new ArgumentException();
}
}
@@ -1453,16 +1514,19 @@ namespace ProcessHacker.Common
public static uint ToUInt32(this byte[] data, int offset, Endianness type)
{
- switch (type)
+ if (type == Endianness.Little)
{
- case Endianness.Little:
- return (uint)(data[offset]) | (uint)(data[offset + 1] << 8) |
- (uint)(data[offset + 2] << 16) | (uint)(data[offset + 3] << 24);
- case Endianness.Big:
- return (uint)(data[offset] << 24) | (uint)(data[offset + 1] << 16) |
- (uint)(data[offset + 2] << 8) | (uint)(data[offset + 3]);
- default:
- throw new ArgumentException();
+ return (uint)(data[offset]) | (uint)(data[offset + 1] << 8) |
+ (uint)(data[offset + 2] << 16) | (uint)(data[offset + 3] << 24);
+ }
+ else if (type == Endianness.Big)
+ {
+ return (uint)(data[offset] << 24) | (uint)(data[offset + 1] << 16) |
+ (uint)(data[offset + 2] << 8) | (uint)(data[offset + 3]);
+ }
+ else
+ {
+ throw new ArgumentException();
}
}
@@ -1485,7 +1549,7 @@ namespace ProcessHacker.Common
if (buffer != null)
{
if (buffer.Length - offset < length)
- throw new ArgumentOutOfRangeException("buffer", "The buffer is too small for the specified offset and length.");
+ throw new ArgumentOutOfRangeException("The buffer is too small for the specified offset and length.");
}
else
{
@@ -1494,7 +1558,7 @@ namespace ProcessHacker.Common
// We don't have a buffer, so make sure the offset and length are zero.
if (offset != 0 || length != 0)
- throw new ArgumentOutOfRangeException("offset", "The offset and length must be zero for a null buffer.");
+ throw new ArgumentOutOfRangeException("The offset and length must be zero for a null buffer.");
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/WeakReference.cs b/1.x/trunk/ProcessHacker.Common/WeakReference.cs
new file mode 100644
index 000000000..a7d0bece0
--- /dev/null
+++ b/1.x/trunk/ProcessHacker.Common/WeakReference.cs
@@ -0,0 +1,39 @@
+using System;
+
+namespace ProcessHacker.Common
+{
+ public class WeakReference
+ where T : class
+ {
+ public static implicit operator T(WeakReference reference)
+ {
+ return reference.Target;
+ }
+
+ private WeakReference _weakReference;
+
+ public WeakReference(T obj)
+ : this(obj, false)
+ { }
+
+ public WeakReference(T obj, bool trackResurrection)
+ {
+ _weakReference = new WeakReference(obj, trackResurrection);
+ }
+
+ public bool Alive
+ {
+ get { return _weakReference.IsAlive; }
+ }
+
+ public bool TrackResurrection
+ {
+ get { return _weakReference.TrackResurrection; }
+ }
+
+ public T Target
+ {
+ get { return _weakReference.Target as T; }
+ }
+ }
+}
diff --git a/1.x/trunk/ProcessHacker.Common/WorkQueue.cs b/1.x/trunk/ProcessHacker.Common/WorkQueue.cs
index 4d2f93b76..b37f82208 100644
--- a/1.x/trunk/ProcessHacker.Common/WorkQueue.cs
+++ b/1.x/trunk/ProcessHacker.Common/WorkQueue.cs
@@ -37,10 +37,10 @@ namespace ProcessHacker.Common
///
public sealed class WorkItem
{
- private readonly WorkQueue _owner;
- private readonly string _tag;
- private readonly Delegate _work;
- private readonly object[] _args;
+ private WorkQueue _owner;
+ private string _tag;
+ private Delegate _work;
+ private object[] _args;
private bool _enabled = true;
private FastEvent _completedEvent = new FastEvent(false);
private object _result;
@@ -175,7 +175,7 @@ namespace ProcessHacker.Common
}
}
- private static readonly WorkQueue _globalWorkQueue = new WorkQueue();
+ private static WorkQueue _globalWorkQueue = new WorkQueue();
///
/// Gets the global work queue instance.
@@ -228,7 +228,7 @@ namespace ProcessHacker.Common
///
/// The work queue. This object is used as a lock.
///
- private readonly Queue _workQueue = new Queue();
+ private Queue _workQueue = new Queue();
///
/// The maximum number of worker threads. If there are less worker threads
/// than this limit, they will be created as necessary. If there are more
@@ -241,15 +241,15 @@ namespace ProcessHacker.Common
/// as necessary and the number of worker threads will never drop below
/// this number.
///
- private int _minWorkerThreads;
+ private int _minWorkerThreads = 0;
///
/// The pool of worker threads. This object is used as a lock.
///
- private readonly Dictionary _workerThreads = new Dictionary();
+ private Dictionary _workerThreads = new Dictionary();
///
/// The number of worker threads which are currently running work.
///
- private int _busyCount;
+ private int _busyCount = 0;
///
/// A worker will block on the work-arrived event for this amount of time
/// before terminating.
@@ -258,7 +258,13 @@ namespace ProcessHacker.Common
///
/// If true, prevents new work items from being queued.
///
- private volatile bool _isJoining;
+ private volatile bool _isJoining = false;
+
+ ///
+ /// Creates a new work queue.
+ ///
+ public WorkQueue()
+ { }
///
/// Gets the number of worker threads that are currently busy.
@@ -336,11 +342,9 @@ namespace ProcessHacker.Common
///
private void CreateWorkerThread()
{
- Thread workThread = new Thread(this.WorkerThreadStart, Utils.SixteenthStackSize)
- {
- IsBackground = true,
- Priority = ThreadPriority.Lowest
- };
+ Thread workThread = new Thread(this.WorkerThreadStart, Utils.SixteenthStackSize);
+ workThread.IsBackground = true;
+ workThread.Priority = ThreadPriority.Lowest;
workThread.SetApartmentState(ApartmentState.STA);
_workerThreads.Add(workThread.ManagedThreadId, workThread);
workThread.Start();
@@ -374,7 +378,7 @@ namespace ProcessHacker.Common
// Check for work items.
while (_workQueue.Count > 0)
{
- WorkItem workItem;
+ WorkItem workItem = null;
// Lock and re-check.
lock (_workQueue)
@@ -407,8 +411,11 @@ namespace ProcessHacker.Common
workItem.Enabled = false;
return true;
}
- // The work item is no longer in the queue.
- return false;
+ else
+ {
+ // The work item is no longer in the queue.
+ return false;
+ }
}
}
@@ -528,7 +535,7 @@ namespace ProcessHacker.Common
// Check for work.
if (_workQueue.Count > 0)
{
- WorkItem workItem;
+ WorkItem workItem = null;
// There is work, but we must lock and re-check.
lock (_workQueue)
@@ -546,7 +553,7 @@ namespace ProcessHacker.Common
else
{
// No work available. Wait for work.
- bool workArrived;
+ bool workArrived = false;
lock (_workQueue)
workArrived = Monitor.Wait(_workQueue, _noWorkTimeout);
@@ -556,14 +563,17 @@ namespace ProcessHacker.Common
// Work arrived. Go back so we can perform it.
continue;
}
- // No work arrived during the timeout period. Delete the thread.
- lock (this._workerThreads)
+ else
{
- // Check the minimum.
- if (this._workerThreads.Count > this._minWorkerThreads)
+ // No work arrived during the timeout period. Delete the thread.
+ lock (_workerThreads)
{
- this.DestroyWorkerThread();
- return;
+ // Check the minimum.
+ if (_workerThreads.Count > _minWorkerThreads)
+ {
+ this.DestroyWorkerThread();
+ return;
+ }
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Common/app.config b/1.x/trunk/ProcessHacker.Common/app.config
index b4ca687d2..89dc7d426 100644
--- a/1.x/trunk/ProcessHacker.Common/app.config
+++ b/1.x/trunk/ProcessHacker.Common/app.config
@@ -1,3 +1,3 @@
-
+
diff --git a/1.x/trunk/ProcessHacker.Native/Api/Enums.cs b/1.x/trunk/ProcessHacker.Native/Api/Enums.cs
index 2cdd47e6e..825d1dbc6 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/Enums.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/Enums.cs
@@ -179,7 +179,7 @@ namespace ProcessHacker.Native.Api
TruncateExisting = 5
}
- public enum GdiBlendMode
+ public enum GdiBlendMode : int
{
Black = 1,
NotMergePen,
@@ -200,7 +200,7 @@ namespace ProcessHacker.Native.Api
Last
}
- public enum GdiPenStyle
+ public enum GdiPenStyle : int
{
Solid = 0,
Dash,
@@ -213,7 +213,7 @@ namespace ProcessHacker.Native.Api
Alternate
}
- public enum GdiStockObject
+ public enum GdiStockObject : int
{
WhiteBrush = 0,
LightGrayBrush,
@@ -236,7 +236,7 @@ namespace ProcessHacker.Native.Api
DcPen
}
- public enum GetWindowLongOffset
+ public enum GetWindowLongOffset : int
{
WndProc = -4,
HInstance = -6,
@@ -248,14 +248,14 @@ namespace ProcessHacker.Native.Api
}
[Flags]
- public enum HeapEntry32Flags
+ public enum HeapEntry32Flags : int
{
Fixed = 0x00000001,
Free = 0x00000002,
Moveable = 0x00000004
}
- public enum LoadImageType
+ public enum LoadImageType : int
{
Bitmap = 0,
Icon = 1,
@@ -308,14 +308,14 @@ namespace ProcessHacker.Native.Api
LargePages = 0x20000000
}
- public enum MemoryType
+ public enum MemoryType : int
{
Image = 0x1000000,
Mapped = 0x40000,
Private = 0x20000
}
- public enum MibTcpState
+ public enum MibTcpState : int
{
Closed = 1,
Listening = 2,
@@ -331,7 +331,6 @@ namespace ProcessHacker.Native.Api
DeleteTcb = 12
}
- [Flags]
public enum MinidumpType : uint
{
Normal = 0x00000000,
@@ -457,41 +456,6 @@ namespace ProcessHacker.Native.Api
AboveNormal = 0x8000
}
- [Flags]
- public enum PropSheetPageFlags
- {
- Default = 0x0,
- DlgIndirect = 0x1,
- UseHIcon = 0x2,
- UseIconID = 0x4,
- UseTitle = 0x8,
- RtlReading = 0x10,
-
- HasHelp = 0x20,
- UseRefParent = 0x40,
- UseCallback = 0x80,
- Premature = 0x400,
-
- HideHeader = 0x800,
- UseHeaderTitle = 0x1000,
- UseHeaderSubTitle = 0x2000,
- UseFusionContext = 0x4000
- }
-
- public enum PropSheetPageCallbackMessage
- {
- AddRef = 0,
- Release = 1,
- Create = 2
- }
-
- public enum PropSheetNotification : uint
- {
- First = ~200u + 1, // -200
- SetActive = First - 0,
- KillActive = First - 1
- }
-
[Flags]
public enum RedrawWindowFlags
{
diff --git a/1.x/trunk/ProcessHacker.Native/Api/Extensions.cs b/1.x/trunk/ProcessHacker.Native/Api/Extensions.cs
index cbbe8f5d9..b7a636607 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/Extensions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/Extensions.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -29,7 +30,7 @@ namespace ProcessHacker.Native
{
public static class NativeExtensions
{
- private static bool NphNotAvailable;
+ private static bool NphNotAvailable = false;
public static ObjectBasicInformation GetBasicInfo(this SystemHandleEntry thisHandle)
{
@@ -41,34 +42,39 @@ namespace ProcessHacker.Native
public static ObjectBasicInformation GetBasicInfo(this SystemHandleEntry thisHandle, ProcessHandle process)
{
+ NtStatus status = NtStatus.Success;
IntPtr handle = new IntPtr(thisHandle.Handle);
IntPtr objectHandleI;
GenericHandle objectHandle = null;
int retLength;
+ int baseAddress;
- Win32.NtDuplicateObject(
- process,
- handle,
- ProcessHandle.Current,
- out objectHandleI,
- 0,
- 0,
- 0
- ).ThrowIf();
+ if (KProcessHacker.Instance == null)
+ {
+ if ((status = Win32.NtDuplicateObject(
+ process, handle, ProcessHandle.Current, out objectHandleI, 0, 0, 0)) >= NtStatus.Error)
+ Win32.Throw();
+
+ objectHandle = new GenericHandle(objectHandleI);
+ }
try
{
- objectHandle = new GenericHandle(objectHandleI);
-
- using (MemoryAlloc data = new MemoryAlloc(ObjectBasicInformation.SizeOf))
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(ObjectBasicInformation))))
{
- Win32.NtQueryObject(
- objectHandle,
- ObjectInformationClass.ObjectBasicInformation,
- data,
- data.Size,
- out retLength
- ).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ KProcessHacker.Instance.ZwQueryObject(process, handle, ObjectInformationClass.ObjectBasicInformation,
+ data, data.Size, out retLength, out baseAddress);
+ }
+ else
+ {
+ status = Win32.NtQueryObject(objectHandle, ObjectInformationClass.ObjectBasicInformation,
+ data, data.Size, out retLength);
+ }
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return data.ReadStruct();
}
@@ -91,49 +97,62 @@ namespace ProcessHacker.Native
if (includeThread)
{
- if (!string.IsNullOrEmpty(processName))
- return processName + " (" + clientId.ProcessId.ToString() + "): " + clientId.ThreadId.ToString();
-
- return "Non-existent process (" + clientId.ProcessId.ToString() + "): " + clientId.ThreadId.ToString();
+ if (processName != null)
+ return processName + " (" + clientId.ProcessId.ToString() + "): " +
+ clientId.ThreadId.ToString();
+ else
+ return "Non-existent process (" + clientId.ProcessId.ToString() + "): " +
+ clientId.ThreadId.ToString();
+ }
+ else
+ {
+ if (processName != null)
+ return processName + " (" + clientId.ProcessId.ToString() + ")";
+ else
+ return "Non-existent process (" + clientId.ProcessId.ToString() + ")";
}
-
- if (!string.IsNullOrEmpty(processName))
- return processName + " (" + clientId.ProcessId.ToString() + ")";
-
- return "Non-existent process (" + clientId.ProcessId.ToString() + ")";
}
private static string GetObjectNameNt(ProcessHandle process, IntPtr handle, GenericHandle dupHandle)
{
int retLength;
+ int baseAddress = 0;
- Win32.NtQueryObject(
- dupHandle,
- ObjectInformationClass.ObjectNameInformation,
- IntPtr.Zero,
- 0,
- out retLength
- );
+ if (KProcessHacker.Instance != null)
+ {
+ KProcessHacker.Instance.ZwQueryObject(process, handle, ObjectInformationClass.ObjectNameInformation,
+ IntPtr.Zero, 0, out retLength, out baseAddress);
+ }
+ else
+ {
+ Win32.NtQueryObject(dupHandle, ObjectInformationClass.ObjectNameInformation,
+ IntPtr.Zero, 0, out retLength);
+ }
if (retLength > 0)
{
using (MemoryAlloc oniMem = new MemoryAlloc(retLength))
{
- Win32.NtQueryObject(
- dupHandle,
- ObjectInformationClass.ObjectNameInformation,
- oniMem,
- oniMem.Size,
- out retLength
- ).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ if (KProcessHacker.Instance.ZwQueryObject(process, handle, ObjectInformationClass.ObjectNameInformation,
+ oniMem, oniMem.Size, out retLength, out baseAddress) >= NtStatus.Error)
+ throw new Exception("ZwQueryObject failed.");
+ }
+ else
+ {
+ if (Win32.NtQueryObject(dupHandle, ObjectInformationClass.ObjectNameInformation,
+ oniMem, oniMem.Size, out retLength) >= NtStatus.Error)
+ throw new Exception("NtQueryObject failed.");
+ }
- ObjectNameInformation oni = oniMem.ReadStruct();
- UnicodeString str = oni.Name;
+ var oni = oniMem.ReadStruct();
+ var str = oni.Name;
- //if (KProcessHacker.Instance != null)
- //str.Buffer = str.Buffer.Increment(oniMem.Memory.Decrement(baseAddress));
+ if (KProcessHacker.Instance != null)
+ str.Buffer = str.Buffer.Increment(oniMem.Memory.Decrement(baseAddress));
- return str.Text;
+ return str.Read();
}
}
@@ -147,7 +166,8 @@ namespace ProcessHacker.Native
public static ObjectInformation GetHandleInfo(this SystemHandleEntry thisHandle, bool getName)
{
- using (ProcessHandle process = new ProcessHandle(thisHandle.ProcessId, ProcessAccess.DupHandle))
+ using (ProcessHandle process = new ProcessHandle(thisHandle.ProcessId,
+ KProcessHacker.Instance != null ? OSVersion.MinProcessQueryInfoAccess : ProcessAccess.DupHandle))
{
return thisHandle.GetHandleInfo(process, getName);
}
@@ -162,24 +182,20 @@ namespace ProcessHacker.Native
{
IntPtr handle = new IntPtr(thisHandle.Handle);
IntPtr objectHandleI;
- int retLength;
+ int retLength = 0;
GenericHandle objectHandle = null;
if (thisHandle.Handle == 0 || thisHandle.Handle == -1 || thisHandle.Handle == -2)
throw new WindowsException(NtStatus.InvalidHandle);
// Duplicate the handle if we're not using KPH
- //if (KProcessHacker.Instance == null)
+ if (KProcessHacker.Instance == null)
{
- Win32.NtDuplicateObject(
- process,
- handle,
- ProcessHandle.Current,
- out objectHandleI,
- 0,
- 0,
- 0
- ).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtDuplicateObject(
+ process, handle, ProcessHandle.Current, out objectHandleI, 0, 0, 0)) >= NtStatus.Error)
+ Win32.Throw(status);
objectHandle = new GenericHandle(objectHandleI);
}
@@ -202,35 +218,45 @@ namespace ProcessHacker.Native
Windows.ObjectTypesLock.ReleaseShared();
}
- if (string.IsNullOrEmpty(info.TypeName))
+ if (info.TypeName == null)
{
- Win32.NtQueryObject(
- objectHandle,
- ObjectInformationClass.ObjectTypeInformation,
- IntPtr.Zero,
- 0,
- out retLength
- );
+ int baseAddress = 0;
+
+ if (KProcessHacker.Instance != null)
+ {
+ KProcessHacker.Instance.ZwQueryObject(process, handle, ObjectInformationClass.ObjectTypeInformation,
+ IntPtr.Zero, 0, out retLength, out baseAddress);
+ }
+ else
+ {
+ Win32.NtQueryObject(objectHandle, ObjectInformationClass.ObjectTypeInformation,
+ IntPtr.Zero, 0, out retLength);
+ }
if (retLength > 0)
{
using (MemoryAlloc otiMem = new MemoryAlloc(retLength))
{
- Win32.NtQueryObject(
- objectHandle,
- ObjectInformationClass.ObjectTypeInformation,
- otiMem,
- otiMem.Size,
- out retLength
- ).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ if (KProcessHacker.Instance.ZwQueryObject(process, handle, ObjectInformationClass.ObjectTypeInformation,
+ otiMem, otiMem.Size, out retLength, out baseAddress) >= NtStatus.Error)
+ throw new Exception("ZwQueryObject failed.");
+ }
+ else
+ {
+ if (Win32.NtQueryObject(objectHandle, ObjectInformationClass.ObjectTypeInformation,
+ otiMem, otiMem.Size, out retLength) >= NtStatus.Error)
+ throw new Exception("NtQueryObject failed.");
+ }
- ObjectTypeInformation oti = otiMem.ReadStruct();
- UnicodeString str = oti.Name;
+ var oti = otiMem.ReadStruct();
+ var str = oti.Name;
- //if (KProcessHacker.Instance != null)
- //str.Buffer = str.Buffer.Increment(otiMem.Memory.Decrement(baseAddress));
+ if (KProcessHacker.Instance != null)
+ str.Buffer = str.Buffer.Increment(otiMem.Memory.Decrement(baseAddress));
- info.TypeName = str.Text;
+ info.TypeName = str.Read();
Windows.ObjectTypesLock.AcquireExclusive();
@@ -252,14 +278,14 @@ namespace ProcessHacker.Native
// Get the object's name. If the object is a file we must take special
// precautions so that we don't hang.
- if (string.Equals(info.TypeName, "File", StringComparison.OrdinalIgnoreCase))
+ if (info.TypeName == "File")
{
- //if (KProcessHacker.Instance != null)
- //{
- // // Use KProcessHacker for files to avoid hangs.
- // info.OrigName = KProcessHacker.Instance.GetHandleObjectName(process, handle);
- //}
- //else
+ if (KProcessHacker.Instance != null)
+ {
+ // Use KProcessHacker for files to avoid hangs.
+ info.OrigName = KProcessHacker.Instance.GetHandleObjectName(process, handle);
+ }
+ else
{
// 0: No hack, query the thing normally.
// 1: No hack, use NProcessHacker.
@@ -289,16 +315,13 @@ namespace ProcessHacker.Native
// Use NProcessHacker.
using (MemoryAlloc oniMem = new MemoryAlloc(0x4000))
{
- NProcessHacker.PhQueryNameFileObject(
- objectHandle,
- oniMem,
- oniMem.Size,
- out retLength
- ).ThrowIf();
+ if (NProcessHacker.PhQueryNameFileObject(
+ objectHandle, oniMem, oniMem.Size, out retLength) >= NtStatus.Error)
+ throw new Exception("PhQueryNameFileObject failed.");
var oni = oniMem.ReadStruct();
- info.OrigName = oni.Name.Text;
+ info.OrigName = oni.Name.Read();
}
}
catch (DllNotFoundException)
@@ -316,7 +339,7 @@ namespace ProcessHacker.Native
{
// KProcessHacker and NProcessHacker not available. Fall back to using hack
// (i.e. not querying the name at all if the access is 0x0012019f).
- if (thisHandle.GrantedAccess != 0x0012019f)
+ if ((int)thisHandle.GrantedAccess != 0x0012019f)
info.OrigName = GetObjectNameNt(process, handle, objectHandle);
}
}
@@ -341,20 +364,33 @@ namespace ProcessHacker.Native
case "Key":
info.BestName = NativeUtils.FormatNativeKeyName(info.OrigName);
+
break;
case "Process":
{
int processId;
- using (NativeHandle processHandle = new NativeHandle(process, handle, OSVersion.MinProcessQueryInfoAccess))
+ if (KProcessHacker.Instance != null)
{
- if ((processId = Win32.GetProcessId(processHandle)) == 0)
- Win32.Throw();
+ processId = KProcessHacker.Instance.KphGetProcessId(process, handle);
+
+ if (processId == 0)
+ throw new Exception("Invalid PID");
+ }
+ else
+ {
+ using (var processHandle =
+ new NativeHandle(process, handle, OSVersion.MinProcessQueryInfoAccess))
+ {
+ if ((processId = Win32.GetProcessId(processHandle)) == 0)
+ Win32.Throw();
+ }
}
info.BestName = (new ClientId(processId, 0)).GetName(false);
}
+
break;
case "Thread":
@@ -362,82 +398,106 @@ namespace ProcessHacker.Native
int processId;
int threadId;
- using (var threadHandle = new NativeHandle(process, handle, OSVersion.MinThreadQueryInfoAccess))
+ if (KProcessHacker.Instance != null)
{
- var basicInfo = ThreadHandle.FromHandle(threadHandle).GetBasicInformation();
+ threadId = KProcessHacker.Instance.KphGetThreadId(process, handle, out processId);
- threadId = basicInfo.ClientId.ThreadId;
- processId = basicInfo.ClientId.ProcessId;
+ if (threadId == 0 || processId == 0)
+ throw new Exception("Invalid TID or PID");
+ }
+ else
+ {
+ using (var threadHandle =
+ new NativeHandle(process, handle, OSVersion.MinThreadQueryInfoAccess))
+ {
+ var basicInfo = ThreadHandle.FromHandle(threadHandle).GetBasicInformation();
+
+ threadId = basicInfo.ClientId.ThreadId;
+ processId = basicInfo.ClientId.ProcessId;
+ }
}
info.BestName = (new ClientId(processId, threadId)).GetName(true);
}
+
break;
case "TmEn":
{
- using (NativeHandle enHandleDup = new NativeHandle(process, handle, EnlistmentAccess.QueryInformation))
- using (EnlistmentHandle enHandle = EnlistmentHandle.FromHandle(enHandleDup))
+ using (var enHandleDup =
+ new NativeHandle(process, handle, EnlistmentAccess.QueryInformation))
{
- info.BestName = enHandle.BasicInformation.EnlistmentId.ToString("B");
+ var enHandle = EnlistmentHandle.FromHandle(enHandleDup);
+
+ info.BestName = enHandle.GetBasicInformation().EnlistmentId.ToString("B");
}
}
break;
case "TmRm":
{
- using (var rmHandleDup = new NativeHandle(process, handle, ResourceManagerAccess.QueryInformation))
+ using (var rmHandleDup =
+ new NativeHandle(process, handle, ResourceManagerAccess.QueryInformation))
{
var rmHandle = ResourceManagerHandle.FromHandle(rmHandleDup);
- info.BestName = rmHandle.Description;
+ info.BestName = rmHandle.GetDescription();
if (string.IsNullOrEmpty(info.BestName))
- info.BestName = rmHandle.Guid.ToString("B");
+ info.BestName = rmHandle.GetGuid().ToString("B");
}
}
break;
case "TmTm":
{
- using (NativeHandle tmHandleDup = new NativeHandle(process, handle, TmAccess.QueryInformation))
- using (TmHandle tmHandle = TmHandle.FromHandle(tmHandleDup))
+ using (var tmHandleDup =
+ new NativeHandle(process, handle, TmAccess.QueryInformation))
{
- info.BestName = FileUtils.GetFileName(FileUtils.GetFileName(tmHandle.LogFileName));
+ var tmHandle = TmHandle.FromHandle(tmHandleDup);
+
+ info.BestName = FileUtils.GetFileName(FileUtils.GetFileName(tmHandle.GetLogFileName()));
if (string.IsNullOrEmpty(info.BestName))
- info.BestName = tmHandle.BasicInformation.TmIdentity.ToString("B");
+ info.BestName = tmHandle.GetBasicInformation().TmIdentity.ToString("B");
}
}
break;
case "TmTx":
{
- using (var transactionHandleDup = new NativeHandle(process, handle, TransactionAccess.QueryInformation))
+ using (var transactionHandleDup =
+ new NativeHandle(process, handle, TransactionAccess.QueryInformation))
{
- TransactionHandle transactionHandle = TransactionHandle.FromHandle(transactionHandleDup);
+ var transactionHandle = TransactionHandle.FromHandle(transactionHandleDup);
- info.BestName = transactionHandle.Description;
+ info.BestName = transactionHandle.GetDescription();
if (string.IsNullOrEmpty(info.BestName))
- info.BestName = transactionHandle.BasicInformation.TransactionId.ToString("B");
+ info.BestName = transactionHandle.GetBasicInformation().TransactionId.ToString("B");
}
}
break;
case "Token":
{
- using (var tokenHandleDup = new NativeHandle(process, handle, TokenAccess.Query))
- using (TokenHandle tokenHandle = TokenHandle.FromHandle(tokenHandleDup))
- using (tokenHandle.User)
+ using (var tokenHandleDup =
+ new NativeHandle(process, handle, TokenAccess.Query))
{
- info.BestName = tokenHandle.User.GetFullName(true) + ": 0x" + tokenHandle.Statistics.AuthenticationId;
+ var tokenHandle = TokenHandle.FromHandle(tokenHandleDup);
+ var sid = tokenHandle.GetUser();
+
+ using (sid)
+ info.BestName = sid.GetFullName(true) + ": 0x" +
+ tokenHandle.GetStatistics().AuthenticationId.ToString();
}
}
+
break;
default:
- if (!string.IsNullOrEmpty(info.OrigName))
+ if (info.OrigName != null &&
+ info.OrigName != "")
{
info.BestName = info.OrigName;
}
@@ -451,7 +511,7 @@ namespace ProcessHacker.Native
}
catch
{
- if (!string.IsNullOrEmpty(info.OrigName))
+ if (info.OrigName != null && info.OrigName != "")
{
info.BestName = info.OrigName;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Api/Functions.cs b/1.x/trunk/ProcessHacker.Native/Api/Functions.cs
index 5fc47f803..51647ecdb 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/Functions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/Functions.cs
@@ -35,6 +35,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
+using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
namespace ProcessHacker.Native.Api
@@ -441,7 +442,7 @@ namespace ProcessHacker.Native.Api
[In] IntPtr ImageBase
);
- [DllImport("imagehlp.dll", SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true, CharSet = CharSet.Ansi)]
+ [DllImport("imagehlp.dll", SetLastError = true, CharSet = CharSet.Ansi)]
public static extern bool MapAndLoad(
[In] string ImageName,
[In] [Optional] string DllPath,
@@ -2590,8 +2591,8 @@ namespace ProcessHacker.Native.Api
public static extern IntPtr SendMessage(
[In] IntPtr hWnd,
[In] WindowMessage msg,
- [In] IntPtr w,
- [In] IntPtr l
+ [In] int w,
+ [In] int l
);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
diff --git a/1.x/trunk/ProcessHacker.Native/Api/HResult.cs b/1.x/trunk/ProcessHacker.Native/Api/HResult.cs
index a15542d46..b91d0cb78 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/HResult.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/HResult.cs
@@ -21,6 +21,7 @@
* along with Process Hacker. If not, see .
*/
+using System;
using System.Runtime.InteropServices;
namespace ProcessHacker.Native.Api
diff --git a/1.x/trunk/ProcessHacker.Native/Api/ISecurityInformation.cs b/1.x/trunk/ProcessHacker.Native/Api/ISecurityInformation.cs
index 80186163b..4938bca58 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/ISecurityInformation.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/ISecurityInformation.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using System.Runtime.InteropServices;
namespace ProcessHacker.Native.Api
diff --git a/1.x/trunk/ProcessHacker.Native/Api/LsaFunctions.cs b/1.x/trunk/ProcessHacker.Native/Api/LsaFunctions.cs
index 0e57c8493..a6a69f412 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/LsaFunctions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/LsaFunctions.cs
@@ -21,7 +21,9 @@
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Text;
using ProcessHacker.Native.Security;
namespace ProcessHacker.Native.Api
diff --git a/1.x/trunk/ProcessHacker.Native/Api/LsaStructs.cs b/1.x/trunk/ProcessHacker.Native/Api/LsaStructs.cs
index 2b082ff77..b5fe9b79d 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/LsaStructs.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/LsaStructs.cs
@@ -21,7 +21,9 @@
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Text;
namespace ProcessHacker.Native.Api
{
@@ -60,13 +62,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct LsaTrustInformation
{
- public static readonly int SizeOf;
-
- static LsaTrustInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(LsaTrustInformation));
- }
-
public UnicodeString Name;
public IntPtr Sid; // Sid*
}
@@ -74,13 +69,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct Msv1_0_InteractiveLogon
{
- public static readonly int SizeOf;
-
- static Msv1_0_InteractiveLogon()
- {
- SizeOf = Marshal.SizeOf(typeof(Msv1_0_InteractiveLogon));
- }
-
public Msv1_0_LogonSubmitType MessageType;
public UnicodeString LogonDomainName;
public UnicodeString UserName;
@@ -111,13 +99,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct PolicyPrivilegeDefinition
{
- public static readonly int SizeOf;
-
- static PolicyPrivilegeDefinition()
- {
- SizeOf = Marshal.SizeOf(typeof(PolicyPrivilegeDefinition));
- }
-
public UnicodeString Name;
public Luid LocalValue;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs b/1.x/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs
index fe065c3a1..f72d1a20b 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs
@@ -84,9 +84,9 @@ namespace ProcessHacker.Native.Api
public const string TransactionManagerPath = @"\TransactionManager";
public static readonly IntPtr KnownAceSidStartOffset = Marshal.OffsetOf(typeof(KnownAceStruct), "SidStart");
- public static readonly int SecurityDescriptorMinLength = SecurityDescriptorStruct.SizeOf;
+ public static readonly int SecurityDescriptorMinLength = Marshal.SizeOf(typeof(SecurityDescriptorStruct));
public static readonly int SecurityMaxSidSize =
- SidStruct.SizeOf - sizeof(int) + (SidMaxSubAuthorities * sizeof(int));
+ Marshal.SizeOf(typeof(SidStruct)) - sizeof(int) + (SidMaxSubAuthorities * sizeof(int));
public static readonly IntPtr UserSharedData = new IntPtr(0x7ffe0000);
public static int CsrMakeApiNumber(int dllIndex, int apiIndex)
diff --git a/1.x/trunk/ProcessHacker.Native/Api/NativeEnums.cs b/1.x/trunk/ProcessHacker.Native/Api/NativeEnums.cs
index 18b08cf76..15d0f6e64 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/NativeEnums.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/NativeEnums.cs
@@ -210,7 +210,6 @@ namespace ProcessHacker.Native.Api
MaxDebugObjectInfoClass
}
- [Flags]
public enum DeviceControlAccess : int
{
Any = 0,
@@ -425,7 +424,7 @@ namespace ProcessHacker.Native.Api
OverwriteIf = 0x5
}
- public enum FileInformationClass
+ public enum FileInformationClass : int
{
FileDirectoryInformation = 1, // dir
FileFullDirectoryInformation, // dir
diff --git a/1.x/trunk/ProcessHacker.Native/Api/NativeFunctions.cs b/1.x/trunk/ProcessHacker.Native/Api/NativeFunctions.cs
index 02d8913f2..c571bcdf7 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/NativeFunctions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/NativeFunctions.cs
@@ -1507,15 +1507,6 @@ namespace ProcessHacker.Native.Api
[Out] [Optional] out int ReturnLength
);
- [DllImport("ntdll.dll")]
- public static unsafe extern NtStatus NtQueryInformationToken(
- [In] IntPtr TokenHandle,
- [In] TokenInformationClass TokenInformationClass,
- void* TokenInformation,
- [In] int TokenInformationLength,
- [Optional] void* ReturnLength
- );
-
[DllImport("ntdll.dll")]
public static extern NtStatus NtQueryInformationToken(
[In] IntPtr TokenHandle,
@@ -1676,14 +1667,6 @@ namespace ProcessHacker.Native.Api
[Out] [Optional] out int ReturnLength
);
- [DllImport("ntdll.dll")]
- public static unsafe extern NtStatus NtQuerySystemInformation(
- [In] SystemInformationClass SystemInformationClass,
- void* SystemInformation,
- [In] int SystemInformationLength,
- int* ReturnLength
- );
-
[DllImport("ntdll.dll")]
public static extern NtStatus NtQuerySystemInformation(
[In] SystemInformationClass SystemInformationClass,
@@ -2520,7 +2503,7 @@ namespace ProcessHacker.Native.Api
[DllImport("ntdll.dll", CharSet = CharSet.Unicode)]
public static extern NtStatus LdrGetDllHandle(
[In] [Optional] string DllPath,
- [In] [Optional] int DllCharacteristics,
+ [In] [Optional] ref int DllCharacteristics,
[In] ref UnicodeString DllName,
[Out] out IntPtr DllHandle
);
@@ -2528,7 +2511,7 @@ namespace ProcessHacker.Native.Api
[DllImport("ntdll.dll")]
public static extern NtStatus LdrGetProcedureAddress(
[In] IntPtr DllHandle,
- [In] [Optional] IntPtr ProcedureName,
+ [In] [Optional] ref AnsiString ProcedureName,
[In] [Optional] int ProcedureNumber,
[Out] out IntPtr ProcedureAddress
);
@@ -2536,7 +2519,7 @@ namespace ProcessHacker.Native.Api
[DllImport("ntdll.dll", CharSet = CharSet.Unicode)]
public static extern NtStatus LdrLoadDll(
[In] [Optional] string DllPath,
- [In] [Optional] int DllCharacteristics,
+ [In] [Optional] ref int DllCharacteristics,
[In] ref UnicodeString DllName,
[Out] out IntPtr DllHandle
);
@@ -3311,14 +3294,6 @@ namespace ProcessHacker.Native.Api
[In] IntPtr Length
);
-
- [DllImport("ntdll.dll")]
- public static extern unsafe void RtlMoveMemory(
- void* Destination,
- void* Source,
- [In] IntPtr Length
- );
-
[DllImport("ntdll.dll")]
public static extern void RtlZeroMemory(
[In] IntPtr Destination,
diff --git a/1.x/trunk/ProcessHacker.Native/Api/NativeStructs.cs b/1.x/trunk/ProcessHacker.Native/Api/NativeStructs.cs
index b8a053771..243f8848f 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/NativeStructs.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/NativeStructs.cs
@@ -99,13 +99,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct AclSizeInformation
{
- public static readonly int SizeOf;
-
- static AclSizeInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(AclSizeInformation));
- }
-
public int AceCount;
public int AclBytesInUse;
public int AclBytesFree;
@@ -126,10 +119,11 @@ namespace ProcessHacker.Native.Api
{
public AnsiString(string str)
{
- using (UnicodeString unicodeStr = new UnicodeString(str))
- {
- this = unicodeStr.ToAnsiString();
- }
+ UnicodeString unicodeStr;
+
+ unicodeStr = new UnicodeString(str);
+ this = unicodeStr.ToAnsiString();
+ unicodeStr.Dispose();
}
public ushort Length;
@@ -147,9 +141,11 @@ namespace ProcessHacker.Native.Api
public UnicodeString ToUnicodeString()
{
+ NtStatus status;
UnicodeString unicodeStr = new UnicodeString();
- Win32.RtlAnsiStringToUnicodeString(ref unicodeStr, ref this, true).ThrowIf();
+ if ((status = Win32.RtlAnsiStringToUnicodeString(ref unicodeStr, ref this, true)) >= NtStatus.Error)
+ Win32.Throw(status);
return unicodeStr;
}
@@ -158,13 +154,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct BaseCreateProcessMsg
{
- public static readonly int SizeOf;
-
- static BaseCreateProcessMsg()
- {
- SizeOf = Marshal.SizeOf(typeof(BaseCreateProcessMsg));
- }
-
public IntPtr ProcessHandle;
public IntPtr ThreadHandle;
public ClientId ClientId;
@@ -184,8 +173,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ClientId
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ClientId));
-
public ClientId(int processId, int threadId)
{
this.UniqueProcess = new IntPtr(processId);
@@ -195,15 +182,8 @@ namespace ProcessHacker.Native.Api
public IntPtr UniqueProcess;
public IntPtr UniqueThread;
- public int ProcessId
- {
- get { return this.UniqueProcess.ToInt32(); }
- }
-
- public int ThreadId
- {
- get { return this.UniqueThread.ToInt32(); }
- }
+ public int ProcessId { get { return this.UniqueProcess.ToInt32(); } }
+ public int ThreadId { get { return this.UniqueThread.ToInt32(); } }
}
[StructLayout(LayoutKind.Sequential)]
@@ -262,13 +242,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ContextAmd64
{
- public static readonly int SizeOf;
-
- static ContextAmd64()
- {
- SizeOf = Marshal.SizeOf(typeof(ContextAmd64));
- }
-
public long P1Home;
public long P2Home;
public long P3Home;
@@ -454,13 +427,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct EnlistmentBasicInformation
{
- public static readonly int SizeOf;
-
- static EnlistmentBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(EnlistmentBasicInformation));
- }
-
public Guid EnlistmentId;
public Guid TransactionId;
public Guid ResourceManagerId;
@@ -469,13 +435,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct EventBasicInformation
{
- public static readonly int SizeOf;
-
- static EventBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(EventBasicInformation));
- }
-
public EventType EventType;
public int EventState;
}
@@ -521,13 +480,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileBasicInformation
{
- public static readonly int SizeOf;
-
- static FileBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileBasicInformation));
- }
-
public long CreationTime;
public long LastAccessTime;
public long LastWriteTime;
@@ -538,13 +490,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileCompletionInformation
{
- public static readonly int SizeOf;
-
- static FileCompletionInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileCompletionInformation));
- }
-
public IntPtr Port;
public IntPtr Key;
}
@@ -552,14 +497,8 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileDirectoryInformation
{
- public static readonly int SizeOf;
- public static readonly int FileNameOffset;
-
- static FileDirectoryInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileDirectoryInformation));
- FileNameOffset = Marshal.OffsetOf(typeof(FileDirectoryInformation), "FileName").ToInt32();
- }
+ public static int FileNameOffset =
+ Marshal.OffsetOf(typeof(FileDirectoryInformation), "FileName").ToInt32();
public int NextEntryOffset;
public int FileIndex;
@@ -578,13 +517,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileDispositionInformation
{
- public static readonly int SizeOf;
-
- static FileDispositionInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileDispositionInformation));
- }
-
[MarshalAs(UnmanagedType.I1)]
public bool DeleteFile;
}
@@ -598,28 +530,12 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileEndOfFileInformation
{
- public static readonly int SizeOf;
-
- static FileEndOfFileInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileEndOfFileInformation));
- }
-
public long EndOfFile;
}
[StructLayout(LayoutKind.Sequential)]
public struct FileFsAttributeInformation
{
- public static readonly int SizeOf;
- public static readonly int FileSystemNameOffset;
-
- static FileFsAttributeInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileFsAttributeInformation));
- FileSystemNameOffset = Marshal.OffsetOf(typeof(FileFsAttributeInformation), "FileSystemName").ToInt32();
- }
-
public int FileSystemAttributes;
public int MaximumComponentNameLength;
public int FileSystemNameLength;
@@ -638,22 +554,11 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileFsVolumeInformation
{
- public static readonly int SizeOf;
- public static readonly int VolumeLabelOffset;
-
- static FileFsVolumeInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileFsVolumeInformation));
- VolumeLabelOffset = Marshal.OffsetOf(typeof(FileFsVolumeInformation), "VolumeLabel").ToInt32();
- }
-
public long VolumeCreationTime;
public int VolumeSerialNumber;
public int VolumeLabelLength;
-
[MarshalAs(UnmanagedType.I1)]
public bool SupportsObjects;
-
public short VolumeLabel;
// Volume label string follows (WCHAR).
}
@@ -689,14 +594,8 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileNameInformation
{
- public static readonly int SizeOf;
- public static int FileNameOffset;
-
- static FileNameInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileNameInformation));
- FileNameOffset = Marshal.OffsetOf(typeof(FileNameInformation), "FileName").ToInt32();
- }
+ public static int FileNameOffset =
+ Marshal.OffsetOf(typeof(FileNameInformation), "FileName").ToInt32();
public int FileNameLength;
public short FileName;
@@ -729,13 +628,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FilePipeInformation
{
- public static readonly int SizeOf;
-
- static FilePipeInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FilePipeInformation));
- }
-
public PipeType ReadMode;
public PipeCompletionMode CompletionMode;
}
@@ -743,13 +635,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FilePipeLocalInformation
{
- public static readonly int SizeOf;
-
- static FilePipeLocalInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FilePipeLocalInformation));
- }
-
public PipeType NamedPipeType;
public PipeConfiguration NamedPipeConfiguration;
public int MaximumInstances;
@@ -791,33 +676,17 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FilePositionInformation
{
- public static readonly int SizeOf;
-
- static FilePositionInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FilePositionInformation));
- }
-
public long CurrentByteOffset;
}
[StructLayout(LayoutKind.Sequential)]
public struct FileStandardInformation
{
- public static readonly int SizeOf;
-
- static FileStandardInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileStandardInformation));
- }
-
public long AllocationSize;
public long EndOfFile;
public int NumberOfLinks;
-
[MarshalAs(UnmanagedType.I1)]
public bool DeletePending;
-
[MarshalAs(UnmanagedType.I1)]
public bool Directory;
}
@@ -825,14 +694,8 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct FileStreamInformation
{
- public static readonly int SizeOf;
- public static int StreamNameOffset;
-
- static FileStreamInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(FileStreamInformation));
- StreamNameOffset = Marshal.OffsetOf(typeof(FileStreamInformation), "StreamName").ToInt32();
- }
+ public static int StreamNameOffset =
+ Marshal.OffsetOf(typeof(FileStreamInformation), "StreamName").ToInt32();
public int NextEntryOffset;
public int StreamNameLength;
@@ -1155,13 +1018,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct IoCounters
{
- public static readonly int SizeOf;
-
- static IoCounters()
- {
- SizeOf = Marshal.SizeOf(typeof(IoCounters));
- }
-
public ulong ReadOperationCount;
public ulong WriteOperationCount;
public ulong OtherOperationCount;
@@ -1173,13 +1029,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct IoStatusBlock
{
- public static readonly int SizeOf;
-
- static IoStatusBlock()
- {
- SizeOf = Marshal.SizeOf(typeof(IoStatusBlock));
- }
-
public IoStatusBlock(NtStatus status)
: this(status, IntPtr.Zero)
{ }
@@ -1222,8 +1071,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct JobObjectBasicAccountingInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(JobObjectBasicAccountingInformation));
-
public long TotalUserTime;
public long TotalKernelTime;
public long ThisPeriodTotalUserTime;
@@ -1237,8 +1084,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct JobObjectBasicAndIoAccountingInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(JobObjectBasicAndIoAccountingInformation));
-
public JobObjectBasicAccountingInformation BasicInfo;
public IoCounters IoInfo;
}
@@ -1246,8 +1091,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct JobObjectBasicLimitInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(JobObjectBasicLimitInformation));
-
public long PerProcessUserTimeLimit;
public long PerJobUserTimeLimit;
public JobObjectLimitFlags LimitFlags;
@@ -1276,13 +1119,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct JobObjectExtendedLimitInformation
{
- public static readonly int SizeOf;
-
- static JobObjectExtendedLimitInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(JobObjectExtendedLimitInformation));
- }
-
public JobObjectBasicLimitInformation BasicLimitInformation;
public IoCounters IoInfo;
public int ProcessMemoryLimit;
@@ -1423,13 +1259,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct KnownAceStruct
{
- public static readonly int SizeOf;
-
- static KnownAceStruct()
- {
- SizeOf = Marshal.SizeOf(typeof(KnownAceStruct));
- }
-
public AceHeader Header;
public int Mask;
public int SidStart;
@@ -1551,14 +1380,8 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct LdrDataTableEntry
{
- public static readonly int SizeOf;
- public static readonly int LoadCountOffset;
-
- static LdrDataTableEntry()
- {
- SizeOf = Marshal.SizeOf(typeof(LdrDataTableEntry));
- LoadCountOffset = Marshal.OffsetOf(typeof(LdrDataTableEntry), "LoadCount").ToInt32();
- }
+ public static readonly int LoadCountOffset =
+ Marshal.OffsetOf(typeof(LdrDataTableEntry), "LoadCount").ToInt32();
public ListEntry InLoadOrderLinks;
public ListEntry InMemoryOrderLinks;
@@ -1591,22 +1414,12 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Explicit, Pack = 4)]
public struct Luid : IEquatable, IEquatable
{
- public static readonly int SizeOf;
- public static readonly Luid Empty;
+ public static readonly Luid Empty = new Luid();
public static readonly Luid System = new Luid(0x3e7, 0);
public static readonly Luid AnonymousLogon = new Luid(0x3e6, 0);
public static readonly Luid LocalService = new Luid(0x3e5, 0);
public static readonly Luid NetworkService = new Luid(0x3e4, 0);
- static Luid()
- {
- SizeOf = Marshal.SizeOf(typeof(Luid));
- System = new Luid(0x3e7, 0);
- AnonymousLogon = new Luid(0x3e6, 0);
- LocalService = new Luid(0x3e5, 0);
- NetworkService = new Luid(0x3e4, 0);
- }
-
///
/// Creates a LUID from a single 64-bit value.
///
@@ -1653,9 +1466,11 @@ namespace ProcessHacker.Native.Api
/// A new LUID.
public static Luid Allocate()
{
+ NtStatus status;
Luid luid;
- Win32.NtAllocateLocallyUniqueId(out luid).ThrowIf();
+ if ((status = Win32.NtAllocateLocallyUniqueId(out luid)) >= NtStatus.Error)
+ Win32.Throw(status);
return luid;
}
@@ -1712,18 +1527,9 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct MutantBasicInformation
{
- public static readonly int SizeOf;
-
- static MutantBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(MutantBasicInformation));
- }
-
public int CurrentCount;
-
[MarshalAs(UnmanagedType.U1)]
public bool OwnedByCaller;
-
[MarshalAs(UnmanagedType.U1)]
public bool AbandonedState;
}
@@ -1731,13 +1537,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct MutantOwnerInformation
{
- public static readonly int SizeOf;
-
- static MutantOwnerInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(MutantOwnerInformation));
- }
-
public ClientId ClientId;
}
@@ -1756,8 +1555,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ObjectAttributes : IDisposable
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ObjectAttributes));
-
public ObjectAttributes(
string objectName,
ObjectFlags attributes,
@@ -1773,17 +1570,17 @@ namespace ProcessHacker.Native.Api
SecurityQualityOfService? securityQos
)
{
- this.Length = SizeOf;
+ this.Length = Marshal.SizeOf(typeof(ObjectAttributes));
this.RootDirectory = IntPtr.Zero;
this.ObjectName = IntPtr.Zero;
- this.PtrSecurityDescriptor = IntPtr.Zero;
- this.PtrSecurityQualityOfService = IntPtr.Zero;
+ this.SecurityDescriptor = IntPtr.Zero;
+ this.SecurityQualityOfService = IntPtr.Zero;
// Object name
- if (!string.IsNullOrEmpty(objectName))
+ if (objectName != null)
{
UnicodeString unicodeString = new UnicodeString(objectName);
- IntPtr unicodeStringMemory = MemoryAlloc.PrivateHeap.Allocate(UnicodeString.SizeOf);
+ IntPtr unicodeStringMemory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(UnicodeString)));
Marshal.StructureToPtr(unicodeString, unicodeStringMemory, false);
this.ObjectName = unicodeStringMemory;
@@ -1797,13 +1594,13 @@ namespace ProcessHacker.Native.Api
this.RootDirectory = rootDirectory;
// Security descriptor
- this.PtrSecurityDescriptor = securityDescriptor ?? IntPtr.Zero;
+ this.SecurityDescriptor = securityDescriptor ?? IntPtr.Zero;
// Security QOS
if (securityQos.HasValue)
{
- this.PtrSecurityQualityOfService = MemoryAlloc.PrivateHeap.Allocate(SecurityQualityOfService.SizeOf);
- Marshal.StructureToPtr(securityQos.Value, this.PtrSecurityQualityOfService, false);
+ this.SecurityQualityOfService = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SecurityQualityOfService)));
+ Marshal.StructureToPtr(securityQos.Value, this.SecurityQualityOfService, false);
}
}
@@ -1811,23 +1608,28 @@ namespace ProcessHacker.Native.Api
public IntPtr RootDirectory;
public IntPtr ObjectName;
public ObjectFlags Attributes;
- public IntPtr PtrSecurityDescriptor;
- public IntPtr PtrSecurityQualityOfService;
+ public IntPtr SecurityDescriptor;
+ public IntPtr SecurityQualityOfService;
public void Dispose()
{
// Object name
if (this.ObjectName != IntPtr.Zero)
{
- MemoryAlloc.PrivateHeap.Free(this.ObjectName);
+ UnicodeString unicodeString =
+ (UnicodeString)Marshal.PtrToStructure(this.ObjectName, typeof(UnicodeString));
+
+ unicodeString.Dispose();
+ Marshal.FreeHGlobal(this.ObjectName);
+
this.ObjectName = IntPtr.Zero;
}
// Security QOS
- if (this.PtrSecurityQualityOfService != IntPtr.Zero)
+ if (this.SecurityQualityOfService != null)
{
- MemoryAlloc.PrivateHeap.Free(this.PtrSecurityQualityOfService);
- this.PtrSecurityQualityOfService = IntPtr.Zero;
+ Marshal.FreeHGlobal(this.SecurityQualityOfService);
+ this.SecurityQualityOfService = IntPtr.Zero;
}
}
}
@@ -1835,13 +1637,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ObjectBasicInformation
{
- public static readonly int SizeOf;
-
- static ObjectBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(ObjectBasicInformation));
- }
-
public uint Attributes;
public int GrantedAccess;
public uint HandleCount;
@@ -1856,30 +1651,15 @@ namespace ProcessHacker.Native.Api
public uint TypeInformationLength;
public uint SecurityDescriptorLength;
public ulong CreateTime;
-
}
[StructLayout(LayoutKind.Sequential)]
public struct ObjectDirectoryInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ObjectDirectoryInformation));
-
public UnicodeString Name;
public UnicodeString TypeName;
}
- [StructLayout(LayoutKind.Sequential)]
- public struct ObjectHandleFlagInformation
- {
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ObjectHandleFlagInformation));
-
- [MarshalAs(UnmanagedType.Bool)]
- public bool Inherit;
-
- [MarshalAs(UnmanagedType.Bool)]
- public bool ProtectFromClose;
- }
-
[StructLayout(LayoutKind.Sequential)]
public struct ObjectNameInformation
{
@@ -2017,13 +1797,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct PebLdrData
{
- public static readonly int SizeOf;
-
- static PebLdrData()
- {
- SizeOf = Marshal.SizeOf(typeof(PebLdrData));
- }
-
public int Length;
[MarshalAs(UnmanagedType.I1)]
public bool Initialized;
@@ -2050,13 +1823,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct PortMessageStruct
{
- public static readonly int SizeOf;
-
- static PortMessageStruct()
- {
- SizeOf = Marshal.SizeOf(typeof(PortMessageStruct));
- }
-
public short DataLength;
public short TotalLength;
public PortMessageType Type;
@@ -2080,7 +1846,7 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct PrivilegeSetStruct
{
- public static readonly int PrivilegesOffset =
+ public static int PrivilegesOffset =
Marshal.OffsetOf(typeof(PrivilegeSetStruct), "Privileges").ToInt32();
public int Count;
@@ -2091,8 +1857,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ProcessBasicInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ProcessBasicInformation));
-
public NtStatus ExitStatus;
public IntPtr PebBaseAddress;
public IntPtr AffinityMask;
@@ -2111,8 +1875,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ProcessHandleTracingEnable
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ProcessHandleTracingEnable));
-
public int Flags; // No flags. Set to 0.
}
@@ -2126,13 +1888,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ProcessHandleTracingEntry
{
- public static readonly int SizeOf;
-
- static ProcessHandleTracingEntry()
- {
- SizeOf = Marshal.SizeOf(typeof(ProcessHandleTracingEntry));
- }
-
public IntPtr Handle;
public ClientId ClientId;
public HandleTraceType Type;
@@ -2156,16 +1911,9 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ProcessPriorityClassStruct
{
- public static readonly int SizeOf;
-
//the type char is set by the CLR runtime to marshal as Ansi (single byte) for some insane reason...
public char Foreground;
public char PriorityClass;
-
- static ProcessPriorityClassStruct()
- {
- SizeOf = Marshal.SizeOf(typeof(ProcessPriorityClassStruct));
- }
}
[StructLayout(LayoutKind.Sequential)]
@@ -2267,13 +2015,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct RtlHeapInformation
{
- public static readonly int SizeOf;
-
- static RtlHeapInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(RtlHeapInformation));
- }
-
public IntPtr BaseAddress;
public int Flags;
public ushort EntryOverhead;
@@ -2327,13 +2068,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct RtlProcessLockInformation
{
- public static readonly int SizeOf;
-
- static RtlProcessLockInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(RtlProcessLockInformation));
- }
-
public IntPtr Address;
public RtlLockType Type;
public ushort CreatorBackTraceInformation;
@@ -2362,13 +2096,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct RtlProcessModuleInformation
{
- public static readonly int SizeOf;
-
- static RtlProcessModuleInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(RtlProcessModuleInformation));
- }
-
public IntPtr Section; // empty
public IntPtr MappedBase;
public IntPtr ImageBase;
@@ -2406,32 +2133,26 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct RtlUserProcessParameters
{
- public static readonly int SizeOf;
- public static readonly int CurrentDirectoryOffset;
- public static readonly int DllPathOffset;
- public static readonly int ImagePathNameOffset;
- public static readonly int CommandLineOffset;
- public static readonly int EnvironmentOffset;
- public static readonly int WindowTitleOffset;
- public static readonly int DesktopInfoOffset;
- public static readonly int ShellInfoOffset;
- public static readonly int RuntimeDataOffset;
- public static readonly int CurrentDirectoriesOffset;
-
- static RtlUserProcessParameters()
- {
- SizeOf = Marshal.SizeOf(typeof(RtlUserProcessParameters));
- CurrentDirectoryOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "CurrentDirectory").ToInt32();
- DllPathOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "DllPath").ToInt32();
- ImagePathNameOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "ImagePathName").ToInt32();
- CommandLineOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "CommandLine").ToInt32();
- EnvironmentOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "Environment").ToInt32();
- WindowTitleOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "WindowTitle").ToInt32();
- DesktopInfoOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "DesktopInfo").ToInt32();
- ShellInfoOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "ShellInfo").ToInt32();
- RuntimeDataOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "RuntimeData").ToInt32();
- CurrentDirectoriesOffset = Marshal.OffsetOf(typeof(RtlUserProcessParameters), "CurrentDirectories").ToInt32();
- }
+ public static readonly int CurrentDirectoryOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "CurrentDirectory").ToInt32();
+ public static readonly int DllPathOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "DllPath").ToInt32();
+ public static readonly int ImagePathNameOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "ImagePathName").ToInt32();
+ public static readonly int CommandLineOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "CommandLine").ToInt32();
+ public static readonly int EnvironmentOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "Environment").ToInt32();
+ public static readonly int WindowTitleOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "WindowTitle").ToInt32();
+ public static readonly int DesktopInfoOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "DesktopInfo").ToInt32();
+ public static readonly int ShellInfoOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "ShellInfo").ToInt32();
+ public static readonly int RuntimeDataOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "RuntimeData").ToInt32();
+ public static readonly int CurrentDirectoriesOffset =
+ Marshal.OffsetOf(typeof(RtlUserProcessParameters), "CurrentDirectories").ToInt32();
public struct CurDir
{
@@ -2488,23 +2209,14 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SectionBasicInformation
{
- public static readonly int SizeOf;
-
public int Unknown;
public SectionAttributes SectionAttributes;
public long SectionSize;
-
- static SectionBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SectionBasicInformation));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct SectionImageInformation
{
- public static readonly int SizeOf;
-
public IntPtr TransferAddress;
public int StackZeroBits;
public IntPtr StackReserved;
@@ -2523,18 +2235,11 @@ namespace ProcessHacker.Native.Api
public int LoaderFlags;
public int ImageFileSize;
public int Reserved;
-
- static SectionImageInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SectionImageInformation));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct SecurityDescriptorStruct
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(SecurityDescriptorStruct));
-
public byte Revision;
public byte Sbz1;
public SecurityDescriptorControlFlags Control;
@@ -2559,15 +2264,13 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SecurityQualityOfService
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(SecurityQualityOfService));
-
public SecurityQualityOfService(
SecurityImpersonationLevel impersonationLevel,
bool dynamicTracking,
bool effectiveOnly
)
{
- this.Length = SizeOf;
+ this.Length = Marshal.SizeOf(typeof(SecurityQualityOfService));
this.ImpersonationLevel = impersonationLevel;
this.ContextTrackingMode = dynamicTracking;
this.EffectiveOnly = effectiveOnly;
@@ -2584,27 +2287,13 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SemaphoreBasicInformation
{
- public static readonly int SizeOf;
-
public int CurrentCount;
public int MaximumCount;
-
- static SemaphoreBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SemaphoreBasicInformation));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct SidStruct
{
- public static readonly int SizeOf;
-
- static SidStruct()
- {
- SizeOf = Marshal.SizeOf(typeof(SidStruct));
- }
-
public byte Revision;
public byte SubAuthorityCount;
public SidIdentifierAuthority IdentifierAuthority;
@@ -2615,13 +2304,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SidAndAttributes
{
- public static readonly int SizeOf;
-
- static SidAndAttributes()
- {
- SizeOf = Marshal.SizeOf(typeof(SidAndAttributes));
- }
-
public IntPtr Sid; // ptr to a SID object
public SidAttributes Attributes;
@@ -2656,8 +2338,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemBasicInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(SystemBasicInformation));
-
public int Reserved;
public int TimerResolution;
public int PageSize;
@@ -2674,8 +2354,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemCacheInformation
{
- public static readonly int SizeOf;
-
///
/// The size of the system working set, in bytes.
///
@@ -2696,11 +2374,6 @@ namespace ProcessHacker.Native.Api
public IntPtr TransitionSharedPagesPeak;
public int TransitionRePurposeCount;
public int Flags;
-
- static SystemCacheInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemCacheInformation));
- }
}
[StructLayout(LayoutKind.Sequential)]
@@ -2730,21 +2403,13 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemHandleInformation
{
- public static readonly int HandlesOffset = Marshal.OffsetOf(typeof(SystemHandleInformation), "Handles").ToInt32();
+ public static readonly int HandlesOffset =
+ Marshal.OffsetOf(typeof(SystemHandleInformation), "Handles").ToInt32();
public int NumberOfHandles;
public SystemHandleEntry Handles;
}
- [StructLayout(LayoutKind.Sequential)]
- public struct SystemProcessImageNameInformation
- {
- public static readonly int SizeOf = Marshal.SizeOf(typeof(SystemProcessImageNameInformation));
-
- public int ProcessId;
- public UnicodeString ImageName;
- }
-
[StructLayout(LayoutKind.Sequential)]
public struct SystemLoadAndCallImage
{
@@ -2785,13 +2450,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemPagefileInformation
{
- public static readonly int SizeOf;
-
- static SystemPagefileInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemPagefileInformation));
- }
-
public int NextEntryOffset;
public int TotalSize;
public int TotalInUse;
@@ -2802,12 +2460,7 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemPerformanceInformation
{
- public static readonly int SizeOf;
-
- static SystemPerformanceInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemPerformanceInformation));
- }
+ public static readonly int Size = Marshal.SizeOf(typeof(SystemPerformanceInformation));
///
/// The total idle time of all processors in units of 100-nanoseconds.
@@ -2828,196 +2481,194 @@ namespace ProcessHacker.Native.Api
///
/// Number of calls to NtReadFile.
///
- public uint IoReadOperationCount;
+ public int IoReadOperationCount;
///
/// Number of calls to NtWriteFile.
///
- public uint IoWriteOperationCount;
+ public int IoWriteOperationCount;
///
/// Number of calls to other I/O functions.
///
- public uint IoOtherOperationCount;
+ public int IoOtherOperationCount;
///
/// The number of pages of physical memory available.
///
- public uint AvailablePages;
+ public int AvailablePages;
///
/// The number of pages of committed virtual memory.
///
- public uint CommittedPages;
+ public int CommittedPages;
///
/// The number of pages of virtual memory that could be committed
/// without extending the system's pagefiles.
///
- public uint CommitLimit;
+ public int CommitLimit;
///
/// The peak number of pages of committed virtual memory.
///
- public uint PeakCommitment;
+ public int PeakCommitment;
///
/// The total number of soft and hard page faults.
///
- public uint PageFaultCount;
+ public int PageFaultCount;
///
/// The number of copy-on-write page faults.
///
- public uint CopyOnWriteCount;
+ public int CopyOnWriteCount;
///
/// The number of soft page faults.
///
- public uint TransitionCount;
+ public int TransitionCount;
///
/// Something that the Native API reference book doesn't have.
///
- public uint CacheTransitionCount;
+ public int CacheTransitionCount;
///
/// The number of demand zero faults.
///
- public uint DemandZeroCount;
+ public int DemandZeroCount;
///
/// The number of pages read from disk to resolve page faults.
///
- public uint PageReadCount;
+ public int PageReadCount;
///
/// The number of read operations initiated to resolve page faults.
///
- public uint PageReadIoCount;
- public uint CacheReadCount;
- public uint CacheIoCount;
+ public int PageReadIoCount;
+ public int CacheReadCount;
+ public int CacheIoCount;
///
/// The number of pages written to the system's pagefiles.
///
- public uint DirtyPagesWriteCount;
+ public int DirtyPagesWriteCount;
///
/// The number of write operations performed on the system's pagefiles.
///
- public uint DirtyWriteIoCount;
+ public int DirtyWriteIoCount;
///
/// The number of pages written to mapped files.
///
- public uint MappedPagesWriteCount;
+ public int MappedPagesWriteCount;
///
/// The number of write operations performed on mapped files.
///
- public uint MappedWriteIoCount;
+ public int MappedWriteIoCount;
///
/// The number of pages used by the paged pool.
///
- public uint PagedPoolPages;
+ public int PagedPoolPages;
///
/// The number of pages used by the non-paged pool.
///
- public uint NonPagedPoolPages;
+ public int NonPagedPoolPages;
///
/// The number of allocations made from the paged pool.
///
- public uint PagedPoolAllocs;
+ public int PagedPoolAllocs;
///
/// The number of allocations returned to the paged pool.
///
- public uint PagedPoolFrees;
+ public int PagedPoolFrees;
///
/// The number of allocations made from the non-paged pool.
///
- public uint NonPagedPoolAllocs;
+ public int NonPagedPoolAllocs;
///
/// The number of allocations returned to the non-paged pool.
///
- public uint NonPagedPoolFrees;
+ public int NonPagedPoolFrees;
///
/// The number of available System Page Table Entries.
///
- public uint FreeSystemPtes;
+ public int FreeSystemPtes;
///
/// The number of pages of pageable OS code and data in physical
/// memory.
///
- public uint ResidentSystemCodePage;
+ public int ResidentSystemCodePage;
///
/// The number of pages of pageable driver code and data.
///
- public uint TotalSystemDriverPages;
+ public int TotalSystemDriverPages;
///
/// The number of pages of OS driver code and data.
///
- public uint TotalSystemCodePages;
+ public int TotalSystemCodePages;
///
/// The number of times an allocation could be statisfied by one of the
/// small non-paged lookaside lists.
///
- public uint NonPagedPoolLookasideHits;
+ public int NonPagedPoolLookasideHits;
///
/// The number of times an allocation could be statisfied by one of the
/// small paged lookaside lists.
///
- public uint PagedPoolLookasideHits;
+ public int PagedPoolLookasideHits;
///
/// The number of pages available for use by the paged pool.
///
- public uint AvailablePagedPoolPages;
+ public int AvailablePagedPoolPages;
///
/// The number of pages of the system cache in physical memory.
///
- public uint ResidentSystemCachePage;
+ public int ResidentSystemCachePage;
///
/// The number of pages of the paged pool in physical memory.
///
- public uint ResidentPagedPoolPage;
+ public int ResidentPagedPoolPage;
///
/// The number of pages of pageable driver code and data in physical memory.
///
- public uint ResidentSystemDriverPage;
+ public int ResidentSystemDriverPage;
///
/// The number of asynchronous fast read operations.
///
- public uint CcFastReadNoWait;
+ public int CcFastReadNoWait;
///
/// The number of synchronous fast read operations.
///
- public uint CcFastReadWait;
+ public int CcFastReadWait;
///
/// The number of fast read operations not possible because of resource
/// conflicts.
///
- public uint CcFastReadResourceMiss;
- public uint CcFastReadNotPossible;
- public uint CcFastMdlReadNoWait;
- public uint CcFastMdlReadWait;
- public uint CcFastMdlReadResourceMiss;
- public uint CcFastMdlReadNotPossible;
- public uint CcMapDataNoWait;
- public uint CcMapDataWait;
- public uint CcMapDataNoWaitMiss;
- public uint CcMapDataWaitMiss;
- public uint CcPinMappedDataCount;
- public uint CcPinReadNoWait;
- public uint CcPinReadWait;
- public uint CcPinReadNoWaitMiss;
- public uint CcPinReadWaitMiss;
- public uint CcCopyReadNoWait;
- public uint CcCopyReadWait;
- public uint CcCopyReadNoWaitMiss;
- public uint CcCopyReadWaitMiss;
- public uint CcMdlReadNoWait;
- public uint CcMdlReadWait;
- public uint CcMdlReadNoWaitMiss;
- public uint CcMdlReadWaitMiss;
- public uint CcReadAheadIos;
- public uint CcLazyWriteIos;
- public uint CcLazyWritePages;
- public uint CcDataFlushes;
- public uint CcDataPages;
- public uint ContextSwitches;
- public uint FirstLevelTbFills;
- public uint SecondLevelTbFills;
- public uint SystemCalls;
+ public int CcFastReadResourceMiss;
+ public int CcFastReadNotPossible;
+ public int CcFastMdlReadNoWait;
+ public int CcFastMdlReadWait;
+ public int CcFastMdlReadResourceMiss;
+ public int CcFastMdlReadNotPossible;
+ public int CcMapDataNoWait;
+ public int CcMapDataWait;
+ public int CcMapDataNoWaitMiss;
+ public int CcMapDataWaitMiss;
+ public int CcPinMappedDataCount;
+ public int CcPinReadNoWait;
+ public int CcPinReadWait;
+ public int CcPinReadNoWaitMiss;
+ public int CcPinReadWaitMiss;
+ public int CcCopyReadNoWait;
+ public int CcCopyReadWait;
+ public int CcCopyReadNoWaitMiss;
+ public int CcCopyReadWaitMiss;
+ public int CcMdlReadNoWait;
+ public int CcMdlReadWait;
+ public int CcMdlReadNoWaitMiss;
+ public int CcMdlReadWaitMiss;
+ public int CcReadAheadIos;
+ public int CcLazyWriteIos;
+ public int CcLazyWritePages;
+ public int CcDataFlushes;
+ public int CcDataPages;
+ public int ContextSwitches;
+ public int FirstLevelTbFills;
+ public int SecondLevelTbFills;
+ public int SystemCalls;
}
[StructLayout(LayoutKind.Sequential)]
public struct SystemProcessInformation
{
- public static readonly int SizeOf;
-
public int NextEntryOffset;
public int NumberOfThreads;
public long SpareLi1;
@@ -3047,23 +2698,11 @@ namespace ProcessHacker.Native.Api
get { return _inheritedFromProcessId.ToInt32(); }
set { _inheritedFromProcessId = value.ToIntPtr(); }
}
-
- static SystemProcessInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemProcessInformation));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct SystemProcessorPerformanceInformation
{
- public static readonly int SizeOf;
-
- static SystemProcessorPerformanceInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemProcessorPerformanceInformation));
- }
-
public long IdleTime;
public long KernelTime;
public long UserTime;
@@ -3083,13 +2722,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemThreadInformation
{
- public static readonly int SizeOf;
-
- static SystemThreadInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemThreadInformation));
- }
-
public long KernelTime;
public long UserTime;
public long CreateTime;
@@ -3106,8 +2738,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SystemTimeOfDayInformation
{
- public static readonly int SizeOf;
-
public long BootTime;
public long CurrentTime;
public long TimeZoneBias;
@@ -3115,11 +2745,6 @@ namespace ProcessHacker.Native.Api
public int Reserved;
public long BootTimeBias;
public long SleepTimeBias;
-
- static SystemTimeOfDayInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(SystemTimeOfDayInformation));
- }
}
[StructLayout(LayoutKind.Sequential)]
@@ -3146,8 +2771,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ThreadBasicInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(ThreadBasicInformation));
-
public NtStatus ExitStatus;
public IntPtr TebBaseAddress;
public ClientId ClientId;
@@ -3159,13 +2782,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct TimerBasicInformation
{
- public static readonly int SizeOf;
-
- static TimerBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(TimerBasicInformation));
- }
-
public LargeInteger RemainingTime;
[MarshalAs(UnmanagedType.I1)]
public bool TimerState;
@@ -3174,13 +2790,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct TmBasicInformation
{
- public static readonly int SizeOf;
-
- static TmBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(TmBasicInformation));
- }
-
public Guid TmIdentity;
public long VirtualClock;
}
@@ -3188,13 +2797,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct TmLogInformation
{
- public static readonly int SizeOf;
-
- static TmLogInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(TmLogInformation));
- }
-
public Guid LogIdentity;
}
@@ -3218,13 +2820,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct TmRecoveryInformation
{
- public static readonly int SizeOf;
-
- static TmRecoveryInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(TmRecoveryInformation));
- }
-
public long LastRecoveredLsn;
}
@@ -3242,14 +2837,8 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct TokenGroups
{
- public static readonly int SizeOf;
- public static readonly int GroupsOffset;
-
- static TokenGroups()
- {
- SizeOf = Marshal.SizeOf(typeof(TokenGroups));
- GroupsOffset = Marshal.OffsetOf(typeof(TokenGroups), "Groups").ToInt32();
- }
+ public static readonly int GroupsOffset =
+ Marshal.OffsetOf(typeof(TokenGroups), "Groups").ToInt32();
public TokenGroups(Sid[] sids)
{
@@ -3305,8 +2894,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct TokenSource
{
- public static readonly int SizeOf;
-
public TokenSource(string sourceName, Luid sourceIdentifier)
{
if (sourceName.Length > 8)
@@ -3320,18 +2907,11 @@ namespace ProcessHacker.Native.Api
public string SourceName;
public Luid SourceIdentifier;
-
- static TokenSource()
- {
- SizeOf = Marshal.SizeOf(typeof(TokenSource));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct TokenStatistics
{
- public static readonly int SizeOf;
-
public Luid TokenId;
public Luid AuthenticationId;
public long ExpirationTime;
@@ -3342,11 +2922,6 @@ namespace ProcessHacker.Native.Api
public int GroupCount;
public int PrivilegeCount;
public Luid ModifiedId;
-
- static TokenStatistics()
- {
- SizeOf = Marshal.SizeOf(typeof(TokenStatistics));
- }
}
[StructLayout(LayoutKind.Sequential)]
@@ -3363,13 +2938,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct TransactionBasicInformation
{
- public static readonly int SizeOf;
-
- static TransactionBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(TransactionBasicInformation));
- }
-
public Guid TransactionId;
public TransactionState State;
public TransactionOutcome Outcome;
@@ -3425,11 +2993,9 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct UnicodeString : IComparable, IEquatable, IDisposable
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(UnicodeString));
-
public UnicodeString(string str)
{
- if (!string.IsNullOrEmpty(str))
+ if (str != null)
{
UnicodeString newString;
@@ -3474,13 +3040,14 @@ namespace ProcessHacker.Native.Api
///
public UnicodeString Duplicate()
{
+ NtStatus status;
UnicodeString newString;
- Win32.RtlDuplicateUnicodeString(
- RtlDuplicateUnicodeStringFlags.AllocateNullString | RtlDuplicateUnicodeStringFlags.NullTerminate,
- ref this,
- out newString
- ).ThrowIf();
+ if ((status = Win32.RtlDuplicateUnicodeString(
+ RtlDuplicateUnicodeStringFlags.AllocateNullString |
+ RtlDuplicateUnicodeStringFlags.NullTerminate,
+ ref this, out newString)) >= NtStatus.Error)
+ Win32.Throw(status);
return newString;
}
@@ -3502,14 +3069,12 @@ namespace ProcessHacker.Native.Api
public int Hash(HashStringAlgorithm algorithm, bool caseInsensitive)
{
+ NtStatus status;
int hash;
- Win32.RtlHashUnicodeString(
- ref this,
- caseInsensitive,
- algorithm,
- out hash
- ).ThrowIf();
+ if ((status = Win32.RtlHashUnicodeString(ref this,
+ caseInsensitive, algorithm, out hash)) >= NtStatus.Error)
+ Win32.Throw(status);
return hash;
}
@@ -3524,21 +3089,18 @@ namespace ProcessHacker.Native.Api
return this.Hash(HashStringAlgorithm.Default);
}
- public string Text
+ public string Read()
{
- get
- {
- if (this.Length == 0)
- return string.Empty;
+ if (this.Length == 0)
+ return "";
- return Marshal.PtrToStringUni(this.Buffer, this.Length / 2);
- }
+ return Marshal.PtrToStringUni(this.Buffer, this.Length / 2);
}
public string Read(ProcessHandle processHandle)
{
if (this.Length == 0)
- return string.Empty;
+ return "";
byte[] strData = processHandle.ReadMemory(this.Buffer, this.Length);
GCHandle strDataHandle = GCHandle.Alloc(strData, GCHandleType.Pinned);
@@ -3565,23 +3127,27 @@ namespace ProcessHacker.Native.Api
public AnsiString ToAnsiString()
{
+ NtStatus status;
AnsiString ansiStr = new AnsiString();
- Win32.RtlUnicodeStringToAnsiString(ref ansiStr, ref this, true).ThrowIf();
+ if ((status = Win32.RtlUnicodeStringToAnsiString(ref ansiStr, ref this, true)) >= NtStatus.Error)
+ Win32.Throw(status);
return ansiStr;
}
public override string ToString()
{
- return this.Text;
+ return this.Read();
}
public AnsiString ToUpperAnsiString()
{
+ NtStatus status;
AnsiString ansiStr = new AnsiString();
- Win32.RtlUpcaseUnicodeStringToAnsiString(ref ansiStr, ref this, true).ThrowIf();
+ if ((status = Win32.RtlUpcaseUnicodeStringToAnsiString(ref ansiStr, ref this, true)) >= NtStatus.Error)
+ Win32.Throw(status);
return ansiStr;
}
@@ -3590,8 +3156,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct VmCounters
{
- public static readonly int SizeOf;
-
public IntPtr PeakVirtualSize;
public IntPtr VirtualSize;
public int PageFaultCount;
@@ -3603,18 +3167,11 @@ namespace ProcessHacker.Native.Api
public IntPtr QuotaNonPagedPoolUsage;
public IntPtr PagefileUsage;
public IntPtr PeakPagefileUsage;
-
- static VmCounters()
- {
- SizeOf = Marshal.SizeOf(typeof(VmCounters));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct VmCountersEx
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(VmCountersEx));
-
public IntPtr PeakVirtualSize;
public IntPtr VirtualSize;
public int PageFaultCount;
@@ -3632,8 +3189,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct VmCountersEx64
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(VmCountersEx64));
-
public VmCountersEx64(VmCountersEx vm)
{
this.PeakVirtualSize = vm.PeakVirtualSize.ToInt64();
@@ -3665,7 +3220,7 @@ namespace ProcessHacker.Native.Api
public VmCountersEx ToVmCountersEx()
{
- return new VmCountersEx
+ return new VmCountersEx()
{
PeakVirtualSize = this.PeakVirtualSize.ToIntPtr(),
VirtualSize = this.VirtualSize.ToIntPtr(),
diff --git a/1.x/trunk/ProcessHacker.Native/Api/NtStatus.cs b/1.x/trunk/ProcessHacker.Native/Api/NtStatus.cs
index 04999f842..71822955d 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/NtStatus.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/NtStatus.cs
@@ -20,7 +20,6 @@
* along with Process Hacker. If not, see .
*/
-using System;
namespace ProcessHacker.Native.Api
{
///
@@ -390,7 +389,7 @@ namespace ProcessHacker.Native.Api
{
// Fix those messages which are formatted like:
// {Asdf}\r\nAsdf asdf asdf...
- if (message.StartsWith("{", StringComparison.OrdinalIgnoreCase))
+ if (message.StartsWith("{"))
{
string[] split = message.Split('\n');
diff --git a/1.x/trunk/ProcessHacker.Native/Api/SamDefinitions.cs b/1.x/trunk/ProcessHacker.Native/Api/SamDefinitions.cs
index 8f5be7a46..a60892232 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/SamDefinitions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/SamDefinitions.cs
@@ -1,4 +1,8 @@
-namespace ProcessHacker.Native.Api
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Native.Api
{
public static partial class Win32
{
diff --git a/1.x/trunk/ProcessHacker.Native/Api/SamFunctions.cs b/1.x/trunk/ProcessHacker.Native/Api/SamFunctions.cs
index ff866d897..569560248 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/SamFunctions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/SamFunctions.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using ProcessHacker.Native.Security;
diff --git a/1.x/trunk/ProcessHacker.Native/Api/SamStructs.cs b/1.x/trunk/ProcessHacker.Native/Api/SamStructs.cs
index 88a61be2d..feb291d87 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/SamStructs.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/SamStructs.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ProcessHacker.Native.Api
@@ -123,13 +124,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SamRidEnumeration
{
- public static readonly int SizeOf;
-
- static SamRidEnumeration()
- {
- SizeOf = Marshal.SizeOf(typeof(SamRidEnumeration));
- }
-
public int RelativeId;
public UnicodeString Name;
}
@@ -137,13 +131,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SamSidEnumeration
{
- public static readonly int SizeOf;
-
- static SamSidEnumeration()
- {
- SizeOf = Marshal.SizeOf(typeof(SamSidEnumeration));
- }
-
public IntPtr Sid; // Sid*
public UnicodeString Name;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Api/Structs.cs b/1.x/trunk/ProcessHacker.Native/Api/Structs.cs
index d13a2d40f..4deaccf49 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/Structs.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/Structs.cs
@@ -31,6 +31,7 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
+using ProcessHacker.Native.Objects;
namespace ProcessHacker.Native.Api
{
@@ -91,13 +92,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CredUiInfo
{
- public static readonly int SizeOf;
-
- static CredUiInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(CredUiInfo));
- }
-
public int Size;
public IntPtr Parent;
public string MessageText;
@@ -161,25 +155,6 @@ namespace ProcessHacker.Native.Api
public IntPtr ChainContext;
}
- [StructLayout(LayoutKind.Sequential, Pack = 1)]
- public struct DlgTemplate
- {
- public static readonly int SizeOf;
-
- public int style;
- public int dwExtendedStyle;
- public short cdit;
- public short x;
- public short y;
- public short cx;
- public short cy;
-
- static DlgTemplate()
- {
- SizeOf = Marshal.SizeOf(typeof(DlgTemplate));
- }
- }
-
[StructLayout(LayoutKind.Sequential)]
public struct EnumServiceStatus
{
@@ -196,13 +171,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct EnumServiceStatusProcess
{
- public static readonly int SizeOf;
-
- static EnumServiceStatusProcess()
- {
- SizeOf = Marshal.SizeOf(typeof(EnumServiceStatusProcess));
- }
-
[MarshalAs(UnmanagedType.LPTStr)]
public string ServiceName;
@@ -235,13 +203,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct HeapEntry32
{
- public static readonly int SizeOf;
-
- static HeapEntry32()
- {
- SizeOf = Marshal.SizeOf(typeof(HeapEntry32));
- }
-
public int dwSize;
public IntPtr hHandle;
public IntPtr dwAddress;
@@ -256,13 +217,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct HeapList32
{
- public static readonly int SizeOf;
-
- static HeapList32()
- {
- SizeOf = Marshal.SizeOf(typeof(HeapList32));
- }
-
public int dwSize;
public int th32ProcessID;
public IntPtr th32HeapID;
@@ -335,13 +289,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct LuidAndAttributes
{
- public static readonly int SizeOf;
-
- static LuidAndAttributes()
- {
- SizeOf = Marshal.SizeOf(typeof(LuidAndAttributes));
- }
-
public Luid Luid;
public SePrivilegeAttributes Attributes;
}
@@ -349,8 +296,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct MemoryBasicInformation
{
- public static readonly int SizeOf;
-
public IntPtr BaseAddress;
public IntPtr AllocationBase;
public MemoryProtection AllocationProtect;
@@ -358,11 +303,6 @@ namespace ProcessHacker.Native.Api
public MemoryState State;
public MemoryProtection Protect;
public MemoryType Type;
-
- static MemoryBasicInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(MemoryBasicInformation));
- }
}
[StructLayout(LayoutKind.Sequential, Pack = 16)]
@@ -371,12 +311,12 @@ namespace ProcessHacker.Native.Api
public IntPtr BaseAddress;
public IntPtr AllocationBase;
public MemoryProtection AllocationProtect;
- public int _alignment1;
+ private int _alignment1;
public ulong RegionSize;
public MemoryState State;
public MemoryProtection Protect;
public MemoryType Type;
- public int _alignment2;
+ private int _alignment2;
}
[StructLayout(LayoutKind.Sequential)]
@@ -418,13 +358,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct MibTcpRowOwnerPid
{
- public static readonly int SizeOf;
-
- static MibTcpRowOwnerPid()
- {
- SizeOf = Marshal.SizeOf(typeof(MibTcpRowOwnerPid));
- }
-
public MibTcpState State;
public uint LocalAddress;
public int LocalPort;
@@ -435,14 +368,7 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct MibTcp6RowOwnerPid
- {
- public static readonly int SizeOf;
-
- static MibTcp6RowOwnerPid()
- {
- SizeOf = Marshal.SizeOf(typeof(MibTcp6RowOwnerPid));
- }
-
+ {
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] LocalAddress;
public uint LocalScopeId;
@@ -534,14 +460,7 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct MibUdpRowOwnerPid
- {
- public static readonly int SizeOf;
-
- static MibUdpRowOwnerPid()
- {
- SizeOf = Marshal.SizeOf(typeof(MibUdpRowOwnerPid));
- }
-
+ {
public uint LocalAddress;
public int LocalPort;
public int OwningProcessId;
@@ -550,13 +469,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct MibUdp6RowOwnerPid
{
- public static readonly int SizeOf;
-
- static MibUdp6RowOwnerPid()
- {
- SizeOf = Marshal.SizeOf(typeof(MibUdp6RowOwnerPid));
- }
-
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] LocalAddress;
public uint LocalScopeId;
@@ -626,13 +538,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ModuleInfo
{
- public static readonly int SizeOf;
-
- static ModuleInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(ModuleInfo));
- }
-
public IntPtr BaseOfDll;
public int SizeOfImage;
public IntPtr EntryPoint;
@@ -647,84 +552,23 @@ namespace ProcessHacker.Native.Api
public uint Flags;
}
- ///
- /// Contains performance information.
- ///
- /// http://msdn.microsoft.com/en-us/library/ms684824.aspx
[StructLayout(LayoutKind.Sequential)]
public struct PerformanceInformation
{
- public static readonly int SizeOf = Marshal.SizeOf(typeof(PerformanceInformation));
-
- ///
- /// The size of this structure, in bytes.
- ///
- public int cbSize;
-
- ///
- /// The number of pages currently committed by the system. Note that committing pages (using VirtualAlloc with MEM_COMMIT) changes this value immediately; however, the physical memory is not charged until the pages are accessed.
- ///
+ public int Size;
public IntPtr CommitTotal;
-
- ///
- /// The current maximum number of pages that can be committed by the system without extending the paging file(s). This number can change if memory is added or deleted, or if pagefiles have grown, shrunk, or been added. If the paging file can be extended, this is a soft limit.
- ///
public IntPtr CommitLimit;
-
- ///
- /// The maximum number of pages that were simultaneously in the committed state since the last system reboot.
- ///
public IntPtr CommitPeak;
-
- ///
- /// The amount of actual physical memory, in pages.
- ///
public IntPtr PhysicalTotal;
-
- ///
- /// The amount of physical memory currently available, in pages. This is the amount of physical memory that can be immediately reused without having to write its contents to disk first. It is the sum of the size of the standby, free, and zero lists.
- ///
public IntPtr PhysicalAvailable;
-
- ///
- /// The amount of system cache memory, in pages. This is the size of the standby list plus the system working set.
- ///
public IntPtr SystemCache;
-
- ///
- /// The sum of the memory currently in the paged and nonpaged kernel pools, in pages.
- ///
public IntPtr KernelTotal;
-
- ///
- /// The memory currently in the paged kernel pool, in pages.
- ///
public IntPtr KernelPaged;
-
- ///
- /// The memory currently in the nonpaged kernel pool, in pages.
- ///
public IntPtr KernelNonPaged;
-
- ///
- /// The size of a page, in bytes.
- ///
public IntPtr PageSize;
-
- ///
- /// The current number of open handles.
- ///
- public uint HandlesCount;
-
- ///
- /// The current number of processes.
- ///
- public uint ProcessCount;
-
- ///
- /// The current number of threads.
- ///
- public uint ThreadCount;
+ public int HandlesCount;
+ public int ProcessCount;
+ public int ThreadCount;
}
[StructLayout(LayoutKind.Sequential)]
@@ -753,32 +597,6 @@ namespace ProcessHacker.Native.Api
public int ThreadId;
}
- [StructLayout(LayoutKind.Sequential)]
- public struct PropSheetPageW
- {
- public static readonly int SizeOf;
-
- static PropSheetPageW()
- {
- SizeOf = Marshal.SizeOf(typeof(PropSheetPageW));
- }
-
- public int dwSize;
- public PropSheetPageFlags dwFlags;
- public IntPtr hInstance;
-
- public IntPtr pResource; // pszTemplate
- public IntPtr hIcon;
- public IntPtr pszTitle;
- public IntPtr pfnDlgProc;
- public IntPtr lParam;
- public IntPtr pfnCallback;
- public IntPtr pcRefParent;
- public IntPtr pszHeaderTitle;
- public IntPtr pszHeaderSubTitle;
- public IntPtr hActCtx;
- }
-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ProfileInformation
{
@@ -847,13 +665,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct SecPkgInfo
{
- public static readonly int SizeOf;
-
- static SecPkgInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(SecPkgInfo));
- }
-
public int Capabilities;
public ushort Version;
public ushort RpcId;
@@ -884,13 +695,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ServiceStatusProcess
{
- public static readonly int SizeOf;
-
- static ServiceStatusProcess()
- {
- SizeOf = Marshal.SizeOf(typeof(ServiceStatusProcess));
- }
-
public ServiceType ServiceType;
public ServiceState CurrentState;
public ServiceAccept ControlsAccepted;
@@ -905,13 +709,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ShellExecuteInfo
{
- public static readonly int SizeOf;
-
- static ShellExecuteInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(ShellExecuteInfo));
- }
-
public int cbSize;
public uint fMask;
public IntPtr hWnd;
@@ -933,13 +730,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct ShFileInfo
{
- public static readonly int SizeOf;
-
- static ShFileInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(ShFileInfo));
- }
-
public IntPtr hIcon;
public IntPtr iIcon;
public uint dwAttributes;
@@ -952,13 +742,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SiAccess
{
- public static readonly int SizeOf;
-
- static SiAccess()
- {
- SizeOf = Marshal.SizeOf(typeof(SiAccess));
- }
-
public IntPtr Guid;
public int Mask;
public IntPtr Name; // string
@@ -1010,13 +793,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct StartupInfo
{
- public static readonly int SizeOf;
-
- static StartupInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(StartupInfo));
- }
-
public int Size;
[MarshalAs(UnmanagedType.LPWStr)]
public string Reserved;
@@ -1043,8 +819,7 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct SymbolInfo
{
- public static readonly int SizeOf;
- public static readonly int NameOffset;
+ public static readonly int NameOffset = Marshal.OffsetOf(typeof(SymbolInfo), "Name").ToInt32();
public int SizeOfStruct;
public int TypeIndex;
@@ -1061,12 +836,6 @@ namespace ProcessHacker.Native.Api
public int NameLen;
public int MaxNameLen;
public byte Name;
-
- static SymbolInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(SymbolInfo));
- NameOffset = Marshal.OffsetOf(typeof(SymbolInfo), "Name").ToInt32();
- }
}
[StructLayout(LayoutKind.Sequential)]
@@ -1090,8 +859,8 @@ namespace ProcessHacker.Native.Api
public int Styles;
[MarshalAs(UnmanagedType.FunctionPtr)]
public WndProcDelegate WindowsProc;
- public int ExtraClassData;
- public int ExtraWindowData;
+ private int ExtraClassData;
+ private int ExtraWindowData;
public IntPtr InstanceHandle;
public IntPtr IconHandle;
public IntPtr CursorHandle;
@@ -1105,13 +874,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct WindowPlacement
{
- public static readonly int SizeOf;
-
- static WindowPlacement()
- {
- SizeOf = Marshal.SizeOf(typeof(WindowPlacement));
- }
-
public int Length;
public WindowPlacementFlags Flags;
public ShowWindowType ShowState;
@@ -1123,13 +885,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WintrustCatalogInfo
{
- public static readonly int SizeOf;
-
- static WintrustCatalogInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(WintrustCatalogInfo));
- }
-
public int Size;
public int CatalogVersion;
public string CatalogFilePath;
@@ -1144,13 +899,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct WintrustData
{
- public static readonly int SizeOf;
-
- static WintrustData()
- {
- SizeOf = Marshal.SizeOf(typeof(WintrustData));
- }
-
public int Size;
public IntPtr PolicyCallbackData;
public IntPtr SIPClientData;
@@ -1168,13 +916,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential)]
public struct WintrustFileInfo
{
- public static readonly int SizeOf;
-
- static WintrustFileInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(WintrustFileInfo));
- }
-
public int Size;
public IntPtr FilePath;
public IntPtr FileHandle;
@@ -1200,13 +941,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WtsProcessInfo
{
- public static readonly int SizeOf;
-
- static WtsProcessInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(WtsProcessInfo));
- }
-
public int SessionId;
public int ProcessId;
public IntPtr ProcessName;
@@ -1216,13 +950,6 @@ namespace ProcessHacker.Native.Api
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WtsSessionInfo
{
- public static readonly int SizeOf;
-
- static WtsSessionInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(WtsSessionInfo));
- }
-
public int SessionID;
public string WinStationName;
public WtsConnectStateClass State;
diff --git a/1.x/trunk/ProcessHacker.Native/Api/Win32.cs b/1.x/trunk/ProcessHacker.Native/Api/Win32.cs
index 537ca5121..2cb1d0393 100644
--- a/1.x/trunk/ProcessHacker.Native/Api/Win32.cs
+++ b/1.x/trunk/ProcessHacker.Native/Api/Win32.cs
@@ -39,20 +39,18 @@ namespace ProcessHacker.Native.Api
public delegate IntPtr WndProcDelegate(IntPtr hWnd, WindowMessage msg, IntPtr wParam, IntPtr lParam);
public delegate bool SymEnumSymbolsProc(IntPtr SymInfo, int SymbolSize, int UserContext);
- public delegate bool ReadProcessMemoryProc64(IntPtr ProcessHandle, ulong BaseAddress, IntPtr Buffer, int Size, out int BytesRead);
+ public unsafe delegate bool ReadProcessMemoryProc64(IntPtr ProcessHandle, ulong BaseAddress, IntPtr Buffer,
+ int Size, out int BytesRead);
public delegate IntPtr FunctionTableAccessProc64(IntPtr ProcessHandle, ulong AddrBase);
public delegate ulong GetModuleBaseProc64(IntPtr ProcessHandle, ulong Address);
- public delegate int PropSheetPageCallback(IntPtr hwnd, PropSheetPageCallbackMessage uMsg, IntPtr ppsp);
- public delegate bool DialogProc(IntPtr hwndDlg, WindowMessage uMsg, IntPtr wParam, IntPtr lParam);
-
///
/// Provides interfacing to the Win32 and Native APIs.
///
[SuppressUnmanagedCodeSecurity]
public static partial class Win32
{
- private static readonly FastMutex _dbgHelpLock = new FastMutex();
+ private static FastMutex _dbgHelpLock = new FastMutex();
///
/// A mutex which controls access to the dbghelp.dll functions.
@@ -95,12 +93,7 @@ namespace ProcessHacker.Native.Api
///
public static void Throw()
{
- Win32Error last = GetLastErrorCode();
-
- if (last != Win32Error.Success)
- {
- Throw(last);
- }
+ Throw(GetLastErrorCode());
}
public static void Throw(NtStatus status)
@@ -122,7 +115,7 @@ namespace ProcessHacker.Native.Api
#region Handles
- public static void DuplicateObject(
+ public unsafe static void DuplicateObject(
IntPtr sourceProcessHandle,
IntPtr sourceHandle,
int desiredAccess,
@@ -143,7 +136,7 @@ namespace ProcessHacker.Native.Api
);
}
- public static void DuplicateObject(
+ public unsafe static void DuplicateObject(
IntPtr sourceProcessHandle,
IntPtr sourceHandle,
IntPtr targetProcessHandle,
@@ -153,15 +146,34 @@ namespace ProcessHacker.Native.Api
DuplicateOptions options
)
{
- NtDuplicateObject(
- sourceProcessHandle,
- sourceHandle,
- targetProcessHandle,
- out targetHandle,
- desiredAccess,
- handleAttributes,
- options
- ).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ int target;
+
+ KProcessHacker.Instance.KphDuplicateObject(
+ sourceProcessHandle.ToInt32(),
+ sourceHandle.ToInt32(),
+ targetProcessHandle.ToInt32(),
+ out target,
+ desiredAccess,
+ handleAttributes,
+ options);
+ targetHandle = new IntPtr(target);
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = NtDuplicateObject(
+ sourceProcessHandle,
+ sourceHandle,
+ targetProcessHandle,
+ out targetHandle,
+ desiredAccess,
+ handleAttributes,
+ options)) >= NtStatus.Error)
+ Throw(status);
+ }
}
#endregion
@@ -181,7 +193,7 @@ namespace ProcessHacker.Native.Api
{
using (ProcessHandle phandle = new ProcessHandle(ProcessId, OSVersion.MinProcessQueryInfoAccess))
{
- return phandle.GetToken(TokenAccess.Query).SessionId;
+ return phandle.GetToken(TokenAccess.Query).GetSessionId();
}
}
@@ -190,43 +202,6 @@ namespace ProcessHacker.Native.Api
#endregion
- #region Property Sheets
-
- [DllImport("comctl32.dll")]
- public static extern IntPtr CreatePropertySheetPageW(
- ref PropSheetPageW lppsp
- );
-
- [DllImport("user32.dll")]
- public static extern bool MapDialogRect(
- IntPtr hDlg,
- ref Rect lpRect
- );
-
- [DllImport("user32.dll")]
- public static extern IntPtr SetParent(
- IntPtr hWndChild,
- IntPtr hWndNewParent
- );
-
- [DllImport("user32.dll")]
- public static extern IntPtr SendMessage(
- IntPtr hWnd,
- int Msg,
- IntPtr wParam,
- IntPtr lParam
- );
-
- [StructLayout(LayoutKind.Sequential)]
- public struct NmHdr
- {
- public IntPtr hwndFrom;
- public IntPtr idFrom;
- public uint code;
- }
-
- #endregion
-
#region TCP
public static MibTcpStats GetTcpStats()
@@ -253,7 +228,7 @@ namespace ProcessHacker.Native.Api
table.Table = new MibTcpRowOwnerPid[count];
for (int i = 0; i < count; i++)
- table.Table[i] = mem.ReadStruct(sizeof(int), MibTcpRowOwnerPid.SizeOf, i);
+ table.Table[i] = mem.ReadStruct(sizeof(int), i);
}
return table;
@@ -274,11 +249,13 @@ namespace ProcessHacker.Native.Api
{
IntPtr processes;
int count;
+ int[] pids;
+ IntPtr[] sids;
WTSEnumerateProcesses(IntPtr.Zero, 0, 1, out processes, out count);
- int[] pids = new int[count];
- IntPtr[] sids = new IntPtr[count];
+ pids = new int[count];
+ sids = new IntPtr[count];
WtsMemoryAlloc data = new WtsMemoryAlloc(processes);
WtsProcessInfo* dataP = (WtsProcessInfo*)data.Memory;
@@ -289,12 +266,7 @@ namespace ProcessHacker.Native.Api
sids[i] = dataP[i].Sid;
}
- return new WtsEnumProcessesFastData
- {
- PIDs = pids,
- SIDs = sids,
- Memory = data
- };
+ return new WtsEnumProcessesFastData() { PIDs = pids, SIDs = sids, Memory = data };
}
#endregion
@@ -325,7 +297,7 @@ namespace ProcessHacker.Native.Api
table.Table = new MibUdpRowOwnerPid[count];
for (int i = 0; i < count; i++)
- table.Table[i] = mem.ReadStruct(sizeof(int), MibTcpRowOwnerPid.SizeOf, i);
+ table.Table[i] = mem.ReadStruct(sizeof(int), i);
}
return table;
@@ -358,7 +330,7 @@ namespace ProcessHacker.Native.Api
string str = currentString.ToString();
- if (string.IsNullOrEmpty(str))
+ if (str == "")
{
break;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Cryptography.cs b/1.x/trunk/ProcessHacker.Native/Cryptography.cs
index 857f409e9..10d1aba91 100644
--- a/1.x/trunk/ProcessHacker.Native/Cryptography.cs
+++ b/1.x/trunk/ProcessHacker.Native/Cryptography.cs
@@ -56,7 +56,7 @@ namespace ProcessHacker.Native
new Guid("{fc451c16-ac75-11d1-b4b8-00c04fb66ea0}");
public static readonly Guid WintrustActionGenericVerifyV2 =
new Guid("{00aac56b-cd44-11d0-8cc2-00c04fc295ee}");
- public static readonly Guid WintrustActionTrustProviderTest =
+ public static readonly System.Guid WintrustActionTrustProviderTest =
new Guid("{573e31f8-ddba-11d0-8ccb-00c04fc295ee}");
private static string GetX500Value(string subject, string keyName)
@@ -106,12 +106,14 @@ namespace ProcessHacker.Native
// Well, here's a shitload of indirection for you...
// 1. State data -> Provider data
+
IntPtr provData = Win32.WTHelperProvDataFromStateData(stateData);
if (provData == IntPtr.Zero)
return null;
// 2. Provider data -> Provider signer
+
IntPtr signerInfo = Win32.WTHelperGetProvSignerFromChain(provData, 0, false, 0);
if (signerInfo == IntPtr.Zero)
@@ -125,22 +127,25 @@ namespace ProcessHacker.Native
return null;
// 3. Provider signer -> Provider cert
+
CryptProviderCert cert = (CryptProviderCert)Marshal.PtrToStructure(sngr.CertChain, typeof(CryptProviderCert));
if (cert.Cert == IntPtr.Zero)
return null;
// 4. Provider cert -> Cert context
+
CertContext context = (CertContext)Marshal.PtrToStructure(cert.Cert, typeof(CertContext));
if (context.CertInfo != IntPtr.Zero)
{
// 5. Cert context -> Cert info
+
CertInfo certInfo = (CertInfo)Marshal.PtrToStructure(context.CertInfo, typeof(CertInfo));
unsafe
{
- using (MemoryAlloc buffer = new MemoryAlloc(0x200))
+ using (var buffer = new MemoryAlloc(0x200))
{
int length;
@@ -168,12 +173,13 @@ namespace ProcessHacker.Native
}
string name = buffer.ReadUnicodeString(0);
+ string value;
// 7. Subject X.500 string -> CN or OU value
- string value = GetX500Value(name, "CN");
+ value = GetX500Value(name, "CN");
- if (string.IsNullOrEmpty(value))
+ if (value == null)
value = GetX500Value(name, "OU");
return value;
@@ -186,23 +192,20 @@ namespace ProcessHacker.Native
public static VerifyResult StatusToVerifyResult(uint status)
{
- switch (status)
- {
- case 0:
- return VerifyResult.Trusted;
- case 0x800b0100:
- return VerifyResult.NoSignature;
- case 0x800b0101:
- return VerifyResult.Expired;
- case 0x800b010c:
- return VerifyResult.Revoked;
- case 0x800b0111:
- return VerifyResult.Distrust;
- case 0x80092026:
- return VerifyResult.SecuritySettings;
- default:
- return VerifyResult.SecuritySettings;
- }
+ if (status == 0)
+ return VerifyResult.Trusted;
+ else if (status == 0x800b0100)
+ return VerifyResult.NoSignature;
+ else if (status == 0x800b0101)
+ return VerifyResult.Expired;
+ else if (status == 0x800b010c)
+ return VerifyResult.Revoked;
+ else if (status == 0x800b0111)
+ return VerifyResult.Distrust;
+ else if (status == 0x80092026)
+ return VerifyResult.SecuritySettings;
+ else
+ return VerifyResult.SecuritySettings;
}
public static VerifyResult VerifyFile(string fileName)
@@ -214,7 +217,7 @@ namespace ProcessHacker.Native
public static VerifyResult VerifyFile(string fileName, out string signerName)
{
- VerifyResult result;
+ VerifyResult result = VerifyResult.NoSignature;
using (MemoryAlloc strMem = new MemoryAlloc(fileName.Length * 2 + 2))
{
@@ -223,25 +226,24 @@ namespace ProcessHacker.Native
strMem.WriteUnicodeString(0, fileName);
strMem.WriteInt16(fileName.Length * 2, 0);
- fileInfo.Size = WintrustFileInfo.SizeOf;
+ fileInfo.Size = Marshal.SizeOf(fileInfo);
fileInfo.FilePath = strMem;
- WintrustData trustData = new WintrustData
- {
- Size = WintrustData.SizeOf,
- UIChoice = 2, // WTD_UI_NONE
- UnionChoice = 1, // WTD_CHOICE_FILE
- RevocationChecks = WtdRevocationChecks.None,
- ProvFlags = WtdProvFlags.Safer,
- StateAction = WtdStateAction.Verify
- };
+ WintrustData trustData = new WintrustData();
+
+ trustData.Size = Marshal.SizeOf(typeof(WintrustData));
+ trustData.UIChoice = 2; // WTD_UI_NONE
+ trustData.UnionChoice = 1; // WTD_CHOICE_FILE
+ trustData.RevocationChecks = WtdRevocationChecks.None;
+ trustData.ProvFlags = WtdProvFlags.Safer;
+ trustData.StateAction = WtdStateAction.Verify;
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
trustData.ProvFlags |= WtdProvFlags.CacheOnlyUrlRetrieval;
using (MemoryAlloc mem = new MemoryAlloc(fileInfo.Size))
{
- mem.WriteStruct(fileInfo);
+ mem.WriteStruct(fileInfo);
trustData.UnionData = mem;
uint winTrustResult = Win32.WinVerifyTrust(IntPtr.Zero, WintrustActionGenericVerifyV2, ref trustData);
@@ -268,7 +270,8 @@ namespace ProcessHacker.Native
signerName = null;
- using (FileHandle sourceFile = FileHandle.CreateWin32(fileName, FileAccess.GenericRead, FileShareMode.Read, FileCreationDispositionWin32.OpenExisting))
+ using (FileHandle sourceFile = FileHandle.CreateWin32(fileName, FileAccess.GenericRead, FileShareMode.Read,
+ FileCreationDispositionWin32.OpenExisting))
{
byte[] hash = new byte[256];
int hashLength = 256;
@@ -308,29 +311,27 @@ namespace ProcessHacker.Native
return VerifyResult.NoSignature;
}
- WintrustCatalogInfo wci = new WintrustCatalogInfo
- {
- Size = WintrustCatalogInfo.SizeOf,
- CatalogFilePath = ci.CatalogFile,
- MemberFilePath = fileName,
- MemberTag = memberTag.ToString()
- };
+ WintrustCatalogInfo wci = new WintrustCatalogInfo();
- WintrustData trustData = new WintrustData
- {
- Size = WintrustData.SizeOf,
- UIChoice = 1,
- UnionChoice = 2,
- RevocationChecks = WtdRevocationChecks.None,
- StateAction = WtdStateAction.Verify
- };
+ wci.Size = Marshal.SizeOf(wci);
+ wci.CatalogFilePath = ci.CatalogFile;
+ wci.MemberFilePath = fileName;
+ wci.MemberTag = memberTag.ToString();
+
+ WintrustData trustData = new WintrustData();
+
+ trustData.Size = Marshal.SizeOf(typeof(WintrustData));
+ trustData.UIChoice = 1;
+ trustData.UnionChoice = 2;
+ trustData.RevocationChecks = WtdRevocationChecks.None;
+ trustData.StateAction = WtdStateAction.Verify;
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
trustData.ProvFlags = WtdProvFlags.CacheOnlyUrlRetrieval;
using (MemoryAlloc mem = new MemoryAlloc(wci.Size))
{
- mem.WriteStruct(wci);
+ mem.WriteStruct(wci);
try
{
diff --git a/1.x/trunk/ProcessHacker.Native/Debugging/DebugBuffer.cs b/1.x/trunk/ProcessHacker.Native/Debugging/DebugBuffer.cs
index 1a89a5ea3..72213a4c4 100644
--- a/1.x/trunk/ProcessHacker.Native/Debugging/DebugBuffer.cs
+++ b/1.x/trunk/ProcessHacker.Native/Debugging/DebugBuffer.cs
@@ -37,7 +37,7 @@ namespace ProcessHacker.Native.Debugging
///
public sealed class DebugBuffer : BaseObject
{
- private readonly IntPtr _buffer;
+ private IntPtr _buffer;
///
/// Creates a new debug buffer.
@@ -64,7 +64,7 @@ namespace ProcessHacker.Native.Debugging
/// The callback for the enumeration.
public void EnumHeaps(DebugEnumHeapsDelegate callback)
{
- RtlDebugInformation debugInfo = this.GetDebugInformation();
+ var debugInfo = this.GetDebugInformation();
if (debugInfo.Heaps == IntPtr.Zero)
throw new InvalidOperationException("Heap information does not exist.");
@@ -74,7 +74,7 @@ namespace ProcessHacker.Native.Debugging
for (int i = 0; i < heaps.NumberOfHeaps; i++)
{
- RtlHeapInformation heap = heapInfo.ReadStruct(RtlProcessHeaps.HeapsOffset, RtlHeapInformation.SizeOf, i);
+ var heap = heapInfo.ReadStruct(RtlProcessHeaps.HeapsOffset, i);
if (!callback(new HeapInformation(heap)))
break;
@@ -97,7 +97,7 @@ namespace ProcessHacker.Native.Debugging
for (int i = 0; i < locks.NumberOfLocks; i++)
{
- var lock_ = locksInfo.ReadStruct(sizeof(int), RtlProcessLockInformation.SizeOf, i);
+ var lock_ = locksInfo.ReadStruct(sizeof(int), i);
if (!callback(new LockInformation(lock_)))
break;
@@ -110,17 +110,17 @@ namespace ProcessHacker.Native.Debugging
/// The callback for the enumeration.
public void EnumModules(DebugEnumModulesDelegate callback)
{
- RtlDebugInformation debugInfo = this.GetDebugInformation();
+ var debugInfo = this.GetDebugInformation();
if (debugInfo.Modules == IntPtr.Zero)
throw new InvalidOperationException("Module information does not exist.");
MemoryRegion modulesInfo = new MemoryRegion(debugInfo.Modules);
- RtlProcessModules modules = modulesInfo.ReadStruct();
+ var modules = modulesInfo.ReadStruct();
for (int i = 0; i < modules.NumberOfModules; i++)
{
- var module = modulesInfo.ReadStruct(RtlProcessModules.ModulesOffset, RtlProcessModuleInformation.SizeOf, i);
+ var module = modulesInfo.ReadStruct(RtlProcessModules.ModulesOffset, i);
if (!callback(new ModuleInformation(module)))
break;
@@ -146,7 +146,7 @@ namespace ProcessHacker.Native.Debugging
{
List heaps = new List();
- this.EnumHeaps(heap =>
+ this.EnumHeaps((heap) =>
{
heaps.Add(heap);
return true;
@@ -163,7 +163,7 @@ namespace ProcessHacker.Native.Debugging
{
List locks = new List();
- this.EnumLocks(lock_ =>
+ this.EnumLocks((lock_) =>
{
locks.Add(lock_);
return true;
@@ -180,7 +180,7 @@ namespace ProcessHacker.Native.Debugging
{
List modules = new List();
- this.EnumModules(module =>
+ this.EnumModules((module) =>
{
modules.Add(module);
return true;
@@ -195,7 +195,7 @@ namespace ProcessHacker.Native.Debugging
/// The information to query.
public void Query(RtlQueryProcessDebugFlags flags)
{
- this.Query(ProcessHandle.CurrentId, flags);
+ this.Query(ProcessHandle.GetCurrentId(), flags);
}
///
@@ -205,11 +205,14 @@ namespace ProcessHacker.Native.Debugging
/// The information to query.
public void Query(int pid, RtlQueryProcessDebugFlags flags)
{
- Win32.RtlQueryProcessDebugInformation(
+ NtStatus status;
+
+ if ((status = Win32.RtlQueryProcessDebugInformation(
pid.ToIntPtr(),
flags,
_buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -217,7 +220,10 @@ namespace ProcessHacker.Native.Debugging
///
public void QueryBackTraces()
{
- Win32.RtlQueryProcessBackTraceInformation(_buffer).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlQueryProcessBackTraceInformation(_buffer)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -225,7 +231,10 @@ namespace ProcessHacker.Native.Debugging
///
public void QueryHeaps()
{
- Win32.RtlQueryProcessHeapInformation(_buffer).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlQueryProcessHeapInformation(_buffer)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -233,7 +242,10 @@ namespace ProcessHacker.Native.Debugging
///
public void QueryLocks()
{
- Win32.RtlQueryProcessLockInformation(_buffer).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlQueryProcessLockInformation(_buffer)) >= NtStatus.Error)
+ Win32.Throw(status);
}
//public void QueryModules()
@@ -243,11 +255,14 @@ namespace ProcessHacker.Native.Debugging
//public void QueryModules(ProcessHandle processHandle, RtlQueryProcessDebugFlags flags)
//{
- // Win32.RtlQueryProcessModuleInformation(
+ // NtStatus status;
+
+ // if ((status = Win32.RtlQueryProcessModuleInformation(
// processHandle ?? IntPtr.Zero,
// flags,
// _buffer
- // ).ThrowIf();
+ // )) >= NtStatus.Error)
+ // Win32.ThrowLastError(status);
//}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/FileUtils.cs b/1.x/trunk/ProcessHacker.Native/FileUtils.cs
index cc4097790..401f77ec6 100644
--- a/1.x/trunk/ProcessHacker.Native/FileUtils.cs
+++ b/1.x/trunk/ProcessHacker.Native/FileUtils.cs
@@ -23,6 +23,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -42,18 +44,20 @@ namespace ProcessHacker.Native
///
/// Used to resolve device prefixes (\Device\Harddisk1) into DOS drive names.
///
- private static Dictionary _fileNamePrefixes;
+ private static Dictionary _fileNamePrefixes = new Dictionary();
public static string FindFile(string basePath, string fileName)
{
- if (!string.IsNullOrEmpty(basePath))
+ string path;
+
+ if (basePath != null)
{
// Search the base path first.
if (System.IO.File.Exists(basePath + "\\" + fileName))
return System.IO.Path.Combine(basePath, fileName);
}
- string path = Environment.GetEnvironmentVariable("Path");
+ path = Environment.GetEnvironmentVariable("Path");
string[] directories = path.Split(';');
@@ -68,11 +72,12 @@ namespace ProcessHacker.Native
public static string FindFileWin32(string fileName)
{
- using (MemoryAlloc data = new MemoryAlloc(0x400))
+ using (var data = new MemoryAlloc(0x400))
{
+ int retLength;
IntPtr filePart;
- int retLength = Win32.SearchPath(null, fileName, null, data.Size / 2, data, out filePart);
+ retLength = Win32.SearchPath(null, fileName, null, data.Size / 2, data, out filePart);
if (retLength * 2 > data.Size)
{
@@ -94,26 +99,24 @@ namespace ProcessHacker.Native
public static Icon GetFileIcon(string fileName, bool large)
{
+ ShFileInfo shinfo = new ShFileInfo();
+
if (string.IsNullOrEmpty(fileName))
throw new Exception("File name cannot be empty.");
try
{
- ShFileInfo shinfo;
-
- if (Win32.SHGetFileInfo(
- fileName,
- 0,
- out shinfo,
- (uint)ShFileInfo.SizeOf,
+ if (Win32.SHGetFileInfo(fileName, 0, out shinfo,
+ (uint)Marshal.SizeOf(shinfo),
Win32.ShgFiIcon |
- (large ? Win32.ShgFiLargeIcon : Win32.ShgFiSmallIcon)
- ) == 0)
+ (large ? Win32.ShgFiLargeIcon : Win32.ShgFiSmallIcon)) == 0)
{
return null;
}
-
- return Icon.FromHandle(shinfo.hIcon);
+ else
+ {
+ return Icon.FromHandle(shinfo.hIcon);
+ }
}
catch
{
@@ -121,43 +124,6 @@ namespace ProcessHacker.Native
}
}
- public static unsafe string GetVistaFileName(int pid)
- {
- using (MemoryAlloc buffer = new MemoryAlloc(0x100))
- {
- SystemProcessImageNameInformation info;
-
- info.ProcessId = pid;
- info.ImageName.Length = 0;
- info.ImageName.MaximumLength = 0x100;
- info.ImageName.Buffer = buffer;
-
- NtStatus status = Win32.NtQuerySystemInformation(
- SystemInformationClass.SystemProcessImageName,
- &info,
- SystemProcessImageNameInformation.SizeOf,
- null
- );
-
- if (status == NtStatus.InfoLengthMismatch)
- {
- // Our buffer was too small. The required buffer length is stored in MaximumLength.
- buffer.ResizeNew(info.ImageName.MaximumLength);
-
- status = Win32.NtQuerySystemInformation(
- SystemInformationClass.SystemProcessImageName,
- &info,
- SystemProcessImageNameInformation.SizeOf,
- null
- );
- }
-
- status.ThrowIf();
-
- return GetFileName(info.ImageName.Text);
- }
- }
-
public static string GetFileName(string fileName)
{
return GetFileName(fileName, false);
@@ -180,23 +146,25 @@ namespace ProcessHacker.Native
alreadyCanonicalized = true;
}
// If the path starts with "\??\", we can remove it and we will have the path.
- else if (fileName.StartsWith("\\??\\", StringComparison.OrdinalIgnoreCase))
+ else if (fileName.StartsWith("\\??\\"))
{
fileName = fileName.Substring(4);
}
// If the path still starts with a backslash, we probably need to
// resolve any native object name to a DOS drive letter.
- if (fileName.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
+ if (fileName.StartsWith("\\"))
{
- foreach (KeyValuePair pair in _fileNamePrefixes)
+ var prefixes = _fileNamePrefixes;
+
+ foreach (var pair in prefixes)
{
- if (fileName.StartsWith(pair.Key + "\\", StringComparison.OrdinalIgnoreCase))
+ if (fileName.StartsWith(pair.Key + "\\"))
{
fileName = pair.Value + "\\" + fileName.Substring(pair.Key.Length + 1);
break;
}
- if (fileName == pair.Key)
+ else if (fileName == pair.Key)
{
fileName = pair.Value;
break;
@@ -217,44 +185,42 @@ namespace ProcessHacker.Native
if (driveLetter < 'A' || driveLetter > 'Z')
throw new ArgumentException("The drive letter must be between A to Z (inclusive).");
- using (SymbolicLinkHandle shandle = new SymbolicLinkHandle(@"\??\" + driveLetter + ":", SymbolicLinkAccess.Query))
+ using (var shandle = new SymbolicLinkHandle(@"\??\" + driveLetter + ":", SymbolicLinkAccess.Query))
{
- return shandle.Target;
+ return shandle.GetTarget();
}
}
public static void RefreshFileNamePrefixes()
{
- if (_fileNamePrefixes == null)
+ // Just create a new dictionary to avoid having to lock the existing one.
+ var newPrefixes = new Dictionary();
+
+ for (char c = 'A'; c <= 'Z'; c++)
{
- // Just create a new dictionary to avoid having to lock the existing one.
- _fileNamePrefixes = new Dictionary();
-
- for (char c = 'A'; c <= 'Z'; c++)
+ using (var data = new MemoryAlloc(1024))
{
- using (MemoryAlloc data = new MemoryAlloc(1024))
- {
- int length;
+ int length;
- if ((length = Win32.QueryDosDevice(c.ToString() + ":", data, data.Size/2)) > 2)
- {
- _fileNamePrefixes.Add(data.ReadUnicodeString(0, length - 2), c.ToString() + ":");
- }
+ if ((length = Win32.QueryDosDevice(c.ToString() + ":", data, data.Size / 2)) > 2)
+ {
+ newPrefixes.Add(data.ReadUnicodeString(0, length - 2), c.ToString() + ":");
}
}
}
+
+ _fileNamePrefixes = newPrefixes;
}
public static void ShowProperties(string fileName)
{
- ShellExecuteInfo info = new ShellExecuteInfo
- {
- cbSize = ShellExecuteInfo.SizeOf,
- lpFile = fileName,
- nShow = ShowWindowType.Show,
- fMask = Win32.SeeMaskInvokeIdList,
- lpVerb = "properties"
- };
+ var info = new ShellExecuteInfo();
+
+ info.cbSize = Marshal.SizeOf(info);
+ info.lpFile = fileName;
+ info.nShow = ShowWindowType.Show;
+ info.fMask = Win32.SeeMaskInvokeIdList;
+ info.lpVerb = "properties";
Win32.ShellExecuteEx(ref info);
}
diff --git a/1.x/trunk/ProcessHacker.Native/ILoadedModule.cs b/1.x/trunk/ProcessHacker.Native/ILoadedModule.cs
index 3af0dd656..5dd450ca2 100644
--- a/1.x/trunk/ProcessHacker.Native/ILoadedModule.cs
+++ b/1.x/trunk/ProcessHacker.Native/ILoadedModule.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native
diff --git a/1.x/trunk/ProcessHacker.Native/Image/ImageExports.cs b/1.x/trunk/ProcessHacker.Native/Image/ImageExports.cs
index 881867446..8cb4349f0 100644
--- a/1.x/trunk/ProcessHacker.Native/Image/ImageExports.cs
+++ b/1.x/trunk/ProcessHacker.Native/Image/ImageExports.cs
@@ -21,7 +21,11 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
+using ProcessHacker.Native.Objects;
+using ProcessHacker.Native.Security;
namespace ProcessHacker.Native.Image
{
@@ -29,12 +33,12 @@ namespace ProcessHacker.Native.Image
{
public delegate bool EnumEntriesDelegate(ImageExportEntry entry);
- private readonly MappedImage _mappedImage;
- private readonly ImageDataDirectory* _dataDirectory;
- private readonly ImageExportDirectory* _exportDirectory;
- private readonly int* _addressTable;
- private readonly int* _namePointerTable;
- private readonly short* _ordinalTable;
+ private MappedImage _mappedImage;
+ private ImageDataDirectory* _dataDirectory;
+ private ImageExportDirectory* _exportDirectory;
+ private int* _addressTable;
+ private int* _namePointerTable;
+ private short* _ordinalTable;
internal ImageExports(MappedImage mappedImage)
{
@@ -56,8 +60,8 @@ namespace ProcessHacker.Native.Image
{
if (_exportDirectory != null)
return _exportDirectory->NumberOfFunctions;
-
- return 0;
+ else
+ return 0;
}
}
@@ -68,10 +72,9 @@ namespace ProcessHacker.Native.Image
if (index >= _exportDirectory->NumberOfFunctions)
return ImageExportEntry.Empty;
- ImageExportEntry entry = new ImageExportEntry
- {
- Ordinal = (short)(this._ordinalTable[index] + this._exportDirectory->Base)
- };
+ ImageExportEntry entry = new ImageExportEntry();
+
+ entry.Ordinal = (short)(_ordinalTable[index] + _exportDirectory->Base);
if (index < _exportDirectory->NumberOfNames)
entry.Name = new string((sbyte*)_mappedImage.RvaToVa(_namePointerTable[index]));
@@ -84,7 +87,9 @@ namespace ProcessHacker.Native.Image
if (_exportDirectory == null || _namePointerTable == null || _ordinalTable == null)
return ImageExportFunction.Empty;
- int index = this.LookupName(name);
+ int index;
+
+ index = this.LookupName(name);
if (index == -1)
return ImageExportFunction.Empty;
@@ -107,17 +112,13 @@ namespace ProcessHacker.Native.Image
)
{
// This is a forwarder RVA.
- return new ImageExportFunction
- {
- ForwardedName = new string((sbyte*)_mappedImage.RvaToVa(rva))
- };
+ return new ImageExportFunction() { ForwardedName = new string((sbyte*)_mappedImage.RvaToVa(rva)) };
+ }
+ else
+ {
+ // This is a function RVA.
+ return new ImageExportFunction() { Function = (IntPtr)_mappedImage.RvaToVa(rva) };
}
-
- // This is a function RVA.
- return new ImageExportFunction
- {
- Function = (IntPtr)this._mappedImage.RvaToVa(rva)
- };
}
private int LookupName(string name)
@@ -154,7 +155,7 @@ namespace ProcessHacker.Native.Image
public struct ImageExportEntry
{
- public static readonly ImageExportEntry Empty;
+ public static readonly ImageExportEntry Empty = new ImageExportEntry();
public string Name;
public short Ordinal;
@@ -162,7 +163,7 @@ namespace ProcessHacker.Native.Image
public struct ImageExportFunction
{
- public static readonly ImageExportFunction Empty;
+ public static readonly ImageExportFunction Empty = new ImageExportFunction();
public IntPtr Function;
public string ForwardedName;
diff --git a/1.x/trunk/ProcessHacker.Native/Image/ImageImports.cs b/1.x/trunk/ProcessHacker.Native/Image/ImageImports.cs
index c8c8e7c80..db466a7fb 100644
--- a/1.x/trunk/ProcessHacker.Native/Image/ImageImports.cs
+++ b/1.x/trunk/ProcessHacker.Native/Image/ImageImports.cs
@@ -28,10 +28,10 @@ namespace ProcessHacker.Native.Image
{
public delegate bool EnumEntriesDelegate(ImageExportEntry entry);
- private readonly MappedImage _mappedImage;
- private readonly int _count;
- private readonly ImageImportDescriptor* _descriptorTable;
- private readonly ImageImportDll[] _dlls;
+ private MappedImage _mappedImage;
+ private int _count;
+ private ImageImportDescriptor* _descriptorTable;
+ private ImageImportDll[] _dlls;
internal ImageImports(MappedImage mappedImage)
{
@@ -82,11 +82,11 @@ namespace ProcessHacker.Native.Image
public unsafe sealed class ImageImportDll
{
- private readonly MappedImage _mappedImage;
- private readonly ImageImportDescriptor* _descriptor;
+ private MappedImage _mappedImage;
+ private ImageImportDescriptor* _descriptor;
private string _name;
- private readonly void* _lookupTable;
- private readonly int _count;
+ private void* _lookupTable;
+ private int _count;
internal ImageImportDll(MappedImage mappedImage, ImageImportDescriptor* descriptor)
{
@@ -144,50 +144,45 @@ namespace ProcessHacker.Native.Image
if (index >= _count)
return ImageImportEntry.Empty;
- switch (this._mappedImage.Magic)
+ if (_mappedImage.Magic == Win32.Pe32Magic)
{
- case Win32.Pe32Magic:
+ int entry = ((int*)_lookupTable)[index];
+
+ // Is this entry using an ordinal?
+ if ((entry & 0x80000000) != 0)
+ {
+ return new ImageImportEntry() { Ordinal = (short)(entry & 0xffff) };
+ }
+ else
+ {
+ ImageImportByName* nameEntry = (ImageImportByName*)_mappedImage.RvaToVa(entry);
+
+ return new ImageImportEntry()
{
- int entry = ((int*)this._lookupTable)[index];
+ NameHint = nameEntry->Hint,
+ Name = new string((sbyte*)&nameEntry->Name)
+ };
+ }
+ }
+ else if (_mappedImage.Magic == Win32.Pe32PlusMagic)
+ {
+ long entry = ((long*)_lookupTable)[index];
- // Is this entry using an ordinal?
- if ((entry & 0x80000000) != 0)
- {
- return new ImageImportEntry
- {
- Ordinal = (short)(entry & 0xffff)
- };
- }
+ // Is this entry using an ordinal?
+ if (((ulong)entry & 0x8000000000000000) != 0)
+ {
+ return new ImageImportEntry() { Ordinal = (short)(entry & 0xffff) };
+ }
+ else
+ {
+ ImageImportByName* nameEntry = (ImageImportByName*)_mappedImage.RvaToVa((int)(entry & 0xffffffff));
- ImageImportByName* nameEntry = (ImageImportByName*)this._mappedImage.RvaToVa(entry);
-
- return new ImageImportEntry
- {
- NameHint = nameEntry->Hint,
- Name = new string((sbyte*)&nameEntry->Name)
- };
- }
- case Win32.Pe32PlusMagic:
+ return new ImageImportEntry()
{
- long entry = ((long*)this._lookupTable)[index];
-
- // Is this entry using an ordinal?
- if (((ulong)entry & 0x8000000000000000) != 0)
- {
- return new ImageImportEntry
- {
- Ordinal = (short)(entry & 0xffff)
- };
- }
-
- ImageImportByName* nameEntry = (ImageImportByName*)this._mappedImage.RvaToVa((int)(entry & 0xffffffff));
-
- return new ImageImportEntry
- {
- NameHint = nameEntry->Hint,
- Name = new string((sbyte*)&nameEntry->Name)
- };
- }
+ NameHint = nameEntry->Hint,
+ Name = new string((sbyte*)&nameEntry->Name)
+ };
+ }
}
return ImageImportEntry.Empty;
diff --git a/1.x/trunk/ProcessHacker.Native/Image/MappedImage.cs b/1.x/trunk/ProcessHacker.Native/Image/MappedImage.cs
index b49cf4c63..e86324798 100644
--- a/1.x/trunk/ProcessHacker.Native/Image/MappedImage.cs
+++ b/1.x/trunk/ProcessHacker.Native/Image/MappedImage.cs
@@ -157,41 +157,52 @@ namespace ProcessHacker.Native.Image
public ImageDataDirectory* GetDataEntry(ImageDataEntry entry)
{
- switch (this._magic)
+ if (_magic == Win32.Pe32Magic)
{
- case Win32.Pe32Magic:
- if ((int)entry >= this._ntHeaders->OptionalHeader.NumberOfRvaAndSizes)
- return null;
- return &(&this._ntHeaders->OptionalHeader.DataDirectory)[(int)entry];
- case Win32.Pe32PlusMagic:
- if ((int)entry >= this.GetOptionalHeader64()->NumberOfRvaAndSizes)
- return null;
- return &(&this.GetOptionalHeader64()->DataDirectory)[(int)entry];
- default:
+ if ((int)entry >= _ntHeaders->OptionalHeader.NumberOfRvaAndSizes)
return null;
+
+ return &(&_ntHeaders->OptionalHeader.DataDirectory)[(int)entry];
+ }
+ else if (_magic == Win32.Pe32PlusMagic)
+ {
+ if ((int)entry >= this.GetOptionalHeader64()->NumberOfRvaAndSizes)
+ return null;
+
+ return &(&this.GetOptionalHeader64()->DataDirectory)[(int)entry];
+ }
+ else
+ {
+ return null;
}
}
public ImageExportDirectory* GetExportDirectory()
{
- ImageDataDirectory* dataEntry = this.GetDataEntry(ImageDataEntry.Export);
+ ImageDataDirectory* dataEntry;
+
+ dataEntry = this.GetDataEntry(ImageDataEntry.Export);
return (ImageExportDirectory*)this.RvaToVa(dataEntry->VirtualAddress);
}
public ImageImportDescriptor* GetImportDirectory()
{
- ImageDataDirectory* dataEntry = this.GetDataEntry(ImageDataEntry.Import);
+ ImageDataDirectory* dataEntry;
+
+ dataEntry = this.GetDataEntry(ImageDataEntry.Import);
return (ImageImportDescriptor*)this.RvaToVa(dataEntry->VirtualAddress);
}
private void* GetLoadConfig(short magic)
{
+ ImageDataDirectory* dataEntry;
+
if (_magic != magic)
return null;
- ImageDataDirectory* dataEntry = this.GetDataEntry(ImageDataEntry.LoadConfig);
+ dataEntry = this.GetDataEntry(ImageDataEntry.LoadConfig);
if (dataEntry == null)
return null;
@@ -211,14 +222,17 @@ namespace ProcessHacker.Native.Image
private ImageNtHeaders* GetNtHeaders()
{
- int offset = *((int*)((byte*)this._memory + 0x3c));
+ int offset;
+ ImageNtHeaders* ntHeaders;
+
+ offset = *((int*)((byte*)_memory + 0x3c));
if (offset == 0)
throw new Exception("Invalid NT headers offset.");
if (offset >= 0x10000000 || offset >= _size)
throw new Exception("The NT headers offset is too large.");
- ImageNtHeaders* ntHeaders = (ImageNtHeaders*)((byte*)this._memory + offset);
+ ntHeaders = (ImageNtHeaders*)((byte*)_memory + offset);
return ntHeaders;
}
@@ -271,7 +285,7 @@ namespace ProcessHacker.Native.Image
readOnly ? MemoryProtection.ExecuteRead : MemoryProtection.ExecuteReadWrite
))
{
- _size = (int)fileHandle.FileSize;
+ _size = (int)fileHandle.GetSize();
_view = section.MapView(_size);
this.Load(_view);
@@ -299,7 +313,9 @@ namespace ProcessHacker.Native.Image
public void* RvaToVa(int rva)
{
- ImageSectionHeader* section = this.RvaToSection(rva);
+ ImageSectionHeader* section;
+
+ section = this.RvaToSection(rva);
if (section == null)
return null;
diff --git a/1.x/trunk/ProcessHacker.Native/ImpersonationContext.cs b/1.x/trunk/ProcessHacker.Native/ImpersonationContext.cs
index f35c10a0b..cfba70324 100644
--- a/1.x/trunk/ProcessHacker.Native/ImpersonationContext.cs
+++ b/1.x/trunk/ProcessHacker.Native/ImpersonationContext.cs
@@ -6,7 +6,7 @@ namespace ProcessHacker.Native
{
public class ImpersonationContext : IDisposable
{
- private bool _disposed;
+ private bool _disposed = false;
public ImpersonationContext(TokenHandle token)
{
@@ -16,11 +16,11 @@ namespace ProcessHacker.Native
public void Dispose()
{
- if (_disposed)
- return;
-
- Win32.RevertToSelf();
- this._disposed = true;
+ if (!_disposed)
+ {
+ Win32.RevertToSelf();
+ _disposed = true;
+ }
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/IntPtrExtensions.cs b/1.x/trunk/ProcessHacker.Native/IntPtrExtensions.cs
index 192721828..664fa81f3 100644
--- a/1.x/trunk/ProcessHacker.Native/IntPtrExtensions.cs
+++ b/1.x/trunk/ProcessHacker.Native/IntPtrExtensions.cs
@@ -22,6 +22,7 @@
*/
using System;
+using System.Runtime.InteropServices;
namespace ProcessHacker.Native
{
@@ -34,34 +35,26 @@ namespace ProcessHacker.Native
public static IntPtr And(this IntPtr ptr, int value)
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() & value);
- default:
- return new IntPtr(ptr.ToInt64() & value);
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() & value);
+ else
+ return new IntPtr(ptr.ToInt64() & value);
}
public static IntPtr And(this IntPtr ptr, IntPtr value)
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() & value.ToInt32());
- default:
- return new IntPtr(ptr.ToInt64() & value.ToInt64());
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() & value.ToInt32());
+ else
+ return new IntPtr(ptr.ToInt64() & value.ToInt64());
}
public static int CompareTo(this IntPtr ptr, IntPtr ptr2)
{
if (ptr.ToUInt64() > ptr2.ToUInt64())
return 1;
-
if (ptr.ToUInt64() < ptr2.ToUInt64())
return -1;
-
return 0;
}
@@ -74,22 +67,17 @@ namespace ProcessHacker.Native
{
if (ptr.ToUInt64() > ptr2)
return 1;
-
if (ptr.ToUInt64() < ptr2)
return -1;
-
return 0;
}
public static IntPtr Decrement(this IntPtr ptr, IntPtr ptr2)
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() - ptr2.ToInt32());
- default:
- return new IntPtr(ptr.ToInt64() - ptr2.ToInt64());
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() - ptr2.ToInt32());
+ else
+ return new IntPtr(ptr.ToInt64() - ptr2.ToInt64());
}
public static IntPtr Decrement(this IntPtr ptr, int value)
@@ -102,6 +90,13 @@ namespace ProcessHacker.Native
return Increment(ptr, -value);
}
+ public static T ElementAt(this IntPtr ptr, int index)
+ {
+ var offset = Marshal.SizeOf(typeof(T)) * index;
+ var offsetPtr = ptr.Increment(offset);
+ return (T)Marshal.PtrToStructure(offsetPtr, typeof(T));
+ }
+
public static bool Equals(this IntPtr ptr, IntPtr ptr2)
{
return ptr == ptr2;
@@ -131,13 +126,10 @@ namespace ProcessHacker.Native
{
unchecked
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() + value);
- default:
- return new IntPtr(ptr.ToInt64() + value);
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() + value);
+ else
+ return new IntPtr(ptr.ToInt64() + value);
}
}
@@ -145,13 +137,10 @@ namespace ProcessHacker.Native
{
unchecked
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr((int)(ptr.ToInt32() + value));
- default:
- return new IntPtr(ptr.ToInt64() + value);
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr((int)(ptr.ToInt32() + value));
+ else
+ return new IntPtr(ptr.ToInt64() + value);
}
}
@@ -159,16 +148,18 @@ namespace ProcessHacker.Native
{
unchecked
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() + ptr2.ToInt32());
- default:
- return new IntPtr(ptr.ToInt64() + ptr2.ToInt64());
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() + ptr2.ToInt32());
+ else
+ return new IntPtr(ptr.ToInt64() + ptr2.ToInt64());
}
}
+ public static IntPtr Increment(this IntPtr ptr)
+ {
+ return ptr.Increment(Marshal.SizeOf(typeof(T)));
+ }
+
public static bool IsGreaterThanOrEqualTo(this IntPtr ptr, IntPtr ptr2)
{
return ptr.CompareTo(ptr2) >= 0;
@@ -181,40 +172,40 @@ namespace ProcessHacker.Native
public static IntPtr Not(this IntPtr ptr)
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(~ptr.ToInt32());
- default:
- return new IntPtr(~ptr.ToInt64());
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(~ptr.ToInt32());
+ else
+ return new IntPtr(~ptr.ToInt64());
}
public static IntPtr Or(this IntPtr ptr, IntPtr value)
{
- switch (IntPtr.Size)
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() | value.ToInt32());
+ else
+ return new IntPtr(ptr.ToInt64() | value.ToInt64());
+ }
+
+ public static uint ToUInt32(this IntPtr ptr)
+ {
+ // Avoid sign-extending the pointer - we want it zero-extended.
+ unsafe
{
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() | value.ToInt32());
- default:
- return new IntPtr(ptr.ToInt64() | value.ToInt64());
+ void* voidPtr = (void*)ptr;
+
+ return (uint)voidPtr;
}
}
- public unsafe static uint ToUInt32(this IntPtr ptr)
+ public static ulong ToUInt64(this IntPtr ptr)
{
// Avoid sign-extending the pointer - we want it zero-extended.
- void* voidPtr = (void*)ptr;
+ unsafe
+ {
+ void* voidPtr = (void*)ptr;
- return (uint)voidPtr;
- }
-
- public unsafe static ulong ToUInt64(this IntPtr ptr)
- {
- // Avoid sign-extending the pointer - we want it zero-extended.
- void* voidPtr = (void*)ptr;
-
- return (ulong)voidPtr;
+ return (ulong)voidPtr;
+ }
}
public static IntPtr ToIntPtr(this int value)
@@ -251,13 +242,10 @@ namespace ProcessHacker.Native
public static IntPtr Xor(this IntPtr ptr, IntPtr value)
{
- switch (IntPtr.Size)
- {
- case sizeof(int):
- return new IntPtr(ptr.ToInt32() ^ value.ToInt32());
- default:
- return new IntPtr(ptr.ToInt64() ^ value.ToInt64());
- }
+ if (IntPtr.Size == sizeof(Int32))
+ return new IntPtr(ptr.ToInt32() ^ value.ToInt32());
+ else
+ return new IntPtr(ptr.ToInt64() ^ value.ToInt64());
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Io/BeepDevice.cs b/1.x/trunk/ProcessHacker.Native/Io/BeepDevice.cs
index 355b95db6..68ab2c533 100644
--- a/1.x/trunk/ProcessHacker.Native/Io/BeepDevice.cs
+++ b/1.x/trunk/ProcessHacker.Native/Io/BeepDevice.cs
@@ -13,15 +13,8 @@ namespace ProcessHacker.Native.Io
[StructLayout(LayoutKind.Sequential)]
public struct BeepSetParameters
{
- public static readonly int SizeOf;
-
public int Frequency;
public int Duration;
-
- static BeepSetParameters()
- {
- SizeOf = Marshal.SizeOf(typeof(BeepSetParameters));
- }
}
public const int BeepFrequencyMinimum = 0x25;
@@ -29,15 +22,18 @@ namespace ProcessHacker.Native.Io
public static readonly int IoCtlSet = Win32.CtlCode(DeviceType.Beep, 0, DeviceControlMethod.Buffered, DeviceControlAccess.Any);
- public static unsafe void Beep(int frequency, int duration)
+ public static void Beep(int frequency, int duration)
{
- BeepSetParameters p;
+ unsafe
+ {
+ BeepSetParameters p;
- p.Frequency = frequency;
- p.Duration = duration;
+ p.Frequency = frequency;
+ p.Duration = duration;
- using (var fhandle = OpenBeepDevice(FileAccess.GenericRead))
- fhandle.IoControl(IoCtlSet, &p, BeepSetParameters.SizeOf, null, 0);
+ using (var fhandle = OpenBeepDevice(FileAccess.GenericRead))
+ fhandle.IoControl(IoCtlSet, &p, Marshal.SizeOf(typeof(BeepSetParameters)), null, 0);
+ }
}
private static FileHandle OpenBeepDevice(FileAccess access)
diff --git a/1.x/trunk/ProcessHacker.Native/Io/DiskDevice.cs b/1.x/trunk/ProcessHacker.Native/Io/DiskDevice.cs
index 845d17b88..8894a1925 100644
--- a/1.x/trunk/ProcessHacker.Native/Io/DiskDevice.cs
+++ b/1.x/trunk/ProcessHacker.Native/Io/DiskDevice.cs
@@ -1,5 +1,8 @@
-using System.Runtime.InteropServices;
-
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Text;
+using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -8,7 +11,7 @@ namespace ProcessHacker.Native.Io
{
public static class DiskDevice
{
- public enum DiskCacheState
+ public enum DiskCacheState : int
{
Normal,
WriteThroughNotSupported,
@@ -19,17 +22,10 @@ namespace ProcessHacker.Native.Io
[StructLayout(LayoutKind.Sequential)]
public struct DiskCacheSetting
{
- public static readonly int SizeOf;
-
public int Version;
public DiskCacheState State;
[MarshalAs(UnmanagedType.I1)]
public bool IsPowerProtected;
-
- static DiskCacheSetting()
- {
- SizeOf = Marshal.SizeOf(typeof(DiskCacheSetting));
- }
}
[StructLayout(LayoutKind.Sequential)]
@@ -71,21 +67,24 @@ namespace ProcessHacker.Native.Io
return GetCacheSetting(fhandle, out isPowerProtected);
}
- public static unsafe DiskCacheState GetCacheSetting(FileHandle fileHandle, out bool isPowerProtected)
+ public static DiskCacheState GetCacheSetting(FileHandle fileHandle, out bool isPowerProtected)
{
- DiskCacheSetting diskCacheSetting;
+ unsafe
+ {
+ DiskCacheSetting diskCacheSetting;
- fileHandle.IoControl(
- IoCtlGetCacheSetting,
- null,
- 0,
- &diskCacheSetting,
- DiskCacheSetting.SizeOf
- );
+ fileHandle.IoControl(
+ IoCtlGetCacheSetting,
+ null,
+ 0,
+ &diskCacheSetting,
+ Marshal.SizeOf(typeof(DiskCacheSetting))
+ );
- isPowerProtected = diskCacheSetting.IsPowerProtected;
+ isPowerProtected = diskCacheSetting.IsPowerProtected;
- return diskCacheSetting.State;
+ return diskCacheSetting.State;
+ }
}
public static void SetCacheSetting(string fileName, DiskCacheState state, bool isPowerProtected)
@@ -94,21 +93,24 @@ namespace ProcessHacker.Native.Io
SetCacheSetting(fhandle, state, isPowerProtected);
}
- public static unsafe void SetCacheSetting(FileHandle fileHandle, DiskCacheState state, bool isPowerProtected)
+ public static void SetCacheSetting(FileHandle fileHandle, DiskCacheState state, bool isPowerProtected)
{
- DiskCacheSetting diskCacheSetting;
+ unsafe
+ {
+ DiskCacheSetting diskCacheSetting;
- diskCacheSetting.Version = DiskCacheSetting.SizeOf;
- diskCacheSetting.State = state;
- diskCacheSetting.IsPowerProtected = isPowerProtected;
+ diskCacheSetting.Version = Marshal.SizeOf(typeof(DiskCacheSetting));
+ diskCacheSetting.State = state;
+ diskCacheSetting.IsPowerProtected = isPowerProtected;
- fileHandle.IoControl(
- IoCtlSetCacheSetting,
- &diskCacheSetting,
- DiskCacheSetting.SizeOf,
- null,
- 0
- );
+ fileHandle.IoControl(
+ IoCtlSetCacheSetting,
+ &diskCacheSetting,
+ Marshal.SizeOf(typeof(DiskCacheSetting)),
+ null,
+ 0
+ );
+ }
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Io/MountManager.cs b/1.x/trunk/ProcessHacker.Native/Io/MountManager.cs
index 4091332cc..cd9e2eee0 100644
--- a/1.x/trunk/ProcessHacker.Native/Io/MountManager.cs
+++ b/1.x/trunk/ProcessHacker.Native/Io/MountManager.cs
@@ -21,7 +21,10 @@
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Text;
+using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -44,12 +47,7 @@ namespace ProcessHacker.Native.Io
[StructLayout(LayoutKind.Sequential)]
public struct MountMgrMountPoint
{
- public static readonly int SizeOf;
-
- static MountMgrMountPoint()
- {
- SizeOf = Marshal.SizeOf(typeof(MountMgrMountPoint));
- }
+ public static readonly int Size = Marshal.SizeOf(typeof(MountMgrMountPoint));
public int SymbolicLinkNameOffset;
public ushort SymbolicLinkNameLength;
@@ -96,17 +94,12 @@ namespace ProcessHacker.Native.Io
[StructLayout(LayoutKind.Sequential)]
public struct MountMgrVolumeMountPoint
{
- public static readonly int SizeOf;
+ public static readonly int Size = Marshal.SizeOf(typeof(MountMgrVolumeMountPoint));
public ushort SourceVolumeNameOffset;
public ushort SourceVolumeNameLength;
public ushort TargetVolumeNameOffset;
public ushort TargetVolumeNameLength;
-
- static MountMgrVolumeMountPoint()
- {
- SizeOf = Marshal.SizeOf(typeof(MountMgrVolumeMountPoint));
- }
}
// Input, output for IoCtlChangeNotify
@@ -172,16 +165,14 @@ namespace ProcessHacker.Native.Io
private static void DeleteSymbolicLink(string path)
{
- using (MemoryAlloc data = new MemoryAlloc(MountMgrMountPoint.SizeOf + path.Length * 2))
- using (MemoryAlloc outData = new MemoryAlloc(1600))
+ using (var data = new MemoryAlloc(MountMgrMountPoint.Size + path.Length * 2))
+ using (var outData = new MemoryAlloc(1600))
{
- MountMgrMountPoint mountPoint = new MountMgrMountPoint
- {
- SymbolicLinkNameLength = (ushort)(path.Length*2),
- SymbolicLinkNameOffset = MountMgrMountPoint.SizeOf
- };
+ MountMgrMountPoint mountPoint = new MountMgrMountPoint();
- data.WriteStruct(mountPoint);
+ mountPoint.SymbolicLinkNameLength = (ushort)(path.Length * 2);
+ mountPoint.SymbolicLinkNameOffset = MountMgrMountPoint.Size;
+ data.WriteStruct(mountPoint);
data.WriteUnicodeString(mountPoint.SymbolicLinkNameOffset, path);
using (var fhandle = OpenMountManager(FileAccess.GenericRead | FileAccess.GenericWrite))
@@ -201,7 +192,7 @@ namespace ProcessHacker.Native.Io
/// The device name associated with the DOS drive.
public static string GetDeviceName(string fileName)
{
- using (FileHandle fhandle = new FileHandle(
+ using (var fhandle = new FileHandle(
fileName,
FileShareMode.ReadWrite,
FileCreateOptions.SynchronousIoNonAlert,
@@ -212,7 +203,7 @@ namespace ProcessHacker.Native.Io
public static string GetDeviceName(FileHandle fhandle)
{
- using (MemoryAlloc data = new MemoryAlloc(600))
+ using (var data = new MemoryAlloc(600))
{
fhandle.IoControl(IoCtlQueryDeviceName, IntPtr.Zero, 0, data, data.Size);
@@ -224,7 +215,7 @@ namespace ProcessHacker.Native.Io
private static string GetReparsePointTarget(FileHandle fhandle)
{
- using (MemoryAlloc data = new MemoryAlloc(FileSystem.MaximumReparseDataBufferSize))
+ using (var data = new MemoryAlloc(FileSystem.MaximumReparseDataBufferSize))
{
fhandle.IoControl(FileSystem.FsCtlGetReparsePoint, IntPtr.Zero, 0, data, data.Size);
@@ -299,15 +290,13 @@ namespace ProcessHacker.Native.Io
public static string GetVolumeName(string deviceName)
{
- using (MemoryAlloc data = new MemoryAlloc(MountMgrMountPoint.SizeOf + deviceName.Length * 2))
+ using (var data = new MemoryAlloc(MountMgrMountPoint.Size + deviceName.Length * 2))
{
- MountMgrMountPoint mountPoint = new MountMgrMountPoint
- {
- DeviceNameLength = (ushort)(deviceName.Length*2),
- DeviceNameOffset = MountMgrMountPoint.SizeOf
- };
+ MountMgrMountPoint mountPoint = new MountMgrMountPoint();
- data.WriteStruct(mountPoint);
+ mountPoint.DeviceNameLength = (ushort)(deviceName.Length * 2);
+ mountPoint.DeviceNameOffset = MountMgrMountPoint.Size;
+ data.WriteStruct(mountPoint);
data.WriteUnicodeString(mountPoint.DeviceNameOffset, deviceName);
using (var fhandle = OpenMountManager((FileAccess)StandardRights.Synchronize))
@@ -315,7 +304,7 @@ namespace ProcessHacker.Native.Io
NtStatus status;
int retLength;
- using (MemoryAlloc outData = new MemoryAlloc(0x100))
+ using (var outData = new MemoryAlloc(0x100))
{
while (true)
{
@@ -339,7 +328,8 @@ namespace ProcessHacker.Native.Io
}
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
MountMgrMountPoints mountPoints = outData.ReadStruct();
@@ -349,11 +339,11 @@ namespace ProcessHacker.Native.Io
{
MountMgrMountPoint mp = outData.ReadStruct(
MountMgrMountPoints.MountPointsOffset,
- MountMgrMountPoint.SizeOf,
i
);
+ string symLinkName;
- string symLinkName = Marshal.PtrToStringUni(
+ symLinkName = Marshal.PtrToStringUni(
outData.Memory.Increment(mp.SymbolicLinkNameOffset),
mp.SymbolicLinkNameLength / 2
);
@@ -372,20 +362,20 @@ namespace ProcessHacker.Native.Io
{
if (
path.Length == 14 &&
- path.StartsWith(@"\DosDevices\", StringComparison.OrdinalIgnoreCase) &&
+ path.StartsWith(@"\DosDevices\") &&
path[12] >= 'A' && path[12] <= 'Z' &&
path[13] == ':'
)
return true;
-
- return false;
+ else
+ return false;
}
public static bool IsVolumePath(string path)
{
if (
(path.Length == 48 || (path.Length == 49 && path[48] == '\\')) &&
- (path.StartsWith(@"\??\Volume", StringComparison.OrdinalIgnoreCase) || path.StartsWith(@"\\?\Volume", StringComparison.OrdinalIgnoreCase)) &&
+ (path.StartsWith(@"\??\Volume") || path.StartsWith(@"\\?\Volume")) &&
path[10] == '{' &&
path[19] == '-' &&
path[24] == '-' &&
@@ -394,32 +384,31 @@ namespace ProcessHacker.Native.Io
path[47] == '}'
)
return true;
-
- return false;
+ else
+ return false;
}
private static void Notify(bool created, string sourceVolumeName, string targetVolumeName)
{
- using (MemoryAlloc data = new MemoryAlloc(
- MountMgrVolumeMountPoint.SizeOf +
+ using (var data = new MemoryAlloc(
+ MountMgrVolumeMountPoint.Size +
sourceVolumeName.Length * 2 +
targetVolumeName.Length * 2
))
{
- MountMgrVolumeMountPoint mountPoint = new MountMgrVolumeMountPoint
- {
- SourceVolumeNameLength = (ushort)(sourceVolumeName.Length * 2),
- SourceVolumeNameOffset = (ushort)MountMgrVolumeMountPoint.SizeOf,
- TargetVolumeNameLength = (ushort)(targetVolumeName.Length * 2)
- };
+ MountMgrVolumeMountPoint mountPoint = new MountMgrVolumeMountPoint();
- mountPoint.TargetVolumeNameOffset = (ushort)(mountPoint.SourceVolumeNameOffset + mountPoint.SourceVolumeNameLength);
+ mountPoint.SourceVolumeNameLength = (ushort)(sourceVolumeName.Length * 2);
+ mountPoint.SourceVolumeNameOffset = (ushort)MountMgrVolumeMountPoint.Size;
+ mountPoint.TargetVolumeNameLength = (ushort)(targetVolumeName.Length * 2);
+ mountPoint.TargetVolumeNameOffset =
+ (ushort)(mountPoint.SourceVolumeNameOffset + mountPoint.SourceVolumeNameLength);
- data.WriteStruct(mountPoint);
+ data.WriteStruct(mountPoint);
data.WriteUnicodeString(mountPoint.SourceVolumeNameOffset, sourceVolumeName);
data.WriteUnicodeString(mountPoint.TargetVolumeNameOffset, targetVolumeName);
- using (FileHandle fhandle = OpenMountManager(FileAccess.GenericRead | FileAccess.GenericWrite))
+ using (var fhandle = OpenMountManager(FileAccess.GenericRead | FileAccess.GenericWrite))
{
fhandle.IoControl(
created ? IoCtlVolumeMountPointCreated : IoCtlVolumeMountPointDeleted,
diff --git a/1.x/trunk/ProcessHacker.Native/Io/StorageDevice.cs b/1.x/trunk/ProcessHacker.Native/Io/StorageDevice.cs
index 8184df4db..532831101 100644
--- a/1.x/trunk/ProcessHacker.Native/Io/StorageDevice.cs
+++ b/1.x/trunk/ProcessHacker.Native/Io/StorageDevice.cs
@@ -23,8 +23,6 @@ namespace ProcessHacker.Native.Io
[StructLayout(LayoutKind.Sequential)]
public struct StorageHotplugInfo
{
- public static readonly int SizeOf;
-
public int Size;
[MarshalAs(UnmanagedType.I1)]
public bool MediaRemovable;
@@ -34,11 +32,6 @@ namespace ProcessHacker.Native.Io
public bool DeviceHotplug;
[MarshalAs(UnmanagedType.I1)]
public bool WriteCacheEnableOverride;
-
- static StorageHotplugInfo()
- {
- SizeOf = Marshal.SizeOf(typeof(StorageHotplugInfo));
- }
}
public static readonly int IoCtlMediaRemoval = Win32.CtlCode(DeviceType.MassStorage, 0x0201, DeviceControlMethod.Buffered, DeviceControlAccess.Read);
@@ -68,13 +61,16 @@ namespace ProcessHacker.Native.Io
return GetHotplugInfo(fhandle);
}
- public static unsafe StorageHotplugInfo GetHotplugInfo(FileHandle fileHandle)
+ public static StorageHotplugInfo GetHotplugInfo(FileHandle fileHandle)
{
- StorageHotplugInfo hotplugInfo;
+ unsafe
+ {
+ StorageHotplugInfo hotplugInfo;
- fileHandle.IoControl(IoCtlGetHotplugInfo, null, 0, &hotplugInfo, StorageHotplugInfo.SizeOf);
+ fileHandle.IoControl(IoCtlGetHotplugInfo, null, 0, &hotplugInfo, Marshal.SizeOf(typeof(StorageHotplugInfo)));
- return hotplugInfo;
+ return hotplugInfo;
+ }
}
public static FileHandle OpenStorageDevice(string fileName, FileAccess access)
diff --git a/1.x/trunk/ProcessHacker.Native/Ipc/IpcCircularBuffer.cs b/1.x/trunk/ProcessHacker.Native/Ipc/IpcCircularBuffer.cs
index dc560f6e8..d8f935285 100644
--- a/1.x/trunk/ProcessHacker.Native/Ipc/IpcCircularBuffer.cs
+++ b/1.x/trunk/ProcessHacker.Native/Ipc/IpcCircularBuffer.cs
@@ -28,18 +28,11 @@ using ProcessHacker.Native.Threading;
namespace ProcessHacker.Native.Ipc
{
- public unsafe class IpcCircularBuffer : IDisposable
+ public unsafe class IpcCircularBuffer
{
[StructLayout(LayoutKind.Sequential)]
- public struct BufferHeader
+ private struct BufferHeader
{
- public static readonly int SizeOf;
-
- static BufferHeader()
- {
- SizeOf = Marshal.SizeOf(typeof(BufferHeader));
- }
-
public int BlockSize;
public int NumberOfBlocks;
@@ -57,21 +50,22 @@ namespace ProcessHacker.Native.Ipc
Random r = new Random();
long readSemaphoreId = ((long)r.Next() << 32) + r.Next();
long writeSemaphoreId = ((long)r.Next() << 32) + r.Next();
+ Section section;
- Section section = new Section(name, blockSize * numberOfBlocks, MemoryProtection.ReadWrite);
+ section = new Section(name, blockSize * numberOfBlocks, MemoryProtection.ReadWrite);
- using (SectionView view = section.MapView(BufferHeader.SizeOf))
+ using (var view = section.MapView(Marshal.SizeOf(typeof(BufferHeader))))
{
- BufferHeader header = new BufferHeader
- {
- BlockSize = blockSize,
- NumberOfBlocks = numberOfBlocks,
- ReadSemaphoreId = readSemaphoreId,
- WriteSemaphoreId = writeSemaphoreId,
- ReadPosition = 0, WritePosition = 0
- };
+ BufferHeader header = new BufferHeader();
- view.WriteStruct(header);
+ header.BlockSize = blockSize;
+ header.NumberOfBlocks = numberOfBlocks;
+ header.ReadSemaphoreId = readSemaphoreId;
+ header.WriteSemaphoreId = writeSemaphoreId;
+ header.ReadPosition = 0;
+ header.WritePosition = 0;
+
+ view.WriteStruct(header);
}
return new IpcCircularBuffer(
@@ -87,13 +81,13 @@ namespace ProcessHacker.Native.Ipc
return new IpcCircularBuffer(new Section(name, SectionAccess.All), name, null, null);
}
- private readonly Section _section;
- private readonly SectionView _sectionView;
- private readonly Semaphore _readSemaphore;
- private readonly Semaphore _writeSemaphore;
+ private Section _section;
+ private SectionView _sectionView;
+ private Semaphore _readSemaphore;
+ private Semaphore _writeSemaphore;
- private readonly BufferHeader* _header;
- private readonly void* _data;
+ private BufferHeader* _header;
+ private void* _data;
private IpcCircularBuffer(Section section, string sectionName, Semaphore readSemaphore, Semaphore writeSemaphore)
{
@@ -101,7 +95,7 @@ namespace ProcessHacker.Native.Ipc
_section = section;
- _sectionView = section.MapView(BufferHeader.SizeOf);
+ _sectionView = section.MapView(Marshal.SizeOf(typeof(BufferHeader)));
header = _sectionView.ReadStruct();
_sectionView.Dispose();
@@ -121,17 +115,16 @@ namespace ProcessHacker.Native.Ipc
_data = &_header->Data;
}
- public T Read() where T : struct
+ public T Read()
+ where T : struct
{
- using (MemoryAlloc data = this.Read())
- {
+ using (var data = this.Read())
return data.ReadStruct();
- }
}
public MemoryAlloc Read()
{
- MemoryAlloc data = new MemoryAlloc(_header->BlockSize);
+ var data = new MemoryAlloc(_header->BlockSize);
this.Read(data);
@@ -175,12 +168,13 @@ namespace ProcessHacker.Native.Ipc
_writeSemaphore.Release();
}
- public void Write(int size, T s) where T : struct
+ public void Write(T s)
+ where T : struct
{
- using (MemoryAlloc data = new MemoryAlloc(size))
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(T))))
{
- data.WriteStruct(s);
- this.Write(data);
+ data.WriteStruct(s);
+ this.Write((MemoryRegion)data);
}
}
@@ -225,14 +219,5 @@ namespace ProcessHacker.Native.Ipc
// Release the read semaphore to allow a reader to read one more block.
_readSemaphore.Release();
}
-
- public void Dispose()
- {
- if (_readSemaphore != null)
- _readSemaphore.Dispose();
-
- if (_writeSemaphore != null)
- _writeSemaphore.Dispose();
- }
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/KProcessHacker.cs b/1.x/trunk/ProcessHacker.Native/KProcessHacker.cs
index 4c31da159..2d3d6b06c 100644
--- a/1.x/trunk/ProcessHacker.Native/KProcessHacker.cs
+++ b/1.x/trunk/ProcessHacker.Native/KProcessHacker.cs
@@ -2,7 +2,7 @@
* Process Hacker -
* KProcessHacker interfacing code
*
- * Copyright (C) 2009-2011 wj32
+ * Copyright (C) 2009 wj32
*
* This file is part of Process Hacker.
*
@@ -23,96 +23,134 @@
// The private field 'field' is assigned but its value is never used
#pragma warning disable 0414
+using System;
using System.Runtime.InteropServices;
+using System.Text;
using System.Windows.Forms;
-using ProcessHacker.Native;
+using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
+using ProcessHacker.Native.SsLogging;
-namespace System
+namespace ProcessHacker.Native
{
///
/// Provides an interface to KProcessHacker.
///
- public sealed unsafe class KProcessHacker2 : IDisposable
+ public sealed unsafe class KProcessHacker
{
- public static KProcessHacker2 Instance;
+ private static KProcessHacker _instance;
- public bool KphIsConnected
+ public static KProcessHacker Instance
{
- get { return _fileHandle != null; }
+ get { return _instance; }
+ set { _instance = value; }
}
- public static int KphCtlCode(int x)
+ ///
+ /// A control code used by KProcessHacker to represent a specific function.
+ ///
+ private enum Control : uint
{
- return Win32.CtlCode((DeviceType)KphDeviceType, 0x800 + x, DeviceControlMethod.Neither, DeviceControlAccess.Any);
+ ClientCloseHandle = 0,
+ SsQueryClientEntry,
+ Reserved1,
+ KphOpenProcess,
+ KphOpenThread,
+ KphOpenProcessToken,
+ GetProcessProtected,
+ SetProcessProtected,
+ KphTerminateProcess,
+ KphSuspendProcess,
+ KphResumeProcess,
+ KphReadVirtualMemory,
+ KphWriteVirtualMemory,
+ SetProcessToken,
+ GetThreadStartAddress,
+ SetHandleAttributes,
+ GetHandleObjectName,
+ KphOpenProcessJob,
+ KphGetContextThread,
+ KphSetContextThread,
+ KphGetThreadWin32Thread,
+ KphDuplicateObject,
+ ZwQueryObject,
+ KphGetProcessId,
+ KphGetThreadId,
+ KphTerminateThread,
+ GetFeatures,
+ KphSetHandleGrantedAccess,
+ KphAssignImpersonationToken,
+ ProtectAdd,
+ ProtectRemove,
+ ProtectQuery,
+ KphUnsafeReadVirtualMemory,
+ SetExecuteOptions,
+ KphQueryProcessHandles,
+ KphOpenThreadProcess,
+ KphCaptureStackBackTraceThread,
+ KphDangerousTerminateThread,
+ KphOpenType,
+ KphOpenDriver,
+ KphQueryInformationDriver,
+ KphOpenDirectoryObject,
+ SsRef,
+ SsUnref,
+ SsCreateClientEntry,
+ SsCreateRuleSetEntry,
+ SsRemoveRule,
+ SsAddProcessIdRule,
+ SsAddThreadIdRule,
+ SsAddPreviousModeRule,
+ SsAddNumberRule,
+ SsEnableClientEntry,
+ KphOpenNamedObject,
+ KphQueryInformationProcess,
+ KphQueryInformationThread,
+ KphSetInformationProcess,
+ KphSetInformationThread,
}
- public const int KphDeviceType = 0x9999;
-
- // General
- public static readonly int IoCtlGetFeatures = KphCtlCode(0);
-
- // Processes
- public static readonly int IoCtlOpenProcess = KphCtlCode(50);
- public static readonly int IoCtlOpenProcessToken = KphCtlCode(51);
- public static readonly int IoCtlOpenProcessJob = KphCtlCode(52);
- public static readonly int IoCtlSuspendProcess = KphCtlCode(53);
- public static readonly int IoCtlResumeProcess = KphCtlCode(54);
- public static readonly int IoCtlTerminateProcess = KphCtlCode(55);
- public static readonly int IoCtlReadVirtualMemory = KphCtlCode(56);
- public static readonly int IoCtlWriteVirtualMemory = KphCtlCode(57);
- public static readonly int IoCtlReadVirtualMemoryUnsafe = KphCtlCode(58);
- public static readonly int IoCtlQueryInformationProcess = KphCtlCode(59);
- public static readonly int IoCtlSetInformationProcess = KphCtlCode(60);
-
- // Threads
- public static readonly int IoCtlOpenThread = KphCtlCode(100);
- public static readonly int IoCtlOpenThreadProcess = KphCtlCode(101);
- public static readonly int IoCtlTerminateThread = KphCtlCode(102);
- public static readonly int IoCtlTerminateThreadUnsafe = KphCtlCode(103);
- public static readonly int IoCtlGetContextThread = KphCtlCode(104);
- public static readonly int IoCtlSetContextThread = KphCtlCode(105);
- public static readonly int IoCtlCaptureStackBackTraceThread = KphCtlCode(106);
- public static readonly int IoCtlQueryInformationThread = KphCtlCode(107);
- public static readonly int IoCtlSetInformationThread = KphCtlCode(108);
-
- // Handles
- public static readonly int IoCtlEnumerateProcessHandles = KphCtlCode(150);
- public static readonly int IoCtlQueryInformationObject = KphCtlCode(151);
- public static readonly int IoCtlSetInformationObject = KphCtlCode(152);
- public static readonly int IoCtlDuplicateObject = KphCtlCode(153);
-
- // Misc.
- public static readonly int IoCtlOpenDriver = KphCtlCode(200);
- public static readonly int IoCtlQueryInformationDriver = KphCtlCode(201);
-
[Flags]
- public enum KphFeatures
+ public enum KphFeatures : int
{
- None = 0 // none so far
+ PsTerminateProcess = 0x1,
+ PspTerminateThreadByPointer = 0x2
}
- private readonly string _deviceName;
+ private string _deviceName;
private FileHandle _fileHandle;
- private readonly KphFeatures _features;
+ private uint _baseControlNumber;
+ private KphFeatures _features;
///
/// Creates a connection to KProcessHacker.
///
- public KProcessHacker2()
- : this("KProcessHacker2")
+ public KProcessHacker()
+ : this("KProcessHacker")
{ }
///
/// Creates a connection to KProcessHacker.
///
/// The name of the KProcessHacker service and device.
- public KProcessHacker2(string deviceName)
+ public KProcessHacker(string deviceName)
+ : this(deviceName, Application.StartupPath + "\\kprocesshacker.sys")
+ { }
+
+ ///
+ /// Creates a connection to KProcessHacker.
+ ///
+ /// The name of the KProcessHacker service and device.
+ /// The file name of the KProcessHacker driver.
+ public KProcessHacker(string deviceName, string fileName)
{
_deviceName = deviceName;
+ if (OSVersion.Architecture != OSArch.I386)
+ throw new NotSupportedException("KProcessHacker does not support 64-bit Windows.");
+
try
{
_fileHandle = new FileHandle(
@@ -129,7 +167,53 @@ namespace System
ex.Status == NtStatus.ObjectNameNotFound
)
{
- LoadService();
+ // Attempt to load the driver, then try again.
+ ServiceHandle shandle;
+ bool created = false;
+
+ try
+ {
+ using (shandle = new ServiceHandle("KProcessHacker", ServiceAccess.Start))
+ {
+ shandle.Start();
+ }
+ }
+ catch
+ {
+ using (var scm = new ServiceManagerHandle(ScManagerAccess.CreateService))
+ {
+ shandle = scm.CreateService(
+ deviceName,
+ deviceName,
+ ServiceType.KernelDriver,
+ fileName
+ );
+ shandle.Start();
+ created = true;
+ }
+ }
+
+ try
+ {
+ _fileHandle = new FileHandle(
+ @"\Device\" + deviceName,
+ 0,
+ FileAccess.GenericRead | FileAccess.GenericWrite
+ );
+ }
+ finally
+ {
+ if (shandle != null)
+ {
+ if (created)
+ {
+ // The SCM will delete the service when it is stopped.
+ shandle.Delete();
+ }
+
+ shandle.Dispose();
+ }
+ }
}
else
{
@@ -138,7 +222,18 @@ namespace System
}
_fileHandle.SetHandleFlags(Win32HandleFlags.ProtectFromClose, Win32HandleFlags.ProtectFromClose);
- _features = this.KphGetFeatures();
+
+ byte[] bytes = _fileHandle.Read(4);
+
+ fixed (byte* bytesPtr = bytes)
+ _baseControlNumber = *(uint*)bytesPtr;
+
+ try
+ {
+ _features = this.GetFeatures();
+ }
+ catch
+ { }
}
public string DeviceName
@@ -151,276 +246,960 @@ namespace System
get { return _features; }
}
-
- public void LoadService()
+ private int CtlCode(Control ctl)
{
- // Attempt to load the driver, then try again.
- ServiceHandle shandle;
- bool created = false;
+ return (int)(_baseControlNumber + ((uint)ctl * 4));
+ }
+
+ ///
+ /// Closes the connection to KProcessHacker.
+ ///
+ public void Close()
+ {
+ _fileHandle.SetHandleFlags(Win32HandleFlags.ProtectFromClose, 0);
+ _fileHandle.Dispose();
+ }
+
+ public void ClientCloseHandle(IntPtr handle)
+ {
+ byte* inData = stackalloc byte[4];
+
+ *(int*)inData = handle.ToInt32();
+
+ _fileHandle.IoControl(CtlCode(Control.ClientCloseHandle), inData, 4, null, 0);
+ }
+
+ public KphFeatures GetFeatures()
+ {
+ byte* outData = stackalloc byte[4];
+
+ _fileHandle.IoControl(CtlCode(Control.GetFeatures), null, 0, outData, 4);
+
+ return (KphFeatures)(*(int*)outData);
+ }
+
+ public string GetHandleObjectName(ProcessHandle processHandle, IntPtr handle)
+ {
+ byte* inData = stackalloc byte[8];
+ byte[] outData = new byte[2048];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = handle.ToInt32();
try
{
- using (shandle = new ServiceHandle(_deviceName, ServiceAccess.Start))
- {
- shandle.Start();
- }
+ int len = _fileHandle.IoControl(CtlCode(Control.GetHandleObjectName),
+ inData, 8, outData);
+
+ return Encoding.Unicode.GetString(outData, 8, len - 8).TrimEnd('\0');
}
catch
+ { }
+
+ return null;
+ }
+
+ public bool GetProcessProtected(int pid)
+ {
+ byte[] result = new byte[1];
+
+ _fileHandle.IoControl(CtlCode(Control.GetProcessProtected),
+ (byte*)&pid, 4, result);
+
+ return result[0] != 0;
+ }
+
+ public uint GetThreadStartAddress(ThreadHandle threadHandle)
+ {
+ byte* outData = stackalloc byte[4];
+ int threadHandleInt = threadHandle;
+
+ _fileHandle.IoControl(CtlCode(Control.GetThreadStartAddress),
+ (byte*)&threadHandleInt, 4, outData, 4);
+
+ return *(uint*)outData;
+ }
+
+ public void KphAssignImpersonationToken(ThreadHandle threadHandle, TokenHandle tokenHandle)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 4) = tokenHandle;
+
+ _fileHandle.IoControl(CtlCode(Control.KphAssignImpersonationToken), inData, 8, null, 0);
+ }
+
+ public unsafe int KphCaptureStackBackTraceThread(
+ ThreadHandle threadHandle,
+ int framesToSkip,
+ int framesToCapture,
+ IntPtr[] backTrace,
+ out int backTraceHash
+ )
+ {
+ byte* inData = stackalloc byte[6 * sizeof(int)];
+ int capturedFramesLocal;
+ int backTraceHashLocal;
+
+ if (framesToCapture > backTrace.Length)
+ throw new ArgumentOutOfRangeException("Back trace buffer is too small.");
+
+ fixed (IntPtr* backTracePtr = backTrace)
{
- using (ServiceManagerHandle scm = new ServiceManagerHandle(ScManagerAccess.CreateService))
- {
- shandle = scm.CreateService(
- _deviceName,
- _deviceName,
- ServiceType.KernelDriver,
- Application.StartupPath + "\\kprocesshacker.sys"
- );
- shandle.Start();
- created = true;
- }
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 0x4) = framesToSkip;
+ *(int*)(inData + 0x8) = framesToCapture;
+ *(int*)(inData + 0xc) = (int)backTracePtr;
+ *(int*)(inData + 0x10) = (int)&capturedFramesLocal;
+ *(int*)(inData + 0x14) = (int)&backTraceHashLocal;
+
+ _fileHandle.IoControl(CtlCode(Control.KphCaptureStackBackTraceThread), inData, 6 * sizeof(int), null, 0);
+ backTraceHash = backTraceHashLocal;
+
+ return capturedFramesLocal;
}
+ }
+
+ public void KphDangerousTerminateThread(ThreadHandle threadHandle, NtStatus exitStatus)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 4) = (int)exitStatus;
+
+ _fileHandle.IoControl(CtlCode(Control.KphDangerousTerminateThread), inData, 8, null, 0);
+ }
+
+ public void KphDuplicateObject(
+ int sourceProcessHandle,
+ int sourceHandle,
+ int targetProcessHandle,
+ out int targetHandle,
+ int desiredAccess,
+ HandleFlags handleAttributes,
+ DuplicateOptions options
+ )
+ {
+ int handle;
+
+ KphDuplicateObject(
+ sourceProcessHandle,
+ sourceHandle,
+ targetProcessHandle,
+ (int)&handle,
+ desiredAccess,
+ handleAttributes,
+ options
+ );
+
+ targetHandle = handle;
+ }
+
+ public void KphDuplicateObject(
+ int sourceProcessHandle,
+ int sourceHandle,
+ int targetProcessHandle,
+ int targetHandle,
+ int desiredAccess,
+ HandleFlags handleAttributes,
+ DuplicateOptions options
+ )
+ {
+ byte[] data = new byte[7 * sizeof(int)];
+
+ fixed (byte* dataPtr = data)
+ {
+ *(int*)(dataPtr + 0x0) = sourceProcessHandle;
+ *(int*)(dataPtr + 0x4) = sourceHandle;
+ *(int*)(dataPtr + 0x8) = targetProcessHandle;
+ *(int*)(dataPtr + 0xc) = targetHandle;
+ *(int*)(dataPtr + 0x10) = desiredAccess;
+ *(int*)(dataPtr + 0x14) = (int)handleAttributes;
+ *(int*)(dataPtr + 0x18) = (int)options;
+
+ _fileHandle.IoControl(CtlCode(Control.KphDuplicateObject), data, null);
+ }
+ }
+
+ public void KphGetContextThread(ThreadHandle threadHandle, Context* context)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 4) = (int)context;
+
+ _fileHandle.IoControl(CtlCode(Control.KphGetContextThread), inData, 8, null, 0);
+ }
+
+ public int KphGetProcessId(ProcessHandle processHandle, IntPtr handle)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = handle.ToInt32();
+
+ _fileHandle.IoControl(CtlCode(Control.KphGetProcessId), inData, 8, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphGetThreadId(ProcessHandle processHandle, IntPtr handle, out int processId)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[8];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = handle.ToInt32();
+
+ _fileHandle.IoControl(CtlCode(Control.KphGetThreadId), inData, 8, outData, 8);
+ processId = *(int*)(outData + 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphGetThreadWin32Thread(ThreadHandle threadHandle)
+ {
+ int threadHandleInt = threadHandle;
+ byte* outData = stackalloc byte[4];
+
+ _fileHandle.IoControl(CtlCode(Control.KphGetThreadWin32Thread), (byte*)&threadHandleInt, 4, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphOpenDirectoryObject(DirectoryAccess access, ObjectAttributes objectAttributes)
+ {
+ byte* inData = stackalloc byte[0xc];
+ int directoryObjectHandle;
+
+ *(int*)inData = (int)&directoryObjectHandle;
+ *(int*)(inData + 0x4) = (int)access;
+ *(int*)(inData + 0x8) = (int)&objectAttributes;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenDirectoryObject), inData, 0xc, null, 0);
+
+ return directoryObjectHandle;
+ }
+
+ public int KphOpenDriver(ObjectAttributes objectAttributes)
+ {
+ byte* inData = stackalloc byte[8];
+ int driverHandle;
+
+ *(int*)inData = (int)&driverHandle;
+ *(int*)(inData + 4) = (int)&objectAttributes;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenDriver), inData, 8, null, 0);
+
+ return driverHandle;
+ }
+
+ public int KphOpenNamedObject(int access, ObjectAttributes objectAttributes)
+ {
+ byte* inData = stackalloc byte[0xc];
+ int handle;
+
+ *(int*)inData = (int)&handle;
+ *(int*)(inData + 4) = access;
+ *(int*)(inData + 8) = (int)&objectAttributes;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenNamedObject), inData, 0xc, null, 0);
+
+ return handle;
+ }
+
+ public int KphOpenProcess(int pid, ProcessAccess desiredAccess)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = pid;
+ *(uint*)(inData + 4) = (uint)desiredAccess;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenProcess), inData, 8, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphOpenProcessJob(ProcessHandle processHandle, JobObjectAccess desiredAccess)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = processHandle;
+ *(uint*)(inData + 4) = (uint)desiredAccess;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenProcessJob), inData, 8, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphOpenProcessToken(ProcessHandle processHandle, TokenAccess desiredAccess)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = processHandle;
+ *(uint*)(inData + 4) = (uint)desiredAccess;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenProcessToken), inData, 8, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphOpenThread(int tid, ThreadAccess desiredAccess)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = tid;
+ *(uint*)(inData + 4) = (uint)desiredAccess;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenThread), inData, 8, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphOpenThreadProcess(ThreadHandle threadHandle, ProcessAccess desiredAccess)
+ {
+ byte* inData = stackalloc byte[8];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = threadHandle;
+ *(uint*)(inData + 4) = (uint)desiredAccess;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenThreadProcess), inData, 8, outData, 4);
+
+ return *(int*)outData;
+ }
+
+ public int KphOpenType(ObjectAttributes objectAttributes)
+ {
+ byte* inData = stackalloc byte[8];
+ int typeHandle;
+
+ *(int*)inData = (int)&typeHandle;
+ *(int*)(inData + 4) = (int)&objectAttributes;
+
+ _fileHandle.IoControl(CtlCode(Control.KphOpenType), inData, 8, null, 0);
+
+ return typeHandle;
+ }
+
+ public void KphQueryInformationDriver(
+ DriverHandle driverHandle,
+ DriverInformationClass driverInformationClass,
+ IntPtr driverInformation,
+ int driverInformationLength,
+ out int returnLength
+ )
+ {
+ byte* inData = stackalloc byte[0x14];
+ int returnLengthLocal;
+
+ *(int*)inData = driverHandle;
+ *(int*)(inData + 0x4) = (int)driverInformationClass;
+ *(int*)(inData + 0x8) = driverInformation.ToInt32();
+ *(int*)(inData + 0xc) = driverInformationLength;
+ *(int*)(inData + 0x10) = (int)&returnLengthLocal;
try
{
- _fileHandle = new FileHandle(
- @"\Device\" + _deviceName,
- 0,
- FileAccess.GenericRead | FileAccess.GenericWrite
- );
+ _fileHandle.IoControl(CtlCode(Control.KphQueryInformationDriver), inData, 0x14, null, 0);
}
finally
{
- if (created)
- {
- // The SCM will delete the service when it is stopped.
- shandle.Delete();
- }
-
- shandle.Dispose();
+ returnLength = returnLengthLocal;
}
}
- public KphFeatures KphGetFeatures()
+ public void KphQueryInformationProcess(
+ ProcessHandle processHandle,
+ ProcessInformationClass processInformationClass,
+ IntPtr processInformation,
+ int processInformationLength,
+ out int returnLength
+ )
{
- KphGetFeaturesInput input;
- int features;
+ byte* inData = stackalloc byte[0x14];
+ int returnLengthLocal;
- input.Features = &features;
- _fileHandle.IoControl(IoCtlGetFeatures, &input, sizeof(KphGetFeaturesInput), null, 0);
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = (int)processInformationClass;
+ *(int*)(inData + 0x8) = processInformation.ToInt32();
+ *(int*)(inData + 0xc) = processInformationLength;
+ *(int*)(inData + 0x10) = (int)&returnLengthLocal;
- return (KphFeatures)features;
+ try
+ {
+ _fileHandle.IoControl(CtlCode(Control.KphQueryInformationProcess), inData, 0x14, null, 0);
+ }
+ finally
+ {
+ returnLength = returnLengthLocal;
+ }
}
- public IntPtr KphOpenProcess(int pid, ProcessAccess desiredAccess)
+ public void KphQueryInformationThread(
+ ThreadHandle threadHandle,
+ ThreadInformationClass threadInformationClass,
+ IntPtr threadInformation,
+ int threadInformationLength,
+ out int returnLength
+ )
{
- KphOpenProcessInput input;
- IntPtr processHandle;
- ClientId clientId;
+ byte* inData = stackalloc byte[0x14];
+ int returnLengthLocal;
- clientId.UniqueProcess = (IntPtr)pid;
- clientId.UniqueThread = IntPtr.Zero;
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 0x4) = (int)threadInformationClass;
+ *(int*)(inData + 0x8) = threadInformation.ToInt32();
+ *(int*)(inData + 0xc) = threadInformationLength;
+ *(int*)(inData + 0x10) = (int)&returnLengthLocal;
- input.ProcessHandle = &processHandle;
- input.DesiredAccess = (int)desiredAccess;
- input.ClientId = &clientId;
- _fileHandle.IoControl(IoCtlOpenProcess, &input, sizeof(KphOpenProcessInput), null, 0);
-
- return processHandle;
+ try
+ {
+ _fileHandle.IoControl(CtlCode(Control.KphQueryInformationThread), inData, 0x14, null, 0);
+ }
+ finally
+ {
+ returnLength = returnLengthLocal;
+ }
}
- public IntPtr KphOpenProcessToken(ProcessHandle processHandle, TokenAccess desiredAccess)
+ public void KphQueryProcessHandles(ProcessHandle processHandle, IntPtr buffer, int bufferLength, out int returnLength)
{
- KphOpenProcessTokenInput input;
- IntPtr tokenHandle;
+ byte* inData = stackalloc byte[0x10];
+ int returnLengthLocal;
- input.ProcessHandle = processHandle;
- input.DesiredAccess = (int)desiredAccess;
- input.TokenHandle = &tokenHandle;
- _fileHandle.IoControl(IoCtlOpenProcessToken, &input, sizeof(KphOpenProcessTokenInput), null, 0);
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = buffer.ToInt32();
+ *(int*)(inData + 0x8) = bufferLength;
+ *(int*)(inData + 0xc) = (int)&returnLengthLocal;
- return tokenHandle;
+ try
+ {
+ _fileHandle.IoControl(CtlCode(Control.KphQueryProcessHandles), inData, 0x10, null, 0);
+ }
+ finally
+ {
+ returnLength = returnLengthLocal;
+ }
}
- public IntPtr KphOpenProcessJob(ProcessHandle processHandle, TokenAccess desiredAccess)
+ public void KphReadVirtualMemory(ProcessHandle processHandle, int baseAddress, byte[] buffer, int length, out int bytesRead)
{
- KphOpenProcessJobInput input;
- IntPtr jobHandle;
+ fixed (byte* bufferPtr = buffer)
+ {
+ this.KphReadVirtualMemory(processHandle, baseAddress, new IntPtr(bufferPtr), length, out bytesRead);
+ }
+ }
- input.ProcessHandle = processHandle;
- input.DesiredAccess = (int)desiredAccess;
- input.JobHandle = &jobHandle;
- _fileHandle.IoControl(IoCtlOpenProcessJob, &input, sizeof(KphOpenProcessJobInput), null, 0);
+ public void KphReadVirtualMemory(ProcessHandle processHandle, int baseAddress, IntPtr buffer, int length, out int bytesRead)
+ {
+ NtStatus status;
- return jobHandle;
+ status = KphReadVirtualMemorySafe(processHandle, baseAddress, buffer, length, out bytesRead);
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+
+ public NtStatus KphReadVirtualMemorySafe(ProcessHandle processHandle, int baseAddress, IntPtr buffer, int length, out int bytesRead)
+ {
+ NtStatus status;
+ byte* inData = stackalloc byte[0x14];
+ int returnLength;
+ int br;
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = baseAddress;
+ *(int*)(inData + 0x8) = (int)buffer;
+ *(int*)(inData + 0xc) = length;
+ *(int*)(inData + 0x10) = (int)&br;
+
+ status = _fileHandle.IoControl(CtlCode(Control.KphReadVirtualMemory), (IntPtr)inData, 0x14, IntPtr.Zero, 0, out returnLength);
+
+ bytesRead = br;
+
+ return status;
+ }
+
+ public NtStatus KphReadVirtualMemoryUnsafe(ProcessHandle processHandle, int baseAddress, void* buffer, int length, out int bytesRead)
+ {
+ return KphReadVirtualMemoryUnsafe(processHandle, baseAddress, new IntPtr(buffer), length, out bytesRead);
+ }
+
+ public NtStatus KphReadVirtualMemoryUnsafe(ProcessHandle processHandle, int baseAddress, IntPtr buffer, int length, out int bytesRead)
+ {
+ NtStatus status;
+ byte* inData = stackalloc byte[0x14];
+ int returnLength;
+ int br;
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = baseAddress;
+ *(int*)(inData + 0x8) = (int)buffer;
+ *(int*)(inData + 0xc) = length;
+ *(int*)(inData + 0x10) = (int)&br;
+
+ status = _fileHandle.IoControl(CtlCode(Control.KphUnsafeReadVirtualMemory), (IntPtr)inData, 0x14, IntPtr.Zero, 0, out returnLength);
+
+ bytesRead = br;
+
+ return status;
+ }
+
+ public void KphResumeProcess(ProcessHandle processHandle)
+ {
+ int processHandleInt = processHandle;
+
+ _fileHandle.IoControl(CtlCode(Control.KphResumeProcess),
+ (byte*)&processHandleInt, 4, null, 0);
+ }
+
+ public void KphSetContextThread(ThreadHandle threadHandle, Context* context)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 4) = (int)context;
+
+ _fileHandle.IoControl(CtlCode(Control.KphSetContextThread), inData, 8, null, 0);
+ }
+
+ public void KphSetHandleGrantedAccess(IntPtr handle, int grantedAccess)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = handle.ToInt32();
+ *(int*)(inData + 4) = grantedAccess;
+
+ _fileHandle.IoControl(CtlCode(Control.KphSetHandleGrantedAccess), inData, 8, null, 0);
+ }
+
+ public void KphSetInformationProcess(
+ ProcessHandle processHandle,
+ ProcessInformationClass processInformationClass,
+ IntPtr processInformation,
+ int processInformationLength
+ )
+ {
+ byte* inData = stackalloc byte[0x10];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = (int)processInformationClass;
+ *(int*)(inData + 0x8) = processInformation.ToInt32();
+ *(int*)(inData + 0xc) = processInformationLength;
+
+ _fileHandle.IoControl(CtlCode(Control.KphSetInformationProcess), inData, 0x10, null, 0);
+ }
+
+ public void KphSetInformationThread(
+ ThreadHandle threadHandle,
+ ThreadInformationClass threadInformationClass,
+ IntPtr threadInformation,
+ int threadInformationLength
+ )
+ {
+ byte* inData = stackalloc byte[0x10];
+
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 0x4) = (int)threadInformationClass;
+ *(int*)(inData + 0x8) = threadInformation.ToInt32();
+ *(int*)(inData + 0xc) = threadInformationLength;
+
+ _fileHandle.IoControl(CtlCode(Control.KphSetInformationThread), inData, 0x10, null, 0);
}
public void KphSuspendProcess(ProcessHandle processHandle)
{
- KphSuspendProcessInput input;
+ int processHandleInt = processHandle;
- input.ProcessHandle = processHandle;
- _fileHandle.IoControl(IoCtlSuspendProcess, &input, sizeof(KphSuspendProcessInput), null, 0);
- }
-
-
- public void KphResumeProcess(ProcessHandle processHandle)
- {
- KphResumeProcessInput input;
-
- input.ProcessHandle = processHandle;
- _fileHandle.IoControl(IoCtlResumeProcess, &input, sizeof(KphResumeProcessInput), null, 0);
+ _fileHandle.IoControl(CtlCode(Control.KphSuspendProcess),
+ (byte*)&processHandleInt, 4, null, 0);
}
public void KphTerminateProcess(ProcessHandle processHandle, NtStatus exitStatus)
{
- KphTerminateProcessInput input;
+ byte* inData = stackalloc byte[8];
- input.ProcessHandle = processHandle;
- input.ExitStatus = exitStatus;
- _fileHandle.IoControl(IoCtlTerminateProcess, &input, sizeof(KphTerminateProcessInput), null, 0);
- }
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = (int)exitStatus;
-
-
- public void KphReadVirtualMemory(ProcessHandle processHandle, IntPtr baseAddress, IntPtr buffer, IntPtr bufferSize, void* numberOfBytesRead)
- {
- KphReadVirtualMemoryInput input;
-
- input.ProcessHandle = processHandle;
- input.BaseAddress = baseAddress;
- input.Buffer = buffer;
- input.BufferSize = bufferSize;
- input.NumberOfBytesRead = (IntPtr*)(&numberOfBytesRead);
- _fileHandle.IoControl(IoCtlReadVirtualMemory, &input, sizeof(KphReadVirtualMemoryInput), null, 0);
- }
-
- public void KphWriteVirtualMemory(ProcessHandle processHandle, IntPtr baseAddress, IntPtr buffer, IntPtr bufferSize, void* numberOfBytesWritten)
- {
- KphWriteVirtualMemoryInput input;
-
- input.ProcessHandle = processHandle;
- input.BaseAddress = baseAddress;
- input.Buffer = buffer;
- input.BufferSize = bufferSize;
- input.NumberOfBytesWritten = (IntPtr*)(&numberOfBytesWritten);
- _fileHandle.IoControl(IoCtlWriteVirtualMemory, &input, sizeof(KphWriteVirtualMemoryInput), null, 0);
- }
-
-
- public void KphReadVirtualMemoryUnsafe(ProcessHandle processHandle, IntPtr baseAddress, IntPtr buffer, IntPtr bufferSize, void* numberOfBytesRead)
- {
- KphReadVirtualMemoryUnsafeInput input;
-
- input.ProcessHandle = processHandle;
- input.BaseAddress = baseAddress;
- input.Buffer = buffer;
- input.BufferSize = bufferSize;
-
- input.NumberOfBytesRead = (IntPtr*)(&numberOfBytesRead);
-
- _fileHandle.IoControl(IoCtlReadVirtualMemoryUnsafe, &input, sizeof(KphReadVirtualMemoryUnsafeInput), null, 0);
- }
-
-
- public void KphQueryInformationProcess(ProcessHandle processHandle, KphProcessInformationClass processInformationClass, IntPtr processInformation, int processInformationLength, out int returnLength)
- {
- KphQueryInformationProcessInput input;
-
- input.ProcessHandle = processHandle;
- input.ProcessInformationClass = processInformationClass;
- input.ProcessInformation = processInformation;
- input.ProcessInformationLength = processInformationLength;
-
- returnLength = 0;
- input.ReturnLength = returnLength;
-
- _fileHandle.IoControl(IoCtlQueryInformationProcess, &input, sizeof(KphQueryInformationProcessInput), null, 0);
- }
-
- public void Dispose()
- {
- if (_fileHandle != null)
+ try
{
- try
- {
- _fileHandle.SetHandleFlags(Win32HandleFlags.ProtectFromClose, 0);
- _fileHandle.Dispose();
- }
- catch (Exception)
- { }
+ _fileHandle.IoControl(CtlCode(Control.KphTerminateProcess), inData, 8, null, 0);
+ }
+ catch (WindowsException ex)
+ {
+ // STATUS_CANT_TERMINATE_SELF means we tried to terminate ourself. Kernel-mode can't do it,
+ // so we do it now.
+ if (ex.Status == NtStatus.CantTerminateSelf)
+ Win32.TerminateProcess(new IntPtr(-1), (int)exitStatus);
+ else
+ throw ex;
}
}
- }
- public enum KphSecurityLevel
- {
- KphSecurityNone = 0, // all clients are allowed
- KphSecurityPrivilegeCheck = 1, // require SeDebugPrivilege
- KphMaxSecurityLevel
- }
+ public void KphTerminateThread(ThreadHandle threadHandle, NtStatus exitStatus)
+ {
+ byte* inData = stackalloc byte[8];
- public enum KphProcessInformationClass
- {
- KphProcessProtectionInformation = 1,
- KphProcessExecuteFlags = 2,
- KphProcessIoPriority = 3,
- MaxKphProcessInfoClass
- }
+ *(int*)inData = threadHandle;
+ *(int*)(inData + 4) = (int)exitStatus;
- [StructLayout(LayoutKind.Sequential)]
- public struct KphProcessProtectionInformation
- {
- public byte IsProtectedProcess;
- }
+ try
+ {
+ _fileHandle.IoControl(CtlCode(Control.KphTerminateThread), inData, 8, null, 0);
+ }
+ catch (WindowsException ex)
+ {
+ if (ex.Status == NtStatus.CantTerminateSelf)
+ Win32.TerminateThread(new IntPtr(-2), (int)exitStatus);
+ else
+ throw ex;
+ }
+ }
- public enum KphThreadInformationClass
- {
- KphThreadWin32Thread = 1,
- KphThreadImpersonationToken = 2,
- KphThreadIoPriority = 3,
- MaxKphThreadInfoClass
- }
+ public void KphWriteVirtualMemory(ProcessHandle processHandle, int baseAddress, byte[] buffer, int length, out int bytesWritten)
+ {
+ fixed (byte* bufferPtr = buffer)
+ this.KphWriteVirtualMemory(processHandle, baseAddress, new IntPtr(bufferPtr), length, out bytesWritten);
+ }
- [StructLayout(LayoutKind.Sequential)]
- public struct KphProcessHandle
- {
- public IntPtr Handle;
- public IntPtr Object;
- public int GrantedAccess;
- public short ObjectTypeIndex;
- public short Reserved1;
- public int HandleAttributes;
- private int Reserved2;
- }
+ public void KphWriteVirtualMemory(ProcessHandle processHandle, int baseAddress, IntPtr buffer, int length, out int bytesWritten)
+ {
+ byte* inData = stackalloc byte[0x14];
+ int returnLength;
- [StructLayout(LayoutKind.Sequential)]
- public struct KphProcessHandleInformation
- {
- public static readonly int HandlesOffset =
- Marshal.OffsetOf(typeof(KphProcessHandleInformation), "Handles").ToInt32();
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = baseAddress;
+ *(int*)(inData + 0x8) = (int)buffer;
+ *(int*)(inData + 0xc) = length;
+ *(int*)(inData + 0x10) = (int)&returnLength;
- public int HandleCount;
- public KphProcessHandle Handles;
- }
+ try
+ {
+ _fileHandle.IoControl(CtlCode(Control.KphWriteVirtualMemory), inData, 0x14, null, 0);
+ }
+ finally
+ {
+ bytesWritten = returnLength;
+ }
+ }
- public enum KphObjectInformationClass
- {
- KphObjectBasicInformation,
- KphObjectNameInformation,
- KphObjectTypeInformation,
- KphObjectHandleFlagInformation,
- KphObjectProcessBasicInformation,
- KphObjectThreadBasicInformation,
- KphObjectEtwRegBasicInformation,
- MaxKphObjectInfoClass
+ public void ProtectAdd(ProcessHandle processHandle, bool allowKernelMode, ProcessAccess ProcessAllowMask, ThreadAccess ThreadAllowMask)
+ {
+ byte* inData = stackalloc byte[16];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = allowKernelMode ? 1 : 0;
+ *(int*)(inData + 0x8) = (int)ProcessAllowMask;
+ *(int*)(inData + 0xc) = (int)ThreadAllowMask;
+
+ _fileHandle.IoControl(CtlCode(Control.ProtectAdd), inData, 16, null, 0);
+ }
+
+ public void ProtectQuery(ProcessHandle processHandle, out bool AllowKernelMode, out ProcessAccess ProcessAllowMask, out ThreadAccess ThreadAllowMask)
+ {
+ byte* inData = stackalloc byte[16];
+ int allowKernelMode;
+ ProcessAccess processAllowMask;
+ ThreadAccess threadAllowMask;
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = (int)&allowKernelMode;
+ *(int*)(inData + 0x8) = (int)&processAllowMask;
+ *(int*)(inData + 0xc) = (int)&threadAllowMask;
+
+ _fileHandle.IoControl(CtlCode(Control.ProtectQuery), inData, 16, null, 0);
+
+ AllowKernelMode = allowKernelMode != 0;
+ ProcessAllowMask = processAllowMask;
+ ThreadAllowMask = threadAllowMask;
+ }
+
+ public void ProtectRemove(ProcessHandle processHandle)
+ {
+ int processHandleInt = processHandle;
+
+ _fileHandle.IoControl(CtlCode(Control.ProtectRemove),
+ (byte*)&processHandleInt, 4, null, 0);
+ }
+
+ public void SetExecuteOptions(ProcessHandle processHandle, MemExecuteOptions executeOptions)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = (int)executeOptions;
+
+ _fileHandle.IoControl(CtlCode(Control.SetExecuteOptions), inData, 8, null, 0);
+ }
+
+ public void SetHandleAttributes(ProcessHandle processHandle, IntPtr handle, HandleFlags flags)
+ {
+ byte* inData = stackalloc byte[12];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = handle.ToInt32();
+ *(int*)(inData + 8) = (int)flags;
+
+ _fileHandle.IoControl(CtlCode(Control.SetHandleAttributes), inData, 12, null, 0);
+ }
+
+ public void SetProcessProtected(int pid, bool protecte)
+ {
+ byte* inData = stackalloc byte[5];
+
+ *(int*)inData = pid;
+ inData[4] = (byte)(protecte ? 1 : 0);
+
+ _fileHandle.IoControl(CtlCode(Control.SetProcessProtected), inData, 5, null, 0);
+ }
+
+ public void SetProcessToken(int sourcePid, int targetPid)
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = sourcePid;
+ *(int*)(inData + 4) = targetPid;
+
+ _fileHandle.IoControl(CtlCode(Control.SetProcessToken), inData, 8, null, 0);
+ }
+
+ public IntPtr SsAddProcessIdRule(
+ KphSsRuleSetEntryHandle ruleSetEntryHandle,
+ KphSsFilterType filterType,
+ IntPtr processId
+ )
+ {
+ byte* inData = stackalloc byte[0xc];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = ruleSetEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 0x4) = (int)filterType;
+ *(int*)(inData + 0x8) = processId.ToInt32();
+
+ _fileHandle.IoControl(CtlCode(Control.SsAddProcessIdRule), inData, 0xc, outData, 4);
+
+ return (*(int*)outData).ToIntPtr();
+ }
+
+ public IntPtr SsAddThreadIdRule(
+ KphSsRuleSetEntryHandle ruleSetEntryHandle,
+ KphSsFilterType filterType,
+ IntPtr threadId
+ )
+ {
+ byte* inData = stackalloc byte[0xc];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = ruleSetEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 0x4) = (int)filterType;
+ *(int*)(inData + 0x8) = threadId.ToInt32();
+
+ _fileHandle.IoControl(CtlCode(Control.SsAddThreadIdRule), inData, 0xc, outData, 4);
+
+ return (*(int*)outData).ToIntPtr();
+ }
+
+ public IntPtr SsAddPreviousModeRule(
+ KphSsRuleSetEntryHandle ruleSetEntryHandle,
+ KphSsFilterType filterType,
+ KProcessorMode previousMode
+ )
+ {
+ byte* inData = stackalloc byte[0x9];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = ruleSetEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 0x4) = (int)filterType;
+ *(byte*)(inData + 0x8) = (byte)previousMode;
+
+ _fileHandle.IoControl(CtlCode(Control.SsAddPreviousModeRule), inData, 0x9, outData, 4);
+
+ return (*(int*)outData).ToIntPtr();
+ }
+
+ public IntPtr SsAddNumberRule(
+ KphSsRuleSetEntryHandle ruleSetEntryHandle,
+ KphSsFilterType filterType,
+ int number
+ )
+ {
+ byte* inData = stackalloc byte[0xc];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = ruleSetEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 0x4) = (int)filterType;
+ *(int*)(inData + 0x8) = number;
+
+ _fileHandle.IoControl(CtlCode(Control.SsAddNumberRule), inData, 0xc, outData, 4);
+
+ return (*(int*)outData).ToIntPtr();
+ }
+
+ public KphSsClientEntryHandle SsCreateClientEntry(
+ ProcessHandle processHandle,
+ SemaphoreHandle readSemaphoreHandle,
+ SemaphoreHandle writeSemaphoreHandle,
+ IntPtr bufferBase,
+ int bufferSize
+ )
+ {
+ byte* inData = stackalloc byte[0x14];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 0x4) = readSemaphoreHandle;
+ *(int*)(inData + 0x8) = writeSemaphoreHandle;
+ *(int*)(inData + 0xc) = bufferBase.ToInt32();
+ *(int*)(inData + 0x10) = bufferSize;
+
+ _fileHandle.IoControl(CtlCode(Control.SsCreateClientEntry), inData, 0x14, outData, 4);
+
+ return new KphSsClientEntryHandle((*(int*)outData).ToIntPtr());
+ }
+
+ public KphSsRuleSetEntryHandle SsCreateRuleSetEntry(
+ KphSsClientEntryHandle clientEntryHandle,
+ KphSsFilterType defaultFilterType,
+ KphSsRuleSetAction action
+ )
+ {
+ byte* inData = stackalloc byte[0xc];
+ byte* outData = stackalloc byte[4];
+
+ *(int*)inData = clientEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 0x4) = (int)defaultFilterType;
+ *(int*)(inData + 0x8) = (int)action;
+
+ _fileHandle.IoControl(CtlCode(Control.SsCreateRuleSetEntry), inData, 0xc, outData, 4);
+
+ return new KphSsRuleSetEntryHandle((*(int*)outData).ToIntPtr());
+ }
+
+ public void SsEnableClientEntry(
+ KphSsClientEntryHandle clientEntryHandle,
+ bool enable
+ )
+ {
+ byte* inData = stackalloc byte[5];
+
+ *(int*)inData = clientEntryHandle.Handle.ToInt32();
+ *(byte*)(inData + 4) = (byte)(enable ? 1 : 0);
+
+ _fileHandle.IoControl(CtlCode(Control.SsEnableClientEntry), inData, 5, null, 0);
+ }
+
+ public void SsQueryClientEntry(
+ KphSsClientEntryHandle clientEntryHandle,
+ out KphSsClientInformation clientInformation,
+ int clientInformationLength,
+ out int returnLength
+ )
+ {
+ fixed (KphSsClientInformation *clientInfoPtr = &clientInformation)
+ fixed (int* retLengthPtr = &returnLength)
+ {
+ byte* inData = stackalloc byte[0x10];
+
+ *(int*)inData = clientEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 0x4) = (int)clientInfoPtr;
+ *(int*)(inData + 0x8) = clientInformationLength;
+ *(int*)(inData + 0xc) = (int)retLengthPtr;
+
+ _fileHandle.IoControl(CtlCode(Control.SsQueryClientEntry), inData, 0x10, null, 0);
+ }
+ }
+
+ public void SsRemoveRule(
+ KphSsRuleSetEntryHandle ruleSetEntryHandle,
+ IntPtr ruleEntryHandle
+ )
+ {
+ byte* inData = stackalloc byte[8];
+
+ *(int*)inData = ruleSetEntryHandle.Handle.ToInt32();
+ *(int*)(inData + 4) = ruleEntryHandle.ToInt32();
+
+ _fileHandle.IoControl(CtlCode(Control.SsRemoveRule), inData, 8, null, 0);
+ }
+
+ public void SsRef()
+ {
+ _fileHandle.IoControl(CtlCode(Control.SsRef), null, null);
+ }
+
+ public void SsUnref()
+ {
+ _fileHandle.IoControl(CtlCode(Control.SsUnref), null, null);
+ }
+
+ public NtStatus ZwQueryObject(
+ ProcessHandle processHandle,
+ IntPtr handle,
+ ObjectInformationClass objectInformationClass,
+ IntPtr buffer,
+ int bufferLength,
+ out int returnLength,
+ out int baseAddress
+ )
+ {
+ byte* inData = stackalloc byte[12];
+ byte[] outData = new byte[bufferLength + 12];
+
+ *(int*)inData = processHandle;
+ *(int*)(inData + 4) = handle.ToInt32();
+ *(int*)(inData + 8) = (int)objectInformationClass;
+
+ _fileHandle.IoControl(CtlCode(Control.ZwQueryObject), inData, 12, outData);
+
+ NtStatus status;
+
+ fixed (byte* outDataPtr = outData)
+ {
+ status = *(NtStatus*)outDataPtr;
+ returnLength = *(int*)(outDataPtr + 4);
+ baseAddress = *(int*)(outDataPtr + 8);
+ }
+
+ if (buffer != IntPtr.Zero)
+ Marshal.Copy(outData, 12, buffer, bufferLength);
+
+ return status;
+ }
}
public enum DriverInformationClass
{
- DriverBasicInformation,
+ DriverBasicInformation = 0,
DriverNameInformation,
- DriverServiceKeyNameInformation,
- MaxDriverInfoClass
+ DriverServiceKeyNameInformation
+ }
+
+ public class KphHandle : BaseObject
+ {
+ private IntPtr _handle;
+
+ protected KphHandle(IntPtr handle)
+ {
+ _handle = handle;
+ }
+
+ protected override void DisposeObject(bool disposing)
+ {
+ KProcessHacker.Instance.ClientCloseHandle(_handle);
+ }
+
+ public IntPtr Handle
+ {
+ get { return _handle; }
+ }
}
[StructLayout(LayoutKind.Sequential)]
@@ -431,355 +1210,20 @@ namespace System
public int DriverSize;
}
- //[StructLayout(LayoutKind.Sequential)]
- //public struct DriverBasicInformation
- //{
- // public UnicodeString DriverName;
- //}
-
[StructLayout(LayoutKind.Sequential)]
- public struct DriverServiceKeyNameInformation
+ public struct ProcessHandleInformation
{
- public UnicodeString ServiceKeyName;
+ public IntPtr Handle;
+ public IntPtr Object;
+ public int GrantedAccess;
+ public HandleFlags HandleAttributes; // should be an int
+ private byte Pad1;
+ private short Pad2;
+
+ private void Dummy()
+ {
+ Pad1 = 0;
+ Pad2 = 0;
+ }
}
-
- [StructLayout(LayoutKind.Sequential)]
- public struct EtwRegBasicInformation
- {
- public Guid Guid;
- public IntPtr SessionId;
- }
-
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphOpenProcessJobInput
- {
- public IntPtr ProcessHandle;
- public int DesiredAccess;
- public IntPtr* JobHandle;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphGetFeaturesInput
- {
- public int* Features;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphOpenProcessInput
- {
- public IntPtr* ProcessHandle;
- public int DesiredAccess;
- public ClientId* ClientId;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphOpenProcessTokenInput
- {
- public IntPtr ProcessHandle;
- public int DesiredAccess;
- public IntPtr* TokenHandle;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct KphSuspendProcessInput
- {
- public IntPtr ProcessHandle;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct KphResumeProcessInput
- {
- public IntPtr ProcessHandle;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct KphTerminateProcessInput
- {
- public IntPtr ProcessHandle;
- public NtStatus ExitStatus;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphReadVirtualMemoryInput
- {
- public IntPtr ProcessHandle;
- public IntPtr BaseAddress;
- public IntPtr Buffer;
- public IntPtr BufferSize;
- public IntPtr* NumberOfBytesRead;
- }
-
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphWriteVirtualMemoryInput
- {
- public IntPtr ProcessHandle;
- public IntPtr BaseAddress;
- public IntPtr Buffer;
- public IntPtr BufferSize;
- public IntPtr* NumberOfBytesWritten;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct KphReadVirtualMemoryUnsafeInput
- {
- public IntPtr ProcessHandle;
- public IntPtr BaseAddress;
- public IntPtr Buffer;
- public IntPtr BufferSize;
- public IntPtr* NumberOfBytesRead;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct KphQueryInformationProcessInput
- {
- public IntPtr ProcessHandle;
- public KphProcessInformationClass ProcessInformationClass;
- public IntPtr ProcessInformation;
- public int ProcessInformationLength;
- public int ReturnLength;
- }
-
}
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphOpenProcessToken(
-// __in HANDLE ProcessHandle,
-// __in ACCESS_MASK DesiredAccess,
-// __out PHANDLE TokenHandle
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphOpenProcessJob(
-// __in HANDLE ProcessHandle,
-// __in ACCESS_MASK DesiredAccess,
-// __out PHANDLE JobHandle
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphSuspendProcess(
-// __in HANDLE ProcessHandle
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphResumeProcess(
-// __in HANDLE ProcessHandle
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphTerminateProcess(
-// __in HANDLE ProcessHandle,
-// __in NTSTATUS ExitStatus
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphReadVirtualMemory(
-// __in HANDLE ProcessHandle,
-// __in PVOID BaseAddress,
-// __out_bcount(BufferSize) PVOID Buffer,
-// __in SIZE_T BufferSize,
-// __out_opt PSIZE_T NumberOfBytesRead
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphWriteVirtualMemory(
-// __in HANDLE ProcessHandle,
-// __in_opt PVOID BaseAddress,
-// __in_bcount(BufferSize) PVOID Buffer,
-// __in SIZE_T BufferSize,
-// __out_opt PSIZE_T NumberOfBytesWritten
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphReadVirtualMemoryUnsafe(
-// __in_opt HANDLE ProcessHandle,
-// __in PVOID BaseAddress,
-// __out_bcount(BufferSize) PVOID Buffer,
-// __in SIZE_T BufferSize,
-// __out_opt PSIZE_T NumberOfBytesRead
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphQueryInformationProcess(
-// __in HANDLE ProcessHandle,
-// __in KPH_PROCESS_INFORMATION_CLASS ProcessInformationClass,
-// __out_bcount(ProcessInformationLength) PVOID ProcessInformation,
-// __in ULONG ProcessInformationLength,
-// __out_opt PULONG ReturnLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphSetInformationProcess(
-// __in HANDLE ProcessHandle,
-// __in KPH_PROCESS_INFORMATION_CLASS ProcessInformationClass,
-// __in_bcount(ProcessInformationLength) PVOID ProcessInformation,
-// __in ULONG ProcessInformationLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphOpenThread(
-// __out PHANDLE ThreadHandle,
-// __in ACCESS_MASK DesiredAccess,
-// __in PCLIENT_ID ClientId
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphOpenThreadProcess(
-// __in HANDLE ThreadHandle,
-// __in ACCESS_MASK DesiredAccess,
-// __out PHANDLE ProcessHandle
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphTerminateThread(
-// __in HANDLE ThreadHandle,
-// __in NTSTATUS ExitStatus
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphTerminateThreadUnsafe(
-// __in HANDLE ThreadHandle,
-// __in NTSTATUS ExitStatus
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphGetContextThread(
-// __in HANDLE ThreadHandle,
-// __inout PCONTEXT ThreadContext
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphSetContextThread(
-// __in HANDLE ThreadHandle,
-// __in PCONTEXT ThreadContext
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphCaptureStackBackTraceThread(
-// __in HANDLE ThreadHandle,
-// __in ULONG FramesToSkip,
-// __in ULONG FramesToCapture,
-// __out_ecount(FramesToCapture) PVOID *BackTrace,
-// __out_opt PULONG CapturedFrames,
-// __out_opt PULONG BackTraceHash
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphQueryInformationThread(
-// __in HANDLE ThreadHandle,
-// __in KPH_THREAD_INFORMATION_CLASS ThreadInformationClass,
-// __out_bcount(ProcessInformationLength) PVOID ThreadInformation,
-// __in ULONG ThreadInformationLength,
-// __out_opt PULONG ReturnLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphSetInformationThread(
-// __in HANDLE ThreadHandle,
-// __in KPH_THREAD_INFORMATION_CLASS ThreadInformationClass,
-// __in_bcount(ThreadInformationLength) PVOID ThreadInformation,
-// __in ULONG ThreadInformationLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphEnumerateProcessHandles(
-// __in HANDLE ProcessHandle,
-// __out_bcount(BufferLength) PVOID Buffer,
-// __in_opt ULONG BufferLength,
-// __out_opt PULONG ReturnLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphQueryInformationObject(
-// __in HANDLE ProcessHandle,
-// __in HANDLE Handle,
-// __in KPH_OBJECT_INFORMATION_CLASS ObjectInformationClass,
-// __out_bcount(ObjectInformationLength) PVOID ObjectInformation,
-// __in ULONG ObjectInformationLength,
-// __out_opt PULONG ReturnLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphSetInformationObject(
-// __in HANDLE ProcessHandle,
-// __in HANDLE Handle,
-// __in KPH_OBJECT_INFORMATION_CLASS ObjectInformationClass,
-// __in_bcount(ObjectInformationLength) PVOID ObjectInformation,
-// __in ULONG ObjectInformationLength
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphDuplicateObject(
-// __in HANDLE SourceProcessHandle,
-// __in HANDLE SourceHandle,
-// __in_opt HANDLE TargetProcessHandle,
-// __out_opt PHANDLE TargetHandle,
-// __in ACCESS_MASK DesiredAccess,
-// __in ULONG HandleAttributes,
-// __in ULONG Options
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphOpenDriver(
-// __out PHANDLE DriverHandle,
-// __in POBJECT_ATTRIBUTES ObjectAttributes
-// );
-
-//PHLIBAPI
-//NTSTATUS
-//NTAPI
-//KphQueryInformationDriver(
-// __in HANDLE DriverHandle,
-// __in DRIVER_INFORMATION_CLASS DriverInformationClass,
-// __out_bcount(DriverInformationLength) PVOID DriverInformation,
-// __in ULONG DriverInformationLength,
-// __out_opt PULONG ReturnLength
-// );
diff --git a/1.x/trunk/ProcessHacker.Native/Loader.cs b/1.x/trunk/ProcessHacker.Native/Loader.cs
index bbb8ba184..3d26f1dec 100644
--- a/1.x/trunk/ProcessHacker.Native/Loader.cs
+++ b/1.x/trunk/ProcessHacker.Native/Loader.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native
diff --git a/1.x/trunk/ProcessHacker.Native/Lpc/PortMessage.cs b/1.x/trunk/ProcessHacker.Native/Lpc/PortMessage.cs
index 68bcbf489..c824603cb 100644
--- a/1.x/trunk/ProcessHacker.Native/Lpc/PortMessage.cs
+++ b/1.x/trunk/ProcessHacker.Native/Lpc/PortMessage.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
@@ -6,6 +7,8 @@ namespace ProcessHacker.Native.Lpc
{
public class PortMessage : BaseObject
{
+ private static readonly int _portMessageSize = Marshal.SizeOf(typeof(PortMessageStruct));
+
public static MemoryAlloc AllocateBuffer()
{
return new MemoryAlloc(Win32.PortMessageMaxLength);
@@ -40,7 +43,7 @@ namespace ProcessHacker.Native.Lpc
internal PortMessage(MemoryRegion headerAndData)
{
_message = headerAndData.ReadStruct();
- _data = new MemoryRegion(headerAndData, PortMessageStruct.SizeOf, _message.DataLength);
+ _data = new MemoryRegion(headerAndData, _portMessageSize, _message.DataLength);
_referencedData = headerAndData;
_referencedData.Reference();
@@ -89,12 +92,11 @@ namespace ProcessHacker.Native.Lpc
if (dataLength < 0)
throw new ArgumentOutOfRangeException("Data length cannot be negative.");
- _message = new PortMessageStruct
- {
- DataLength = dataLength,
- TotalLength = (short)(PortMessageStruct.SizeOf + dataLength),
- DataInfoOffset = 0
- };
+ _message = new PortMessageStruct();
+
+ _message.DataLength = dataLength;
+ _message.TotalLength = (short)(_portMessageSize + dataLength);
+ _message.DataInfoOffset = 0;
if (existingMessage != null)
{
@@ -115,10 +117,10 @@ namespace ProcessHacker.Native.Lpc
public MemoryAlloc ToMemory()
{
- MemoryAlloc data = new MemoryAlloc(PortMessageStruct.SizeOf + _message.DataLength);
+ MemoryAlloc data = new MemoryAlloc(_portMessageSize + _message.DataLength);
- data.WriteStruct(_message);
- data.WriteMemory(PortMessageStruct.SizeOf, _data, _message.DataLength);
+ data.WriteStruct(_message);
+ data.WriteMemory(_portMessageSize, _data, _message.DataLength);
return data;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/AlignedMemoryAlloc.cs b/1.x/trunk/ProcessHacker.Native/Memory/AlignedMemoryAlloc.cs
index 2151bb091..101684cbc 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/AlignedMemoryAlloc.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/AlignedMemoryAlloc.cs
@@ -1,21 +1,23 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Common;
namespace ProcessHacker.Native
{
- public sealed class AlignedMemoryAlloc : MemoryAlloc
+ public class AlignedMemoryAlloc : MemoryAlloc
{
- private readonly IntPtr _realMemory;
+ private IntPtr _realMemory;
public AlignedMemoryAlloc(int size, int alignment)
{
// Make sure the alignment is positive and a power of two.
- if (alignment <= 0 || alignment.CountBits() != 1)
+ if (alignment <= 0 || Utils.CountBits(alignment) != 1)
throw new ArgumentOutOfRangeException("alignment");
// Since we are going to align our pointer, we need to account for
// any padding at the beginning.
- _realMemory = PrivateHeap.Allocate(size + alignment - 1);
+ _realMemory = MemoryAlloc.PrivateHeap.Allocate(0, size + alignment - 1);
// aligned memory = (memory + alignment - 1) & ~(alignment - 1)
this.Memory = _realMemory.Align(alignment);
@@ -24,7 +26,7 @@ namespace ProcessHacker.Native
protected override void Free()
{
- PrivateHeap.Free(_realMemory);
+ MemoryAlloc.PrivateHeap.Free(0, _realMemory);
}
public override void Resize(int newSize)
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/Heap.cs b/1.x/trunk/ProcessHacker.Native/Memory/Heap.cs
index 21ef5c251..7696c7215 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/Heap.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/Heap.cs
@@ -60,13 +60,11 @@ namespace ProcessHacker.Native
return heaps;
}
- private readonly IntPtr _heap;
- private readonly HeapFlags _flags;
+ private IntPtr _heap;
private Heap(IntPtr heap)
{
_heap = heap;
- _flags = 0;
}
public Heap(HeapFlags flags)
@@ -86,8 +84,6 @@ namespace ProcessHacker.Native
if (_heap == IntPtr.Zero)
throw new OutOfMemoryException();
-
- _flags = flags;
}
public IntPtr Address
@@ -95,9 +91,9 @@ namespace ProcessHacker.Native
get { return _heap; }
}
- public IntPtr Allocate(int size)
+ public IntPtr Allocate(HeapFlags flags, int size)
{
- IntPtr memory = Win32.RtlAllocateHeap(_heap, _flags, size.ToIntPtr());
+ IntPtr memory = Win32.RtlAllocateHeap(_heap, flags, size.ToIntPtr());
if (memory == IntPtr.Zero)
throw new OutOfMemoryException();
@@ -105,9 +101,9 @@ namespace ProcessHacker.Native
return memory;
}
- public int Compact()
+ public int Compact(HeapFlags flags)
{
- return Win32.RtlCompactHeap(_heap, _flags).ToInt32();
+ return Win32.RtlCompactHeap(_heap, flags).ToInt32();
}
public void Destroy()
@@ -115,19 +111,19 @@ namespace ProcessHacker.Native
Win32.RtlDestroyHeap(_heap);
}
- public void Free(IntPtr memory)
+ public void Free(HeapFlags flags, IntPtr memory)
{
- Win32.RtlFreeHeap(_heap, _flags, memory);
+ Win32.RtlFreeHeap(_heap, flags, memory);
}
- public int GetBlockSize(IntPtr memory)
+ public int GetBlockSize(HeapFlags flags, IntPtr memory)
{
- return Win32.RtlSizeHeap(_heap, _flags, memory).ToInt32();
+ return Win32.RtlSizeHeap(_heap, flags, memory).ToInt32();
}
- public IntPtr Reallocate(IntPtr memory, int size)
+ public IntPtr Reallocate(HeapFlags flags, IntPtr memory, int size)
{
- IntPtr newMemory = Win32.RtlReAllocateHeap(_heap, _flags, memory, size.ToIntPtr());
+ IntPtr newMemory = Win32.RtlReAllocateHeap(_heap, flags, memory, size.ToIntPtr());
if (newMemory == IntPtr.Zero)
throw new OutOfMemoryException();
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/LsaMemoryAlloc.cs b/1.x/trunk/ProcessHacker.Native/Memory/LsaMemoryAlloc.cs
index ce3a3fcd2..b9503fab7 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/LsaMemoryAlloc.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/LsaMemoryAlloc.cs
@@ -31,7 +31,7 @@ namespace ProcessHacker.Native
///
public sealed class LsaMemoryAlloc : MemoryAlloc
{
- private readonly bool _secur32;
+ private bool _secur32;
public LsaMemoryAlloc(IntPtr memory)
: this(memory, false)
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/MemoryAlloc.cs b/1.x/trunk/ProcessHacker.Native/Memory/MemoryAlloc.cs
index 05caa373f..0bd646fec 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/MemoryAlloc.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/MemoryAlloc.cs
@@ -20,11 +20,13 @@
* along with Process Hacker. If not, see .
*/
-#if DEBUG
#define ENABLE_STATISTICS
-#endif
using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Text;
+using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native
@@ -34,13 +36,13 @@ namespace ProcessHacker.Native
///
public class MemoryAlloc : MemoryRegion
{
- private static int _allocatedCount;
- private static int _freedCount;
- private static int _reallocatedCount;
+ private static int _allocatedCount = 0;
+ private static int _freedCount = 0;
+ private static int _reallocatedCount = 0;
// A private heap just for the client.
private static Heap _privateHeap = new Heap(HeapFlags.Class1 | HeapFlags.Growable);
- //private static Heap _processHeap = Heap.GetDefault();
+ private static Heap _processHeap = Heap.GetDefault();
public static int AllocatedCount
{
@@ -67,6 +69,7 @@ namespace ProcessHacker.Native
/// You must set the pointer using the Memory property.
///
protected MemoryAlloc()
+ : base()
{ }
public MemoryAlloc(IntPtr memory)
@@ -96,25 +99,21 @@ namespace ProcessHacker.Native
/// Any flags to use.
public MemoryAlloc(int size, HeapFlags flags)
{
- this.Memory = _privateHeap.Allocate(size);
+ this.Memory = _privateHeap.Allocate(flags, size);
this.Size = size;
#if ENABLE_STATISTICS
System.Threading.Interlocked.Increment(ref _allocatedCount);
#endif
- if (this.Size > 0)
- GC.AddMemoryPressure(this.Size);
}
protected override void Free()
{
- _privateHeap.Free(this);
+ _privateHeap.Free(0, this);
#if ENABLE_STATISTICS
System.Threading.Interlocked.Increment(ref _freedCount);
#endif
- if (this.Size > 0)
- GC.RemoveMemoryPressure(this.Size);
}
///
@@ -123,17 +122,12 @@ namespace ProcessHacker.Native
/// The new size of the allocation.
public virtual void Resize(int newSize)
{
- if (newSize > 0)
- GC.RemoveMemoryPressure(this.Size);
-
- this.Memory = _privateHeap.Reallocate(this.Memory, newSize);
+ this.Memory = _privateHeap.Reallocate(0, this.Memory, newSize);
this.Size = newSize;
#if ENABLE_STATISTICS
System.Threading.Interlocked.Increment(ref _reallocatedCount);
#endif
- if (this.Size > 0)
- GC.AddMemoryPressure(this.Size);
}
///
@@ -143,16 +137,9 @@ namespace ProcessHacker.Native
/// The new size of the allocation.
public virtual void ResizeNew(int newSize)
{
- if (newSize > 0)
- GC.RemoveMemoryPressure(this.Size);
-
- _privateHeap.Free(this.Memory);
-
- this.Memory = _privateHeap.Allocate(newSize);
+ _privateHeap.Free(0, this.Memory);
+ this.Memory = _privateHeap.Allocate(0, newSize);
this.Size = newSize;
-
- if (this.Size > 0)
- GC.AddMemoryPressure(this.Size);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegion.cs b/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegion.cs
index c04ca3efc..cd1d7b596 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegion.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegion.cs
@@ -20,15 +20,68 @@
* along with Process Hacker. If not, see .
*/
+#define SIZE_CACHE_USE_RESOURCE_LOCK
+
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Text;
using ProcessHacker.Common.Objects;
-using ProcessHacker.Native.Api;
+using ProcessHacker.Common.Threading;
namespace ProcessHacker.Native
{
public class MemoryRegion : BaseObject
{
+ private static Dictionary _sizeCache = new Dictionary();
+#if SIZE_CACHE_USE_RESOURCE_LOCK
+ private static FastResourceLock _sizeCacheLock = new FastResourceLock();
+#endif
+
+ private static int GetStructSize(Type structType)
+ {
+ int size;
+
+#if SIZE_CACHE_USE_RESOURCE_LOCK
+ _sizeCacheLock.AcquireShared();
+
+ if (_sizeCache.ContainsKey(structType))
+ {
+ size = _sizeCache[structType];
+ _sizeCacheLock.ReleaseShared();
+ }
+ else
+ {
+ _sizeCacheLock.ReleaseShared();
+
+ size = Marshal.SizeOf(structType);
+ _sizeCacheLock.AcquireExclusive();
+
+ try
+ {
+ if (!_sizeCache.ContainsKey(structType))
+ _sizeCache.Add(structType, size);
+ }
+ finally
+ {
+ _sizeCacheLock.ReleaseExclusive();
+ }
+ }
+
+ return size;
+#else
+ lock (_sizeCache)
+ {
+ if (_sizeCache.ContainsKey(structType))
+ size = _sizeCache[structType];
+ else
+ _sizeCache.Add(structType, size = Marshal.SizeOf(structType));
+
+ return size;
+ }
+#endif
+ }
+
public static T ReadStruct(IntPtr ptr)
{
return (T)Marshal.PtrToStructure(ptr, typeof(T));
@@ -44,7 +97,7 @@ namespace ProcessHacker.Native
return memory.Memory.ToPointer();
}
- private readonly MemoryRegion _parent;
+ private MemoryRegion _parent;
private IntPtr _memory;
private int _size;
@@ -121,15 +174,15 @@ namespace ProcessHacker.Native
public void DestroyStruct()
{
- Marshal.DestroyStructure(_memory, typeof(T));
+ this.DestroyStruct(0);
}
- public void DestroyStruct(int index, int size)
+ public void DestroyStruct(int index)
{
- this.DestroyStruct(0, index, size);
+ this.DestroyStruct(0, index);
}
- public void DestroyStruct(int offset, int index, int size)
+ public void DestroyStruct(int offset, int index)
{
if (index == 0)
{
@@ -138,7 +191,7 @@ namespace ProcessHacker.Native
else
{
Marshal.DestroyStructure(
- _memory.Increment(offset + size * index),
+ _memory.Increment(offset + GetStructSize(typeof(T)) * index),
typeof(T)
);
}
@@ -146,7 +199,7 @@ namespace ProcessHacker.Native
public void Fill(int offset, int length, byte value)
{
- Win32.RtlFillMemory(
+ ProcessHacker.Native.Api.Win32.RtlFillMemory(
_memory.Increment(offset),
length.ToIntPtr(),
value
@@ -213,9 +266,12 @@ namespace ProcessHacker.Native
/// The offset at which to begin reading.
/// The index at which to begin reading, after the offset is added.
/// The integer.
- public unsafe int ReadInt32(int offset, int index)
+ public int ReadInt32(int offset, int index)
{
- return ((int*)((byte*)this._memory + offset))[index];
+ unsafe
+ {
+ return ((int*)((byte*)_memory + offset))[index];
+ }
}
public int[] ReadInt32Array(int offset, int count)
@@ -232,14 +288,17 @@ namespace ProcessHacker.Native
return this.ReadIntPtr(offset, 0);
}
- public unsafe IntPtr ReadIntPtr(int offset, int index)
+ public IntPtr ReadIntPtr(int offset, int index)
{
- return ((IntPtr*)((byte*)this._memory + offset))[index];
+ unsafe
+ {
+ return ((IntPtr*)((byte*)_memory + offset))[index];
+ }
}
public void ReadMemory(IntPtr buffer, int destOffset, int srcOffset, int length)
{
- Win32.RtlMoveMemory(
+ ProcessHacker.Native.Api.Win32.RtlMoveMemory(
buffer.Increment(destOffset),
_memory.Increment(srcOffset),
length.ToIntPtr()
@@ -262,14 +321,36 @@ namespace ProcessHacker.Native
/// The offset at which to begin reading.
/// The index at which to begin reading, after the offset is added.
/// The integer.
- public unsafe uint ReadUInt32(int offset, int index)
+ public uint ReadUInt32(int offset, int index)
{
- return ((uint*)((byte*)this._memory + offset))[index];
+ unsafe
+ {
+ return ((uint*)((byte*)_memory + offset))[index];
+ }
}
- public T ReadStruct() where T : struct
+ ///
+ /// Creates a struct from the memory allocation.
+ ///
+ /// The type of the struct.
+ /// The new struct.
+ public T ReadStruct()
+ where T : struct
{
- return (T)Marshal.PtrToStructure(_memory, typeof(T));
+ return this.ReadStruct(0);
+ }
+
+ ///
+ /// Creates a struct from the memory allocation.
+ ///
+ /// The type of the struct.
+ /// The index at which to begin reading to the struct. This is multiplied by
+ /// the size of the struct.
+ /// The new struct.
+ public T ReadStruct(int index)
+ where T : struct
+ {
+ return this.ReadStruct(0, index);
}
///
@@ -277,18 +358,23 @@ namespace ProcessHacker.Native
///
/// The type of the struct.
/// The offset to add before reading.
- ///
/// The index at which to begin reading to the struct. This is multiplied by
/// the size of the struct.
/// The new struct.
- public T ReadStruct(int offset, int size, int index) where T : struct
+ public T ReadStruct(int offset, int index)
+ where T : struct
{
if (index == 0)
{
return (T)Marshal.PtrToStructure(_memory.Increment(offset), typeof(T));
}
-
- return (T)Marshal.PtrToStructure(this._memory.Increment(offset + size * index), typeof(T));
+ else
+ {
+ return (T)Marshal.PtrToStructure(
+ _memory.Increment(offset + GetStructSize(typeof(T)) * index),
+ typeof(T)
+ );
+ }
}
public string ReadUnicodeString(int offset)
@@ -306,9 +392,12 @@ namespace ProcessHacker.Native
///
/// The offset at which to write.
/// The value of the byte.
- public unsafe void WriteByte(int offset, byte b)
+ public void WriteByte(int offset, byte b)
{
- *((byte*)this._memory + offset) = b;
+ unsafe
+ {
+ *((byte*)_memory + offset) = b;
+ }
}
public void WriteBytes(int offset, byte[] b)
@@ -316,41 +405,53 @@ namespace ProcessHacker.Native
Marshal.Copy(b, 0, _memory.Increment(offset), b.Length);
}
- public unsafe void WriteInt16(int offset, short i)
+ public void WriteInt16(int offset, short i)
{
- *(short*)((byte*)this._memory + offset) = i;
+ unsafe
+ {
+ *(short*)((byte*)_memory + offset) = i;
+ }
}
- public unsafe void WriteInt32(int offset, int i)
+ public void WriteInt32(int offset, int i)
{
- *(int*)((byte*)this._memory + offset) = i;
+ unsafe
+ {
+ *(int*)((byte*)_memory + offset) = i;
+ }
}
- public unsafe void WriteIntPtr(int offset, IntPtr i)
+ public void WriteIntPtr(int offset, IntPtr i)
{
- *(IntPtr*)((byte*)this._memory + offset) = i;
+ unsafe
+ {
+ *(IntPtr*)((byte*)_memory + offset) = i;
+ }
}
public void WriteMemory(int offset, IntPtr buffer, int length)
{
- Win32.RtlMoveMemory(
+ ProcessHacker.Native.Api.Win32.RtlMoveMemory(
_memory.Increment(offset),
buffer,
length.ToIntPtr()
);
}
- public void WriteStruct(T s) where T : struct
+ public void WriteStruct(T s)
+ where T : struct
{
- Marshal.StructureToPtr(s, _memory, false);
+ this.WriteStruct(0, s);
}
- public void WriteStruct(int index, int size, T s) where T : struct
+ public void WriteStruct(int index, T s)
+ where T : struct
{
- this.WriteStruct(0, size, index, s);
+ this.WriteStruct(0, index, s);
}
- public void WriteStruct(int offset, int size, int index, T s) where T : struct
+ public void WriteStruct(int offset, int index, T s)
+ where T : struct
{
if (index == 0)
{
@@ -360,7 +461,7 @@ namespace ProcessHacker.Native
{
Marshal.StructureToPtr(
s,
- _memory.Increment(offset + size * index),
+ _memory.Increment(offset + GetStructSize(typeof(T)) * index),
false
);
}
@@ -371,17 +472,20 @@ namespace ProcessHacker.Native
///
/// The offset to add.
/// The string to write.
- public unsafe void WriteUnicodeString(int offset, string s)
+ public void WriteUnicodeString(int offset, string s)
{
- fixed (char* ptr = s)
+ unsafe
{
- this.WriteMemory(offset, (IntPtr)ptr, s.Length * 2);
+ fixed (char* ptr = s)
+ {
+ this.WriteMemory(offset, (IntPtr)ptr, s.Length * 2);
+ }
}
}
public void Zero(int offset, int length)
{
- Win32.RtlZeroMemory(
+ ProcessHacker.Native.Api.Win32.RtlZeroMemory(
_memory.Increment(offset),
length.ToIntPtr()
);
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegionStream.cs b/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegionStream.cs
index e4674ecbc..103fc20fe 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegionStream.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/MemoryRegionStream.cs
@@ -28,8 +28,8 @@ namespace ProcessHacker.Native
{
public class MemoryRegionStream : Stream
{
- private readonly MemoryRegion _memory;
- private long _position;
+ private MemoryRegion _memory;
+ private long _position = 0;
public MemoryRegionStream(MemoryRegion memory)
{
@@ -86,18 +86,12 @@ namespace ProcessHacker.Native
public override long Seek(long offset, SeekOrigin origin)
{
- switch (origin)
- {
- case SeekOrigin.Begin:
- this._position = offset;
- break;
- case SeekOrigin.Current:
- this._position += offset;
- break;
- case SeekOrigin.End:
- this._position = this._memory.Size + offset;
- break;
- }
+ if (origin == SeekOrigin.Begin)
+ _position = offset;
+ else if (origin == SeekOrigin.Current)
+ _position += offset;
+ else if (origin == SeekOrigin.End)
+ _position = _memory.Size + offset;
return _position;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/PebMemoryAlloc.cs b/1.x/trunk/ProcessHacker.Native/Memory/PebMemoryAlloc.cs
index aeb6f5439..73d2eb040 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/PebMemoryAlloc.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/PebMemoryAlloc.cs
@@ -33,9 +33,11 @@ namespace ProcessHacker.Native
{
public PebMemoryAlloc(int size)
{
+ NtStatus status;
IntPtr block;
- Win32.RtlAllocateFromPeb(size, out block).ThrowIf();
+ if ((status = Win32.RtlAllocateFromPeb(size, out block)) >= NtStatus.Error)
+ Win32.Throw(status);
this.Memory = block;
this.Size = size;
@@ -43,7 +45,10 @@ namespace ProcessHacker.Native
protected override void Free()
{
- Win32.RtlFreeToPeb(this, this.Size).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlFreeToPeb(this, this.Size)) >= NtStatus.Error)
+ Win32.Throw(status);
}
[EditorBrowsable(EditorBrowsableState.Never)]
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPages.cs b/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPages.cs
index 5090620f1..1da7fbca6 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPages.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPages.cs
@@ -10,9 +10,9 @@ namespace ProcessHacker.Native.Memory
///
public sealed class PhysicalPages : BaseObject
{
- private readonly ProcessHandle _processHandle;
- private readonly int _count;
- private readonly IntPtr[] _pfnArray;
+ private ProcessHandle _processHandle;
+ private int _count;
+ private IntPtr[] _pfnArray;
///
/// Allocates physical pages.
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPagesMapping.cs b/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPagesMapping.cs
index 78e7f5962..ee1d5c134 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPagesMapping.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/PhysicalPagesMapping.cs
@@ -1,10 +1,11 @@
using System;
+using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Memory
{
public sealed class PhysicalPagesMapping : MemoryAlloc
{
- private readonly PhysicalPages _physicalPages;
+ private PhysicalPages _physicalPages;
internal PhysicalPagesMapping(PhysicalPages physicalPages, IntPtr baseAddress)
{
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/PinnedObject.cs b/1.x/trunk/ProcessHacker.Native/Memory/PinnedObject.cs
index f3c1f96dd..c1c675c22 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/PinnedObject.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/PinnedObject.cs
@@ -1,11 +1,14 @@
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Text;
+using ProcessHacker.Common.Objects;
namespace ProcessHacker.Native
{
- public sealed class PinnedObject : MemoryRegion
+ public sealed class PinnedObject : BaseObject
{
- private readonly T _object;
+ private T _object;
private GCHandle _handle;
public PinnedObject(T obj)
@@ -14,7 +17,7 @@ namespace ProcessHacker.Native
_handle = GCHandle.Alloc(obj, GCHandleType.Pinned);
}
- protected override void Free()
+ protected override void DisposeObject(bool disposing)
{
_handle.Free();
}
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/Section.cs b/1.x/trunk/ProcessHacker.Native/Memory/Section.cs
index 9c68d63ff..7710ce9ce 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/Section.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/Section.cs
@@ -9,7 +9,7 @@ namespace ProcessHacker.Native
///
public sealed class Section : NativeObject
{
- private readonly MemoryProtection _originalProtection = MemoryProtection.ReadWrite;
+ private MemoryProtection _originalProtection = MemoryProtection.ReadWrite;
///
/// Opens an existing section.
@@ -64,7 +64,7 @@ namespace ProcessHacker.Native
name,
ObjectFlags.OpenIf,
null,
- fileHandle.FileSize,
+ fileHandle.GetSize(),
image ? SectionAttributes.Image : SectionAttributes.Commit,
protection,
fileHandle
diff --git a/1.x/trunk/ProcessHacker.Native/Memory/SectionView.cs b/1.x/trunk/ProcessHacker.Native/Memory/SectionView.cs
index 1e67595e9..232feba5d 100644
--- a/1.x/trunk/ProcessHacker.Native/Memory/SectionView.cs
+++ b/1.x/trunk/ProcessHacker.Native/Memory/SectionView.cs
@@ -40,7 +40,10 @@ namespace ProcessHacker.Native
protected override void Free()
{
- Win32.NtUnmapViewOfSection(ProcessHandle.Current, this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtUnmapViewOfSection(ProcessHandle.Current, this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -62,8 +65,8 @@ namespace ProcessHacker.Native
{
if ((uint)Win32.NtAreMappedFilesTheSame(this, mappedAsFile) == this.Memory.ToUInt32())
return true;
-
- return false;
+ else
+ return false;
}
[EditorBrowsable(EditorBrowsableState.Never)]
diff --git a/1.x/trunk/ProcessHacker.Native/Mfs/Exceptions.cs b/1.x/trunk/ProcessHacker.Native/Mfs/Exceptions.cs
index efd54e387..cc14a02b7 100644
--- a/1.x/trunk/ProcessHacker.Native/Mfs/Exceptions.cs
+++ b/1.x/trunk/ProcessHacker.Native/Mfs/Exceptions.cs
@@ -1,11 +1,13 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Native.Mfs
{
- [Serializable]
public class MfsException : Exception
{
public MfsException()
+ : base()
{ }
public MfsException(string message)
@@ -17,7 +19,6 @@ namespace ProcessHacker.Native.Mfs
{ }
}
- [Serializable]
public class MfsInvalidFileSystemException : MfsException
{
public MfsInvalidFileSystemException()
@@ -32,8 +33,7 @@ namespace ProcessHacker.Native.Mfs
: base(message, innerException)
{ }
}
-
- [Serializable]
+
public class MfsInvalidOperationException : MfsException
{
public MfsInvalidOperationException()
diff --git a/1.x/trunk/ProcessHacker.Native/Mfs/Internal.cs b/1.x/trunk/ProcessHacker.Native/Mfs/Internal.cs
index 00e6c865b..0ce96a5aa 100644
--- a/1.x/trunk/ProcessHacker.Native/Mfs/Internal.cs
+++ b/1.x/trunk/ProcessHacker.Native/Mfs/Internal.cs
@@ -98,13 +98,6 @@ namespace ProcessHacker.Native.Mfs
[StructLayout(LayoutKind.Sequential, Pack = 4)]
internal unsafe struct MfsObjectHeader
{
- public static readonly int SizeOf;
-
- static MfsObjectHeader()
- {
- SizeOf = Marshal.SizeOf(typeof(MfsObjectHeader));
- }
-
public MfsCellId Flink;
public MfsCellId Blink;
public MfsCellId Parent;
@@ -118,11 +111,11 @@ namespace ProcessHacker.Native.Mfs
public MfsCellId LastData;
public int NameLength;
- public fixed char Name [32];
+ public fixed char Name[32];
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
- internal struct MfsDataCell
+ internal unsafe struct MfsDataCell
{
public static readonly int DataOffset = Marshal.OffsetOf(typeof(MfsDataCell), "Data").ToInt32();
diff --git a/1.x/trunk/ProcessHacker.Native/Mfs/MemoryDataWriteStream.cs b/1.x/trunk/ProcessHacker.Native/Mfs/MemoryDataWriteStream.cs
index 6569cd7f9..da9e844ff 100644
--- a/1.x/trunk/ProcessHacker.Native/Mfs/MemoryDataWriteStream.cs
+++ b/1.x/trunk/ProcessHacker.Native/Mfs/MemoryDataWriteStream.cs
@@ -21,15 +21,17 @@
*/
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Text;
using ProcessHacker.Common;
namespace ProcessHacker.Native.Mfs
{
public class MemoryDataWriteStream : Stream
{
- private readonly MemoryObject _obj;
- private readonly byte[] _buffer;
+ private MemoryObject _obj;
+ private byte[] _buffer;
private int _bufferLength;
internal MemoryDataWriteStream(MemoryObject obj, int bufferSize)
diff --git a/1.x/trunk/ProcessHacker.Native/Mfs/MemoryFileSystem.cs b/1.x/trunk/ProcessHacker.Native/Mfs/MemoryFileSystem.cs
index fd352806e..477ff087b 100644
--- a/1.x/trunk/ProcessHacker.Native/Mfs/MemoryFileSystem.cs
+++ b/1.x/trunk/ProcessHacker.Native/Mfs/MemoryFileSystem.cs
@@ -53,23 +53,26 @@ namespace ProcessHacker.Native.Mfs
}
}
- private readonly bool _readOnly;
- private readonly MemoryProtection _protection;
- private readonly Section _section;
+ private bool _readOnly;
+ private MemoryProtection _protection;
+ private Section _section;
private MfsFsHeader* _header;
- private readonly int _blockSize;
- private readonly int _blockMask;
- private readonly int _cellSize;
- private readonly int _cellCount;
- private readonly int _dataCellDataMaxLength;
+ private int _blockSize;
+ private int _blockMask;
+ private int _cellSize;
+ private int _cellCount;
+ private int _dataCellDataMaxLength;
- private readonly MfsCellId _rootObjectCellId = new MfsCellId(0, 1);
- private readonly MemoryObject _rootObjectMo;
+ private MfsCellId _rootObjectCellId = new MfsCellId(0, 1);
+ private MfsObjectHeader* _rootObject;
+ private MemoryObject _rootObjectMo;
- private readonly FreeList _vdFreeList = new FreeList(16);
- private readonly Dictionary _views = new Dictionary();
- private readonly Dictionary _views2 = new Dictionary();
+ private FreeList _vdFreeList = new FreeList(16);
+ private Dictionary _views =
+ new Dictionary();
+ private Dictionary _views2 =
+ new Dictionary();
private ViewDescriptor _cachedLastBlockView;
@@ -106,7 +109,7 @@ namespace ProcessHacker.Native.Mfs
break;
}
- using (FileHandle fhandle = FileHandle.CreateWin32(
+ using (var fhandle = FileHandle.CreateWin32(
fileName,
FileAccess.GenericRead | (!readOnly ? FileAccess.GenericWrite : 0),
FileShareMode.Read,
@@ -118,42 +121,46 @@ namespace ProcessHacker.Native.Mfs
_readOnly = readOnly;
_protection = !readOnly ? MemoryProtection.ReadWrite : MemoryProtection.ReadOnly;
- if (fhandle.FileSize == 0)
+ if (fhandle.GetSize() == 0)
{
if (readOnly)
{
throw new MfsInvalidFileSystemException();
}
-
- // File is too small. Make it 1 byte large and we'll deal with it soon.
- fhandle.SetEnd(1);
+ else
+ {
+ // File is too small. Make it 1 byte large and we'll deal with it
+ // soon.
+ fhandle.SetEnd(1);
+ }
}
_section = new Section(fhandle, _protection);
_blockSize = MfsBlockSizeBase; // fake block size to begin with; we'll fix it up later.
- if (fhandle.FileSize < _blockSize)
+ if (fhandle.GetSize() < _blockSize)
{
if (readOnly)
{
throw new MfsInvalidFileSystemException();
}
-
- // We're creating a new file system. We need the correct block size now.
- if (createParams != null)
- this._blockSize = createParams.BlockSize;
else
- this._blockSize = MfsDefaultBlockSize;
-
- this._section.Extend(this._blockSize);
-
- using (SectionView view = this._section.MapView(0, this._blockSize, this._protection))
{
- this.InitializeFs((MfsFsHeader*)view.Memory, createParams);
- }
+ // We're creating a new file system. We need the correct block size
+ // now.
+ if (createParams != null)
+ _blockSize = createParams.BlockSize;
+ else
+ _blockSize = MfsDefaultBlockSize;
- justCreated = true;
+ _section.Extend(_blockSize);
+
+ using (var view = _section.MapView(0, _blockSize, _protection))
+ this.InitializeFs((MfsFsHeader*)view.Memory, createParams);
+
+ justCreated = true;
+ }
}
_header = (MfsFsHeader*)this.ReferenceBlock(0);
@@ -189,6 +196,7 @@ namespace ProcessHacker.Native.Mfs
_header = (MfsFsHeader*)this.ReferenceBlock(0);
// Set up the root object.
+ _rootObject = (MfsObjectHeader*)((byte*)_header + _cellSize);
_rootObjectMo = new MemoryObject(this, _rootObjectCellId, true);
if (_header->NextFreeBlock != 1 && !readOnly)
@@ -203,16 +211,15 @@ namespace ProcessHacker.Native.Mfs
protected override void DisposeObject(bool disposing)
{
- foreach (ViewDescriptor vd in _views.Values)
+ foreach (var vd in _views.Values)
vd.View.Dispose(disposing);
if (_rootObjectMo != null)
_rootObjectMo.Dispose();
-
if (_section != null)
_section.Dispose();
-
_header = null;
+ _rootObject = null;
}
public int BlockSize
@@ -627,7 +634,7 @@ namespace ProcessHacker.Native.Mfs
throw new ArgumentException("The block size must be a multiple of the cell size.");
if ((blockSize / cellSize) < 2)
throw new ArgumentException("There must be a least 2 cells in each block.");
- if (cellSize < MfsObjectHeader.SizeOf)
+ if (cellSize < Marshal.SizeOf(typeof(MfsObjectHeader)))
throw new ArgumentException("The cell size is too small.");
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Mfs/MemoryObject.cs b/1.x/trunk/ProcessHacker.Native/Mfs/MemoryObject.cs
index f3918503b..a057f4511 100644
--- a/1.x/trunk/ProcessHacker.Native/Mfs/MemoryObject.cs
+++ b/1.x/trunk/ProcessHacker.Native/Mfs/MemoryObject.cs
@@ -30,9 +30,9 @@ namespace ProcessHacker.Native.Mfs
{
public delegate bool EnumChildrenDelegate(MemoryObject mo);
- private readonly bool _fsInternal;
- private readonly MemoryFileSystem _fs;
- private readonly MfsCellId _cellId;
+ private bool _fsInternal;
+ private MemoryFileSystem _fs;
+ private MfsCellId _cellId;
private MfsObjectHeader* _obj;
private string _name;
@@ -80,7 +80,7 @@ namespace ProcessHacker.Native.Mfs
{
get
{
- if (string.IsNullOrEmpty(_name))
+ if (_name == null)
_name = _fs.GetObjectName(_obj);
return _name;
@@ -184,26 +184,23 @@ namespace ProcessHacker.Native.Mfs
return null;
}
- public string[] ChildNames
+ public string[] GetChildNames()
{
- get
- {
- List names = new List();
+ List names = new List();
- this.EnumChildren(mo =>
+ this.EnumChildren((mo) =>
{
names.Add(mo.Name);
mo.Dispose();
return true;
});
- return names.ToArray();
- }
+ return names.ToArray();
}
- public MemoryObject Parent
+ public MemoryObject GetParent()
{
- get { return new MemoryObject(_fs, _obj->Parent); }
+ return new MemoryObject(_fs, _obj->Parent);
}
public MemoryDataWriteStream GetWriteStream()
diff --git a/1.x/trunk/ProcessHacker.Native/NativeBitmap.cs b/1.x/trunk/ProcessHacker.Native/NativeBitmap.cs
index 7bcdf6a0d..f0b5f4bff 100644
--- a/1.x/trunk/ProcessHacker.Native/NativeBitmap.cs
+++ b/1.x/trunk/ProcessHacker.Native/NativeBitmap.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Common;
using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
@@ -54,7 +56,7 @@ namespace ProcessHacker.Native
}
private RtlBitmap _bitmap;
- private readonly MemoryAlloc _buffer;
+ private MemoryAlloc _buffer;
public NativeBitmap(int bits)
{
@@ -129,8 +131,9 @@ namespace ProcessHacker.Native
public BitmapRun[] FindClearRuns(int count, bool locateLongest)
{
RtlBitmapRun[] runs = new RtlBitmapRun[count];
+ int numberOfRuns;
- int numberOfRuns = Win32.RtlFindClearRuns(ref this._bitmap, runs, count, locateLongest);
+ numberOfRuns = Win32.RtlFindClearRuns(ref _bitmap, runs, count, locateLongest);
BitmapRun[] returnRuns = new BitmapRun[numberOfRuns];
@@ -143,8 +146,9 @@ namespace ProcessHacker.Native
public BitmapRun FindBackwardClearRun(int index)
{
int startingIndex;
+ int numberOfBits;
- int numberOfBits = Win32.RtlFindLastBackwardRunClear(ref this._bitmap, index, out startingIndex);
+ numberOfBits = Win32.RtlFindLastBackwardRunClear(ref _bitmap, index, out startingIndex);
return new BitmapRun(startingIndex, numberOfBits);
}
@@ -152,8 +156,9 @@ namespace ProcessHacker.Native
public BitmapRun FindFirstClearRun()
{
int startingIndex;
+ int numberOfBits;
- int numberOfBits = Win32.RtlFindFirstRunClear(ref this._bitmap, out startingIndex);
+ numberOfBits = Win32.RtlFindFirstRunClear(ref _bitmap, out startingIndex);
return new BitmapRun(startingIndex, numberOfBits);
}
@@ -161,8 +166,9 @@ namespace ProcessHacker.Native
public BitmapRun FindForwardClearRun(int index)
{
int startingIndex;
+ int numberOfBits;
- int numberOfBits = Win32.RtlFindNextForwardRunClear(ref this._bitmap, index, out startingIndex);
+ numberOfBits = Win32.RtlFindNextForwardRunClear(ref _bitmap, index, out startingIndex);
return new BitmapRun(startingIndex, numberOfBits);
}
@@ -170,8 +176,9 @@ namespace ProcessHacker.Native
public BitmapRun FindLongestClearRun()
{
int startingIndex;
+ int numberOfBits;
- int numberOfBits = Win32.RtlFindLongestRunClear(ref this._bitmap, out startingIndex);
+ numberOfBits = Win32.RtlFindLongestRunClear(ref _bitmap, out startingIndex);
return new BitmapRun(startingIndex, numberOfBits);
}
@@ -196,14 +203,14 @@ namespace ProcessHacker.Native
return Win32.RtlFindSetBitsAndClear(ref _bitmap, length, hintIndex);
}
- public int ClearCount
+ public int GetClearCount()
{
- get { return Win32.RtlNumberOfClearBits(ref _bitmap); }
+ return Win32.RtlNumberOfClearBits(ref _bitmap);
}
- public int SetCount
+ public int GetSetCount()
{
- get { return Win32.RtlNumberOfSetBits(ref _bitmap); }
+ return Win32.RtlNumberOfSetBits(ref _bitmap);
}
public void Set()
diff --git a/1.x/trunk/ProcessHacker.Native/NativeLibrary.cs b/1.x/trunk/ProcessHacker.Native/NativeLibrary.cs
deleted file mode 100644
index 1610003fc..000000000
--- a/1.x/trunk/ProcessHacker.Native/NativeLibrary.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-namespace System
-{
- using Runtime.InteropServices;
- using ProcessHacker.Native;
- using ProcessHacker.Native.Api;
- using ProcessHacker.Native.Objects;
-
- ///
- /// Utility class to wrap an unmanaged DLL and be responsible for freeing it.
- ///
- /// This is a managed wrapper over the native LoadLibrary, GetProcAddress, and FreeLibrary calls.
- public sealed class NativeLibrary : NativeHandle
- {
- ///
- /// LoadLibraryEx constructor to load a dll and be responsible for freeing it.
- ///
- /// full path name of dll to load
- ///
- /// Throws exceptions on failure. Most common failure would be file-not-found, or that the file is not a loadable image.
- public NativeLibrary(string dllName, LoadLibraryFlags flags)
- {
- UnicodeString str = new UnicodeString(dllName);
-
- IntPtr ptr;
-
- NtStatus result = Win32.LdrLoadDll(null, (int)flags, ref str, out ptr);
-
- if (result.IsError())
- {
- this.MarkAsInvalid();
- }
-
- str.Dispose();
- }
-
- ///
- /// Dynamically lookup a function in the dll via kernel32!GetProcAddress.
- ///
- /// raw name of the function in the export table.
- /// null if function is not found. Else a delegate to the unmanaged function.
- /// GetProcAddress results are valid as long as the dll is not yet unloaded. This
- /// is very very dangerous to use since you need to ensure that the dll is not unloaded
- /// until after you're done with any objects implemented by the dll. For example, if you
- /// get a delegate that then gets an IUnknown implemented by this dll,
- /// you can not dispose this library until that IUnknown is collected. Else, you may free
- /// the library and then the CLR may call release on that IUnknown and it will crash.
- public TDelegate GetUnmanagedFunction(string functionName) where TDelegate : class
- {
- using (AnsiString str = new AnsiString(functionName))
- {
- IntPtr functionPtr;
-
- NtStatus result = Win32.LdrGetProcedureAddress(this, str.Buffer, 0, out functionPtr);
-
- // Failure is a common case, especially for adaptive code.
- if (result.IsError())
- {
- //result.ReturnException().Log();
-
- return null;
- }
-
- Delegate function = Marshal.GetDelegateForFunctionPointer(functionPtr, typeof(TDelegate));
-
- // Ideally, we'd just make the constraint on TDelegate be
- // System.Delegate, but compiler error CS0702 (constrained can't be System.Delegate)
- // prevents that. So we make the constraint system.object and do the cast from object-->TDelegate.
- object o = function;
-
- return (TDelegate)o;
- }
- }
-
- #region Disposable Members
-
- ///
- /// Call FreeLibrary on the unmanaged dll. All function pointers handed out from this class become invalid after this.
- ///
- /// This is very dangerous because it suddenly invalidate
- /// everything retrieved from this dll. This includes any functions
- /// handed out via GetProcAddress, and potentially any objects returned
- /// from those functions (which may have an implementation in the dll).
- ///
- protected override void Close()
- {
- Win32.LdrUnloadDll(this).ThrowIf();
- }
-
- #endregion
-
- public IntPtr GetProcedure(string procedureName)
- {
- AnsiString str = new AnsiString(procedureName);
- {
- IntPtr functionPtr = IntPtr.Zero;
-
- NtStatus result = Win32.LdrGetProcedureAddress(this, functionPtr, 0, out functionPtr);
-
- return functionPtr;
- }
- }
-
- public IntPtr GetProcedure(int procedureNumber)
- {
- IntPtr functionPtr;
-
- NtStatus result = Win32.LdrGetProcedureAddress(this, IntPtr.Zero, procedureNumber, out functionPtr);
-
- return functionPtr;
- }
-
- #region Static Methods
-
- public static IntPtr GetProcedure(string dllName, string procedureName)
- {
- return GetProcedure(GetModuleHandle(dllName), procedureName);
- }
-
- public static IntPtr GetProcedure(IntPtr dllHandle, string procedureName)
- {
- IntPtr handle;
-
- using (AnsiString str = new AnsiString(procedureName))
- {
- Win32.LdrGetProcedureAddress(dllHandle, str.Buffer, 0, out handle).ThrowIf();
- }
-
- return handle;
- }
-
- public static IntPtr GetModuleHandle(string dllName)
- {
- IntPtr handle;
-
- UnicodeString str = new UnicodeString(dllName);
- {
- Win32.LdrGetDllHandle(null, 0, ref str, out handle).ThrowIf();
- }
-
- return handle;
- }
-
- #endregion
- }
-
- [Flags] //TODO: move to enum file
- public enum LoadLibraryFlags
- {
- None = 0,
-
- ///
- /// If this value is used, and the executable module is a DLL, the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module. Do not use this value; it is provided only for backwards compatibility. If you are planning to access only data or resources in the DLL, use LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE or LOAD_LIBRARY_AS_IMAGE_RESOURCE or both. Otherwise, load the library as a DLL or executable module using the LoadLibrary function.
- ///
- DontResolveDllReferences = 0x00000001,
-
- ///
- /// If this value is used, the system maps the file into the calling process's virtual address space as if it were a data file. Nothing is done to execute or prepare to execute the mapped file. Therefore, you cannot call functions like GetModuleFileName, GetModuleHandle or GetProcAddress with this DLL. Using this value causes writes to read-only memory to raise an access violation. Use this flag when you want to load a DLL only to extract messages or resources from it. This value can be used with LOAD_LIBRARY_AS_IMAGE_RESOURCE.
- ///
- LOAD_LIBRARY_AS_DATAFILE = 0x00000002,
-
- ///
- /// If this value is used and lpFileName specifies an absolute path, the system uses the alternate file search strategy discussed in the Remarks section to find associated executable modules that the specified module causes to be loaded. If this value is used and lpFileName specifies a relative path, the behavior is undefined. If this value is not used, or if lpFileName does not specify a path, the system uses the standard search strategy discussed in the Remarks section to find associated executable modules that the specified module causes to be loaded.
- ///
- LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008,
-
- ///
- /// If this value is used, the system does not check AppLocker rules or apply Software Restriction Policies for the DLL. This action applies only to the DLL being loaded and not to its dependents. This value is recommended for use in setup programs that must run extracted DLLs during installation.
- ///
- LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010,
-
- ///
- /// If this value is used, the system maps the file into the process's virtual address space as an image file. However, the loader does not load the static imports or perform the other usual initialization steps. Use this flag when you want to load a DLL only to extract messages or resources from it. Unless the application depends on the image layout, this value should be used with either LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE or LOAD_LIBRARY_AS_DATAFILE. For more information, see the Remarks section.
- ///
- LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020,
-
- ///
- /// Similar to LOAD_LIBRARY_AS_DATAFILE, except that the DLL file on the disk is opened for exclusive write access. Therefore, other processes cannot open the DLL file for write access while it is in use. However, the DLL can still be opened by other processes. This value can be used with LOAD_LIBRARY_AS_IMAGE_RESOURCE. For more information, see Remarks.
- ///
- LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040,
-
-
- LOAD_LIBRARY_REQUIRE_SIGNED_TARGET = 0x00000080
- }
-}
diff --git a/1.x/trunk/ProcessHacker.Native/NativeUtils.cs b/1.x/trunk/ProcessHacker.Native/NativeUtils.cs
index bd67e9ed0..76f75c478 100644
--- a/1.x/trunk/ProcessHacker.Native/NativeUtils.cs
+++ b/1.x/trunk/ProcessHacker.Native/NativeUtils.cs
@@ -1,6 +1,7 @@
using System;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Security;
namespace ProcessHacker.Native
@@ -41,23 +42,34 @@ namespace ProcessHacker.Native
ref StartupInfo startupInfo
)
{
+ UnicodeString imagePathNameStr;
+ UnicodeString dllPathStr;
+ UnicodeString currentDirectoryStr;
+ UnicodeString commandLineStr;
+ UnicodeString windowTitleStr;
+ UnicodeString desktopInfoStr;
+ UnicodeString shellInfoStr;
+ UnicodeString runtimeInfoStr;
+
// Create the unicode strings.
- UnicodeString imagePathNameStr = new UnicodeString(imagePathName);
- UnicodeString dllPathStr = new UnicodeString(dllPath);
- UnicodeString currentDirectoryStr = new UnicodeString(currentDirectory);
- UnicodeString commandLineStr = new UnicodeString(commandLine);
- UnicodeString windowTitleStr = new UnicodeString(windowTitle);
- UnicodeString desktopInfoStr = new UnicodeString(desktopInfo);
- UnicodeString shellInfoStr = new UnicodeString(shellInfo);
- UnicodeString runtimeInfoStr = new UnicodeString(runtimeInfo);
+ imagePathNameStr = new UnicodeString(imagePathName);
+ dllPathStr = new UnicodeString(dllPath);
+ currentDirectoryStr = new UnicodeString(currentDirectory);
+ commandLineStr = new UnicodeString(commandLine);
+ windowTitleStr = new UnicodeString(windowTitle);
+ desktopInfoStr = new UnicodeString(desktopInfo);
+ shellInfoStr = new UnicodeString(shellInfo);
+ runtimeInfoStr = new UnicodeString(runtimeInfo);
try
{
+ NtStatus status;
IntPtr processParameters;
// Create the process parameter block.
- Win32.RtlCreateProcessParameters(
+
+ status = Win32.RtlCreateProcessParameters(
out processParameters,
ref imagePathNameStr,
ref dllPathStr,
@@ -68,15 +80,21 @@ namespace ProcessHacker.Native
ref desktopInfoStr,
ref shellInfoStr,
ref runtimeInfoStr
- ).ThrowIf();
+ );
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
try
{
// Allocate a new memory region in the remote process for
// the environment block and copy it over.
- int environmentLength = environment.Length;
- IntPtr newEnvironment = processHandle.AllocateMemory(
+ int environmentLength;
+ IntPtr newEnvironment;
+
+ environmentLength = environment.GetLength();
+ newEnvironment = processHandle.AllocateMemory(
environmentLength,
MemoryProtection.ReadWrite
);
@@ -113,9 +131,10 @@ namespace ProcessHacker.Native
// Allocate a new memory region in the remote process for
// the process parameters.
+ IntPtr newProcessParameters;
IntPtr regionSize = paramsStruct->Length.ToIntPtr();
- IntPtr newProcessParameters = processHandle.AllocateMemory(
+ newProcessParameters = processHandle.AllocateMemory(
IntPtr.Zero,
ref regionSize,
MemoryFlags.Commit,
@@ -161,23 +180,25 @@ namespace ProcessHacker.Native
if (nativeKeyName.StartsWith(hkcrString, StringComparison.OrdinalIgnoreCase))
return "HKCR" + nativeKeyName.Substring(hkcrString.Length);
- if (nativeKeyName.StartsWith(hklmString, StringComparison.OrdinalIgnoreCase))
+ else if (nativeKeyName.StartsWith(hklmString, StringComparison.OrdinalIgnoreCase))
return "HKLM" + nativeKeyName.Substring(hklmString.Length);
- if (nativeKeyName.StartsWith(hkcucrString, StringComparison.OrdinalIgnoreCase))
+ else if (nativeKeyName.StartsWith(hkcucrString, StringComparison.OrdinalIgnoreCase))
return @"HKCU\Software\Classes" + nativeKeyName.Substring(hkcucrString.Length);
- if (nativeKeyName.StartsWith(hkcuString, StringComparison.OrdinalIgnoreCase))
+ else if (nativeKeyName.StartsWith(hkcuString, StringComparison.OrdinalIgnoreCase))
return "HKCU" + nativeKeyName.Substring(hkcuString.Length);
- if (nativeKeyName.StartsWith(hkuString, StringComparison.OrdinalIgnoreCase))
+ else if (nativeKeyName.StartsWith(hkuString, StringComparison.OrdinalIgnoreCase))
return "HKU" + nativeKeyName.Substring(hkuString.Length);
- return nativeKeyName;
+ else
+ return nativeKeyName;
}
public static string GetMessage(IntPtr dllHandle, int messageTableId, int messageLanguageId, int messageId)
{
+ NtStatus status;
IntPtr messageEntry;
string message;
- NtStatus status = Win32.RtlFindMessage(
+ status = Win32.RtlFindMessage(
dllHandle,
messageTableId,
messageLanguageId,
@@ -188,8 +209,8 @@ namespace ProcessHacker.Native
if (status.IsError())
return null;
- MemoryRegion region = new MemoryRegion(messageEntry);
- MessageResourceEntry entry = region.ReadStruct();
+ var region = new MemoryRegion(messageEntry);
+ var entry = region.ReadStruct();
// Read the message, depending on format.
if ((entry.Flags & MessageResourceFlags.Unicode) == MessageResourceFlags.Unicode)
@@ -217,7 +238,7 @@ namespace ProcessHacker.Native
try
{
- using (var dhandle = new DirectoryHandle(dirPart, DirectoryAccess.Query))
+ using (var dhandle = new DirectoryHandle(dirPart, ProcessHacker.Native.Security.DirectoryAccess.Query))
{
var objects = dhandle.GetObjects();
@@ -242,7 +263,7 @@ namespace ProcessHacker.Native
try
{
- return null;// new NativeHandle(KProcessHacker.Instance.KphOpenNamedObject(access, oa).ToIntPtr(), true);
+ return new NativeHandle(KProcessHacker.Instance.KphOpenNamedObject(access, oa).ToIntPtr(), true);
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/OSVersion.cs b/1.x/trunk/ProcessHacker.Native/OSVersion.cs
index 83e4fcc7d..a07d5728f 100644
--- a/1.x/trunk/ProcessHacker.Native/OSVersion.cs
+++ b/1.x/trunk/ProcessHacker.Native/OSVersion.cs
@@ -25,7 +25,7 @@ using ProcessHacker.Native.Security;
namespace ProcessHacker.Native
{
- public enum OSArch
+ public enum OSArch : int
{
Unknown,
I386,
@@ -59,11 +59,6 @@ namespace ProcessHacker.Native
///
Seven = 61,
- ///
- /// Windows 8.
- ///
- Eight = 62,
-
///
/// An unknown version of Windows.
///
@@ -72,31 +67,31 @@ namespace ProcessHacker.Native
public static class OSVersion
{
- private static readonly int _bits = IntPtr.Size * 8;
- private static readonly OSArch _arch = IntPtr.Size == 4 ? OSArch.I386 : OSArch.Amd64;
- private static readonly string _versionString;
- private static readonly WindowsVersion _windowsVersion;
+ private static int _bits = IntPtr.Size * 8;
+ private static OSArch _arch = IntPtr.Size == 4 ? OSArch.I386 : OSArch.Amd64;
+ private static string _versionString;
+ private static WindowsVersion _windowsVersion;
- private static readonly ProcessAccess _minProcessQueryInfoAccess = ProcessAccess.QueryInformation;
- private static readonly ThreadAccess _minThreadQueryInfoAccess = ThreadAccess.QueryInformation;
- private static readonly ThreadAccess _minThreadSetInfoAccess = ThreadAccess.SetInformation;
+ private static ProcessAccess _minProcessQueryInfoAccess = ProcessAccess.QueryInformation;
+ private static ThreadAccess _minThreadQueryInfoAccess = ThreadAccess.QueryInformation;
+ private static ThreadAccess _minThreadSetInfoAccess = ThreadAccess.SetInformation;
- private static readonly bool _hasCycleTime;
- private static readonly bool _hasExtendedTaskbar;
- private static readonly bool _hasIoPriority;
- private static readonly bool _hasPagePriority;
- private static readonly bool _hasProtectedProcesses;
- private static readonly bool _hasPsSuspendResumeProcess;
- private static readonly bool _hasQueryLimitedInformation;
- private static readonly bool _hasSetAccessToken;
- private static readonly bool _hasTaskDialogs;
- private static readonly bool _hasThemes;
- private static readonly bool _hasUac;
- private static readonly bool _hasWin32ImageFileName;
+ private static bool _hasCycleTime = false;
+ private static bool _hasExtendedTaskbar = false;
+ private static bool _hasIoPriority = false;
+ private static bool _hasPagePriority = false;
+ private static bool _hasProtectedProcesses = false;
+ private static bool _hasPsSuspendResumeProcess = false;
+ private static bool _hasQueryLimitedInformation = false;
+ private static bool _hasSetAccessToken = false;
+ private static bool _hasTaskDialogs = false;
+ private static bool _hasThemes = false;
+ private static bool _hasUac = false;
+ private static bool _hasWin32ImageFileName = false;
static OSVersion()
{
- Version version = Environment.OSVersion.Version;
+ System.Version version = Environment.OSVersion.Version;
if (version.Major == 5 && version.Minor == 0)
_windowsVersion = WindowsVersion.TwoThousand;
@@ -107,9 +102,7 @@ namespace ProcessHacker.Native
else if (version.Major == 6 && version.Minor == 0)
_windowsVersion = WindowsVersion.Vista;
else if (version.Major == 6 && version.Minor == 1)
- _windowsVersion = WindowsVersion.Seven;
- else if (version.Major == 6 && version.Minor == 2)
- _windowsVersion = WindowsVersion.Eight;
+ _windowsVersion = WindowsVersion.Seven;
else
_windowsVersion = WindowsVersion.Unknown;
@@ -263,22 +256,22 @@ namespace ProcessHacker.Native
public static bool IsAbove(WindowsVersion version)
{
- return _windowsVersion > version;
+ return (int)_windowsVersion > (int)version;
}
public static bool IsAboveOrEqual(WindowsVersion version)
{
- return _windowsVersion >= version;
+ return (int)_windowsVersion >= (int)version;
}
public static bool IsBelowOrEqual(WindowsVersion version)
{
- return _windowsVersion <= version;
+ return (int)_windowsVersion <= (int)version;
}
public static bool IsBelow(WindowsVersion version)
{
- return _windowsVersion < version;
+ return (int)_windowsVersion < (int)version;
}
public static bool IsEqualTo(WindowsVersion version)
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs
index 2416e0e13..879022ff9 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -40,17 +42,19 @@ namespace ProcessHacker.Native.Objects
public static DebugObjectHandle Create(DebugObjectAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, DebugObjectFlags flags)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateDebugObject(
+ if ((status = Win32.NtCreateDebugObject(
out handle,
access,
ref oa,
flags
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -80,26 +84,31 @@ namespace ProcessHacker.Native.Objects
public void Continue(ClientId cid, NtStatus continueStatus)
{
- Win32.NtDebugContinue(
+ NtStatus status;
+
+ if ((status = Win32.NtDebugContinue(
this,
ref cid,
continueStatus
- ).ThrowIf();
+ )) > NtStatus.Error)
+ Win32.Throw(status);
}
public void SetFlags(DebugObjectFlags flags)
{
unsafe
{
+ NtStatus status;
int retLength;
- Win32.NtSetInformationDebugObject(
+ if ((status = Win32.NtSetInformationDebugObject(
this,
DebugObjectInformationClass.DebugObjectFlags,
new IntPtr(&flags),
sizeof(DebugObjectFlags),
out retLength
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
@@ -111,12 +120,13 @@ namespace ProcessHacker.Native.Objects
//NtStatus status;
//long realTimeout = timeoutRelative ? -timeout : timeout;
- //Win32.NtWaitForDebugEvent(
+ //if ((status = Win32.NtWaitForDebugEvent(
// this,
// alertable,
// ref realTimeout,
// IntPtr.Zero
- // ).ThrowIf();
+ // )) >= NtStatus.Error)
+ // Win32.ThrowLastError(status);
//return IntPtr.Zero;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/DesktopHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/DesktopHandle.cs
index 25a22dd99..9c95d819c 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/DesktopHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/DesktopHandle.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/DirectoryHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/DirectoryHandle.cs
index 0bb2a5f87..b6ed60e0b 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/DirectoryHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/DirectoryHandle.cs
@@ -36,8 +36,8 @@ namespace ProcessHacker.Native.Objects
public struct ObjectEntry
{
- private readonly string _name;
- private readonly string _typeName;
+ private string _name;
+ private string _typeName;
public ObjectEntry(string name, string typeName)
{
@@ -56,12 +56,14 @@ namespace ProcessHacker.Native.Objects
public static DirectoryHandle Create(DirectoryAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateDirectoryObject(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtCreateDirectoryObject(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -84,12 +86,21 @@ namespace ProcessHacker.Native.Objects
public DirectoryHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, DirectoryAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenDirectoryObject(out handle, access, ref oa).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ handle = KProcessHacker.Instance.KphOpenDirectoryObject(access, oa).ToIntPtr();
+ }
+ else
+ {
+ if ((status = Win32.NtOpenDirectoryObject(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
}
finally
{
@@ -122,7 +133,7 @@ namespace ProcessHacker.Native.Objects
{
// Check if we have at least one entry. If not,
// we need to double the buffer size and try again.
- if (data.ReadStruct(0, ObjectDirectoryInformation.SizeOf, 0).Name.Buffer != IntPtr.Zero)
+ if (data.ReadStruct(0).Name.Buffer != IntPtr.Zero)
break;
if (data.Size > 16 * 1024 * 1024)
@@ -131,18 +142,19 @@ namespace ProcessHacker.Native.Objects
data.ResizeNew(data.Size * 2);
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
int i = 0;
while (true)
{
- ObjectDirectoryInformation info = data.ReadStruct(0, ObjectDirectoryInformation.SizeOf, i);
+ ObjectDirectoryInformation info = data.ReadStruct(i);
if (info.Name.Buffer == IntPtr.Zero)
break;
- if (!callback(new ObjectEntry(info.Name.Text, info.TypeName.Text)))
+ if (!callback(new ObjectEntry(info.Name.Read(), info.TypeName.Read())))
return;
i++;
@@ -164,7 +176,7 @@ namespace ProcessHacker.Native.Objects
{
var objects = new List();
- this.EnumObjects(obj =>
+ this.EnumObjects((obj) =>
{
objects.Add(obj);
return true;
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/DriverHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/DriverHandle.cs
index 2e63b5571..ffff7d53d 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/DriverHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/DriverHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Objects
@@ -37,7 +38,7 @@ namespace ProcessHacker.Native.Objects
try
{
- this.Handle = IntPtr.Zero;// KProcessHacker.Instance.KphOpenDriver(oa).ToIntPtr();
+ this.Handle = KProcessHacker.Instance.KphOpenDriver(oa).ToIntPtr();
}
finally
{
@@ -45,63 +46,66 @@ namespace ProcessHacker.Native.Objects
}
}
- public string DriverName
+ public DriverBasicInformation GetBasicInformation()
{
- get { return this.GetInformationUnicodeString(DriverInformationClass.DriverNameInformation); }
- }
-
- public string ServiceKeyName
- {
- get { return this.GetInformationUnicodeString(DriverInformationClass.DriverServiceKeyNameInformation); }
- }
-
- public unsafe DriverBasicInformation BasicInformation
- {
- get
+ unsafe
{
- DriverBasicInformation basicInfo = new DriverBasicInformation();
+ DriverBasicInformation basicInfo;
+ int retLength;
- //KProcessHacker.Instance.KphQueryInformationDriver(
- // this,
- // DriverInformationClass.DriverBasicInformation,
- // new IntPtr(&basicInfo),
- // DriverBasicInformation.SizeOf,
- // out retLength
- // );
+ KProcessHacker.Instance.KphQueryInformationDriver(
+ this,
+ DriverInformationClass.DriverBasicInformation,
+ new IntPtr(&basicInfo),
+ Marshal.SizeOf(typeof(DriverBasicInformation)),
+ out retLength
+ );
return basicInfo;
}
}
+ public string GetDriverName()
+ {
+ return this.GetInformationUnicodeString(DriverInformationClass.DriverNameInformation);
+ }
+
private string GetInformationUnicodeString(DriverInformationClass infoClass)
{
using (MemoryAlloc data = new MemoryAlloc(0x1000))
{
- //try
- //{
- // KProcessHacker.Instance.KphQueryInformationDriver(
- // this,
- // infoClass,
- // data,
- // data.Size,
- // out retLength
- // );
- //}
- //catch (WindowsException)
- //{
- // data.ResizeNew(retLength);
+ int retLength = 0;
- // KProcessHacker.Instance.KphQueryInformationDriver(
- // this,
- // infoClass,
- // data,
- // data.Size,
- // out retLength
- // );
- //}
+ try
+ {
+ KProcessHacker.Instance.KphQueryInformationDriver(
+ this,
+ infoClass,
+ data,
+ data.Size,
+ out retLength
+ );
+ }
+ catch (WindowsException)
+ {
+ data.ResizeNew(retLength);
- return data.ReadStruct().Text;
+ KProcessHacker.Instance.KphQueryInformationDriver(
+ this,
+ infoClass,
+ data,
+ data.Size,
+ out retLength
+ );
+ }
+
+ return data.ReadStruct().Read();
}
}
+
+ public string GetServiceKeyName()
+ {
+ return this.GetInformationUnicodeString(DriverInformationClass.DriverServiceKeyNameInformation);
+ }
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/EnlistmentHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/EnlistmentHandle.cs
index 6a95d8c23..69eb2042f 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/EnlistmentHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/EnlistmentHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -40,12 +41,13 @@ namespace ProcessHacker.Native.Objects
IntPtr enlistmentKey
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateEnlistment(
+ if ((status = Win32.NtCreateEnlistment(
out handle,
access,
resourceManagerHandle,
@@ -54,7 +56,8 @@ namespace ProcessHacker.Native.Objects
createOptions,
notificationMask,
enlistmentKey
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -82,18 +85,20 @@ namespace ProcessHacker.Native.Objects
EnlistmentAccess access
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenEnlistment(
+ if ((status = Win32.NtOpenEnlistment(
out handle,
access,
resourceManagerHandle,
ref guid,
ref oa
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -105,76 +110,108 @@ namespace ProcessHacker.Native.Objects
public void Commit(long virtualClock)
{
- Win32.NtCommitEnlistment(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtCommitEnlistment(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void CommitComplete(long virtualClock)
{
- Win32.NtCommitComplete(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtCommitComplete(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
- public EnlistmentBasicInformation BasicInformation
+ public EnlistmentBasicInformation GetBasicInformation()
{
- get
- {
- EnlistmentBasicInformation basicInfo;
- int retLength;
+ NtStatus status;
+ EnlistmentBasicInformation basicInfo;
+ int retLength;
- Win32.NtQueryInformationEnlistment(
- this,
- EnlistmentInformationClass.EnlistmentBasicInformation,
- out basicInfo,
- EnlistmentBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationEnlistment(
+ this,
+ EnlistmentInformationClass.EnlistmentBasicInformation,
+ out basicInfo,
+ Marshal.SizeOf(typeof(EnlistmentBasicInformation)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return basicInfo;
- }
+ return basicInfo;
}
public void Prepare(long virtualClock)
{
- Win32.NtPrepareEnlistment(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtPrepareEnlistment(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void PrepareComplete(long virtualClock)
{
- Win32.NtPrepareComplete(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtPrepareComplete(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void PrePrepare(long virtualClock)
{
- Win32.NtPrePrepareEnlistment(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtPrePrepareEnlistment(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void PrePrepareComplete(long virtualClock)
{
- Win32.NtPrePrepareComplete(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtPrePrepareComplete(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void ReadOnly(long virtualClock)
{
- Win32.NtReadOnlyEnlistment(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtReadOnlyEnlistment(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void Recover(IntPtr enlistmentKey)
{
- Win32.NtRecoverEnlistment(this, enlistmentKey).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRecoverEnlistment(this, enlistmentKey)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void RejectSinglePhase(long virtualClock)
{
- Win32.NtSinglePhaseReject(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSinglePhaseReject(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void Rollback(long virtualClock)
{
- Win32.NtRollbackEnlistment(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRollbackEnlistment(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void RollbackComplete(long virtualClock)
{
- Win32.NtRollbackComplete(this, ref virtualClock).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRollbackComplete(this, ref virtualClock)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/EnvironmentBlock.cs b/1.x/trunk/ProcessHacker.Native/Objects/EnvironmentBlock.cs
index 68dc0a107..6c5434bfe 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/EnvironmentBlock.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/EnvironmentBlock.cs
@@ -1,5 +1,9 @@
using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
+using System.Runtime.InteropServices;
namespace ProcessHacker.Native.Objects
{
@@ -12,9 +16,12 @@ namespace ProcessHacker.Native.Objects
get { return _zero; }
}
- public unsafe static EnvironmentBlock GetCurrent()
+ public static EnvironmentBlock GetCurrent()
{
- return new EnvironmentBlock(ProcessHandle.GetCurrentProcessParameters()->Environment);
+ unsafe
+ {
+ return new EnvironmentBlock(ProcessHandle.GetCurrentProcessParameters()->Environment);
+ }
}
public static string GetCurrentVariable(string name)
@@ -24,32 +31,46 @@ namespace ProcessHacker.Native.Objects
public static EnvironmentBlock SetCurrent(EnvironmentBlock environmentBlock)
{
+ NtStatus status;
IntPtr previousEnvironment;
- Win32.RtlSetCurrentEnvironment(
+ if ((status = Win32.RtlSetCurrentEnvironment(
environmentBlock,
out previousEnvironment
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new EnvironmentBlock(previousEnvironment);
}
public static void SetCurrentVariable(string name, string value)
{
- UnicodeString nameStr = new UnicodeString(name);
- UnicodeString valueStr = new UnicodeString(value);
+ NtStatus status;
+ UnicodeString nameStr;
+ UnicodeString valueStr;
+
+ nameStr = new UnicodeString(name);
try
{
- Win32.RtlSetEnvironmentVariable(
- IntPtr.Zero,
- ref nameStr,
- ref valueStr
- ).ThrowIf();
+ valueStr = new UnicodeString(value);
+
+ try
+ {
+ if ((status = Win32.RtlSetEnvironmentVariable(
+ IntPtr.Zero,
+ ref nameStr,
+ ref valueStr
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+ finally
+ {
+ valueStr.Dispose();
+ }
}
finally
{
- valueStr.Dispose();
nameStr.Dispose();
}
}
@@ -63,10 +84,13 @@ namespace ProcessHacker.Native.Objects
public EnvironmentBlock(bool cloneCurrent)
{
- Win32.RtlCreateEnvironment(
+ NtStatus status;
+
+ if ((status = Win32.RtlCreateEnvironment(
cloneCurrent,
out _environment
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public EnvironmentBlock(TokenHandle tokenHandle)
@@ -90,41 +114,36 @@ namespace ProcessHacker.Native.Objects
Win32.RtlDestroyEnvironment(this);
}
- public unsafe int Length
+ public unsafe int GetLength()
{
- get
- {
- short* ptr = (short*)_environment;
+ short* ptr = (short*)_environment;
- while (*ptr != 0)
- {
- while (*ptr++ != 0)
- {
+ while (*ptr != 0)
+ while (*ptr++ != 0)
+ ;
- }
- }
+ ptr++;
- ptr++;
-
- return (new IntPtr(ptr)).Decrement(_environment).ToInt32();
- }
+ return (new IntPtr(ptr)).Decrement(_environment).ToInt32();
}
public string GetVariable(string name)
{
- UnicodeString nameStr = new UnicodeString(name);
+ NtStatus status;
+ UnicodeString nameStr;
+ UnicodeString valueStr;
+
+ nameStr = new UnicodeString(name);
try
{
- using (MemoryAlloc data = new MemoryAlloc(100))
+ using (var data = new MemoryAlloc(100))
{
- UnicodeString valueStr = new UnicodeString
- {
- Buffer = data,
- MaximumLength = (ushort)data.Size
- };
+ valueStr = new UnicodeString();
+ valueStr.Buffer = data;
+ valueStr.MaximumLength = (ushort)data.Size;
- NtStatus status = Win32.RtlQueryEnvironmentVariable_U(
+ status = Win32.RtlQueryEnvironmentVariable_U(
this,
ref nameStr,
ref valueStr
@@ -144,9 +163,10 @@ namespace ProcessHacker.Native.Objects
);
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
- return valueStr.Text;
+ return valueStr.Read();
}
}
finally
@@ -157,22 +177,33 @@ namespace ProcessHacker.Native.Objects
public void SetVariable(string name, string value)
{
+ NtStatus status;
IntPtr environment = _environment;
+ UnicodeString nameStr;
+ UnicodeString valueStr;
- UnicodeString nameStr = new UnicodeString(name);
- UnicodeString valueStr = new UnicodeString(value);
+ nameStr = new UnicodeString(name);
try
{
- Win32.RtlSetEnvironmentVariable(
- ref environment,
- ref nameStr,
- ref valueStr
- ).ThrowIf();
+ valueStr = new UnicodeString(value);
+
+ try
+ {
+ if ((status = Win32.RtlSetEnvironmentVariable(
+ ref environment,
+ ref nameStr,
+ ref valueStr
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+ finally
+ {
+ valueStr.Dispose();
+ }
}
finally
{
- valueStr.Dispose();
nameStr.Dispose();
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/EventHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/EventHandle.cs
index c332abfc9..5c6c7c8c4 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/EventHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/EventHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -40,12 +41,14 @@ namespace ProcessHacker.Native.Objects
public static EventHandle Create(EventAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, EventType type, bool initialState)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateEvent(out handle, access, ref oa, type, initialState).ThrowIf();
+ if ((status = Win32.NtCreateEvent(out handle, access, ref oa, type, initialState)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -70,12 +73,14 @@ namespace ProcessHacker.Native.Objects
public EventHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, EventAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenEvent(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenEvent(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -87,51 +92,54 @@ namespace ProcessHacker.Native.Objects
public void Clear()
{
- Win32.NtClearEvent(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtClearEvent(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
- public EventBasicInformation BasicInformation
+ public EventBasicInformation GetBasicInformation()
{
- get
- {
- EventBasicInformation ebi;
- int retLength;
+ NtStatus status;
+ EventBasicInformation ebi;
+ int retLength;
- Win32.NtQueryEvent(
- this,
- EventInformationClass.EventBasicInformation,
- out ebi,
- EventBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryEvent(this, EventInformationClass.EventBasicInformation,
+ out ebi, Marshal.SizeOf(typeof(EventBasicInformation)), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
- return ebi;
- }
+ return ebi;
}
public int Pulse()
{
+ NtStatus status;
int previousState;
- Win32.NtPulseEvent(this, out previousState).ThrowIf();
+ if ((status = Win32.NtPulseEvent(this, out previousState)) >= NtStatus.Error)
+ Win32.Throw(status);
return previousState;
}
public int Reset()
{
+ NtStatus status;
int previousState;
- Win32.NtResetEvent(this, out previousState).ThrowIf();
+ if ((status = Win32.NtResetEvent(this, out previousState)) >= NtStatus.Error)
+ Win32.Throw(status);
return previousState;
}
public int Set()
{
+ NtStatus status;
int previousState;
- Win32.NtSetEvent(this, out previousState).ThrowIf();
+ if ((status = Win32.NtSetEvent(this, out previousState)) >= NtStatus.Error)
+ Win32.Throw(status);
return previousState;
}
@@ -142,7 +150,10 @@ namespace ProcessHacker.Native.Objects
///
public void SetBoostPriority()
{
- Win32.NtSetEventBoostPriority(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSetEventBoostPriority(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/EventPairHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/EventPairHandle.cs
index 23d923147..f562dc5e4 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/EventPairHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/EventPairHandle.cs
@@ -56,12 +56,14 @@ namespace ProcessHacker.Native.Objects
/// A handle to an event pair.
public static EventPairHandle Create(EventPairAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateEventPair(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtCreateEventPair(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -91,12 +93,14 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the event pair.
public EventPairHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, EventPairAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenEventPair(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenEventPair(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -115,7 +119,10 @@ namespace ProcessHacker.Native.Objects
///
public void SetHigh()
{
- Win32.NtSetHighEventPair(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSetHighEventPair(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -123,7 +130,12 @@ namespace ProcessHacker.Native.Objects
///
public NtStatus SetHighWaitLow()
{
- return Win32.NtSetHighWaitLowEventPair(this);
+ NtStatus status;
+
+ if ((status = Win32.NtSetHighWaitLowEventPair(this)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
///
@@ -131,7 +143,10 @@ namespace ProcessHacker.Native.Objects
///
public void SetLow()
{
- Win32.NtSetLowEventPair(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSetLowEventPair(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -139,7 +154,12 @@ namespace ProcessHacker.Native.Objects
///
public NtStatus SetLowWaitHigh()
{
- return Win32.NtSetLowWaitHighEventPair(this);
+ NtStatus status;
+
+ if ((status = Win32.NtSetLowWaitHighEventPair(this)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
///
@@ -147,7 +167,12 @@ namespace ProcessHacker.Native.Objects
///
public NtStatus WaitHigh()
{
- return Win32.NtWaitHighEventPair(this);
+ NtStatus status;
+
+ if ((status = Win32.NtWaitHighEventPair(this)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
///
@@ -155,7 +180,12 @@ namespace ProcessHacker.Native.Objects
///
public NtStatus WaitLow()
{
- return Win32.NtWaitLowEventPair(this);
+ NtStatus status;
+
+ if ((status = Win32.NtWaitLowEventPair(this)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/FileHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/FileHandle.cs
index 460b988aa..43d833d12 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/FileHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/FileHandle.cs
@@ -126,13 +126,14 @@ namespace ProcessHacker.Native.Objects
out FileIoStatus ioStatus
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, rootDirectory);
IoStatusBlock isb;
IntPtr handle;
try
{
- Win32.NtCreateFile(
+ if ((status = Win32.NtCreateFile(
out handle,
access,
ref oa,
@@ -144,7 +145,8 @@ namespace ProcessHacker.Native.Objects
createOptions,
IntPtr.Zero,
0
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
ioStatus = (FileIoStatus)isb.Information.ToInt32();
}
@@ -166,11 +168,14 @@ namespace ProcessHacker.Native.Objects
return CreateWin32(fileName, desiredAccess, shareMode, FileCreationDispositionWin32.OpenAlways);
}
- public static FileHandle CreateWin32(string fileName, FileAccess desiredAccess, FileShareMode shareMode, FileCreationDispositionWin32 creationDisposition)
+ public static FileHandle CreateWin32(string fileName, FileAccess desiredAccess, FileShareMode shareMode,
+ FileCreationDispositionWin32 creationDisposition)
{
- IntPtr handle = Win32.CreateFile(fileName, desiredAccess, shareMode, 0, creationDisposition, 0, IntPtr.Zero);
+ IntPtr handle;
+
+ handle = Win32.CreateFile(fileName, desiredAccess, shareMode, 0, creationDisposition, 0, IntPtr.Zero);
- if (handle != MinusOne)
+ if (handle == NativeHandle.MinusOne)
Win32.Throw();
return new FileHandle(handle, true);
@@ -178,11 +183,13 @@ namespace ProcessHacker.Native.Objects
public static void Delete(string fileName, ObjectFlags objectFlags)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, null);
try
{
- Win32.NtDeleteFile(ref oa).ThrowIf();
+ if ((status = Win32.NtDeleteFile(ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -257,20 +264,22 @@ namespace ProcessHacker.Native.Objects
FileAccess access
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, rootDirectory);
IoStatusBlock isb;
IntPtr handle;
try
{
- Win32.NtOpenFile(
+ if ((status = Win32.NtOpenFile(
out handle,
access,
ref oa,
out isb,
shareMode,
openOptions
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -474,9 +483,11 @@ namespace ProcessHacker.Native.Objects
public void BeginLock(AsyncIoContext asyncContext, long offset, long length, bool wait, bool exclusive)
{
+ NtStatus status;
+
asyncContext.NotifyPreBegin();
- NtStatus status = Win32.NtLockFile(
+ status = Win32.NtLockFile(
this,
asyncContext.EventHandle ?? IntPtr.Zero,
null,
@@ -506,13 +517,14 @@ namespace ProcessHacker.Native.Objects
public void BeginRead(AsyncIoContext asyncContext, long fileOffset, byte[] buffer, int offset, int length)
{
- Utils.ValidateBuffer(buffer, offset, length);
+ PinnedObject pinnedBuffer;
+ Utils.ValidateBuffer(buffer, offset, length);
asyncContext.NotifyPreBegin();
// Pin the buffer because the I/O system may be writing to it after
// this call returns.
- PinnedObject pinnedBuffer = new PinnedObject(buffer);
+ pinnedBuffer = new PinnedObject(buffer);
asyncContext.KeepAlive(pinnedBuffer);
this.BeginRead(asyncContext, fileOffset, pinnedBuffer.Address.Increment(offset), length);
}
@@ -560,13 +572,13 @@ namespace ProcessHacker.Native.Objects
public void BeginWrite(AsyncIoContext asyncContext, long fileOffset, byte[] buffer, int offset, int length)
{
- Utils.ValidateBuffer(buffer, offset, length);
+ PinnedObject pinnedBuffer;
+ Utils.ValidateBuffer(buffer, offset, length);
asyncContext.NotifyPreBegin();
- PinnedObject pinnedBuffer = new PinnedObject(buffer);
+ pinnedBuffer = new PinnedObject(buffer);
asyncContext.KeepAlive(pinnedBuffer);
-
this.BeginWrite(asyncContext, fileOffset, pinnedBuffer.Address.Increment(offset), length);
}
@@ -612,9 +624,11 @@ namespace ProcessHacker.Native.Objects
/// An I/O status block.
public IoStatusBlock CancelIo()
{
+ NtStatus status;
IoStatusBlock isb;
- Win32.NtCancelIoFile(this, out isb).ThrowIf();
+ if ((status = Win32.NtCancelIoFile(this, out isb)) >= NtStatus.Error)
+ Win32.Throw(status);
return isb;
}
@@ -624,10 +638,10 @@ namespace ProcessHacker.Native.Objects
///
public void Delete()
{
- this.SetStruct(FileInformationClass.FileDispositionInformation, FileDispositionInformation.SizeOf, new FileDispositionInformation
- {
- DeleteFile = true
- });
+ this.SetStruct(
+ FileInformationClass.FileDispositionInformation,
+ new FileDispositionInformation() { DeleteFile = true }
+ );
}
///
@@ -640,7 +654,8 @@ namespace ProcessHacker.Native.Objects
asyncContext.Wait();
asyncContext.NotifyEnd();
- asyncContext.Status.ThrowIf();
+ if (asyncContext.Status >= NtStatus.Error)
+ Win32.Throw(asyncContext.Status);
return asyncContext.StatusBlock.Information.ToInt32();
}
@@ -678,7 +693,8 @@ namespace ProcessHacker.Native.Objects
if (asyncContext.Status == NtStatus.LockNotGranted)
return false;
- asyncContext.Status.ThrowIf();
+ if (asyncContext.Status >= NtStatus.Error)
+ Win32.Throw(asyncContext.Status);
return true;
}
@@ -780,7 +796,8 @@ namespace ProcessHacker.Native.Objects
break;
// Handle any errors.
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
// Read the list of files we got in this batch.
@@ -788,8 +805,7 @@ namespace ProcessHacker.Native.Objects
while (true)
{
- FileDirectoryInformation info = data.ReadStruct(i, FileDirectoryInformation.SizeOf, 0);
-
+ FileDirectoryInformation info = data.ReadStruct(i, 0);
string name = data.ReadUnicodeString(
i + FileDirectoryInformation.FileNameOffset,
info.FileNameLength / 2
@@ -810,8 +826,8 @@ namespace ProcessHacker.Native.Objects
if (info.NextEntryOffset == 0)
break;
-
- i += info.NextEntryOffset;
+ else
+ i += info.NextEntryOffset;
}
firstTime = false;
@@ -833,13 +849,13 @@ namespace ProcessHacker.Native.Objects
/// The callback function to use.
public void EnumStreams(EnumStreamsDelegate callback)
{
- using (MemoryAlloc data = this.QueryVariableSize(FileInformationClass.FileStreamInformation))
+ using (var data = this.QueryVariableSize(FileInformationClass.FileStreamInformation))
{
int i = 0;
while (true)
{
- FileStreamInformation info = data.ReadStruct(i, FileStreamInformation.SizeOf, 0);
+ FileStreamInformation info = data.ReadStruct(i, 0);
string name = data.ReadUnicodeString(
i + FileStreamInformation.StreamNameOffset,
info.StreamNameLength / 2
@@ -850,8 +866,8 @@ namespace ProcessHacker.Native.Objects
if (info.NextEntryOffset == 0)
break;
-
- i += info.NextEntryOffset;
+ else
+ i += info.NextEntryOffset;
}
}
}
@@ -861,9 +877,10 @@ namespace ProcessHacker.Native.Objects
///
public void Flush()
{
+ NtStatus status;
IoStatusBlock isb;
- NtStatus status = Win32.NtFlushBuffersFile(
+ status = Win32.NtFlushBuffersFile(
this,
out isb
);
@@ -874,7 +891,8 @@ namespace ProcessHacker.Native.Objects
status = isb.Status;
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -945,9 +963,13 @@ namespace ProcessHacker.Native.Objects
int outBufferLength
)
{
+ NtStatus status;
int returnLength;
- this.FsControl(controlCode, inBuffer, inBufferLength, outBuffer, outBufferLength, out returnLength).ThrowIf();
+ status = this.FsControl(controlCode, inBuffer, inBufferLength, outBuffer, outBufferLength, out returnLength);
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return returnLength;
}
@@ -961,9 +983,10 @@ namespace ProcessHacker.Native.Objects
out int returnLength
)
{
+ NtStatus status;
IoStatusBlock isb;
- NtStatus status = Win32.NtFsControlFile(
+ status = Win32.NtFsControlFile(
this,
IntPtr.Zero,
null,
@@ -992,37 +1015,34 @@ namespace ProcessHacker.Native.Objects
/// Gets the attributes of the file.
///
/// The attributes of the file.
- public FileAttributes Attributes
+ public FileAttributes GetAttributes()
{
- get { return this.BasicInformation.FileAttributes; }
+ return this.GetBasicInformation().FileAttributes;
}
///
/// Gets basic information about the file.
///
/// Basic information about the file.
- public FileBasicInformation BasicInformation
+ public FileBasicInformation GetBasicInformation()
{
- get { return this.QueryStruct(FileInformationClass.FileBasicInformation, FileBasicInformation.SizeOf); }
+ return this.QueryStruct(FileInformationClass.FileBasicInformation);
}
///
/// Gets the partial name of the file.
///
/// The name of the file, relative to its volume.
- public string FileName
+ public string GetFileName()
{
- get
+ using (var data = this.QueryVariableSize(FileInformationClass.FileNameInformation))
{
- using (MemoryAlloc data = this.QueryVariableSize(FileInformationClass.FileNameInformation))
- {
- FileNameInformation info = data.ReadStruct(0, FileNameInformation.SizeOf, 0);
+ FileNameInformation info = data.ReadStruct();
- return data.ReadUnicodeString(
- FileNameInformation.FileNameOffset,
- info.FileNameLength/2
- );
- }
+ return data.ReadUnicodeString(
+ FileNameInformation.FileNameOffset,
+ info.FileNameLength / 2
+ );
}
}
@@ -1030,9 +1050,9 @@ namespace ProcessHacker.Native.Objects
/// Gets a list of the files contained in the directory.
///
/// An array of file information structures.
- public FileEntry[] Files
+ public FileEntry[] GetFiles()
{
- get { return this.GetFiles(null); }
+ return this.GetFiles(null);
}
///
@@ -1049,7 +1069,7 @@ namespace ProcessHacker.Native.Objects
{
List files = new List();
- this.EnumFiles(file =>
+ this.EnumFiles((file) =>
{
files.Add(file);
return true;
@@ -1062,15 +1082,9 @@ namespace ProcessHacker.Native.Objects
/// Gets the current position.
///
/// A byte offset from the beginning of the file.
- public long Position
+ public long GetPosition()
{
- get
- {
- return this.QueryStruct(
- FileInformationClass.FilePositionInformation,
- FilePositionInformation.SizeOf
- ).CurrentByteOffset;
- }
+ return this.QueryStruct(FileInformationClass.FilePositionInformation).CurrentByteOffset;
}
///
@@ -1081,7 +1095,7 @@ namespace ProcessHacker.Native.Objects
{
List streams = new List();
- this.EnumStreams(file =>
+ this.EnumStreams((file) =>
{
streams.Add(file);
return true;
@@ -1094,53 +1108,46 @@ namespace ProcessHacker.Native.Objects
/// Gets the size of the file.
///
/// The size of the file.
- public long FileSize
+ public long GetSize()
{
- get { return this.StandardInformation.EndOfFile; }
+ return this.GetStandardInformation().EndOfFile;
}
///
/// Gets standard information about the file.
///
/// Standard information about the file.
- public FileStandardInformation StandardInformation
+ public FileStandardInformation GetStandardInformation()
{
- get
- {
- return this.QueryStruct(
- FileInformationClass.FileStandardInformation,
- FileStandardInformation.SizeOf
- );
- }
+ return this.QueryStruct(FileInformationClass.FileStandardInformation);
}
///
/// Gets the file system name of the file's associated volume.
///
/// The volume's file system name.
- public string VolumeFsName
+ public string GetVolumeFsName()
{
- get
+ NtStatus status;
+ IoStatusBlock isb;
+
+ using (var data = new MemoryAlloc(0x200))
{
- IoStatusBlock isb;
+ if ((status = Win32.NtQueryVolumeInformationFile(
+ this,
+ out isb,
+ data,
+ data.Size,
+ FsInformationClass.FileFsAttributeInformation
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- using (MemoryAlloc data = new MemoryAlloc(0x200))
- {
- Win32.NtQueryVolumeInformationFile(
- this,
- out isb,
- data,
- data.Size,
- FsInformationClass.FileFsAttributeInformation
- ).ThrowIf();
+ FileFsAttributeInformation info = data.ReadStruct();
- FileFsAttributeInformation info = data.ReadStruct(0, FileFsAttributeInformation.SizeOf, 0);
-
- return Marshal.PtrToStringUni(
- data.Memory.Increment(FileFsAttributeInformation.FileSystemNameOffset),
- info.FileSystemNameLength/2
- );
- }
+ return Marshal.PtrToStringUni(
+ data.Memory.Increment(Marshal.OffsetOf(typeof(FileFsAttributeInformation), "FileSystemName")),
+ info.FileSystemNameLength / 2
+ );
}
}
@@ -1148,29 +1155,28 @@ namespace ProcessHacker.Native.Objects
/// Gets the label of the file's associated volume.
///
/// The volume label.
- public string VolumeLabel
+ public string GetVolumeLabel()
{
- get
+ NtStatus status;
+ IoStatusBlock isb;
+
+ using (var data = new MemoryAlloc(0x200))
{
- using (MemoryAlloc data = new MemoryAlloc(0x200))
- {
- IoStatusBlock isb;
+ if ((status = Win32.NtQueryVolumeInformationFile(
+ this,
+ out isb,
+ data,
+ data.Size,
+ FsInformationClass.FileFsVolumeInformation
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- Win32.NtQueryVolumeInformationFile(
- this,
- out isb,
- data,
- data.Size,
- FsInformationClass.FileFsVolumeInformation
- ).ThrowIf();
+ FileFsVolumeInformation info = data.ReadStruct();
- FileFsVolumeInformation info = data.ReadStruct();
-
- return Marshal.PtrToStringUni(
- data.Memory.Increment(FileFsVolumeInformation.VolumeLabelOffset),
- info.VolumeLabelLength/2
- );
- }
+ return Marshal.PtrToStringUni(
+ data.Memory.Increment(Marshal.OffsetOf(typeof(FileFsVolumeInformation), "VolumeLabel")),
+ info.VolumeLabelLength / 2
+ );
}
}
@@ -1261,9 +1267,13 @@ namespace ProcessHacker.Native.Objects
int outBufferLength
)
{
+ NtStatus status;
int returnLength;
- this.IoControl(controlCode, inBuffer, inBufferLength, outBuffer, outBufferLength, out returnLength).ThrowIf();
+ status = this.IoControl(controlCode, inBuffer, inBufferLength, outBuffer, outBufferLength, out returnLength);
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return returnLength;
}
@@ -1277,9 +1287,10 @@ namespace ProcessHacker.Native.Objects
out int returnLength
)
{
+ NtStatus status;
IoStatusBlock isb;
- NtStatus status = Win32.NtDeviceIoControlFile(
+ status = Win32.NtDeviceIoControlFile(
this,
IntPtr.Zero,
null,
@@ -1345,9 +1356,10 @@ namespace ProcessHacker.Native.Objects
/// True if the lock was acquired, otherwise false.
public bool Lock(long offset, long length, bool wait, bool exclusive)
{
+ NtStatus status;
IoStatusBlock isb;
- NtStatus status = Win32.NtLockFile(
+ status = Win32.NtLockFile(
this,
IntPtr.Zero,
null,
@@ -1369,26 +1381,30 @@ namespace ProcessHacker.Native.Objects
if (status == NtStatus.LockNotGranted)
return false;
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return true;
}
- protected T QueryStruct(FileInformationClass infoClass, int size) where T : struct
+ protected T QueryStruct(FileInformationClass infoClass)
+ where T : struct
{
- using (MemoryAlloc data = new MemoryAlloc(size))
+ NtStatus status;
+ IoStatusBlock isb;
+
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(T))))
{
- IoStatusBlock isb;
-
- Win32.NtQueryInformationFile(
+ if ((status = Win32.NtQueryInformationFile(
this,
out isb,
data,
data.Size,
infoClass
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return data.ReadStruct(0, size, 0);
+ return data.ReadStruct();
}
}
@@ -1396,7 +1412,7 @@ namespace ProcessHacker.Native.Objects
{
NtStatus status;
IoStatusBlock isb;
- MemoryAlloc data = new MemoryAlloc(0x200);
+ var data = new MemoryAlloc(0x200);
while (true)
{
@@ -1418,7 +1434,7 @@ namespace ProcessHacker.Native.Objects
break;
}
- if (status.IsError())
+ if (status >= NtStatus.Error)
{
data.Dispose();
Win32.Throw(status);
@@ -1560,7 +1576,8 @@ namespace ProcessHacker.Native.Objects
status = isb.Status;
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return isb.Information.ToInt32();
}
@@ -1571,10 +1588,10 @@ namespace ProcessHacker.Native.Objects
/// A byte offset from the beginning of the file.
public void SetEnd(long offset)
{
- this.SetStruct(FileInformationClass.FileEndOfFileInformation, FileEndOfFileInformation.SizeOf, new FileEndOfFileInformation
- {
- EndOfFile = offset
- });
+ this.SetStruct(
+ FileInformationClass.FileEndOfFileInformation,
+ new FileEndOfFileInformation() { EndOfFile = offset }
+ );
}
///
@@ -1602,13 +1619,11 @@ namespace ProcessHacker.Native.Objects
/// A key to associate with the file object.
public void SetIoCompletion(IoCompletionHandle ioCompletionHandle, IntPtr keyContext)
{
- FileCompletionInformation info = new FileCompletionInformation
- {
- Port = ioCompletionHandle,
- Key = keyContext
- };
+ FileCompletionInformation info = new FileCompletionInformation();
- this.SetStruct(FileInformationClass.FileCompletionInformation, FileCompletionInformation.SizeOf, info);
+ info.Port = ioCompletionHandle;
+ info.Key = keyContext;
+ this.SetStruct(FileInformationClass.FileCompletionInformation, info);
}
///
@@ -1617,10 +1632,10 @@ namespace ProcessHacker.Native.Objects
/// A byte offset from the beginning of the file.
public void SetPosition(long offset)
{
- this.SetStruct(FileInformationClass.FilePositionInformation, FilePositionInformation.SizeOf, new FilePositionInformation
- {
- CurrentByteOffset = offset
- });
+ this.SetStruct(
+ FileInformationClass.FilePositionInformation,
+ new FilePositionInformation() { CurrentByteOffset = offset }
+ );
}
///
@@ -1632,7 +1647,7 @@ namespace ProcessHacker.Native.Objects
{
long currentPosition;
- currentPosition = this.Position;
+ currentPosition = this.GetPosition();
switch (origin)
{
@@ -1643,7 +1658,7 @@ namespace ProcessHacker.Native.Objects
currentPosition = offset;
break;
case PositionOrigin.End:
- currentPosition = this.FileSize + offset;
+ currentPosition = this.GetSize() + offset;
break;
}
@@ -1652,21 +1667,24 @@ namespace ProcessHacker.Native.Objects
return currentPosition;
}
- protected void SetStruct(FileInformationClass infoClass, int size, T info) where T : struct
+ protected void SetStruct(FileInformationClass infoClass, T info)
+ where T : struct
{
- using (MemoryAlloc data = new MemoryAlloc(size))
+ NtStatus status;
+ IoStatusBlock isb;
+
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(T))))
{
- data.WriteStruct(info);
+ data.WriteStruct(info);
- IoStatusBlock isb;
-
- Win32.NtSetInformationFile(
+ if ((status = Win32.NtSetInformationFile(
this,
out isb,
data,
data.Size,
infoClass
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
@@ -1677,15 +1695,19 @@ namespace ProcessHacker.Native.Objects
/// The length of the byte range.
public void Unlock(long offset, long length)
{
+ NtStatus status;
IoStatusBlock isb;
- Win32.NtUnlockFile(
+ status = Win32.NtUnlockFile(
this,
out isb,
ref offset,
ref length,
0
- ).ThrowIf();
+ );
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -1807,7 +1829,8 @@ namespace ProcessHacker.Native.Objects
status = isb.Status;
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return isb.Information.ToInt32();
}
@@ -1828,7 +1851,7 @@ namespace ProcessHacker.Native.Objects
public sealed class AsyncIoCompletionPort : IDisposable
{
- private readonly IoCompletionHandle _ioCompletionHandle;
+ private IoCompletionHandle _ioCompletionHandle;
public AsyncIoCompletionPort()
: this(0)
@@ -1856,17 +1879,19 @@ namespace ProcessHacker.Native.Objects
public AsyncIoContext Remove(long timeout, bool relative)
{
+ bool result;
+ AsyncIoContext asyncContext;
IoStatusBlock isb;
IntPtr keyContext;
IntPtr apcContext;
- bool result = this._ioCompletionHandle.Remove(out isb, out keyContext, out apcContext, relative ? -timeout : timeout, false);
+ result = _ioCompletionHandle.Remove(out isb, out keyContext, out apcContext, relative ? -timeout : timeout, false);
// Fail?
if (!result)
return null;
- AsyncIoContext asyncContext = AsyncIoContext.GetAsyncIoContext(apcContext);
+ asyncContext = AsyncIoContext.GetAsyncIoContext(apcContext);
asyncContext.NotifyEnd();
return asyncContext;
@@ -1885,17 +1910,19 @@ namespace ProcessHacker.Native.Objects
{
private unsafe sealed class UnmanagedIsb : BaseObject
{
+ private static readonly int _isbSize = Marshal.SizeOf(typeof(IoStatusBlock));
+
public static implicit operator IntPtr(UnmanagedIsb isb)
{
return isb.Memory;
}
- private readonly IoStatusBlock* _ioStatusBlock;
+ private IoStatusBlock* _ioStatusBlock;
public UnmanagedIsb()
{
// Allocate an ISB.
- _ioStatusBlock = (IoStatusBlock*)MemoryAlloc.PrivateHeap.Allocate(IoStatusBlock.SizeOf);
+ _ioStatusBlock = (IoStatusBlock*)MemoryAlloc.PrivateHeap.Allocate(0, _isbSize);
// Zero the ISB.
_ioStatusBlock->Pointer = IntPtr.Zero;
_ioStatusBlock->Information = IntPtr.Zero;
@@ -1905,7 +1932,7 @@ namespace ProcessHacker.Native.Objects
protected override void DisposeObject(bool disposing)
{
if (_ioStatusBlock != null)
- MemoryAlloc.PrivateHeap.Free(new IntPtr(_ioStatusBlock));
+ MemoryAlloc.PrivateHeap.Free(0, new IntPtr(_ioStatusBlock));
}
public IntPtr Information
@@ -1944,12 +1971,12 @@ namespace ProcessHacker.Native.Objects
}
private IntPtr _context = IntPtr.Zero;
- private readonly EventHandle _eventHandle;
- private readonly UnmanagedIsb _isb;
- private bool _completedSynchronously;
- private bool _started;
+ private EventHandle _eventHandle = null;
+ private UnmanagedIsb _isb;
+ private bool _completedSynchronously = false;
+ private bool _started = false;
- private List _keepAliveList;
+ private List _keepAliveList = null;
private object _tag;
public AsyncIoContext()
@@ -1958,10 +1985,8 @@ namespace ProcessHacker.Native.Objects
public AsyncIoContext(AsyncIoMethod method)
{
- _isb = new UnmanagedIsb
- {
- Status = NtStatus.Pending
- };
+ _isb = new UnmanagedIsb();
+ _isb.Status = NtStatus.Pending;
if (method == AsyncIoMethod.Event)
{
@@ -1990,16 +2015,6 @@ namespace ProcessHacker.Native.Objects
_eventHandle.Dispose();
if (_isb != null)
_isb.Dispose();
-
- if (_context != IntPtr.Zero)
- {
- GCHandle handle = GCHandle.FromIntPtr(_context);
-
- if (handle.IsAllocated)
- handle.Free();
-
- _context = IntPtr.Zero;
- }
}
public bool Cancelled
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/IoCompletionHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/IoCompletionHandle.cs
index 943b5a341..e71db55b9 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/IoCompletionHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/IoCompletionHandle.cs
@@ -21,7 +21,10 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
+using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
namespace ProcessHacker.Native.Objects
@@ -45,12 +48,14 @@ namespace ProcessHacker.Native.Objects
public static IoCompletionHandle Create(IoCompletionAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, int count)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateIoCompletion(out handle, access, ref oa, count).ThrowIf();
+ if ((status = Win32.NtCreateIoCompletion(out handle, access, ref oa, count)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -66,12 +71,14 @@ namespace ProcessHacker.Native.Objects
public IoCompletionHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, IoCompletionAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenIoCompletion(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenIoCompletion(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -92,20 +99,23 @@ namespace ProcessHacker.Native.Objects
public bool Remove(out IoStatusBlock isb, out IntPtr keyContext, out IntPtr apcContext, long timeout, bool relative)
{
+ NtStatus status;
long realTimeout = relative ? -timeout : timeout;
- return Win32.NtRemoveIoCompletion(this, out keyContext, out apcContext, out isb, ref realTimeout) != NtStatus.Timeout;
+ if ((status = Win32.NtRemoveIoCompletion(
+ this, out keyContext, out apcContext, out isb, ref realTimeout)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status != NtStatus.Timeout;
}
public void Set(IntPtr keyContext, IntPtr apcContext, NtStatus ioStatus, IntPtr ioInformation)
{
- Win32.NtSetIoCompletion(
- this,
- keyContext,
- apcContext,
- ioStatus,
- ioInformation
- ).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSetIoCompletion(
+ this, keyContext, apcContext, ioStatus, ioInformation)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs
index 43f2d1df3..9d4f242ee 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -44,16 +45,18 @@ namespace ProcessHacker.Native.Objects
public static JobObjectHandle Create(JobObjectAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateJobObject(
+ if ((status = Win32.NtCreateJobObject(
out handle,
access,
ref oa
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -67,15 +70,17 @@ namespace ProcessHacker.Native.Objects
{
try
{
- return KProcessHacker2.Instance.KphOpenProcessJob(processHandle, (TokenAccess)access);
+ return new IntPtr(KProcessHacker.Instance.KphOpenProcessJob(processHandle, access));
}
catch (WindowsException)
{
+ IntPtr handle;
+
// Use KPH to set the handle's granted access.
- IntPtr handle = KProcessHacker2.Instance.KphOpenProcessJob(processHandle, (TokenAccess)StandardRights.Synchronize);
-
- //if (handle != IntPtr.Zero)
- //KProcessHacker2.Instance.KphSetHandleGrantedAccess(handle, (int)access);
+ handle = new IntPtr(KProcessHacker.Instance.KphOpenProcessJob(processHandle,
+ (JobObjectAccess)StandardRights.Synchronize));
+ if (handle != IntPtr.Zero)
+ KProcessHacker.Instance.KphSetHandleGrantedAccess(handle, (int)access);
return handle;
}
@@ -102,16 +107,18 @@ namespace ProcessHacker.Native.Objects
public JobObjectHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, JobObjectAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenJobObject(
+ if ((status = Win32.NtOpenJobObject(
out handle,
access,
ref oa
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -138,80 +145,80 @@ namespace ProcessHacker.Native.Objects
}
}
+ private T QueryStruct(JobObjectInformationClass informationClass)
+ where T : struct
+ {
+ int retLength;
+
+ using (MemoryAlloc data = new MemoryAlloc(Marshal.SizeOf(typeof(T))))
+ {
+ if (!Win32.QueryInformationJobObject(this, informationClass, data, data.Size, out retLength))
+ {
+ data.ResizeNew(retLength);
+
+ if (!Win32.QueryInformationJobObject(this, informationClass, data, data.Size, out retLength))
+ Win32.Throw();
+ }
+
+ return data.ReadStruct();
+ }
+ }
+
public JobObjectBasicAccountingInformation GetBasicAccountingInformation()
{
return this.QueryStruct(
- JobObjectInformationClass.JobObjectBasicAccountingInformation,
- JobObjectBasicAccountingInformation.SizeOf
- );
+ JobObjectInformationClass.JobObjectBasicAccountingInformation);
}
public JobObjectBasicAndIoAccountingInformation GetBasicAndIoAccountingInformation()
{
return this.QueryStruct(
- JobObjectInformationClass.JobObjectBasicAndIoAccountingInformation,
- JobObjectBasicAndIoAccountingInformation.SizeOf
- );
+ JobObjectInformationClass.JobObjectBasicAndIoAccountingInformation);
}
- public JobObjectBasicLimitInformation BasicLimitInformation
+ public JobObjectBasicLimitInformation GetBasicLimitInformation()
{
- get { return this.QueryStruct(
- JobObjectInformationClass.JobObjectBasicLimitInformation,
- JobObjectBasicLimitInformation.SizeOf
- );
- }
+ return this.QueryStruct(JobObjectInformationClass.JobObjectBasicLimitInformation);
}
- public JobObjectBasicUiRestrictions BasicUiRestrictions
+ public int[] GetProcessIdList()
{
- get
+ List processIds = new List();
+ int retLength;
+
+ // FIXME: Fixed buffer
+ using (MemoryAlloc data = new MemoryAlloc(0x1000))
{
- JobObjectBasicUiRestrictions uiRestrictions;
- int retLength;
-
- if (!Win32.QueryInformationJobObject(this, JobObjectInformationClass.JobObjectBasicUIRestrictions, out uiRestrictions, 4, out retLength))
+ if (!Win32.QueryInformationJobObject(this, JobObjectInformationClass.JobObjectBasicProcessIdList,
+ data, data.Size, out retLength))
Win32.Throw();
- return uiRestrictions;
- }
- }
+ JobObjectBasicProcessIdList listInfo = data.ReadStruct();
- public JobObjectExtendedLimitInformation ExtendedLimitInformation
- {
- get
- {
- return this.QueryStruct(
- JobObjectInformationClass.JobObjectExtendedLimitInformation,
- JobObjectExtendedLimitInformation.SizeOf
- );
- }
- }
-
- public int[] ProcessIdList
- {
- get
- {
- List processIds = new List();
- int retLength;
-
- // FIXME: Fixed buffer
- using (MemoryAlloc data = new MemoryAlloc(0x1000))
+ for (int i = 0; i < listInfo.NumberOfProcessIdsInList; i++)
{
- if (!Win32.QueryInformationJobObject(this, JobObjectInformationClass.JobObjectBasicProcessIdList,
- data, data.Size, out retLength))
- Win32.Throw();
-
- JobObjectBasicProcessIdList listInfo = data.ReadStruct();
-
- for (int i = 0; i < listInfo.NumberOfProcessIdsInList; i++)
- {
- processIds.Add(data.ReadInt32(8, i));
- }
+ processIds.Add(data.ReadInt32(8, i));
}
-
- return processIds.ToArray();
}
+
+ return processIds.ToArray();
+ }
+
+ public JobObjectBasicUiRestrictions GetBasicUiRestrictions()
+ {
+ JobObjectBasicUiRestrictions uiRestrictions;
+ int retLength;
+
+ if (!Win32.QueryInformationJobObject(this, JobObjectInformationClass.JobObjectBasicUIRestrictions,
+ out uiRestrictions, 4, out retLength))
+ Win32.Throw();
+
+ return uiRestrictions;
+ }
+
+ public JobObjectExtendedLimitInformation GetExtendedLimitInformation()
+ {
+ return this.QueryStruct(JobObjectInformationClass.JobObjectExtendedLimitInformation);
}
public void Terminate()
@@ -224,26 +231,5 @@ namespace ProcessHacker.Native.Objects
if (!Win32.TerminateJobObject(this, exitCode))
Win32.Throw();
}
-
- private T QueryStruct(JobObjectInformationClass informationClass, int size) where T : struct
- {
- int retLength;
-
- using (MemoryAlloc data = new MemoryAlloc(size))
- {
- bool ret = Win32.QueryInformationJobObject(this, informationClass, data, data.Size, out retLength);
- int res = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
-
- if (!Win32.QueryInformationJobObject(this, informationClass, data, data.Size, out retLength))
- {
- data.ResizeNew(retLength);
-
- if (!Win32.QueryInformationJobObject(this, informationClass, data, data.Size, out retLength))
- Win32.Throw();
- }
-
- return data.ReadStruct();
- }
- }
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/KeyHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/KeyHandle.cs
index 5e8603325..1c075c886 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/KeyHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/KeyHandle.cs
@@ -21,6 +21,9 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -59,12 +62,13 @@ namespace ProcessHacker.Native.Objects
out KeyCreationDisposition creationDisposition
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateKey(
+ if ((status = Win32.NtCreateKey(
out handle,
access,
ref oa,
@@ -72,7 +76,8 @@ namespace ProcessHacker.Native.Objects
IntPtr.Zero,
createOptions,
out creationDisposition
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -92,16 +97,18 @@ namespace ProcessHacker.Native.Objects
public KeyHandle(string name, ObjectFlags objectFlags, KeyHandle rootDirectory, KeyAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenKey(
+ if ((status = Win32.NtOpenKey(
out handle,
access,
ref oa
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -113,16 +120,21 @@ namespace ProcessHacker.Native.Objects
public void Delete()
{
- Win32.NtDeleteKey(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtDeleteKey(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void DeleteValue(string name)
{
+ NtStatus status;
UnicodeString nameStr = new UnicodeString(name);
try
{
- Win32.NtDeleteValueKey(this, ref nameStr).ThrowIf();
+ if ((status = Win32.NtDeleteValueKey(this, ref nameStr)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/KeyedEventHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/KeyedEventHandle.cs
index af0e11d82..0cd6de4bb 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/KeyedEventHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/KeyedEventHandle.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -40,12 +42,14 @@ namespace ProcessHacker.Native.Objects
public static KeyedEventHandle Create(KeyedEventAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateKeyedEvent(out handle, access, ref oa, 0).ThrowIf();
+ if ((status = Win32.NtCreateKeyedEvent(out handle, access, ref oa, 0)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -65,12 +69,14 @@ namespace ProcessHacker.Native.Objects
public KeyedEventHandle(string name, DirectoryHandle rootDirectory, ObjectFlags objectFlags, KeyedEventAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenKeyedEvent(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenKeyedEvent(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -102,17 +108,21 @@ namespace ProcessHacker.Native.Objects
public NtStatus ReleaseKey(IntPtr key, bool alertable, long timeout, bool relative)
{
+ NtStatus status;
long realTimeout = relative ? -timeout : timeout;
if (key.ToInt64() % 2 != 0)
throw new ArgumentException("Key must be divisible by 2.");
- return Win32.NtReleaseKeyedEvent(
+ if ((status = Win32.NtReleaseKeyedEvent(
this,
key,
alertable,
ref realTimeout
- );
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
public NtStatus WaitKey(int key)
@@ -137,17 +147,21 @@ namespace ProcessHacker.Native.Objects
public NtStatus WaitKey(IntPtr key, bool alertable, long timeout, bool relative)
{
+ NtStatus status;
long realTimeout = relative ? -timeout : timeout;
if (key.ToInt64() % 2 != 0)
throw new ArgumentException("Key must be divisible by 2.");
- return Win32.NtWaitForKeyedEvent(
+ if ((status = Win32.NtWaitForKeyedEvent(
this,
key,
alertable,
ref realTimeout
- );
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/LsaAccountHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/LsaAccountHandle.cs
index 3785068a0..305b6e51d 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/LsaAccountHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/LsaAccountHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -33,14 +34,16 @@ namespace ProcessHacker.Native.Objects
{
public static LsaAccountHandle Create(LsaAccountAccess access, LsaPolicyHandle policyHandle, Sid sid)
{
+ NtStatus status;
IntPtr handle;
- Win32.LsaCreateAccount(
+ if ((status = Win32.LsaCreateAccount(
policyHandle,
sid,
access,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new LsaAccountHandle(handle, true);
}
@@ -57,14 +60,16 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the account.
public LsaAccountHandle(LsaPolicyHandle policyHandle, Sid sid, LsaAccountAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.LsaOpenAccount(
+ if ((status = Win32.LsaOpenAccount(
policyHandle,
sid,
access,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.Handle = handle;
}
@@ -76,62 +81,61 @@ namespace ProcessHacker.Native.Objects
public void AddPrivileges(PrivilegeSet privileges)
{
- using (MemoryAlloc privilegeSetMemory = privileges.ToMemory())
+ NtStatus status;
+
+ using (var privilegeSetMemory = privileges.ToMemory())
{
- Win32.LsaAddPrivilegesToAccount(
+ if ((status = Win32.LsaAddPrivilegesToAccount(
this,
privilegeSetMemory
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
- public PrivilegeSet Privileges
+ public PrivilegeSet GetPrivileges()
{
- get
+ NtStatus status;
+ IntPtr privileges;
+
+ if ((status = Win32.LsaEnumeratePrivilegesOfAccount(
+ this,
+ out privileges
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ using (var privilegesAlloc = new LsaMemoryAlloc(privileges))
{
- IntPtr privileges;
-
- Win32.LsaEnumeratePrivilegesOfAccount(
- this,
- out privileges
- ).ThrowIf();
-
- using (LsaMemoryAlloc privilegesAlloc = new LsaMemoryAlloc(privileges))
- {
- return new PrivilegeSet(privilegesAlloc);
- }
+ return new PrivilegeSet(privilegesAlloc);
}
}
- public QuotaLimits Quotas
+ public QuotaLimits GetQuotas()
{
- get
- {
- QuotaLimits quotas;
+ NtStatus status;
+ QuotaLimits quotas;
- Win32.LsaGetQuotasForAccount(
- this,
- out quotas
- ).ThrowIf();
+ if ((status = Win32.LsaGetQuotasForAccount(
+ this,
+ out quotas
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return quotas;
- }
+ return quotas;
}
-
- public SecuritySystemAccess SystemAccess
+ public SecuritySystemAccess GetSystemAccess()
{
- get
- {
- SecuritySystemAccess access;
+ NtStatus status;
+ SecuritySystemAccess access;
- Win32.LsaGetSystemAccessAccount(
- this,
- out access
- ).ThrowIf();
+ if ((status = Win32.LsaGetSystemAccessAccount(
+ this,
+ out access
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return access;
- }
+ return access;
}
public void RemovePrivilege(Privilege privilege)
@@ -141,39 +145,51 @@ namespace ProcessHacker.Native.Objects
public void RemovePrivileges()
{
- Win32.LsaRemovePrivilegesFromAccount(
+ NtStatus status;
+
+ if ((status = Win32.LsaRemovePrivilegesFromAccount(
this,
true,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void RemovePrivileges(PrivilegeSet privileges)
{
- using (MemoryAlloc privilegeSetMemory = privileges.ToMemory())
+ NtStatus status;
+
+ using (var privilegeSetMemory = privileges.ToMemory())
{
- Win32.LsaRemovePrivilegesFromAccount(
+ if ((status = Win32.LsaRemovePrivilegesFromAccount(
this,
false,
privilegeSetMemory
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
public void SetQuotas(QuotaLimits quotas)
{
- Win32.LsaSetQuotasForAccount(
+ NtStatus status;
+
+ if ((status = Win32.LsaSetQuotasForAccount(
this,
ref quotas
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void SetSystemAccess(SecuritySystemAccess access)
{
- Win32.LsaSetSystemAccessAccount(
+ NtStatus status;
+
+ if ((status = Win32.LsaSetSystemAccessAccount(
this,
access
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/LsaAuthHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/LsaAuthHandle.cs
index 6820913d7..bcb9dfaf2 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/LsaAuthHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/LsaAuthHandle.cs
@@ -21,7 +21,10 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
+using ProcessHacker.Native.Security;
using ProcessHacker.Native.Security.Authentication;
namespace ProcessHacker.Native.Objects
@@ -30,18 +33,21 @@ namespace ProcessHacker.Native.Objects
{
public static LsaAuthHandle Connect(string name)
{
+ NtStatus status;
+ AnsiString nameStr;
IntPtr handle;
LsaOperationalMode mode;
- AnsiString nameStr = new AnsiString(name);
+ nameStr = new AnsiString(name);
try
{
- Win32.LsaRegisterLogonProcess(
+ if ((status = Win32.LsaRegisterLogonProcess(
ref nameStr,
out handle,
out mode
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -53,9 +59,11 @@ namespace ProcessHacker.Native.Objects
public static LsaAuthHandle ConnectUntrusted()
{
+ NtStatus status;
IntPtr handle;
- Win32.LsaConnectUntrusted(out handle).ThrowIf();
+ if ((status = Win32.LsaConnectUntrusted(out handle)) >= NtStatus.Error)
+ Win32.Throw(status);
return new LsaAuthHandle(handle, true);
}
@@ -101,18 +109,20 @@ namespace ProcessHacker.Native.Objects
out NtStatus subStatus
)
{
+ NtStatus status;
+ AnsiString originNameStr;
IntPtr profileBuffer;
int profileBufferLength;
IntPtr token;
QuotaLimits quotas;
- AnsiString originNameStr = new AnsiString(originName);
+ originNameStr = new AnsiString(originName);
try
{
- using (MemoryRegion logonData = package.GetAuthData())
+ using (var logonData = package.GetAuthData())
{
- Win32.LsaLogonUser(
+ if ((status = Win32.LsaLogonUser(
this,
ref originNameStr,
logonType,
@@ -127,12 +137,11 @@ namespace ProcessHacker.Native.Objects
out token,
out quotas,
out subStatus
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- using (new LsaMemoryAlloc(profileBuffer, true))
- {
+ using (var profileBufferAlloc = new LsaMemoryAlloc(profileBuffer, true))
profileData = package.GetProfileData(new MemoryRegion(profileBuffer, 0, profileBufferLength));
- }
return new TokenHandle(token, true);
}
@@ -145,17 +154,20 @@ namespace ProcessHacker.Native.Objects
public int LookupAuthenticationPackage(string packageName)
{
+ NtStatus status;
+ AnsiString packageNameStr;
int authenticationPackage;
- AnsiString packageNameStr = new AnsiString(packageName);
+ packageNameStr = new AnsiString(packageName);
try
{
- Win32.LsaLookupAuthenticationPackage(
+ if ((status = Win32.LsaLookupAuthenticationPackage(
this,
ref packageNameStr,
out authenticationPackage
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/LsaHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/LsaHandle.cs
index bea581c38..b34e33b2a 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/LsaHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/LsaHandle.cs
@@ -46,29 +46,37 @@ namespace ProcessHacker.Native.Objects
public void Delete()
{
- Win32.LsaDelete(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.LsaDelete(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public override SecurityDescriptor GetSecurity(SecurityInformation securityInformation)
{
+ NtStatus status;
IntPtr securityDescriptor;
- Win32.LsaQuerySecurityObject(
+ if ((status = Win32.LsaQuerySecurityObject(
this,
securityInformation,
out securityDescriptor
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SecurityDescriptor(new LsaMemoryAlloc(securityDescriptor));
}
public override void SetSecurity(SecurityInformation securityInformation, SecurityDescriptor securityDescriptor)
{
- Win32.LsaSetSecurityObject(
+ NtStatus status;
+
+ if ((status = Win32.LsaSetSecurityObject(
this,
securityInformation,
securityDescriptor
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/LsaPolicyHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/LsaPolicyHandle.cs
index 1b3290066..c2038f685 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/LsaPolicyHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/LsaPolicyHandle.cs
@@ -45,7 +45,7 @@ namespace ProcessHacker.Native.Objects
if (weakRef != null)
{
- weakRef.TryGetTarget(out policyHandle);
+ policyHandle = weakRef.Target;
}
if (policyHandle == null)
@@ -53,10 +53,9 @@ namespace ProcessHacker.Native.Objects
System.Threading.Interlocked.Increment(ref _lookupPolicyHandleMisses);
policyHandle = new LsaPolicyHandle(LsaPolicyAccess.LookupNames);
+
if (policyHandle != null)
- {
_lookupPolicyHandle = new WeakReference(policyHandle);
- }
}
return policyHandle;
@@ -86,19 +85,22 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the policy.
public LsaPolicyHandle(string systemName, LsaPolicyAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes();
+ UnicodeString systemNameStr;
IntPtr handle;
- UnicodeString systemNameStr = new UnicodeString(systemName);
+ systemNameStr = new UnicodeString(systemName);
try
{
- Win32.LsaOpenPolicy(
+ if ((status = Win32.LsaOpenPolicy(
ref systemNameStr,
ref oa,
access,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -115,6 +117,7 @@ namespace ProcessHacker.Native.Objects
public void AddPrivileges(Sid accountSid, string[] privileges)
{
+ NtStatus status;
UnicodeString[] privilegeStrArray = new UnicodeString[privileges.Length];
for (int i = 0; i < privileges.Length; i++)
@@ -122,12 +125,13 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.LsaAddAccountRights(
+ if ((status = Win32.LsaAddAccountRights(
this,
accountSid,
privilegeStrArray,
privilegeStrArray.Length
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -138,15 +142,19 @@ namespace ProcessHacker.Native.Objects
public void DeletePrivateData(string name)
{
- UnicodeString nameStr = new UnicodeString(name);
+ NtStatus status;
+ UnicodeString nameStr;
+
+ nameStr = new UnicodeString(name);
try
{
- Win32.LsaStorePrivateData(
+ if ((status = Win32.LsaStorePrivateData(
this,
ref nameStr,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -161,13 +169,14 @@ namespace ProcessHacker.Native.Objects
/// The callback for the enumeration.
public void EnumAccounts(EnumAccountsDelegate callback)
{
+ NtStatus status;
int enumerationContext = 0;
IntPtr buffer;
int count;
while (true)
{
- NtStatus status = Win32.LsaEnumerateAccounts(
+ status = Win32.LsaEnumerateAccounts(
this,
ref enumerationContext,
out buffer,
@@ -177,10 +186,10 @@ namespace ProcessHacker.Native.Objects
if (status == NtStatus.NoMoreEntries)
break;
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
- status.ThrowIf();
-
- using (LsaMemoryAlloc bufferAlloc = new LsaMemoryAlloc(buffer))
+ using (var bufferAlloc = new LsaMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
@@ -200,26 +209,31 @@ namespace ProcessHacker.Native.Objects
/// The callback for the enumeration.
public void EnumAccountsWithPrivilege(string privilegeName, EnumAccountsDelegate callback)
{
+ NtStatus status;
+ UnicodeString privilegeNameStr;
IntPtr buffer;
int count;
- UnicodeString privilegeNameStr = new UnicodeString(privilegeName);
+ privilegeNameStr = new UnicodeString(privilegeName);
try
{
- Win32.LsaEnumerateAccountsWithUserRight(
+ if ((status = Win32.LsaEnumerateAccountsWithUserRight(
this,
ref privilegeNameStr,
out buffer,
out count
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
privilegeNameStr.Dispose();
}
- using (LsaMemoryAlloc bufferAlloc = new LsaMemoryAlloc(buffer))
+ Sid[] sids = new Sid[count];
+
+ using (var bufferAlloc = new LsaMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
@@ -236,13 +250,14 @@ namespace ProcessHacker.Native.Objects
/// The callback for the enumeration.
public void EnumPrivileges(EnumPrivilegesDelegate callback)
{
+ NtStatus status;
int enumerationContext = 0;
IntPtr buffer;
int count;
while (true)
{
- NtStatus status = Win32.LsaEnumeratePrivileges(
+ status = Win32.LsaEnumeratePrivileges(
this,
ref enumerationContext,
out buffer,
@@ -252,14 +267,14 @@ namespace ProcessHacker.Native.Objects
if (status == NtStatus.NoMoreEntries)
break;
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
- status.ThrowIf();
-
- using (LsaMemoryAlloc bufferAlloc = new LsaMemoryAlloc(buffer))
+ using (var bufferAlloc = new LsaMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
- if (!callback(new Privilege(bufferAlloc.ReadStruct(0, PolicyPrivilegeDefinition.SizeOf, i).Name.Text)))
+ if (!callback(new Privilege(bufferAlloc.ReadStruct(i).Name.Read())))
return;
}
}
@@ -270,20 +285,17 @@ namespace ProcessHacker.Native.Objects
/// Gets the accounts in the policy. This requires
/// ViewLocalInformation access.
///
- public Sid[] Accounts
+ public Sid[] GetAccounts()
{
- get
- {
- List sids = new List();
+ List sids = new List();
- this.EnumAccounts(sid =>
+ this.EnumAccounts((sid) =>
{
sids.Add(sid);
return true;
});
- return sids.ToArray();
- }
+ return sids.ToArray();
}
///
@@ -296,7 +308,7 @@ namespace ProcessHacker.Native.Objects
{
List sids = new List();
- this.EnumAccountsWithPrivilege(privilegeName, sid =>
+ this.EnumAccountsWithPrivilege(privilegeName, (sid) =>
{
sids.Add(sid);
return true;
@@ -305,20 +317,17 @@ namespace ProcessHacker.Native.Objects
return sids.ToArray();
}
- public Privilege[] Privileges
+ public Privilege[] GetPrivileges()
{
- get
+ List privileges = new List();
+
+ this.EnumPrivileges((privilege) =>
{
- List privileges = new List();
+ privileges.Add(privilege);
+ return true;
+ });
- this.EnumPrivileges(privilege =>
- {
- privileges.Add(privilege);
- return true;
- });
-
- return privileges.ToArray();
- }
+ return privileges.ToArray();
}
public string LookupName(Sid sid)
@@ -354,7 +363,7 @@ namespace ProcessHacker.Native.Objects
new IntPtr[] { sid },
out referencedDomains,
out names
- )).IsError())
+ )) >= NtStatus.Error)
{
if (status == NtStatus.NoneMapped)
{
@@ -366,8 +375,8 @@ namespace ProcessHacker.Native.Objects
Win32.Throw(status);
}
- using (LsaMemoryAlloc referencedDomainsAlloc = new LsaMemoryAlloc(referencedDomains))
- using (LsaMemoryAlloc namesAlloc = new LsaMemoryAlloc(names))
+ using (var referencedDomainsAlloc = new LsaMemoryAlloc(referencedDomains))
+ using (var namesAlloc = new LsaMemoryAlloc(names))
{
LsaTranslatedName translatedName = namesAlloc.ReadStruct();
@@ -384,16 +393,16 @@ namespace ProcessHacker.Native.Objects
{
LsaReferencedDomainList domains = referencedDomainsAlloc.ReadStruct();
MemoryRegion trustArray = new MemoryRegion(domains.Domains);
- LsaTrustInformation trustInfo = trustArray.ReadStruct(0, LsaTrustInformation.SizeOf, translatedName.DomainIndex);
+ LsaTrustInformation trustInfo = trustArray.ReadStruct(translatedName.DomainIndex);
- domainName = trustInfo.Name.Text;
+ domainName = trustInfo.Name.Read();
}
else
{
domainName = null;
}
- return translatedName.Name.Text;
+ return translatedName.Name.Read();
}
}
@@ -404,60 +413,68 @@ namespace ProcessHacker.Native.Objects
public string LookupPrivilegeDisplayName(string name)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr displayName;
short language;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.LsaLookupPrivilegeDisplayName(
+ if ((status = Win32.LsaLookupPrivilegeDisplayName(
this,
ref nameStr,
out displayName,
out language
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
nameStr.Dispose();
}
- using (LsaMemoryAlloc displayNameAlloc = new LsaMemoryAlloc(displayName))
+ using (var displayNameAlloc = new LsaMemoryAlloc(displayName))
{
- return displayNameAlloc.ReadStruct().Text;
+ return displayNameAlloc.ReadStruct().Read();
}
}
public string LookupPrivilegeName(Luid value)
{
+ NtStatus status;
IntPtr name;
- Win32.LsaLookupPrivilegeName(
+ if ((status = Win32.LsaLookupPrivilegeName(
this,
ref value,
out name
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- using (LsaMemoryAlloc nameAlloc = new LsaMemoryAlloc(name))
+ using (var nameAlloc = new LsaMemoryAlloc(name))
{
- return nameAlloc.ReadStruct().Text;
+ return nameAlloc.ReadStruct().Read();
}
}
public Luid LookupPrivilegeValue(string name)
{
+ NtStatus status;
+ UnicodeString nameStr;
Luid luid;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.LsaLookupPrivilegeValue(
+ if ((status = Win32.LsaLookupPrivilegeValue(
this,
ref nameStr,
out luid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -491,10 +508,11 @@ namespace ProcessHacker.Native.Objects
public Sid LookupSid(string name, out SidNameUse nameUse, out string domainName)
{
NtStatus status;
+ UnicodeString nameStr;
IntPtr referencedDomains;
IntPtr sids;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
@@ -505,7 +523,7 @@ namespace ProcessHacker.Native.Objects
new UnicodeString[] { nameStr },
out referencedDomains,
out sids
- )).IsError())
+ )) >= NtStatus.Error)
{
if (status == NtStatus.NoneMapped)
{
@@ -540,9 +558,9 @@ namespace ProcessHacker.Native.Objects
{
LsaReferencedDomainList domains = referencedDomainsAlloc.ReadStruct();
MemoryRegion trustArray = new MemoryRegion(domains.Domains);
- LsaTrustInformation trustInfo = trustArray.ReadStruct(0, LsaTrustInformation.SizeOf, translatedSid.DomainIndex);
+ LsaTrustInformation trustInfo = trustArray.ReadStruct(translatedSid.DomainIndex);
- domainName = trustInfo.Name.Text;
+ domainName = trustInfo.Name.Read();
}
else
{
@@ -560,17 +578,21 @@ namespace ProcessHacker.Native.Objects
public void RemovePrivileges(Sid accountSid)
{
- Win32.LsaRemoveAccountRights(
+ NtStatus status;
+
+ if ((status = Win32.LsaRemoveAccountRights(
this,
accountSid,
true,
null,
0
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void RemovePrivileges(Sid accountSid, string[] privileges)
{
+ NtStatus status;
UnicodeString[] privilegeStrArray = new UnicodeString[privileges.Length];
for (int i = 0; i < privileges.Length; i++)
@@ -578,13 +600,14 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.LsaRemoveAccountRights(
+ if ((status = Win32.LsaRemoveAccountRights(
this,
accountSid,
false,
privilegeStrArray,
privilegeStrArray.Length
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -595,41 +618,47 @@ namespace ProcessHacker.Native.Objects
public string RetrievePrivateData(string name)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr privateData;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.LsaRetrievePrivateData(
+ if ((status = Win32.LsaRetrievePrivateData(
this,
ref nameStr,
out privateData
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
nameStr.Dispose();
}
- using (LsaMemoryAlloc privateDataAlloc = new LsaMemoryAlloc(privateData))
- {
- return privateDataAlloc.ReadStruct().Text;
- }
+ using (var privateDataAlloc = new LsaMemoryAlloc(privateData))
+ return privateDataAlloc.ReadStruct().Read();
}
public void StorePrivateData(string name, string privateData)
{
- UnicodeString nameStr = new UnicodeString(name);
- UnicodeString privateDataStr = new UnicodeString(privateData);
+ NtStatus status;
+ UnicodeString nameStr;
+ UnicodeString privateDataStr;
+
+ nameStr = new UnicodeString(name);
+ privateDataStr = new UnicodeString(privateData);
try
{
- Win32.LsaStorePrivateData(
+ if ((status = Win32.LsaStorePrivateData(
this,
ref nameStr,
ref privateDataStr
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/LsaSecretHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/LsaSecretHandle.cs
index 77ada9075..7657956bb 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/LsaSecretHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/LsaSecretHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -33,18 +34,21 @@ namespace ProcessHacker.Native.Objects
{
public static LsaSecretHandle Create(LsaSecretAccess access, LsaPolicyHandle policyHandle, string name)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr handle;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.LsaCreateSecret(
+ if ((status = Win32.LsaCreateSecret(
policyHandle,
ref nameStr,
access,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -60,18 +64,21 @@ namespace ProcessHacker.Native.Objects
public LsaSecretHandle(LsaPolicyHandle policyHandle, string name, LsaSecretAccess access)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr handle;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.LsaOpenSecret(
+ if ((status = Win32.LsaOpenSecret(
policyHandle,
ref nameStr,
access,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -106,25 +113,27 @@ namespace ProcessHacker.Native.Objects
out DateTime oldValueSetTime
)
{
+ NtStatus status;
IntPtr currentValueStr;
long currentValueSetTimeLong;
IntPtr oldValueStr;
long oldValueSetTimeLong;
- Win32.LsaQuerySecret(
+ if ((status = Win32.LsaQuerySecret(
this,
out currentValueStr,
out currentValueSetTimeLong,
out oldValueStr,
out oldValueSetTimeLong
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- using (LsaMemoryAlloc currentValueStrAlloc = new LsaMemoryAlloc(currentValueStr))
- using (LsaMemoryAlloc oldValueStrAlloc = new LsaMemoryAlloc(oldValueStr))
+ using (var currentValueStrAlloc = new LsaMemoryAlloc(currentValueStr))
+ using (var oldValueStrAlloc = new LsaMemoryAlloc(oldValueStr))
{
- currentValue = currentValueStrAlloc.ReadStruct().Text;
+ currentValue = currentValueStrAlloc.ReadStruct().Read();
currentValueSetTime = DateTime.FromFileTime(currentValueSetTimeLong);
- oldValue = oldValueStrAlloc.ReadStruct().Text;
+ oldValue = oldValueStrAlloc.ReadStruct().Read();
oldValueSetTime = DateTime.FromFileTime(oldValueSetTimeLong);
}
}
@@ -136,16 +145,21 @@ namespace ProcessHacker.Native.Objects
public void Set(string currentValue, string oldValue)
{
- UnicodeString currentValueStr = new UnicodeString(currentValue);
- UnicodeString oldValueStr = new UnicodeString(oldValue);
+ NtStatus status;
+ UnicodeString currentValueStr;
+ UnicodeString oldValueStr;
+
+ currentValueStr = new UnicodeString(currentValue);
+ oldValueStr = new UnicodeString(oldValue);
try
{
- Win32.LsaSetSecret(
+ if ((status = Win32.LsaSetSecret(
this,
ref currentValueStr,
ref oldValueStr
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/MailslotHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/MailslotHandle.cs
index 45758ae47..f3b62c173 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/MailslotHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/MailslotHandle.cs
@@ -56,13 +56,14 @@ namespace ProcessHacker.Native.Objects
FileCreateOptions createOptions
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, rootDirectory);
IoStatusBlock isb;
IntPtr handle;
try
{
- Win32.NtCreateMailslotFile(
+ if ((status = Win32.NtCreateMailslotFile(
out handle,
access,
ref oa,
@@ -71,7 +72,8 @@ namespace ProcessHacker.Native.Objects
quota,
maxMessageSize,
ref readTimeout
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/MutantHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/MutantHandle.cs
index f10b0362b..9e9fd229b 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/MutantHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/MutantHandle.cs
@@ -21,8 +21,11 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
+using System.Runtime.InteropServices;
namespace ProcessHacker.Native.Objects
{
@@ -40,12 +43,14 @@ namespace ProcessHacker.Native.Objects
public static MutantHandle Create(MutantAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, bool initialOwner)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateMutant(out handle, access, ref oa, initialOwner).ThrowIf();
+ if ((status = Win32.NtCreateMutant(out handle, access, ref oa, initialOwner)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -66,12 +71,14 @@ namespace ProcessHacker.Native.Objects
public MutantHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, MutantAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenMutant(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenMutant(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -85,49 +92,39 @@ namespace ProcessHacker.Native.Objects
: this(name, 0, null, access)
{ }
- public MutantBasicInformation BasicInformation
+ public MutantBasicInformation GetBasicInformation()
{
- get
- {
- MutantBasicInformation mbi;
- int retLength;
+ NtStatus status;
+ MutantBasicInformation mbi;
+ int retLength;
- Win32.NtQueryMutant(
- this,
- MutantInformationClass.MutantBasicInformation,
- out mbi,
- MutantBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryMutant(this, MutantInformationClass.MutantBasicInformation,
+ out mbi, Marshal.SizeOf(typeof(MutantBasicInformation)), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
- return mbi;
- }
+ return mbi;
}
- public MutantOwnerInformation OwnerInformation
+ public MutantOwnerInformation GetOwnerInformation()
{
- get
- {
- MutantOwnerInformation moi;
- int retLength;
+ NtStatus status;
+ MutantOwnerInformation moi;
+ int retLength;
- Win32.NtQueryMutant(
- this,
- MutantInformationClass.MutantOwnerInformation,
- out moi,
- MutantOwnerInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryMutant(this, MutantInformationClass.MutantOwnerInformation,
+ out moi, Marshal.SizeOf(typeof(MutantOwnerInformation)), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
- return moi;
- }
+ return moi;
}
public int Release()
{
+ NtStatus status;
int previousCount;
- Win32.NtReleaseMutant(this, out previousCount).ThrowIf();
+ if ((status = Win32.NtReleaseMutant(this, out previousCount)) >= NtStatus.Error)
+ Win32.Throw(status);
return previousCount;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/NamedPipeHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/NamedPipeHandle.cs
index 8d7659360..94075162c 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/NamedPipeHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/NamedPipeHandle.cs
@@ -89,6 +89,7 @@ namespace ProcessHacker.Native.Objects
long defaultTimeout
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, rootDirectory);
IoStatusBlock isb;
IntPtr handle;
@@ -99,7 +100,7 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.NtCreateNamedPipeFile(
+ if ((status = Win32.NtCreateNamedPipeFile(
out handle,
access,
ref oa,
@@ -114,7 +115,8 @@ namespace ProcessHacker.Native.Objects
inboundQuota,
outboundQuota,
ref defaultTimeout
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -153,33 +155,33 @@ namespace ProcessHacker.Native.Objects
public static bool Wait(string name, long timeout, bool relative)
{
- using (FileHandle npfsHandle = new FileHandle(
+ using (var npfsHandle = new FileHandle(
Win32.NamedPipePath + "\\",
FileShareMode.ReadWrite,
FileCreateOptions.SynchronousIoNonAlert,
FileAccess.ReadAttributes | (FileAccess)StandardRights.Synchronize
))
{
- using (MemoryAlloc data = new MemoryAlloc(FilePipeWaitForBuffer.NameOffset + name.Length * 2))
+ using (var data = new MemoryAlloc(FilePipeWaitForBuffer.NameOffset + name.Length * 2))
{
- FilePipeWaitForBuffer info = new FilePipeWaitForBuffer
- {
- Timeout = timeout,
- TimeoutSpecified = true,
- NameLength = name.Length * 2
- };
+ FilePipeWaitForBuffer info = new FilePipeWaitForBuffer();
- data.WriteStruct(info);
+ info.Timeout = timeout;
+ info.TimeoutSpecified = true;
+ info.NameLength = name.Length * 2;
+ data.WriteStruct(info);
data.WriteUnicodeString(FilePipeWaitForBuffer.NameOffset, name);
+ NtStatus status;
int returnLength;
- NtStatus status = npfsHandle.FsControl(FsCtlWait, data, data.Size, IntPtr.Zero, 0, out returnLength);
+ status = npfsHandle.FsControl(FsCtlWait, data, data.Size, IntPtr.Zero, 0, out returnLength);
if (status == NtStatus.IoTimeout)
return false;
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return true;
}
@@ -253,7 +255,8 @@ namespace ProcessHacker.Native.Objects
if (asyncContext.Status == NtStatus.PipeConnected)
return true;
- asyncContext.StatusBlock.Status.ThrowIf();
+ if (asyncContext.StatusBlock.Status >= NtStatus.Error)
+ Win32.Throw(asyncContext.StatusBlock.Status);
return false;
}
@@ -268,31 +271,19 @@ namespace ProcessHacker.Native.Objects
this.FsControl(FsCtlDisconnect, IntPtr.Zero, 0, IntPtr.Zero, 0);
}
- private FilePipeInformation Information
+ private FilePipeInformation GetInformation()
{
- get
- {
- return this.QueryStruct(
- FileInformationClass.FilePipeInformation,
- FilePipeInformation.SizeOf
- );
- }
+ return this.QueryStruct(FileInformationClass.FilePipeInformation);
}
- private FilePipeLocalInformation LocalInformation
+ private FilePipeLocalInformation GetLocalInformation()
{
- get
- {
- return this.QueryStruct(
- FileInformationClass.FilePipeLocalInformation,
- FilePipeLocalInformation.SizeOf
- );
- }
+ return this.QueryStruct(FileInformationClass.FilePipeLocalInformation);
}
- public PipeType PipeType
+ public PipeType GetPipeType()
{
- get { return this.Information.ReadMode; }
+ return this.GetInformation().ReadMode;
}
public void ImpersonateClient()
@@ -302,14 +293,16 @@ namespace ProcessHacker.Native.Objects
public bool Listen()
{
+ NtStatus status;
int returnLength;
- NtStatus status = this.FsControl(FsCtlListen, IntPtr.Zero, 0, IntPtr.Zero, 0, out returnLength);
+ status = this.FsControl(FsCtlListen, IntPtr.Zero, 0, IntPtr.Zero, 0, out returnLength);
if (status == NtStatus.PipeConnected)
return true;
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return false;
}
@@ -374,7 +367,7 @@ namespace ProcessHacker.Native.Objects
public int Peek(IntPtr buffer, int length, out int bytesAvailable, out int bytesLeftInMessage)
{
- using (MemoryAlloc data = new MemoryAlloc(FilePipePeekBuffer.DataOffset + length))
+ using (var data = new MemoryAlloc(FilePipePeekBuffer.DataOffset + length))
{
NtStatus status;
int returnLength;
@@ -386,12 +379,14 @@ namespace ProcessHacker.Native.Objects
if (status == NtStatus.BufferOverflow)
status = NtStatus.Success;
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
FilePipePeekBuffer info = data.ReadStruct();
+ int bytesRead;
bytesAvailable = info.ReadDataAvailable;
- int bytesRead = returnLength - FilePipePeekBuffer.DataOffset;
+ bytesRead = returnLength - FilePipePeekBuffer.DataOffset;
bytesLeftInMessage = info.MessageLength - bytesRead;
if (buffer != IntPtr.Zero)
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/NativeHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/NativeHandle.cs
index 99031c6d4..2f60fdfb0 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/NativeHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/NativeHandle.cs
@@ -90,19 +90,23 @@ namespace ProcessHacker.Native.Objects
private static NtStatus WaitForMultipleObjects(ISynchronizable[] objects, WaitType waitType, bool alertable, long timeout, bool relative)
{
+ NtStatus status;
IntPtr[] handles = new IntPtr[objects.Length];
long realTimeout = relative ? -timeout : timeout;
for (int i = 0; i < objects.Length; i++)
handles[i] = objects[i].Handle;
- return Win32.NtWaitForMultipleObjects(
+ if ((status = Win32.NtWaitForMultipleObjects(
handles.Length,
handles,
waitType,
alertable,
ref realTimeout
- );
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
public static implicit operator int(NativeHandle handle)
@@ -220,80 +224,66 @@ namespace ProcessHacker.Native.Objects
/// Gets the handle's name.
///
/// A string.
- public virtual string ObjectName
+ public virtual string GetObjectName()
{
- get
+ NtStatus status;
+ int retLength;
+
+ status = Win32.NtQueryObject(this, ObjectInformationClass.ObjectNameInformation,
+ IntPtr.Zero, 0, out retLength);
+
+ if (retLength > 0)
{
- int retLength;
-
- Win32.NtQueryObject(
- this,
- ObjectInformationClass.ObjectNameInformation,
- IntPtr.Zero,
- 0,
- out retLength
- );
-
- if (retLength > 0)
+ using (MemoryAlloc oniMem = new MemoryAlloc(retLength))
{
- using (MemoryAlloc oniMem = new MemoryAlloc(retLength))
- {
- Win32.NtQueryObject(
- this,
- ObjectInformationClass.ObjectNameInformation,
- oniMem,
- oniMem.Size,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryObject(this, ObjectInformationClass.ObjectNameInformation,
+ oniMem, oniMem.Size, out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
- ObjectNameInformation oni = oniMem.ReadStruct();
+ var oni = oniMem.ReadStruct();
- return oni.Name.Text;
- }
+ return oni.Name.Read();
}
-
- return null;
}
+ else
+ {
+ Win32.Throw(status);
+ }
+
+ return null;
}
///
/// Gets the handle's type name.
///
/// A string.
- public virtual string ObjectTypeName
+ public virtual string GetObjectTypeName()
{
- get
+ NtStatus status;
+ int retLength;
+
+ status = Win32.NtQueryObject(this, ObjectInformationClass.ObjectTypeInformation,
+ IntPtr.Zero, 0, out retLength);
+
+ if (retLength > 0)
{
- int retLength;
-
- Win32.NtQueryObject(
- this,
- ObjectInformationClass.ObjectTypeInformation,
- IntPtr.Zero,
- 0,
- out retLength
- );
-
- if (retLength > 0)
+ using (MemoryAlloc otiMem = new MemoryAlloc(retLength))
{
- using (MemoryAlloc otiMem = new MemoryAlloc(retLength))
- {
- Win32.NtQueryObject(
- this,
- ObjectInformationClass.ObjectTypeInformation,
- otiMem,
- otiMem.Size,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryObject(this, ObjectInformationClass.ObjectTypeInformation,
+ otiMem, otiMem.Size, out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
- ObjectTypeInformation oni = otiMem.ReadStruct();
+ var oni = otiMem.ReadStruct();
- return oni.Name.Text;
- }
+ return oni.Name.Read();
}
-
- return null;
}
+ else
+ {
+ Win32.Throw(status);
+ }
+
+ return null;
}
///
@@ -322,7 +312,10 @@ namespace ProcessHacker.Native.Objects
///
public virtual void MakeObjectPermanent()
{
- Win32.NtMakePermanentObject(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtMakePermanentObject(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -332,16 +325,10 @@ namespace ProcessHacker.Native.Objects
///
public virtual void MakeObjectTemporary()
{
- Win32.NtMakeTemporaryObject(this).ThrowIf();
- }
+ NtStatus status;
- ///
- /// Marks the handle as invalid. This method must only be called from
- /// within a derived class constructor.
- ///
- protected bool IsValid
- {
- get { return this._handle != IntPtr.Zero; }
+ if ((status = Win32.NtMakeTemporaryObject(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -414,14 +401,18 @@ namespace ProcessHacker.Native.Objects
///
public virtual NtStatus SignalAndWait(ISynchronizable waitObject, bool alertable, long timeout, bool relative)
{
+ NtStatus status;
long realTimeout = relative ? -timeout : timeout;
- return Win32.NtSignalAndWaitForSingleObject(
+ if ((status = Win32.NtSignalAndWaitForSingleObject(
this,
waitObject.Handle,
alertable,
- ref realTimeout
- );
+ ref timeout
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
///
@@ -522,20 +513,25 @@ namespace ProcessHacker.Native.Objects
/// Whether the timeout value is relative.
public virtual NtStatus Wait(bool alertable, long timeout, bool relative)
{
+ NtStatus status;
long realTimeout = relative ? -timeout : timeout;
- return Win32.NtWaitForSingleObject(
+ if ((status = Win32.NtWaitForSingleObject(
this,
alertable,
ref realTimeout
- );
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
}
///
/// Represents a generic Windows handle which acts as a kernel handle by default.
///
- public class NativeHandle : NativeHandle where TAccess : struct
+ public class NativeHandle : NativeHandle
+ where TAccess : struct
{
///
/// Creates a new, invalid handle. You must set the handle using the Handle property.
@@ -571,16 +567,8 @@ namespace ProcessHacker.Native.Objects
{
IntPtr newHandle;
- Win32.NtDuplicateObject(
- ProcessHandle.Current,
- handle,
- ProcessHandle.Current,
- out newHandle,
- (int)Convert.ChangeType(access, typeof(int)),
- 0,
- 0
- );
-
+ Win32.DuplicateObject(ProcessHandle.Current, handle, ProcessHandle.Current, out newHandle,
+ (int)Convert.ChangeType(access, typeof(int)), 0, 0);
this.Handle = newHandle;
}
@@ -594,16 +582,8 @@ namespace ProcessHacker.Native.Objects
{
IntPtr newHandle;
- Win32.NtDuplicateObject(
- processHandle,
- handle,
- ProcessHandle.Current,
- out newHandle,
- (int)Convert.ChangeType(access, typeof(int)),
- 0,
- 0
- );
-
+ Win32.DuplicateObject(processHandle, handle, ProcessHandle.Current, out newHandle,
+ (int)Convert.ChangeType(access, typeof(int)), 0, 0);
this.Handle = newHandle;
}
@@ -615,16 +595,8 @@ namespace ProcessHacker.Native.Objects
{
IntPtr newHandle;
- Win32.NtDuplicateObject(
- ProcessHandle.Current,
- this,
- ProcessHandle.Current,
- out newHandle,
- (int)Convert.ChangeType(access, typeof(int)),
- 0,
- 0
- );
-
+ Win32.DuplicateObject(ProcessHandle.Current, this, ProcessHandle.Current, out newHandle,
+ (int)Convert.ChangeType(access, typeof(int)), 0, 0);
this.SwapHandle(newHandle);
}
@@ -648,6 +620,7 @@ namespace ProcessHacker.Native.Objects
/// Creates a new, invalid handle. You must set the handle using the Handle property.
///
protected GenericHandle()
+ : base()
{ }
///
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/PortComHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/PortComHandle.cs
index c52d814cd..a032c3a45 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/PortComHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/PortComHandle.cs
@@ -31,13 +31,15 @@ namespace ProcessHacker.Native.Objects
{
public static PortComHandle Connect(string portName)
{
+ NtStatus status;
UnicodeString portNameStr = new UnicodeString(portName);
- SecurityQualityOfService securityQos = new SecurityQualityOfService(SecurityImpersonationLevel.SecurityImpersonation, true, false);
+ SecurityQualityOfService securityQos =
+ new SecurityQualityOfService(SecurityImpersonationLevel.SecurityImpersonation, true, false);
IntPtr handle;
try
{
- Win32.NtConnectPort(
+ if ((status = Win32.NtConnectPort(
out handle,
ref portNameStr,
ref securityQos,
@@ -46,7 +48,8 @@ namespace ProcessHacker.Native.Objects
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -62,9 +65,12 @@ namespace ProcessHacker.Native.Objects
public void Reply(PortMessage message)
{
- using (MemoryAlloc messageMemory = message.ToMemory())
+ NtStatus status;
+
+ using (var messageMemory = message.ToMemory())
{
- Win32.NtReplyPort(this, messageMemory).ThrowIf();
+ if ((status = Win32.NtReplyPort(this, messageMemory)) >= NtStatus.Error)
+ Win32.Throw(status);
message.SetHeader(messageMemory);
}
@@ -77,7 +83,10 @@ namespace ProcessHacker.Native.Objects
public PortMessage ReplyWaitReceive(PortMessage message)
{
- using (MemoryAlloc buffer = PortMessage.AllocateBuffer())
+ NtStatus status;
+ IntPtr context;
+
+ using (var buffer = PortMessage.AllocateBuffer())
{
MemoryAlloc messageMemory = null;
@@ -86,14 +95,13 @@ namespace ProcessHacker.Native.Objects
try
{
- IntPtr context;
-
- Win32.NtReplyWaitReceivePort(
+ if ((status = Win32.NtReplyWaitReceivePort(
this,
out context,
messageMemory ?? IntPtr.Zero,
buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (message != null)
message.SetHeader(messageMemory);
@@ -110,12 +118,15 @@ namespace ProcessHacker.Native.Objects
public PortMessage ReplyWaitReply(PortMessage message)
{
- using (MemoryAlloc messageMemory = message.ToMemory())
+ NtStatus status;
+
+ using (var messageMemory = message.ToMemory())
{
- Win32.NtReplyWaitReplyPort(
+ if ((status = Win32.NtReplyWaitReplyPort(
this,
messageMemory
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new PortMessage(messageMemory);
}
@@ -123,9 +134,12 @@ namespace ProcessHacker.Native.Objects
public void Request(PortMessage message)
{
- using (MemoryAlloc messageMemory = message.ToMemory())
+ NtStatus status;
+
+ using (var messageMemory = message.ToMemory())
{
- Win32.NtRequestPort(this, messageMemory).ThrowIf();
+ if ((status = Win32.NtRequestPort(this, messageMemory)) >= NtStatus.Error)
+ Win32.Throw(status);
message.SetHeader(messageMemory);
}
@@ -133,14 +147,17 @@ namespace ProcessHacker.Native.Objects
public PortMessage RequestWaitReply(PortMessage message)
{
- using (MemoryAlloc buffer = PortMessage.AllocateBuffer())
- using (MemoryAlloc messageMemory = message.ToMemory())
+ NtStatus status;
+
+ using (var buffer = PortMessage.AllocateBuffer())
+ using (var messageMemory = message.ToMemory())
{
- Win32.NtRequestWaitReplyPort(
+ if ((status = Win32.NtRequestWaitReplyPort(
this,
messageMemory,
buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
message.SetHeader(messageMemory);
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/PortHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/PortHandle.cs
index 5abd9caae..ca8032f92 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/PortHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/PortHandle.cs
@@ -54,18 +54,20 @@ namespace ProcessHacker.Native.Objects
int maxPoolUsage
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreatePort(
+ if ((status = Win32.NtCreatePort(
out handle,
ref oa,
maxConnectionInfoLength,
maxMessageLength,
maxPoolUsage
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -100,18 +102,20 @@ namespace ProcessHacker.Native.Objects
int maxPoolUsage
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateWaitablePort(
+ if ((status = Win32.NtCreateWaitablePort(
out handle,
ref oa,
maxConnectionInfoLength,
maxMessageLength,
maxPoolUsage
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -127,36 +131,44 @@ namespace ProcessHacker.Native.Objects
public PortComHandle AcceptConnect(PortMessage message, bool accept)
{
+ NtStatus status;
IntPtr portHandle;
- using (MemoryAlloc messageMemory = message.ToMemory())
+ using (var messageMemory = message.ToMemory())
{
- Win32.NtAcceptConnectPort(
+ if ((status = Win32.NtAcceptConnectPort(
out portHandle,
IntPtr.Zero,
messageMemory,
accept,
IntPtr.Zero,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (!NativeHandle.IsInvalid(portHandle))
return new PortComHandle(portHandle, true);
-
- return null;
+ else
+ return null;
}
}
public void CompleteConnect()
{
- Win32.NtCompleteConnectPort(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtCompleteConnectPort(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public PortMessage Listen()
{
- using (MemoryAlloc buffer = PortMessage.AllocateBuffer())
+ NtStatus status;
+
+ using (var buffer = PortMessage.AllocateBuffer())
{
- Win32.NtListenPort(this, buffer).ThrowIf();
+ if ((status = Win32.NtListenPort(this, buffer)) >= NtStatus.Error)
+ Win32.Throw(status);
return new PortMessage(buffer);
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs
index b9cc3de4a..c3dbd7468 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs
@@ -23,6 +23,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Runtime.InteropServices;
using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -106,12 +107,13 @@ namespace ProcessHacker.Native.Objects
DebugObjectHandle debugPort
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateProcess(
+ if ((status = Win32.NtCreateProcess(
out handle,
access,
ref oa,
@@ -120,7 +122,8 @@ namespace ProcessHacker.Native.Objects
sectionHandle ?? IntPtr.Zero,
debugPort ?? IntPtr.Zero,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -169,24 +172,36 @@ namespace ProcessHacker.Native.Objects
)
{
ProcessHandle phandle;
+ ThreadHandle thandle;
SectionImageInformation imageInfo;
// If we don't have a desktop, use the current one.
if (startupInfo.Desktop == null)
- startupInfo.Desktop = Current.GetPebString(PebOffset.DesktopName);
+ startupInfo.Desktop = ProcessHandle.Current.GetPebString(PebOffset.DesktopName);
// Open the file, create a section, and create a process.
- using (FileHandle fhandle = new FileHandle(fileName, FileShareMode.Read | FileShareMode.Delete, FileAccess.Execute | (FileAccess)StandardRights.Synchronize))
- using (SectionHandle shandle = SectionHandle.Create(SectionAccess.All, SectionAttributes.Image, MemoryProtection.Execute, fhandle))
+ using (var fhandle = new FileHandle(
+ fileName,
+ FileShareMode.Read | FileShareMode.Delete,
+ FileAccess.Execute | (FileAccess)StandardRights.Synchronize
+ ))
{
- imageInfo = shandle.GetImageInformation();
+ using (var shandle = SectionHandle.Create(
+ SectionAccess.All,
+ SectionAttributes.Image,
+ MemoryProtection.Execute,
+ fhandle
+ ))
+ {
+ imageInfo = shandle.GetImageInformation();
- phandle = Create(
- ProcessAccess.All,
- parentProcess,
- inheritHandles,
- shandle
- );
+ phandle = Create(
+ ProcessAccess.All,
+ parentProcess,
+ inheritHandles,
+ shandle
+ );
+ }
}
IntPtr peb = phandle.GetBasicInformation().PebBaseAddress;
@@ -197,21 +212,21 @@ namespace ProcessHacker.Native.Objects
peb,
creationFlags,
FileUtils.GetFileName(fileName),
- Current.GetPebString(PebOffset.DllPath),
+ ProcessHandle.Current.GetPebString(PebOffset.DllPath),
currentDirectory,
fileName,
environment,
- !string.IsNullOrEmpty(startupInfo.Title) ? startupInfo.Title : fileName,
- !string.IsNullOrEmpty(startupInfo.Desktop) ? startupInfo.Desktop : string.Empty,
- !string.IsNullOrEmpty(startupInfo.Reserved) ? startupInfo.Reserved : string.Empty,
- string.Empty,
+ startupInfo.Title != null ? startupInfo.Title : fileName,
+ startupInfo.Desktop != null ? startupInfo.Desktop : "",
+ startupInfo.Reserved != null ? startupInfo.Reserved : "",
+ "",
ref startupInfo
);
// TODO: Duplicate the console handles (stdin, stdout, stderr).
// Create the initial thread.
- ThreadHandle thandle = ThreadHandle.CreateUserThread(
+ thandle = ThreadHandle.CreateUserThread(
phandle,
true,
imageInfo.StackCommit.Increment(imageInfo.StackReserved).ToInt32(),
@@ -225,23 +240,24 @@ namespace ProcessHacker.Native.Objects
if (notifyCsr)
{
- BaseCreateProcessMsg processMsg = new BaseCreateProcessMsg
- {
- ProcessHandle = phandle,
- ThreadHandle = thandle,
- ClientId = clientId,
- CreationFlags = creationFlags
- };
+ BaseCreateProcessMsg processMsg = new BaseCreateProcessMsg();
- if ((creationFlags & (ProcessCreationFlags.DebugProcess | ProcessCreationFlags.DebugOnlyThisProcess)) != 0)
- {
- NtStatus status = Win32.DbgUiConnectToDbg();
+ processMsg.ProcessHandle = phandle;
+ processMsg.ThreadHandle = thandle;
+ processMsg.ClientId = clientId;
+ processMsg.CreationFlags = creationFlags;
- if (status.IsError())
+ if ((creationFlags & (ProcessCreationFlags.DebugProcess |
+ ProcessCreationFlags.DebugOnlyThisProcess)) != 0)
+ {
+ NtStatus status;
+
+ status = Win32.DbgUiConnectToDbg();
+
+ if (status >= NtStatus.Error)
{
phandle.Terminate(status);
-
- status.Throw();
+ Win32.Throw(status);
}
processMsg.DebuggerClientId = ThreadHandle.GetCurrentCid();
@@ -251,28 +267,30 @@ namespace ProcessHacker.Native.Objects
// hourglass cursor on.
if (imageInfo.ImageSubsystem == 2)
processMsg.ProcessHandle = processMsg.ProcessHandle.Or((1 | 2).ToIntPtr());
-
// We still have to honor the startup info settings, though.
- if (startupInfo.Flags.HasFlag(StartupFlags.ForceOnFeedback))
+ if ((startupInfo.Flags & StartupFlags.ForceOnFeedback) ==
+ StartupFlags.ForceOnFeedback)
processMsg.ProcessHandle = processMsg.ProcessHandle.Or((1).ToIntPtr());
-
- if (startupInfo.Flags.HasFlag(StartupFlags.ForceOffFeedback))
+ if ((startupInfo.Flags & StartupFlags.ForceOffFeedback) ==
+ StartupFlags.ForceOffFeedback)
processMsg.ProcessHandle = processMsg.ProcessHandle.And((1).ToIntPtr().Not());
- using (MemoryAlloc data = new MemoryAlloc(CsrApiMsg.ApiMessageDataOffset + BaseCreateProcessMsg.SizeOf))
+ using (var data = new MemoryAlloc(
+ CsrApiMsg.ApiMessageDataOffset + Marshal.SizeOf(typeof(BaseCreateProcessMsg))
+ ))
{
- data.WriteStruct(CsrApiMsg.ApiMessageDataOffset, BaseCreateProcessMsg.SizeOf, 0, processMsg);
+ data.WriteStruct(CsrApiMsg.ApiMessageDataOffset, 0, processMsg);
Win32.CsrClientCallServer(
data,
IntPtr.Zero,
Win32.CsrMakeApiNumber(Win32.BaseSrvServerDllIndex, (int)BaseSrvApiNumber.BasepCreateProcess),
- BaseCreateProcessMsg.SizeOf
+ Marshal.SizeOf(typeof(BaseCreateProcessMsg))
);
NtStatus status = (NtStatus)data.ReadStruct().ReturnValue;
- if (status.IsError())
+ if (status >= NtStatus.Error)
{
phandle.Terminate(status);
Win32.Throw(status);
@@ -290,11 +308,12 @@ namespace ProcessHacker.Native.Objects
public static ProcessHandle CreateUserProcess(string fileName, out ClientId clientId, out ThreadHandle threadHandle)
{
+ NtStatus status;
UnicodeString fileNameStr = new UnicodeString(fileName);
RtlUserProcessParameters processParams = new RtlUserProcessParameters();
RtlUserProcessInformation processInfo;
- processParams.Length = RtlUserProcessParameters.SizeOf;
+ processParams.Length = Marshal.SizeOf(processParams);
processParams.MaximumLength = processParams.Length;
processParams.ImagePathName = new UnicodeString(fileName);
processParams.CommandLine = new UnicodeString(fileName);
@@ -303,7 +322,7 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.RtlCreateUserProcess(
+ if ((status = Win32.RtlCreateUserProcess(
ref fileNameStr,
0,
ref processParams,
@@ -314,7 +333,8 @@ namespace ProcessHacker.Native.Objects
IntPtr.Zero,
IntPtr.Zero,
out processInfo
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
clientId = processInfo.ClientId;
threadHandle = new ThreadHandle(processInfo.Thread, true);
@@ -344,7 +364,7 @@ namespace ProcessHacker.Native.Objects
{
ProcessInformation processInformation;
- startupInfo.Size = StartupInfo.SizeOf;
+ startupInfo.Size = Marshal.SizeOf(typeof(StartupInfo));
if (!Win32.CreateProcess(
applicationName,
@@ -381,7 +401,7 @@ namespace ProcessHacker.Native.Objects
{
ProcessInformation processInformation;
- startupInfo.Size = StartupInfo.SizeOf;
+ startupInfo.Size = Marshal.SizeOf(typeof(StartupInfo));
if (!Win32.CreateProcessAsUser(
tokenHandle,
@@ -428,9 +448,9 @@ namespace ProcessHacker.Native.Objects
/// Gets the ID of the current process.
///
/// The ID of the current process.
- public static int CurrentId
+ public static int GetCurrentId()
{
- get { return Win32.GetCurrentProcessId(); }
+ return Win32.GetCurrentProcessId();
}
///
@@ -506,7 +526,40 @@ namespace ProcessHacker.Native.Objects
/// A handle.
public static ProcessHandle OpenCurrent(ProcessAccess access)
{
- return new ProcessHandle(CurrentId, access);
+ return new ProcessHandle(GetCurrentId(), access);
+ }
+
+ public static ProcessHandle OpenWithAnyAccess(int pid)
+ {
+ try
+ {
+ return new ProcessHandle(pid, OSVersion.MinProcessQueryInfoAccess);
+ }
+ catch
+ {
+ try
+ {
+ return new ProcessHandle(pid, (ProcessAccess)StandardRights.Synchronize);
+ }
+ catch
+ {
+ try
+ {
+ return new ProcessHandle(pid, (ProcessAccess)StandardRights.ReadControl);
+ }
+ catch
+ {
+ try
+ {
+ return new ProcessHandle(pid, (ProcessAccess)StandardRights.WriteDac);
+ }
+ catch
+ {
+ return new ProcessHandle(pid, (ProcessAccess)StandardRights.WriteOwner);
+ }
+ }
+ }
+ }
}
private ProcessHandle(IntPtr handle, bool owned)
@@ -529,11 +582,11 @@ namespace ProcessHacker.Native.Objects
public ProcessHandle(int pid, ProcessAccess access)
{
// If we have KPH, use it.
- if (KProcessHacker2.Instance.KphIsConnected)
+ if (KProcessHacker.Instance != null)
{
try
{
- this.Handle = KProcessHacker2.Instance.KphOpenProcess(pid, access);
+ this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenProcess(pid, access));
}
catch (WindowsException)
{
@@ -541,7 +594,9 @@ namespace ProcessHacker.Native.Objects
// some part of ObReferenceObjectByHandle is hooked. We can
// open the process with SYNCHRONIZE access and set the granted access
// using KPH.
- this.Handle = KProcessHacker2.Instance.KphOpenProcess(pid, (ProcessAccess)StandardRights.Synchronize);
+ this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenProcess(pid,
+ (ProcessAccess)StandardRights.Synchronize));
+ KProcessHacker.Instance.KphSetHandleGrantedAccess(this.Handle, (int)access);
}
}
else
@@ -556,6 +611,19 @@ namespace ProcessHacker.Native.Objects
}
}
+ ///
+ /// Opens a thread's process.
+ ///
+ /// A handle to a thread.
+ /// The desired access to the process.
+ public ProcessHandle(ThreadHandle threadHandle, ProcessAccess access)
+ {
+ if (KProcessHacker.Instance == null)
+ throw new NotSupportedException();
+
+ this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenThreadProcess(threadHandle, access));
+ }
+
///
/// Opens a process.
///
@@ -574,31 +642,34 @@ namespace ProcessHacker.Native.Objects
ProcessAccess access
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
// NtOpenProcess fails when both a client ID and a name is specified.
- if (!string.IsNullOrEmpty(name))
+ if (name != null)
{
// Name specified, don't specify a CID.
- Win32.NtOpenProcess(
+ if ((status = Win32.NtOpenProcess(
out handle,
access,
ref oa,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
else
{
// No name, specify a CID.
- Win32.NtOpenProcess(
+ if ((status = Win32.NtOpenProcess(
out handle,
access,
ref oa,
ref clientId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
finally
@@ -680,14 +751,17 @@ namespace ProcessHacker.Native.Objects
/// The base address of the allocated pages.
public IntPtr AllocateMemory(IntPtr baseAddress, ref IntPtr size, MemoryFlags type, MemoryProtection protection)
{
- Win32.NtAllocateVirtualMemory(
+ NtStatus status;
+
+ if ((status = Win32.NtAllocateVirtualMemory(
this,
ref baseAddress,
IntPtr.Zero,
ref size,
type,
protection
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return baseAddress;
}
@@ -794,7 +868,9 @@ namespace ProcessHacker.Native.Objects
/// A handle to the new thread.
public ThreadHandle CreateThreadWin32(IntPtr startAddress, IntPtr parameter, bool createSuspended, out int threadId)
{
- IntPtr threadHandle = Win32.CreateRemoteThread(
+ IntPtr threadHandle;
+
+ if ((threadHandle = Win32.CreateRemoteThread(
this,
IntPtr.Zero,
IntPtr.Zero,
@@ -802,9 +878,7 @@ namespace ProcessHacker.Native.Objects
parameter,
createSuspended ? ProcessCreationFlags.CreateSuspended : 0,
out threadId
- );
-
- if (threadHandle == IntPtr.Zero)
+ )) == IntPtr.Zero)
Win32.Throw();
return new ThreadHandle(threadHandle, true);
@@ -817,7 +891,10 @@ namespace ProcessHacker.Native.Objects
/// A handle to a debug object.
public void Debug(DebugObjectHandle debugObjectHandle)
{
- Win32.NtDebugActiveProcess(this, debugObjectHandle).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtDebugActiveProcess(this, debugObjectHandle)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -827,13 +904,16 @@ namespace ProcessHacker.Native.Objects
///
public void DisableHandleTracing()
{
+ NtStatus status;
+
// Length 0 and NULL disables handle tracing.
- Win32.NtSetInformationProcess(
+ if ((status = Win32.NtSetInformationProcess(
this,
ProcessInformationClass.ProcessHandleTracing,
IntPtr.Zero,
0
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -852,14 +932,16 @@ namespace ProcessHacker.Native.Objects
///
public void EnableHandleTracing()
{
+ NtStatus status;
ProcessHandleTracingEnable phte = new ProcessHandleTracingEnable();
- Win32.NtSetInformationProcess(
+ if ((status = Win32.NtSetInformationProcess(
this,
ProcessInformationClass.ProcessHandleTracing,
ref phte,
- ProcessHandleTracingEnable.SizeOf
- ).ThrowIf();
+ Marshal.SizeOf(phte)
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -869,10 +951,10 @@ namespace ProcessHacker.Native.Objects
public void EnumMemory(EnumMemoryDelegate enumMemoryCallback)
{
IntPtr address = IntPtr.Zero;
+ MemoryBasicInformation mbi = new MemoryBasicInformation();
+ int mbiSize = Marshal.SizeOf(mbi);
- MemoryBasicInformation mbi;
-
- while (Win32.VirtualQueryEx(this, address, out mbi, MemoryBasicInformation.SizeOf) != 0)
+ while (Win32.VirtualQueryEx(this, address, out mbi, mbiSize) != 0)
{
if (!enumMemoryCallback(mbi))
break;
@@ -905,23 +987,23 @@ namespace ProcessHacker.Native.Objects
if (!Win32.EnumProcessModules(this, moduleHandles, requiredSize, out requiredSize))
Win32.Throw();
- foreach (IntPtr t in moduleHandles)
+ for (int i = 0; i < moduleHandles.Length; i++)
{
ModuleInfo moduleInfo = new ModuleInfo();
StringBuilder baseName = new StringBuilder(0x400);
StringBuilder fileName = new StringBuilder(0x400);
- if (!Win32.GetModuleInformation(this, t, moduleInfo, ModuleInfo.SizeOf))
+ if (!Win32.GetModuleInformation(this, moduleHandles[i], moduleInfo, Marshal.SizeOf(moduleInfo)))
Win32.Throw();
- if (Win32.GetModuleBaseName(this, t, baseName, baseName.Capacity * 2) == 0)
+ if (Win32.GetModuleBaseName(this, moduleHandles[i], baseName, baseName.Capacity * 2) == 0)
Win32.Throw();
- if (Win32.GetModuleFileNameEx(this, t, fileName, fileName.Capacity * 2) == 0)
+ if (Win32.GetModuleFileNameEx(this, moduleHandles[i], fileName, fileName.Capacity * 2) == 0)
Win32.Throw();
if (!enumModulesCallback(new ProcessModule(
- moduleInfo.BaseOfDll, moduleInfo.SizeOfImage, moduleInfo.EntryPoint, 0,
- baseName.ToString(), FileUtils.GetFileName(fileName.ToString())
- )))
+ moduleInfo.BaseOfDll, moduleInfo.SizeOfImage, moduleInfo.EntryPoint, 0,
+ baseName.ToString(), FileUtils.GetFileName(fileName.ToString())
+ )))
break;
}
}
@@ -941,7 +1023,7 @@ namespace ProcessHacker.Native.Objects
PebLdrData data;
// Read the loader data table structure.
- this.ReadMemory(loaderData, &data, PebLdrData.SizeOf);
+ this.ReadMemory(loaderData, &data, Marshal.SizeOf(typeof(PebLdrData)));
if (!data.Initialized)
throw new Exception("Loader data is not initialized.");
@@ -961,7 +1043,7 @@ namespace ProcessHacker.Native.Objects
break;
// Read the loader data table entry.
- this.ReadMemory(currentLink, ¤tEntry, LdrDataTableEntry.SizeOf);
+ this.ReadMemory(currentLink, ¤tEntry, Marshal.SizeOf(typeof(LdrDataTableEntry)));
// Check if the entry is valid.
if (currentEntry.DllBase != IntPtr.Zero)
@@ -1009,15 +1091,17 @@ namespace ProcessHacker.Native.Objects
/// A NT status value.
public NtStatus FlushMemory(IntPtr baseAddress, int size)
{
+ NtStatus status;
IntPtr sizeIntPtr = size.ToIntPtr();
IoStatusBlock isb;
- Win32.NtFlushVirtualMemory(
+ if ((status = Win32.NtFlushVirtualMemory(
this,
ref baseAddress,
ref sizeIntPtr,
out isb
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return isb.Status;
}
@@ -1041,37 +1125,31 @@ namespace ProcessHacker.Native.Objects
/// reserve the memory instead of freeing it.
public void FreeMemory(IntPtr baseAddress, int size, bool reserveOnly)
{
+ NtStatus status;
IntPtr sizeIntPtr = size.ToIntPtr();
// Size needs to be 0 if we're freeing.
if (!reserveOnly)
sizeIntPtr = IntPtr.Zero;
- Win32.NtFreeVirtualMemory(
+ if ((status = Win32.NtFreeVirtualMemory(
this,
ref baseAddress,
ref sizeIntPtr,
reserveOnly ? MemoryFlags.Decommit : MemoryFlags.Release
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
- /// Gets/Sets the processor affinity for the process.
+ /// Gets the processor affinity for the process.
///
/// The processor affinity for the process.
- public long AffinityMask
+ public long GetAffinityMask()
{
- get
- {
- long systemMask;
+ long systemMask;
- return this.GetAffinityMask(out systemMask);
- }
- set
- {
- if (!Win32.SetProcessAffinityMask(this, new IntPtr(value)))
- Win32.Throw();
- }
+ return this.GetAffinityMask(out systemMask);
}
///
@@ -1095,10 +1173,9 @@ namespace ProcessHacker.Native.Objects
///
/// Gets the base priority of the process.
///
- public int BasePriority
+ public int GetBasePriority()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessBasePriority); }
- set { this.SetInformationInt32(ProcessInformationClass.ProcessBasePriority, value); }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessBasePriority);
}
///
@@ -1108,16 +1185,13 @@ namespace ProcessHacker.Native.Objects
/// A PROCESS_BASIC_INFORMATION structure.
public ProcessBasicInformation GetBasicInformation()
{
+ NtStatus status;
ProcessBasicInformation pbi;
int retLen;
- Win32.NtQueryInformationProcess(
- this,
- ProcessInformationClass.ProcessBasicInformation,
- out pbi,
- ProcessBasicInformation.SizeOf,
- out retLen
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationProcess(this, ProcessInformationClass.ProcessBasicInformation,
+ out pbi, Marshal.SizeOf(typeof(ProcessBasicInformation)), out retLen)) >= NtStatus.Error)
+ Win32.Throw(status);
return pbi;
}
@@ -1127,15 +1201,12 @@ namespace ProcessHacker.Native.Objects
/// the PROCESS_QUERY_LIMITED_INFORMATION and PROCESS_VM_READ permissions.
///
/// A string.
- public string CommandLine
+ public string GetCommandLine()
{
- get
- {
- if (!this.IsPosix)
- return this.GetPebString(PebOffset.CommandLine);
-
+ if (!this.IsPosix())
+ return this.GetPebString(PebOffset.CommandLine);
+ else
return this.GetPosixCommandLine();
- }
}
///
@@ -1149,9 +1220,9 @@ namespace ProcessHacker.Native.Objects
///
/// Gets the creation time of the process.
///
- public DateTime CreateTime
+ public DateTime GetCreateTime()
{
- get { return DateTime.FromFileTime(this.GetTimes()[0]); }
+ return DateTime.FromFileTime(this.GetTimes()[0]);
}
///
@@ -1173,7 +1244,9 @@ namespace ProcessHacker.Native.Objects
/// A debug object handle.
public DebugObjectHandle GetDebugObject()
{
- IntPtr handle = this.GetDebugObjectHandle();
+ IntPtr handle;
+
+ handle = this.GetDebugObjectHandle();
// Check if we got a handle. If we didn't the process is not being debugged.
if (handle == IntPtr.Zero)
@@ -1188,61 +1261,43 @@ namespace ProcessHacker.Native.Objects
}
///
- /// Gets/Sets the process' DEP policy.
+ /// Gets the process' DEP policy.
///
/// A DepStatus enum.
- public DepStatus DepStatus
+ public DepStatus GetDepStatus()
{
- get
+ MemExecuteOptions options;
+
+ // If we're on 64-bit and the process isn't under
+ // WOW64, it must be under permanent DEP.
+ if (OSVersion.Architecture == OSArch.Amd64)
{
- // If we're on 64-bit and the process isn't under
- // WOW64, it must be under permanent DEP.
- if (OSVersion.Architecture == OSArch.Amd64)
- {
- if (!this.IsWow64)
- return DepStatus.Enabled | DepStatus.Permanent;
- }
-
- MemExecuteOptions options = (MemExecuteOptions)this.GetInformationInt32(ProcessInformationClass.ProcessExecuteFlags);
-
- DepStatus depStatus = 0;
-
- // Check if execution of data pages is enabled.
- if ((options & MemExecuteOptions.ExecuteEnable) == MemExecuteOptions.ExecuteEnable)
- return 0;
-
- // Check if execution of data pages is disabled.
- if ((options & MemExecuteOptions.ExecuteDisable) == MemExecuteOptions.ExecuteDisable)
- depStatus = DepStatus.Enabled;
- // ExecuteDisable and ExecuteEnable are both disabled in OptOut mode.
- else if ((options & MemExecuteOptions.ExecuteDisable) == 0 &&
- (options & MemExecuteOptions.ExecuteEnable) == 0)
- depStatus = DepStatus.Enabled;
-
- if ((options & MemExecuteOptions.DisableThunkEmulation) == MemExecuteOptions.DisableThunkEmulation)
- depStatus |= DepStatus.AtlThunkEmulationDisabled;
- if ((options & MemExecuteOptions.Permanent) == MemExecuteOptions.Permanent)
- depStatus |= DepStatus.Permanent;
-
- return depStatus;
+ if (!this.IsWow64())
+ return DepStatus.Enabled | DepStatus.Permanent;
}
- set
- {
- MemExecuteOptions executeOptions = 0;
- if (value.HasFlag(DepStatus.Enabled))
- executeOptions |= MemExecuteOptions.ExecuteDisable;
- else
- executeOptions |= MemExecuteOptions.ExecuteEnable;
+ options = (MemExecuteOptions)this.GetInformationInt32(ProcessInformationClass.ProcessExecuteFlags);
- if (value.HasFlag(DepStatus.AtlThunkEmulationDisabled))
- executeOptions |= MemExecuteOptions.DisableThunkEmulation;
+ DepStatus depStatus = 0;
- if (value.HasFlag(DepStatus.Permanent))
- executeOptions |= MemExecuteOptions.Permanent;
+ // Check if execution of data pages is enabled.
+ if ((options & MemExecuteOptions.ExecuteEnable) == MemExecuteOptions.ExecuteEnable)
+ return 0;
- //KProcessHacker.Instance.SetExecuteOptions(this, executeOptions);
- }
+ // Check if execution of data pages is disabled.
+ if ((options & MemExecuteOptions.ExecuteDisable) == MemExecuteOptions.ExecuteDisable)
+ depStatus = DepStatus.Enabled;
+ // ExecuteDisable and ExecuteEnable are both disabled in OptOut mode.
+ else if ((options & MemExecuteOptions.ExecuteDisable) == 0 &&
+ (options & MemExecuteOptions.ExecuteEnable) == 0)
+ depStatus = DepStatus.Enabled;
+
+ if ((options & MemExecuteOptions.DisableThunkEmulation) == MemExecuteOptions.DisableThunkEmulation)
+ depStatus |= DepStatus.AtlThunkEmulationDisabled;
+ if ((options & MemExecuteOptions.Permanent) == MemExecuteOptions.Permanent)
+ depStatus |= DepStatus.Permanent;
+
+ return depStatus;
}
///
@@ -1262,7 +1317,7 @@ namespace ProcessHacker.Native.Objects
// Get a pointer to the environment block.
this.ReadMemory(processParameters.Increment(RtlUserProcessParameters.EnvironmentOffset), buffer, IntPtr.Size);
IntPtr envBase = *(IntPtr*)buffer;
- int length;
+ int length = 0;
{
MemoryBasicInformation mbi = this.QueryMemory(envBase);
@@ -1356,7 +1411,8 @@ namespace ProcessHacker.Native.Objects
///
/// Gets a GUI handle count.
///
- /// If true, returns the number of USER handles. Otherwise, returns the number of GDI handles.
+ /// If true, returns the number of USER handles. Otherwise, returns
+ /// the number of GDI handles.
/// A handle count.
public int GetGuiResources(bool userObjects)
{
@@ -1375,45 +1431,45 @@ namespace ProcessHacker.Native.Objects
/// Gets the handles owned by the process.
///
/// An array of handle information structures.
- //public ProcessHandleInformation[] GetHandles()
- //{
- // int returnLength = 0;
- // int attempts = 0;
+ public ProcessHandleInformation[] GetHandles()
+ {
+ int returnLength = 0;
+ int attempts = 0;
- // using (MemoryAlloc data = new MemoryAlloc(0x1000))
- // {
- // while (true)
- // {
- // try
- // {
- // //KProcessHacker.Instance.KphQueryProcessHandles(this, data, data.Size, out returnLength);
- // }
- // catch (WindowsException ex)
- // {
- // if (attempts > 3)
- // throw ex;
+ using (var data = new MemoryAlloc(0x1000))
+ {
+ while (true)
+ {
+ try
+ {
+ KProcessHacker.Instance.KphQueryProcessHandles(this, data, data.Size, out returnLength);
+ }
+ catch (WindowsException ex)
+ {
+ if (attempts > 3)
+ throw ex;
- // if (
- // ex.Status == NtStatus.BufferTooSmall &&
- // returnLength > data.Size
- // )
- // data.ResizeNew(returnLength);
+ if (
+ ex.Status == NtStatus.BufferTooSmall &&
+ returnLength > data.Size
+ )
+ data.ResizeNew(returnLength);
- // attempts++;
+ attempts++;
- // continue;
- // }
+ continue;
+ }
- // int handleCount = data.ReadInt32(0);
- // ProcessHandleInformation[] handles = new ProcessHandleInformation[handleCount];
+ int handleCount = data.ReadInt32(0);
+ ProcessHandleInformation[] handles = new ProcessHandleInformation[handleCount];
- // for (int i = 0; i < handleCount; i++)
- // handles[i] = data.ReadStruct(sizeof(int), ProcessHandleInformation.SizeOf, i);
+ for (int i = 0; i < handleCount; i++)
+ handles[i] = data.ReadStruct(sizeof(int), i);
- // return handles;
- // }
- // }
- //}
+ return handles;
+ }
+ }
+ }
///
/// Gets a collection of handle stack traces. This requires
@@ -1439,17 +1495,15 @@ namespace ProcessHacker.Native.Objects
NtStatus status = NtStatus.Success;
int retLength;
- using (MemoryAlloc data = new MemoryAlloc(0x10000))
+ using (var data = new MemoryAlloc(0x10000))
{
+ var query = new ProcessHandleTracingQuery();
+
// If Handle is not NULL, NtQueryInformationProcess will
// get a specific stack trace. Otherwise, it will get
// all of the stack traces.
- ProcessHandleTracingQuery query = new ProcessHandleTracingQuery
- {
- Handle = handle
- };
-
- data.WriteStruct(query);
+ query.Handle = handle;
+ data.WriteStruct(query);
for (int i = 0; i < 8; i++)
{
@@ -1467,7 +1521,8 @@ namespace ProcessHacker.Native.Objects
continue;
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return new ProcessHandleTraceCollection(data);
}
@@ -1499,9 +1554,9 @@ namespace ProcessHacker.Native.Objects
/// QueryLimitedInformation access.
///
/// A file name, in native format.
- public string ImageFileName
+ public string GetImageFileName()
{
- get { return FileUtils.GetFileName(this.GetInformationUnicodeString(ProcessInformationClass.ProcessImageFileName)); }
+ return this.GetInformationUnicodeString(ProcessInformationClass.ProcessImageFileName);
}
///
@@ -1515,36 +1570,106 @@ namespace ProcessHacker.Native.Objects
}
///
- /// Gets/Sets the process' I/O priority, ranging from 0-7.
+ /// Gets information about the process in an Int32.
+ ///
+ /// The class of information to retrieve.
+ /// An int.
+ private int GetInformationInt32(ProcessInformationClass infoClass)
+ {
+ if (
+ KProcessHacker.Instance != null &&
+ infoClass == ProcessInformationClass.ProcessIoPriority
+ )
+ {
+ unsafe
+ {
+ int value;
+ int retLength;
+
+ KProcessHacker.Instance.KphQueryInformationProcess(
+ this, infoClass, new IntPtr(&value), sizeof(int), out retLength
+ );
+
+ return value;
+ }
+ }
+ else
+ {
+ NtStatus status;
+ int value;
+ int retLength;
+
+ if ((status = Win32.NtQueryInformationProcess(
+ this, infoClass, out value, sizeof(int), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return value;
+ }
+ }
+
+ ///
+ /// Gets information about the process in an IntPtr.
+ ///
+ /// The class of information to retrieve.
+ /// An IntPtr.
+ private IntPtr GetInformationIntPtr(ProcessInformationClass infoClass)
+ {
+ NtStatus status;
+ IntPtr value;
+ int retLength;
+
+ if ((status = Win32.NtQueryInformationProcess(
+ this, infoClass, out value, IntPtr.Size, out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return value;
+ }
+
+ private string GetInformationUnicodeString(ProcessInformationClass infoClass)
+ {
+ NtStatus status;
+ int retLen;
+
+ Win32.NtQueryInformationProcess(this, infoClass, IntPtr.Zero, 0, out retLen);
+
+ using (MemoryAlloc data = new MemoryAlloc(retLen))
+ {
+ if ((status = Win32.NtQueryInformationProcess(this, infoClass, data, retLen, out retLen)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return data.ReadStruct().Read();
+ }
+ }
+
+ ///
+ /// Gets the process' I/O priority, ranging from 0-7.
///
///
- public int IoPriority
+ public int GetIoPriority()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessIoPriority); }
- set { this.SetInformationInt32(ProcessInformationClass.ProcessIoPriority, value); }
- }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessIoPriority);
+ }
///
/// Gets I/O statistics for the process.
///
/// A IoCounters structure.
- public IoCounters IoStatistics
+ public IoCounters GetIoStatistics()
{
- get
- {
- IoCounters counters;
- int retLength;
+ NtStatus status;
+ IoCounters counters;
+ int retLength;
- Win32.NtQueryInformationProcess(
- this,
- ProcessInformationClass.ProcessIoCounters,
- out counters,
- IoCounters.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationProcess(
+ this,
+ ProcessInformationClass.ProcessIoCounters,
+ out counters,
+ Marshal.SizeOf(typeof(IoCounters)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return counters;
- }
+ return counters;
}
///
@@ -1553,50 +1678,51 @@ namespace ProcessHacker.Native.Objects
/// A job object handle.
public JobObjectHandle GetJobObject(JobObjectAccess access)
{
- IntPtr handle = JobObjectHandle.Open(this, access);
+ IntPtr handle;
+
+ handle = JobObjectHandle.Open(this, access);
if (handle != IntPtr.Zero)
return new JobObjectHandle(handle, true);
-
- return null;
+ else
+ return null;
}
///
/// Gets the type of well-known process.
///
/// A known process type.
- public KnownProcess KnownProcessType
+ public KnownProcess GetKnownProcessType()
{
- get
+ if (this.GetBasicInformation().UniqueProcessId.Equals(4))
+ return KnownProcess.System;
+
+ string fileName = FileUtils.GetFileName(this.GetImageFileName());
+
+ if (fileName.StartsWith(Environment.SystemDirectory, StringComparison.OrdinalIgnoreCase))
{
- if (this.GetBasicInformation().UniqueProcessId.Equals(4))
- return KnownProcess.System;
+ string baseName = fileName.Remove(0, Environment.SystemDirectory.Length).TrimStart('\\').ToLowerInvariant();
- string fileName = this.ImageFileName;
-
- if (fileName.StartsWith(Environment.SystemDirectory, StringComparison.OrdinalIgnoreCase))
+ switch (baseName)
{
- string baseName = fileName.Remove(0, Environment.SystemDirectory.Length).TrimStart('\\').ToLowerInvariant();
-
- switch (baseName)
- {
- case "smss.exe":
- return KnownProcess.SessionManager;
- case "csrss.exe":
- return KnownProcess.WindowsSubsystem;
- case "wininit.exe":
- return KnownProcess.WindowsStartup;
- case "services.exe":
- return KnownProcess.ServiceControlManager;
- case "lsass.exe":
- return KnownProcess.LocalSecurityAuthority;
- case "lsm.exe":
- return KnownProcess.LocalSessionManager;
- default:
- return KnownProcess.None;
- }
+ case "smss.exe":
+ return KnownProcess.SessionManager;
+ case "csrss.exe":
+ return KnownProcess.WindowsSubsystem;
+ case "wininit.exe":
+ return KnownProcess.WindowsStartup;
+ case "services.exe":
+ return KnownProcess.ServiceControlManager;
+ case "lsass.exe":
+ return KnownProcess.LocalSecurityAuthority;
+ case "lsm.exe":
+ return KnownProcess.LocalSessionManager;
+ default:
+ return KnownProcess.None;
}
-
+ }
+ else
+ {
return KnownProcess.None;
}
}
@@ -1606,20 +1732,17 @@ namespace ProcessHacker.Native.Objects
/// PROCESS_QUERY_INFORMATION and PROCESS_VM_READ permissions.
///
/// A ProcessModule.
- public ProcessModule MainModule
+ public ProcessModule GetMainModule()
{
- get
+ ProcessModule mainModule = null;
+
+ this.EnumModules((module) =>
{
- ProcessModule mainModule = null;
+ mainModule = module;
+ return false;
+ });
- this.EnumModules(module =>
- {
- mainModule = module;
- return false;
- });
-
- return mainModule;
- }
+ return mainModule;
}
///
@@ -1655,10 +1778,10 @@ namespace ProcessHacker.Native.Objects
);
}
- if (status.IsError())
+ if (status >= NtStatus.Error)
return null;
- return FileUtils.GetFileName(data.ReadStruct().Text);
+ return FileUtils.GetFileName(data.ReadStruct().Read());
}
}
@@ -1666,23 +1789,22 @@ namespace ProcessHacker.Native.Objects
/// Gets memory statistics for the process.
///
/// A VmCounters structure.
- public VmCounters MemoryStatistics
+ public VmCounters GetMemoryStatistics()
{
- get
- {
- VmCounters counters;
- int retLength;
+ NtStatus status;
+ VmCounters counters;
+ int retLength;
- Win32.NtQueryInformationProcess(
- this,
- ProcessInformationClass.ProcessVmCounters,
- out counters,
- VmCounters.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationProcess(
+ this,
+ ProcessInformationClass.ProcessVmCounters,
+ out counters,
+ Marshal.SizeOf(typeof(VmCounters)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return counters;
- }
+ return counters;
}
///
@@ -1694,7 +1816,7 @@ namespace ProcessHacker.Native.Objects
{
List modules = new List();
- this.EnumModules(module =>
+ this.EnumModules((module) =>
{
modules.Add(module);
return true;
@@ -1710,20 +1832,22 @@ namespace ProcessHacker.Native.Objects
/// A process handle.
public ProcessHandle GetNextProcess(ProcessAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.NtGetNextProcess(
+ if ((status = Win32.NtGetNextProcess(
this,
access,
0,
0,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (handle != IntPtr.Zero)
return new ProcessHandle(handle, true);
-
- return null;
+ else
+ return null;
}
///
@@ -1734,30 +1858,31 @@ namespace ProcessHacker.Native.Objects
/// A thread handle.
public ThreadHandle GetNextThread(ThreadHandle threadHandle, ThreadAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.NtGetNextThread(
+ if ((status = Win32.NtGetNextThread(
this,
- threadHandle ?? IntPtr.Zero,
+ threadHandle != null ? threadHandle : IntPtr.Zero,
access,
0,
0,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (handle != IntPtr.Zero)
return new ThreadHandle(handle, true);
-
- return null;
+ else
+ return null;
}
///
/// Gets the process' page priority, ranging from 0-7.
///
- public int PagePriority
+ public int GetPagePriority()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessPagePriority); }
- set { this.SetInformationInt32(ProcessInformationClass.ProcessPagePriority, value); }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessPagePriority);
}
///
@@ -1765,9 +1890,9 @@ namespace ProcessHacker.Native.Objects
/// the PROCESS_QUERY_LIMITED_INFORMATION permission.
///
/// The process ID.
- public int ParentPid
+ public int GetParentPid()
{
- get { return this.GetBasicInformation().InheritedFromUniqueProcessId.ToInt32(); }
+ return this.GetBasicInformation().InheritedFromUniqueProcessId.ToInt32();
}
///
@@ -1790,7 +1915,7 @@ namespace ProcessHacker.Native.Objects
// Read the UNICODE_STRING structure.
UnicodeString pebStr;
- this.ReadMemory(processParameters.Increment(realOffset), &pebStr, UnicodeString.SizeOf);
+ this.ReadMemory(processParameters.Increment(realOffset), &pebStr, Marshal.SizeOf(typeof(UnicodeString)));
// read string and decode it
return Encoding.Unicode.GetString(this.ReadMemory(pebStr.Buffer, pebStr.Length), 0, pebStr.Length);
@@ -1815,9 +1940,8 @@ namespace ProcessHacker.Native.Objects
this.ReadMemory(
processParameters.Increment(GetPebOffset(PebOffset.CommandLine)),
&commandLineUs,
- UnicodeString.SizeOf
+ Marshal.SizeOf(typeof(UnicodeString))
);
-
IntPtr stringAddr = commandLineUs.Buffer;
/*
@@ -1852,8 +1976,7 @@ namespace ProcessHacker.Native.Objects
if (zeroReached)
break;
-
- if (value == IntPtr.Zero)
+ else if (value == IntPtr.Zero)
zeroReached = true;
}
@@ -1880,56 +2003,61 @@ namespace ProcessHacker.Native.Objects
}
///
- /// Gets/Sets the process' priority class.
+ /// Gets the process' priority class.
///
/// A ProcessPriorityClass enum.
- public ProcessPriorityClass PriorityClass
+ public ProcessPriorityClass GetPriorityClass()
{
- get
- {
- ProcessPriorityClassStruct priorityClass;
- int retLength;
+ //switch (Win32.GetPriorityClass(this))
+ //{
+ // case ProcessPriorityClassWin32.AboveNormal:
+ // return ProcessPriorityClass.AboveNormal;
+ // case ProcessPriorityClassWin32.BelowNormal:
+ // return ProcessPriorityClass.BelowNormal;
+ // case ProcessPriorityClassWin32.High:
+ // return ProcessPriorityClass.High;
+ // case ProcessPriorityClassWin32.Idle:
+ // return ProcessPriorityClass.Idle;
+ // case ProcessPriorityClassWin32.Normal:
+ // return ProcessPriorityClass.Normal;
+ // case ProcessPriorityClassWin32.RealTime:
+ // return ProcessPriorityClass.RealTime;
+ // default:
+ // Win32.Throw();
+ // // Stupid compiler
+ // return ProcessPriorityClass.Unknown;
+ //}
- Win32.NtQueryInformationProcess(
- this,
- ProcessInformationClass.ProcessPriorityClass,
- out priorityClass,
- ProcessPriorityClassStruct.SizeOf,
- out retLength
- ).ThrowIf();
+ NtStatus status;
+ ProcessPriorityClassStruct priorityClass;
+ int retLength;
- return (ProcessPriorityClass)priorityClass.PriorityClass;
- }
- set
- {
- ProcessPriorityClassStruct processPriority;
+ if ((status = Win32.NtQueryInformationProcess(
+ this,
+ ProcessInformationClass.ProcessPriorityClass,
+ out priorityClass,
+ Marshal.SizeOf(typeof(ProcessPriorityClassStruct)),
+ out retLength
+ )) != NtStatus.Success)
+ Win32.Throw(status);
- processPriority.Foreground = '\0';
- processPriority.PriorityClass = Convert.ToChar(value);
-
- Win32.NtSetInformationProcess(
- this,
- ProcessInformationClass.ProcessPriorityClass,
- ref processPriority,
- ProcessPriorityClassStruct.SizeOf
- ).ThrowIf();
- }
+ return (ProcessPriorityClass)priorityClass.PriorityClass;
}
///
/// Gets the process' unique identifier.
///
- public int ProcessId
+ public int GetProcessId()
{
- get { return this.GetBasicInformation().UniqueProcessId.ToInt32(); }
+ return this.GetBasicInformation().UniqueProcessId.ToInt32();
}
///
/// Gets the process' session ID.
///
- public int SessionId
+ public int GetSessionId()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessSessionInformation); }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessSessionInformation);
}
///
@@ -2012,20 +2140,17 @@ namespace ProcessHacker.Native.Objects
/// Gets whether the process is currently being debugged. This requires
/// QueryInformation access.
///
- public bool IsBeingDebugged
+ public bool IsBeingDebugged()
{
- get { return this.GetInformationIntPtr(ProcessInformationClass.ProcessDebugPort) != IntPtr.Zero; }
+ return this.GetInformationIntPtr(ProcessInformationClass.ProcessDebugPort) != IntPtr.Zero;
}
///
- /// Gets/Sets whether the system will crash upon the process being terminated.
- /// This function requires SeTcbPrivilege.
- /// Whether the system will crash upon the process being terminated.
+ /// Gets whether the system will crash upon the process being terminated.
///
- public bool IsCritical
+ public bool IsCritical()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessBreakOnTermination) != 0; }
- set { this.SetInformationInt32(ProcessInformationClass.ProcessBreakOnTermination, value ? 1 : 0); }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessBreakOnTermination) != 0;
}
///
@@ -2060,46 +2185,38 @@ namespace ProcessHacker.Native.Objects
///
/// Gets whether the process is a NTVDM process.
///
- public bool IsNtVdmProcess
+ public bool IsNtVdmProcess()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessWx86Information) != 0; }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessWx86Information) != 0;
}
///
/// Gets whether the process is using the POSIX subsystem.
///
- public unsafe bool IsPosix
+ public unsafe bool IsPosix()
{
- get
- {
- int subsystem;
- IntPtr pebBaseAddress = this.GetBasicInformation().PebBaseAddress;
+ int subsystem;
+ IntPtr pebBaseAddress = this.GetBasicInformation().PebBaseAddress;
- this.ReadMemory(pebBaseAddress.Increment(Peb.ImageSubsystemOffset), &subsystem, sizeof(int));
+ this.ReadMemory(pebBaseAddress.Increment(Peb.ImageSubsystemOffset), &subsystem, sizeof(int));
- return subsystem == 7;
- }
+ return subsystem == 7;
}
///
- /// Gets/Sets whether the process has priority boost enabled.
+ /// Gets whether the process has priority boost enabled.
///
- public bool IsPriorityBoostEnabled
+ public bool IsPriorityBoostEnabled()
{
- get { return this.GetInformationInt32(ProcessInformationClass.ProcessPriorityBoost) == 0; }
- set
- {
- // If priority boost is being enabled, we have to not disable it (hence the value of 0).
- this.SetInformationInt32(ProcessInformationClass.ProcessPriorityBoost, value ? 0 : 1);
- }
+ return this.GetInformationInt32(ProcessInformationClass.ProcessPriorityBoost) == 0;
}
///
/// Gets whether the process is running under WOW64.
///
- public bool IsWow64
+ public bool IsWow64()
{
- get { return this.GetInformationIntPtr(ProcessInformationClass.ProcessWow64Information) != IntPtr.Zero; }
+ return this.GetInformationIntPtr(ProcessInformationClass.ProcessWow64Information) != IntPtr.Zero;
}
///
@@ -2111,16 +2228,18 @@ namespace ProcessHacker.Native.Objects
/// The old memory protection.
public MemoryProtection ProtectMemory(IntPtr baseAddress, int size, MemoryProtection protection)
{
+ NtStatus status;
IntPtr sizeIntPtr = size.ToIntPtr();
MemoryProtection oldProtection;
- Win32.NtProtectVirtualMemory(
+ if ((status = Win32.NtProtectVirtualMemory(
this,
ref baseAddress,
ref sizeIntPtr,
protection,
out oldProtection
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return oldProtection;
}
@@ -2132,17 +2251,19 @@ namespace ProcessHacker.Native.Objects
/// A MEMORY_BASIC_INFORMATION structure.
public MemoryBasicInformation QueryMemory(IntPtr baseAddress)
{
+ NtStatus status;
MemoryBasicInformation mbi;
IntPtr retLength;
- Win32.NtQueryVirtualMemory(
+ if ((status = Win32.NtQueryVirtualMemory(
this,
baseAddress,
MemoryInformationClass.MemoryBasicInformation,
out mbi,
- MemoryBasicInformation.SizeOf.ToIntPtr(),
+ Marshal.SizeOf(typeof(MemoryBasicInformation)).ToIntPtr(),
out retLength
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return mbi;
}
@@ -2196,23 +2317,34 @@ namespace ProcessHacker.Native.Objects
/// The number of bytes read.
public int ReadMemory(IntPtr baseAddress, IntPtr buffer, int length)
{
+ int retLength;
+
if (this.Handle == Current)
{
Win32.RtlMoveMemory(buffer, baseAddress, length.ToIntPtr());
return length;
}
- IntPtr retLengthIntPtr;
+ if (KProcessHacker.Instance != null)
+ {
+ KProcessHacker.Instance.KphReadVirtualMemory(this, baseAddress.ToInt32(), buffer, length, out retLength);
+ }
+ else
+ {
+ NtStatus status;
+ IntPtr retLengthIntPtr;
- Win32.NtReadVirtualMemory(
- this,
- baseAddress,
- buffer,
- length.ToIntPtr(),
- out retLengthIntPtr
- ).ThrowIf();
+ if ((status = Win32.NtReadVirtualMemory(
+ this,
+ baseAddress,
+ buffer,
+ length.ToIntPtr(),
+ out retLengthIntPtr
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- int retLength = retLengthIntPtr.ToInt32();
+ retLength = retLengthIntPtr.ToInt32();
+ }
return retLength;
}
@@ -2244,7 +2376,10 @@ namespace ProcessHacker.Native.Objects
/// The debug object which was used to debug the process.
public void RemoveDebug(DebugObjectHandle debugObjectHandle)
{
- Win32.NtRemoveProcessDebug(this, debugObjectHandle).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRemoveProcessDebug(this, debugObjectHandle)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -2252,7 +2387,101 @@ namespace ProcessHacker.Native.Objects
///
public void Resume()
{
- Win32.NtResumeProcess(this).ThrowIf();
+ if (KProcessHacker.Instance != null && OSVersion.HasPsSuspendResumeProcess)
+ {
+ KProcessHacker.Instance.KphResumeProcess(this);
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtResumeProcess(this)) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+ }
+
+ ///
+ /// Sets the processor affinity for the process.
+ ///
+ /// The processor affinity mask.
+ public void SetAffinityMask(long processMask)
+ {
+ if (!Win32.SetProcessAffinityMask(this, new IntPtr(processMask)))
+ Win32.Throw();
+ }
+
+ ///
+ /// Sets the process' base priority.
+ ///
+ /// The process' base priority.
+ public void SetBasePriority(int basePriority)
+ {
+ this.SetInformationInt32(ProcessInformationClass.ProcessBasePriority, basePriority);
+ }
+
+ ///
+ /// Sets whether the system will crash upon the process being terminated.
+ /// This function requires SeTcbPrivilege.
+ ///
+ /// Whether the system will crash upon the process being terminated.
+ public void SetCritical(bool critical)
+ {
+ this.SetInformationInt32(ProcessInformationClass.ProcessBreakOnTermination, critical ? 1 : 0);
+ }
+
+ ///
+ /// Sets the process' DEP policy.
+ ///
+ /// The DEP options.
+ public void SetDepStatus(DepStatus depStatus)
+ {
+ MemExecuteOptions executeOptions = 0;
+
+ if ((depStatus & DepStatus.Enabled) == DepStatus.Enabled)
+ executeOptions |= MemExecuteOptions.ExecuteDisable;
+ else
+ executeOptions |= MemExecuteOptions.ExecuteEnable;
+
+ if ((depStatus & DepStatus.AtlThunkEmulationDisabled) == DepStatus.AtlThunkEmulationDisabled)
+ executeOptions |= MemExecuteOptions.DisableThunkEmulation;
+ if ((depStatus & DepStatus.Permanent) == DepStatus.Permanent)
+ executeOptions |= MemExecuteOptions.Permanent;
+
+ KProcessHacker.Instance.SetExecuteOptions(this, executeOptions);
+ }
+
+ ///
+ /// Sets information about the process in an Int32.
+ ///
+ /// The class of information to set.
+ /// The value to set.
+ private void SetInformationInt32(ProcessInformationClass infoClass, int value)
+ {
+ if (
+ KProcessHacker.Instance != null &&
+ infoClass == ProcessInformationClass.ProcessIoPriority
+ )
+ {
+ unsafe
+ {
+ KProcessHacker.Instance.KphSetInformationProcess(
+ this, infoClass, new IntPtr(&value), sizeof(int)
+ );
+ }
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtSetInformationProcess(
+ this, infoClass, ref value, sizeof(int))) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+ }
+
+ public void SetIoPriority(int ioPriority)
+ {
+ this.SetInformationInt32(ProcessInformationClass.ProcessIoPriority, ioPriority);
}
///
@@ -2273,7 +2502,7 @@ namespace ProcessHacker.Native.Objects
IntPtr loaderData = *(IntPtr*)buffer;
PebLdrData data;
- this.ReadMemory(loaderData, &data, PebLdrData.SizeOf);
+ this.ReadMemory(loaderData, &data, Marshal.SizeOf(typeof(PebLdrData)));
if (!data.Initialized)
throw new Exception("Loader data is not initialized.");
@@ -2291,7 +2520,7 @@ namespace ProcessHacker.Native.Objects
if (i > 0x800)
break;
- this.ReadMemory(currentLink, ¤tEntry, LdrDataTableEntry.SizeOf);
+ this.ReadMemory(currentLink, ¤tEntry, Marshal.SizeOf(typeof(LdrDataTableEntry)));
if (currentEntry.DllBase == baseAddress)
{
@@ -2304,13 +2533,87 @@ namespace ProcessHacker.Native.Objects
}
}
+ public void SetPagePriority(int pagePriority)
+ {
+ this.SetInformationInt32(ProcessInformationClass.ProcessPagePriority, pagePriority);
+ }
+
+ ///
+ /// Sets the process' priority boost.
+ ///
+ /// Whether priority boost will be enabled.
+ public void SetPriorityBoost(bool enabled)
+ {
+ // If priority boost is being enabled, we have to not disable it (hence the value of 0).
+ this.SetInformationInt32(ProcessInformationClass.ProcessPriorityBoost, enabled ? 0 : 1);
+ }
+
+ ///
+ /// Sets the process' priority class.
+ ///
+ /// The process' priority class.
+ public void SetPriorityClass(ProcessPriorityClass priorityClass)
+ {
+ //ProcessPriorityClassWin32 pcWin32;
+
+ //switch (priorityClass)
+ //{
+ // case ProcessPriorityClass.AboveNormal:
+ // pcWin32 = ProcessPriorityClassWin32.AboveNormal;
+ // break;
+ // case ProcessPriorityClass.BelowNormal:
+ // pcWin32 = ProcessPriorityClassWin32.BelowNormal;
+ // break;
+ // case ProcessPriorityClass.High:
+ // pcWin32 = ProcessPriorityClassWin32.High;
+ // break;
+ // case ProcessPriorityClass.Idle:
+ // pcWin32 = ProcessPriorityClassWin32.Idle;
+ // break;
+ // case ProcessPriorityClass.Normal:
+ // pcWin32 = ProcessPriorityClassWin32.Normal;
+ // break;
+ // case ProcessPriorityClass.RealTime:
+ // pcWin32 = ProcessPriorityClassWin32.RealTime;
+ // break;
+ // default:
+ // throw new ArgumentException("priorityClass");
+ //}
+
+ //if (!Win32.SetPriorityClass(this, pcWin32))
+ // Win32.Throw();
+
+ NtStatus status;
+ ProcessPriorityClassStruct processPriority;
+
+ processPriority.Foreground = '\0';
+ processPriority.PriorityClass = Convert.ToChar(priorityClass);
+
+ if ((status = Win32.NtSetInformationProcess(
+ this,
+ ProcessInformationClass.ProcessPriorityClass,
+ ref processPriority,
+ Marshal.SizeOf(typeof(ProcessPriorityClassStruct))
+ )) != NtStatus.Success)
+ Win32.Throw(status);
+ }
///
/// Suspends the process. This requires PROCESS_SUSPEND_RESUME access.
///
public void Suspend()
{
- Win32.NtSuspendProcess(this).ThrowIf();
+ if (KProcessHacker.Instance != null && OSVersion.HasPsSuspendResumeProcess)
+ {
+ KProcessHacker.Instance.KphSuspendProcess(this);
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtSuspendProcess(this)) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
}
///
@@ -2327,7 +2630,17 @@ namespace ProcessHacker.Native.Objects
/// The exit status.
public void Terminate(NtStatus exitStatus)
{
- Win32.NtTerminateProcess(this, exitStatus).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ KProcessHacker.Instance.KphTerminateProcess(this, exitStatus);
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtTerminateProcess(this, exitStatus)) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
}
///
@@ -2353,10 +2666,8 @@ namespace ProcessHacker.Native.Objects
/// The type of minidump to write.
public void WriteDump(string fileName, MinidumpType type)
{
- using (FileHandle fhandle = FileHandle.CreateWin32(fileName, FileAccess.GenericWrite))
- {
+ using (var fhandle = FileHandle.CreateWin32(fileName, FileAccess.GenericWrite))
this.WriteDump(fhandle, type);
- }
}
///
@@ -2368,7 +2679,7 @@ namespace ProcessHacker.Native.Objects
{
if (!Win32.MiniDumpWriteDump(
this,
- this.ProcessId,
+ this.GetProcessId(),
fileHandle,
type,
IntPtr.Zero,
@@ -2384,11 +2695,14 @@ namespace ProcessHacker.Native.Objects
/// The offset at which to begin writing.
/// The data to write.
/// The length, in bytes, that was written.
- public unsafe int WriteMemory(IntPtr baseAddress, byte[] buffer)
+ public int WriteMemory(IntPtr baseAddress, byte[] buffer)
{
- fixed (byte* dataPtr = buffer)
+ unsafe
{
- return WriteMemory(baseAddress, dataPtr, buffer.Length);
+ fixed (byte* dataPtr = buffer)
+ {
+ return WriteMemory(baseAddress, dataPtr, buffer.Length);
+ }
}
}
@@ -2413,94 +2727,36 @@ namespace ProcessHacker.Native.Objects
/// The length, in bytes, that was written.
public int WriteMemory(IntPtr baseAddress, IntPtr buffer, int length)
{
+ int retLength;
+
if (this.Handle == Current)
{
Win32.RtlMoveMemory(baseAddress, buffer, length.ToIntPtr());
return length;
}
- IntPtr retLengthIntPtr;
-
- Win32.NtWriteVirtualMemory(
- this,
- baseAddress,
- buffer,
- length.ToIntPtr(),
- out retLengthIntPtr
- ).ThrowIf();
-
- return retLengthIntPtr.ToInt32();
- }
-
- ///
- /// Gets information about the process in an Int32.
- ///
- /// The class of information to retrieve.
- /// An int.
- private int GetInformationInt32(ProcessInformationClass infoClass)
- {
- int value;
- int retLength;
-
- Win32.NtQueryInformationProcess(
- this,
- infoClass,
- out value,
- sizeof(int),
- out retLength
- ).ThrowIf();
-
- return value;
- }
-
- ///
- /// Gets information about the process in an IntPtr.
- ///
- /// The class of information to retrieve.
- /// An IntPtr.
- private IntPtr GetInformationIntPtr(ProcessInformationClass infoClass)
- {
- IntPtr value;
- int retLength;
-
- Win32.NtQueryInformationProcess(
- this,
- infoClass,
- out value,
- IntPtr.Size,
- out retLength
- ).ThrowIf();
-
- return value;
- }
-
- private string GetInformationUnicodeString(ProcessInformationClass infoClass)
- {
- int retLen;
-
- Win32.NtQueryInformationProcess(this, infoClass, IntPtr.Zero, 0, out retLen);
-
- using (MemoryAlloc data = new MemoryAlloc(retLen))
+ if (KProcessHacker.Instance != null)
{
- Win32.NtQueryInformationProcess(this, infoClass, data, retLen, out retLen).ThrowIf();
-
- return data.ReadStruct().Text;
+ KProcessHacker.Instance.KphWriteVirtualMemory(this, baseAddress.ToInt32(), buffer, length, out retLength);
}
- }
+ else
+ {
+ NtStatus status;
+ IntPtr retLengthIntPtr;
- ///
- /// Sets information about the process in an Int32.
- ///
- /// The class of information to set.
- /// The value to set.
- private void SetInformationInt32(ProcessInformationClass infoClass, int value)
- {
- Win32.NtSetInformationProcess(
- this,
- infoClass,
- ref value,
- sizeof(int)
- ).ThrowIf();
+ if ((status = Win32.NtWriteVirtualMemory(
+ this,
+ baseAddress,
+ buffer,
+ length.ToIntPtr(),
+ out retLengthIntPtr
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ retLength = retLengthIntPtr.ToInt32();
+ }
+
+ return retLength;
}
}
@@ -2509,10 +2765,10 @@ namespace ProcessHacker.Native.Objects
///
public class ProcessHandleTrace
{
- private readonly ClientId _clientId;
- private readonly IntPtr _handle;
- private readonly IntPtr[] _stack;
- private readonly HandleTraceType _type;
+ private ClientId _clientId;
+ private IntPtr _handle;
+ private IntPtr[] _stack;
+ private HandleTraceType _type;
internal ProcessHandleTrace(ProcessHandleTracingEntry entry)
{
@@ -2521,7 +2777,7 @@ namespace ProcessHacker.Native.Objects
_type = entry.Type;
// Find the first occurrence of a NULL to find where the trace stops.
- int zeroIndex = Array.IndexOf(entry.Stacks, IntPtr.Zero);
+ int zeroIndex = Array.IndexOf(entry.Stacks, IntPtr.Zero);
// If there was no NULL, copy the entire array.
if (zeroIndex == -1)
@@ -2570,16 +2826,16 @@ namespace ProcessHacker.Native.Objects
///
public class ProcessHandleTraceCollection : ReadOnlyCollection
{
- private readonly IntPtr _handle;
+ private IntPtr _handle;
internal ProcessHandleTraceCollection(MemoryAlloc data)
: base(new List())
{
- if (data.Size < ProcessHandleTracingEntry.SizeOf)
+ if (data.Size < Marshal.SizeOf(typeof(ProcessHandleTracingQuery)))
throw new ArgumentException("Data memory allocation is too small.");
// Read the structure.
- ProcessHandleTracingQuery query = data.ReadStruct();
+ var query = data.ReadStruct();
_handle = query.Handle;
@@ -2588,9 +2844,8 @@ namespace ProcessHacker.Native.Objects
for (int i = 0; i < query.TotalTraces; i++)
{
- ProcessHandleTracingEntry entry = data.ReadStruct(
- ProcessHandleTracingQuery.HandleTraceOffset,
- ProcessHandleTracingEntry.SizeOf,
+ var entry = data.ReadStruct(
+ ProcessHandleTracingQuery.HandleTraceOffset,
i
);
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/ProfileHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/ProfileHandle.cs
index cad79dca2..73000759d 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/ProfileHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/ProfileHandle.cs
@@ -38,6 +38,7 @@ namespace ProcessHacker.Native.Objects
IntPtr affinity
)
{
+ NtStatus status;
IntPtr handle;
if (bucketSize < 2 || bucketSize > 30)
@@ -48,7 +49,7 @@ namespace ProcessHacker.Native.Objects
uint realBucketSize = (uint)(2 << (bucketSize - 1));
MemoryAlloc buffer = new MemoryAlloc((int)((rangeSize - 1) / realBucketSize + 1) * sizeof(int)); // divide, round up
- Win32.NtCreateProfile(
+ if ((status = Win32.NtCreateProfile(
out handle,
processHandle ?? IntPtr.Zero,
rangeBase,
@@ -58,7 +59,8 @@ namespace ProcessHacker.Native.Objects
buffer.Size,
profileSource,
affinity
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new ProfileHandle(handle, true, rangeBase, rangeSize, realBucketSize, buffer);
}
@@ -66,19 +68,27 @@ namespace ProcessHacker.Native.Objects
public static int GetInterval(KProfileSource profileSource)
{
+ NtStatus status;
int interval;
- Win32.NtQueryIntervalProfile(profileSource, out interval).ThrowIf();
+ if ((status = Win32.NtQueryIntervalProfile(profileSource, out interval)) >= NtStatus.Error)
+ Win32.Throw(status);
return interval;
}
public static void SetInterval(KProfileSource profileSource, int interval)
{
- Win32.NtSetIntervalProfile(interval, profileSource).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSetIntervalProfile(interval, profileSource)) >= NtStatus.Error)
+ Win32.Throw(status);
}
- private readonly MemoryAlloc _buffer;
+ private IntPtr _rangeBase;
+ private uint _rangeSize;
+ private uint _bucketSize; // not logarithmic
+ private MemoryAlloc _buffer;
private ProfileHandle(
IntPtr handle,
@@ -90,6 +100,9 @@ namespace ProcessHacker.Native.Objects
)
: base(handle, owned)
{
+ _rangeBase = rangeBase;
+ _rangeSize = rangeSize;
+ _bucketSize = bucketSize;
_buffer = buffer;
}
@@ -111,12 +124,18 @@ namespace ProcessHacker.Native.Objects
public void Start()
{
- Win32.NtStartProfile(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtStartProfile(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void Stop()
{
- Win32.NtStopProfile(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtStopProfile(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/RemoteHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/RemoteHandle.cs
index d33c3ea84..2e2e0f757 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/RemoteHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/RemoteHandle.cs
@@ -29,8 +29,8 @@ namespace ProcessHacker.Native.Objects
///
public class RemoteHandle
{
- private readonly ProcessHandle _phandle;
- private readonly IntPtr _handle;
+ private ProcessHandle _phandle;
+ private IntPtr _handle;
public RemoteHandle(ProcessHandle phandle, IntPtr handle)
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/RemoteTokenHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/RemoteTokenHandle.cs
index 379dbf3e4..6f3b6ae82 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/RemoteTokenHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/RemoteTokenHandle.cs
@@ -42,7 +42,7 @@ namespace ProcessHacker.Native.Objects
public new IntPtr GetHandle(int rights)
{
- IntPtr newHandle;
+ IntPtr newHandle = IntPtr.Zero;
// We can use KPH here. RemoteHandle doesn't.
Win32.DuplicateObject(this.ProcessHandle, this.Handle, new IntPtr(-1), out newHandle, rights, 0, 0);
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/ResourceManagerHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/ResourceManagerHandle.cs
index f38161e7c..90dbe9f6b 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/ResourceManagerHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/ResourceManagerHandle.cs
@@ -39,26 +39,34 @@ namespace ProcessHacker.Native.Objects
string description
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
- UnicodeString descriptionStr = new UnicodeString(description);
try
{
- Win32.NtCreateResourceManager(
- out handle,
- access,
- tmHandle,
- ref guid,
- ref oa,
- createOptions,
- ref descriptionStr
- ).ThrowIf();
+ UnicodeString descriptionStr = new UnicodeString(description);
+
+ try
+ {
+ if ((status = Win32.NtCreateResourceManager(
+ out handle,
+ access,
+ tmHandle,
+ ref guid,
+ ref oa,
+ createOptions,
+ ref descriptionStr
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+ finally
+ {
+ descriptionStr.Dispose();
+ }
}
finally
{
- descriptionStr.Dispose();
-
oa.Dispose();
}
@@ -83,18 +91,20 @@ namespace ProcessHacker.Native.Objects
ResourceManagerAccess access
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenResourceManager(
+ if ((status = Win32.NtOpenResourceManager(
out handle,
access,
tmHandle,
ref guid,
ref oa
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -109,7 +119,7 @@ namespace ProcessHacker.Native.Objects
NtStatus status;
int retLength;
- MemoryAlloc data = new MemoryAlloc(0x1000);
+ var data = new MemoryAlloc(0x1000);
status = Win32.NtQueryInformationResourceManager(
this,
@@ -133,7 +143,7 @@ namespace ProcessHacker.Native.Objects
);
}
- if (status.IsError())
+ if (status >= NtStatus.Error)
{
data.Dispose();
Win32.Throw(status);
@@ -142,36 +152,33 @@ namespace ProcessHacker.Native.Objects
return data;
}
- public string Description
+ public string GetDescription()
{
- get
+ using (var data = this.GetBasicInformation())
{
- using (MemoryAlloc data = this.GetBasicInformation())
- {
- ResourceManagerBasicInformation basicInfo = data.ReadStruct();
+ var basicInfo = data.ReadStruct();
- return data.ReadUnicodeString(
- ResourceManagerBasicInformation.DescriptionOffset,
- basicInfo.DescriptionLength / 2
- );
- }
+ return data.ReadUnicodeString(
+ ResourceManagerBasicInformation.DescriptionOffset,
+ basicInfo.DescriptionLength / 2
+ );
}
}
- public Guid Guid
+ public Guid GetGuid()
{
- get
+ using (var data = this.GetBasicInformation())
{
- using (MemoryAlloc data = this.GetBasicInformation())
- {
- return data.ReadStruct().ResourceManagerId;
- }
+ return data.ReadStruct().ResourceManagerId;
}
}
public void Recover()
{
- Win32.NtRecoverResourceManager(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRecoverResourceManager(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SamAliasHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SamAliasHandle.cs
index 954f49183..8c328e0a8 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SamAliasHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SamAliasHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -33,19 +34,22 @@ namespace ProcessHacker.Native.Objects
{
public static SamAliasHandle Create(SamAliasAccess access, SamDomainHandle domainHandle, string name, out int aliasId)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr handle;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.SamCreateAliasInDomain(
+ if ((status = Win32.SamCreateAliasInDomain(
domainHandle,
ref nameStr,
access,
out handle,
out aliasId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -62,7 +66,7 @@ namespace ProcessHacker.Native.Objects
public static SamAliasHandle Open(Sid sid, SamAliasAccess access)
{
- using (SamDomainHandle dhandle = new SamDomainHandle(sid.DomainName, SamDomainAccess.Lookup))
+ using (var dhandle = new SamDomainHandle(sid.DomainName, SamDomainAccess.Lookup))
{
return new SamAliasHandle(dhandle, dhandle.LookupName(sid.Name), access);
}
@@ -80,119 +84,129 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the alias.
public SamAliasHandle(SamDomainHandle domainHandle, int aliasId, SamAliasAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.SamOpenAlias(
+ if ((status = Win32.SamOpenAlias(
domainHandle,
access,
aliasId,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.Handle = handle;
}
public void AddMember(Sid sid)
{
- Win32.SamAddMemberToAlias(this, sid).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamAddMemberToAlias(this, sid)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddMembers(Sid[] sids)
{
+ NtStatus status;
IntPtr[] sidArray = new IntPtr[sids.Length];
for (int i = 0; i < sids.Length; i++)
sidArray[i] = sids[i];
- Win32.SamAddMultipleMembersToAlias(
+ if ((status = Win32.SamAddMultipleMembersToAlias(
this,
sidArray,
sids.Length
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void Delete()
{
- Win32.SamDeleteAlias(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamDeleteAlias(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
private SamMemoryAlloc GetInformation(AliasInformationClass infoClass)
{
+ NtStatus status;
IntPtr buffer;
- Win32.SamQueryInformationAlias(
+ if ((status = Win32.SamQueryInformationAlias(
this,
infoClass,
out buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SamMemoryAlloc(buffer);
}
- public string AdminComment
+ public string GetAdminComment()
{
- get
+ using (var data = this.GetInformation(AliasInformationClass.AliasAdminCommentInformation))
{
- using (SamMemoryAlloc data = this.GetInformation(AliasInformationClass.AliasAdminCommentInformation))
- {
- return data.ReadStruct().AdminComment.Text;
- }
+ return data.ReadStruct().AdminComment.Read();
}
}
- public Sid[] Members
+ public Sid[] GetMembers()
{
- get
+ NtStatus status;
+ IntPtr members;
+ int count;
+
+ if ((status = Win32.SamGetMembersInAlias(
+ this,
+ out members,
+ out count
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ using (var membersAlloc = new SamMemoryAlloc(members))
{
- IntPtr members;
- int count;
+ Sid[] sids = new Sid[count];
- Win32.SamGetMembersInAlias(
- this,
- out members,
- out count
- ).ThrowIf();
+ for (int i = 0; i < sids.Length; i++)
+ sids[i] = new Sid(membersAlloc.ReadIntPtr(0, i));
- using (SamMemoryAlloc membersAlloc = new SamMemoryAlloc(members))
- {
- Sid[] sids = new Sid[count];
-
- for (int i = 0; i < sids.Length; i++)
- sids[i] = new Sid(membersAlloc.ReadIntPtr(0, i));
-
- return sids;
- }
+ return sids;
}
}
- public string Name
+ public string GetName()
{
- get
+ using (var data = this.GetInformation(AliasInformationClass.AliasNameInformation))
{
- using (SamMemoryAlloc data = this.GetInformation(AliasInformationClass.AliasNameInformation))
- {
- return data.ReadStruct().Name.Text;
- }
+ return data.ReadStruct().Name.Read();
}
}
public void RemoveMember(Sid sid)
{
- Win32.SamRemoveMemberFromAlias(this, sid).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamRemoveMemberFromAlias(this, sid)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void RemoveMembers(Sid[] sids)
{
+ NtStatus status;
IntPtr[] sidArray = new IntPtr[sids.Length];
for (int i = 0; i < sids.Length; i++)
sidArray[i] = sids[i];
- Win32.SamRemoveMultipleMembersFromAlias(
+ if ((status = Win32.SamRemoveMultipleMembersFromAlias(
this,
sidArray,
sids.Length
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SamDomainHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SamDomainHandle.cs
index 12df34bac..a9a068a59 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SamDomainHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SamDomainHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -85,44 +86,49 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the domain.
public SamDomainHandle(SamServerHandle serverHandle, Sid domainId, SamDomainAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.SamOpenDomain(
+ if ((status = Win32.SamOpenDomain(
serverHandle,
access,
domainId,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.Handle = handle;
}
public void EnumAliases(EnumAliasesDelegate callback)
{
+ NtStatus status;
int enumerationContext = 0;
IntPtr buffer;
int count;
while (true)
{
- Win32.SamEnumerateAliasesInDomain(
+ status = Win32.SamEnumerateAliasesInDomain(
this,
ref enumerationContext,
out buffer,
0x100,
out count
- ).ThrowIf();
+ );
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
if (count == 0)
break;
- using (SamMemoryAlloc bufferAlloc = new SamMemoryAlloc(buffer))
+ using (var bufferAlloc = new SamMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
- SamRidEnumeration data = bufferAlloc.ReadStruct(0, SamRidEnumeration.SizeOf, i);
+ var data = bufferAlloc.ReadStruct(i);
- if (!callback(data.Name.Text, data.RelativeId))
+ if (!callback(data.Name.Read(), data.RelativeId))
return;
}
}
@@ -131,30 +137,33 @@ namespace ProcessHacker.Native.Objects
public void EnumGroups(EnumGroupsDelegate callback)
{
+ NtStatus status;
int enumerationContext = 0;
IntPtr buffer;
int count;
while (true)
{
- Win32.SamEnumerateGroupsInDomain(
+ status = Win32.SamEnumerateGroupsInDomain(
this,
ref enumerationContext,
out buffer,
0x100,
out count
- ).ThrowIf();
+ );
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
if (count == 0)
break;
- using (SamMemoryAlloc bufferAlloc = new SamMemoryAlloc(buffer))
+ using (var bufferAlloc = new SamMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
- SamRidEnumeration data = bufferAlloc.ReadStruct(0, SamRidEnumeration.SizeOf, i);
+ var data = bufferAlloc.ReadStruct(i);
- if (!callback(data.Name.Text, data.RelativeId))
+ if (!callback(data.Name.Read(), data.RelativeId))
return;
}
}
@@ -168,31 +177,34 @@ namespace ProcessHacker.Native.Objects
public void EnumUsers(EnumUsersDelegate callback, UserAccountFlags flags)
{
+ NtStatus status;
int enumerationContext = 0;
IntPtr buffer;
int count;
while (true)
{
- Win32.SamEnumerateUsersInDomain(
+ status = Win32.SamEnumerateUsersInDomain(
this,
ref enumerationContext,
flags,
out buffer,
0x100,
out count
- ).ThrowIf();
+ );
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
if (count == 0)
break;
- using (SamMemoryAlloc bufferAlloc = new SamMemoryAlloc(buffer))
+ using (var bufferAlloc = new SamMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
- var data = bufferAlloc.ReadStruct(0, SamRidEnumeration.SizeOf, i);
+ var data = bufferAlloc.ReadStruct(i);
- if (!callback(data.Name.Text, data.RelativeId))
+ if (!callback(data.Name.Read(), data.RelativeId))
return;
}
}
@@ -201,44 +213,50 @@ namespace ProcessHacker.Native.Objects
public int[] GetAliasMembership(Sid sid)
{
+ NtStatus status;
IntPtr aliases;
int count;
- Win32.SamGetAliasMembership(
+ if ((status = Win32.SamGetAliasMembership(
this,
1,
new IntPtr[] { sid },
out count,
out aliases
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (aliases != IntPtr.Zero)
{
using (var aliasesAlloc = new SamMemoryAlloc(aliases))
return aliasesAlloc.ReadInt32Array(0, count);
}
-
- return new int[0];
+ else
+ {
+ return new int[0];
+ }
}
private SamMemoryAlloc GetInformation(DomainInformationClass infoClass)
{
+ NtStatus status;
IntPtr buffer;
- Win32.SamQueryInformationDomain(
+ if ((status = Win32.SamQueryInformationDomain(
this,
infoClass,
out buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SamMemoryAlloc(buffer);
}
public DomainPasswordPolicy GetPasswordPolicy()
{
- using (SamMemoryAlloc data = this.GetInformation(DomainInformationClass.DomainPasswordInformation))
+ using (var data = this.GetInformation(DomainInformationClass.DomainPasswordInformation))
{
- DomainPasswordInformation info = data.ReadStruct();
+ var info = data.ReadStruct();
return new DomainPasswordPolicy(
info.MinPasswordLength,
@@ -252,15 +270,17 @@ namespace ProcessHacker.Native.Objects
public Sid GetSid(int relativeId)
{
+ NtStatus status;
IntPtr sid;
- Win32.SamRidToSid(
+ if ((status = Win32.SamRidToSid(
this,
relativeId,
out sid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- using (SamMemoryAlloc sidAlloc = new SamMemoryAlloc(sid))
+ using (var sidAlloc = new SamMemoryAlloc(sid))
return new Sid(sidAlloc);
}
@@ -278,26 +298,28 @@ namespace ProcessHacker.Native.Objects
public string[] LookupIds(int[] relativeIds, out SidNameUse[] uses)
{
+ NtStatus status;
IntPtr names;
IntPtr use;
- Win32.SamLookupIdsInDomain(
+ if ((status = Win32.SamLookupIdsInDomain(
this,
relativeIds.Length,
relativeIds,
out names,
out use
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- using (SamMemoryAlloc namesAlloc = new SamMemoryAlloc(names))
- using (SamMemoryAlloc useAlloc = new SamMemoryAlloc(use))
+ using (var namesAlloc = new SamMemoryAlloc(names))
+ using (var useAlloc = new SamMemoryAlloc(use))
{
string[] nameArray = new string[relativeIds.Length];
SidNameUse[] useArray = new SidNameUse[relativeIds.Length];
for (int i = 0; i < relativeIds.Length; i++)
{
- nameArray[i] = namesAlloc.ReadStruct(0, UnicodeString.SizeOf, i).Text;
+ nameArray[i] = namesAlloc.ReadStruct(i).Read();
useArray[i] = (SidNameUse)useAlloc.ReadInt32(0, i);
}
@@ -321,23 +343,26 @@ namespace ProcessHacker.Native.Objects
public int[] LookupNames(string[] names, out SidNameUse[] uses)
{
+ NtStatus status;
+ UnicodeString[] nameStr;
IntPtr relativeIds;
IntPtr use;
- UnicodeString[] nameStr = new UnicodeString[names.Length];
+ nameStr = new UnicodeString[names.Length];
for (int i = 0; i < names.Length; i++)
nameStr[i] = new UnicodeString(names[i]);
try
{
- Win32.SamLookupNamesInDomain(
+ if ((status = Win32.SamLookupNamesInDomain(
this,
names.Length,
nameStr,
out relativeIds,
out use
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -345,8 +370,8 @@ namespace ProcessHacker.Native.Objects
nameStr[i].Dispose();
}
- using (SamMemoryAlloc relativeIdsAlloc = new SamMemoryAlloc(relativeIds))
- using (SamMemoryAlloc useAlloc = new SamMemoryAlloc(use))
+ using (var relativeIdsAlloc = new SamMemoryAlloc(relativeIds))
+ using (var useAlloc = new SamMemoryAlloc(use))
{
SidNameUse[] useArray = new SidNameUse[names.Length];
@@ -361,25 +386,30 @@ namespace ProcessHacker.Native.Objects
private void SetInformation(DomainInformationClass infoClass, IntPtr buffer)
{
- Win32.SamSetInformationDomain(
+ NtStatus status;
+
+ if ((status = Win32.SamSetInformationDomain(
this,
infoClass,
buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
- public unsafe void SetPasswordPolicy(DomainPasswordPolicy policy)
+ public void SetPasswordPolicy(DomainPasswordPolicy policy)
{
- DomainPasswordInformation info = new DomainPasswordInformation
+ unsafe
{
- MinPasswordLength = policy.MinPasswordLength,
- PasswordHistoryLength = policy.PasswordHistoryLength,
- PasswordProperties = policy.PasswordProperties,
- MaxPasswordAge = -policy.MaxPasswordAge.Ticks,
- MinPasswordAge = -policy.MinPasswordAge.Ticks
- };
+ DomainPasswordInformation info = new DomainPasswordInformation();
- this.SetInformation(DomainInformationClass.DomainPasswordInformation, new IntPtr(&info));
+ info.MinPasswordLength = policy.MinPasswordLength;
+ info.PasswordHistoryLength = policy.PasswordHistoryLength;
+ info.PasswordProperties = policy.PasswordProperties;
+ info.MaxPasswordAge = -policy.MaxPasswordAge.Ticks;
+ info.MinPasswordAge = -policy.MinPasswordAge.Ticks;
+
+ this.SetInformation(DomainInformationClass.DomainPasswordInformation, new IntPtr(&info));
+ }
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SamGroupHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SamGroupHandle.cs
index 0bc8d86e1..9b16d394f 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SamGroupHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SamGroupHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -33,19 +34,22 @@ namespace ProcessHacker.Native.Objects
{
public static SamGroupHandle Create(SamGroupAccess access, SamDomainHandle domainHandle, string name, out int groupId)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr handle;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.SamCreateGroupInDomain(
+ if ((status = Win32.SamCreateGroupInDomain(
domainHandle,
ref nameStr,
access,
out handle,
out groupId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -62,7 +66,7 @@ namespace ProcessHacker.Native.Objects
public static SamGroupHandle Open(Sid sid, SamGroupAccess access)
{
- using (SamDomainHandle dhandle = new SamDomainHandle(sid.DomainName, SamDomainAccess.Lookup))
+ using (var dhandle = new SamDomainHandle(sid.DomainName, SamDomainAccess.Lookup))
{
return new SamGroupHandle(dhandle, dhandle.LookupName(sid.Name), access);
}
@@ -80,89 +84,95 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the group.
public SamGroupHandle(SamDomainHandle domainHandle, int groupId, SamGroupAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.SamOpenGroup(
+ if ((status = Win32.SamOpenGroup(
domainHandle,
access,
groupId,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.Handle = handle;
}
public void AddMember(int memberId)
{
- Win32.SamAddMemberToGroup(this, memberId, 0).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamAddMemberToGroup(this, memberId, 0)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void Delete()
{
- Win32.SamDeleteGroup(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamDeleteGroup(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
private SamMemoryAlloc GetInformation(GroupInformationClass infoClass)
{
+ NtStatus status;
IntPtr buffer;
- Win32.SamQueryInformationGroup(
+ if ((status = Win32.SamQueryInformationGroup(
this,
infoClass,
out buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SamMemoryAlloc(buffer);
}
- public string AdminComment
+ public string GetAdminComment()
{
- get
+ using (var data = this.GetInformation(GroupInformationClass.GroupAdminCommentInformation))
{
- using (SamMemoryAlloc data = this.GetInformation(GroupInformationClass.GroupAdminCommentInformation))
- {
- return data.ReadStruct().AdminComment.Text;
- }
+ return data.ReadStruct().AdminComment.Read();
}
}
- public int[] Members
+ public int[] GetMembers()
{
- get
+ NtStatus status;
+ IntPtr memberIds;
+ IntPtr attributes;
+ int count;
+
+ if ((status = Win32.SamGetMembersInGroup(
+ this,
+ out memberIds,
+ out attributes,
+ out count
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ using (var memberIdsAlloc = new SamMemoryAlloc(memberIds))
+ using (var attributesAlloc = new SamMemoryAlloc(attributes))
{
- IntPtr memberIds;
- IntPtr attributes;
- int count;
-
- Win32.SamGetMembersInGroup(
- this,
- out memberIds,
- out attributes,
- out count
- ).ThrowIf();
-
- using (SamMemoryAlloc memberIdsAlloc = new SamMemoryAlloc(memberIds))
- using (new SamMemoryAlloc(attributes))
- {
- return memberIdsAlloc.ReadInt32Array(0, count);
- }
+ return memberIdsAlloc.ReadInt32Array(0, count);
}
}
- public string Name
+ public string GetName()
{
- get
+ using (var data = this.GetInformation(GroupInformationClass.GroupNameInformation))
{
- using (SamMemoryAlloc data = this.GetInformation(GroupInformationClass.GroupNameInformation))
- {
- return data.ReadStruct().Name.Text;
- }
+ return data.ReadStruct().Name.Read();
}
}
public void RemoveMember(int memberId)
{
- Win32.SamRemoveMemberFromGroup(this, memberId).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamRemoveMemberFromGroup(this, memberId)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SamHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SamHandle.cs
index 7810a4cbd..f97e51d7d 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SamHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SamHandle.cs
@@ -46,24 +46,29 @@ namespace ProcessHacker.Native.Objects
public override SecurityDescriptor GetSecurity(SecurityInformation securityInformation)
{
+ NtStatus status;
IntPtr securityDescriptor;
- Win32.SamQuerySecurityObject(
+ if ((status = Win32.SamQuerySecurityObject(
this,
securityInformation,
out securityDescriptor
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SecurityDescriptor(new SamMemoryAlloc(securityDescriptor));
}
public override void SetSecurity(SecurityInformation securityInformation, SecurityDescriptor securityDescriptor)
{
- Win32.SamSetSecurityObject(
+ NtStatus status;
+
+ if ((status = Win32.SamSetSecurityObject(
this,
securityInformation,
securityDescriptor
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SamServerHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SamServerHandle.cs
index df0f676e4..56e527a63 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SamServerHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SamServerHandle.cs
@@ -34,7 +34,7 @@ namespace ProcessHacker.Native.Objects
public sealed class SamServerHandle : SamHandle
{
private static WeakReference _connectServerHandle;
- private static int _connectServerHandleMisses;
+ private static int _connectServerHandleMisses = 0;
public static SamServerHandle ConnectServerHandle
{
@@ -45,7 +45,7 @@ namespace ProcessHacker.Native.Objects
if (weakRef != null)
{
- weakRef.TryGetTarget(out connectHandle);
+ connectHandle = weakRef.Target;
}
if (connectHandle == null)
@@ -53,10 +53,9 @@ namespace ProcessHacker.Native.Objects
System.Threading.Interlocked.Increment(ref _connectServerHandleMisses);
connectHandle = new SamServerHandle(SamServerAccess.GenericRead | SamServerAccess.GenericExecute);
+
if (connectHandle != null)
- {
_connectServerHandle = new WeakReference(connectHandle);
- }
}
return connectHandle;
@@ -85,18 +84,22 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the server.
public SamServerHandle(string serverName, SamServerAccess access)
{
- IntPtr handle;
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes();
- UnicodeString serverNameStr = new UnicodeString(serverName);
+ UnicodeString serverNameStr;
+ IntPtr handle;
+
+ serverNameStr = new UnicodeString(serverName);
try
{
- Win32.SamConnect(
+ if ((status = Win32.SamConnect(
ref serverNameStr,
out handle,
access,
ref oa
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -108,30 +111,33 @@ namespace ProcessHacker.Native.Objects
public void EnumDomains(EnumDomainsDelegate callback)
{
+ NtStatus status;
int enumerationContext = 0;
IntPtr buffer;
int count;
while (true)
{
- Win32.SamEnumerateDomainsInSamServer(
+ status = Win32.SamEnumerateDomainsInSamServer(
this,
ref enumerationContext,
out buffer,
0x100,
out count
- ).ThrowIf();
+ );
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
if (count == 0)
break;
- using (SamMemoryAlloc bufferAlloc = new SamMemoryAlloc(buffer))
+ using (var bufferAlloc = new SamMemoryAlloc(buffer))
{
for (int i = 0; i < count; i++)
{
- SamSidEnumeration data = bufferAlloc.ReadStruct(0, SamSidEnumeration.SizeOf, i);
+ var data = bufferAlloc.ReadStruct(i);
- if (!callback(data.Name.Text))
+ if (!callback(data.Name.Read()))
return;
}
}
@@ -142,7 +148,7 @@ namespace ProcessHacker.Native.Objects
{
List domains = new List();
- this.EnumDomains(name =>
+ this.EnumDomains((name) =>
{
domains.Add(name);
return true;
@@ -153,17 +159,20 @@ namespace ProcessHacker.Native.Objects
public Sid LookupDomain(string name)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr domainId;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.SamLookupDomainInSamServer(
+ if ((status = Win32.SamLookupDomainInSamServer(
this,
ref nameStr,
out domainId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -176,7 +185,10 @@ namespace ProcessHacker.Native.Objects
public void Shutdown()
{
- Win32.SamShutdownSamServer(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamShutdownSamServer(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SamUserHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SamUserHandle.cs
index 0654bc6e5..dcc30fc12 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SamUserHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SamUserHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Collections.Generic;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -33,19 +34,22 @@ namespace ProcessHacker.Native.Objects
{
public static SamUserHandle Create(SamUserAccess access, SamDomainHandle domainHandle, string name, out int userId)
{
+ NtStatus status;
+ UnicodeString nameStr;
IntPtr handle;
- UnicodeString nameStr = new UnicodeString(name);
+ nameStr = new UnicodeString(name);
try
{
- Win32.SamCreateUserInDomain(
+ if ((status = Win32.SamCreateUserInDomain(
domainHandle,
ref nameStr,
access,
out handle,
out userId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -84,30 +88,37 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the user.
public SamUserHandle(SamDomainHandle domainHandle, int userId, SamUserAccess access)
{
+ NtStatus status;
IntPtr handle;
- Win32.SamOpenUser(
+ if ((status = Win32.SamOpenUser(
domainHandle,
access,
userId,
out handle
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.Handle = handle;
}
public void ChangePassword(string oldPassword, string newPassword)
{
- UnicodeString oldPasswordStr = new UnicodeString(oldPassword);
- UnicodeString newPasswordStr = new UnicodeString(newPassword);
+ NtStatus status;
+ UnicodeString oldPasswordStr;
+ UnicodeString newPasswordStr;
+
+ oldPasswordStr = new UnicodeString(oldPassword);
+ newPasswordStr = new UnicodeString(newPassword);
try
{
- Win32.SamChangePasswordUser(
+ if ((status = Win32.SamChangePasswordUser(
this,
ref oldPasswordStr,
ref newPasswordStr
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -118,221 +129,220 @@ namespace ProcessHacker.Native.Objects
public void Delete()
{
- Win32.SamDeleteUser(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.SamDeleteUser(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
- public string AdminComment
+ public string GetAdminComment()
{
- get { return this.Information.AdminComment; }
+ return this.GetInformation().AdminComment;
}
- public UserAccountFlags Flags
+ public UserAccountFlags GetFlags()
{
- get { return this.Information.UserFlags; }
+ return this.GetInformation().UserFlags;
}
- public string FullName
+ public string GetFullName()
{
- get
+ using (var data = this.GetInformation(UserInformationClass.UserFullNameInformation))
+ return data.ReadStruct().FullName.Read();
+ }
+
+ public int[] GetGroups()
+ {
+ NtStatus status;
+ IntPtr groups;
+ int count;
+
+ if ((status = Win32.SamGetGroupsForUser(
+ this,
+ out groups,
+ out count
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ using (var groupsAlloc = new SamMemoryAlloc(groups))
{
- using (SamMemoryAlloc data = this.GetInformation(UserInformationClass.UserFullNameInformation))
- {
- return data.ReadStruct().FullName.Text;
- }
+ return groupsAlloc.ReadInt32Array(0, count);
}
}
- public int[] Groups
+ public SamUserInformation GetInformation()
{
- get
+ using (var data = this.GetInformation(UserInformationClass.UserAllInformation))
{
- IntPtr groups;
- int count;
+ UserAllInformation info = data.ReadStruct();
- Win32.SamGetGroupsForUser(
- this,
- out groups,
- out count
- ).ThrowIf();
-
- using (SamMemoryAlloc groupsAlloc = new SamMemoryAlloc(groups))
- {
- return groupsAlloc.ReadInt32Array(0, count);
- }
- }
- }
-
- public SamUserInformation Information
- {
- get
- {
- using (SamMemoryAlloc data = this.GetInformation(UserInformationClass.UserAllInformation))
- {
- UserAllInformation info = data.ReadStruct();
-
- return new SamUserInformation(
- SamDomainHandle.ToDateTime(info.LastLogon),
- SamDomainHandle.ToDateTime(info.LastLogoff),
- SamDomainHandle.ToDateTime(info.PasswordLastSet),
- SamDomainHandle.ToDateTime(info.AccountExpires),
- SamDomainHandle.ToDateTime(info.PasswordCanChange),
- SamDomainHandle.ToDateTime(info.PasswordMustChange),
- info.UserName.Text,
- info.FullName.Text,
- info.AdminComment.Text,
- info.UserComment.Text,
- info.UserId,
- info.PrimaryGroupId,
- info.UserAccountControl,
- info.PasswordExpired
- );
- }
+ return new SamUserInformation(
+ SamDomainHandle.ToDateTime(info.LastLogon),
+ SamDomainHandle.ToDateTime(info.LastLogoff),
+ SamDomainHandle.ToDateTime(info.PasswordLastSet),
+ SamDomainHandle.ToDateTime(info.AccountExpires),
+ SamDomainHandle.ToDateTime(info.PasswordCanChange),
+ SamDomainHandle.ToDateTime(info.PasswordMustChange),
+ info.UserName.Read(),
+ info.FullName.Read(),
+ info.AdminComment.Read(),
+ info.UserComment.Read(),
+ info.UserId,
+ info.PrimaryGroupId,
+ info.UserAccountControl,
+ info.PasswordExpired
+ );
}
}
private SamMemoryAlloc GetInformation(UserInformationClass infoClass)
{
+ NtStatus status;
IntPtr buffer;
- Win32.SamQueryInformationUser(
+ if ((status = Win32.SamQueryInformationUser(
this,
infoClass,
out buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SamMemoryAlloc(buffer);
}
- public string Name
+ public string GetName()
{
- get
+ using (var data = this.GetInformation(UserInformationClass.UserAccountNameInformation))
+ return data.ReadStruct().UserName.Read();
+ }
+
+ public string GetPasswordHint()
+ {
+ using (var data = this.GetInformation(UserInformationClass.UserExtendedInformation))
+ return data.ReadStruct().PasswordHint.Read();
+ }
+
+ public void SetAdminComment(string comment)
+ {
+ unsafe
{
- using (SamMemoryAlloc data = this.GetInformation(UserInformationClass.UserAccountNameInformation))
+ UserAllInformation info = new UserAllInformation();
+
+ info.WhichFields = UserWhichFields.AdminComment;
+ info.AdminComment = new UnicodeString(comment);
+
+ try
{
- return data.ReadStruct().UserName.Text;
+ this.SetInformation(UserInformationClass.UserAllInformation, new IntPtr(&info));
+ }
+ finally
+ {
+ info.AdminComment.Dispose();
}
}
}
- public string PasswordHint
+ public void SetFlags(UserAccountFlags flags)
{
- get
+ unsafe
{
- using (SamMemoryAlloc data = this.GetInformation(UserInformationClass.UserExtendedInformation))
- {
- return data.ReadStruct().PasswordHint.Text;
- }
- }
- }
+ UserAllInformation info = new UserAllInformation();
- public unsafe void SetAdminComment(string comment)
- {
- UserAllInformation info = new UserAllInformation
- {
- WhichFields = UserWhichFields.AdminComment,
- AdminComment = new UnicodeString(comment)
- };
+ info.WhichFields = UserWhichFields.UserAccountControl;
+ info.UserAccountControl = flags;
- try
- {
this.SetInformation(UserInformationClass.UserAllInformation, new IntPtr(&info));
}
- finally
- {
- info.AdminComment.Dispose();
- }
}
- public unsafe void SetFlags(UserAccountFlags flags)
+ public void SetFullName(string fullName)
{
- UserAllInformation info = new UserAllInformation
+ unsafe
{
- WhichFields = UserWhichFields.UserAccountControl,
- UserAccountControl = flags
- };
+ UserFullNameInformation info = new UserFullNameInformation();
- this.SetInformation(UserInformationClass.UserAllInformation, new IntPtr(&info));
- }
+ info.FullName = new UnicodeString(fullName);
- public unsafe void SetFullName(string fullName)
- {
- UserFullNameInformation info = new UserFullNameInformation
- {
- FullName = new UnicodeString(fullName)
- };
-
- try
- {
- this.SetInformation(UserInformationClass.UserFullNameInformation, new IntPtr(&info));
- }
- finally
- {
- info.FullName.Dispose();
+ try
+ {
+ this.SetInformation(UserInformationClass.UserFullNameInformation, new IntPtr(&info));
+ }
+ finally
+ {
+ info.FullName.Dispose();
+ }
}
}
private void SetInformation(UserInformationClass infoClass, IntPtr buffer)
{
- Win32.SamSetInformationUser(
+ NtStatus status;
+
+ if ((status = Win32.SamSetInformationUser(
this,
infoClass,
buffer
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
- public unsafe void SetPassword(string password, bool expired)
+ public void SetPassword(string password, bool expired)
{
- UserSetPasswordInformation info = new UserSetPasswordInformation
+ unsafe
{
- Password = new UnicodeString(password),
- PasswordExpired = expired
- };
+ UserSetPasswordInformation info = new UserSetPasswordInformation();
- try
- {
- this.SetInformation(UserInformationClass.UserSetPasswordInformation, new IntPtr(&info));
- }
- finally
- {
- info.Password.Dispose();
+ info.Password = new UnicodeString(password);
+ info.PasswordExpired = expired;
+
+ try
+ {
+ this.SetInformation(UserInformationClass.UserSetPasswordInformation, new IntPtr(&info));
+ }
+ finally
+ {
+ info.Password.Dispose();
+ }
}
}
- public unsafe void SetPasswordHint(string passwordHint)
+ public void SetPasswordHint(string passwordHint)
{
- UserExtendedInformation info = new UserExtendedInformation
+ unsafe
{
- ExtendedWhichFields = UserExtendedWhichFields.PasswordHint,
- PasswordHint = new UnicodeString(passwordHint)
- };
+ UserExtendedInformation info = new UserExtendedInformation();
- try
- {
- this.SetInformation(UserInformationClass.UserExtendedInformation, new IntPtr(&info));
- }
- finally
- {
- info.PasswordHint.Dispose();
+ info.ExtendedWhichFields = UserExtendedWhichFields.PasswordHint;
+ info.PasswordHint = new UnicodeString(passwordHint);
+
+ try
+ {
+ this.SetInformation(UserInformationClass.UserExtendedInformation, new IntPtr(&info));
+ }
+ finally
+ {
+ info.PasswordHint.Dispose();
+ }
}
}
}
public class SamUserInformation
{
- private readonly DateTime _lastLogon;
- private readonly DateTime _lastLogoff;
- private readonly DateTime _passwordLastSet;
- private readonly DateTime _accountExpires;
- private readonly DateTime _passwordCanChange;
- private readonly DateTime _passwordMustChange;
- private readonly string _userName;
- private readonly string _fullName;
- private readonly string _adminComment;
- private readonly string _userComment;
- private readonly int _userId;
- private readonly int _primaryGroupId;
- private readonly UserAccountFlags _userFlags;
- private readonly bool _passwordExpired;
+ private DateTime _lastLogon;
+ private DateTime _lastLogoff;
+ private DateTime _passwordLastSet;
+ private DateTime _accountExpires;
+ private DateTime _passwordCanChange;
+ private DateTime _passwordMustChange;
+ private string _userName;
+ private string _fullName;
+ private string _adminComment;
+ private string _userComment;
+ private int _userId;
+ private int _primaryGroupId;
+ private UserAccountFlags _userFlags;
+ private bool _passwordExpired;
public SamUserInformation(
DateTime lastLogon,
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SectionHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SectionHandle.cs
index 146ef2d9c..014957f95 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SectionHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SectionHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -82,6 +83,7 @@ namespace ProcessHacker.Native.Objects
FileHandle fileHandle
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
@@ -89,7 +91,7 @@ namespace ProcessHacker.Native.Objects
{
if (maximumSize != 0)
{
- Win32.NtCreateSection(
+ if ((status = Win32.NtCreateSection(
out handle,
access,
ref oa,
@@ -97,11 +99,12 @@ namespace ProcessHacker.Native.Objects
pageAttributes,
sectionAttributes,
fileHandle ?? IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
else
{
- Win32.NtCreateSection(
+ if ((status = Win32.NtCreateSection(
out handle,
access,
ref oa,
@@ -109,7 +112,8 @@ namespace ProcessHacker.Native.Objects
pageAttributes,
sectionAttributes,
fileHandle ?? IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
finally
@@ -131,12 +135,14 @@ namespace ProcessHacker.Native.Objects
public SectionHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, SectionAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenSection(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenSection(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -152,39 +158,36 @@ namespace ProcessHacker.Native.Objects
public long Extend(long newSize)
{
- Win32.NtExtendSection(this, ref newSize).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtExtendSection(this, ref newSize)) >= NtStatus.Error)
+ Win32.Throw(status);
return newSize;
}
public SectionBasicInformation GetBasicInformation()
{
+ NtStatus status;
SectionBasicInformation sbi;
IntPtr retLength;
- Win32.NtQuerySection(
- this,
- SectionInformationClass.SectionBasicInformation,
- out sbi,
- new IntPtr(SectionBasicInformation.SizeOf),
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQuerySection(this, SectionInformationClass.SectionBasicInformation,
+ out sbi, new IntPtr(Marshal.SizeOf(typeof(SectionBasicInformation))), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
return sbi;
}
public SectionImageInformation GetImageInformation()
{
+ NtStatus status;
SectionImageInformation sii;
IntPtr retLength;
- Win32.NtQuerySection(
- this,
- SectionInformationClass.SectionImageInformation,
- out sii,
- new IntPtr(SectionImageInformation.SizeOf),
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQuerySection(this, SectionInformationClass.SectionImageInformation,
+ out sii, new IntPtr(Marshal.SizeOf(typeof(SectionImageInformation))), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
return sii;
}
@@ -230,9 +233,11 @@ namespace ProcessHacker.Native.Objects
MemoryProtection protection
)
{
+ NtStatus status;
+
// sectionOffset requires 2 << 15 = 0x10000 = 65536 alignment.
// viewSize will be rounded up to the page size.
- Win32.NtMapViewOfSection(
+ if ((status = Win32.NtMapViewOfSection(
this,
processHandle,
ref baseAddress,
@@ -243,7 +248,8 @@ namespace ProcessHacker.Native.Objects
inheritDisposition,
allocationType,
protection
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new SectionView(baseAddress, viewSize);
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SemaphoreHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SemaphoreHandle.cs
index 735767bec..c73cdc2af 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SemaphoreHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SemaphoreHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -40,18 +41,15 @@ namespace ProcessHacker.Native.Objects
public static SemaphoreHandle Create(SemaphoreAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, int initialCount, int maximumCount)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateSemaphore(
- out handle,
- access,
- ref oa,
- initialCount,
- maximumCount
- ).ThrowIf();
+ if ((status = Win32.NtCreateSemaphore(out handle, access, ref oa,
+ initialCount, maximumCount)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -72,12 +70,14 @@ namespace ProcessHacker.Native.Objects
public SemaphoreHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, SemaphoreAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenSemaphore(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenSemaphore(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -93,16 +93,13 @@ namespace ProcessHacker.Native.Objects
public SemaphoreBasicInformation GetBasicInformation()
{
+ NtStatus status;
SemaphoreBasicInformation sbi;
int retLength;
- Win32.NtQuerySemaphore(
- this,
- SemaphoreInformationClass.SemaphoreBasicInformation,
- out sbi,
- SemaphoreBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQuerySemaphore(this, SemaphoreInformationClass.SemaphoreBasicInformation,
+ out sbi, Marshal.SizeOf(typeof(SemaphoreBasicInformation)), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
return sbi;
}
@@ -114,9 +111,11 @@ namespace ProcessHacker.Native.Objects
public int Release(int count)
{
+ NtStatus status;
int previousCount;
- Win32.NtReleaseSemaphore(this, count, out previousCount).ThrowIf();
+ if ((status = Win32.NtReleaseSemaphore(this, count, out previousCount)) >= NtStatus.Error)
+ Win32.Throw(status);
return previousCount;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/ServiceHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/ServiceHandle.cs
index 5aabc23f8..543adb999 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/ServiceHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/ServiceHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
using ProcessHacker.Native.Security.AccessControl;
@@ -95,7 +96,8 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the service.
public ServiceHandle(string serviceName, ServiceAccess access)
{
- using (ServiceManagerHandle manager = new ServiceManagerHandle(ScManagerAccess.Connect))
+ using (ServiceManagerHandle manager =
+ new ServiceManagerHandle(ScManagerAccess.Connect))
{
this.Handle = Win32.OpenService(manager, serviceName, access);
@@ -113,7 +115,7 @@ namespace ProcessHacker.Native.Objects
/// The message.
public void Control(ServiceControl control)
{
- ServiceStatus status;
+ ServiceStatus status = new ServiceStatus();
if (!Win32.ControlService(this, control, out status))
Win32.Throw();
@@ -133,7 +135,7 @@ namespace ProcessHacker.Native.Objects
///
public QueryServiceConfig GetConfig()
{
- int requiredSize;
+ int requiredSize = 0;
Win32.QueryServiceConfig(this, IntPtr.Zero, 0, out requiredSize);
@@ -179,7 +181,7 @@ namespace ProcessHacker.Native.Objects
ServiceStatusProcess status;
int retLen;
- if (!Win32.QueryServiceStatusEx(this, 0, out status, ServiceStatusProcess.SizeOf, out retLen))
+ if (!Win32.QueryServiceStatusEx(this, 0, out status, Marshal.SizeOf(typeof(ServiceStatusProcess)), out retLen))
Win32.Throw();
return status;
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/ServiceManagerHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/ServiceManagerHandle.cs
index 8a5769847..854f838f6 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/ServiceManagerHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/ServiceManagerHandle.cs
@@ -60,25 +60,15 @@ namespace ProcessHacker.Native.Objects
ServiceErrorControl.Ignore, binaryPath, null, null, null);
}
- public ServiceHandle CreateService(string name, string displayName, ServiceType type, ServiceStartType startType, ServiceErrorControl errorControl, string binaryPath, string group, string accountName, string password)
+ public ServiceHandle CreateService(string name, string displayName,
+ ServiceType type, ServiceStartType startType, ServiceErrorControl errorControl,
+ string binaryPath, string group, string accountName, string password)
{
- IntPtr service = Win32.CreateService(
- this,
- name,
- displayName,
- ServiceAccess.All,
- type,
- startType,
- errorControl,
- binaryPath,
- group,
- IntPtr.Zero,
- IntPtr.Zero,
- accountName,
- password
- );
+ IntPtr service;
- if (service == IntPtr.Zero)
+ if ((service = Win32.CreateService(this, name, displayName, ServiceAccess.All,
+ type, startType, errorControl, binaryPath, group,
+ IntPtr.Zero, IntPtr.Zero, accountName, password)) == IntPtr.Zero)
Win32.Throw();
return new ServiceHandle(service, true);
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/SymbolicLinkHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/SymbolicLinkHandle.cs
index d9282db85..fc0e3148f 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/SymbolicLinkHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/SymbolicLinkHandle.cs
@@ -35,6 +35,7 @@ namespace ProcessHacker.Native.Objects
public static SymbolicLinkHandle Create(SymbolicLinkAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, string linkTarget)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
@@ -44,12 +45,9 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.NtCreateSymbolicLinkObject(
- out handle,
- access,
- ref oa,
- ref linkTargetString
- ).ThrowIf();
+ if ((status = Win32.NtCreateSymbolicLinkObject(out handle, access,
+ ref oa, ref linkTargetString)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -70,12 +68,14 @@ namespace ProcessHacker.Native.Objects
public SymbolicLinkHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, SymbolicLinkAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenSymbolicLinkObject(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenSymbolicLinkObject(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -89,30 +89,29 @@ namespace ProcessHacker.Native.Objects
: this(name, 0, null, access)
{ }
- public string Target
+ public string GetTarget()
{
- get
+ NtStatus status;
+ int retLength;
+ UnicodeString str = new UnicodeString();
+
+ using (var buffer = new MemoryAlloc(0x200))
{
- int retLength;
- UnicodeString str = new UnicodeString();
+ str.Length = 0;
+ str.MaximumLength = (ushort)buffer.Size;
+ str.Buffer = buffer;
- using (MemoryAlloc buffer = new MemoryAlloc(0x200))
+ if ((status = Win32.NtQuerySymbolicLinkObject(this, ref str, out retLength)) >= NtStatus.Error)
{
- str.Length = 0;
- str.MaximumLength = (ushort)buffer.Size;
+ buffer.ResizeNew(retLength);
+ str.MaximumLength = (ushort)retLength;
str.Buffer = buffer;
-
- if (Win32.NtQuerySymbolicLinkObject(this, ref str, out retLength).IsError())
- {
- buffer.ResizeNew(retLength);
- str.MaximumLength = (ushort)retLength;
- str.Buffer = buffer;
- }
-
- Win32.NtQuerySymbolicLinkObject(this, ref str, out retLength).ThrowIf();
-
- return str.Text;
}
+
+ if ((status = Win32.NtQuerySymbolicLinkObject(this, ref str, out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return str.Read();
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TerminalServerHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/TerminalServerHandle.cs
index 4cbeb52dd..ae7bb2991 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TerminalServerHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TerminalServerHandle.cs
@@ -74,7 +74,7 @@ namespace ProcessHacker.Native.Objects
Win32.Throw();
}
- private readonly string _systemName;
+ private string _systemName;
private TerminalServerHandle(IntPtr handle, bool owned)
: base(handle, owned)
@@ -120,13 +120,13 @@ namespace ProcessHacker.Native.Objects
if (!Win32.WTSEnumerateProcesses(this, 0, 1, out dataPtr, out count))
Win32.Throw();
- using (WtsMemoryAlloc data = new WtsMemoryAlloc(dataPtr))
+ using (var data = new WtsMemoryAlloc(dataPtr))
{
processes = new TerminalServerProcess[count];
for (int i = 0; i < count; i++)
{
- var process = data.ReadStruct(0, WtsProcessInfo.SizeOf, i);
+ var process = data.ReadStruct(i);
processes[i] = new TerminalServerProcess(
process.ProcessId,
process.SessionId,
@@ -157,18 +157,18 @@ namespace ProcessHacker.Native.Objects
{
IntPtr dataPtr;
int count;
+ TerminalServerSession[] sessions;
if (!Win32.WTSEnumerateSessions(this, 0, 1, out dataPtr, out count))
Win32.Throw();
- using (WtsMemoryAlloc data = new WtsMemoryAlloc(dataPtr))
+ using (var data = new WtsMemoryAlloc(dataPtr))
{
- TerminalServerSession[] sessions = new TerminalServerSession[count];
+ sessions = new TerminalServerSession[count];
for (int i = 0; i < count; i++)
{
- WtsSessionInfo session = data.ReadStruct(0, WtsSessionInfo.SizeOf, i);
-
+ var session = data.ReadStruct(i);
sessions[i] = new TerminalServerSession(
this,
session.SessionID,
@@ -235,8 +235,8 @@ namespace ProcessHacker.Native.Objects
return Win32.WTSGetActiveConsoleSessionId();
}
- private readonly TerminalServerHandle _serverHandle;
- private readonly int _sessionId;
+ private TerminalServerHandle _serverHandle;
+ private int _sessionId;
private string _name;
private WtsConnectStateClass _state = (WtsConnectStateClass)(-1);
private string _initialProgram;
@@ -291,7 +291,8 @@ namespace ProcessHacker.Native.Objects
IntPtr dataPtr;
int length;
- if (!Win32.WTSQuerySessionInformation(_serverHandle, _sessionId, WtsInformationClass.ConnectState, out dataPtr, out length))
+ if (!Win32.WTSQuerySessionInformation(
+ _serverHandle, _sessionId, WtsInformationClass.ConnectState, out dataPtr, out length))
Win32.Throw();
using (var data = new WtsMemoryAlloc(dataPtr))
@@ -381,17 +382,21 @@ namespace ProcessHacker.Native.Objects
IntPtr dataPtr;
int length;
- if (!Win32.WTSQuerySessionInformation(_serverHandle, _sessionId, WtsInformationClass.ClientAddress, out dataPtr, out length))
+ if (!Win32.WTSQuerySessionInformation(
+ _serverHandle, _sessionId, WtsInformationClass.ClientAddress, out dataPtr, out length))
Win32.Throw();
if (dataPtr != IntPtr.Zero)
{
- using (WtsMemoryAlloc data = new WtsMemoryAlloc(dataPtr))
+ unsafe
{
- WtsClientAddress address = data.ReadStruct();
+ using (var data = new WtsMemoryAlloc(dataPtr))
+ {
+ var address = data.ReadStruct();
- if (address.AddressFamily != 0)
- this._clientAddress = new System.Net.IPAddress(data.ReadBytes(6, 4));
+ if (address.AddressFamily != 0)
+ _clientAddress = new System.Net.IPAddress(data.ReadBytes(6, 4));
+ }
}
}
}
@@ -404,12 +409,13 @@ namespace ProcessHacker.Native.Objects
{
get
{
- if (!_clientDisplay.HasValue)
+ if (_clientDisplay == null)
{
IntPtr dataPtr;
int length;
- if (!Win32.WTSQuerySessionInformation(_serverHandle, _sessionId, WtsInformationClass.ClientDisplay, out dataPtr, out length))
+ if (!Win32.WTSQuerySessionInformation(
+ _serverHandle, _sessionId, WtsInformationClass.ClientDisplay, out dataPtr, out length))
Win32.Throw();
if (dataPtr != IntPtr.Zero)
@@ -508,10 +514,10 @@ namespace ProcessHacker.Native.Objects
public class TerminalServerProcess
{
- private readonly int _processId;
- private readonly int _sessionId;
- private readonly string _name;
- private readonly Sid _sid;
+ private int _processId;
+ private int _sessionId;
+ private string _name;
+ private Sid _sid;
internal TerminalServerProcess(int processId, int sessionId, string name, Sid sid)
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs
index 7ed9432c9..5127762b1 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs
@@ -23,6 +23,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Runtime.InteropServices;
using ProcessHacker.Common;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -58,12 +59,13 @@ namespace ProcessHacker.Native.Objects
bool createSuspended
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateThread(
+ if ((status = Win32.NtCreateThread(
out handle,
access,
ref oa,
@@ -72,7 +74,8 @@ namespace ProcessHacker.Native.Objects
ref threadContext,
ref initialTeb,
createSuspended
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -109,9 +112,10 @@ namespace ProcessHacker.Native.Objects
out ClientId clientId
)
{
+ NtStatus status;
IntPtr threadHandle;
- Win32.RtlCreateUserThread(
+ if ((status = Win32.RtlCreateUserThread(
processHandle,
IntPtr.Zero,
createSuspended,
@@ -122,7 +126,8 @@ namespace ProcessHacker.Native.Objects
parameter,
out threadHandle,
out clientId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return new ThreadHandle(threadHandle, true);
}
@@ -153,7 +158,7 @@ namespace ProcessHacker.Native.Objects
/// A client ID.
public static ClientId GetCurrentCid()
{
- return new ClientId(ProcessHandle.CurrentId, GetCurrentId());
+ return new ClientId(ProcessHandle.GetCurrentId(), ThreadHandle.GetCurrentId());
}
///
@@ -223,7 +228,10 @@ namespace ProcessHacker.Native.Objects
/// A handle to a port.
public static void RegisterTerminationPort(PortHandle portHandle)
{
- Win32.NtRegisterThreadTerminatePort(portHandle).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRegisterThreadTerminatePort(portHandle)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -269,7 +277,12 @@ namespace ProcessHacker.Native.Objects
///
public static NtStatus TestAlert()
{
- return Win32.NtTestAlert();
+ NtStatus status;
+
+ if ((status = Win32.NtTestAlert()) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return status;
}
///
@@ -299,24 +312,24 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the thread.
public ThreadHandle(int tid, ThreadAccess access)
{
- //if (KProcessHacker.Instance != null)
- //{
- // try
- // {
- // this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenThread(tid, access));
- // }
- // catch (WindowsException)
- // {
- // // Open the thread with minimum access (SYNCHRONIZE) and set the granted access.
- // this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenThread(tid,
- // (ThreadAccess)StandardRights.Synchronize));
- // KProcessHacker.Instance.KphSetHandleGrantedAccess(this.Handle, (int)access);
- // }
- //}
- //else
- //{
+ if (KProcessHacker.Instance != null)
+ {
+ try
+ {
+ this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenThread(tid, access));
+ }
+ catch (WindowsException)
+ {
+ // Open the thread with minimum access (SYNCHRONIZE) and set the granted access.
+ this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenThread(tid,
+ (ThreadAccess)StandardRights.Synchronize));
+ KProcessHacker.Instance.KphSetHandleGrantedAccess(this.Handle, (int)access);
+ }
+ }
+ else
+ {
this.Handle = Win32.OpenThread(access, false, tid);
- //}
+ }
if (this.Handle == IntPtr.Zero)
{
@@ -333,6 +346,7 @@ namespace ProcessHacker.Native.Objects
ThreadAccess access
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
@@ -340,21 +354,23 @@ namespace ProcessHacker.Native.Objects
{
if (clientId.ProcessId == 0 && clientId.ThreadId == 0)
{
- Win32.NtOpenThread(
+ if ((status = Win32.NtOpenThread(
out handle,
access,
ref oa,
IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
else
{
- Win32.NtOpenThread(
+ if ((status = Win32.NtOpenThread(
out handle,
access,
ref oa,
ref clientId
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
finally
@@ -374,7 +390,10 @@ namespace ProcessHacker.Native.Objects
///
public void Alert()
{
- Win32.NtAlertThread(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtAlertThread(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -382,9 +401,11 @@ namespace ProcessHacker.Native.Objects
///
public int AlertResume()
{
+ NtStatus status;
int suspendCount;
- Win32.NtAlertResumeThread(this, out suspendCount).ThrowIf();
+ if ((status = Win32.NtAlertResumeThread(this, out suspendCount)) >= NtStatus.Error)
+ Win32.Throw(status);
return suspendCount;
}
@@ -405,24 +426,24 @@ namespace ProcessHacker.Native.Objects
/// An array of function addresses.
public IntPtr[] CaptureKernelStack(int skipCount)
{
- //IntPtr[] stack = new IntPtr[62 - skipCount]; // 62 limit for XP and Server 2003
- //int hash;
+ IntPtr[] stack = new IntPtr[62 - skipCount]; // 62 limit for XP and Server 2003
+ int hash;
// Capture a kernel-mode stack trace.
- //int captured = KProcessHacker.Instance.KphCaptureStackBackTraceThread(
- // this,
- // skipCount,
- // stack.Length,
- // stack,
- // out hash
- // );
+ int captured = KProcessHacker.Instance.KphCaptureStackBackTraceThread(
+ this,
+ skipCount,
+ stack.Length,
+ stack,
+ out hash
+ );
// Create a new array with only the frames we captured.
- //IntPtr[] newStack = new IntPtr[captured];
+ IntPtr[] newStack = new IntPtr[captured];
- //Array.Copy(stack, 0, newStack, 0, captured);
+ Array.Copy(stack, 0, newStack, 0, captured);
- return null;// newStack;
+ return newStack;
}
///
@@ -444,7 +465,7 @@ namespace ProcessHacker.Native.Objects
List frames = new List();
// Walk the stack.
- this.WalkStack(frame => { frames.Add(frame); return true; });
+ this.WalkStack((frame) => { frames.Add(frame); return true; });
// If we want to skip frames than we have, just return an empty array.
if (frames.Count <= skipCount)
@@ -465,7 +486,7 @@ namespace ProcessHacker.Native.Objects
/// The exit status.
public void DangerousTerminate(NtStatus exitStatus)
{
- //KProcessHacker.Instance.KphDangerousTerminateThread(this, exitStatus);
+ KProcessHacker.Instance.KphDangerousTerminateThread(this, exitStatus);
}
///
@@ -496,16 +517,13 @@ namespace ProcessHacker.Native.Objects
/// A THREAD_BASIC_INFORMATION structure.
public ThreadBasicInformation GetBasicInformation()
{
+ NtStatus status;
ThreadBasicInformation basicInfo = new ThreadBasicInformation();
int retLen;
- Win32.NtQueryInformationThread(
- this,
- ThreadInformationClass.ThreadBasicInformation,
- ref basicInfo,
- ThreadBasicInformation.SizeOf,
- out retLen
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationThread(this, ThreadInformationClass.ThreadBasicInformation,
+ ref basicInfo, Marshal.SizeOf(basicInfo), out retLen)) >= NtStatus.Error)
+ Win32.Throw(status);
return basicInfo;
}
@@ -516,11 +534,9 @@ namespace ProcessHacker.Native.Objects
/// A CONTEXT struct.
public Context GetContext(ContextFlags flags)
{
- Context context = new Context
- {
- ContextFlags = flags
- };
+ Context context = new Context();
+ context.ContextFlags = flags;
this.GetContext(ref context);
return context;
@@ -532,7 +548,18 @@ namespace ProcessHacker.Native.Objects
/// A Context structure. The ContextFlags must be set appropriately.
public unsafe void GetContext(ref Context context)
{
- Win32.NtGetContextThread(this, ref context).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ fixed (Context* contextPtr = &context)
+ KProcessHacker.Instance.KphGetContextThread(this, contextPtr);
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtGetContextThread(this, ref context)) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
}
///
@@ -541,11 +568,9 @@ namespace ProcessHacker.Native.Objects
/// A CONTEXT struct.
public ContextAmd64 GetContext(ContextFlagsAmd64 flags)
{
- ContextAmd64 context = new ContextAmd64
- {
- ContextFlags = flags
- };
+ ContextAmd64 context = new ContextAmd64();
+ context.ContextFlags = flags;
this.GetContext(ref context);
return context;
@@ -557,13 +582,16 @@ namespace ProcessHacker.Native.Objects
/// A Context structure. The ContextFlags must be set appropriately.
public void GetContext(ref ContextAmd64 context)
{
+ NtStatus status;
+
// HACK: To avoid a datatype misalignment error, allocate some
// aligned memory.
- using (AlignedMemoryAlloc data = new AlignedMemoryAlloc(Utils.SizeOf(16, ContextAmd64.SizeOf), 16))
+ using (var data = new AlignedMemoryAlloc(Utils.SizeOf(16), 16))
{
- data.WriteStruct(context);
+ data.WriteStruct(context);
- Win32.NtGetContextThread(this, data).ThrowIf();
+ if ((status = Win32.NtGetContextThread(this, data)) >= NtStatus.Error)
+ Win32.Throw(status);
context = data.ReadStruct();
}
@@ -576,7 +604,10 @@ namespace ProcessHacker.Native.Objects
/// A Context structure. The ContextFlags must be set appropriately.
public void GetContextWow64(ref Context context)
{
- Win32.RtlWow64GetThreadContext(this, ref context).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlWow64GetThreadContext(this, ref context)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -617,32 +648,46 @@ namespace ProcessHacker.Native.Objects
private int GetInformationInt32(ThreadInformationClass infoClass)
{
- int value;
- int retLength;
-
- Win32.NtQueryInformationThread(
- this,
- infoClass,
- out value,
- sizeof(int),
- out retLength
- ).ThrowIf();
+ if (
+ KProcessHacker.Instance != null &&
+ infoClass == ThreadInformationClass.ThreadIoPriority
+ )
+ {
+ unsafe
+ {
+ int value;
+ int retLength;
- return value;
+ KProcessHacker.Instance.KphQueryInformationThread(
+ this, infoClass, new IntPtr(&value), sizeof(int), out retLength
+ );
+
+ return value;
+ }
+ }
+ else
+ {
+ NtStatus status;
+ int value;
+ int retLength;
+
+ if ((status = Win32.NtQueryInformationThread(
+ this, infoClass, out value, sizeof(int), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return value;
+ }
}
private IntPtr GetInformationIntPtr(ThreadInformationClass infoClass)
{
+ NtStatus status;
IntPtr value;
int retLength;
- Win32.NtQueryInformationThread(
- this,
- infoClass,
- out value,
- IntPtr.Size,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationThread(
+ this, infoClass, out value, IntPtr.Size, out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
return value;
}
@@ -673,16 +718,13 @@ namespace ProcessHacker.Native.Objects
/// A system call number.
public unsafe int GetLastSystemCall(out int firstArgument)
{
+ NtStatus status;
int* data = stackalloc int[2];
int retLength;
- Win32.NtQueryInformationThread(
- this,
- ThreadInformationClass.ThreadLastSystemCall,
- data,
- sizeof(int) * 2,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationThread(
+ this, ThreadInformationClass.ThreadLastSystemCall, data, sizeof(int) * 2, out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
firstArgument = data[0];
@@ -766,13 +808,12 @@ namespace ProcessHacker.Native.Objects
/// The impersonation level to request.
public void Impersonate(ThreadHandle clientThreadHandle, SecurityImpersonationLevel impersonationLevel)
{
- SecurityQualityOfService securityQos = new SecurityQualityOfService(impersonationLevel, false, false);
+ NtStatus status;
+ SecurityQualityOfService securityQos =
+ new SecurityQualityOfService(impersonationLevel, false, false);
- Win32.NtImpersonateThread(
- this,
- clientThreadHandle,
- ref securityQos
- ).ThrowIf();
+ if ((status = Win32.NtImpersonateThread(this, clientThreadHandle, ref securityQos)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -780,7 +821,10 @@ namespace ProcessHacker.Native.Objects
///
public void ImpersonateAnonymous()
{
- Win32.NtImpersonateAnonymousToken(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtImpersonateAnonymousToken(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -856,13 +900,16 @@ namespace ProcessHacker.Native.Objects
/// The third parameter to pass to the function.
public void QueueApc(IntPtr address, IntPtr param1, IntPtr param2, IntPtr param3)
{
- Win32.NtQueueApcThread(
+ NtStatus status;
+
+ if ((status = Win32.NtQueueApcThread(
this,
address,
param1,
param2,
param3
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void RemoteCall(IntPtr address, IntPtr[] arguments)
@@ -872,7 +919,12 @@ namespace ProcessHacker.Native.Objects
public void RemoteCall(IntPtr address, IntPtr[] arguments, bool alreadySuspended)
{
- ProcessHandle processHandle = new ProcessHandle(this.GetProcessId(), ProcessAccess.VmWrite);
+ ProcessHandle processHandle;
+
+ if (KProcessHacker.Instance != null)
+ processHandle = this.GetProcess(ProcessAccess.VmWrite);
+ else
+ processHandle = new ProcessHandle(this.GetProcessId(), ProcessAccess.VmWrite);
using (processHandle)
this.RemoteCall(processHandle, address, arguments, alreadySuspended);
@@ -880,7 +932,9 @@ namespace ProcessHacker.Native.Objects
public void RemoteCall(ProcessHandle processHandle, IntPtr address, IntPtr[] arguments, bool alreadySuspended)
{
- Win32.RtlRemoteCall(
+ NtStatus status;
+
+ if ((status = Win32.RtlRemoteCall(
processHandle,
this,
address,
@@ -888,7 +942,8 @@ namespace ProcessHacker.Native.Objects
arguments,
false,
alreadySuspended
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -896,9 +951,11 @@ namespace ProcessHacker.Native.Objects
///
public int Resume()
{
+ NtStatus status;
int suspendCount;
- Win32.NtResumeThread(this, out suspendCount).ThrowIf();
+ if ((status = Win32.NtResumeThread(this, out suspendCount)) >= NtStatus.Error)
+ Win32.Throw(status);
return suspendCount;
}
@@ -926,9 +983,19 @@ namespace ProcessHacker.Native.Objects
/// Sets the thread's context.
///
/// A CONTEXT struct.
- public void SetContext(Context context)
+ public unsafe void SetContext(Context context)
{
- Win32.NtSetContextThread(this, ref context).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ KProcessHacker.Instance.KphSetContextThread(this, &context);
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtSetContextThread(this, ref context)) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
}
///
@@ -937,13 +1004,16 @@ namespace ProcessHacker.Native.Objects
/// A CONTEXT struct.
public void SetContext(ContextAmd64 context)
{
+ NtStatus status;
+
// HACK: To avoid a datatype misalignment error, allocate
// some aligned memory.
- using (AlignedMemoryAlloc data = new AlignedMemoryAlloc(Utils.SizeOf(16, ContextAmd64.SizeOf), 16))
+ using (var data = new AlignedMemoryAlloc(Utils.SizeOf(16), 16))
{
- data.WriteStruct(context);
+ data.WriteStruct(context);
- Win32.NtSetContextThread(this, data).ThrowIf();
+ if ((status = Win32.NtSetContextThread(this, data)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
@@ -954,7 +1024,10 @@ namespace ProcessHacker.Native.Objects
/// A CONTEXT struct.
public void SetContextWow64(Context context)
{
- Win32.RtlWow64SetThreadContext(this, ref context).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlWow64SetThreadContext(this, ref context)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -968,22 +1041,35 @@ namespace ProcessHacker.Native.Objects
private void SetInformationInt32(ThreadInformationClass infoClass, int value)
{
- Win32.NtSetInformationThread(
- this,
- infoClass,
- ref value,
- sizeof(int)
- ).ThrowIf();
+ if (
+ KProcessHacker.Instance != null &&
+ infoClass == ThreadInformationClass.ThreadIoPriority
+ )
+ {
+ unsafe
+ {
+ KProcessHacker.Instance.KphSetInformationThread(
+ this, infoClass, new IntPtr(&value), sizeof(int)
+ );
+ }
+ }
+ else
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtSetInformationThread(
+ this, infoClass, ref value, sizeof(int))) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
}
private void SetInformationIntPtr(ThreadInformationClass infoClass, IntPtr value)
{
- Win32.NtSetInformationThread(
- this,
- infoClass,
- ref value,
- sizeof(int)
- ).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtSetInformationThread(
+ this, infoClass, ref value, sizeof(int))) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void SetIoPriority(int ioPriority)
@@ -1031,9 +1117,11 @@ namespace ProcessHacker.Native.Objects
///
public int Suspend()
{
+ NtStatus status;
int suspendCount;
- Win32.NtSuspendThread(this, out suspendCount).ThrowIf();
+ if ((status = Win32.NtSuspendThread(this, out suspendCount)) >= NtStatus.Error)
+ Win32.Throw(status);
return suspendCount;
}
@@ -1052,7 +1140,24 @@ namespace ProcessHacker.Native.Objects
/// The exit status.
public void Terminate(NtStatus exitStatus)
{
- Win32.NtTerminateThread(this, exitStatus).ThrowIf();
+ if (KProcessHacker.Instance != null)
+ {
+ try
+ {
+ KProcessHacker.Instance.KphTerminateThread(this, exitStatus);
+ return;
+ }
+ catch (WindowsException ex)
+ {
+ if (ex.ErrorCode != Win32Error.NotSupported)
+ throw ex;
+ }
+ }
+
+ NtStatus status;
+
+ if ((status = Win32.NtTerminateThread(this, exitStatus)) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -1075,14 +1180,23 @@ namespace ProcessHacker.Native.Objects
///
public void WalkStack(WalkStackDelegate walkStackCallback, OSArch architecture)
{
- // We need to duplicate the handle to get QueryInformation access.
- using (NativeHandle dupThreadHandle = this.Duplicate(OSVersion.MinThreadQueryInfoAccess))
- using (ProcessHandle phandle = new ProcessHandle(
- FromHandle(dupThreadHandle).GetBasicInformation().ClientId.ProcessId,
- ProcessAccess.QueryInformation | ProcessAccess.VmRead
- ))
+ if (KProcessHacker.Instance != null)
{
- this.WalkStack(phandle, walkStackCallback, architecture);
+ // Use KPH to open the parent process.
+ using (var phandle = this.GetProcess(ProcessAccess.QueryInformation | ProcessAccess.VmRead))
+ this.WalkStack(phandle, walkStackCallback, architecture);
+ }
+ else
+ {
+ // We need to duplicate the handle to get QueryInformation access.
+ using (var dupThreadHandle = this.Duplicate(OSVersion.MinThreadQueryInfoAccess))
+ using (var phandle = new ProcessHandle(
+ ThreadHandle.FromHandle(dupThreadHandle).GetBasicInformation().ClientId.ProcessId,
+ ProcessAccess.QueryInformation | ProcessAccess.VmRead
+ ))
+ {
+ this.WalkStack(phandle, walkStackCallback, architecture);
+ }
}
}
@@ -1091,7 +1205,7 @@ namespace ProcessHacker.Native.Objects
///
/// A handle to the thread's parent process.
/// A callback to execute.
- public void WalkStack(ProcessHandle parentProcess, WalkStackDelegate walkStackCallback)
+ public unsafe void WalkStack(ProcessHandle parentProcess, WalkStackDelegate walkStackCallback)
{
this.WalkStack(parentProcess, walkStackCallback, OSVersion.Architecture);
}
@@ -1106,9 +1220,9 @@ namespace ProcessHacker.Native.Objects
/// On 64-bit systems, this value can be set to I386 to walk the
/// 32-bit stack.
///
- public void WalkStack(ProcessHandle parentProcess, WalkStackDelegate walkStackCallback, OSArch architecture)
+ public unsafe void WalkStack(ProcessHandle parentProcess, WalkStackDelegate walkStackCallback, OSArch architecture)
{
- bool suspended;
+ bool suspended = false;
// Suspend the thread to avoid inaccurate thread stacks.
try
@@ -1124,24 +1238,24 @@ namespace ProcessHacker.Native.Objects
// Use KPH for reading memory if we can.
ReadProcessMemoryProc64 readMemoryProc = null;
- //if (KProcessHacker.Instance != null)
- //{
- // readMemoryProc =
- // (IntPtr processHandle, ulong baseAddress, IntPtr buffer, int size, out int bytesRead)
- // => KProcessHacker.Instance.KphReadVirtualMemorySafe(
- // ProcessHandle.FromHandle(processHandle), (int)baseAddress, buffer, size, out bytesRead
- // ).IsSuccess();
- //}
+ if (KProcessHacker.Instance != null)
+ {
+ readMemoryProc = new ReadProcessMemoryProc64(
+ delegate(IntPtr processHandle, ulong baseAddress, IntPtr buffer, int size, out int bytesRead)
+ {
+ return KProcessHacker.Instance.KphReadVirtualMemorySafe(
+ ProcessHandle.FromHandle(processHandle), (int)baseAddress, buffer, size, out bytesRead).IsSuccess();
+ });
+ }
try
{
// x86/WOW64 stack walk.
if (OSVersion.Architecture == OSArch.I386 || (OSVersion.Architecture == OSArch.Amd64 && architecture == OSArch.I386))
{
- Context context = new Context
- {
- ContextFlags = ContextFlags.All
- };
+ Context context = new Context();
+
+ context.ContextFlags = ContextFlags.All;
if (OSVersion.Architecture == OSArch.I386)
{
@@ -1155,24 +1269,14 @@ namespace ProcessHacker.Native.Objects
}
// Set up the initial stack frame structure.
- StackFrame64 stackFrame = new StackFrame64
- {
- AddrPC =
- {
- Mode = AddressMode.AddrModeFlat,
- Offset = (ulong)context.Eip
- },
- AddrStack =
- {
- Mode = AddressMode.AddrModeFlat,
- Offset = (ulong)context.Esp
- },
- AddrFrame =
- {
- Mode = AddressMode.AddrModeFlat,
- Offset = (ulong)context.Ebp
- }
- };
+ var stackFrame = new StackFrame64();
+
+ stackFrame.AddrPC.Mode = AddressMode.AddrModeFlat;
+ stackFrame.AddrPC.Offset = (ulong)context.Eip;
+ stackFrame.AddrStack.Mode = AddressMode.AddrModeFlat;
+ stackFrame.AddrStack.Offset = (ulong)context.Esp;
+ stackFrame.AddrFrame.Mode = AddressMode.AddrModeFlat;
+ stackFrame.AddrFrame.Offset = (ulong)context.Ebp;
while (true)
{
@@ -1204,34 +1308,21 @@ namespace ProcessHacker.Native.Objects
// x64 stack walk.
else if (OSVersion.Architecture == OSArch.Amd64)
{
- ContextAmd64 context = new ContextAmd64
- {
- ContextFlags = ContextFlagsAmd64.All
- };
+ ContextAmd64 context = new ContextAmd64();
+ context.ContextFlags = ContextFlagsAmd64.All;
// Get the context.
this.GetContext(ref context);
// Set up the initial stack frame structure.
- StackFrame64 stackFrame = new StackFrame64
- {
- AddrPC =
- {
- Mode = AddressMode.AddrModeFlat,
- Offset = (ulong)context.Rip
- },
- AddrStack =
- {
- Mode = AddressMode.AddrModeFlat,
- Offset = (ulong)context.Rsp
- },
- AddrFrame =
- {
- Mode = AddressMode.AddrModeFlat,
- Offset = (ulong)context.Rbp
- }
- };
+ var stackFrame = new StackFrame64();
+ stackFrame.AddrPC.Mode = AddressMode.AddrModeFlat;
+ stackFrame.AddrPC.Offset = (ulong)context.Rip;
+ stackFrame.AddrStack.Mode = AddressMode.AddrModeFlat;
+ stackFrame.AddrStack.Offset = (ulong)context.Rsp;
+ stackFrame.AddrFrame.Mode = AddressMode.AddrModeFlat;
+ stackFrame.AddrFrame.Offset = (ulong)context.Rbp;
while (true)
{
@@ -1279,12 +1370,12 @@ namespace ProcessHacker.Native.Objects
public class ThreadStackFrame
{
- private readonly IntPtr _pcAddress;
- private readonly IntPtr _returnAddress;
- private readonly IntPtr _frameAddress;
- private readonly IntPtr _stackAddress;
- private readonly IntPtr _bStoreAddress;
- private readonly IntPtr[] _params;
+ private IntPtr _pcAddress;
+ private IntPtr _returnAddress;
+ private IntPtr _frameAddress;
+ private IntPtr _stackAddress;
+ private IntPtr _bStoreAddress;
+ private IntPtr[] _params;
internal ThreadStackFrame(ref StackFrame64 stackFrame)
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TimerHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/TimerHandle.cs
index 2a7b8308f..fd75b906c 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TimerHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TimerHandle.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -46,12 +47,14 @@ namespace ProcessHacker.Native.Objects
/// A handle to the timer.
public static TimerHandle Create(TimerAccess access, string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, TimerType type)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtCreateTimer(out handle, access, ref oa, type).ThrowIf();
+ if ((status = Win32.NtCreateTimer(out handle, access, ref oa, type)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -66,18 +69,22 @@ namespace ProcessHacker.Native.Objects
return new TimerHandle(handle, false);
}
+ private TimerApcRoutine _routine;
+
private TimerHandle(IntPtr handle, bool owned)
: base(handle, owned)
{ }
public TimerHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, TimerAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenTimer(out handle, access, ref oa).ThrowIf();
+ if ((status = Win32.NtOpenTimer(out handle, access, ref oa)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -97,9 +104,11 @@ namespace ProcessHacker.Native.Objects
/// The state of the timer (whether it is signaled).
public bool Cancel()
{
+ NtStatus status;
bool currentState;
- Win32.NtCancelTimer(this, out currentState).ThrowIf();
+ if ((status = Win32.NtCancelTimer(this, out currentState)) >= NtStatus.Error)
+ Win32.Throw(status);
return currentState;
}
@@ -107,23 +116,17 @@ namespace ProcessHacker.Native.Objects
///
/// Gets information about the timer.
///
- public TimerBasicInformation BasicInformation
+ public TimerBasicInformation GetBasicInformation()
{
- get
- {
- TimerBasicInformation tbi;
- int retLength;
+ NtStatus status;
+ TimerBasicInformation tbi;
+ int retLength;
- Win32.NtQueryTimer(
- this,
- TimerInformationClass.TimerBasicInformation,
- out tbi,
- TimerBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryTimer(this, TimerInformationClass.TimerBasicInformation,
+ out tbi, Marshal.SizeOf(typeof(TimerBasicInformation)), out retLength)) >= NtStatus.Error)
+ Win32.Throw(status);
- return tbi;
- }
+ return tbi;
}
///
@@ -203,12 +206,14 @@ namespace ProcessHacker.Native.Objects
/// The state of the timer (whether it is signaled).
public bool Set(long dueTime, bool relative, TimerApcRoutine routine, IntPtr context, bool resume, int period)
{
+ NtStatus status;
long realDueTime = relative ? -dueTime : dueTime;
bool previousState;
// Keep the APC routine alive.
+ _routine = routine;
- Win32.NtSetTimer(
+ if ((status = Win32.NtSetTimer(
this,
ref realDueTime,
routine,
@@ -216,7 +221,8 @@ namespace ProcessHacker.Native.Objects
resume,
period,
out previousState
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return previousState;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TmHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/TmHandle.cs
index 40eb00148..6450d191a 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TmHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TmHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -37,24 +38,33 @@ namespace ProcessHacker.Native.Objects
TmOptions createOptions
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
- UnicodeString logFileNameStr = new UnicodeString(logFileName);
IntPtr handle;
try
{
- Win32.NtCreateTransactionManager(
- out handle,
- access,
- ref oa,
- ref logFileNameStr,
- createOptions,
- 0
- ).ThrowIf();
+ UnicodeString logFileNameStr = new UnicodeString(logFileName);
+
+ try
+ {
+ if ((status = Win32.NtCreateTransactionManager(
+ out handle,
+ access,
+ ref oa,
+ ref logFileNameStr,
+ createOptions,
+ 0
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+ finally
+ {
+ logFileNameStr.Dispose();
+ }
}
finally
{
- logFileNameStr.Dispose();
oa.Dispose();
}
@@ -72,19 +82,21 @@ namespace ProcessHacker.Native.Objects
public TmHandle(string name, ObjectFlags objectFlags, DirectoryHandle rootDirectory, TmAccess access)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenTransactionManager(
+ if ((status = Win32.NtOpenTransactionManager(
out handle,
access,
ref oa,
IntPtr.Zero,
IntPtr.Zero,
0
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -94,113 +106,115 @@ namespace ProcessHacker.Native.Objects
this.Handle = handle;
}
- public TmBasicInformation BasicInformation
+ public TmBasicInformation GetBasicInformation()
{
- get
- {
- TmBasicInformation basicInfo;
- int retLength;
+ NtStatus status;
+ TmBasicInformation basicInfo;
+ int retLength;
- Win32.NtQueryInformationTransactionManager(
- this,
- TmInformationClass.TransactionManagerBasicInformation,
- out basicInfo,
- TmBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationTransactionManager(
+ this,
+ TmInformationClass.TransactionManagerBasicInformation,
+ out basicInfo,
+ Marshal.SizeOf(typeof(TmBasicInformation)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return basicInfo;
- }
+ return basicInfo;
}
- public long LastRecoveredLsn
+ public long GetLastRecoveredLsn()
{
- get
- {
- TmRecoveryInformation recoveryInfo;
- int retLength;
+ NtStatus status;
+ TmRecoveryInformation recoveryInfo;
+ int retLength;
- Win32.NtQueryInformationTransactionManager(
- this,
- TmInformationClass.TransactionManagerRecoveryInformation,
- out recoveryInfo,
- TmRecoveryInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationTransactionManager(
+ this,
+ TmInformationClass.TransactionManagerRecoveryInformation,
+ out recoveryInfo,
+ Marshal.SizeOf(typeof(TmRecoveryInformation)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return recoveryInfo.LastRecoveredLsn;
- }
+ return recoveryInfo.LastRecoveredLsn;
}
- public string LogFileName
+ public string GetLogFileName()
{
- get
- {
- int retLength;
+ NtStatus status;
+ int retLength;
- using (MemoryAlloc data = new MemoryAlloc(0x1000))
+ using (var data = new MemoryAlloc(0x1000))
+ {
+ status = Win32.NtQueryInformationTransactionManager(
+ this,
+ TmInformationClass.TransactionManagerLogPathInformation,
+ data,
+ data.Size,
+ out retLength
+ );
+
+ if (status == NtStatus.BufferTooSmall)
{
- NtStatus status = Win32.NtQueryInformationTransactionManager(
+ // Resize the buffer and try again.
+ data.ResizeNew(retLength);
+
+ status = Win32.NtQueryInformationTransactionManager(
this,
TmInformationClass.TransactionManagerLogPathInformation,
data,
data.Size,
out retLength
);
-
- if (status == NtStatus.BufferTooSmall)
- {
- // Resize the buffer and try again.
- data.ResizeNew(retLength);
-
- Win32.NtQueryInformationTransactionManager(
- this,
- TmInformationClass.TransactionManagerLogPathInformation,
- data,
- data.Size,
- out retLength
- ).ThrowIf();
- }
-
- status.ThrowIf();
-
- TmLogPathInformation logPathInfo = data.ReadStruct();
-
- return data.ReadUnicodeString(TmLogPathInformation.LogPathOffset, logPathInfo.LogPathLength);
}
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
+
+ TmLogPathInformation logPathInfo = data.ReadStruct();
+
+ return data.ReadUnicodeString(TmLogPathInformation.LogPathOffset, logPathInfo.LogPathLength);
}
}
- public Guid LogIdentity
+ public Guid GetLogIdentity()
{
- get
- {
- TmLogInformation logInfo;
- int retLength;
+ NtStatus status;
+ TmLogInformation logInfo;
+ int retLength;
- Win32.NtQueryInformationTransactionManager(
- this,
- TmInformationClass.TransactionManagerLogInformation,
- out logInfo,
- TmLogInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationTransactionManager(
+ this,
+ TmInformationClass.TransactionManagerLogInformation,
+ out logInfo,
+ Marshal.SizeOf(typeof(TmLogInformation)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return logInfo.LogIdentity;
- }
+ return logInfo.LogIdentity;
}
public void Recover()
{
- Win32.NtRecoverTransactionManager(this).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRecoverTransactionManager(this)) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void Rollforward(long virtualClock)
{
- Win32.NtRollforwardTransactionManager(
+ NtStatus status;
+
+ if ((status = Win32.NtRollforwardTransactionManager(
this,
ref virtualClock
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TokenHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/TokenHandle.cs
index b3f0d1225..7415127dd 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TokenHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TokenHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
using ProcessHacker.Native.Security.AccessControl;
@@ -48,7 +49,7 @@ namespace ProcessHacker.Native.Objects
)
{
using (var administratorsSid = Sid.GetWellKnownSid(WellKnownSidType.WinBuiltinAdministratorsSid))
- using (var thandle = OpenCurrentPrimary(TokenAccess.Query))
+ using (var thandle = TokenHandle.OpenCurrentPrimary(TokenAccess.Query))
return Create(access, 0, thandle, tokenType, user, groups, privileges, administratorsSid, administratorsSid);
}
@@ -64,7 +65,7 @@ namespace ProcessHacker.Native.Objects
Sid primaryGroup
)
{
- var statistics = existingTokenHandle.Statistics;
+ var statistics = existingTokenHandle.GetStatistics();
return Create(
access,
@@ -101,6 +102,7 @@ namespace ProcessHacker.Native.Objects
TokenSource source
)
{
+ NtStatus status;
TokenUser tokenUser = new TokenUser(user);
TokenGroups tokenGroups = new TokenGroups(groups);
TokenPrivileges tokenPrivileges = new TokenPrivileges(privileges);
@@ -112,7 +114,7 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.NtCreateToken(
+ if ((status = Win32.NtCreateToken(
out handle,
access,
ref oa,
@@ -126,7 +128,8 @@ namespace ProcessHacker.Native.Objects
ref tokenPrimaryGroup,
ref tokenDefaultDacl,
ref source
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -174,7 +177,7 @@ namespace ProcessHacker.Native.Objects
public static TokenHandle OpenSystemToken(TokenAccess access)
{
- using (ProcessHandle phandle = new ProcessHandle(4, OSVersion.MinProcessQueryInfoAccess))
+ using (var phandle = new ProcessHandle(4, OSVersion.MinProcessQueryInfoAccess))
{
return phandle.GetToken(access);
}
@@ -182,9 +185,9 @@ namespace ProcessHacker.Native.Objects
public static TokenHandle OpenSystemToken(TokenAccess access, SecurityImpersonationLevel impersonationLevel, TokenType type)
{
- using (ProcessHandle phandle = new ProcessHandle(4, OSVersion.MinProcessQueryInfoAccess))
+ using (var phandle = new ProcessHandle(4, OSVersion.MinProcessQueryInfoAccess))
{
- using (TokenHandle thandle = phandle.GetToken(TokenAccess.Duplicate | access))
+ using (var thandle = phandle.GetToken(TokenAccess.Duplicate | access))
{
return thandle.Duplicate(access, impersonationLevel, type);
}
@@ -202,22 +205,22 @@ namespace ProcessHacker.Native.Objects
/// The desired access to the token.
public TokenHandle(ProcessHandle handle, TokenAccess access)
{
- if (KProcessHacker2.Instance != null && KProcessHacker2.Instance.KphIsConnected)
+ IntPtr h;
+
+ if (KProcessHacker.Instance != null)
{
- this.Handle = KProcessHacker2.Instance.KphOpenProcessToken(handle, access);
+ h = new IntPtr(KProcessHacker.Instance.KphOpenProcessToken(handle, access));
}
else
{
- IntPtr thandle;
-
- if (!Win32.OpenProcessToken(handle, access, out thandle))
+ if (!Win32.OpenProcessToken(handle, access, out h))
{
this.MarkAsInvalid();
Win32.Throw();
}
-
- this.Handle = thandle;
}
+
+ this.Handle = h;
}
///
@@ -250,11 +253,10 @@ namespace ProcessHacker.Native.Objects
public void AdjustGroups(Sid[] groups)
{
- TokenGroups tokenGroups = new TokenGroups
- {
- GroupCount = groups.Length,
- Groups = new SidAndAttributes[groups.Length]
- };
+ TokenGroups tokenGroups = new TokenGroups();
+
+ tokenGroups.GroupCount = groups.Length;
+ tokenGroups.Groups = new SidAndAttributes[groups.Length];
for (int i = 0; i < groups.Length; i++)
tokenGroups.Groups[i] = groups[i].ToSidAndAttributes();
@@ -267,20 +269,25 @@ namespace ProcessHacker.Native.Objects
{
var tokenPrivileges = privileges.ToTokenPrivileges();
- Win32.NtAdjustPrivilegesToken(this, false, ref tokenPrivileges, 0, IntPtr.Zero, IntPtr.Zero).ThrowIf();
+ Win32.AdjustTokenPrivileges(this, false, ref tokenPrivileges, 0, IntPtr.Zero, IntPtr.Zero);
+
+ if (Marshal.GetLastWin32Error() != 0)
+ Win32.Throw();
}
public bool CheckPrivileges(PrivilegeSet privileges)
{
+ NtStatus status;
bool result;
- using (MemoryAlloc privilegesMemory = privileges.ToMemory())
+ using (var privilegesMemory = privileges.ToMemory())
{
- Win32.NtPrivilegeCheck(
+ if ((status = Win32.NtPrivilegeCheck(
this,
privilegesMemory,
out result
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return result;
}
@@ -310,13 +317,15 @@ namespace ProcessHacker.Native.Objects
/// Whether they are equal.
public bool Equals(TokenHandle other)
{
+ NtStatus status;
bool equal;
- Win32.NtCompareTokens(
+ if ((status = Win32.NtCompareTokens(
this,
other,
out equal
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return equal;
}
@@ -325,226 +334,23 @@ namespace ProcessHacker.Native.Objects
/// Gets the elevation type of the token.
///
/// A TOKEN_ELEVATION_TYPE enum.
- public TokenElevationType ElevationType
+ public TokenElevationType GetElevationType()
{
- get { return (TokenElevationType)this.GetInformationInt32(TokenInformationClass.TokenElevationType); }
+ return (TokenElevationType)this.GetInformationInt32(TokenInformationClass.TokenElevationType);
}
///
/// Gets the token's groups.
///
/// A TokenGroupsData struct.
- public Sid[] Groups
+ public Sid[] GetGroups()
{
- get { return this.GetGroupsInternal(TokenInformationClass.TokenGroups); }
- }
-
- public TokenHandle LinkedToken
- {
- get
- {
- NtStatus status;
-
- IntPtr handle = this.GetInformationIntPtr(TokenInformationClass.TokenLinkedToken, out status);
-
- if (status == NtStatus.NoSuchLogonSession)
- return null;
-
- status.ThrowIf();
-
- return new TokenHandle(handle, true);
- }
- }
-
- ///
- /// Gets the token's owner.
- ///
- /// A WindowsSID instance.
- public Sid Owner
- {
- get
- {
- int retLen;
-
- Win32.GetTokenInformation(this, TokenInformationClass.TokenOwner, IntPtr.Zero, 0, out retLen);
-
- using (MemoryAlloc data = new MemoryAlloc(retLen))
- {
- if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenOwner, data, data.Size, out retLen))
- Win32.Throw();
-
- return new Sid(data.ReadIntPtr(0));
- }
- }
- }
-
- ///
- /// Gets the token's primary group.
- ///
- /// A WindowsSID instance.
- public Sid PrimaryGroup
- {
- get
- {
- int retLen;
-
- Win32.GetTokenInformation(this, TokenInformationClass.TokenPrimaryGroup, IntPtr.Zero, 0, out retLen);
-
- using (MemoryAlloc data = new MemoryAlloc(retLen))
- {
- if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenPrimaryGroup, data, data.Size, out retLen))
- Win32.Throw();
-
- return new Sid(data.ReadIntPtr(0));
- }
- }
- }
-
- ///
- /// Gets the token's privileges.
- ///
- /// A TOKEN_PRIVILEGES structure.
- public Privilege[] Privileges
- {
- get
- {
- int retLen;
-
- Win32.GetTokenInformation(this, TokenInformationClass.TokenPrivileges, IntPtr.Zero, 0, out retLen);
-
- using (MemoryAlloc data = new MemoryAlloc(retLen))
- {
- if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenPrivileges, data, data.Size, out retLen))
- Win32.Throw();
-
- uint count = data.ReadUInt32(0);
- Privilege[] privileges = new Privilege[count];
-
- for (int i = 0; i < count; i++)
- {
- var laa = data.ReadStruct(sizeof(int), LuidAndAttributes.SizeOf, i);
- privileges[i] = new Privilege(this, laa.Luid, laa.Attributes);
- }
-
- return privileges;
- }
- }
- }
-
- ///
- /// Gets the restricted token's restricting SIDs.
- ///
- /// A TokenGroupsData struct.
- public Sid[] RestrictingGroups
- {
- get { return this.GetGroupsInternal(TokenInformationClass.TokenRestrictedSids); }
- }
-
- ///
- /// Gets/Sets the token's session ID.
- ///
- /// The session ID.
- public int SessionId
- {
- get { return this.GetInformationInt32(TokenInformationClass.TokenSessionId); }
- set { this.SetInformationInt32(TokenInformationClass.TokenSessionId, value); }
- }
-
- ///
- /// Gets the token's source.
- ///
- /// A TOKEN_SOURCE struct.
- public TokenSource Source
- {
- get
- {
- TokenSource source;
- int retLen;
-
- if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenSource, out source, TokenSource.SizeOf, out retLen))
- Win32.Throw();
-
- return source;
- }
- }
-
- ///
- /// Gets statistics about the token.
- ///
- /// A TOKEN_STATISTICS structure.
- public TokenStatistics Statistics
- {
- get
- {
- TokenStatistics statistics;
- int retLen;
-
- if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenStatistics, out statistics, TokenStatistics.SizeOf, out retLen))
- Win32.Throw();
-
- return statistics;
- }
- }
-
- ///
- /// Gets the token's user.
- ///
- /// A WindowsSID instance.
- public Sid User
- {
- get
- {
- int retLen;
-
- Win32.NtQueryInformationToken(this, TokenInformationClass.TokenUser, IntPtr.Zero, 0, out retLen);
-
- using (MemoryAlloc data = new MemoryAlloc(retLen))
- {
- Win32.NtQueryInformationToken(this.Handle, TokenInformationClass.TokenUser, data, data.Size, out retLen).ThrowIf();
-
- TokenUser user = data.ReadStruct();
-
- return new Sid(user.User.Sid, user.User.Attributes);
- }
- }
- }
-
- ///
- /// Gets whether the token has UAC elevation applied.
- ///
- /// A boolean.
- public bool IsElevated
- {
- get { return this.GetInformationInt32(TokenInformationClass.TokenElevation) != 0; }
- }
-
- ///
- /// Gets whether virtualization is allowed.
- ///
- /// A boolean.
- public bool IsVirtualizationAllowed
- {
- get { return this.GetInformationInt32(TokenInformationClass.TokenVirtualizationAllowed) != 0; }
- }
-
- ///
- /// Gets/Sets whether virtualization is enabled or disabled.
- ///
- /// A boolean.
- public bool IsVirtualizationEnabled
- {
- get { return this.GetInformationInt32(TokenInformationClass.TokenVirtualizationEnabled) != 0; }
- set
- {
- int val = value ? 1 : 0;
-
- Win32.NtSetInformationToken(this, TokenInformationClass.TokenVirtualizationEnabled, ref val, 4).ThrowIf();
- }
+ return this.GetGroupsInternal(TokenInformationClass.TokenGroups);
}
private Sid[] GetGroupsInternal(TokenInformationClass infoClass)
{
- int retLen;
+ int retLen = 0;
Win32.GetTokenInformation(this, infoClass, IntPtr.Zero, 0, out retLen);
@@ -554,12 +360,12 @@ namespace ProcessHacker.Native.Objects
data.Size, out retLen))
Win32.Throw();
- int count = data.ReadStruct(0, TokenGroups.SizeOf, 0).GroupCount;
+ int count = data.ReadStruct().GroupCount;
Sid[] sids = new Sid[count];
for (int i = 0; i < count; i++)
{
- var saa = data.ReadStruct(TokenGroups.GroupsOffset, SidAndAttributes.SizeOf, i);
+ var saa = data.ReadStruct(TokenGroups.GroupsOffset, i);
sids[i] = new Sid(saa.Sid, saa.Attributes);
}
@@ -570,10 +376,12 @@ namespace ProcessHacker.Native.Objects
private int GetInformationInt32(TokenInformationClass infoClass)
{
NtStatus status;
-
- int value = this.GetInformationInt32(infoClass, out status);
+ int value;
- status.ThrowIf();
+ value = this.GetInformationInt32(infoClass, out status);
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return value;
}
@@ -594,23 +402,15 @@ namespace ProcessHacker.Native.Objects
return value;
}
- private void SetInformationInt32(TokenInformationClass infoClass, int value)
- {
- Win32.NtSetInformationToken(
- this,
- infoClass,
- ref value,
- sizeof(int)
- ).ThrowIf();
- }
-
private IntPtr GetInformationIntPtr(TokenInformationClass infoClass)
{
NtStatus status;
+ IntPtr value;
- IntPtr value = this.GetInformationIntPtr(infoClass, out status);
+ value = this.GetInformationIntPtr(infoClass, out status);
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return value;
}
@@ -630,7 +430,203 @@ namespace ProcessHacker.Native.Objects
return value;
}
-
+
+ public TokenHandle GetLinkedToken()
+ {
+ NtStatus status;
+ IntPtr handle;
+
+ handle = this.GetInformationIntPtr(TokenInformationClass.TokenLinkedToken, out status);
+
+ if (status == NtStatus.NoSuchLogonSession)
+ return null;
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
+
+ return new TokenHandle(handle, true);
+ }
+
+ ///
+ /// Gets the token's owner.
+ ///
+ /// A WindowsSID instance.
+ public Sid GetOwner()
+ {
+ int retLen;
+
+ Win32.GetTokenInformation(this, TokenInformationClass.TokenOwner, IntPtr.Zero, 0, out retLen);
+
+ using (MemoryAlloc data = new MemoryAlloc(retLen))
+ {
+ if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenOwner, data,
+ data.Size, out retLen))
+ Win32.Throw();
+
+ return new Sid(data.ReadIntPtr(0));
+ }
+ }
+
+ ///
+ /// Gets the token's primary group.
+ ///
+ /// A WindowsSID instance.
+ public Sid GetPrimaryGroup()
+ {
+ int retLen;
+
+ Win32.GetTokenInformation(this, TokenInformationClass.TokenPrimaryGroup, IntPtr.Zero, 0, out retLen);
+
+ using (MemoryAlloc data = new MemoryAlloc(retLen))
+ {
+ if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenPrimaryGroup, data,
+ data.Size, out retLen))
+ Win32.Throw();
+
+ return new Sid(data.ReadIntPtr(0));
+ }
+ }
+
+ ///
+ /// Gets the token's privileges.
+ ///
+ /// A TOKEN_PRIVILEGES structure.
+ public Privilege[] GetPrivileges()
+ {
+ int retLen;
+
+ Win32.GetTokenInformation(this, TokenInformationClass.TokenPrivileges, IntPtr.Zero, 0, out retLen);
+
+ using (MemoryAlloc data = new MemoryAlloc(retLen))
+ {
+ if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenPrivileges, data,
+ data.Size, out retLen))
+ Win32.Throw();
+
+ uint count = data.ReadUInt32(0);
+ Privilege[] privileges = new Privilege[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ var laa = data.ReadStruct(sizeof(int), i);
+ privileges[i] = new Privilege(this, laa.Luid, laa.Attributes);
+ }
+
+ return privileges;
+ }
+ }
+
+ ///
+ /// Gets the restricted token's restricting SIDs.
+ ///
+ /// A TokenGroupsData struct.
+ public Sid[] GetRestrictingGroups()
+ {
+ return this.GetGroupsInternal(TokenInformationClass.TokenRestrictedSids);
+ }
+
+ ///
+ /// Gets the token's session ID.
+ ///
+ /// The session ID.
+ public int GetSessionId()
+ {
+ return this.GetInformationInt32(TokenInformationClass.TokenSessionId);
+ }
+
+ ///
+ /// Gets the token's source.
+ ///
+ /// A TOKEN_SOURCE struct.
+ public TokenSource GetSource()
+ {
+ TokenSource source;
+ int retLen;
+
+ if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenSource,
+ out source, Marshal.SizeOf(typeof(TokenSource)), out retLen))
+ Win32.Throw();
+
+ return source;
+ }
+
+ ///
+ /// Gets statistics about the token.
+ ///
+ /// A TOKEN_STATISTICS structure.
+ public TokenStatistics GetStatistics()
+ {
+ TokenStatistics statistics;
+ int retLen;
+
+ if (!Win32.GetTokenInformation(this, TokenInformationClass.TokenStatistics,
+ out statistics, Marshal.SizeOf(typeof(TokenStatistics)), out retLen))
+ Win32.Throw();
+
+ return statistics;
+ }
+
+ ///
+ /// Gets the token's user.
+ ///
+ /// A WindowsSID instance.
+ public Sid GetUser()
+ {
+ int retLen;
+
+ Win32.GetTokenInformation(this, TokenInformationClass.TokenUser, IntPtr.Zero, 0, out retLen);
+
+ using (MemoryAlloc data = new MemoryAlloc(retLen))
+ {
+ if (!Win32.GetTokenInformation(this.Handle, TokenInformationClass.TokenUser, data,
+ data.Size, out retLen))
+ Win32.Throw();
+
+ TokenUser user = data.ReadStruct();
+
+ return new Sid(user.User.Sid, user.User.Attributes);
+ }
+ }
+
+ ///
+ /// Gets whether the token has UAC elevation applied.
+ ///
+ /// A boolean.
+ public bool IsElevated()
+ {
+ return this.GetInformationInt32(TokenInformationClass.TokenElevation) != 0;
+ }
+
+ ///
+ /// Gets whether virtualization is allowed.
+ ///
+ /// A boolean.
+ public bool IsVirtualizationAllowed()
+ {
+ return this.GetInformationInt32(TokenInformationClass.TokenVirtualizationAllowed) != 0;
+ }
+
+ ///
+ /// Gets whether virtualization is enabled.
+ ///
+ /// A boolean.
+ public bool IsVirtualizationEnabled()
+ {
+ return this.GetInformationInt32(TokenInformationClass.TokenVirtualizationEnabled) != 0;
+ }
+
+ private void SetInformationInt32(TokenInformationClass infoClass, int value)
+ {
+ NtStatus status;
+
+ if ((status = Win32.NtSetInformationToken(
+ this,
+ infoClass,
+ ref value,
+ sizeof(int)
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
+ }
+
///
/// Sets a privilege's attributes.
///
@@ -638,12 +634,33 @@ namespace ProcessHacker.Native.Objects
/// The new attributes of the privilege.
public void SetPrivilege(string privilegeName, SePrivilegeAttributes attributes)
{
- this.TrySetPrivilege(privilegeName, attributes).ThrowIf();
+ if (!this.TrySetPrivilege(privilegeName, attributes))
+ Win32.Throw();
}
public void SetPrivilege(Luid privilegeLuid, SePrivilegeAttributes attributes)
{
- this.TrySetPrivilege(privilegeLuid, attributes).ThrowIf();
+ if (!this.TrySetPrivilege(privilegeLuid, attributes))
+ Win32.Throw();
+ }
+
+ public void SetSessionId(int sessionId)
+ {
+ this.SetInformationInt32(TokenInformationClass.TokenSessionId, sessionId);
+ }
+
+ ///
+ /// Sets whether virtualization is enabled.
+ ///
+ /// Whether virtualization is enabled.
+ public void SetVirtualizationEnabled(bool enabled)
+ {
+ int value = enabled ? 1 : 0;
+
+ if (!Win32.SetTokenInformation(this, TokenInformationClass.TokenVirtualizationEnabled, ref value, 4))
+ {
+ Win32.Throw();
+ }
}
///
@@ -652,7 +669,7 @@ namespace ProcessHacker.Native.Objects
/// The name of the privilege.
/// The new attributes of the privilege.
/// True if the function succeeded, otherwise false.
- public NtStatus TrySetPrivilege(string privilegeName, SePrivilegeAttributes attributes)
+ public bool TrySetPrivilege(string privilegeName, SePrivilegeAttributes attributes)
{
return this.TrySetPrivilege(
LsaPolicyHandle.LookupPolicyHandle.LookupPrivilegeValue(privilegeName),
@@ -660,18 +677,22 @@ namespace ProcessHacker.Native.Objects
);
}
- public NtStatus TrySetPrivilege(Luid privilegeLuid, SePrivilegeAttributes attributes)
+ public bool TrySetPrivilege(Luid privilegeLuid, SePrivilegeAttributes attributes)
{
- TokenPrivileges tkp = new TokenPrivileges
- {
- Privileges = new LuidAndAttributes[1],
- PrivilegeCount = 1
- };
+ TokenPrivileges tkp = new TokenPrivileges();
+ tkp.Privileges = new LuidAndAttributes[1];
+
+ tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = attributes;
tkp.Privileges[0].Luid = privilegeLuid;
- return Win32.NtAdjustPrivilegesToken(this, false, ref tkp, 0, IntPtr.Zero, IntPtr.Zero);
+ Win32.AdjustTokenPrivileges(this, false, ref tkp, 0, IntPtr.Zero, IntPtr.Zero);
+
+ if (Marshal.GetLastWin32Error() != 0)
+ return false;
+
+ return true;
}
}
}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TokenWithLinkedToken.cs b/1.x/trunk/ProcessHacker.Native/Objects/TokenWithLinkedToken.cs
index aec73840b..4fc88a731 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TokenWithLinkedToken.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TokenWithLinkedToken.cs
@@ -20,13 +20,15 @@
* along with Process Hacker. If not, see .
*/
+using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
+using System;
namespace ProcessHacker.Native.Objects
{
public sealed class TokenWithLinkedToken : IWithToken
{
- private readonly TokenHandle _token;
+ private TokenHandle _token;
public TokenWithLinkedToken(TokenHandle token)
{
@@ -35,7 +37,7 @@ namespace ProcessHacker.Native.Objects
public TokenHandle GetToken()
{
- return _token.LinkedToken;
+ return _token.GetLinkedToken();
}
public TokenHandle GetToken(TokenAccess access)
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TransactionHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/TransactionHandle.cs
index 8870ed89b..765dd1c33 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TransactionHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TransactionHandle.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -30,7 +31,7 @@ namespace ProcessHacker.Native.Objects
{
public struct CurrentTransactionContext : IDisposable
{
- private readonly TransactionHandle _oldHandle;
+ private TransactionHandle _oldHandle;
private bool _disposed;
internal CurrentTransactionContext(TransactionHandle handle)
@@ -83,6 +84,7 @@ namespace ProcessHacker.Native.Objects
string description
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
@@ -95,7 +97,7 @@ namespace ProcessHacker.Native.Objects
try
{
- Win32.NtCreateTransaction(
+ if ((status = Win32.NtCreateTransaction(
out handle,
access,
ref oa,
@@ -106,7 +108,8 @@ namespace ProcessHacker.Native.Objects
0,
ref timeout,
ref descriptionStr
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -123,12 +126,14 @@ namespace ProcessHacker.Native.Objects
public static TransactionHandle GetCurrent()
{
- IntPtr handle = Win32.RtlGetCurrentTransaction();
+ IntPtr handle;
+
+ handle = Win32.RtlGetCurrentTransaction();
if (handle != IntPtr.Zero)
return new TransactionHandle(handle, false);
-
- return null;
+ else
+ return null;
}
public static void SetCurrent(TransactionHandle transactionHandle)
@@ -154,18 +159,20 @@ namespace ProcessHacker.Native.Objects
TransactionAccess access
)
{
+ NtStatus status;
ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
IntPtr handle;
try
{
- Win32.NtOpenTransaction(
+ if ((status = Win32.NtOpenTransaction(
out handle,
access,
ref oa,
ref unitOfWorkGuid,
tmHandle ?? IntPtr.Zero
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -182,51 +189,51 @@ namespace ProcessHacker.Native.Objects
public void Commit(bool wait)
{
- Win32.NtCommitTransaction(this, wait).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtCommitTransaction(this, wait)) >= NtStatus.Error)
+ Win32.Throw(status);
}
- public TransactionBasicInformation BasicInformation
+ public TransactionBasicInformation GetBasicInformation()
{
- get
- {
- TransactionBasicInformation basicInfo;
- int retLength;
+ NtStatus status;
+ TransactionBasicInformation basicInfo;
+ int retLength;
- Win32.NtQueryInformationTransaction(
- this,
- TransactionInformationClass.TransactionBasicInformation,
- out basicInfo,
- TransactionBasicInformation.SizeOf,
- out retLength
- ).ThrowIf();
+ if ((status = Win32.NtQueryInformationTransaction(
+ this,
+ TransactionInformationClass.TransactionBasicInformation,
+ out basicInfo,
+ Marshal.SizeOf(typeof(TransactionBasicInformation)),
+ out retLength
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
- return basicInfo;
- }
+ return basicInfo;
}
- public string Description
+ public string GetDescription()
{
- get
+ using (var data = this.GetPropertiesInformation())
{
- using (MemoryAlloc data = this.GetPropertiesInformation())
- {
- TransactionPropertiesInformation propertiesInfo = data.ReadStruct();
+ var propertiesInfo = data.ReadStruct();
- return data.ReadUnicodeString(
- TransactionPropertiesInformation.DescriptionOffset,
- propertiesInfo.DescriptionLength / 2
- );
- }
+ return data.ReadUnicodeString(
+ TransactionPropertiesInformation.DescriptionOffset,
+ propertiesInfo.DescriptionLength / 2
+ );
}
}
private MemoryAlloc GetPropertiesInformation()
{
+ NtStatus status;
int retLength;
- MemoryAlloc data = new MemoryAlloc(0x1000);
+ var data = new MemoryAlloc(0x1000);
- NtStatus status = Win32.NtQueryInformationTransaction(
+ status = Win32.NtQueryInformationTransaction(
this,
TransactionInformationClass.TransactionPropertiesInformation,
data,
@@ -248,29 +255,27 @@ namespace ProcessHacker.Native.Objects
);
}
- if (status.IsError())
+ if (status >= NtStatus.Error)
{
data.Dispose();
- status.Throw();
+ Win32.Throw(status);
}
return data;
}
- public long Timeout
+ public long GetTimeout()
{
- get
- {
- using (MemoryAlloc data = this.GetPropertiesInformation())
- {
- return data.ReadStruct().Timeout;
- }
- }
+ using (var data = this.GetPropertiesInformation())
+ return data.ReadStruct().Timeout;
}
public void Rollback(bool wait)
{
- Win32.NtRollbackTransaction(this, wait).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtRollbackTransaction(this, wait)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/TypeObjectHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/TypeObjectHandle.cs
index 21fa5b789..85cf0b29a 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/TypeObjectHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/TypeObjectHandle.cs
@@ -1,4 +1,8 @@
-using ProcessHacker.Native.Api;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Native;
+using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
namespace ProcessHacker.Native.Objects
@@ -15,7 +19,7 @@ namespace ProcessHacker.Native.Objects
try
{
- //this.Handle = KProcessHacker.Instance.KphOpenType(oa).ToIntPtr();
+ this.Handle = KProcessHacker.Instance.KphOpenType(oa).ToIntPtr();
}
finally
{
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/WindowHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/WindowHandle.cs
index e67a00a66..91e29aae4 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/WindowHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/WindowHandle.cs
@@ -1,5 +1,7 @@
using System;
using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Text;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Objects
@@ -8,7 +10,7 @@ namespace ProcessHacker.Native.Objects
public struct WindowHandle : IEquatable, IEquatable, System.Windows.Forms.IWin32Window
{
- private static readonly WindowHandle _zero = new WindowHandle(IntPtr.Zero);
+ private static WindowHandle _zero = new WindowHandle(IntPtr.Zero);
public static WindowHandle Zero
{
@@ -52,7 +54,7 @@ namespace ProcessHacker.Native.Objects
return windowHandle.Handle;
}
- private readonly IntPtr _handle;
+ private IntPtr _handle;
public WindowHandle(IntPtr handle)
{
@@ -104,83 +106,70 @@ namespace ProcessHacker.Native.Objects
return this.Handle.Equals(other);
}
- public ClientId ClientId
+ public ClientId GetClientId()
{
- get
- {
- int pid;
+ int tid, pid;
- int tid = Win32.GetWindowThreadProcessId(this, out pid);
+ tid = Win32.GetWindowThreadProcessId(this, out pid);
- return new ClientId(pid, tid);
- }
+ return new ClientId(pid, tid);
}
- public WindowHandle Parent
+ public WindowHandle GetParent()
{
- get { return new WindowHandle(Win32.GetParent(this)); }
+ return new WindowHandle(Win32.GetParent(this));
}
- public WindowPlacement Placement
+ public WindowPlacement GetPlacement()
{
- get
- {
- WindowPlacement placement = new WindowPlacement
- {
- Length = WindowPlacement.SizeOf
- };
+ WindowPlacement placement = new WindowPlacement();
+ placement.Length = Marshal.SizeOf(placement);
+ Win32.GetWindowPlacement(this, ref placement);
- Win32.GetWindowPlacement(this, ref placement);
-
- return placement;
- }
+ return placement;
}
- public Rectangle Rectangle
+ public Rectangle GetRectangle()
{
- get
- {
- Rect rect;
-
- if (!Win32.GetWindowRect(this, out rect))
- return Rectangle.Empty;
+ Rect rect;
+ if (!Win32.GetWindowRect(this, out rect))
+ return Rectangle.Empty;
+ else
return rect.ToRectangle();
- }
}
- public string Text
+ public string GetText()
{
- get
+ int retChars;
+
+ using (var data = new MemoryAlloc(0x200))
{
- using (MemoryAlloc data = new MemoryAlloc(0x200))
- {
- int retChars = Win32.InternalGetWindowText(this, data, data.Size/2);
+ retChars = Win32.InternalGetWindowText(this, data, data.Size / 2);
- return data.ReadUnicodeString(0, retChars);
- }
+ return data.ReadUnicodeString(0, retChars);
}
}
- public bool IsHung
+ public bool IsHung()
{
- get { return Win32.IsHungAppWindow(this); }
+ return Win32.IsHungAppWindow(this);
}
- public bool IsParent
+ public bool IsParent()
{
- get { return this.Parent.Equals(Zero); }
+ return this.GetParent().Equals(WindowHandle.Zero);
}
- public bool IsWindow
+ public bool IsWindow()
{
- get { return Win32.IsWindow(this); }
+ return Win32.IsWindow(this);
}
- public bool IsVisible
+ public bool IsVisible()
{
- get { return Win32.IsWindowVisible(this); }
+ return Win32.IsWindowVisible(this);
}
public bool PostMessage(WindowMessage message, int wParam, int lParam)
@@ -188,7 +177,7 @@ namespace ProcessHacker.Native.Objects
return Win32.PostMessage(this, message, wParam, lParam);
}
- public IntPtr SendMessage(WindowMessage message, IntPtr wParam, IntPtr lParam)
+ public IntPtr SendMessage(WindowMessage message, int wParam, int lParam)
{
return Win32.SendMessage(this, message, wParam, lParam);
}
diff --git a/1.x/trunk/ProcessHacker.Native/Objects/WindowStationHandle.cs b/1.x/trunk/ProcessHacker.Native/Objects/WindowStationHandle.cs
index 63fb29e5f..180a970f0 100644
--- a/1.x/trunk/ProcessHacker.Native/Objects/WindowStationHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/Objects/WindowStationHandle.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security;
@@ -48,7 +50,7 @@ namespace ProcessHacker.Native.Objects
{
this.Handle = Win32.OpenWindowStation(name, false, access);
- if (this.Handle == IntPtr.Zero)
+ if (this.Handle == System.IntPtr.Zero)
Win32.Throw();
}
diff --git a/1.x/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj b/1.x/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj
index f91925c68..e6e74a769 100644
--- a/1.x/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj
+++ b/1.x/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj
@@ -10,7 +10,7 @@
Properties
ProcessHacker.Native
ProcessHacker.Native
- v4.5
+ v4.0
512
@@ -47,8 +47,7 @@
AnyCPU
- MinimumRecommendedRules.ruleset
- false
+ AllRules.ruleset
pdbonly
@@ -62,7 +61,6 @@
1591
AnyCPU
AllRules.ruleset
- false
@@ -126,7 +124,6 @@
-
@@ -152,12 +149,6 @@
-
- UserControl
-
-
- UserControl
-
@@ -280,6 +271,18 @@
+
+ Form
+
+
+ ChooseProcessDialog.cs
+
+
+ Form
+
+
+ HandlePropertiesWindow.cs
+
@@ -289,6 +292,14 @@
+
+
+ ChooseProcessDialog.cs
+
+
+ HandlePropertiesWindow.cs
+
+
{8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}
diff --git a/1.x/trunk/ProcessHacker.Native/PropertySheet/ProcessPropertySheetPage.cs b/1.x/trunk/ProcessHacker.Native/PropertySheet/ProcessPropertySheetPage.cs
deleted file mode 100644
index 425d78117..000000000
--- a/1.x/trunk/ProcessHacker.Native/PropertySheet/ProcessPropertySheetPage.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Process Hacker -
- * Process Property Sheet Control
- *
- * Copyright (C) 2011 wj32
- * Copyright (C) 2011 dmex
- *
- * This file is part of Process Hacker.
- *
- * Process Hacker is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Process Hacker is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Process Hacker. If not, see .
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-using ProcessHacker.Native;
-using ProcessHacker.Native.Api;
-
-namespace ProcessHacker.Api
-{
- public class ProcessPropertySheetPage : PropertySheetPage
- {
- private IntPtr _pageHandle;
- private IntPtr _dialogTemplate;
- private readonly DialogProc _dialogProc;
- private readonly PropSheetPageCallback _pagePageProc;
-
- public ProcessPropertySheetPage()
- {
- _dialogProc = this.DialogProc;
- _pagePageProc = this.PropPageProc;
- }
-
- protected override void Dispose(bool disposing)
- {
- MemoryAlloc.PrivateHeap.Free(this._dialogTemplate);
-
- base.Dispose(disposing);
- }
-
- public override IntPtr CreatePageHandle()
- {
- if (_pageHandle != IntPtr.Zero)
- return _pageHandle;
-
- PropSheetPageW psp = new PropSheetPageW();
-
- // *Must* be 260x260. See PhAddPropPageLayoutItem in procprp.c.
- _dialogTemplate = CreateDialogTemplate(260, 260, this.Text, 8, "MS Shell Dlg");
-
- psp.dwSize = PropSheetPageW.SizeOf;
- psp.dwFlags = PropSheetPageFlags.UseCallback | PropSheetPageFlags.DlgIndirect | PropSheetPageFlags.UseTitle | PropSheetPageFlags.DlgIndirect;
-
- psp.pszTitle = Marshal.StringToHGlobalUni("Details");
-
- psp.pResource = _dialogTemplate;
-
- psp.pfnDlgProc = Marshal.GetFunctionPointerForDelegate(_dialogProc);
- psp.pfnCallback = Marshal.GetFunctionPointerForDelegate(_pagePageProc);
-
- _pageHandle = Win32.CreatePropertySheetPageW(ref psp);
-
- return _pageHandle;
- }
-
- protected override bool DialogProc(IntPtr hwndDlg, WindowMessage uMsg, IntPtr wParam, IntPtr lParam)
- {
- switch (uMsg)
- {
- case WindowMessage.InitDialog:
- {
- Rect initialSize = new Rect
- {
- Left = 0,
- Top = 0,
- Right = 260,
- Bottom = 260
- };
-
- Win32.MapDialogRect(hwndDlg, ref initialSize);
-
- this.Size = new System.Drawing.Size(initialSize.Right, initialSize.Bottom);
-
- this.Refresh();
- }
- break;
- }
-
- return base.DialogProc(hwndDlg, uMsg, wParam, lParam);
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker.Native/PropertySheet/PropertySheetPage.cs b/1.x/trunk/ProcessHacker.Native/PropertySheet/PropertySheetPage.cs
deleted file mode 100644
index 278b1a0d3..000000000
--- a/1.x/trunk/ProcessHacker.Native/PropertySheet/PropertySheetPage.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Process Hacker -
- * Property Sheet Control
- *
- * Copyright (C) 2010 wj32
- * Copyright (C) 2010 dmex
- *
- * This file is part of Process Hacker.
- *
- * Process Hacker is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Process Hacker is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Process Hacker. If not, see .
- */
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Windows.Forms;
-using ProcessHacker.Native;
-using ProcessHacker.Native.Api;
-
-namespace ProcessHacker.Api
-{
- public class PropertySheetPage : UserControl
- {
- private static readonly List _keepAliveList = new List();
-
- public unsafe static IntPtr CreateDialogTemplate(int width, int height, string title, short fontSize, string fontName)
- {
- DlgTemplate* template;
- int templateStructSize;
- int offset;
-
- templateStructSize = DlgTemplate.SizeOf;
- template = (DlgTemplate*)MemoryAlloc.PrivateHeap.Allocate(templateStructSize + 2 + 2 + (title.Length + 1) * 2 + 2 + (fontName.Length + 1) * 2);
- template->style = 0x40; // DS_SETFONT
- template->dwExtendedStyle = 0;
- template->cdit = 0;
- template->x = 0;
- template->y = 0;
- template->cx = (short)width;
- template->cy = (short)height;
-
- offset = templateStructSize;
-
- // No menu
- *(short*)((byte*)template + offset) = 0;
- offset += 2;
-
- // No class
- *(short*)((byte*)template + offset) = 0;
- offset += 2;
-
- // Title
- fixed (char* titlePtr = title)
- Win32.RtlMoveMemory((byte*)template + offset, titlePtr, (IntPtr)((title.Length + 1) * 2));
- offset += (title.Length + 1) * 2;
-
- // Font size
- *(short*)((byte*)template + offset) = fontSize;
- offset += 2;
-
- // Font name
- fixed (char* fontNamePtr = fontName)
- Win32.RtlMoveMemory((byte*)template + offset, fontNamePtr, (IntPtr)((fontName.Length + 1) * 2));
- //offset += (fontName.Length + 1) * 2;
-
- return (IntPtr)template;
- }
-
- public event EventHandler PageGotFocus;
- public event EventHandler PageLostFocus;
-
- private readonly IContainer components;
- private IntPtr _dialogWindowParentHandle;
-
- public PropertySheetPage()
- {
- components = new Container();
- this.AutoScaleMode = AutoScaleMode.Font;
- }
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
- public virtual IntPtr CreatePageHandle()
- {
- throw new NotImplementedException();
- }
-
- protected virtual bool DialogProc(IntPtr hwndDlg, WindowMessage uMsg, IntPtr wParam, IntPtr lParam)
- {
- switch (uMsg)
- {
- case WindowMessage.InitDialog:
- {
- _dialogWindowParentHandle = Win32.GetParent(hwndDlg);
- Win32.SetParent(this.Handle, hwndDlg);
-
- this.Refresh();
- }
- break;
- case WindowMessage.Notify:
- return OnDialogNotify(hwndDlg, wParam, lParam);
- }
-
- return false;
- }
-
- private unsafe bool OnDialogNotify(IntPtr hwndDlg, IntPtr wParam, IntPtr lParam)
- {
- Win32.NmHdr* hdr = (Win32.NmHdr*)lParam;
-
- if (hdr->hwndFrom != _dialogWindowParentHandle)
- return false;
-
- switch (hdr->code)
- {
- case (uint)PropSheetNotification.SetActive:
- if (this.PageGotFocus != null)
- this.PageGotFocus(this, new EventArgs());
- break;
- case (uint)PropSheetNotification.KillActive:
- if (this.PageLostFocus != null)
- this.PageLostFocus(this, new EventArgs());
- break;
- }
-
- return false;
- }
-
- protected int PropPageProc(IntPtr hwnd, PropSheetPageCallbackMessage uMsg, IntPtr ppsp)
- {
- switch (uMsg)
- {
- case PropSheetPageCallbackMessage.AddRef:
- _keepAliveList.Add(this);
- break;
- case PropSheetPageCallbackMessage.Release:
- _keepAliveList.Remove(this);
- break;
- }
-
- return 1;
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/Acl.cs b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/Acl.cs
index 02bdf0a97..cdc3b0bb0 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/Acl.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/Acl.cs
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
+using System.Runtime.InteropServices;
using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
@@ -39,10 +40,12 @@ namespace ProcessHacker.Native.Security.AccessControl
return acl.Memory;
}
- private readonly MemoryRegion _memory;
+ private MemoryRegion _memory;
public Acl(int size)
{
+ NtStatus status;
+
// Reserve 8 bytes for the ACL header.
if (size < 8)
throw new ArgumentException("Size must be greater than or equal to 8 bytes.");
@@ -51,11 +54,11 @@ namespace ProcessHacker.Native.Security.AccessControl
_memory = new MemoryAlloc(size);
// Initialize the ACL.
- if (Win32.RtlCreateAcl(
+ if ((status = Win32.RtlCreateAcl(
_memory,
size,
Win32.AclRevision
- ).IsError())
+ )) >= NtStatus.Error)
{
// Dispose memory and disable ownership.
_memory.Dispose();
@@ -137,61 +140,78 @@ namespace ProcessHacker.Native.Security.AccessControl
public void AddAccessAllowed(int accessMask, Sid sid)
{
- Win32.RtlAddAccessAllowedAce(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddAccessAllowedAce(
this,
Win32.AclRevision,
accessMask,
sid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddAccessAllowed(int accessMask, Sid sid, AceFlags flags)
{
- Win32.RtlAddAccessAllowedAceEx(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddAccessAllowedAceEx(
this,
Win32.AclRevision,
flags,
accessMask,
sid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddAccessDenied(int accessMask, Sid sid)
{
- Win32.RtlAddAccessDeniedAce(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddAccessDeniedAce(
this,
Win32.AclRevision,
accessMask,
sid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddAccessDenied(int accessMask, Sid sid, AceFlags flags)
{
- Win32.RtlAddAccessDeniedAceEx(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddAccessDeniedAceEx(
this,
Win32.AclRevision,
flags,
accessMask,
sid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddAuditAccess(int accessMask, Sid sid, bool auditSuccess, bool auditFailure)
{
- Win32.RtlAddAuditAccessAce(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddAuditAccessAce(
this,
Win32.AclRevision,
accessMask,
sid,
auditSuccess,
auditFailure
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddAuditAccess(int accessMask, Sid sid, bool auditSuccess, bool auditFailure, AceFlags flags)
{
- Win32.RtlAddAuditAccessAceEx(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddAuditAccessAceEx(
this,
Win32.AclRevision,
flags,
@@ -199,19 +219,23 @@ namespace ProcessHacker.Native.Security.AccessControl
sid,
auditSuccess,
auditFailure
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddCompound(AceType type, int accessMask, Sid serverSid, Sid clientSid)
{
- Win32.RtlAddCompoundAce(
+ NtStatus status;
+
+ if ((status = Win32.RtlAddCompoundAce(
this,
Win32.AclRevision,
type,
accessMask,
serverSid,
clientSid
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
public void AddRange(int index, IEnumerable aceList)
@@ -224,7 +248,7 @@ namespace ProcessHacker.Native.Security.AccessControl
totalSize += ace.Size;
}
- using (MemoryAlloc aceListMemory = new MemoryAlloc(totalSize))
+ using (var aceListMemory = new MemoryAlloc(totalSize))
{
int i = 0;
@@ -235,22 +259,27 @@ namespace ProcessHacker.Native.Security.AccessControl
i += ace.Size;
}
+ NtStatus status;
+
// Add the ACEs to the ACL.
- Win32.RtlAddAce(
+ if ((status = Win32.RtlAddAce(
this,
Win32.AclRevision,
index,
aceListMemory,
totalSize
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
public Ace GetAt(int index)
{
+ NtStatus status;
IntPtr ace;
- Win32.RtlGetAce(this, index, out ace).ThrowIf();
+ if ((status = Win32.RtlGetAce(this, index, out ace)) >= NtStatus.Error)
+ Win32.Throw(status);
return Ace.GetAce(ace);
}
@@ -268,21 +297,26 @@ namespace ProcessHacker.Native.Security.AccessControl
public AclSizeInformation GetSizeInformation()
{
+ NtStatus status;
AclSizeInformation sizeInfo;
- Win32.RtlQueryInformationAcl(
+ if ((status = Win32.RtlQueryInformationAcl(
this,
out sizeInfo,
- AclSizeInformation.SizeOf,
+ Marshal.SizeOf(typeof(AclSizeInformation)),
AclInformationClass.AclSizeInformation
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return sizeInfo;
}
public void RemoveAt(int index)
{
- Win32.RtlDeleteAce(this, index).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.RtlDeleteAce(this, index)) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/KnownAce.cs b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/KnownAce.cs
index c464cca2b..8b5c12192 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/KnownAce.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/KnownAce.cs
@@ -22,15 +22,19 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Security.AccessControl
{
- public sealed class KnownAce : Ace
+ public class KnownAce : Ace
{
private int _mask;
private Sid _sid;
+ protected KnownAce()
+ { }
+
public KnownAce(AceType type, AceFlags flags, int mask, Sid sid)
{
if (
@@ -42,25 +46,20 @@ namespace ProcessHacker.Native.Security.AccessControl
throw new ArgumentException("Invalid ACE type.");
this.MemoryRegion = new MemoryAlloc(
- KnownAceStruct.SizeOf - // known ace struct size
+ Marshal.SizeOf(typeof(KnownAceStruct)) - // known ace struct size
sizeof(int) + // minus SidStart field
sid.Length // plus SID length
);
- // Initialize the ACE (minus the SID).
- KnownAceStruct knownAce = new KnownAceStruct
- {
- Mask = mask,
- Header =
- {
- AceType = type,
- AceFlags = flags,
- AceSize = (ushort)this.MemoryRegion.Size
- }
- };
+ KnownAceStruct knownAce = new KnownAceStruct();
+ // Initialize the ACE (minus the SID).
+ knownAce.Header.AceType = type;
+ knownAce.Header.AceFlags = flags;
+ knownAce.Header.AceSize = (ushort)this.MemoryRegion.Size;
+ knownAce.Mask = mask;
// Write the ACE to memory.
- this.MemoryRegion.WriteStruct(knownAce);
+ this.MemoryRegion.WriteStruct(knownAce);
// Write the SID.
this.MemoryRegion.WriteMemory(Win32.KnownAceSidStartOffset.ToInt32(), sid, sid.Length);
// Update the cached info.
diff --git a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityDescriptor.cs b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityDescriptor.cs
index 3c45ab86a..116f03917 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityDescriptor.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityDescriptor.cs
@@ -40,11 +40,12 @@ namespace ProcessHacker.Native.Security.AccessControl
/// A security descriptor.
public static SecurityDescriptor GetSecurity(IntPtr handle, SecurityInformation securityInformation)
{
- using (MemoryAlloc data = new MemoryAlloc(0x100))
- {
- int retLength;
+ NtStatus status;
+ int retLength;
- NtStatus status = Win32.NtQuerySecurityObject(
+ using (var data = new MemoryAlloc(0x100))
+ {
+ status = Win32.NtQuerySecurityObject(
handle,
securityInformation,
data,
@@ -56,16 +57,17 @@ namespace ProcessHacker.Native.Security.AccessControl
{
data.ResizeNew(retLength);
- Win32.NtQuerySecurityObject(
+ status = Win32.NtQuerySecurityObject(
handle,
securityInformation,
data,
data.Size,
out retLength
- ).ThrowIf();
+ );
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return new SecurityDescriptor(data);
}
@@ -103,11 +105,14 @@ namespace ProcessHacker.Native.Security.AccessControl
/// The security descriptor.
public static void SetSecurity(IntPtr handle, SecurityInformation securityInformation, SecurityDescriptor securityDescriptor)
{
- Win32.NtSetSecurityObject(
+ NtStatus status;
+
+ if ((status = Win32.NtSetSecurityObject(
handle,
securityInformation,
securityDescriptor
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
///
@@ -125,13 +130,13 @@ namespace ProcessHacker.Native.Security.AccessControl
IntPtr owner = IntPtr.Zero;
IntPtr sacl = IntPtr.Zero;
- if (securityInformation.HasFlag(SecurityInformation.Dacl))
+ if ((securityInformation & SecurityInformation.Dacl) == SecurityInformation.Dacl)
dacl = securityDescriptor.Dacl ?? IntPtr.Zero;
- if (securityInformation.HasFlag(SecurityInformation.Group))
+ if ((securityInformation & SecurityInformation.Group) == SecurityInformation.Group)
group = securityDescriptor.Group;
- if (securityInformation.HasFlag(SecurityInformation.Owner))
+ if ((securityInformation & SecurityInformation.Owner) == SecurityInformation.Owner)
owner = securityDescriptor.Owner;
- if (securityInformation.HasFlag(SecurityInformation.Sacl))
+ if ((securityInformation & SecurityInformation.Sacl) == SecurityInformation.Sacl)
sacl = securityDescriptor.Sacl ?? IntPtr.Zero;
if ((result = Win32.SetSecurityInfo(
@@ -151,7 +156,7 @@ namespace ProcessHacker.Native.Security.AccessControl
return securityDescriptor.Memory;
}
- private readonly MemoryRegion _memory;
+ private MemoryRegion _memory;
private Acl _dacl;
private Acl _sacl;
private Sid _owner;
@@ -169,7 +174,7 @@ namespace ProcessHacker.Native.Security.AccessControl
if ((status = Win32.RtlCreateSecurityDescriptor(
_memory,
Win32.SecurityDescriptorRevision
- )).IsError())
+ )) >= NtStatus.Error)
{
_memory.Dispose();
_memory = null;
@@ -229,24 +234,29 @@ namespace ProcessHacker.Native.Security.AccessControl
{
get
{
+ NtStatus status;
SecurityDescriptorControlFlags control;
int revision;
- Win32.RtlGetControlSecurityDescriptor(
+ if ((status = Win32.RtlGetControlSecurityDescriptor(
this,
out control,
out revision
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return control;
}
set
{
- Win32.RtlSetControlSecurityDescriptor(
+ NtStatus status;
+
+ if ((status = Win32.RtlSetControlSecurityDescriptor(
this,
value,
value
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
}
}
@@ -258,12 +268,15 @@ namespace ProcessHacker.Native.Security.AccessControl
get { return _dacl; }
set
{
- Win32.RtlSetDaclSecurityDescriptor(
+ NtStatus status;
+
+ if ((status = Win32.RtlSetDaclSecurityDescriptor(
this,
value != null,
value ?? IntPtr.Zero,
false
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.SwapDacl(value);
}
@@ -274,7 +287,11 @@ namespace ProcessHacker.Native.Security.AccessControl
///
public bool DaclDefaulted
{
- get { return this.ControlFlags.HasFlag(SecurityDescriptorControlFlags.DaclDefaulted); }
+ get
+ {
+ return (this.ControlFlags & SecurityDescriptorControlFlags.DaclDefaulted) ==
+ SecurityDescriptorControlFlags.DaclDefaulted;
+ }
set
{
if (value)
@@ -292,11 +309,14 @@ namespace ProcessHacker.Native.Security.AccessControl
get { return _group; }
set
{
- Win32.RtlSetGroupSecurityDescriptor(
+ NtStatus status;
+
+ if ((status = Win32.RtlSetGroupSecurityDescriptor(
this,
value,
false
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.SwapGroup(value);
}
@@ -307,7 +327,11 @@ namespace ProcessHacker.Native.Security.AccessControl
///
public bool GroupDefaulted
{
- get { return this.ControlFlags.HasFlag(SecurityDescriptorControlFlags.GroupDefaulted); }
+ get
+ {
+ return (this.ControlFlags & SecurityDescriptorControlFlags.GroupDefaulted) ==
+ SecurityDescriptorControlFlags.GroupDefaulted;
+ }
set
{
if (value)
@@ -341,11 +365,14 @@ namespace ProcessHacker.Native.Security.AccessControl
get { return _owner; }
set
{
- Win32.RtlSetOwnerSecurityDescriptor(
+ NtStatus status;
+
+ if ((status = Win32.RtlSetOwnerSecurityDescriptor(
this,
value,
false
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.SwapOwner(value);
}
@@ -378,12 +405,15 @@ namespace ProcessHacker.Native.Security.AccessControl
get { return _sacl; }
set
{
- Win32.RtlSetSaclSecurityDescriptor(
+ NtStatus status;
+
+ if ((status = Win32.RtlSetSaclSecurityDescriptor(
this,
value != null,
value ?? IntPtr.Zero,
false
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
this.SwapSacl(value);
}
@@ -394,7 +424,11 @@ namespace ProcessHacker.Native.Security.AccessControl
///
public bool SaclDefaulted
{
- get { return this.ControlFlags.HasFlag(SecurityDescriptorControlFlags.SaclDefaulted); }
+ get
+ {
+ return (this.ControlFlags & SecurityDescriptorControlFlags.SaclDefaulted) ==
+ SecurityDescriptorControlFlags.SaclDefaulted;
+ }
set
{
if (value)
@@ -409,7 +443,11 @@ namespace ProcessHacker.Native.Security.AccessControl
///
public bool SelfRelative
{
- get { return this.ControlFlags.HasFlag(SecurityDescriptorControlFlags.SelfRelative); }
+ get
+ {
+ return (this.ControlFlags & SecurityDescriptorControlFlags.SelfRelative) ==
+ SecurityDescriptorControlFlags.SelfRelative;
+ }
}
///
@@ -422,10 +460,11 @@ namespace ProcessHacker.Native.Security.AccessControl
/// Success if access was granted, otherwise another NT status value.
public NtStatus CheckAccess(TokenHandle tokenHandle, int desiredAccess, GenericMapping genericMapping, out int grantedAccess)
{
+ NtStatus status;
NtStatus accessStatus;
int privilegeSetLength = 0;
- Win32.NtAccessCheck(
+ if ((status = Win32.NtAccessCheck(
this,
tokenHandle,
desiredAccess,
@@ -434,7 +473,8 @@ namespace ProcessHacker.Native.Security.AccessControl
ref privilegeSetLength,
out grantedAccess,
out accessStatus
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return accessStatus;
}
@@ -443,23 +483,25 @@ namespace ProcessHacker.Native.Security.AccessControl
/// Checks whether the security descriptor is valid.
///
/// True if the security descriptor is valid, otherwise false.
- public bool IsValid
+ public bool IsValid()
{
- get { return Win32.RtlValidSecurityDescriptor(this); }
+ return Win32.RtlValidSecurityDescriptor(this);
}
private void Read()
{
+ NtStatus status;
bool present, defaulted;
IntPtr dacl, group, owner, sacl;
// Read the DACL.
- Win32.RtlGetDaclSecurityDescriptor(
+ if ((status = Win32.RtlGetDaclSecurityDescriptor(
this,
out present,
out dacl,
out defaulted
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (present && dacl != IntPtr.Zero)
this.SwapDacl(new Acl(Acl.FromPointer(dacl)));
@@ -467,12 +509,13 @@ namespace ProcessHacker.Native.Security.AccessControl
this.SwapDacl(null);
// Read the SACL.
- Win32.RtlGetSaclSecurityDescriptor(
+ if ((status = Win32.RtlGetSaclSecurityDescriptor(
this,
out present,
out sacl,
out defaulted
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (present && sacl != IntPtr.Zero)
this.SwapSacl(new Acl(Acl.FromPointer(sacl)));
@@ -480,11 +523,12 @@ namespace ProcessHacker.Native.Security.AccessControl
this.SwapSacl(null);
// Read the group.
- Win32.RtlGetGroupSecurityDescriptor(
+ if ((status = Win32.RtlGetGroupSecurityDescriptor(
this,
out group,
out defaulted
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (group != IntPtr.Zero)
this.SwapGroup(new Sid(group));
@@ -492,11 +536,12 @@ namespace ProcessHacker.Native.Security.AccessControl
this.SwapGroup(null);
// Read the owner.
- Win32.RtlGetOwnerSecurityDescriptor(
+ if ((status = Win32.RtlGetOwnerSecurityDescriptor(
this,
out owner,
out defaulted
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
if (owner != IntPtr.Zero)
this.SwapOwner(new Sid(owner));
@@ -506,22 +551,22 @@ namespace ProcessHacker.Native.Security.AccessControl
private void SwapDacl(Acl dacl)
{
- BaseObject.SwapRef(ref _dacl, dacl);
+ BaseObject.SwapRef(ref _dacl, dacl);
}
private void SwapGroup(Sid group)
{
- BaseObject.SwapRef(ref _group, group);
+ BaseObject.SwapRef(ref _group, group);
}
private void SwapOwner(Sid owner)
{
- BaseObject.SwapRef(ref _owner, owner);
+ BaseObject.SwapRef(ref _owner, owner);
}
private void SwapSacl(Acl sacl)
{
- BaseObject.SwapRef(ref _sacl, sacl);
+ BaseObject.SwapRef(ref _sacl, sacl);
}
///
@@ -530,11 +575,13 @@ namespace ProcessHacker.Native.Security.AccessControl
/// A new self-relative security descriptor.
public SecurityDescriptor ToSelfRelative()
{
- using (MemoryAlloc data = new MemoryAlloc(Win32.SecurityDescriptorMinLength))
- {
- int retLength = data.Size;
+ NtStatus status;
+ int retLength;
- NtStatus status = Win32.RtlMakeSelfRelativeSD(this, data, ref retLength);
+ using (var data = new MemoryAlloc(Win32.SecurityDescriptorMinLength))
+ {
+ retLength = data.Size;
+ status = Win32.RtlMakeSelfRelativeSD(this, data, ref retLength);
if (status == NtStatus.BufferTooSmall)
{
@@ -542,7 +589,8 @@ namespace ProcessHacker.Native.Security.AccessControl
status = Win32.RtlMakeSelfRelativeSD(this, data, ref retLength);
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return new SecurityDescriptor(data);
}
diff --git a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityEditor.cs b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityEditor.cs
index f63653404..a2c609d3b 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityEditor.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/AccessControl/SecurityEditor.cs
@@ -22,9 +22,11 @@
using System;
using System.Collections.Generic;
+using System.Runtime.InteropServices;
using System.Windows.Forms;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
+using ProcessHacker.Native.Security.AccessControl;
namespace ProcessHacker.Native.Security.AccessControl
{
@@ -32,7 +34,7 @@ namespace ProcessHacker.Native.Security.AccessControl
{
private class SecurableObjectWrapper : ISecurable
{
- private readonly Func _openMethod;
+ private Func _openMethod;
public SecurableObjectWrapper(Func openMethod)
{
@@ -63,8 +65,8 @@ namespace ProcessHacker.Native.Security.AccessControl
private class SeSecurableObjectWrapper : ISecurable
{
- private readonly SeObjectType _objectType;
- private readonly Func _openMethod;
+ private SeObjectType _objectType;
+ private Func _openMethod;
public SeSecurableObjectWrapper(SeObjectType objectType, Func openMethod)
{
@@ -96,24 +98,18 @@ namespace ProcessHacker.Native.Security.AccessControl
public static void EditSecurity(IWin32Window owner, ISecurable securable, string name, IEnumerable accessEntries)
{
- using (SecurityEditor osi = new SecurityEditor(securable, name, accessEntries))
+ using (var osi = new SecurityEditor(securable, name, accessEntries))
Win32.EditSecurity(owner != null ? owner.Handle : IntPtr.Zero, osi);
}
-
- public static SecurityEditor EditSecurity2(IWin32Window owner, ISecurable securable, string name, IEnumerable accessEntries)
- {
- return new SecurityEditor(securable, name, accessEntries);
- }
-
public static ISecurable GetSecurableWrapper(IntPtr handle)
{
- return GetSecurableWrapper(access => new NativeHandle(handle, access));
+ return GetSecurableWrapper((access) => new NativeHandle(handle, access));
}
public static ISecurable GetSecurableWrapper(SeObjectType objectType, IntPtr handle)
{
- return GetSecurableWrapper(objectType, access => new NativeHandle(handle, access));
+ return GetSecurableWrapper(objectType, (access) => new NativeHandle(handle, access));
}
public static ISecurable GetSecurableWrapper(Func openMethod)
@@ -126,25 +122,27 @@ namespace ProcessHacker.Native.Security.AccessControl
return new SeSecurableObjectWrapper(objectType, openMethod);
}
- private bool _disposed;
- private readonly ISecurable _securable;
- private readonly List _pool = new List();
- private readonly string _name;
- private readonly MemoryAlloc _accessRights;
- private readonly int _accessRightCount;
+ private bool _disposed = false;
+ private ISecurable _securable;
+ private List _pool = new List();
+ private string _name;
+ private MemoryAlloc _accessRights;
+ private int _accessRightCount;
internal SecurityEditor(ISecurable securable, string name, IEnumerable accessEntries)
{
+ List accesses;
+
_securable = securable;
_name = name;
- List accesses = new List();
+ accesses = new List();
- foreach (AccessEntry entry in accessEntries)
+ foreach (var entry in accessEntries)
{
if (entry.Mask != 0)
{
- accesses.Add(new SiAccess
+ accesses.Add(new SiAccess()
{
Guid = IntPtr.Zero,
Mask = entry.Mask,
@@ -154,7 +152,7 @@ namespace ProcessHacker.Native.Security.AccessControl
}
}
- _accessRights = this.AllocateStructArray(SiAccess.SizeOf, accesses.ToArray());
+ _accessRights = this.AllocateStructArray(accesses.ToArray());
_accessRightCount = accesses.Count;
}
@@ -162,7 +160,7 @@ namespace ProcessHacker.Native.Security.AccessControl
{
if (!_disposed)
{
- _pool.ForEach(alloc => alloc.Dispose());
+ _pool.ForEach((alloc) => alloc.Dispose());
_pool.Clear();
_disposed = true;
}
@@ -202,37 +200,39 @@ namespace ProcessHacker.Native.Security.AccessControl
return m;
}
- private MemoryAlloc AllocateStruct(int size, T value) where T : struct
+ private MemoryAlloc AllocateStruct(T value)
+ where T : struct
{
- MemoryAlloc alloc = new MemoryAlloc(size);
+ MemoryAlloc alloc = new MemoryAlloc(Marshal.SizeOf(typeof(T)));
- alloc.WriteStruct(0, size, value);
+ alloc.WriteStruct(0, value);
return alloc;
}
- private MemoryAlloc AllocateStructFromPool(int size, T value)
+ private MemoryAlloc AllocateStructFromPool(T value)
where T : struct
{
- MemoryAlloc m = this.AllocateStruct(size, value);
+ MemoryAlloc m = this.AllocateStruct(value);
_pool.Add(m);
return m;
}
- private MemoryAlloc AllocateStructArray(int size, T[] value) where T : struct
+ private MemoryAlloc AllocateStructArray(T[] value)
+ where T : struct
{
- MemoryAlloc alloc = new MemoryAlloc(size * value.Length);
+ MemoryAlloc alloc = new MemoryAlloc(Marshal.SizeOf(typeof(T)) * value.Length);
for (int i = 0; i < value.Length; i++)
- alloc.WriteStruct(i, size, value[i]);
+ alloc.WriteStruct(i, value[i]);
return alloc;
}
- private MemoryAlloc AllocateStructArrayFromPool(int size, T[] value)
+ private MemoryAlloc AllocateStructArrayFromPool(T[] value)
where T : struct
{
- MemoryAlloc m = this.AllocateStructArray(size, value);
+ MemoryAlloc m = this.AllocateStructArray(value);
_pool.Add(m);
return m;
}
@@ -241,18 +241,17 @@ namespace ProcessHacker.Native.Security.AccessControl
public HResult GetObjectInformation(out SiObjectInfo ObjectInfo)
{
- SiObjectInfo soi = new SiObjectInfo
- {
- Flags = SiObjectInfoFlags.EditAudits |
- SiObjectInfoFlags.EditOwner |
- SiObjectInfoFlags.EditPerms |
- SiObjectInfoFlags.Advanced |
- SiObjectInfoFlags.NoAclProtect |
- SiObjectInfoFlags.NoTreeApply,
- Instance = IntPtr.Zero,
- ObjectName = this.AllocateStringFromPool(this._name)
- };
+ SiObjectInfo soi = new SiObjectInfo();
+ soi.Flags =
+ SiObjectInfoFlags.EditAudits |
+ SiObjectInfoFlags.EditOwner |
+ SiObjectInfoFlags.EditPerms |
+ SiObjectInfoFlags.Advanced |
+ SiObjectInfoFlags.NoAclProtect |
+ SiObjectInfoFlags.NoTreeApply;
+ soi.Instance = IntPtr.Zero;
+ soi.ObjectName = this.AllocateStringFromPool(_name);
ObjectInfo = soi;
return HResult.OK;
@@ -262,12 +261,12 @@ namespace ProcessHacker.Native.Security.AccessControl
{
try
{
- using (SecurityDescriptor sd = _securable.GetSecurity(RequestedInformation))
+ using (var sd = _securable.GetSecurity(RequestedInformation))
{
// Since the ACL editor will free the security descriptor using
// LocalFree, we need to use a local memory allocation and copy
// the security descriptor into it.
- using (LocalMemoryAlloc localAlloc = new LocalMemoryAlloc(sd.Length))
+ using (var localAlloc = new LocalMemoryAlloc(sd.Length))
{
localAlloc.WriteMemory(0, sd.Memory, sd.Length);
localAlloc.Reference(); // reference for ACL editor
@@ -334,10 +333,10 @@ namespace ProcessHacker.Native.Security.AccessControl
public struct AccessEntry
{
- private readonly bool _general;
- private readonly int _mask;
- private readonly string _name;
- private readonly bool _specific;
+ private bool _general;
+ private int _mask;
+ private string _name;
+ private bool _specific;
public AccessEntry(string name, object mask, bool general, bool specific)
{
diff --git a/1.x/trunk/ProcessHacker.Native/Security/Authentication/Credentials.cs b/1.x/trunk/ProcessHacker.Native/Security/Authentication/Credentials.cs
index f00eb2973..55cbfbc3f 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/Authentication/Credentials.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/Authentication/Credentials.cs
@@ -33,10 +33,10 @@ namespace ProcessHacker.Native.Security.Authentication
MemoryAlloc data = new MemoryAlloc(0x100);
int size = data.Size;
- if (string.IsNullOrEmpty(userName))
- userName = string.Empty;
- if (string.IsNullOrEmpty(password))
- password = string.Empty;
+ if (userName == null)
+ userName = "";
+ if (password == null)
+ password = "";
if (!Win32.CredPackAuthenticationBuffer(flags, userName, password, data, ref size))
{
@@ -57,9 +57,9 @@ namespace ProcessHacker.Native.Security.Authentication
out string password
)
{
- using (MemoryAlloc domainNameBuffer = new MemoryAlloc(0x100))
- using (MemoryAlloc userNameBuffer = new MemoryAlloc(0x100))
- using (MemoryAlloc passwordBuffer = new MemoryAlloc(0x100))
+ using (var domainNameBuffer = new MemoryAlloc(0x100))
+ using (var userNameBuffer = new MemoryAlloc(0x100))
+ using (var passwordBuffer = new MemoryAlloc(0x100))
{
int domainNameSize = domainNameBuffer.Size / 2 - 1;
int userNameSize = userNameBuffer.Size / 2 - 1;
@@ -122,13 +122,13 @@ namespace ProcessHacker.Native.Security.Authentication
if (userName.Length > maxChars || password.Length > maxChars)
throw new ArgumentException("The user name or password string is too long.");
- info.Size = CredUiInfo.SizeOf;
+ info.Size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(CredUiInfo));
info.Parent = parent != null ? parent.Handle : IntPtr.Zero;
info.MessageText = messageText;
info.CaptionText = captionText;
- using (MemoryAlloc userNameAlloc = new MemoryAlloc(maxBytes))
- using (MemoryAlloc passwordAlloc = new MemoryAlloc(maxBytes))
+ using (var userNameAlloc = new MemoryAlloc(maxBytes))
+ using (var passwordAlloc = new MemoryAlloc(maxBytes))
{
userNameAlloc.WriteUnicodeString(0, userName);
userNameAlloc.WriteInt16(userName.Length * 2, 0);
@@ -178,12 +178,12 @@ namespace ProcessHacker.Native.Security.Authentication
IntPtr outAuthBuffer;
int outAuthBufferSize;
- info.Size = CredUiInfo.SizeOf;
+ info.Size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(CredUiInfo));
info.Parent = parent != null ? parent.Handle : IntPtr.Zero;
info.MessageText = messageText;
info.CaptionText = captionText;
- using (MemoryRegion inAuthBuffer = PackCredentials(0, userName, password))
+ using (var inAuthBuffer = PackCredentials(0, userName, password))
{
result = Win32.CredUIPromptForWindowsCredentials(
ref info,
@@ -223,10 +223,11 @@ namespace ProcessHacker.Native.Security.Authentication
public static SecPkgInfo[] GetSSPackages()
{
+ int result;
int count;
IntPtr packages;
- int result = Win32.EnumerateSecurityPackages(out count, out packages);
+ result = Win32.EnumerateSecurityPackages(out count, out packages);
if (result != 0)
Win32.Throw(result);
@@ -238,7 +239,7 @@ namespace ProcessHacker.Native.Security.Authentication
SecPkgInfo[] array = new SecPkgInfo[count];
for (int i = 0; i < count; i++)
- array[i] = alloc.ReadStruct(0, SecPkgInfo.SizeOf, i);
+ array[i] = alloc.ReadStruct(i);
return array;
}
diff --git a/1.x/trunk/ProcessHacker.Native/Security/Authentication/Msv1_0_InteractivePackage.cs b/1.x/trunk/ProcessHacker.Native/Security/Authentication/Msv1_0_InteractivePackage.cs
index 1cd2595cb..ae0e2e3f6 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/Authentication/Msv1_0_InteractivePackage.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/Authentication/Msv1_0_InteractivePackage.cs
@@ -20,6 +20,9 @@
* along with Process Hacker. If not, see .
*/
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Security.Authentication
@@ -77,24 +80,27 @@ namespace ProcessHacker.Native.Security.Authentication
public MemoryRegion GetAuthData()
{
- string lDomainName = !string.IsNullOrEmpty(_domainName) ? _domainName : string.Empty;
- string lUserName = !string.IsNullOrEmpty(_userName) ? _userName : string.Empty;
- string lPassword = !string.IsNullOrEmpty(_password) ? _password : string.Empty;
+ MemoryAlloc data;
+ int dataSize;
+ int domainNameOffset;
+ int userNameOffset;
+ int passwordOffset;
+ string lDomainName = _domainName != null ? _domainName : "";
+ string lUserName = _userName != null ? _userName : "";
+ string lPassword = _password != null ? _password : "";
// The structure plus the strings must be stored in the same buffer,
// so we have to do some computation.
- int domainNameOffset = Msv1_0_InteractiveLogon.SizeOf;
- int userNameOffset = domainNameOffset + lDomainName.Length * 2;
- int passwordOffset = userNameOffset + lUserName.Length * 2;
- int dataSize = passwordOffset + lPassword.Length * 2;
+ domainNameOffset = Marshal.SizeOf(typeof(Msv1_0_InteractiveLogon));
+ userNameOffset = domainNameOffset + lDomainName.Length * 2;
+ passwordOffset = userNameOffset + lUserName.Length * 2;
+ dataSize = passwordOffset + lPassword.Length * 2;
+ data = new MemoryAlloc(dataSize);
- MemoryAlloc data = new MemoryAlloc(dataSize);
+ Msv1_0_InteractiveLogon info = new Msv1_0_InteractiveLogon();
- Msv1_0_InteractiveLogon info = new Msv1_0_InteractiveLogon
- {
- MessageType = Msv1_0_LogonSubmitType.Interactive
- };
+ info.MessageType = Msv1_0_LogonSubmitType.Interactive;
info.LogonDomainName.MaximumLength = info.LogonDomainName.Length = (ushort)(lDomainName.Length * 2);
info.LogonDomainName.Buffer = data.Memory.Increment(domainNameOffset);
@@ -108,7 +114,7 @@ namespace ProcessHacker.Native.Security.Authentication
info.Password.Buffer = data.Memory.Increment(passwordOffset);
data.WriteUnicodeString(passwordOffset, lPassword);
- data.WriteStruct(info);
+ data.WriteStruct(info);
return data;
}
@@ -130,9 +136,9 @@ namespace ProcessHacker.Native.Security.Authentication
if (info.Password.Buffer.CompareTo(buffer.Size) < 0)
info.Password.Buffer = info.Password.Buffer.Increment(buffer);
- _domainName = info.LogonDomainName.Text;
- _userName = info.UserName.Text;
- _password = info.Password.Text;
+ _domainName = info.LogonDomainName.Read();
+ _userName = info.UserName.Read();
+ _password = info.Password.Read();
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/Security/DesktopAccess.cs b/1.x/trunk/ProcessHacker.Native/Security/DesktopAccess.cs
index 09c6e1eb5..e6268edbc 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/DesktopAccess.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/DesktopAccess.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Native.Security
{
diff --git a/1.x/trunk/ProcessHacker.Native/Security/EnlistmentAccess.cs b/1.x/trunk/ProcessHacker.Native/Security/EnlistmentAccess.cs
index d3d12c451..061fd1f79 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/EnlistmentAccess.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/EnlistmentAccess.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Native.Security
{
diff --git a/1.x/trunk/ProcessHacker.Native/Security/ISecurable.cs b/1.x/trunk/ProcessHacker.Native/Security/ISecurable.cs
index 552104ede..1c28e4ad1 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/ISecurable.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/ISecurable.cs
@@ -1,4 +1,7 @@
-using ProcessHacker.Native.Api;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Native.Api;
using ProcessHacker.Native.Security.AccessControl;
namespace ProcessHacker.Native.Security
diff --git a/1.x/trunk/ProcessHacker.Native/Security/IoCompletionAccess.cs b/1.x/trunk/ProcessHacker.Native/Security/IoCompletionAccess.cs
index ba9646428..dc10c1ee0 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/IoCompletionAccess.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/IoCompletionAccess.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Native.Security
{
diff --git a/1.x/trunk/ProcessHacker.Native/Security/Privilege.cs b/1.x/trunk/ProcessHacker.Native/Security/Privilege.cs
index c3fc71857..3b15299b3 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/Privilege.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/Privilege.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Text;
using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
@@ -44,8 +45,8 @@ namespace ProcessHacker.Native.Security
}
}
- private readonly TokenHandle _tokenHandle;
- private readonly Luid _luid;
+ private TokenHandle _tokenHandle;
+ private Luid _luid;
private SePrivilegeAttributes _attributes;
private string _name;
private string _displayName;
@@ -121,7 +122,8 @@ namespace ProcessHacker.Native.Security
{
get
{
- return (_attributes & SePrivilegeAttributes.Disabled)!= SePrivilegeAttributes.Disabled;
+ return (_attributes & SePrivilegeAttributes.Disabled)
+ != SePrivilegeAttributes.Disabled;
}
set
{
@@ -133,7 +135,7 @@ namespace ProcessHacker.Native.Security
{
get
{
- if (string.IsNullOrEmpty(_displayName))
+ if (_displayName == null)
{
_displayName = LsaPolicyHandle.LookupPolicyHandle.LookupPrivilegeDisplayName(this.Name);
}
@@ -177,7 +179,7 @@ namespace ProcessHacker.Native.Security
{
get
{
- if (string.IsNullOrEmpty(_name))
+ if (_name == null)
{
_name = LsaPolicyHandle.LookupPolicyHandle.LookupPrivilegeName(_luid);
}
@@ -262,7 +264,7 @@ namespace ProcessHacker.Native.Security
public LuidAndAttributes ToLuidAndAttributes()
{
- return new LuidAndAttributes
+ return new LuidAndAttributes()
{
Attributes = _attributes,
Luid = _luid
diff --git a/1.x/trunk/ProcessHacker.Native/Security/PrivilegeSet.cs b/1.x/trunk/ProcessHacker.Native/Security/PrivilegeSet.cs
index f32ed2ae0..01c18e857 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/PrivilegeSet.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/PrivilegeSet.cs
@@ -22,14 +22,16 @@
using System;
using System.Collections.Generic;
-
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.Security
{
public sealed class PrivilegeSet : IList
{
- private readonly List _privileges;
+ private static int _sizeOfLaa = Marshal.SizeOf(typeof(LuidAndAttributes));
+
+ private List _privileges;
private PrivilegeSetFlags _flags;
public PrivilegeSet()
@@ -61,7 +63,7 @@ namespace ProcessHacker.Native.Security
for (int i = 0; i < privilegeSet.Count; i++)
{
- _privileges.Add(new Privilege(memoryRegion.ReadStruct(PrivilegeSetStruct.PrivilegesOffset, LuidAndAttributes.SizeOf, i)));
+ _privileges.Add(new Privilege(memoryRegion.ReadStruct(PrivilegeSetStruct.PrivilegesOffset, i)));
}
}
@@ -73,24 +75,25 @@ namespace ProcessHacker.Native.Security
public MemoryAlloc ToMemory()
{
- int requiredSize = 8 + LuidAndAttributes.SizeOf * _privileges.Count;
+ int requiredSize = 8 + _sizeOfLaa * _privileges.Count;
MemoryAlloc memory = new MemoryAlloc(requiredSize);
memory.WriteInt32(0, _privileges.Count);
memory.WriteInt32(4, (int)_flags);
for (int i = 0; i < _privileges.Count; i++)
- memory.WriteStruct(8, LuidAndAttributes.SizeOf, i, _privileges[i].ToLuidAndAttributes());
+ memory.WriteStruct(8, i, _privileges[i].ToLuidAndAttributes());
return memory;
}
public TokenPrivileges ToTokenPrivileges()
{
- return new TokenPrivileges
+ return new TokenPrivileges()
{
PrivilegeCount = _privileges.Count,
- Privileges = _privileges.ConvertAll(privilege => privilege.ToLuidAndAttributes()).ToArray()
+ Privileges = _privileges.ConvertAll(
+ (privilege) => privilege.ToLuidAndAttributes()).ToArray()
};
}
diff --git a/1.x/trunk/ProcessHacker.Native/Security/Sid.cs b/1.x/trunk/ProcessHacker.Native/Security/Sid.cs
index 76dfe500f..b3fdc29a3 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/Sid.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/Sid.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Text;
using ProcessHacker.Common;
using ProcessHacker.Common.Objects;
using ProcessHacker.Native.Api;
@@ -51,7 +52,7 @@ namespace ProcessHacker.Native.Security
if (currentUser == null)
{
using (var thandle = TokenHandle.OpenCurrentPrimary(TokenAccess.Query))
- _currentUser = currentUser = thandle.User;
+ _currentUser = currentUser = thandle.GetUser();
}
return currentUser;
@@ -119,8 +120,8 @@ namespace ProcessHacker.Native.Security
if (copy)
return array.Duplicate();
-
- return array;
+ else
+ return array;
}
public static implicit operator IntPtr(Sid sid)
@@ -128,10 +129,10 @@ namespace ProcessHacker.Native.Security
return sid.Memory;
}
- private readonly MemoryRegion _memory;
- private readonly string _systemName;
- private readonly bool _hasAttributes;
- private readonly SidAttributes _attributes;
+ private MemoryRegion _memory;
+ private string _systemName;
+ private bool _hasAttributes;
+ private SidAttributes _attributes;
private string _stringSid;
private string _domain;
@@ -214,9 +215,12 @@ namespace ProcessHacker.Native.Security
private Sid(IntPtr sid, bool hasAttributes, SidAttributes attributes, string systemName)
{
+ NtStatus status;
+
_memory = new MemoryAlloc(Win32.RtlLengthSid(sid));
- Win32.RtlCopySid(_memory.Size, _memory, sid).ThrowIf();
+ if ((status = Win32.RtlCopySid(_memory.Size, _memory, sid)) >= NtStatus.Error)
+ Win32.Throw(status);
_hasAttributes = hasAttributes;
_attributes = attributes;
@@ -243,9 +247,15 @@ namespace ProcessHacker.Native.Security
}
}
- public unsafe byte[] IdentifierAuthority
+ public byte[] IdentifierAuthority
{
- get { return Utils.Create((*Win32.RtlIdentifierAuthoritySid(this)).Value, 6); }
+ get
+ {
+ unsafe
+ {
+ return Utils.Create((*Win32.RtlIdentifierAuthoritySid(this)).Value, 6);
+ }
+ }
}
public bool HasAttributes
@@ -267,9 +277,8 @@ namespace ProcessHacker.Native.Security
{
get
{
- if (string.IsNullOrEmpty(_name))
+ if (_name == null)
this.GetNameAndUse(out _domain, out _name, out _nameUse);
-
return _name;
}
}
@@ -280,22 +289,24 @@ namespace ProcessHacker.Native.Security
{
if (_nameUse == 0)
this.GetNameAndUse(out _domain, out _name, out _nameUse);
-
return _nameUse;
}
}
- public unsafe int[] SubAuthorities
+ public int[] SubAuthorities
{
get
{
- byte count = *Win32.RtlSubAuthorityCountSid(this);
- int[] subAuthorities = new int[count];
+ unsafe
+ {
+ byte count = *Win32.RtlSubAuthorityCountSid(this);
+ int[] subAuthorities = new int[count];
- for (int i = 0; i < count; i++)
- subAuthorities[i] = *Win32.RtlSubAuthoritySid(this, i);
+ for (int i = 0; i < count; i++)
+ subAuthorities[i] = *Win32.RtlSubAuthoritySid(this, i);
- return subAuthorities;
+ return subAuthorities;
+ }
}
}
@@ -303,9 +314,8 @@ namespace ProcessHacker.Native.Security
{
get
{
- if (string.IsNullOrEmpty(_stringSid))
- _stringSid = this.String;
-
+ if (_stringSid == null)
+ _stringSid = this.GetString();
return _stringSid;
}
}
@@ -344,8 +354,8 @@ namespace ProcessHacker.Native.Security
if (includeDomain && !string.IsNullOrEmpty(this.DomainName))
return this.DomainName + "\\" + this.Name;
-
- return this.Name;
+ else
+ return this.Name;
}
catch
{
@@ -359,7 +369,7 @@ namespace ProcessHacker.Native.Security
byte[] identifierAuthority = this.IdentifierAuthority;
int[] subAuthorities = this.SubAuthorities;
- foreach (int t in subAuthorities)
+ for (int i = 0; i < subAuthorities.Length; i++)
{
hashCode ^= identifierAuthority[(uint)hashCode % identifierAuthority.Length];
// Reverse and XOR.
@@ -379,7 +389,8 @@ namespace ProcessHacker.Native.Security
{
byte[] identifierAuthority = this.IdentifierAuthority;
- foreach (WellKnownSidIdentifierAuthority value in Enum.GetValues(typeof(WellKnownSidIdentifierAuthority)))
+ foreach (WellKnownSidIdentifierAuthority value in
+ Enum.GetValues(typeof(WellKnownSidIdentifierAuthority)))
{
if (value == WellKnownSidIdentifierAuthority.None)
continue;
@@ -391,19 +402,16 @@ namespace ProcessHacker.Native.Security
return WellKnownSidIdentifierAuthority.None;
}
- private string String
+ private string GetString()
{
- get
- {
- UnicodeString str = new UnicodeString();
+ NtStatus status;
+ UnicodeString str = new UnicodeString();
- Win32.RtlConvertSidToUnicodeString(ref str, this, true).ThrowIf();
+ if ((status = Win32.RtlConvertSidToUnicodeString(ref str, this, true)) >= NtStatus.Error)
+ Win32.Throw(status);
- using (str)
- {
- return str.Text;
- }
- }
+ using (str)
+ return str.Read();
}
public bool IsValid()
@@ -418,7 +426,7 @@ namespace ProcessHacker.Native.Security
public SidAndAttributes ToSidAndAttributes()
{
- return new SidAndAttributes
+ return new SidAndAttributes()
{
Attributes = _attributes,
Sid = this
diff --git a/1.x/trunk/ProcessHacker.Native/Security/TransactionAccess.cs b/1.x/trunk/ProcessHacker.Native/Security/TransactionAccess.cs
index bcf99cbff..870a38b8c 100644
--- a/1.x/trunk/ProcessHacker.Native/Security/TransactionAccess.cs
+++ b/1.x/trunk/ProcessHacker.Native/Security/TransactionAccess.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Text;
namespace ProcessHacker.Native.Security
{
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/FilterType.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/FilterType.cs
index 17a32f6e0..111c53720 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/FilterType.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/FilterType.cs
@@ -1,4 +1,8 @@
-namespace ProcessHacker.Native.SsLogging
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Native.SsLogging
{
public enum FilterType
{
@@ -12,8 +16,8 @@
{
if (filterType == FilterType.Include)
return KphSsFilterType.Include;
-
- return KphSsFilterType.Exclude;
+ else
+ return KphSsFilterType.Exclude;
}
}
}
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/KphTypes.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/KphTypes.cs
index 1e8b40d90..00b066e84 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/KphTypes.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/KphTypes.cs
@@ -58,17 +58,24 @@ namespace ProcessHacker.Native.SsLogging
Log
}
+ public class KphSsClientEntryHandle : KphHandle
+ {
+ internal KphSsClientEntryHandle(IntPtr handle)
+ : base(handle)
+ { }
+ }
+
+ public class KphSsRuleSetEntryHandle : KphHandle
+ {
+ internal KphSsRuleSetEntryHandle(IntPtr handle)
+ : base(handle)
+ { }
+ }
+
[StructLayout(LayoutKind.Sequential)]
public struct KphSsArgumentBlock
{
- public static readonly int SizeOf;
- public static readonly int DataOffset;
-
- static KphSsArgumentBlock()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsArgumentBlock));
- DataOffset = Marshal.OffsetOf(typeof(KphSsArgumentBlock), "Data").ToInt32();
- }
+ public static readonly int DataOffset = Marshal.OffsetOf(typeof(KphSsArgumentBlock), "Data").ToInt32();
[StructLayout(LayoutKind.Explicit)]
public struct KphSsArgumentUnion
@@ -94,41 +101,22 @@ namespace ProcessHacker.Native.SsLogging
[StructLayout(LayoutKind.Sequential)]
public struct KphSsBlockHeader
{
- public static readonly int SizeOf;
-
public ushort Size;
public KphSsBlockType Type;
-
- static KphSsBlockHeader()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsBlockHeader));
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct KphSsBytes
{
- public static readonly int BufferOffset;
+ public static readonly int BufferOffset = Marshal.OffsetOf(typeof(KphSsBytes), "Buffer").ToInt32();
public ushort Length;
public byte Buffer;
-
- static KphSsBytes()
- {
- BufferOffset = Marshal.OffsetOf(typeof(KphSsBytes), "Buffer").ToInt32();
- }
}
[StructLayout(LayoutKind.Sequential)]
public struct KphSsClientInformation
{
- public static readonly int SizeOf;
-
- static KphSsClientInformation()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsClientInformation));
- }
-
public IntPtr ProcessId;
public IntPtr BufferBase;
public int BufferSize;
@@ -139,13 +127,6 @@ namespace ProcessHacker.Native.SsLogging
[StructLayout(LayoutKind.Sequential)]
public struct KphSsEventBlock
{
- public static readonly int SizeOf;
-
- static KphSsEventBlock()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsEventBlock));
- }
-
public KphSsBlockHeader Header;
public KphSsEventFlags Flags;
public long Time;
@@ -161,14 +142,7 @@ namespace ProcessHacker.Native.SsLogging
[StructLayout(LayoutKind.Sequential)]
public struct KphSsHandle
- {
- public static readonly int SizeOf;
-
- static KphSsHandle()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsHandle));
- }
-
+ {
public ClientId ClientId;
public ushort TypeNameOffset;
public ushort NameOffset;
@@ -177,13 +151,6 @@ namespace ProcessHacker.Native.SsLogging
[StructLayout(LayoutKind.Sequential)]
public struct KphSsObjectAttributes
{
- public static readonly int SizeOf;
-
- static KphSsObjectAttributes()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsObjectAttributes));
- }
-
public ObjectAttributes ObjectAttributes;
public ushort RootDirectoryOffset;
public ushort ObjectNameOffset;
@@ -192,14 +159,7 @@ namespace ProcessHacker.Native.SsLogging
[StructLayout(LayoutKind.Sequential)]
public struct KphSsUnicodeString
{
- public static readonly int SizeOf;
- public static readonly int BufferOffset;
-
- static KphSsUnicodeString()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsUnicodeString));
- BufferOffset = Marshal.OffsetOf(typeof(KphSsUnicodeString), "Buffer").ToInt32();
- }
+ public static readonly int BufferOffset = Marshal.OffsetOf(typeof(KphSsUnicodeString), "Buffer").ToInt32();
public ushort Length;
public ushort MaximumLength;
@@ -210,14 +170,7 @@ namespace ProcessHacker.Native.SsLogging
[StructLayout(LayoutKind.Sequential)]
public struct KphSsWString
{
- public static readonly int SizeOf;
- public static readonly int BufferOffset;
-
- static KphSsWString()
- {
- SizeOf = Marshal.SizeOf(typeof(KphSsWString));
- BufferOffset = Marshal.OffsetOf(typeof(KphSsWString), "Buffer").ToInt32();
- }
+ public static readonly int BufferOffset = Marshal.OffsetOf(typeof(KphSsWString), "Buffer").ToInt32();
public ushort Length;
public byte Buffer;
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/SsClientId.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/SsClientId.cs
index 323d075f3..7563d7766 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/SsClientId.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/SsClientId.cs
@@ -1,4 +1,7 @@
-using ProcessHacker.Native.Api;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.SsLogging
{
@@ -6,7 +9,7 @@ namespace ProcessHacker.Native.SsLogging
{
public SsClientId(MemoryRegion data)
{
- this.Original = data.ReadStruct(0, ClientId.SizeOf, 0);
+ this.Original = data.ReadStruct();
}
public ClientId Original
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/SsHandle.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/SsHandle.cs
index e3f67af7f..d964e09e4 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/SsHandle.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/SsHandle.cs
@@ -1,10 +1,14 @@
-namespace ProcessHacker.Native.SsLogging
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ProcessHacker.Native.SsLogging
{
public sealed class SsHandle : SsData
{
internal SsHandle(MemoryRegion data)
{
- KphSsHandle handleInfo = data.ReadStruct(0, KphSsHandle.SizeOf, 0);
+ KphSsHandle handleInfo = data.ReadStruct();
if (handleInfo.TypeNameOffset != 0)
{
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/SsLogger.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/SsLogger.cs
index 455a57e05..01f606245 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/SsLogger.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/SsLogger.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.InteropServices;
using System.Threading;
using ProcessHacker.Common;
using ProcessHacker.Native.Api;
@@ -19,7 +20,7 @@ namespace ProcessHacker.Native.SsLogging
public static SsData ReadArgumentBlock(MemoryRegion data)
{
- KphSsArgumentBlock argBlock = data.ReadStruct(0, KphSsArgumentBlock.SizeOf, 0);
+ var argBlock = data.ReadStruct();
MemoryRegion dataRegion;
SsData ssArg = null;
@@ -31,45 +32,37 @@ namespace ProcessHacker.Native.SsLogging
{
case KphSsArgumentType.Int8:
{
- SsSimple simpleArg = new SsSimple
- {
- Argument = argBlock.Data.Int8,
- Type = typeof(Byte)
- };
+ SsSimple simpleArg = new SsSimple();
+ simpleArg.Argument = argBlock.Data.Int8;
+ simpleArg.Type = typeof(Byte);
ssArg = simpleArg;
}
break;
case KphSsArgumentType.Int16:
{
- SsSimple simpleArg = new SsSimple
- {
- Argument = argBlock.Data.Int16,
- Type = typeof(Int16)
- };
+ SsSimple simpleArg = new SsSimple();
+ simpleArg.Argument = argBlock.Data.Int16;
+ simpleArg.Type = typeof(Int16);
ssArg = simpleArg;
}
break;
case KphSsArgumentType.Int32:
{
- SsSimple simpleArg = new SsSimple
- {
- Argument = argBlock.Data.Int32,
- Type = typeof(Int32)
- };
+ SsSimple simpleArg = new SsSimple();
+ simpleArg.Argument = argBlock.Data.Int32;
+ simpleArg.Type = typeof(Int32);
ssArg = simpleArg;
}
break;
case KphSsArgumentType.Int64:
{
- SsSimple simpleArg = new SsSimple
- {
- Argument = argBlock.Data.Int64,
- Type = typeof(Int64)
- };
+ SsSimple simpleArg = new SsSimple();
+ simpleArg.Argument = argBlock.Data.Int64;
+ simpleArg.Type = typeof(Int64);
ssArg = simpleArg;
}
break;
@@ -107,12 +100,15 @@ namespace ProcessHacker.Native.SsLogging
public static SsEvent ReadEventBlock(MemoryRegion data)
{
- KphSsEventBlock eventBlock = data.ReadStruct(0, KphSsEventBlock.SizeOf, 0);
+ var eventBlock = data.ReadStruct();
+
+ int[] arguments;
+ IntPtr[] stackTrace;
// Reconstruct the argument and stack trace arrays.
- int[] arguments = new int[eventBlock.NumberOfArguments];
- IntPtr[] stackTrace = new IntPtr[eventBlock.TraceCount];
+ arguments = new int[eventBlock.NumberOfArguments];
+ stackTrace = new IntPtr[eventBlock.TraceCount];
for (int i = 0; i < arguments.Length; i++)
arguments[i] = data.ReadInt32(eventBlock.ArgumentsOffset, i);
@@ -120,20 +116,22 @@ namespace ProcessHacker.Native.SsLogging
stackTrace[i] = data.ReadIntPtr(eventBlock.TraceOffset, i);
// Create an event object.
- SsEvent ssEvent = new SsEvent
- {
- // Basic information
- Time = DateTime.FromFileTime(eventBlock.Time),
- ThreadId = eventBlock.ClientId.ThreadId,
- ProcessId = eventBlock.ClientId.ProcessId,
- Arguments = arguments,
- StackTrace = stackTrace, ArgumentsCopyFailed =
- eventBlock.Flags.HasFlag(KphSsEventFlags.CopyArgumentsFailed),
- ArgumentsProbeFailed = eventBlock.Flags.HasFlag(KphSsEventFlags.ProbeArgumentsFailed),
- CallNumber = eventBlock.Number
- };
+ SsEvent ssEvent = new SsEvent();
+
+ // Basic information
+ ssEvent.Time = DateTime.FromFileTime(eventBlock.Time);
+ ssEvent.ThreadId = eventBlock.ClientId.ThreadId;
+ ssEvent.ProcessId = eventBlock.ClientId.ProcessId;
+ ssEvent.Arguments = arguments;
+ ssEvent.StackTrace = stackTrace;
// Flags
+ ssEvent.ArgumentsCopyFailed =
+ (eventBlock.Flags & KphSsEventFlags.CopyArgumentsFailed) == KphSsEventFlags.CopyArgumentsFailed;
+ ssEvent.ArgumentsProbeFailed =
+ (eventBlock.Flags & KphSsEventFlags.ProbeArgumentsFailed) == KphSsEventFlags.ProbeArgumentsFailed;
+ ssEvent.CallNumber = eventBlock.Number;
+
if ((eventBlock.Flags & KphSsEventFlags.UserMode) == KphSsEventFlags.UserMode)
ssEvent.Mode = KProcessorMode.UserMode;
else
@@ -144,7 +142,7 @@ namespace ProcessHacker.Native.SsLogging
public static string ReadWString(MemoryRegion data)
{
- KphSsWString wString = data.ReadStruct(0, KphSsWString.SizeOf, 0);
+ KphSsWString wString = data.ReadStruct();
return data.ReadUnicodeString(KphSsWString.BufferOffset, wString.Length / 2);
}
@@ -154,18 +152,20 @@ namespace ProcessHacker.Native.SsLogging
public event RawArgumentBlockReceivedDelegate RawArgumentBlockReceived;
public event RawEventBlockReceivedDelegate RawEventBlockReceived;
- private bool _started;
- private readonly object _startLock = new object();
+ private bool _started = false;
+ private object _startLock = new object();
- private bool _terminating;
+ private bool _terminating = false;
private Thread _bufferWorkerThread;
private ThreadHandle _bufferWorkerThreadHandle;
- private readonly Event _bufferWorkerThreadReadyEvent = new Event(true, false);
+ private Event _bufferWorkerThreadReadyEvent = new Event(true, false);
- private readonly VirtualMemoryAlloc _buffer;
- private readonly SemaphoreHandle _readSemaphore;
- private readonly SemaphoreHandle _writeSemaphore;
- private int _cursor;
+ private VirtualMemoryAlloc _buffer;
+ private SemaphoreHandle _readSemaphore;
+ private SemaphoreHandle _writeSemaphore;
+ private int _cursor = 0;
+ private KphSsClientEntryHandle _clientEntryHandle;
+ private KphSsRuleSetEntryHandle _ruleSetEntryHandle;
public SsLogger(int bufferedBlockCount, bool includeAll)
{
@@ -180,57 +180,57 @@ namespace ProcessHacker.Native.SsLogging
_writeSemaphore = SemaphoreHandle.Create(SemaphoreAccess.All, bufferedBlockCount, bufferedBlockCount);
// Create the client entry.
- //_clientEntryHandle = KProcessHacker.Instance.SsCreateClientEntry(
- // ProcessHandle.Current,
- // _readSemaphore,
- // _writeSemaphore,
- // _buffer,
- // _buffer.Size
- // );
+ _clientEntryHandle = KProcessHacker.Instance.SsCreateClientEntry(
+ ProcessHandle.Current,
+ _readSemaphore,
+ _writeSemaphore,
+ _buffer,
+ _buffer.Size
+ );
// Create the ruleset entry.
- //_ruleSetEntryHandle = KProcessHacker.Instance.SsCreateRuleSetEntry(
- // _clientEntryHandle,
- // includeAll ? KphSsFilterType.Include : KphSsFilterType.Exclude,
- // KphSsRuleSetAction.Log
- // );
+ _ruleSetEntryHandle = KProcessHacker.Instance.SsCreateRuleSetEntry(
+ _clientEntryHandle,
+ includeAll ? KphSsFilterType.Include : KphSsFilterType.Exclude,
+ KphSsRuleSetAction.Log
+ );
}
- //public IntPtr AddNumberRule(FilterType filterType, int number)
- //{
- // return KProcessHacker.Instance.SsAddNumberRule(
- // _ruleSetEntryHandle,
- // filterType.ToKphSs(),
- // number
- // );
- //}
+ public IntPtr AddNumberRule(FilterType filterType, int number)
+ {
+ return KProcessHacker.Instance.SsAddNumberRule(
+ _ruleSetEntryHandle,
+ filterType.ToKphSs(),
+ number
+ );
+ }
- //public IntPtr AddPreviousModeRule(FilterType filterType, KProcessorMode previousMode)
- //{
- // return KProcessHacker.Instance.SsAddPreviousModeRule(
- // _ruleSetEntryHandle,
- // filterType.ToKphSs(),
- // previousMode
- // );
- //}
+ public IntPtr AddPreviousModeRule(FilterType filterType, KProcessorMode previousMode)
+ {
+ return KProcessHacker.Instance.SsAddPreviousModeRule(
+ _ruleSetEntryHandle,
+ filterType.ToKphSs(),
+ previousMode
+ );
+ }
- //public IntPtr AddProcessIdRule(FilterType filterType, int pid)
- //{
- // return KProcessHacker.Instance.SsAddProcessIdRule(
- // _ruleSetEntryHandle,
- // filterType.ToKphSs(),
- // pid.ToIntPtr()
- // );
- //}
+ public IntPtr AddProcessIdRule(FilterType filterType, int pid)
+ {
+ return KProcessHacker.Instance.SsAddProcessIdRule(
+ _ruleSetEntryHandle,
+ filterType.ToKphSs(),
+ pid.ToIntPtr()
+ );
+ }
- //public IntPtr AddThreadIdRule(FilterType filterType, int tid)
- //{
- // return KProcessHacker.Instance.SsAddProcessIdRule(
- // _ruleSetEntryHandle,
- // filterType.ToKphSs(),
- // tid.ToIntPtr()
- // );
- //}
+ public IntPtr AddThreadIdRule(FilterType filterType, int tid)
+ {
+ return KProcessHacker.Instance.SsAddProcessIdRule(
+ _ruleSetEntryHandle,
+ filterType.ToKphSs(),
+ tid.ToIntPtr()
+ );
+ }
private void BufferWorkerThreadStart()
{
@@ -255,34 +255,37 @@ namespace ProcessHacker.Native.SsLogging
return;
// Check if we have an implicit cursor reset.
- if (_buffer.Size - _cursor < KphSsBlockHeader.SizeOf)
+ if (_buffer.Size - _cursor < Marshal.SizeOf(typeof(KphSsBlockHeader)))
_cursor = 0;
// Read the block header.
- blockHeader = _buffer.ReadStruct(_cursor, KphSsBlockHeader.SizeOf, 0);
+ blockHeader = _buffer.ReadStruct(_cursor, 0);
// Check if we have an explicit cursor reset.
if (blockHeader.Type == KphSsBlockType.Reset)
{
_cursor = 0;
- blockHeader = _buffer.ReadStruct(_cursor, KphSsBlockHeader.SizeOf, 0);
+ blockHeader = _buffer.ReadStruct(_cursor, 0);
}
// Process the block.
- switch (blockHeader.Type)
+ if (blockHeader.Type == KphSsBlockType.Event)
{
- case KphSsBlockType.Event:
- if (this.EventBlockReceived != null)
- this.EventBlockReceived(ReadEventBlock(new MemoryRegion(this._buffer, this._cursor)));
- if (this.RawEventBlockReceived != null)
- this.RawEventBlockReceived(new MemoryRegion(this._buffer, this._cursor));
- break;
- case KphSsBlockType.Argument:
- if (this.ArgumentBlockReceived != null)
- this.ArgumentBlockReceived(ReadArgumentBlock(new MemoryRegion(this._buffer, this._cursor)));
- if (this.RawArgumentBlockReceived != null)
- this.RawArgumentBlockReceived(new MemoryRegion(this._buffer, this._cursor));
- break;
+ // Raise the events.
+
+ if (this.EventBlockReceived != null)
+ this.EventBlockReceived(ReadEventBlock(new MemoryRegion(_buffer, _cursor)));
+ if (this.RawEventBlockReceived != null)
+ this.RawEventBlockReceived(new MemoryRegion(_buffer, _cursor));
+ }
+ else if (blockHeader.Type == KphSsBlockType.Argument)
+ {
+ // Raise the events.
+
+ if (this.ArgumentBlockReceived != null)
+ this.ArgumentBlockReceived(ReadArgumentBlock(new MemoryRegion(_buffer, _cursor)));
+ if (this.RawArgumentBlockReceived != null)
+ this.RawArgumentBlockReceived(new MemoryRegion(_buffer, _cursor));
}
// Advance the cursor.
@@ -294,24 +297,23 @@ namespace ProcessHacker.Native.SsLogging
public void GetStatistics(out int blocksWritten, out int blocksDropped)
{
- //KphSsClientInformation info;
- //KProcessHacker.Instance.SsQueryClientEntry(
- // _clientEntryHandle,
- // out info,
- // KphSsClientInformation.SizeOf,
- // out retLength
- // );
+ KphSsClientInformation info;
+ int retLength;
- //blocksWritten = info.NumberOfBlocksWritten;
- //blocksDropped = info.NumberOfBlocksDropped;
-
- blocksWritten = 0;
- blocksDropped = 0;
+ KProcessHacker.Instance.SsQueryClientEntry(
+ _clientEntryHandle,
+ out info,
+ Marshal.SizeOf(typeof(KphSsClientInformation)),
+ out retLength
+ );
+
+ blocksWritten = info.NumberOfBlocksWritten;
+ blocksDropped = info.NumberOfBlocksDropped;
}
public void RemoveRule(IntPtr handle)
{
- //KProcessHacker.Instance.SsRemoveRule(_ruleSetEntryHandle, handle);
+ KProcessHacker.Instance.SsRemoveRule(_ruleSetEntryHandle, handle);
}
public void Start()
@@ -320,17 +322,15 @@ namespace ProcessHacker.Native.SsLogging
{
if (!_started)
{
- //KProcessHacker.Instance.SsRef();
- //KProcessHacker.Instance.SsEnableClientEntry(_clientEntryHandle, true);
+ KProcessHacker.Instance.SsRef();
+ KProcessHacker.Instance.SsEnableClientEntry(_clientEntryHandle, true);
_started = true;
_terminating = false;
// Create the buffer worker thread.
- _bufferWorkerThread = new Thread(this.BufferWorkerThreadStart, Utils.SixteenthStackSize)
- {
- IsBackground = true
- };
+ _bufferWorkerThread = new Thread(this.BufferWorkerThreadStart, Utils.SixteenthStackSize);
+ _bufferWorkerThread.IsBackground = true;
_bufferWorkerThread.Start();
// Wait for the thread to initialize.
_bufferWorkerThreadReadyEvent.Wait();
@@ -344,8 +344,8 @@ namespace ProcessHacker.Native.SsLogging
{
if (_started)
{
- //KProcessHacker.Instance.SsEnableClientEntry(_clientEntryHandle, false);
- //KProcessHacker.Instance.SsUnref();
+ KProcessHacker.Instance.SsEnableClientEntry(_clientEntryHandle, false);
+ KProcessHacker.Instance.SsUnref();
_started = false;
// Tell the worker thread to stop.
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/SsObjectAttributes.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/SsObjectAttributes.cs
index 6ba92e00b..82e4cc591 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/SsObjectAttributes.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/SsObjectAttributes.cs
@@ -1,4 +1,7 @@
-using ProcessHacker.Native.Api;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.SsLogging
{
@@ -6,7 +9,7 @@ namespace ProcessHacker.Native.SsLogging
{
internal SsObjectAttributes(MemoryRegion data)
{
- KphSsObjectAttributes oaInfo = data.ReadStruct(0, KphSsObjectAttributes.SizeOf, 0);
+ KphSsObjectAttributes oaInfo = data.ReadStruct();
if (oaInfo.ObjectNameOffset != 0)
this.ObjectName = new SsUnicodeString(new MemoryRegion(data, oaInfo.ObjectNameOffset));
diff --git a/1.x/trunk/ProcessHacker.Native/SsLogging/SsUnicodeString.cs b/1.x/trunk/ProcessHacker.Native/SsLogging/SsUnicodeString.cs
index 7a59c87dd..a224af7d4 100644
--- a/1.x/trunk/ProcessHacker.Native/SsLogging/SsUnicodeString.cs
+++ b/1.x/trunk/ProcessHacker.Native/SsLogging/SsUnicodeString.cs
@@ -1,4 +1,7 @@
-using ProcessHacker.Native.Api;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ProcessHacker.Native.Api;
namespace ProcessHacker.Native.SsLogging
{
@@ -8,13 +11,12 @@ namespace ProcessHacker.Native.SsLogging
{
KphSsUnicodeString unicodeStringInfo = data.ReadStruct();
- this.Original = new UnicodeString
+ this.Original = new UnicodeString()
{
Length = unicodeStringInfo.Length,
MaximumLength = unicodeStringInfo.MaximumLength,
Buffer = unicodeStringInfo.Pointer
};
-
this.String = data.ReadUnicodeString(
KphSsUnicodeString.BufferOffset,
unicodeStringInfo.Length / 2
diff --git a/1.x/trunk/ProcessHacker.Native/Symbols/SymbolProvider.cs b/1.x/trunk/ProcessHacker.Native/Symbols/SymbolProvider.cs
index e0b4724a6..e2bf114c8 100644
--- a/1.x/trunk/ProcessHacker.Native/Symbols/SymbolProvider.cs
+++ b/1.x/trunk/ProcessHacker.Native/Symbols/SymbolProvider.cs
@@ -38,7 +38,7 @@ namespace ProcessHacker.Native.Symbols
{
private sealed class SymbolHandle : BaseObject
{
- private readonly ProcessHandle _processHandle;
+ private ProcessHandle _processHandle;
private IntPtr _handle;
public static implicit operator IntPtr(SymbolHandle symbolHandle)
@@ -99,7 +99,7 @@ namespace ProcessHacker.Native.Symbols
}
private const int _maxNameLen = 0x100;
- private static readonly IdGenerator _idGen = new IdGenerator();
+ private static IdGenerator _idGen = new IdGenerator();
public static SymbolOptions Options
{
@@ -116,8 +116,8 @@ namespace ProcessHacker.Native.Symbols
}
}
- private readonly SymbolHandle _handle;
- private readonly List> _modules = new List>();
+ private SymbolHandle _handle;
+ private List> _modules = new List>();
public SymbolProvider()
{
@@ -142,9 +142,11 @@ namespace ProcessHacker.Native.Symbols
{
return true;
}
-
- Win32.DbgHelpLock.Release();
- return false;
+ else
+ {
+ Win32.DbgHelpLock.Release();
+ return false;
+ }
}
}
@@ -164,7 +166,7 @@ namespace ProcessHacker.Native.Symbols
using (Win32.DbgHelpLock.AcquireContext())
{
if (!Win32.SymGetSearchPath(_handle, data, data.Capacity))
- return string.Empty;
+ return "";
}
return data.ToString();
@@ -195,9 +197,10 @@ namespace ProcessHacker.Native.Symbols
_handle,
moduleBase,
mask,
- (symbolInfo, symbolSize, userContext) => enumDelegate(new SymbolInformation(symbolInfo, symbolSize)),
- IntPtr.Zero)
- )
+ (symbolInfo, symbolSize, userContext) =>
+ enumDelegate(new SymbolInformation(symbolInfo, symbolSize)),
+ IntPtr.Zero
+ ))
Win32.Throw();
}
}
@@ -209,10 +212,10 @@ namespace ProcessHacker.Native.Symbols
this.GetLineFromAddress(address, out fileName, out lineNumber);
- if (!string.IsNullOrEmpty(fileName))
- return fileName + ": line " + lineNumber;
-
- return null;
+ if (fileName != null)
+ return fileName + ": line " + lineNumber.ToString();
+ else
+ return null;
}
public void GetLineFromAddress(ulong address, out string fileName, out int lineNumber)
@@ -334,15 +337,14 @@ namespace ProcessHacker.Native.Symbols
}
// Allocate some memory for the symbol information.
- using (MemoryAlloc data = new MemoryAlloc(SymbolInfo.SizeOf + _maxNameLen))
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(SymbolInfo)) + _maxNameLen))
{
- SymbolInfo info = new SymbolInfo
- {
- SizeOfStruct = SymbolInfo.SizeOf,
- MaxNameLen = _maxNameLen - 1
- };
+ var info = new SymbolInfo();
- data.WriteStruct(info);
+ info.SizeOfStruct = Marshal.SizeOf(info);
+ info.MaxNameLen = _maxNameLen - 1;
+
+ Marshal.StructureToPtr(info, data, false);
// Hack for drivers, since we don't get their module sizes.
// Preloading modules will fix this.
@@ -384,7 +386,7 @@ namespace ProcessHacker.Native.Symbols
}
// If we don't have a module name, return an address.
- if (string.IsNullOrEmpty(modFileName))
+ if (modFileName == null)
{
level = SymbolResolveLevel.Address;
flags = 0;
@@ -418,10 +420,12 @@ namespace ProcessHacker.Native.Symbols
{
return fi.Name + "+0x" + (address - modBase).ToString("x");
}
+ else
+ {
+ var s = modFileName.Split('\\');
- var s = modFileName.Split('\\');
-
- return s[s.Length - 1] + "+0x" + (address - modBase).ToString("x");
+ return s[s.Length - 1] + "+0x" + (address - modBase).ToString("x");
+ }
}
// If we have everything, return the full symbol name: module!symbol+offset.
@@ -433,22 +437,21 @@ namespace ProcessHacker.Native.Symbols
if (displacement == 0)
return fi.Name + "!" + name;
-
- return fi.Name + "!" + name + "+0x" + displacement.ToString("x");
+ else
+ return fi.Name + "!" + name + "+0x" + displacement.ToString("x");
}
}
public SymbolInformation GetSymbolFromName(string symbolName)
{
- using (MemoryAlloc data = new MemoryAlloc(SymbolInfo.SizeOf + _maxNameLen))
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(SymbolInfo)) + _maxNameLen))
{
- SymbolInfo info = new SymbolInfo
- {
- SizeOfStruct = SymbolInfo.SizeOf,
- MaxNameLen = _maxNameLen - 1
- };
+ var info = new SymbolInfo();
- data.WriteStruct(info);
+ info.SizeOfStruct = Marshal.SizeOf(info);
+ info.MaxNameLen = _maxNameLen - 1;
+
+ Marshal.StructureToPtr(info, data, false);
using (Win32.DbgHelpLock.AcquireContext())
{
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/CurrentThread.cs b/1.x/trunk/ProcessHacker.Native/Threading/CurrentThread.cs
index 3d9cb8d79..a269c9e0f 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/CurrentThread.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/CurrentThread.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/Event.cs b/1.x/trunk/ProcessHacker.Native/Threading/Event.cs
index c00551171..19b716f82 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/Event.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/Event.cs
@@ -20,6 +20,9 @@
* along with Process Hacker. If not, see .
*/
+using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -93,7 +96,11 @@ namespace ProcessHacker.Native.Threading
///
public bool AutoReset
{
- get { return this.Handle.BasicInformation.EventType == EventType.SynchronizationEvent; }
+ get
+ {
+ return this.Handle.GetBasicInformation().EventType ==
+ EventType.SynchronizationEvent;
+ }
}
///
@@ -101,7 +108,7 @@ namespace ProcessHacker.Native.Threading
///
public bool Signaled
{
- get { return this.Handle.BasicInformation.EventState != 0; }
+ get { return this.Handle.GetBasicInformation().EventState != 0; }
}
///
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/EventPair.cs b/1.x/trunk/ProcessHacker.Native/Threading/EventPair.cs
index bd4f3c1ca..4b78b733e 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/EventPair.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/EventPair.cs
@@ -20,6 +20,9 @@
* along with Process Hacker. If not, see .
*/
+using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/KeyedEvent.cs b/1.x/trunk/ProcessHacker.Native/Threading/KeyedEvent.cs
index 966f5eef9..8c38b1f4c 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/KeyedEvent.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/KeyedEvent.cs
@@ -21,6 +21,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/Mutant.cs b/1.x/trunk/ProcessHacker.Native/Threading/Mutant.cs
index 4e3bcadda..f3841fcbf 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/Mutant.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/Mutant.cs
@@ -20,6 +20,9 @@
* along with Process Hacker. If not, see .
*/
+using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -85,7 +88,7 @@ namespace ProcessHacker.Native.Threading
///
public bool Owned
{
- get { return this.Handle.BasicInformation.CurrentCount <= 0; }
+ get { return this.Handle.GetBasicInformation().CurrentCount <= 0; }
}
///
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/NativeThreadPool.cs b/1.x/trunk/ProcessHacker.Native/Threading/NativeThreadPool.cs
index 14bdf0d37..3074a7801 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/NativeThreadPool.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/NativeThreadPool.cs
@@ -1,5 +1,8 @@
using System;
+using System.Collections.Generic;
+using System.Text;
using ProcessHacker.Native.Api;
+using ProcessHacker.Native.Objects;
namespace ProcessHacker.Native.Threading
{
@@ -9,7 +12,7 @@ namespace ProcessHacker.Native.Threading
{
public static void QueueWorkItem(Action
public sealed class Timer : NativeObject
{
+ private TimerCallback _callback;
+
///
/// Creates a timer.
///
@@ -90,7 +92,7 @@ namespace ProcessHacker.Native.Threading
///
public TimeSpan RemainingTime
{
- get { return new TimeSpan(this.Handle.BasicInformation.RemainingTime); }
+ get { return new TimeSpan(this.Handle.GetBasicInformation().RemainingTime); }
}
///
@@ -98,7 +100,7 @@ namespace ProcessHacker.Native.Threading
///
public bool Signaled
{
- get { return this.Handle.BasicInformation.TimerState; }
+ get { return this.Handle.GetBasicInformation().TimerState; }
}
///
@@ -150,6 +152,7 @@ namespace ProcessHacker.Native.Threading
{
TimerApcRoutine apcRoutine = (context_, lowPart, highPart) => callback(context_);
+ _callback = callback;
this.Handle.Set(
dueTime * Win32.TimeMsTo100Ns,
true,
@@ -200,6 +203,7 @@ namespace ProcessHacker.Native.Threading
{
TimerApcRoutine apcRoutine = (context_, lowPart, highPart) => callback(context_);
+ _callback = callback;
this.Handle.Set(
dueTime.ToFileTime(),
false,
diff --git a/1.x/trunk/ProcessHacker.Native/Threading/Waiter.cs b/1.x/trunk/ProcessHacker.Native/Threading/Waiter.cs
index 0cdfff408..07f3f9461 100644
--- a/1.x/trunk/ProcessHacker.Native/Threading/Waiter.cs
+++ b/1.x/trunk/ProcessHacker.Native/Threading/Waiter.cs
@@ -41,22 +41,20 @@ namespace ProcessHacker.Native.Threading
{
public event ObjectSignaledDelegate ObjectSignaled;
- private readonly Waiter _owner;
- private bool _terminating;
- private readonly Thread _thread;
+ private Waiter _owner;
+ private bool _terminating = false;
+ private Thread _thread;
private FastEvent _threadInitializedEvent = new FastEvent(false);
private ThreadHandle _threadHandle;
- private readonly List _waitObjects = new List();
+ private List _waitObjects = new List();
public WaiterThread(Waiter owner)
{
_owner = owner;
// Create the waiter thread.
- _thread = new Thread(this.WaiterThreadStart, Common.Utils.SixteenthStackSize)
- {
- IsBackground = true
- };
+ _thread = new Thread(this.WaiterThreadStart, ProcessHacker.Common.Utils.SixteenthStackSize);
+ _thread.IsBackground = true;
_thread.SetApartmentState(ApartmentState.STA);
_thread.Start();
@@ -233,8 +231,8 @@ namespace ProcessHacker.Native.Threading
///
public event ObjectSignaledDelegate ObjectSignaled;
- private readonly List _waiterThreads = new List();
- private readonly List _waitObjects = new List();
+ private List _waiterThreads = new List();
+ private List _waitObjects = new List();
///
/// Creates a waiter.
@@ -303,7 +301,12 @@ namespace ProcessHacker.Native.Threading
}
}
- private void CreateWaiterThread(ISynchronizable obj = null)
+ private WaiterThread CreateWaiterThread()
+ {
+ return this.CreateWaiterThread(null);
+ }
+
+ private WaiterThread CreateWaiterThread(ISynchronizable obj)
{
WaiterThread waiterThread = new WaiterThread(this);
@@ -314,6 +317,8 @@ namespace ProcessHacker.Native.Threading
lock (_waiterThreads)
_waiterThreads.Add(waiterThread);
+
+ return waiterThread;
}
private void DeleteWaiterThread(WaiterThread waiterThread)
diff --git a/1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.Designer.cs b/1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.Designer.cs
similarity index 100%
rename from 1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.Designer.cs
rename to 1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.Designer.cs
diff --git a/1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.cs b/1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.cs
similarity index 76%
rename from 1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.cs
rename to 1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.cs
index 5a18f44c7..12d82eb22 100644
--- a/1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.cs
+++ b/1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using ProcessHacker.Native.Objects;
@@ -28,7 +27,7 @@ namespace ProcessHacker.Native.Ui
private void RefreshProcesses()
{
- Dictionary processes = Windows.GetProcesses();
+ var processes = Windows.GetProcesses();
listProcesses.BeginUpdate();
listProcesses.Items.Clear();
@@ -39,29 +38,30 @@ namespace ProcessHacker.Native.Ui
foreach (var process in processes.Values)
{
- string userName = string.Empty;
+ string userName = "";
string fileName = null;
try
{
- using (ProcessHandle phandle = new ProcessHandle(process.Process.ProcessId, OSVersion.MinProcessQueryInfoAccess))
+ using (var phandle = new ProcessHandle(process.Process.ProcessId, OSVersion.MinProcessQueryInfoAccess))
{
- using (TokenHandle thandle = phandle.GetToken(TokenAccess.Query))
- using (Sid sid = thandle.User)
+ using (var thandle = phandle.GetToken(TokenAccess.Query))
+ using (var sid = thandle.GetUser())
userName = sid.GetFullName(true);
- fileName = phandle.ImageFileName;
+ fileName = FileUtils.GetFileName(phandle.GetImageFileName());
}
}
catch
{ }
- ListViewItem item = new ListViewItem(new string[]
- {
- process.Process.ProcessId == 0 ? "System Idle Process" : process.Name,
- process.Process.ProcessId.ToString(),
- userName
- });
+ ListViewItem item = new ListViewItem(
+ new string[]
+ {
+ process.Process.ProcessId == 0 ? "System Idle Process" : process.Name,
+ process.Process.ProcessId.ToString(),
+ userName
+ });
if (!string.IsNullOrEmpty(fileName))
{
diff --git a/1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.resx b/1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.resx
similarity index 100%
rename from 1.x/trunk/ProcessHacker/Forms/Ui/ChooseProcessDialog.resx
rename to 1.x/trunk/ProcessHacker.Native/Ui/ChooseProcessDialog.resx
diff --git a/1.x/trunk/ProcessHacker/Components/HandleDetails.Designer.cs b/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.Designer.cs
similarity index 63%
rename from 1.x/trunk/ProcessHacker/Components/HandleDetails.Designer.cs
rename to 1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.Designer.cs
index 2e1263e1b..3b5f6a828 100644
--- a/1.x/trunk/ProcessHacker/Components/HandleDetails.Designer.cs
+++ b/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.Designer.cs
@@ -1,13 +1,13 @@
-namespace ProcessHacker.Components
+namespace ProcessHacker.Native.Ui
{
- partial class HandleDetails
+ partial class HandlePropertiesWindow
{
- ///
+ ///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
- ///
+ ///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
@@ -17,17 +17,20 @@
{
components.Dispose();
}
+
base.Dispose(disposing);
}
- #region Component Designer generated code
+ #region Windows Form Designer generated code
- ///
- /// Required method for Designer support - do not modify
+ ///
+ /// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
+ this.tabControl = new System.Windows.Forms.TabControl();
+ this.tabDetails = new System.Windows.Forms.TabPage();
this.groupObjectInfo = new System.Windows.Forms.GroupBox();
this.groupQuotaCharges = new System.Windows.Forms.GroupBox();
this.labelNonPaged = new System.Windows.Forms.Label();
@@ -44,33 +47,63 @@
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
+ this.buttonClose = new System.Windows.Forms.Button();
+ this.buttonPermissions = new System.Windows.Forms.Button();
+ this.tabControl.SuspendLayout();
+ this.tabDetails.SuspendLayout();
this.groupQuotaCharges.SuspendLayout();
this.groupReferences.SuspendLayout();
this.groupBasicInfo.SuspendLayout();
this.SuspendLayout();
//
+ // tabControl
+ //
+ this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tabControl.Controls.Add(this.tabDetails);
+ this.tabControl.Location = new System.Drawing.Point(12, 12);
+ this.tabControl.Name = "tabControl";
+ this.tabControl.SelectedIndex = 0;
+ this.tabControl.Size = new System.Drawing.Size(370, 382);
+ this.tabControl.TabIndex = 0;
+ //
+ // tabDetails
+ //
+ this.tabDetails.Controls.Add(this.groupObjectInfo);
+ this.tabDetails.Controls.Add(this.groupQuotaCharges);
+ this.tabDetails.Controls.Add(this.groupReferences);
+ this.tabDetails.Controls.Add(this.groupBasicInfo);
+ this.tabDetails.Location = new System.Drawing.Point(4, 22);
+ this.tabDetails.Name = "tabDetails";
+ this.tabDetails.Padding = new System.Windows.Forms.Padding(3);
+ this.tabDetails.Size = new System.Drawing.Size(362, 356);
+ this.tabDetails.TabIndex = 0;
+ this.tabDetails.Text = "Details";
+ this.tabDetails.UseVisualStyleBackColor = true;
+ //
// groupObjectInfo
//
- this.groupObjectInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupObjectInfo.Location = new System.Drawing.Point(6, 189);
+ this.groupObjectInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupObjectInfo.Location = new System.Drawing.Point(6, 215);
this.groupObjectInfo.Name = "groupObjectInfo";
- this.groupObjectInfo.Size = new System.Drawing.Size(430, 234);
- this.groupObjectInfo.TabIndex = 7;
+ this.groupObjectInfo.Size = new System.Drawing.Size(350, 135);
+ this.groupObjectInfo.TabIndex = 3;
this.groupObjectInfo.TabStop = false;
this.groupObjectInfo.Text = "Object Information";
//
// groupQuotaCharges
//
- this.groupQuotaCharges.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupQuotaCharges.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupQuotaCharges.Controls.Add(this.labelNonPaged);
this.groupQuotaCharges.Controls.Add(this.labelPaged);
- this.groupQuotaCharges.Location = new System.Drawing.Point(188, 112);
+ this.groupQuotaCharges.Location = new System.Drawing.Point(179, 138);
this.groupQuotaCharges.Name = "groupQuotaCharges";
- this.groupQuotaCharges.Size = new System.Drawing.Size(248, 71);
- this.groupQuotaCharges.TabIndex = 6;
+ this.groupQuotaCharges.Size = new System.Drawing.Size(177, 71);
+ this.groupQuotaCharges.TabIndex = 2;
this.groupQuotaCharges.TabStop = false;
this.groupQuotaCharges.Text = "Quota Charges";
//
@@ -96,10 +129,10 @@
//
this.groupReferences.Controls.Add(this.labelHandles);
this.groupReferences.Controls.Add(this.labelReferences);
- this.groupReferences.Location = new System.Drawing.Point(6, 112);
+ this.groupReferences.Location = new System.Drawing.Point(6, 138);
this.groupReferences.Name = "groupReferences";
- this.groupReferences.Size = new System.Drawing.Size(176, 71);
- this.groupReferences.TabIndex = 5;
+ this.groupReferences.Size = new System.Drawing.Size(167, 71);
+ this.groupReferences.TabIndex = 1;
this.groupReferences.TabStop = false;
this.groupReferences.Text = "References";
//
@@ -123,8 +156,9 @@
//
// groupBasicInfo
//
- this.groupBasicInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBasicInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBasicInfo.Controls.Add(this.buttonPermissions);
this.groupBasicInfo.Controls.Add(this.textGrantedAccess);
this.groupBasicInfo.Controls.Add(this.textAddress);
this.groupBasicInfo.Controls.Add(this.textType);
@@ -135,49 +169,49 @@
this.groupBasicInfo.Controls.Add(this.label1);
this.groupBasicInfo.Location = new System.Drawing.Point(6, 6);
this.groupBasicInfo.Name = "groupBasicInfo";
- this.groupBasicInfo.Size = new System.Drawing.Size(430, 102);
+ this.groupBasicInfo.Size = new System.Drawing.Size(350, 126);
this.groupBasicInfo.TabIndex = 0;
this.groupBasicInfo.TabStop = false;
this.groupBasicInfo.Text = "Basic Information";
//
// textGrantedAccess
//
- this.textGrantedAccess.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textGrantedAccess.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textGrantedAccess.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textGrantedAccess.Location = new System.Drawing.Point(98, 76);
this.textGrantedAccess.Name = "textGrantedAccess";
- this.textGrantedAccess.Size = new System.Drawing.Size(326, 13);
- this.textGrantedAccess.TabIndex = 20;
+ this.textGrantedAccess.Size = new System.Drawing.Size(246, 13);
+ this.textGrantedAccess.TabIndex = 1;
//
// textAddress
//
- this.textAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textAddress.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textAddress.Location = new System.Drawing.Point(98, 57);
this.textAddress.Name = "textAddress";
- this.textAddress.Size = new System.Drawing.Size(326, 13);
+ this.textAddress.Size = new System.Drawing.Size(246, 13);
this.textAddress.TabIndex = 1;
//
// textType
//
- this.textType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textType.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textType.Location = new System.Drawing.Point(60, 38);
this.textType.Name = "textType";
- this.textType.Size = new System.Drawing.Size(364, 13);
+ this.textType.Size = new System.Drawing.Size(284, 13);
this.textType.TabIndex = 1;
//
// textName
//
- this.textName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textName.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textName.Location = new System.Drawing.Point(60, 19);
this.textName.Name = "textName";
- this.textName.Size = new System.Drawing.Size(364, 13);
+ this.textName.Size = new System.Drawing.Size(284, 13);
this.textName.TabIndex = 1;
//
// label4
@@ -186,7 +220,7 @@
this.label4.Location = new System.Drawing.Point(6, 76);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(86, 13);
- this.label4.TabIndex = 21;
+ this.label4.TabIndex = 0;
this.label4.Text = "Granted Access:";
//
// label3
@@ -204,7 +238,7 @@
this.label2.Location = new System.Drawing.Point(6, 38);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(34, 13);
- this.label2.TabIndex = 2;
+ this.label2.TabIndex = 0;
this.label2.Text = "Type:";
//
// label1
@@ -216,18 +250,47 @@
this.label1.TabIndex = 0;
this.label1.Text = "Name:";
//
- // HandleDetails
+ // buttonClose
+ //
+ this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.buttonClose.Location = new System.Drawing.Point(307, 400);
+ this.buttonClose.Name = "buttonClose";
+ this.buttonClose.Size = new System.Drawing.Size(75, 23);
+ this.buttonClose.TabIndex = 1;
+ this.buttonClose.Text = "Close";
+ this.buttonClose.UseVisualStyleBackColor = true;
+ this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
+ //
+ // buttonPermissions
+ //
+ this.buttonPermissions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonPermissions.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.buttonPermissions.Location = new System.Drawing.Point(269, 97);
+ this.buttonPermissions.Name = "buttonPermissions";
+ this.buttonPermissions.Size = new System.Drawing.Size(75, 23);
+ this.buttonPermissions.TabIndex = 2;
+ this.buttonPermissions.Text = "Permissions";
+ this.buttonPermissions.UseVisualStyleBackColor = true;
+ this.buttonPermissions.Click += new System.EventHandler(this.buttonPermissions_Click);
+ //
+ // HandlePropertiesWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.White;
- this.Controls.Add(this.groupObjectInfo);
- this.Controls.Add(this.groupQuotaCharges);
- this.Controls.Add(this.groupReferences);
- this.Controls.Add(this.groupBasicInfo);
- this.Name = "HandleDetails";
- this.Padding = new System.Windows.Forms.Padding(3);
- this.Size = new System.Drawing.Size(442, 429);
+ this.ClientSize = new System.Drawing.Size(394, 435);
+ this.Controls.Add(this.buttonClose);
+ this.Controls.Add(this.tabControl);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "HandlePropertiesWindow";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Handle Properties";
+ this.Load += new System.EventHandler(this.HandlePropertiesWindow_Load);
+ this.tabControl.ResumeLayout(false);
+ this.tabDetails.ResumeLayout(false);
this.groupQuotaCharges.ResumeLayout(false);
this.groupQuotaCharges.PerformLayout();
this.groupReferences.ResumeLayout(false);
@@ -240,22 +303,25 @@
#endregion
- private System.Windows.Forms.GroupBox groupObjectInfo;
- private System.Windows.Forms.GroupBox groupQuotaCharges;
- private System.Windows.Forms.Label labelNonPaged;
- private System.Windows.Forms.Label labelPaged;
- private System.Windows.Forms.GroupBox groupReferences;
- private System.Windows.Forms.Label labelHandles;
- private System.Windows.Forms.Label labelReferences;
+ private System.Windows.Forms.TabControl tabControl;
+ private System.Windows.Forms.TabPage tabDetails;
+ private System.Windows.Forms.Button buttonClose;
private System.Windows.Forms.GroupBox groupBasicInfo;
- private System.Windows.Forms.TextBox textGrantedAccess;
- private System.Windows.Forms.TextBox textAddress;
- private System.Windows.Forms.TextBox textType;
private System.Windows.Forms.TextBox textName;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
-
+ private System.Windows.Forms.TextBox textGrantedAccess;
+ private System.Windows.Forms.TextBox textAddress;
+ private System.Windows.Forms.TextBox textType;
+ private System.Windows.Forms.GroupBox groupReferences;
+ private System.Windows.Forms.Label labelHandles;
+ private System.Windows.Forms.Label labelReferences;
+ private System.Windows.Forms.GroupBox groupQuotaCharges;
+ private System.Windows.Forms.Label labelNonPaged;
+ private System.Windows.Forms.Label labelPaged;
+ private System.Windows.Forms.GroupBox groupObjectInfo;
+ private System.Windows.Forms.Button buttonPermissions;
}
-}
+}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.cs b/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.cs
new file mode 100644
index 000000000..d74083378
--- /dev/null
+++ b/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.cs
@@ -0,0 +1,151 @@
+/*
+ * Process Hacker -
+ * handle properties window
+ *
+ * Copyright (C) 2009 wj32
+ *
+ * This file is part of Process Hacker.
+ *
+ * Process Hacker is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Process Hacker is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Process Hacker. If not, see .
+ */
+
+using System;
+using System.Windows.Forms;
+using ProcessHacker.Native.Api;
+using ProcessHacker.Native.Objects;
+using ProcessHacker.Native.Security.AccessControl;
+
+namespace ProcessHacker.Native.Ui
+{
+ public partial class HandlePropertiesWindow : Form
+ {
+ public delegate void HandlePropertiesDelegate(Control objectGroup, string name, string typeName);
+
+ public event HandlePropertiesDelegate HandlePropertiesCallback;
+
+ private string _name, _typeName;
+ private NativeHandle _objectHandle;
+
+ public HandlePropertiesWindow(SystemHandleEntry handle)
+ {
+ InitializeComponent();
+ this.KeyPreview = true;
+ this.KeyDown += (sender, e) =>
+ {
+ if (e.KeyCode == Keys.Escape)
+ {
+ this.Close();
+ e.Handled = true;
+ }
+ };
+
+ var handleInfo = handle.GetHandleInfo();
+
+ textName.Text = _name = handleInfo.BestName;
+ if (textName.Text == "")
+ textName.Text = "(unnamed object)";
+ textType.Text = _typeName = handleInfo.TypeName;
+ textAddress.Text = "0x" + handle.Object.ToString("x");
+ textGrantedAccess.Text = "0x" + handle.GrantedAccess.ToString("x");
+
+ if (handle.GrantedAccess != 0)
+ {
+ try
+ {
+ Type accessEnumType = NativeTypeFactory.GetAccessType(handleInfo.TypeName);
+
+ textGrantedAccess.Text += " (" +
+ NativeTypeFactory.GetAccessString(accessEnumType, handle.GrantedAccess) +
+ ")";
+ }
+ catch (NotSupportedException)
+ { }
+ }
+
+ var basicInfo = handle.GetBasicInfo();
+
+ labelReferences.Text = "References: " + (basicInfo.PointerCount - 1).ToString();
+ labelHandles.Text = "Handles: " + basicInfo.HandleCount.ToString();
+ labelPaged.Text = "Paged: " + basicInfo.PagedPoolUsage.ToString();
+ labelNonPaged.Text = "Non-Paged: " + basicInfo.NonPagedPoolUsage.ToString();
+ }
+
+ private void HandlePropertiesWindow_Load(object sender, EventArgs e)
+ {
+ if (HandlePropertiesCallback != null)
+ {
+ try
+ {
+ HandlePropertiesCallback(groupObjectInfo, _name, _typeName);
+ }
+ catch
+ { }
+
+ if (groupObjectInfo.Controls.Count == 0)
+ {
+ groupObjectInfo.Visible = false;
+ }
+ else if (groupObjectInfo.Controls.Count == 1)
+ {
+ Control control = groupObjectInfo.Controls[0];
+
+ // If it's a user control, dock it.
+ if (control is UserControl)
+ {
+ control.Dock = DockStyle.Fill;
+ control.Margin = new Padding(3);
+ }
+ else
+ {
+ control.Location = new System.Drawing.Point(10, 20);
+ }
+ }
+ }
+
+ if (this.ObjectHandle == null)
+ buttonPermissions.Visible = false;
+ }
+
+ public NativeHandle ObjectHandle
+ {
+ get { return _objectHandle; }
+ set { _objectHandle = value; }
+ }
+
+ private void buttonClose_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void buttonPermissions_Click(object sender, EventArgs e)
+ {
+ if (_objectHandle != null)
+ {
+ try
+ {
+ SecurityEditor.EditSecurity(
+ this,
+ SecurityEditor.GetSecurableWrapper(_objectHandle),
+ _name,
+ NativeTypeFactory.GetAccessEntries(NativeTypeFactory.GetObjectType(_typeName))
+ );
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Unable to edit security: " + ex.Message, "Security Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.resx b/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.resx
similarity index 95%
rename from 1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.resx
rename to 1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.resx
+++ b/1.x/trunk/ProcessHacker.Native/Ui/HandlePropertiesWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker.Native/Windows.cs b/1.x/trunk/ProcessHacker.Native/Windows.cs
index edbff97b4..2cdece6a5 100644
--- a/1.x/trunk/ProcessHacker.Native/Windows.cs
+++ b/1.x/trunk/ProcessHacker.Native/Windows.cs
@@ -63,10 +63,10 @@ namespace ProcessHacker.Native
[ThreadStatic]
private static MemoryAlloc _servicesBuffer;
- private static int _numberOfProcessors;
- private static int _pageSize;
+ private static int _numberOfProcessors = 0;
+ private static int _pageSize = 0;
private static IntPtr _kernelBase = IntPtr.Zero;
- private static string _kernelFileName;
+ private static string _kernelFileName = null;
///
/// Gets the number of active processors.
@@ -141,12 +141,13 @@ namespace ProcessHacker.Native
/// A callback for the enumeration.
public static void EnumKernelModules(EnumKernelModulesDelegate enumCallback)
{
+ NtStatus status;
int retLength;
if (_kernelModulesBuffer == null)
_kernelModulesBuffer = new MemoryAlloc(0x1000);
- NtStatus status = Win32.NtQuerySystemInformation(
+ status = Win32.NtQuerySystemInformation(
SystemInformationClass.SystemModuleInformation,
_kernelModulesBuffer,
_kernelModulesBuffer.Size,
@@ -165,13 +166,14 @@ namespace ProcessHacker.Native
);
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
RtlProcessModules modules = _kernelModulesBuffer.ReadStruct();
for (int i = 0; i < modules.NumberOfModules; i++)
{
- var module = _kernelModulesBuffer.ReadStruct(RtlProcessModules.ModulesOffset, RtlProcessModuleInformation.SizeOf, i);
+ var module = _kernelModulesBuffer.ReadStruct(RtlProcessModules.ModulesOffset, i);
var moduleInfo = new Debugging.ModuleInformation(module);
if (!enumCallback(new KernelModule(
@@ -191,15 +193,17 @@ namespace ProcessHacker.Native
/// A structure containing basic information.
public static SystemBasicInformation GetBasicInformation()
{
+ NtStatus status;
SystemBasicInformation sbi;
int retLength;
- Win32.NtQuerySystemInformation(
+ if ((status = Win32.NtQuerySystemInformation(
SystemInformationClass.SystemBasicInformation,
out sbi,
- SystemBasicInformation.SizeOf,
+ Marshal.SizeOf(typeof(SystemBasicInformation)),
out retLength
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
return sbi;
}
@@ -210,8 +214,8 @@ namespace ProcessHacker.Native
/// An array containing information about the handles.
public static SystemHandleEntry[] GetHandles()
{
- int retLength;
- int handleCount;
+ int retLength = 0;
+ int handleCount = 0;
SystemHandleEntry[] returnHandles;
if (_handlesBuffer == null)
@@ -238,7 +242,8 @@ namespace ProcessHacker.Native
throw new OutOfMemoryException();
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
// The structure of the buffer is the handle count plus an array of SYSTEM_HANDLE_INFORMATION
// structures.
@@ -268,7 +273,7 @@ namespace ProcessHacker.Native
{
IntPtr kernelBase = IntPtr.Zero;
- EnumKernelModules(module =>
+ Windows.EnumKernelModules((module) =>
{
kernelBase = module.BaseAddress;
return false;
@@ -285,7 +290,7 @@ namespace ProcessHacker.Native
{
string kernelFileName = null;
- EnumKernelModules(module =>
+ EnumKernelModules((module) =>
{
kernelFileName = module.FileName;
return false;
@@ -302,7 +307,7 @@ namespace ProcessHacker.Native
{
List kernelModules = new List();
- EnumKernelModules(kernelModule =>
+ EnumKernelModules((kernelModule) =>
{
kernelModules.Add(kernelModule);
return true;
@@ -313,49 +318,53 @@ namespace ProcessHacker.Native
public static SystemLogonSession GetLogonSession(Luid logonId)
{
+ NtStatus status;
IntPtr logonSessionData;
- Win32.LsaGetLogonSessionData(
+ if ((status = Win32.LsaGetLogonSessionData(
ref logonId,
out logonSessionData
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
using (var logonSessionDataAlloc = new LsaMemoryAlloc(logonSessionData, true))
{
var info = logonSessionDataAlloc.ReadStruct();
return new SystemLogonSession(
- info.AuthenticationPackage.Text,
- info.DnsDomainName.Text,
- info.LogonDomain.Text,
+ info.AuthenticationPackage.Read(),
+ info.DnsDomainName.Read(),
+ info.LogonDomain.Read(),
info.LogonId,
- info.LogonServer.Text,
+ info.LogonServer.Read(),
DateTime.FromFileTime(info.LogonTime),
info.LogonType,
info.Session,
new Sid(info.Sid),
- info.Upn.Text,
- info.UserName.Text
+ info.Upn.Read(),
+ info.UserName.Read()
);
}
}
public static Luid[] GetLogonSessions()
{
+ NtStatus status;
int logonSessionCount;
IntPtr logonSessionList;
- Win32.LsaEnumerateLogonSessions(
+ if ((status = Win32.LsaEnumerateLogonSessions(
out logonSessionCount,
out logonSessionList
- ).ThrowIf();
+ )) >= NtStatus.Error)
+ Win32.Throw(status);
Luid[] logonSessions = new Luid[logonSessionCount];
- using (LsaMemoryAlloc logonSessionListAlloc = new LsaMemoryAlloc(logonSessionList, true))
+ using (var logonSessionListAlloc = new LsaMemoryAlloc(logonSessionList, true))
{
for (int i = 0; i < logonSessionCount; i++)
- logonSessions[i] = logonSessionListAlloc.ReadStruct(0, Luid.SizeOf, i);
+ logonSessions[i] = logonSessionListAlloc.ReadStruct(i);
return logonSessions;
}
@@ -368,12 +377,14 @@ namespace ProcessHacker.Native
public static Dictionary> GetNetworkConnections()
{
var retDict = new Dictionary>();
- int length = 0;
+ int length;
// TCP IPv4
+
+ length = 0;
Win32.GetExtendedTcpTable(IntPtr.Zero, ref length, false, AiFamily.INet, TcpTableClass.OwnerPidAll, 0);
- using (MemoryAlloc mem = new MemoryAlloc(length))
+ using (var mem = new MemoryAlloc(length))
{
if (Win32.GetExtendedTcpTable(mem, ref length, false, AiFamily.INet, TcpTableClass.OwnerPidAll, 0) != 0)
Win32.Throw();
@@ -382,12 +393,12 @@ namespace ProcessHacker.Native
for (int i = 0; i < count; i++)
{
- MibTcpRowOwnerPid struc = mem.ReadStruct(sizeof(int), MibTcpRowOwnerPid.SizeOf, i);
+ var struc = mem.ReadStruct(sizeof(int), i);
if (!retDict.ContainsKey(struc.OwningProcessId))
retDict.Add(struc.OwningProcessId, new List());
- retDict[struc.OwningProcessId].Add(new NetworkConnection
+ retDict[struc.OwningProcessId].Add(new NetworkConnection()
{
Protocol = NetworkProtocol.Tcp,
Local = new IPEndPoint(struc.LocalAddress, ((ushort)struc.LocalPort).Reverse()),
@@ -403,7 +414,7 @@ namespace ProcessHacker.Native
length = 0;
Win32.GetExtendedUdpTable(IntPtr.Zero, ref length, false, AiFamily.INet, UdpTableClass.OwnerPid, 0);
- using (MemoryAlloc mem = new MemoryAlloc(length))
+ using (var mem = new MemoryAlloc(length))
{
if (Win32.GetExtendedUdpTable(mem, ref length, false, AiFamily.INet, UdpTableClass.OwnerPid, 0) != 0)
Win32.Throw();
@@ -412,17 +423,18 @@ namespace ProcessHacker.Native
for (int i = 0; i < count; i++)
{
- MibUdpRowOwnerPid struc = mem.ReadStruct(sizeof(int), MibUdpRowOwnerPid.SizeOf, i);
+ var struc = mem.ReadStruct(sizeof(int), i);
if (!retDict.ContainsKey(struc.OwningProcessId))
retDict.Add(struc.OwningProcessId, new List());
- retDict[struc.OwningProcessId].Add(new NetworkConnection
- {
- Protocol = NetworkProtocol.Udp,
- Local = new IPEndPoint(struc.LocalAddress, ((ushort)struc.LocalPort).Reverse()),
- Pid = struc.OwningProcessId
- });
+ retDict[struc.OwningProcessId].Add(
+ new NetworkConnection()
+ {
+ Protocol = NetworkProtocol.Udp,
+ Local = new IPEndPoint(struc.LocalAddress, ((ushort)struc.LocalPort).Reverse()),
+ Pid = struc.OwningProcessId
+ });
}
}
@@ -431,7 +443,7 @@ namespace ProcessHacker.Native
length = 0;
Win32.GetExtendedTcpTable(IntPtr.Zero, ref length, false, AiFamily.INet6, TcpTableClass.OwnerPidAll, 0);
- using (MemoryAlloc mem = new MemoryAlloc(length))
+ using (var mem = new MemoryAlloc(length))
{
if (Win32.GetExtendedTcpTable(mem, ref length, false, AiFamily.INet6, TcpTableClass.OwnerPidAll, 0) == 0)
{
@@ -439,12 +451,12 @@ namespace ProcessHacker.Native
for (int i = 0; i < count; i++)
{
- MibTcp6RowOwnerPid struc = mem.ReadStruct(sizeof(int), MibTcp6RowOwnerPid.SizeOf, i);
+ var struc = mem.ReadStruct(sizeof(int), i);
if (!retDict.ContainsKey(struc.OwningProcessId))
retDict.Add(struc.OwningProcessId, new List());
- retDict[struc.OwningProcessId].Add(new NetworkConnection
+ retDict[struc.OwningProcessId].Add(new NetworkConnection()
{
Protocol = NetworkProtocol.Tcp6,
Local = new IPEndPoint(new IPAddress(struc.LocalAddress, struc.LocalScopeId), ((ushort)struc.LocalPort).Reverse()),
@@ -461,7 +473,7 @@ namespace ProcessHacker.Native
length = 0;
Win32.GetExtendedUdpTable(IntPtr.Zero, ref length, false, AiFamily.INet6, UdpTableClass.OwnerPid, 0);
- using (MemoryAlloc mem = new MemoryAlloc(length))
+ using (var mem = new MemoryAlloc(length))
{
if (Win32.GetExtendedUdpTable(mem, ref length, false, AiFamily.INet6, UdpTableClass.OwnerPid, 0) == 0)
{
@@ -469,17 +481,18 @@ namespace ProcessHacker.Native
for (int i = 0; i < count; i++)
{
- MibUdp6RowOwnerPid struc = mem.ReadStruct(sizeof(int), MibUdp6RowOwnerPid.SizeOf, i);
+ var struc = mem.ReadStruct(sizeof(int), i);
if (!retDict.ContainsKey(struc.OwningProcessId))
retDict.Add(struc.OwningProcessId, new List());
- retDict[struc.OwningProcessId].Add(new NetworkConnection
- {
- Protocol = NetworkProtocol.Udp6,
- Local = new IPEndPoint(new IPAddress(struc.LocalAddress, struc.LocalScopeId), ((ushort)struc.LocalPort).Reverse()),
- Pid = struc.OwningProcessId
- });
+ retDict[struc.OwningProcessId].Add(
+ new NetworkConnection()
+ {
+ Protocol = NetworkProtocol.Udp6,
+ Local = new IPEndPoint(new IPAddress(struc.LocalAddress, struc.LocalScopeId), ((ushort)struc.LocalPort).Reverse()),
+ Pid = struc.OwningProcessId
+ });
}
}
}
@@ -494,6 +507,7 @@ namespace ProcessHacker.Native
public static SystemPagefile[] GetPagefiles()
{
int retLength;
+ List pagefiles = new List();
using (MemoryAlloc data = new MemoryAlloc(0x200))
{
@@ -513,22 +527,23 @@ namespace ProcessHacker.Native
throw new OutOfMemoryException();
}
- status.ThrowIf();
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
- List pagefiles = new List(2);
+ pagefiles = new List(2);
int i = 0;
SystemPagefileInformation currentPagefile;
do
{
- currentPagefile = data.ReadStruct(i, SystemPagefileInformation.SizeOf, 0);
+ currentPagefile = data.ReadStruct(i, 0);
pagefiles.Add(new SystemPagefile(
currentPagefile.TotalSize,
currentPagefile.TotalInUse,
currentPagefile.PeakUsage,
- FileUtils.GetFileName(currentPagefile.PageFileName.Text)
+ FileUtils.GetFileName(currentPagefile.PageFileName.Read())
));
i += currentPagefile.NextEntryOffset;
@@ -555,6 +570,7 @@ namespace ProcessHacker.Native
public static Dictionary GetProcesses(bool getThreads)
{
int retLength;
+ Dictionary returnProcesses;
if (_processesBuffer == null)
_processesBuffer = new MemoryAlloc(0x10000);
@@ -573,7 +589,7 @@ namespace ProcessHacker.Native
data,
data.Size,
out retLength
- )).IsError())
+ )) >= NtStatus.Error)
{
if (attempts > 3)
Win32.Throw(status);
@@ -586,7 +602,7 @@ namespace ProcessHacker.Native
}
}
- Dictionary returnProcesses = new Dictionary(32);
+ returnProcesses = new Dictionary(32); // 32 processes on a computer?
int i = 0;
SystemProcess currentProcess = new SystemProcess();
@@ -599,15 +615,17 @@ namespace ProcessHacker.Native
currentProcess.Process = *(SystemProcessInformation*)((byte*)data.Memory + i);
}
- currentProcess.Name = currentProcess.Process.ImageName.Text;
+ currentProcess.Name = currentProcess.Process.ImageName.Read();
- if (getThreads && currentProcess.Process.ProcessId != 0)
+ if (getThreads &&
+ currentProcess.Process.ProcessId != 0)
{
currentProcess.Threads = new Dictionary();
for (int j = 0; j < currentProcess.Process.NumberOfThreads; j++)
{
- var thread = data.ReadStruct(i + SystemProcessInformation.SizeOf, SystemThreadInformation.SizeOf, j);
+ var thread = data.ReadStruct(i +
+ Marshal.SizeOf(typeof(SystemProcessInformation)), j);
currentProcess.Threads.Add(thread.ClientId.ThreadId, thread);
}
@@ -642,12 +660,8 @@ namespace ProcessHacker.Native
{
attempts++;
- if ((status = Win32.NtQuerySystemInformation(
- SystemInformationClass.SystemProcessInformation,
- data.Memory,
- data.Size,
- out retLength)
- ).IsError())
+ if ((status = Win32.NtQuerySystemInformation(SystemInformationClass.SystemProcessInformation, data.Memory,
+ data.Size, out retLength)) >= NtStatus.Error)
{
if (attempts > 3)
Win32.Throw(status);
@@ -673,11 +687,12 @@ namespace ProcessHacker.Native
if (process.ProcessId == pid)
{
- Dictionary threads = new Dictionary();
+ var threads = new Dictionary();
for (int j = 0; j < process.NumberOfThreads; j++)
{
- SystemThreadInformation thread = data.ReadStruct(i + SystemProcessInformation.SizeOf, SystemThreadInformation.SizeOf, j);
+ var thread = data.ReadStruct(i +
+ Marshal.SizeOf(typeof(SystemProcessInformation)), j);
if (pid != 0)
{
@@ -708,7 +723,8 @@ namespace ProcessHacker.Native
/// A dictionary, indexed by service name.
public static Dictionary GetServices()
{
- using (ServiceManagerHandle manager = new ServiceManagerHandle(ScManagerAccess.EnumerateService))
+ using (ServiceManagerHandle manager =
+ new ServiceManagerHandle(ScManagerAccess.EnumerateService))
{
int requiredSize;
int servicesReturned;
@@ -720,21 +736,25 @@ namespace ProcessHacker.Native
MemoryAlloc data = _servicesBuffer;
if (!Win32.EnumServicesStatusEx(manager, IntPtr.Zero, ServiceQueryType.Win32 | ServiceQueryType.Driver,
- ServiceQueryState.All, data, data.Size, out requiredSize, out servicesReturned, ref resume, null))
+ ServiceQueryState.All, data,
+ data.Size, out requiredSize, out servicesReturned,
+ ref resume, null))
{
// resize buffer
data.ResizeNew(requiredSize);
if (!Win32.EnumServicesStatusEx(manager, IntPtr.Zero, ServiceQueryType.Win32 | ServiceQueryType.Driver,
- ServiceQueryState.All, data, data.Size, out requiredSize, out servicesReturned, ref resume, null))
+ ServiceQueryState.All, data,
+ data.Size, out requiredSize, out servicesReturned,
+ ref resume, null))
Win32.Throw();
}
- Dictionary dictionary = new Dictionary(servicesReturned);
+ var dictionary = new Dictionary(servicesReturned);
for (int i = 0; i < servicesReturned; i++)
{
- EnumServiceStatusProcess service = data.ReadStruct(0, EnumServiceStatusProcess.SizeOf, i);
+ var service = data.ReadStruct(i);
dictionary.Add(service.ServiceName, service);
}
@@ -750,12 +770,15 @@ namespace ProcessHacker.Native
public static long GetTickCount()
{
// Read the tick count multiplier.
- int tickCountMultiplier = Marshal.ReadInt32(Win32.UserSharedData.Increment(KUserSharedData.TickCountMultiplierOffset));
+ int tickCountMultiplier = Marshal.ReadInt32(Win32.UserSharedData.Increment(
+ KUserSharedData.TickCountMultiplierOffset));
// Read the tick count.
- var tickCount = QueryKSystemTime(Win32.UserSharedData.Increment(KUserSharedData.TickCountOffset));
+ var tickCount = QueryKSystemTime(Win32.UserSharedData.Increment(
+ KUserSharedData.TickCountOffset));
- return ((tickCount.LowPart * tickCountMultiplier) >> 24) + (((long)tickCount.HighPart * tickCountMultiplier) << 8);
+ return (((long)tickCount.LowPart * tickCountMultiplier) >> (int)24) +
+ (((long)tickCount.HighPart * tickCountMultiplier) << (int)8);
}
///
@@ -764,15 +787,19 @@ namespace ProcessHacker.Native
/// A time of day structure.
public static SystemTimeOfDayInformation GetTimeOfDay()
{
+ NtStatus status;
SystemTimeOfDayInformation timeOfDay;
int retLength;
- Win32.NtQuerySystemInformation(
+ status = Win32.NtQuerySystemInformation(
SystemInformationClass.SystemTimeOfDayInformation,
out timeOfDay,
- SystemTimeOfDayInformation.SizeOf,
+ Marshal.SizeOf(typeof(SystemTimeOfDayInformation)),
out retLength
- ).ThrowIf();
+ );
+
+ if (status >= NtStatus.Error)
+ Win32.Throw(status);
return timeOfDay;
}
@@ -794,11 +821,15 @@ namespace ProcessHacker.Native
/// The service name of the driver.
public static void LoadDriver(string serviceName)
{
- UnicodeString str = new UnicodeString("\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\" + serviceName);
+ var str = new UnicodeString(
+ "\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\" + serviceName);
try
{
- Win32.NtLoadDriver(ref str).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtLoadDriver(ref str)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -811,9 +842,12 @@ namespace ProcessHacker.Native
///
/// A pointer to a KSYSTEM_TIME value.
/// A 64-bit time value.
- private unsafe static LargeInteger QueryKSystemTime(IntPtr time)
+ private static LargeInteger QueryKSystemTime(IntPtr time)
{
- return QueryKSystemTime((KSystemTime*)time);
+ unsafe
+ {
+ return QueryKSystemTime((KSystemTime*)time);
+ }
}
///
@@ -860,11 +894,15 @@ namespace ProcessHacker.Native
/// The service name of the driver.
public static void UnloadDriver(string serviceName)
{
- UnicodeString str = new UnicodeString("\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\" + serviceName);
+ var str = new UnicodeString(
+ "\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\" + serviceName);
try
{
- Win32.NtUnloadDriver(ref str).ThrowIf();
+ NtStatus status;
+
+ if ((status = Win32.NtUnloadDriver(ref str)) >= NtStatus.Error)
+ Win32.Throw(status);
}
finally
{
@@ -899,7 +937,7 @@ namespace ProcessHacker.Native
public void CloseTcpConnection()
{
- MibTcpRow row = new MibTcpRow
+ MibTcpRow row = new MibTcpRow()
{
State = MibTcpState.DeleteTcb,
LocalAddress = (uint)this.Local.Address.Address,
@@ -907,7 +945,6 @@ namespace ProcessHacker.Native
RemoteAddress = this.Remote != null ? (uint)this.Remote.Address.Address : 0,
RemotePort = this.Remote != null ? ((ushort)this.Remote.Port).Reverse() : 0
};
-
int result = Win32.SetTcpEntry(ref row);
if (result != 0)
diff --git a/1.x/trunk/ProcessHacker.Native/WindowsException.cs b/1.x/trunk/ProcessHacker.Native/WindowsException.cs
index 0c196795e..74dd7cfcd 100644
--- a/1.x/trunk/ProcessHacker.Native/WindowsException.cs
+++ b/1.x/trunk/ProcessHacker.Native/WindowsException.cs
@@ -35,10 +35,10 @@ namespace ProcessHacker.Native
///
public class WindowsException : Exception
{
- private readonly bool _isNtStatus;
- private readonly Win32Error _errorCode = 0;
- private readonly NtStatus _status;
- private string _message;
+ private bool _isNtStatus = false;
+ private Win32Error _errorCode = 0;
+ private NtStatus _status;
+ private string _message = null;
///
/// Creates an exception with no error.
@@ -99,7 +99,7 @@ namespace ProcessHacker.Native
{
// No locking, for performance reasons. Getting the
// message doesn't have any side-effects anyway.
- if (string.IsNullOrEmpty(_message))
+ if (_message == null)
{
// We prefer native status messages because they are usually
// more detailed. However, for some status values we do
@@ -113,7 +113,7 @@ namespace ProcessHacker.Native
{
string message = _status.GetMessage();
- if (string.IsNullOrEmpty(message))
+ if (message == null)
message = "Could not retrieve the error message (0x" + ((int)_status).ToString("x") + ").";
_message = message;
diff --git a/1.x/trunk/ProcessHacker.Native/app.config b/1.x/trunk/ProcessHacker.Native/app.config
index b4ca687d2..89dc7d426 100644
--- a/1.x/trunk/ProcessHacker.Native/app.config
+++ b/1.x/trunk/ProcessHacker.Native/app.config
@@ -1,3 +1,3 @@
-
+
diff --git a/1.x/trunk/ProcessHacker.sln b/1.x/trunk/ProcessHacker.sln
index b7f653106..fc6e4066e 100644
--- a/1.x/trunk/ProcessHacker.sln
+++ b/1.x/trunk/ProcessHacker.sln
@@ -1,12 +1,14 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessHacker", "ProcessHacker\ProcessHacker.csproj", "{EEEA1778-1702-4964-8793-A98FE37E4D2B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessHacker.Common", "ProcessHacker.Common\ProcessHacker.Common.csproj", "{8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProcessHacker.Native", "ProcessHacker.Native\ProcessHacker.Native.csproj", "{8A448157-E1A7-4DDF-954E-287F1117832B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aga.Controls", "TreeViewAdv\Aga.Controls.csproj", "{E73BB233-D88B-44A7-A98F-D71EE158381D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -25,6 +27,10 @@ Global
{8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A448157-E1A7-4DDF-954E-287F1117832B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A448157-E1A7-4DDF-954E-287F1117832B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E73BB233-D88B-44A7-A98F-D71EE158381D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E73BB233-D88B-44A7-A98F-D71EE158381D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E73BB233-D88B-44A7-A98F-D71EE158381D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E73BB233-D88B-44A7-A98F-D71EE158381D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/1.x/trunk/ProcessHacker/Common/CircularBuffer.cs b/1.x/trunk/ProcessHacker/Common/CircularBuffer.cs
deleted file mode 100644
index 06e37d491..000000000
--- a/1.x/trunk/ProcessHacker/Common/CircularBuffer.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections;
-
-namespace ProcessHacker.Common
-{
- ///
- /// A Less than perfect CircularList.
- ///
- ///
- public class CircularList : IList
- {
- private List data = new List();
- public int Max;
-
- // TODO: rewrite entire class at some stage.
- public CircularList(int max)
- {
- this.Max = max;
- }
-
- public int Count { get { return data.Count; } }
-
- public T this[int index]
- {
- get { return this.data[index]; }
- set { this.data[index] = value; }
- }
-
- public void Add(T item)
- {
- //Less than perfect.
- if (this.data.Count >= this.Max)
- {
- this.data.RemoveRange(0, this.data.Count - this.Max);
-
- for (int i = 0; i <= this.data.Count - 2; i++)
- {
- this.data[i] = this.data[i + 1];
- }
- this.data[this.data.Count - 1] = item;
- }
- else
- {
- this.data.Add(item);
- }
- }
-
- public int IndexOf(T item)
- {
- throw new NotImplementedException();
- }
-
- public void Insert(int index, T item)
- {
- throw new NotImplementedException();
- }
-
- public void RemoveAt(int index)
- {
- throw new NotImplementedException();
- }
-
- public void Clear()
- {
- data.Clear();
- }
-
- public bool Contains(T item)
- {
- return data.Contains(item);
- }
-
- public void CopyTo(T[] array, int arrayIndex)
- {
- throw new NotImplementedException();
- }
-
- public bool IsReadOnly
- {
- get { throw new NotImplementedException(); }
- }
-
- public bool Remove(T item)
- {
- return data.Remove(item);
- }
-
- public IEnumerator GetEnumerator()
- {
- return data.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return data.GetEnumerator();
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Common/Extensions.cs b/1.x/trunk/ProcessHacker/Common/Extensions.cs
index caa1ee85c..7368f0440 100644
--- a/1.x/trunk/ProcessHacker/Common/Extensions.cs
+++ b/1.x/trunk/ProcessHacker/Common/Extensions.cs
@@ -22,20 +22,9 @@
using System;
using System.Collections.Generic;
-using System.Drawing;
-using System.Windows.Forms;
-using ProcessHacker.Native.Api;
namespace ProcessHacker.Common
{
- public static class StringExtensions
- {
- public static bool Contains(this string source, string toCheck, StringComparison comp)
- {
- return source.IndexOf(toCheck, comp) >= 0;
- }
- }
-
public static class LongExtensions
{
///
@@ -95,141 +84,4 @@ namespace ProcessHacker.Common
return newList;
}
}
-
- ///
- /// MeasureText cache.
- /// Cache the calls to MeasureText as this only needs to be called once.
- ///
- /// Invalidate the cache if UI changes (i.e. DPI)
- public static class TextSizeCache
- {
- private static readonly Dictionary SizeCache = new Dictionary();
-
- public static Size GetCachedSize(this Graphics device, string str, Font font)
- {
- if (SizeCache.ContainsKey(str))
- {
- return SizeCache[str];
- }
-
- // we only need to Measure the string once, so we cache it.
- Size strSize = TextRenderer.MeasureText(device, str, font);
-
- SizeCache.Add(str, strSize);
-
- return strSize;
- }
-
- public static void InvalidateCache()
- {
- SizeCache.Clear();
- }
- }
-
- public static class ControlExtensions
- {
- ///
- /// An application sends the WM_CHANGEUISTATE message to indicate that the UI state should be changed.
- ///
- /// Value: 0x0127
- public const int WM_CHANGEUISTATE = 295;
-
- ///
- /// An application sends the WM_UPDATEUISTATE message to change the UI state for the specified window and all its child windows.
- ///
- /// Value: 0x0128
- public const int WM_UPDATEUISTATE = 296;
-
- public enum UIS_Flags
- {
- ///
- /// The UI state flags specified by the high-order word should be set.
- ///
- UIS_SET = 1,
-
- ///
- /// The UI state flags specified by the high-order word should be cleared.
- ///
- UIS_CLEAR = 2,
-
- ///
- /// The UI state flags specified by the high-order word should be changed based on the last input event. For more information, see Remarks.
- ///
- UIS_INITIALIZE = 3
- }
-
- [Flags]
- public enum UISF_Flags
- {
- UISF_HIDEFOCUS = 0x1,
- UISF_HIDEACCEL = 0x2,
- UISF_ACTIVE = 0x4
- }
-
- public static void MakeAcceleratorsVisible(this Control c)
- {
- Win32.SendMessage(c.Handle, (WindowMessage)WM_CHANGEUISTATE, (IntPtr)MakeLong((int)UIS_Flags.UIS_CLEAR, (int)UISF_Flags.UISF_HIDEACCEL), IntPtr.Zero);
- }
-
- public static void MakeAcceleratorsInvisible(this Control c)
- {
- Win32.SendMessage(c.Handle, (WindowMessage)WM_CHANGEUISTATE, (IntPtr)MakeLong((int)UIS_Flags.UIS_SET, (int)UISF_Flags.UISF_HIDEACCEL), IntPtr.Zero);
- }
-
- public static void MakeFocusVisible(this Control c)
- {
- Win32.SendMessage(c.Handle, (WindowMessage)WM_CHANGEUISTATE, (IntPtr)MakeLong((int)UIS_Flags.UIS_CLEAR, (int)UISF_Flags.UISF_HIDEFOCUS), IntPtr.Zero);
- }
-
- public static void MakeFocusInvisible(this Control c)
- {
- Win32.SendMessage(c.Handle, (WindowMessage)WM_CHANGEUISTATE, (IntPtr)MakeLong((int)UIS_Flags.UIS_SET, (int)UISF_Flags.UISF_HIDEFOCUS), IntPtr.Zero);
- }
-
- public static void MakeActiveVisible(this Control c)
- {
- Win32.SendMessage(c.Handle, (WindowMessage)WM_CHANGEUISTATE, (IntPtr)MakeLong((int)UIS_Flags.UIS_SET, (int)UISF_Flags.UISF_ACTIVE), IntPtr.Zero);
- }
-
- public static void MakeActiveInvisible(this Control c)
- {
- Win32.SendMessage(c.Handle, (WindowMessage)WM_CHANGEUISTATE, (IntPtr)MakeLong((int)UIS_Flags.UIS_CLEAR, (int)UISF_Flags.UISF_ACTIVE), IntPtr.Zero);
- }
-
- private static int MakeLong(int loWord, int hiWord)
- {
- return (hiWord << 16) | (loWord & 0xffff);
- }
-
- public static int LoWord(int number)
- {
- return number & 0xffff;
- }
-
- //private int WM_CHANGEUISTATE = 0x127;
-
- //private enum WM_CHANGEUISTATE_low : short
- //{
- // UIS_CLEAR = 2,
- // UIS_INITIALIZE = 3,
- // UIS_SET = 1
- //}
-
- //private enum WM_CHANGEUISTATE_high : short
- //{
- // UISF_HIDEACCEL = 0x2,
- // UISF_HIDEFOCUS = 0x1,
- // UISF_ACTIVE = 4
- //}
-
- //private enum WM_CHANGEUISTATE : int
- //{
- // UIS_CLEAR = WM_CHANGEUISTATE_low.UIS_CLEAR,
- // UIS_INITIALIZE = WM_CHANGEUISTATE_low.UIS_INITIALIZE,
- // UIS_SET = WM_CHANGEUISTATE_low.UIS_SET,
- // UISF_HIDEACCEL = Convert.ToInt32(WM_CHANGEUISTATE_high.UISF_HIDEACCEL) << 16,
- // UISF_HIDEFOCUS = Convert.ToInt32(WM_CHANGEUISTATE_high.UISF_HIDEFOCUS) << 16,
- // UISF_ACTIVE = Convert.ToInt32(WM_CHANGEUISTATE_high.UISF_ACTIVE) << 16
- //}
- }
}
diff --git a/1.x/trunk/ProcessHacker/Common/PhUtils.cs b/1.x/trunk/ProcessHacker/Common/PhUtils.cs
index 8cf46b47c..f645511b2 100644
--- a/1.x/trunk/ProcessHacker/Common/PhUtils.cs
+++ b/1.x/trunk/ProcessHacker/Common/PhUtils.cs
@@ -31,14 +31,13 @@ using ProcessHacker.Components;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
-using ProcessHacker.Native.Security;
using ProcessHacker.UI;
namespace ProcessHacker.Common
{
public static class PhUtils
{
- public static readonly string[] DangerousNames =
+ public static string[] DangerousNames =
{
"csrss.exe", "dwm.exe", "logonui.exe", "lsass.exe", "lsm.exe", "services.exe",
"smss.exe", "wininit.exe", "winlogon.exe"
@@ -60,27 +59,28 @@ namespace ProcessHacker.Common
/// A virtual item handler, if any.
public static void AddShortcuts(this ListView lv, RetrieveVirtualItemEventHandler retrieveVirtualItem)
{
- lv.KeyDown += (sender, e) =>
- {
- if (e.Control && e.KeyCode == Keys.A)
+ lv.KeyDown +=
+ (sender, e) =>
{
- if (retrieveVirtualItem != null)
+ if (e.Control && e.KeyCode == Keys.A)
{
- for (int i = 0; i < lv.VirtualListSize; i++)
- if (!lv.SelectedIndices.Contains(i))
- lv.SelectedIndices.Add(i);
+ if (retrieveVirtualItem != null)
+ {
+ for (int i = 0; i < lv.VirtualListSize; i++)
+ if (!lv.SelectedIndices.Contains(i))
+ lv.SelectedIndices.Add(i);
+ }
+ else
+ {
+ lv.Items.SelectAll();
+ }
}
- else
- {
- lv.Items.SelectAll();
- }
- }
- if (e.Control && e.KeyCode == Keys.C)
- {
- GenericViewMenu.ListViewCopy(lv, -1, retrieveVirtualItem);
- }
- };
+ if (e.Control && e.KeyCode == Keys.C)
+ {
+ GenericViewMenu.ListViewCopy(lv, -1, retrieveVirtualItem);
+ }
+ };
}
///
@@ -95,11 +95,13 @@ namespace ProcessHacker.Common
try
{
- using (ProcessHandle phandle = new ProcessHandle(pid, OSVersion.MinProcessQueryInfoAccess))
+ using (var phandle = new ProcessHandle(pid, OSVersion.MinProcessQueryInfoAccess))
{
foreach (string s in DangerousNames)
{
- if ((Environment.SystemDirectory + "\\" + s).Equals(FileUtils.GetFileName(FileUtils.GetFileName(phandle.ImageFileName)), StringComparison.OrdinalIgnoreCase))
+ if ((Environment.SystemDirectory + "\\" + s).Equals(
+ FileUtils.GetFileName(FileUtils.GetFileName(phandle.GetImageFileName())),
+ StringComparison.OrdinalIgnoreCase))
{
return true;
}
@@ -123,9 +125,9 @@ namespace ProcessHacker.Common
private static string FormatException(string operation, Exception ex)
{
if (!string.IsNullOrEmpty(operation))
- return operation + ": " + ex.Message + (ex.InnerException != null ? " (" + ex.InnerException.Message + ")" : string.Empty);
-
- return ex.Message + (ex.InnerException != null ? " (" + ex.InnerException.Message + ")" : string.Empty);
+ return operation + ": " + ex.Message + (ex.InnerException != null ? " (" + ex.InnerException.Message + ")" : "");
+ else
+ return ex.Message + (ex.InnerException != null ? " (" + ex.InnerException.Message + ")" : "");
}
public static string FormatFileInfo(
@@ -183,17 +185,18 @@ namespace ProcessHacker.Common
return "Normal";
case ProcessPriorityClass.RealTime:
return "Realtime";
+ case ProcessPriorityClass.Unknown:
default:
- return string.Empty;
+ return "";
}
}
public static string GetBestUserName(string userName, bool includeDomain)
{
- if (string.IsNullOrEmpty(userName))
- return string.Empty;
+ if (userName == null)
+ return "";
- if (!userName.Contains("\\", StringComparison.OrdinalIgnoreCase))
+ if (!userName.Contains("\\"))
return userName;
string[] split = userName.Split(new char[] { '\\' }, 2);
@@ -202,8 +205,8 @@ namespace ProcessHacker.Common
if (includeDomain)
return domain + "\\" + user;
-
- return user;
+ else
+ return user;
}
///
@@ -219,8 +222,8 @@ namespace ProcessHacker.Common
{
if (backColor.GetBrightness() > 0.4)
return Color.Black;
-
- return Color.White;
+ else
+ return Color.White;
}
public static IWin32Window GetForegroundWindow()
@@ -228,49 +231,40 @@ namespace ProcessHacker.Common
var window = WindowHandle.GetForegroundWindow();
// Make sure the foreground window belongs to us.
- if (window.ClientId.ProcessId == ProcessHandle.CurrentId)
+ if (window.GetClientId().ProcessId == ProcessHandle.GetCurrentId())
return window;
-
- return new WindowFromHandle(Program.HackerWindowHandle);
+ else
+ return new WindowFromHandle(Program.HackerWindowHandle);
}
public static string GetIntegrity(this TokenHandle tokenHandle, out int integrityLevel)
{
- var groups = tokenHandle.Groups;
+ var groups = tokenHandle.GetGroups();
string integrity = null;
integrityLevel = 0;
- foreach (Sid t in groups)
+ for (int i = 0; i < groups.Length; i++)
{
- if ((t.Attributes & SidAttributes.IntegrityEnabled) != 0)
+ if ((groups[i].Attributes & SidAttributes.IntegrityEnabled) != 0)
{
- integrity = t.GetFullName(false).Replace(" Mandatory Level", string.Empty);
+ integrity = groups[i].GetFullName(false).Replace(" Mandatory Level", "");
- switch (integrity)
- {
- case "Untrusted":
- integrityLevel = 0;
- break;
- case "Low":
- integrityLevel = 1;
- break;
- case "Medium":
- integrityLevel = 2;
- break;
- case "High":
- integrityLevel = 3;
- break;
- case "System":
- integrityLevel = 4;
- break;
- case "Installer":
- integrityLevel = 5;
- break;
- }
+ if (integrity == "Untrusted")
+ integrityLevel = 0;
+ else if (integrity == "Low")
+ integrityLevel = 1;
+ else if (integrity == "Medium")
+ integrityLevel = 2;
+ else if (integrity == "High")
+ integrityLevel = 3;
+ else if (integrity == "System")
+ integrityLevel = 4;
+ else if (integrity == "Installer")
+ integrityLevel = 5;
}
- t.Dispose();
+ groups[i].Dispose();
}
return integrity;
@@ -350,7 +344,7 @@ namespace ProcessHacker.Common
{
try
{
- IPHostEntry entry = Dns.GetHostEntry("www.msftncsi.com");
+ System.Net.IPHostEntry entry = System.Net.Dns.GetHostEntry("www.msftncsi.com");
return true;
//http://www.msftncsi.com/ncsi.txt
@@ -399,13 +393,13 @@ namespace ProcessHacker.Common
string lastKey = keyName;
// Expand the abbreviations.
- if (lastKey.StartsWith("hkcu", StringComparison.OrdinalIgnoreCase))
+ if (lastKey.ToLowerInvariant().StartsWith("hkcu"))
lastKey = "HKEY_CURRENT_USER" + lastKey.Substring(4);
- else if (lastKey.StartsWith("hku", StringComparison.OrdinalIgnoreCase))
+ else if (lastKey.ToLowerInvariant().StartsWith("hku"))
lastKey = "HKEY_USERS" + lastKey.Substring(3);
- else if (lastKey.StartsWith("hkcr", StringComparison.OrdinalIgnoreCase))
+ else if (lastKey.ToLowerInvariant().StartsWith("hkcr"))
lastKey = "HKEY_CLASSES_ROOT" + lastKey.Substring(4);
- else if (lastKey.StartsWith("hklm", StringComparison.OrdinalIgnoreCase))
+ else if (lastKey.ToLowerInvariant().StartsWith("hklm"))
lastKey = "HKEY_LOCAL_MACHINE" + lastKey.Substring(4);
// Set the last opened key in regedit config. Note that if we are on
@@ -431,7 +425,7 @@ namespace ProcessHacker.Common
{
Program.StartProgramAdmin(
Environment.SystemDirectory + "\\..\\regedit.exe",
- string.Empty,
+ "",
null,
ShowWindowType.Normal,
window != null ? window.Handle : IntPtr.Zero
@@ -459,7 +453,21 @@ namespace ProcessHacker.Common
/// Whether the shield icon is visible.
public static void SetShieldIcon(this Button button, bool visible)
{
- Win32.SendMessage(button.Handle, WindowMessage.BcmSetShield, IntPtr.Zero, visible ? (IntPtr)1 : IntPtr.Zero);
+ Win32.SendMessage(button.Handle, WindowMessage.BcmSetShield, 0, visible ? 1 : 0);
+ }
+
+ ///
+ /// Sets the theme of a control.
+ ///
+ /// The control to modify.
+ /// A name of a theme.
+ public static void SetTheme(this Control control, string theme)
+ {
+ // Don't set on XP, doesn't look better than without SetWindowTheme.
+ if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
+ {
+ Win32.SetWindowTheme(control.Handle, theme, null);
+ }
}
///
@@ -500,13 +508,11 @@ namespace ProcessHacker.Common
if (OSVersion.HasTaskDialogs)
{
- TaskDialog td = new TaskDialog
- {
- WindowTitle = "Process Hacker",
- MainIcon = warning ? TaskDialogIcon.Warning : TaskDialogIcon.None,
- MainInstruction = "Do you want to " + action + "?",
- PositionRelativeToWindow = true
- };
+ TaskDialog td = new TaskDialog();
+
+ td.WindowTitle = "Process Hacker";
+ td.MainIcon = warning ? TaskDialogIcon.Warning : TaskDialogIcon.None;
+ td.MainInstruction = "Do you want to " + action + "?";
if (!string.IsNullOrEmpty(message))
td.Content = message + " Are you sure you want to continue?";
@@ -518,15 +524,17 @@ namespace ProcessHacker.Common
};
td.DefaultButton = (int)DialogResult.No;
- return td.Show(GetForegroundWindow()) == (int)DialogResult.Yes;
+ return td.Show(PhUtils.GetForegroundWindow()) == (int)DialogResult.Yes;
+ }
+ else
+ {
+ return MessageBox.Show(
+ message + " Are you sure you want to " + action + "?",
+ "Process Hacker",
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Warning
+ ) == DialogResult.Yes;
}
-
- return MessageBox.Show(
- message + " Are you sure you want to " + action + "?",
- "Process Hacker",
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Warning
- ) == DialogResult.Yes;
}
///
@@ -573,7 +581,7 @@ namespace ProcessHacker.Common
#else
MessageBox.Show(
PhUtils.GetForegroundWindow(),
- operation + "\n\n" + ex,
+ operation + "\n\n" + ex.ToString(),
"Process Hacker",
MessageBoxButtons.OK,
MessageBoxIcon.Error
diff --git a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DataMap.cs b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DataMap.cs
index 46fc12ef7..f8fbccfcd 100644
--- a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DataMap.cs
+++ b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DataMap.cs
@@ -249,10 +249,10 @@ namespace Be.Windows.Forms
#region Enumerator Nested Type
internal class Enumerator : IEnumerator, IDisposable
{
- readonly DataMap _map;
+ DataMap _map;
DataBlock _current;
int _index;
- readonly int _version;
+ int _version;
internal Enumerator(DataMap map)
{
diff --git a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/Design/HexFontEditor.cs b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/Design/HexFontEditor.cs
index cb4312b0e..e7bba5675 100644
--- a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/Design/HexFontEditor.cs
+++ b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/Design/HexFontEditor.cs
@@ -13,7 +13,14 @@ namespace Be.Windows.Forms.Design
{
object value;
- ///
+ ///
+ /// Initializes an instance of HexFontEditor class.
+ ///
+ public HexFontEditor()
+ {
+ }
+
+ ///
/// Edits the value
///
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
@@ -24,18 +31,16 @@ namespace Be.Windows.Forms.Design
IWindowsFormsEditorService service1 = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
if (service1 != null)
{
- FontDialog fontDialog = new FontDialog
- {
- ShowApply = false,
- ShowColor = false,
- AllowVerticalFonts = false,
- AllowScriptChange = false,
- FixedPitchOnly = true,
- ShowEffects = false,
- ShowHelp = false
- };
+ FontDialog fontDialog = new FontDialog();
+ fontDialog.ShowApply = false;
+ fontDialog.ShowColor = false;
+ fontDialog.AllowVerticalFonts = false;
+ fontDialog.AllowScriptChange = false;
+ fontDialog.FixedPitchOnly = true;
+ fontDialog.ShowEffects = false;
+ fontDialog.ShowHelp = false;
- Font font = value as Font;
+ Font font = value as Font;
if(font != null)
{
fontDialog.Font = font;
@@ -52,11 +57,14 @@ namespace Be.Windows.Forms.Design
value = this.value;
this.value = null;
return value;
+
}
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
+
+
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DynamicByteProvider.cs b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DynamicByteProvider.cs
index 3d79b4ce6..7d09177c0 100644
--- a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DynamicByteProvider.cs
+++ b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/DynamicByteProvider.cs
@@ -14,7 +14,7 @@ namespace Be.Windows.Forms
///
/// Contains a byte collection.
///
- readonly ByteCollection _bytes;
+ ByteCollection _bytes;
///
/// Initializes a new instance of the DynamicByteProvider class.
diff --git a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/FileByteProvider.cs b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/FileByteProvider.cs
index e59f0aa67..6ae12babc 100644
--- a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/FileByteProvider.cs
+++ b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/FileByteProvider.cs
@@ -53,7 +53,7 @@ namespace Be.Windows.Forms
///
/// Contains all changes
///
- readonly WriteCollection _writes = new WriteCollection();
+ WriteCollection _writes = new WriteCollection();
///
/// Contains the file name.
@@ -66,7 +66,7 @@ namespace Be.Windows.Forms
///
/// Read-only access.
///
- readonly bool _readOnly;
+ bool _readOnly;
///
/// Initializes a new instance of the FileByteProvider class.
diff --git a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.cs b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.cs
index 1f2371657..6aa75f59f 100644
--- a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.cs
+++ b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.cs
@@ -1,11 +1,11 @@
using System;
using System.Drawing;
using System.Windows.Forms;
+using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Security.Permissions;
using System.Windows.Forms.VisualStyles;
using Be.Windows.Forms.Design;
-using ProcessHacker;
namespace Be.Windows.Forms
{
@@ -41,16 +41,12 @@ namespace Be.Windows.Forms
public int CharacterPosition
{
get { return _characterPosition; }
- }
-
- readonly int _characterPosition;
+ } int _characterPosition;
public long Index
{
get { return _index; }
- }
-
- readonly long _index;
+ } long _index;
}
#endregion
@@ -108,7 +104,7 @@ namespace Be.Windows.Forms
///
class EmptyKeyInterpreter : IKeyInterpreter
{
- readonly HexBox _hexBox;
+ HexBox _hexBox;
public EmptyKeyInterpreter(HexBox hexBox)
{
@@ -145,12 +141,12 @@ namespace Be.Windows.Forms
///
/// Contains the parent HexBox control
///
- protected readonly HexBox _hexBox;
+ protected HexBox _hexBox;
///
/// Contains True, if shift key is down
///
- bool _shiftDown;
+ protected bool _shiftDown;
///
/// Contains True, if mouse is down
///
@@ -824,9 +820,11 @@ namespace Be.Windows.Forms
#region PreProcessWmKeyUp methods
public virtual bool PreProcessWmKeyUp(ref Message m)
{
+ System.Diagnostics.Debug.WriteLine("PreProcessWmKeyUp(ref Message m)", "KeyInterpreter");
+
Keys vc = (Keys)m.WParam.ToInt32();
- Keys keyData = vc | ModifierKeys;
+ Keys keyData = vc | Control.ModifierKeys;
switch(keyData)
{
@@ -856,7 +854,7 @@ namespace Be.Windows.Forms
return true;
}
- private bool RaiseKeyUp(Keys keyData)
+ protected bool RaiseKeyUp(Keys keyData)
{
KeyEventArgs e = new KeyEventArgs(keyData);
_hexBox.OnKeyUp(e);
@@ -974,12 +972,13 @@ namespace Be.Windows.Forms
protected virtual bool PerformPosMoveRightByte()
{
long pos = _hexBox._bytePos;
+ int cp = _hexBox._byteCharacterPos;
- if(pos == _hexBox._byteProvider.Length)
+ if(pos == _hexBox._byteProvider.Length)
return true;
pos = Math.Min(_hexBox._byteProvider.Length, pos+1);
- int cp = 0;
+ cp = 0;
_hexBox.SetPosition(pos, cp);
@@ -1159,7 +1158,7 @@ namespace Be.Windows.Forms
///
/// Contains string format information for text drawing
///
- readonly StringFormat _stringFormat;
+ StringFormat _stringFormat;
///
/// Contains the width and height of a single char
///
@@ -1193,11 +1192,11 @@ namespace Be.Windows.Forms
///
/// Contains a vertical scroll
///
- readonly VScrollBar _vScrollBar;
+ VScrollBar _vScrollBar;
///
/// Contains a timer for thumbtrack scrolling
///
- readonly Timer _thumbTrackTimer = new Timer();
+ Timer _thumbTrackTimer = new Timer();
///
/// Contains the thumbtrack scrolling position
///
@@ -1383,22 +1382,22 @@ namespace Be.Windows.Forms
public HexBox()
{
this._vScrollBar = new VScrollBar();
- this._vScrollBar.Scroll += this._vScrollBar_Scroll;
+ this._vScrollBar.Scroll += new ScrollEventHandler(_vScrollBar_Scroll);
- this.BackColor = Color.White;
- this.Font = Settings.Instance.Font;
+ BackColor = Color.White;
+ Font = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
+ _stringFormat = new StringFormat(StringFormat.GenericTypographic);
+ _stringFormat.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
- this._stringFormat = new StringFormat(StringFormat.GenericTypographic)
- {
- FormatFlags = StringFormatFlags.MeasureTrailingSpaces
- };
+ ActivateEmptyKeyInterpreter();
+
+ SetStyle(ControlStyles.UserPaint, true);
+ SetStyle(ControlStyles.DoubleBuffer, true);
+ SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle(ControlStyles.ResizeRedraw, true);
- this.ActivateEmptyKeyInterpreter();
-
- this.SetStyle(ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
-
- _thumbTrackTimer.Interval = 1000;
- _thumbTrackTimer.Tick += this.PerformScrollThumbTrack;
+ _thumbTrackTimer.Interval = 50;
+ _thumbTrackTimer.Tick += new EventHandler(PerformScrollThumbTrack);
}
#endregion
@@ -1434,7 +1433,7 @@ namespace Be.Windows.Forms
_thumbTrackTimer.Enabled = false;
// perform scroll immediately only if last refresh is very old
- int currentThumbTrack = Environment.TickCount;
+ int currentThumbTrack = System.Environment.TickCount;
if (currentThumbTrack - _lastThumbtrack > THUMPTRACKDELAY)
{
PerformScrollThumbTrack(null, null);
@@ -1448,6 +1447,8 @@ namespace Be.Windows.Forms
break;
case ScrollEventType.First:
break;
+ default:
+ break;
}
e.NewValue = ToScrollPos(_scrollVpos);
@@ -1470,7 +1471,7 @@ namespace Be.Windows.Forms
// calc scroll bar info
if(VScrollBarVisible && _byteProvider != null && _byteProvider.Length > 0 && _iHexMaxHBytes != 0)
{
- long scrollmax = (long)Math.Ceiling(this._byteProvider.Length / (double)_iHexMaxHBytes - this._iHexMaxVBytes);
+ long scrollmax = (long)Math.Ceiling((double)_byteProvider.Length / (double)_iHexMaxHBytes - (double)_iHexMaxVBytes);
scrollmax = Math.Max(0, scrollmax);
long scrollpos = _startByte / _iHexMaxHBytes;
@@ -1533,11 +1534,14 @@ namespace Be.Windows.Forms
int max = 65535;
if(_scrollVmax < max)
{
- return value;
+ return (long)value;
+ }
+ else
+ {
+ double valperc = (double)value / (double)max * (double)100;
+ long res = (int)Math.Floor((double)_scrollVmax / (double)100 * valperc);
+ return res;
}
- double valperc = (double)value / (double)max * (double)100;
- long res = (int)Math.Floor((double)this._scrollVmax / (double)100 * valperc);
- return res;
}
int ToScrollMax(long value)
@@ -1545,7 +1549,8 @@ namespace Be.Windows.Forms
long max = 65535;
if(value > max)
return (int)max;
- return (int)value;
+ else
+ return (int)value;
}
void PerformScrollToLine(long pos)
@@ -1636,12 +1641,12 @@ namespace Be.Windows.Forms
if(index < _startByte)
{
- long line = (long)Math.Floor(index / (double)_iHexMaxHBytes);
+ long line = (long)Math.Floor((double)index / (double)_iHexMaxHBytes);
PerformScrollThumpPosition(line);
}
else if(index > _endByte)
{
- long line = (long)Math.Floor(index / (double)_iHexMaxHBytes);
+ long line = (long)Math.Floor((double)index / (double)_iHexMaxHBytes);
line -= _iHexMaxVBytes-1;
PerformScrollThumpPosition(line);
}
@@ -1791,8 +1796,8 @@ namespace Be.Windows.Forms
if(_byteProvider == null || _keyInterpreter == null)
return;
- long pos;
- int cp;
+ long pos = _bytePos;
+ int cp = _byteCharacterPos;
if(_recHex.Contains(p))
{
@@ -2057,16 +2062,16 @@ namespace Be.Windows.Forms
if(_selectionLength > 0)
_byteProvider.DeleteBytes(_bytePos, _selectionLength);
- byte[] buffer;
+ byte[] buffer = null;
IDataObject da = Clipboard.GetDataObject();
- if(da != null && da.GetDataPresent("BinaryData"))
+ if(da.GetDataPresent("BinaryData"))
{
System.IO.MemoryStream ms = (System.IO.MemoryStream)da.GetData("BinaryData");
buffer = new byte[ms.Length];
ms.Read(buffer, 0, buffer.Length);
}
- else if(da != null && da.GetDataPresent(typeof(string)))
+ else if(da.GetDataPresent(typeof(string)))
{
string sBuffer = (string)da.GetData(typeof(string));
buffer = System.Text.Encoding.ASCII.GetBytes(sBuffer);
@@ -2102,9 +2107,10 @@ namespace Be.Windows.Forms
IDataObject da = Clipboard.GetDataObject();
if(da.GetDataPresent("BinaryData"))
return true;
- if(da.GetDataPresent(typeof(string)))
- return true;
- return false;
+ else if(da.GetDataPresent(typeof(string)))
+ return true;
+ else
+ return false;
}
#endregion
@@ -2405,7 +2411,7 @@ namespace Be.Windows.Forms
Rectangle betweenLines = new Rectangle(
_recStringView.X,
(int)(startSelPointF.Y+_charSize.Height),
- this._recStringView.Width,
+ (int)(_recStringView.Width),
(int)(_charSize.Height*(multiLine-1)));
if(betweenLines.IntersectsWith(_recStringView))
{
@@ -2527,18 +2533,18 @@ namespace Be.Windows.Forms
Color GetDefaultForeColor()
{
- if(Enabled)
+ if(Enabled)
return ForeColor;
- return Color.Gray;
+ else
+ return Color.Gray;
}
-
- void UpdateVisibilityBytes()
+ void UpdateVisibilityBytes()
{
if(_byteProvider == null || _byteProvider.Length == 0)
return;
_startByte = (_scrollVpos+1) * _iHexMaxHBytes - _iHexMaxHBytes;
- _endByte = Math.Min(this._byteProvider.Length - 1, this._startByte + this._iHexMaxBytes);
+ _endByte = (long)Math.Min(_byteProvider.Length - 1, _startByte + _iHexMaxBytes);
}
#endregion
@@ -2847,11 +2853,11 @@ namespace Be.Windows.Forms
ActivateKeyInterpreter();
if(_byteProvider != null)
- _byteProvider.LengthChanged -= this._byteProvider_LengthChanged;
+ _byteProvider.LengthChanged -= new EventHandler(_byteProvider_LengthChanged);
_byteProvider = value;
if(_byteProvider != null)
- _byteProvider.LengthChanged += this._byteProvider_LengthChanged;
+ _byteProvider.LengthChanged += new EventHandler(_byteProvider_LengthChanged);
OnByteProviderChanged(EventArgs.Empty);
@@ -2967,13 +2973,14 @@ namespace Be.Windows.Forms
[DefaultValue(typeof(HexCasing), "Upper"), Category("Hex"), Description("Gets or sets whether the HexBox control displays the hex characters in upper or lower case.")]
public HexCasing HexCasing
{
- get
- {
- if(_hexStringFormat == "X")
+ get
+ {
+ if(_hexStringFormat == "X")
return HexCasing.Upper;
- return HexCasing.Lower;
+ else
+ return HexCasing.Lower;
}
- set
+ set
{
string format;
if(value == HexCasing.Upper)
@@ -3181,7 +3188,7 @@ namespace Be.Windows.Forms
void CheckCurrentLineChanged()
{
- long currentLine = (long)Math.Floor(this._bytePos / (double)_iHexMaxHBytes) + 1;
+ long currentLine = (long)Math.Floor((double)_bytePos / (double)_iHexMaxHBytes) + 1;
if(_byteProvider == null && _currentLine != 0)
{
diff --git a/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.snk b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.snk
new file mode 100644
index 000000000..8c596985e
Binary files /dev/null and b/1.x/trunk/ProcessHacker/Components/Be.Windows.Forms.HexBox/HexBox.snk differ
diff --git a/1.x/trunk/ProcessHacker/Components/ColorModifier.Designer.cs b/1.x/trunk/ProcessHacker/Components/ColorModifier.Designer.cs
index 0be86b651..e88d39489 100644
--- a/1.x/trunk/ProcessHacker/Components/ColorModifier.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ColorModifier.Designer.cs
@@ -39,15 +39,14 @@
this.panelColor.Name = "panelColor";
this.panelColor.Size = new System.Drawing.Size(40, 20);
this.panelColor.TabIndex = 0;
+ this.panelColor.MouseLeave += new System.EventHandler(this.panelColor_MouseLeave);
this.panelColor.Click += new System.EventHandler(this.panelColor_Click);
this.panelColor.MouseEnter += new System.EventHandler(this.panelColor_MouseEnter);
- this.panelColor.MouseLeave += new System.EventHandler(this.panelColor_MouseLeave);
//
// ColorModifier
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.panelColor);
this.Name = "ColorModifier";
this.Size = new System.Drawing.Size(40, 20);
diff --git a/1.x/trunk/ProcessHacker/Components/ColorModifier.cs b/1.x/trunk/ProcessHacker/Components/ColorModifier.cs
index 4e6927682..ee93afa12 100644
--- a/1.x/trunk/ProcessHacker/Components/ColorModifier.cs
+++ b/1.x/trunk/ProcessHacker/Components/ColorModifier.cs
@@ -21,7 +21,10 @@
*/
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Drawing;
+using System.Text;
using System.Windows.Forms;
namespace ProcessHacker.Components
@@ -39,20 +42,18 @@ namespace ProcessHacker.Components
private void panelColor_Click(object sender, EventArgs e)
{
- using (ColorDialog cd = new ColorDialog
- {
- Color = this.panelColor.BackColor,
- FullOpen = true
- })
- {
- if (cd.ShowDialog() == DialogResult.OK)
- {
- _color = cd.Color;
- panelColor.BackColor = cd.Color;
+ ColorDialog cd = new ColorDialog();
- if (this.ColorChanged != null)
- this.ColorChanged(this, new EventArgs());
- }
+ cd.Color = panelColor.BackColor;
+ cd.FullOpen = true;
+
+ if (cd.ShowDialog() == DialogResult.OK)
+ {
+ _color = cd.Color;
+ panelColor.BackColor = cd.Color;
+
+ if (this.ColorChanged != null)
+ this.ColorChanged(this, new EventArgs());
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/ColorModifier.resx b/1.x/trunk/ProcessHacker/Components/ColorModifier.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/ColorModifier.resx
+++ b/1.x/trunk/ProcessHacker/Components/ColorModifier.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/DotNetCounters.Designer.cs b/1.x/trunk/ProcessHacker/Components/DotNetCounters.Designer.cs
index 69f9ea0de..5e04438ee 100644
--- a/1.x/trunk/ProcessHacker/Components/DotNetCounters.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/DotNetCounters.Designer.cs
@@ -29,12 +29,12 @@
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
- this.listAppDomains = new ProcessHacker.Components.ExtendedListView();
+ this.listAppDomains = new System.Windows.Forms.ListView();
this.label2 = new System.Windows.Forms.Label();
this.comboCategories = new System.Windows.Forms.ComboBox();
- this.listValues = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listValues = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnValue = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// label1
@@ -48,9 +48,8 @@
//
// listAppDomains
//
- this.listAppDomains.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listAppDomains.DoubleClickChecks = true;
+ this.listAppDomains.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listAppDomains.FullRowSelect = true;
this.listAppDomains.HideSelection = false;
this.listAppDomains.Location = new System.Drawing.Point(9, 19);
@@ -73,8 +72,8 @@
//
// comboCategories
//
- this.comboCategories.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.comboCategories.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.comboCategories.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboCategories.FormattingEnabled = true;
this.comboCategories.Location = new System.Drawing.Point(72, 105);
@@ -85,13 +84,12 @@
//
// listValues
//
- this.listValues.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listValues.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listValues.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnName,
this.columnValue});
- this.listValues.DoubleClickChecks = true;
this.listValues.FullRowSelect = true;
this.listValues.HideSelection = false;
this.listValues.Location = new System.Drawing.Point(9, 132);
@@ -116,7 +114,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listValues);
this.Controls.Add(this.comboCategories);
this.Controls.Add(this.label2);
@@ -133,10 +130,10 @@
#endregion
private System.Windows.Forms.Label label1;
- private ExtendedListView listAppDomains;
+ private System.Windows.Forms.ListView listAppDomains;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboCategories;
- private ExtendedListView listValues;
+ private System.Windows.Forms.ListView listValues;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnValue;
}
diff --git a/1.x/trunk/ProcessHacker/Components/DotNetCounters.cs b/1.x/trunk/ProcessHacker/Components/DotNetCounters.cs
index ceaa7ef47..18ae62db3 100644
--- a/1.x/trunk/ProcessHacker/Components/DotNetCounters.cs
+++ b/1.x/trunk/ProcessHacker/Components/DotNetCounters.cs
@@ -32,9 +32,9 @@ namespace ProcessHacker.Components
{
public partial class DotNetCounters : UserControl
{
- private readonly int _pid;
- private bool _initialized;
- private readonly string _name;
+ private int _pid;
+ private bool _initialized = false;
+ private string _name;
private string _instanceName;
private string _categoryName;
private PerformanceCounter[] _counters;
@@ -43,6 +43,10 @@ namespace ProcessHacker.Components
{
InitializeComponent();
+ listAppDomains.SetTheme("explorer");
+
+ listValues.SetDoubleBuffered(true);
+ listValues.SetTheme("explorer");
listValues.ContextMenu = listValues.GetCopyMenu();
listValues.AddShortcuts();
@@ -121,7 +125,7 @@ namespace ProcessHacker.Components
foreach (var category in categories)
{
- if (category.CategoryName.StartsWith(".NET CLR", StringComparison.OrdinalIgnoreCase))
+ if (category.CategoryName.StartsWith(".NET CLR"))
names.Add(category.CategoryName);
}
@@ -157,19 +161,22 @@ namespace ProcessHacker.Components
return;
}
- foreach (PerformanceCounter t in this._counters)
+ for (int i = 0; i < _counters.Length; i++)
{
+ var counter = _counters[i];
+
if (
- (t.CounterType == PerformanceCounterType.NumberOfItems32 ||
- t.CounterType == PerformanceCounterType.NumberOfItems64 ||
- t.CounterType == PerformanceCounterType.RawFraction) &&
- t.CounterName != "Not Displayed"
+ (counter.CounterType == PerformanceCounterType.NumberOfItems32 ||
+ counter.CounterType == PerformanceCounterType.NumberOfItems64 ||
+ counter.CounterType == PerformanceCounterType.RawFraction) &&
+ counter.CounterName != "Not Displayed"
)
{
- this.listValues.Items.Add(new ListViewItem(new string[]
+ listValues.Items.Add(new ListViewItem(
+ new string[]
{
- t.CounterName,
- string.Empty
+ _counters[i].CounterName,
+ ""
}));
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/DotNetCounters.resx b/1.x/trunk/ProcessHacker/Components/DotNetCounters.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/DotNetCounters.resx
+++ b/1.x/trunk/ProcessHacker/Components/DotNetCounters.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/EventPairProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/EventPairProperties.Designer.cs
index 51ccce3c6..b553dbdec 100644
--- a/1.x/trunk/ProcessHacker/Components/EventPairProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/EventPairProperties.Designer.cs
@@ -61,7 +61,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.buttonSetLow);
this.Controls.Add(this.buttonSetHigh);
this.Name = "EventPairProperties";
diff --git a/1.x/trunk/ProcessHacker/Components/EventPairProperties.cs b/1.x/trunk/ProcessHacker/Components/EventPairProperties.cs
index e01514a8e..e704736ca 100644
--- a/1.x/trunk/ProcessHacker/Components/EventPairProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/EventPairProperties.cs
@@ -7,7 +7,7 @@ namespace ProcessHacker.Components
{
public partial class EventPairProperties : UserControl
{
- private readonly EventPairHandle _eventPairHandle;
+ private EventPairHandle _eventPairHandle;
public EventPairProperties(EventPairHandle eventPairHandle)
{
diff --git a/1.x/trunk/ProcessHacker/Components/EventPairProperties.resx b/1.x/trunk/ProcessHacker/Components/EventPairProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/EventPairProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/EventPairProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/EventProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/EventProperties.Designer.cs
index 820b08667..5d06e00bb 100644
--- a/1.x/trunk/ProcessHacker/Components/EventProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/EventProperties.Designer.cs
@@ -125,7 +125,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.buttonReset);
this.Controls.Add(this.buttonPulse);
this.Controls.Add(this.buttonSet);
diff --git a/1.x/trunk/ProcessHacker/Components/EventProperties.cs b/1.x/trunk/ProcessHacker/Components/EventProperties.cs
index 8a3529caa..3b57c78bf 100644
--- a/1.x/trunk/ProcessHacker/Components/EventProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/EventProperties.cs
@@ -1,7 +1,6 @@
using System;
using System.Windows.Forms;
using ProcessHacker.Common;
-using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -9,7 +8,7 @@ namespace ProcessHacker.Components
{
public partial class EventProperties : UserControl
{
- private readonly EventHandle _eventHandle;
+ private EventHandle _eventHandle;
public EventProperties(EventHandle eventHandle)
{
@@ -22,7 +21,7 @@ namespace ProcessHacker.Components
private void UpdateInfo()
{
- EventBasicInformation basicInfo = _eventHandle.BasicInformation;
+ var basicInfo = _eventHandle.GetBasicInformation();
labelType.Text = basicInfo.EventType.ToString();
labelSignaled.Text = (basicInfo.EventState != 0).ToString();
@@ -43,11 +42,11 @@ namespace ProcessHacker.Components
private void UpgradeExecute(MethodInvoker action)
{
this.TryExecute(() =>
- {
- _eventHandle.ChangeAccess(EventAccess.QueryState | EventAccess.ModifyState);
+ {
+ _eventHandle.ChangeAccess(EventAccess.QueryState | EventAccess.ModifyState);
- action();
- });
+ action();
+ });
}
private void buttonSet_Click(object sender, EventArgs e)
@@ -64,7 +63,7 @@ namespace ProcessHacker.Components
private void buttonClear_Click(object sender, EventArgs e)
{
- this.UpgradeExecute(_eventHandle.Clear);
+ this.UpgradeExecute(() => _eventHandle.Clear());
this.UpdateInfo();
}
diff --git a/1.x/trunk/ProcessHacker/Components/EventProperties.resx b/1.x/trunk/ProcessHacker/Components/EventProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/EventProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/EventProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/ExtendedListView.cs b/1.x/trunk/ProcessHacker/Components/ExtendedListView.cs
index 23871072a..26b4f9c19 100644
--- a/1.x/trunk/ProcessHacker/Components/ExtendedListView.cs
+++ b/1.x/trunk/ProcessHacker/Components/ExtendedListView.cs
@@ -31,7 +31,6 @@ using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
-using ProcessHacker.Common;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
@@ -41,7 +40,7 @@ namespace ProcessHacker.Components
public sealed class LinkClickedEventArgs : EventArgs
{
- private readonly ListViewGroup _group;
+ private ListViewGroup _group;
public LinkClickedEventArgs(ListViewGroup group)
{
@@ -54,7 +53,7 @@ namespace ProcessHacker.Components
}
}
- public sealed class ExtendedListView : ListView
+ public class ExtendedListView : ListView
{
#region Control Variables
@@ -85,17 +84,6 @@ namespace ProcessHacker.Components
// Windows messages before they get to the form's WndProc.
this.SetStyle(ControlStyles.EnableNotifyMessage, true);
}
- protected override void OnHandleCreated(EventArgs e)
- {
- base.OnHandleCreated(e);
-
- if (OSVersion.IsAbove(WindowsVersion.XP))
- {
- Win32.SetWindowTheme(this.Handle, "Explorer", null);
- }
-
- this.MakeFocusInvisible();
- }
public bool DoubleClickChecks
{
@@ -126,9 +114,7 @@ namespace ProcessHacker.Components
{
foreach (ListViewGroup group in this.Groups)
{
- int? groupId = GetGroupID(group);
-
- if (groupId != null && groupId.Value == id)
+ if (GetGroupID(group).Value == id)
return group;
}
@@ -139,17 +125,18 @@ namespace ProcessHacker.Components
{
int? grpId = null;
Type grpType = lvGroup.GetType();
-
- PropertyInfo pInfo = grpType.GetProperty("ID", BindingFlags.NonPublic | BindingFlags.Instance);
- if (pInfo != null)
+ if (grpType != null)
{
- object tmprtnval = pInfo.GetValue(lvGroup, null);
- if (tmprtnval != null)
+ PropertyInfo pInfo = grpType.GetProperty("ID", BindingFlags.NonPublic | BindingFlags.Instance);
+ if (pInfo != null)
{
- grpId = tmprtnval as int?;
+ object tmprtnval = pInfo.GetValue(lvGroup, null);
+ if (tmprtnval != null)
+ {
+ grpId = tmprtnval as int?;
+ }
}
}
-
return grpId;
}
@@ -160,13 +147,13 @@ namespace ProcessHacker.Components
if (lvGroup == null || lvGroup.ListView == null)
return;
if (lvGroup.ListView.InvokeRequired)
- lvGroup.ListView.BeginInvoke(new CallBackSetGroupState(SetGrpState), lvGroup, grpState, task);
+ lvGroup.ListView.Invoke(new CallBackSetGroupState(SetGrpState), lvGroup, grpState, task);
else
{
int? GrpId = GetGroupID(lvGroup);
int gIndex = lvGroup.ListView.Groups.IndexOf(lvGroup);
LVGroup group = new LVGroup();
- group.CbSize = LVGroup.SizeOf;
+ group.CbSize = Marshal.SizeOf(group);
if (!string.IsNullOrEmpty(task))
{
@@ -188,12 +175,12 @@ namespace ProcessHacker.Components
if (GrpId != null)
{
group.GroupId = GrpId.Value;
- SendMessage(this.Handle, LVM_SetGroupInfo, GrpId.Value, ref group);
+ SendMessage(base.Handle, LVM_SetGroupInfo, GrpId.Value, ref group);
}
else
{
group.GroupId = gIndex;
- SendMessage(this.Handle, LVM_SetGroupInfo, gIndex, ref group);
+ SendMessage(base.Handle, LVM_SetGroupInfo, gIndex, ref group);
}
lvGroup.ListView.Refresh();
@@ -281,15 +268,8 @@ namespace ProcessHacker.Components
/// Used to set and retrieve groups.
///
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- public struct LVGroup
+ private struct LVGroup
{
- public static readonly int SizeOf;
-
- static LVGroup()
- {
- SizeOf = Marshal.SizeOf(typeof(LVGroup));
- }
-
///
/// Size of this structure, in bytes.
///
@@ -417,12 +397,12 @@ namespace ProcessHacker.Components
///
public uint CchSubsetTitle;
}
-
+
///
/// WM_NOTIFY notificaiton message header.
///
[StructLayout(LayoutKind.Sequential)]
- public struct NMHDR
+ private struct NMHDR
{
///
/// Window handle to the control sending a message.
@@ -442,7 +422,7 @@ namespace ProcessHacker.Components
/// Used to set and retrieve information about a link item.
///
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct LITEM
+ private struct LITEM
{
///
/// Combination of one or more of the LIF flags
@@ -477,7 +457,7 @@ namespace ProcessHacker.Components
/// Contains information about an LVN_LINKCLICK notification.
///
[StructLayout(LayoutKind.Sequential)]
- public struct NMLVLINK
+ private struct NMLVLINK
{
///
/// NMHDR structure that contains basic
diff --git a/1.x/trunk/ProcessHacker/Components/ExtendedTreeView.cs b/1.x/trunk/ProcessHacker/Components/ExtendedTreeView.cs
index 9fc67b2d3..0c1e49458 100644
--- a/1.x/trunk/ProcessHacker/Components/ExtendedTreeView.cs
+++ b/1.x/trunk/ProcessHacker/Components/ExtendedTreeView.cs
@@ -22,6 +22,7 @@
*/
using System;
+using System.Runtime.InteropServices;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
@@ -41,8 +42,8 @@ namespace ProcessHacker.Components
{
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
{
- Win32.SendMessage(this.Handle, (WindowMessage)TVM_SETEXTENDEDSTYLE, IntPtr.Zero, (IntPtr)TVS_EX_FADEINOUTEXPANDOS);
- Win32.SetWindowTheme(this.Handle, "Explorer", null);
+ Win32.SendMessage(this.Handle, (WindowMessage)TVM_SETEXTENDEDSTYLE, 0, TVS_EX_FADEINOUTEXPANDOS);
+ ProcessHacker.Common.PhUtils.SetTheme(this, "explorer");
}
base.OnHandleCreated(e);
diff --git a/1.x/trunk/ProcessHacker/Components/FileNameBox.Designer.cs b/1.x/trunk/ProcessHacker/Components/FileNameBox.Designer.cs
index ef1316274..0b69e8137 100644
--- a/1.x/trunk/ProcessHacker/Components/FileNameBox.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/FileNameBox.Designer.cs
@@ -37,9 +37,9 @@
//
// textFileName
//
- this.textFileName.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileName.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileName.Location = new System.Drawing.Point(0, 2);
this.textFileName.Name = "textFileName";
this.textFileName.Size = new System.Drawing.Size(277, 20);
@@ -48,8 +48,8 @@
//
// buttonProperties
//
- this.buttonProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.buttonProperties.Image = global::ProcessHacker.Properties.Resources.application_form_magnify;
this.buttonProperties.Location = new System.Drawing.Point(279, 0);
this.buttonProperties.Name = "buttonProperties";
@@ -61,8 +61,8 @@
//
// buttonExplore
//
- this.buttonExplore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonExplore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExplore.Image = global::ProcessHacker.Properties.Resources.folder_explore;
this.buttonExplore.Location = new System.Drawing.Point(304, 0);
this.buttonExplore.Name = "buttonExplore";
@@ -76,7 +76,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.buttonExplore);
this.Controls.Add(this.buttonProperties);
this.Controls.Add(this.textFileName);
diff --git a/1.x/trunk/ProcessHacker/Components/FileNameBox.resx b/1.x/trunk/ProcessHacker/Components/FileNameBox.resx
index 026c576b4..a5979aadf 100644
--- a/1.x/trunk/ProcessHacker/Components/FileNameBox.resx
+++ b/1.x/trunk/ProcessHacker/Components/FileNameBox.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/HandleDetails.cs b/1.x/trunk/ProcessHacker/Components/HandleDetails.cs
deleted file mode 100644
index 4abc1a39d..000000000
--- a/1.x/trunk/ProcessHacker/Components/HandleDetails.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Process Hacker -
- * .NET counters control
- *
- * Copyright (C) 2009-2010 wj32
- *
- * This file is part of Process Hacker.
- *
- * Process Hacker is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Process Hacker is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Process Hacker. If not, see .
- */
-
-using System;
-using System.Windows.Forms;
-using ProcessHacker.Api;
-using ProcessHacker.Native;
-using ProcessHacker.Native.Api;
-
-namespace ProcessHacker.Components
-{
- public partial class HandleDetails : ProcessPropertySheetPage
- {
- public delegate void HandlePropertiesDelegate(Control objectGroup, string name, string typeName);
-
- public event HandlePropertiesDelegate HandlePropertiesCallback;
- public string _name;
- public string _typeName;
-
- public SystemHandleEntry ObjectHandle { get; set; }
-
- public void Init()
- {
- try
- {
- ObjectInformation handleInfo = ObjectHandle.GetHandleInfo();
-
- _name = textName.Text = handleInfo.BestName;
-
- if (string.IsNullOrEmpty(textName.Text))
- textName.Text = "(unnamed object)";
-
- _typeName = textType.Text = handleInfo.TypeName;
- textAddress.Text = "0x" + ObjectHandle.Object.ToString("x");
- textGrantedAccess.Text = "0x" + ObjectHandle.GrantedAccess.ToString("x");
-
- if (ObjectHandle.GrantedAccess != 0)
- {
- try
- {
- Type accessEnumType = NativeTypeFactory.GetAccessType(handleInfo.TypeName);
- textGrantedAccess.Text += " (" + NativeTypeFactory.GetAccessString(accessEnumType, ObjectHandle.GrantedAccess) + ")";
- }
- catch (NotSupportedException)
- {
- }
- }
-
- ObjectBasicInformation basicInfo = ObjectHandle.GetBasicInfo();
-
- labelReferences.Text = "References: " + (basicInfo.PointerCount - 1);
- labelHandles.Text = "Handles: " + basicInfo.HandleCount.ToString();
- labelPaged.Text = "Paged: " + basicInfo.PagedPoolUsage.ToString();
- labelNonPaged.Text = "Non-Paged: " + basicInfo.NonPagedPoolUsage.ToString();
-
- if (HandlePropertiesCallback != null)
- {
- try
- {
- HandlePropertiesCallback(groupObjectInfo, _name, _typeName);
- }
- catch
- {
- }
-
- if (groupObjectInfo.Controls.Count == 0)
- {
- groupObjectInfo.Visible = false;
- }
- else if (groupObjectInfo.Controls.Count == 1)
- {
- Control control = groupObjectInfo.Controls[0];
-
- // If it's a user control, dock it.
- if (control is UserControl)
- {
- control.Dock = DockStyle.Fill;
- control.Margin = new Padding(3);
- }
- else
- {
- control.Location = new System.Drawing.Point(10, 20);
- }
- }
- }
- }
- catch (Exception)
- { }
-
- this.ActiveControl = this.label1;
- }
-
- public HandleDetails()
- {
- InitializeComponent();
-
- this.ActiveControl = this.label1;
-
- this.label1.Refresh();
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/HandleDetails.resx b/1.x/trunk/ProcessHacker/Components/HandleDetails.resx
deleted file mode 100644
index c7e0d4bdf..000000000
--- a/1.x/trunk/ProcessHacker/Components/HandleDetails.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/HandleList.Designer.cs b/1.x/trunk/ProcessHacker/Components/HandleList.Designer.cs
index 3289805b5..e1aecfac9 100644
--- a/1.x/trunk/ProcessHacker/Components/HandleList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/HandleList.Designer.cs
@@ -32,10 +32,12 @@
///
private void InitializeComponent()
{
- this.listHandles = new ProcessHacker.Components.ExtendedListView();
- this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnHandle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.components = new System.ComponentModel.Container();
+ this.listHandles = new System.Windows.Forms.ListView();
+ this.columnType = new System.Windows.Forms.ColumnHeader();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnHandle = new System.Windows.Forms.ColumnHeader();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.closeHandleMenuItem = new System.Windows.Forms.MenuItem();
this.copyHandleMenuItem = new System.Windows.Forms.MenuItem();
this.menuHandle = new System.Windows.Forms.ContextMenu();
@@ -43,6 +45,7 @@
this.inheritMenuItem = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.propertiesHandleMenuItem = new System.Windows.Forms.MenuItem();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// listHandles
@@ -53,7 +56,6 @@
this.columnName,
this.columnHandle});
this.listHandles.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listHandles.DoubleClickChecks = true;
this.listHandles.FullRowSelect = true;
this.listHandles.HideSelection = false;
this.listHandles.Location = new System.Drawing.Point(0, 0);
@@ -79,14 +81,21 @@
//
this.columnHandle.Text = "Handle";
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// closeHandleMenuItem
//
+ this.vistaMenu.SetImage(this.closeHandleMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.closeHandleMenuItem.Index = 0;
this.closeHandleMenuItem.Text = "Close";
this.closeHandleMenuItem.Click += new System.EventHandler(this.closeHandleMenuItem_Click);
//
// copyHandleMenuItem
//
+ this.vistaMenu.SetImage(this.copyHandleMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyHandleMenuItem.Index = 4;
this.copyHandleMenuItem.Text = "&Copy";
//
@@ -128,20 +137,22 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listHandles);
+ this.DoubleBuffered = true;
this.Name = "HandleList";
this.Size = new System.Drawing.Size(450, 472);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
#endregion
- private ExtendedListView listHandles;
+ private System.Windows.Forms.ListView listHandles;
private System.Windows.Forms.ColumnHeader columnType;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnHandle;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.ContextMenu menuHandle;
private System.Windows.Forms.MenuItem closeHandleMenuItem;
private System.Windows.Forms.MenuItem copyHandleMenuItem;
diff --git a/1.x/trunk/ProcessHacker/Components/HandleList.cs b/1.x/trunk/ProcessHacker/Components/HandleList.cs
index 77c4a4807..895967535 100644
--- a/1.x/trunk/ProcessHacker/Components/HandleList.cs
+++ b/1.x/trunk/ProcessHacker/Components/HandleList.cs
@@ -23,22 +23,20 @@
using System;
using System.Collections.Generic;
using System.Drawing;
-using System.Runtime.InteropServices;
+using System.Reflection;
using System.Windows.Forms;
-using ProcessHacker.Api;
using ProcessHacker.Common;
using ProcessHacker.Common.Ui;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
-using ProcessHacker.Native.Security.AccessControl;
using ProcessHacker.Native.Ui;
using ProcessHacker.UI;
namespace ProcessHacker.Components
{
- public partial class HandleList : ProcessPropertySheetPage
+ public partial class HandleList : UserControl
{
public static bool ConfirmHandleClose()
{
@@ -51,37 +49,22 @@ namespace ProcessHacker.Components
false
);
}
- return true;
+ else
+ {
+ return true;
+ }
}
public static void ShowHandleProperties(SystemHandleEntry handleInfo)
{
try
{
+ HandlePropertiesWindow window = new HandlePropertiesWindow(handleInfo);
IntPtr handle = new IntPtr(handleInfo.Handle);
ProcessHandle phandle = new ProcessHandle(handleInfo.ProcessId, ProcessAccess.DupHandle);
- GenericHandle dupHandle = null;
+ GenericHandle dupHandle = null;
- // Try to get a handle, since we need one for security editing.
- try
- {
- dupHandle = new GenericHandle(phandle, handle, 0);
- }
- catch
- { }
-
- PropSheetHeader64 header = new PropSheetHeader64
- {
- dwSize = (uint)PropSheetHeader64.SizeOf,
- nPages = 2,
- dwFlags = (uint)PropSheetFlags.PSH_DEFAULT,
- pszCaption = "Handle Properties"
- };
-
- using (HandleDetails hw = new HandleDetails())
- {
- hw.ObjectHandle = handleInfo;
- hw.HandlePropertiesCallback += (control, name, typeName) =>
+ window.HandlePropertiesCallback += (control, name, typeName) =>
{
switch (typeName.ToLowerInvariant())
{
@@ -92,65 +75,76 @@ namespace ProcessHacker.Components
case "token":
case "process":
{
- Button b = new Button
- {
- FlatStyle = FlatStyle.System,
- Text = "Properties"
- };
+ Button b = new Button();
+ b.FlatStyle = FlatStyle.System;
+ b.Text = "Properties";
b.Click += (sender, e) =>
- {
- try
{
- switch (typeName.ToLowerInvariant())
+ try
{
- case "file":
- {
- FileUtils.ShowProperties(name);
- }
- break;
- case "job":
- {
- dupHandle = new GenericHandle(phandle, handle, (int)JobObjectAccess.Query);
+ switch (typeName.ToLowerInvariant())
+ {
+ case "file":
+ {
+ FileUtils.ShowProperties(name);
+ }
+ break;
+ case "job":
+ {
+ dupHandle =
+ new GenericHandle(
+ phandle, handle,
+ (int)JobObjectAccess.Query);
+ (new JobWindow(JobObjectHandle.FromHandle(dupHandle))).ShowDialog();
+ }
+ break;
+ case "key":
+ {
+ try
+ {
+ PhUtils.OpenKeyInRegedit(PhUtils.GetForegroundWindow(), name);
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to open the Registry Editor", ex);
+ }
+ }
+ break;
+ case "token":
+ {
+ (new TokenWindow(new RemoteTokenHandle(phandle,
+ handle))).ShowDialog();
+ }
+ break;
+ case "process":
+ {
+ int pid;
- (new JobWindow(JobObjectHandle.FromHandle(dupHandle))).ShowDialog();
- }
- break;
- case "key":
- {
- try
- {
- PhUtils.OpenKeyInRegedit(PhUtils.GetForegroundWindow(), name);
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to open the Registry Editor", ex);
- }
- }
- break;
- case "token":
- {
- using (TokenWindow twindow = new TokenWindow(new RemoteTokenHandle(phandle, handle)))
- {
- twindow.ShowDialog();
- }
- }
- break;
- case "process":
- {
- dupHandle = new GenericHandle(phandle, handle, (int)OSVersion.MinProcessQueryInfoAccess);
- int pid = ProcessHandle.FromHandle(dupHandle).ProcessId;
+ if (KProcessHacker.Instance != null)
+ {
+ pid = KProcessHacker.Instance.KphGetProcessId(phandle, handle);
+ }
+ else
+ {
+ dupHandle =
+ new GenericHandle(
+ phandle, handle,
+ (int)OSVersion.MinProcessQueryInfoAccess);
+ pid = ProcessHandle.FromHandle(dupHandle).GetProcessId();
+ }
- Program.GetProcessWindow(Program.ProcessProvider.Dictionary[pid], Program.FocusWindow);
- }
- break;
+ Program.GetProcessWindow(Program.ProcessProvider.Dictionary[pid],
+ (f) => Program.FocusWindow(f));
+ }
+ break;
+ }
}
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to show object properties", ex);
- }
- };
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to show object properties", ex);
+ }
+ };
control.Controls.Add(b);
}
@@ -214,25 +208,19 @@ namespace ProcessHacker.Components
}
};
- hw.Init();
-
- IntPtr[] pages = new IntPtr[2];
- pages[0] = hw.CreatePageHandle();
- pages[1] = CreateSecurityPage(SecurityEditor.EditSecurity2(
- null,
- SecurityEditor.GetSecurableWrapper(dupHandle),
- hw._name,
- NativeTypeFactory.GetAccessEntries(NativeTypeFactory.GetObjectType(hw._typeName))
- ));
-
- GCHandle gch = GCHandle.Alloc(pages, GCHandleType.Pinned);
- header.phpage = gch.AddrOfPinnedObject();
-
- PropertySheetW(ref header);
-
- if (dupHandle != null)
- dupHandle.Dispose();
+ if (dupHandle == null)
+ {
+ // Try to get a handle, since we need one for security editing.
+ try { dupHandle = new GenericHandle(phandle, handle, 0); }
+ catch { }
}
+
+ window.ObjectHandle = dupHandle;
+
+ window.ShowDialog();
+
+ if (dupHandle != null)
+ dupHandle.Dispose();
}
catch (Exception ex)
{
@@ -240,84 +228,11 @@ namespace ProcessHacker.Components
}
}
- [DllImport("Comctl32.dll")]
- public static extern IntPtr PropertySheetW([In, MarshalAs(UnmanagedType.Struct)]ref PropSheetHeader64 lppsph);
-
- [DllImport("Aclui.dll")]
- public static extern IntPtr CreateSecurityPage(ISecurityInformation lppsph);
-
- [StructLayout(LayoutKind.Explicit, Pack = 8, CharSet = CharSet.Unicode)]
- public struct PropSheetHeader64
- {
- public static readonly int SizeOf;
-
- static PropSheetHeader64()
- {
- SizeOf = Marshal.SizeOf(typeof(PropSheetHeader64));
- }
-
- [FieldOffset(0)]
- public UInt32 dwSize;
- [FieldOffset(4)]
- public UInt32 dwFlags;
- [FieldOffset(8)]
- public IntPtr hwndParent;
- [FieldOffset(16)]
- public IntPtr hInstance;
- [FieldOffset(24)]
- public IntPtr hIcon;
- [FieldOffset(32)]
- public String pszCaption;
- [FieldOffset(40)]
- public UInt32 nPages;
- [FieldOffset(48)]
- public string pStartPage;
- [FieldOffset(56)]
- public IntPtr phpage;
-
- // following fields all for PROPSHEETHEADER_V2
- [FieldOffset(64)]
- public IntPtr pfnCallback;
- [FieldOffset(72)]
- public IntPtr hbmWatermark;
- [FieldOffset(80)]
- public IntPtr hplWatermark;
- [FieldOffset(88)]
- public IntPtr hbmHeader;
- }
-
- [Flags]
- internal enum PropSheetFlags : uint
- {
- PSH_DEFAULT = 0x00000000,
- PSH_PROPTITLE = 0x00000001,
- PSH_USEHICON = 0x00000002,
- PSH_USEICONID = 0x00000004,
- PSH_PROPSHEETPAGE = 0x00000008,
- PSH_WIZARDHASFINISH = 0x00000010,
- PSH_WIZARD = 0x00000020,
- PSH_USEPSTARTPAGE = 0x00000040,
- PSH_NOAPPLYNOW = 0x00000080,
- PSH_USECALLBACK = 0x00000100,
- PSH_HASHELP = 0x00000200,
- PSH_MODELESS = 0x00000400,
- PSH_RTLREADING = 0x00000800,
- PSH_WIZARDCONTEXTHELP = 0x00001000,
- PSH_WIZARD97 = 0x01000000,
- PSH_WATERMARK = 0x00008000,
- PSH_USEHBMWATERMARK = 0x00010000, // user pass in a hbmWatermark instead of pszbmWatermark
- PSH_USEHPLWATERMARK = 0x00020000, //
- PSH_STRETCHWATERMARK = 0x00040000, // stretchwatermark also applies for the header
- PSH_HEADER = 0x00080000,
- PSH_USEHBMHEADER = 0x00100000,
- PSH_USEPAGELANG = 0x00200000 // use frame dialog template matched to page
- }
-
- private readonly object _listLock = new object();
+ private object _listLock = new object();
private HandleProvider _provider;
- private int _runCount;
- private readonly List _needsAdd = new List();
- private readonly HighlightingContext _highlightingContext;
+ private int _runCount = 0;
+ private List _needsAdd = new List();
+ private HighlightingContext _highlightingContext;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
@@ -328,11 +243,11 @@ namespace ProcessHacker.Components
InitializeComponent();
_highlightingContext = new HighlightingContext(listHandles);
- listHandles.KeyDown += this.listHandles_KeyDown;
- listHandles.MouseDown += this.listHandles_MouseDown;
- listHandles.MouseUp += this.listHandles_MouseUp;
- listHandles.DoubleClick += this.listHandles_DoubleClick;
- listHandles.SelectedIndexChanged += this.listHandles_SelectedIndexChanged;
+ listHandles.KeyDown += new KeyEventHandler(listHandles_KeyDown);
+ listHandles.MouseDown += new MouseEventHandler(listHandles_MouseDown);
+ listHandles.MouseUp += new MouseEventHandler(listHandles_MouseUp);
+ listHandles.DoubleClick += new EventHandler(listHandles_DoubleClick);
+ listHandles.SelectedIndexChanged += new System.EventHandler(listHandles_SelectedIndexChanged);
var comparer = (SortedListViewComparer)
(listHandles.ListViewItemSorter = new SortedListViewComparer(listHandles));
@@ -345,7 +260,7 @@ namespace ProcessHacker.Components
GenericViewMenu.AddMenuItems(copyHandleMenuItem.MenuItems, listHandles, null);
ColumnSettings.LoadSettings(Settings.Instance.HandleListViewColumns, listHandles);
- //if (KProcessHacker.Instance == null)
+ if (KProcessHacker.Instance == null)
{
protectedMenuItem.Visible = false;
inheritMenuItem.Visible = false;
@@ -369,7 +284,7 @@ namespace ProcessHacker.Components
this.MouseDown(sender, e);
}
- private void listHandles_SelectedIndexChanged(object sender, EventArgs e)
+ private void listHandles_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.SelectedIndexChanged != null)
this.SelectedIndexChanged(sender, e);
@@ -382,23 +297,36 @@ namespace ProcessHacker.Components
if (!e.Handled)
{
- switch (e.KeyCode)
+ if (e.KeyCode == Keys.Enter)
{
- case Keys.Enter:
- this.propertiesHandleMenuItem_Click(null, null);
- break;
- case Keys.Delete:
- if (ConfirmHandleClose())
- {
- this.closeHandleMenuItem_Click(null, null);
- }
- break;
+ propertiesHandleMenuItem_Click(null, null);
+ }
+ else if (e.KeyCode == Keys.Delete)
+ {
+ if (ConfirmHandleClose())
+ {
+ closeHandleMenuItem_Click(null, null);
+ }
}
}
}
#region Properties
+ public new bool DoubleBuffered
+ {
+ get
+ {
+ return (bool)typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listHandles, null);
+ }
+ set
+ {
+ typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listHandles, value, null);
+ }
+ }
+
public override bool Focused
{
get
@@ -407,13 +335,19 @@ namespace ProcessHacker.Components
}
}
+ public override ContextMenu ContextMenu
+ {
+ get { return listHandles.ContextMenu; }
+ set { listHandles.ContextMenu = value; }
+ }
+
public override ContextMenuStrip ContextMenuStrip
{
get { return listHandles.ContextMenuStrip; }
set { listHandles.ContextMenuStrip = value; }
}
- public ExtendedListView List
+ public ListView List
{
get { return listHandles; }
}
@@ -506,13 +440,12 @@ namespace ProcessHacker.Components
(item.Handle.Flags & HandleFlags.ProtectFromClose) != 0
)
return Settings.Instance.ColorProtectedHandles;
-
- if (Settings.Instance.UseColorInheritHandles &&
+ else if (Settings.Instance.UseColorInheritHandles &&
(item.Handle.Flags & HandleFlags.Inherit) != 0
)
return Settings.Instance.ColorInheritHandles;
-
- return SystemColors.Window;
+ else
+ return SystemColors.Window;
}
public void AddItem(HandleItem item)
@@ -533,12 +466,11 @@ namespace ProcessHacker.Components
private void provider_DictionaryAdded(HandleItem item)
{
- HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, item.RunId > 0 && _runCount > 0)
- {
- Name = item.Handle.Handle.ToString(),
- Text = item.ObjectInfo.TypeName
- };
+ HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
+ item.RunId > 0 && _runCount > 0);
+ litem.Name = item.Handle.Handle.ToString();
+ litem.Text = item.ObjectInfo.TypeName;
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.ObjectInfo.BestName));
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, "0x" + item.Handle.Handle.ToString("x")));
litem.Tag = item;
@@ -552,21 +484,22 @@ namespace ProcessHacker.Components
private void provider_DictionaryModified(HandleItem oldItem, HandleItem newItem)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- lock (_listLock)
{
- ((HighlightedListViewItem)this.listHandles.Items[newItem.Handle.Handle.ToString()]).NormalColor = this.GetHandleColor(newItem);
- }
- }));
+ lock (_listLock)
+ {
+ (listHandles.Items[newItem.Handle.Handle.ToString()] as
+ HighlightedListViewItem).NormalColor = this.GetHandleColor(newItem);
+ }
+ }));
}
private void provider_DictionaryRemoved(HandleItem item)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- lock (_listLock)
- listHandles.Items[item.Handle.Handle.ToString()].Remove();
- }));
+ {
+ lock (_listLock)
+ listHandles.Items[item.Handle.Handle.ToString()].Remove();
+ }));
}
private int _pid;
@@ -583,7 +516,7 @@ namespace ProcessHacker.Components
if (listHandles.SelectedItems.Count == 0)
{
- //menuHandle.DisableAll();
+ menuHandle.DisableAll();
}
else if (listHandles.SelectedItems.Count == 1)
{
@@ -653,8 +586,8 @@ namespace ProcessHacker.Components
try
{
- //using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- //KProcessHacker.Instance.SetHandleAttributes(phandle, new IntPtr(item.Handle.Handle), flags);
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ KProcessHacker.Instance.SetHandleAttributes(phandle, new IntPtr(item.Handle.Handle), flags);
}
catch (Exception ex)
{
@@ -674,8 +607,8 @@ namespace ProcessHacker.Components
try
{
- //using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- //KProcessHacker.Instance.SetHandleAttributes(phandle, new IntPtr(item.Handle.Handle), flags);
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ KProcessHacker.Instance.SetHandleAttributes(phandle, new IntPtr(item.Handle.Handle), flags);
}
catch (Exception ex)
{
diff --git a/1.x/trunk/ProcessHacker/Components/HandleList.resx b/1.x/trunk/ProcessHacker/Components/HandleList.resx
index 051a81cde..90ace843e 100644
--- a/1.x/trunk/ProcessHacker/Components/HandleList.resx
+++ b/1.x/trunk/ProcessHacker/Components/HandleList.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+ 17, 17
+
+
125, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/Indicator.cs b/1.x/trunk/ProcessHacker/Components/Indicator.cs
index 9248e9362..d4a5a677a 100644
--- a/1.x/trunk/ProcessHacker/Components/Indicator.cs
+++ b/1.x/trunk/ProcessHacker/Components/Indicator.cs
@@ -21,7 +21,11 @@
*/
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Drawing;
+using System.Data;
+using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
@@ -41,38 +45,40 @@ namespace ProcessHacker.Components
get { return _lineColor2; }
set { _lineColor2 = value; }
}
+ private long _data1;
+ public long Data1
+ {
+ get { return _data1; }
+ set { _data1 = value; }
+ }
+ private long _data2;
+ public long Data2
+ {
+ get { return _data2; }
+ set { _data2 = value; }
+ }
- public long Data1 { get; set; }
- public long Data2 { get; set; }
+
public Indicator()
{
InitializeComponent();
-
- this.SetStyle(
- ControlStyles.ResizeRedraw |
- ControlStyles.UserPaint |
- ControlStyles.OptimizedDoubleBuffer |
- ControlStyles.AllPaintingInWmPaint, true);
+ base.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
+ ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
//SolidBrush brush = new SolidBrush(this.ForeColor);
SolidBrush brush1 = new SolidBrush(this.Color1);
SolidBrush brush2 = new SolidBrush(this.Color2);
- int width = this.ClientSize.Width;
- int height = this.ClientSize.Height;
+ int width = base.ClientSize.Width;
+ int height = base.ClientSize.Height;
int num1 = height;
num1 -= this.Font.Height + 4;
- RectangleF layoutRectangle = new RectangleF(0f, num1, width, height);
-
- StringFormat format = new StringFormat(StringFormatFlags.NoWrap)
- {
- Alignment = StringAlignment.Center
- };
-
+ RectangleF layoutRectangle = new RectangleF(0f, (float)num1, (float)width, (float)height);
+ StringFormat format = new StringFormat(StringFormatFlags.NoWrap);
+ format.Alignment = StringAlignment.Center;
e.Graphics.DrawString(this.Text, this.Font, brush1, layoutRectangle, format);
-
int num2 = (((height - 6) - 4) - this.Font.Height) - 4;
num2++;
int num3 = num2 / 3;
@@ -80,24 +86,25 @@ namespace ProcessHacker.Components
byte green = (byte)(this.ForeColor.G / 2);
byte blue = (byte)(this.ForeColor.B / 2);
- Pen pen = new Pen(Color.FromArgb(red, green, blue))
- {
- DashStyle = DashStyle.Dot
- };
+ Pen pen = new Pen(Color.FromArgb(red, green, blue));
+ pen.DashStyle = DashStyle.Dot;
int num4 = (width - this.GraphWidth) / 2;
int num5 = ((height - 4) - this.Font.Height) - 7;
int num6 = this.GraphWidth / 2;
- int num9 = (int)Math.Ceiling(((this.Data1 - this.Minimum) * 1.0) / ((this.Maximum - (this.Minimum * 1.0)) / num3));
- int num10 = (int)Math.Ceiling(((this.Data1 + this.Data2 - this.Minimum) * 1.0) / ((this.Maximum - (this.Minimum * 1.0)) / num3));
+ int x = num4;
+ int y = 0;
+ int num7 = 0;
+ int num8 = 0;
+ int num9 = (int)Math.Ceiling((double)(((this.Data1 - this.Minimum) * 1.0) / ((this.Maximum - (this.Minimum * 1.0)) / ((double)num3))));
+ int num10 = (int)Math.Ceiling((double)(((this.Data1 + this.Data2 - this.Minimum) * 1.0) / ((this.Maximum - (this.Minimum * 1.0)) / ((double)num3))));
for (int i = 0; i < num3; i++)
{
- int x = num4;
- int y = (num5 - (i * 3)) - 1;
- int num7 = x + num6;
- int num8 = y;
-
+ x = num4;
+ y = (num5 - (i * 3)) - 1;
+ num7 = x + num6;
+ num8 = y;
if (i < num9)
{
e.Graphics.FillRectangle(brush1, x, y, num6, 2);
@@ -132,9 +139,9 @@ namespace ProcessHacker.Components
return createParams;
}
}
- private int _GraphWidth = 0x21;
+ private int _GraphWidth=0x21;
private long _Maximum = long.MaxValue;
- private long _Minimum;
+ private long _Minimum = 0;
public int GraphWidth
{
get
@@ -144,7 +151,7 @@ namespace ProcessHacker.Components
set
{
this._GraphWidth = value;
- this.Invalidate();
+ base.Invalidate();
}
}
public long Maximum
@@ -162,7 +169,7 @@ namespace ProcessHacker.Components
}
this._Maximum = value;
- this.Invalidate();
+ base.Invalidate();
}
}
public long Minimum
@@ -178,7 +185,7 @@ namespace ProcessHacker.Components
throw new ArgumentException();
}
this._Minimum = value;
- this.Invalidate();
+ base.Invalidate();
}
}
public string TextValue
@@ -190,7 +197,7 @@ namespace ProcessHacker.Components
set
{
base.Text = value;
- this.Invalidate();
+ base.Invalidate();
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/Indicator.resx b/1.x/trunk/ProcessHacker/Components/Indicator.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/Indicator.resx
+++ b/1.x/trunk/ProcessHacker/Components/Indicator.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/JobProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/JobProperties.Designer.cs
index a6ab51d28..dfd7017d7 100644
--- a/1.x/trunk/ProcessHacker/Components/JobProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/JobProperties.Designer.cs
@@ -34,17 +34,16 @@
this.components = new System.ComponentModel.Container();
this.tabControl = new System.Windows.Forms.TabControl();
this.tabGeneral = new System.Windows.Forms.TabPage();
- this.buttonTerminate = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textJobName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
- this.listLimits = new ProcessHacker.Components.ExtendedListView();
- this.columnLimit = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.listProcesses = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnPid = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listLimits = new System.Windows.Forms.ListView();
+ this.columnLimit = new System.Windows.Forms.ColumnHeader();
+ this.columnValue = new System.Windows.Forms.ColumnHeader();
+ this.listProcesses = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnPid = new System.Windows.Forms.ColumnHeader();
this.tabStatistics = new System.Windows.Forms.TabPage();
this.flowStatistics = new System.Windows.Forms.FlowLayoutPanel();
this.groupGeneral = new System.Windows.Forms.GroupBox();
@@ -88,6 +87,7 @@
this.labelIOOther = new System.Windows.Forms.Label();
this.labelIOOtherBytes = new System.Windows.Forms.Label();
this.timerUpdate = new System.Windows.Forms.Timer(this.components);
+ this.buttonTerminate = new System.Windows.Forms.Button();
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
this.tabStatistics.SuspendLayout();
@@ -110,7 +110,7 @@
this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
- this.tabControl.Size = new System.Drawing.Size(456, 434);
+ this.tabControl.Size = new System.Drawing.Size(646, 434);
this.tabControl.TabIndex = 0;
//
// tabGeneral
@@ -125,23 +125,11 @@
this.tabGeneral.Location = new System.Drawing.Point(4, 22);
this.tabGeneral.Name = "tabGeneral";
this.tabGeneral.Padding = new System.Windows.Forms.Padding(3);
- this.tabGeneral.Size = new System.Drawing.Size(448, 408);
+ this.tabGeneral.Size = new System.Drawing.Size(638, 408);
this.tabGeneral.TabIndex = 0;
this.tabGeneral.Text = "General";
this.tabGeneral.UseVisualStyleBackColor = true;
//
- // buttonTerminate
- //
- this.buttonTerminate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonTerminate.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonTerminate.Location = new System.Drawing.Point(367, 6);
- this.buttonTerminate.Name = "buttonTerminate";
- this.buttonTerminate.Size = new System.Drawing.Size(75, 23);
- this.buttonTerminate.TabIndex = 5;
- this.buttonTerminate.Text = "Terminate";
- this.buttonTerminate.UseVisualStyleBackColor = true;
- this.buttonTerminate.Click += new System.EventHandler(this.buttonTerminate_Click);
- //
// label3
//
this.label3.AutoSize = true;
@@ -162,12 +150,12 @@
//
// textJobName
//
- this.textJobName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textJobName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textJobName.Location = new System.Drawing.Point(50, 6);
this.textJobName.Name = "textJobName";
this.textJobName.ReadOnly = true;
- this.textJobName.Size = new System.Drawing.Size(311, 20);
+ this.textJobName.Size = new System.Drawing.Size(501, 20);
this.textJobName.TabIndex = 2;
//
// label1
@@ -181,20 +169,19 @@
//
// listLimits
//
- this.listLimits.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listLimits.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listLimits.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnLimit,
this.columnValue});
- this.listLimits.DoubleClickChecks = true;
this.listLimits.FullRowSelect = true;
this.listLimits.HideSelection = false;
this.listLimits.Location = new System.Drawing.Point(6, 165);
this.listLimits.MultiSelect = false;
this.listLimits.Name = "listLimits";
this.listLimits.ShowItemToolTips = true;
- this.listLimits.Size = new System.Drawing.Size(436, 237);
+ this.listLimits.Size = new System.Drawing.Size(626, 237);
this.listLimits.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listLimits.TabIndex = 0;
this.listLimits.UseCompatibleStateImageBehavior = false;
@@ -212,19 +199,18 @@
//
// listProcesses
//
- this.listProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listProcesses.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnName,
this.columnPid});
- this.listProcesses.DoubleClickChecks = true;
this.listProcesses.FullRowSelect = true;
this.listProcesses.HideSelection = false;
this.listProcesses.Location = new System.Drawing.Point(6, 50);
this.listProcesses.MultiSelect = false;
this.listProcesses.Name = "listProcesses";
this.listProcesses.ShowItemToolTips = true;
- this.listProcesses.Size = new System.Drawing.Size(436, 96);
+ this.listProcesses.Size = new System.Drawing.Size(626, 96);
this.listProcesses.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listProcesses.TabIndex = 0;
this.listProcesses.UseCompatibleStateImageBehavior = false;
@@ -245,7 +231,7 @@
this.tabStatistics.Location = new System.Drawing.Point(4, 22);
this.tabStatistics.Name = "tabStatistics";
this.tabStatistics.Padding = new System.Windows.Forms.Padding(3);
- this.tabStatistics.Size = new System.Drawing.Size(448, 408);
+ this.tabStatistics.Size = new System.Drawing.Size(638, 408);
this.tabStatistics.TabIndex = 2;
this.tabStatistics.Text = "Statistics";
this.tabStatistics.UseVisualStyleBackColor = true;
@@ -260,7 +246,7 @@
this.flowStatistics.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowStatistics.Location = new System.Drawing.Point(3, 3);
this.flowStatistics.Name = "flowStatistics";
- this.flowStatistics.Size = new System.Drawing.Size(442, 402);
+ this.flowStatistics.Size = new System.Drawing.Size(632, 402);
this.flowStatistics.TabIndex = 2;
//
// groupGeneral
@@ -726,14 +712,26 @@
this.timerUpdate.Interval = 1000;
this.timerUpdate.Tick += new System.EventHandler(this.timerUpdate_Tick);
//
+ // buttonTerminate
+ //
+ this.buttonTerminate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonTerminate.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.buttonTerminate.Location = new System.Drawing.Point(557, 6);
+ this.buttonTerminate.Name = "buttonTerminate";
+ this.buttonTerminate.Size = new System.Drawing.Size(75, 23);
+ this.buttonTerminate.TabIndex = 5;
+ this.buttonTerminate.Text = "Terminate";
+ this.buttonTerminate.UseVisualStyleBackColor = true;
+ this.buttonTerminate.Click += new System.EventHandler(this.buttonTerminate_Click);
+ //
// JobProperties
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.tabControl);
+ this.DoubleBuffered = true;
this.Name = "JobProperties";
- this.Size = new System.Drawing.Size(456, 434);
+ this.Size = new System.Drawing.Size(646, 434);
this.tabControl.ResumeLayout(false);
this.tabGeneral.ResumeLayout(false);
this.tabGeneral.PerformLayout();
@@ -763,11 +761,11 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textJobName;
private System.Windows.Forms.Label label1;
- private ExtendedListView listProcesses;
+ private System.Windows.Forms.ListView listProcesses;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnPid;
private System.Windows.Forms.Label label3;
- private ExtendedListView listLimits;
+ private System.Windows.Forms.ListView listLimits;
private System.Windows.Forms.ColumnHeader columnLimit;
private System.Windows.Forms.ColumnHeader columnValue;
private System.Windows.Forms.GroupBox groupGeneral;
diff --git a/1.x/trunk/ProcessHacker/Components/JobProperties.cs b/1.x/trunk/ProcessHacker/Components/JobProperties.cs
index 5aa5d8e4b..c52274161 100644
--- a/1.x/trunk/ProcessHacker/Components/JobProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/JobProperties.cs
@@ -33,14 +33,17 @@ namespace ProcessHacker.Components
{
public partial class JobProperties : UserControl
{
- private readonly JobObjectHandle _jobObject;
+ private JobObjectHandle _jobObject;
public JobProperties(JobObjectHandle jobObject)
{
InitializeComponent();
+ listProcesses.SetTheme("explorer");
listProcesses.AddShortcuts();
listProcesses.ContextMenu = listProcesses.GetCopyMenu();
+
+ listLimits.SetTheme("explorer");
listLimits.AddShortcuts();
listLimits.ContextMenu = listLimits.GetCopyMenu();
@@ -51,7 +54,7 @@ namespace ProcessHacker.Components
try
{
- string name = _jobObject.ObjectName;
+ string name = _jobObject.GetObjectName();
if (string.IsNullOrEmpty(name))
textJobName.Text = "(unnamed job)";
@@ -63,7 +66,7 @@ namespace ProcessHacker.Components
try
{
- foreach (int pid in _jobObject.ProcessIdList)
+ foreach (int pid in _jobObject.GetProcessIdList())
{
ListViewItem item = new ListViewItem();
@@ -82,8 +85,8 @@ namespace ProcessHacker.Components
try
{
- var extendedLimits = _jobObject.ExtendedLimitInformation;
- var uiRestrictions = _jobObject.BasicUiRestrictions;
+ var extendedLimits = _jobObject.GetExtendedLimitInformation();
+ var uiRestrictions = _jobObject.GetBasicUiRestrictions();
var flags = extendedLimits.BasicLimitInformation.LimitFlags;
if ((flags & JobObjectLimitFlags.ActiveProcess) != 0)
@@ -165,8 +168,8 @@ namespace ProcessHacker.Components
{
try
{
- JobObjectBasicAndIoAccountingInformation accounting = _jobObject.GetBasicAndIoAccountingInformation();
- JobObjectExtendedLimitInformation limits = _jobObject.ExtendedLimitInformation;
+ var accounting = _jobObject.GetBasicAndIoAccountingInformation();
+ var limits = _jobObject.GetExtendedLimitInformation();
labelGeneralActiveProcesses.Text = accounting.BasicInfo.ActiveProcesses.ToString("N0");
labelGeneralTotalProcesses.Text = accounting.BasicInfo.TotalProcesses.ToString("N0");
@@ -201,27 +204,26 @@ namespace ProcessHacker.Components
{
if (OSVersion.HasTaskDialogs)
{
- TaskDialog td = new TaskDialog
+ TaskDialog td = new TaskDialog();
+
+ td.WindowTitle = "Process Hacker";
+ td.MainIcon = TaskDialogIcon.Warning;
+ td.MainInstruction = "Do you want to terminate the job?";
+ td.Content = "Terminating a job will terminate all processes assigned to it. Are you sure " +
+ "you want to continue?";
+ td.Buttons = new TaskDialogButton[]
{
- WindowTitle = "Process Hacker",
- MainInstruction = "Do you want to terminate the job?",
- Content = "Terminating a job will terminate all processes assigned to it. Are you sure " + "you want to continue?",
- MainIcon = TaskDialogIcon.Warning,
- DefaultButton = (int)DialogResult.No,
- Buttons = new TaskDialogButton[]
- {
- new TaskDialogButton((int)DialogResult.Yes, "Terminate"),
- new TaskDialogButton((int)DialogResult.No, "Cancel")
- }
+ new TaskDialogButton((int)DialogResult.Yes, "Terminate"),
+ new TaskDialogButton((int)DialogResult.No, "Cancel")
};
+ td.DefaultButton = (int)DialogResult.No;
if (td.Show(this) == (int)DialogResult.No)
return;
}
else
{
- if (MessageBox.Show(
- "Are you sure you want to terminate the job? This action will " +
+ if (MessageBox.Show("Are you sure you want to terminate the job? This action will " +
"terminate all processes associated with the job.", "Process Hacker",
MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
return;
@@ -229,7 +231,7 @@ namespace ProcessHacker.Components
try
{
- using (NativeHandle jhandle2 = _jobObject.Duplicate(JobObjectAccess.Terminate))
+ using (var jhandle2 = _jobObject.Duplicate(JobObjectAccess.Terminate))
JobObjectHandle.FromHandle(jhandle2).Terminate();
}
catch (Exception ex)
diff --git a/1.x/trunk/ProcessHacker/Components/JobProperties.resx b/1.x/trunk/ProcessHacker/Components/JobProperties.resx
index bfd9c479b..3add4121b 100644
--- a/1.x/trunk/ProcessHacker/Components/JobProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/JobProperties.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/MemoryList.Designer.cs b/1.x/trunk/ProcessHacker/Components/MemoryList.Designer.cs
index 1cd68ea58..27b8fe625 100644
--- a/1.x/trunk/ProcessHacker/Components/MemoryList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/MemoryList.Designer.cs
@@ -31,11 +31,13 @@
///
private void InitializeComponent()
{
- this.listMemory = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnProtection = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.components = new System.ComponentModel.Container();
+ this.listMemory = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnAddress = new System.Windows.Forms.ColumnHeader();
+ this.columnSize = new System.Windows.Forms.ColumnHeader();
+ this.columnProtection = new System.Windows.Forms.ColumnHeader();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.changeMemoryProtectionMemoryMenuItem = new System.Windows.Forms.MenuItem();
this.readWriteMemoryMemoryMenuItem = new System.Windows.Forms.MenuItem();
this.readWriteAddressMemoryMenuItem = new System.Windows.Forms.MenuItem();
@@ -46,6 +48,7 @@
this.menuMemory = new System.Windows.Forms.ContextMenu();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.selectAllMemoryMenuItem = new System.Windows.Forms.MenuItem();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// listMemory
@@ -57,7 +60,6 @@
this.columnSize,
this.columnProtection});
this.listMemory.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listMemory.DoubleClickChecks = true;
this.listMemory.FullRowSelect = true;
this.listMemory.HideSelection = false;
this.listMemory.Location = new System.Drawing.Point(0, 0);
@@ -87,8 +89,14 @@
//
this.columnProtection.Text = "Protection";
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// changeMemoryProtectionMemoryMenuItem
//
+ this.vistaMenu.SetImage(this.changeMemoryProtectionMemoryMenuItem, global::ProcessHacker.Properties.Resources.lock_edit);
this.changeMemoryProtectionMemoryMenuItem.Index = 2;
this.changeMemoryProtectionMemoryMenuItem.Text = "Change &Memory Protection...";
this.changeMemoryProtectionMemoryMenuItem.Click += new System.EventHandler(this.changeMemoryProtectionMemoryMenuItem_Click);
@@ -96,35 +104,41 @@
// readWriteMemoryMemoryMenuItem
//
this.readWriteMemoryMemoryMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.readWriteMemoryMemoryMenuItem, global::ProcessHacker.Properties.Resources.page_edit);
this.readWriteMemoryMemoryMenuItem.Index = 0;
this.readWriteMemoryMemoryMenuItem.Text = "Read/Write Memory";
this.readWriteMemoryMemoryMenuItem.Click += new System.EventHandler(this.readWriteMemoryMemoryMenuItem_Click);
//
// readWriteAddressMemoryMenuItem
//
+ this.vistaMenu.SetImage(this.readWriteAddressMemoryMenuItem, global::ProcessHacker.Properties.Resources.pencil_go);
this.readWriteAddressMemoryMenuItem.Index = 6;
this.readWriteAddressMemoryMenuItem.Text = "Read/Write Address...";
this.readWriteAddressMemoryMenuItem.Click += new System.EventHandler(this.readWriteAddressMemoryMenuItem_Click);
//
// copyMemoryMenuItem
//
+ this.vistaMenu.SetImage(this.copyMemoryMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyMemoryMenuItem.Index = 7;
this.copyMemoryMenuItem.Text = "C&opy";
//
// freeMenuItem
//
+ this.vistaMenu.SetImage(this.freeMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.freeMenuItem.Index = 3;
this.freeMenuItem.Text = "&Free";
this.freeMenuItem.Click += new System.EventHandler(this.freeMenuItem_Click);
//
// decommitMenuItem
//
+ this.vistaMenu.SetImage(this.decommitMenuItem, global::ProcessHacker.Properties.Resources.delete);
this.decommitMenuItem.Index = 4;
this.decommitMenuItem.Text = "&Decommit";
this.decommitMenuItem.Click += new System.EventHandler(this.decommitMenuItem_Click);
//
// dumpMemoryMenuItem
//
+ this.vistaMenu.SetImage(this.dumpMemoryMenuItem, global::ProcessHacker.Properties.Resources.disk);
this.dumpMemoryMenuItem.Index = 1;
this.dumpMemoryMenuItem.Text = "Dump...";
this.dumpMemoryMenuItem.Click += new System.EventHandler(this.dumpMemoryMenuItem_Click);
@@ -158,18 +172,20 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listMemory);
+ this.DoubleBuffered = true;
this.Name = "MemoryList";
this.Size = new System.Drawing.Size(450, 472);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
#endregion
- private ExtendedListView listMemory;
+ private System.Windows.Forms.ListView listMemory;
private System.Windows.Forms.ColumnHeader columnName;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.ColumnHeader columnSize;
private System.Windows.Forms.ColumnHeader columnAddress;
private System.Windows.Forms.ColumnHeader columnProtection;
diff --git a/1.x/trunk/ProcessHacker/Components/MemoryList.cs b/1.x/trunk/ProcessHacker/Components/MemoryList.cs
index 601f20f7b..c205cf43d 100644
--- a/1.x/trunk/ProcessHacker/Components/MemoryList.cs
+++ b/1.x/trunk/ProcessHacker/Components/MemoryList.cs
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
+using System.Reflection;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Common.Ui;
@@ -35,11 +36,12 @@ namespace ProcessHacker.Components
{
public partial class MemoryList : UserControl
{
- private int _runCount;
+ private object _listLock = new object();
+ private int _runCount = 0;
private MemoryProvider _provider;
- private bool _needsSort;
- private readonly List _needsAdd = new List();
- private readonly HighlightingContext _highlightingContext;
+ private bool _needsSort = false;
+ private List _needsAdd = new List();
+ private HighlightingContext _highlightingContext;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
@@ -50,27 +52,28 @@ namespace ProcessHacker.Components
InitializeComponent();
_highlightingContext = new HighlightingContext(listMemory);
- listMemory.KeyDown += this.listMemory_KeyDown;
- listMemory.MouseDown += this.listMemory_MouseDown;
- listMemory.MouseUp += this.listMemory_MouseUp;
+ listMemory.KeyDown += new KeyEventHandler(listMemory_KeyDown);
+ listMemory.MouseDown += new MouseEventHandler(listMemory_MouseDown);
+ listMemory.MouseUp += new MouseEventHandler(listMemory_MouseUp);
ColumnSettings.LoadSettings(Settings.Instance.MemoryListViewColumns, listMemory);
listMemory.ContextMenu = menuMemory;
GenericViewMenu.AddMenuItems(copyMemoryMenuItem.MenuItems, listMemory, null);
listMemory.ListViewItemSorter = new SortedListViewComparer(listMemory)
- {
- SortColumn = 1,
- SortOrder = SortOrder.Ascending
- };
+ {
+ SortColumn = 1,
+ SortOrder = SortOrder.Ascending
+ };
- (listMemory.ListViewItemSorter as SortedListViewComparer).CustomSorters.Add(2, (x, y) =>
- {
- MemoryItem ix = (MemoryItem)x.Tag;
- MemoryItem iy = (MemoryItem)y.Tag;
+ (listMemory.ListViewItemSorter as SortedListViewComparer).CustomSorters.Add(2,
+ (x, y) =>
+ {
+ MemoryItem ix = (MemoryItem)x.Tag;
+ MemoryItem iy = (MemoryItem)y.Tag;
- return ix.Size.CompareTo(iy.Size);
- });
+ return ix.Size.CompareTo(iy.Size);
+ });
}
private void listMemory_MouseUp(object sender, MouseEventArgs e)
@@ -92,20 +95,35 @@ namespace ProcessHacker.Components
if (!e.Handled)
{
- switch (e.KeyCode)
+ if (e.KeyCode == Keys.Enter)
{
- case Keys.Enter:
- this.readWriteMemoryMemoryMenuItem_Click(null, null);
- break;
+ readWriteMemoryMemoryMenuItem_Click(null, null);
}
}
}
#region Properties
+ public new bool DoubleBuffered
+ {
+ get
+ {
+ return (bool)typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listMemory, null);
+ }
+ set
+ {
+ typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listMemory, value, null);
+ }
+ }
+
public override bool Focused
{
- get { return listMemory.Focused; }
+ get
+ {
+ return listMemory.Focused;
+ }
}
public override ContextMenu ContextMenu
@@ -120,7 +138,7 @@ namespace ProcessHacker.Components
set { listMemory.ContextMenuStrip = value; }
}
- public ExtendedListView List
+ public ListView List
{
get { return listMemory; }
}
@@ -132,10 +150,10 @@ namespace ProcessHacker.Components
{
if (_provider != null)
{
- _provider.DictionaryAdded -= this.provider_DictionaryAdded;
- _provider.DictionaryModified -= this.provider_DictionaryModified;
- _provider.DictionaryRemoved -= this.provider_DictionaryRemoved;
- _provider.Updated -= this.provider_Updated;
+ _provider.DictionaryAdded -= new MemoryProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified -= new MemoryProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved -= new MemoryProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated -= new MemoryProvider.ProviderUpdateOnce(provider_Updated);
}
_provider = value;
@@ -145,10 +163,10 @@ namespace ProcessHacker.Components
if (_provider != null)
{
- _provider.DictionaryAdded += this.provider_DictionaryAdded;
- _provider.DictionaryModified += this.provider_DictionaryModified;
- _provider.DictionaryRemoved += this.provider_DictionaryRemoved;
- _provider.Updated += this.provider_Updated;
+ _provider.DictionaryAdded += new MemoryProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified += new MemoryProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved += new MemoryProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated += new MemoryProvider.ProviderUpdateOnce(provider_Updated);
_pid = _provider.Pid;
foreach (MemoryItem item in _provider.Dictionary.Values)
@@ -190,7 +208,7 @@ namespace ProcessHacker.Components
string protectStr;
if (protect == MemoryProtection.AccessDenied)
- protectStr = string.Empty;
+ protectStr = "";
else if ((protect & MemoryProtection.Execute) != 0)
protectStr = "X";
else if ((protect & MemoryProtection.ExecuteRead) != 0)
@@ -222,34 +240,28 @@ namespace ProcessHacker.Components
private string GetStateStr(MemoryState state)
{
- switch (state)
- {
- case MemoryState.Commit:
- return "Commit";
- case MemoryState.Free:
- return "Free";
- case MemoryState.Reserve:
- return "Reserve";
- case MemoryState.Reset:
- return "Reset";
- default:
- return "Unknown";
- }
+ if (state == MemoryState.Commit)
+ return "Commit";
+ else if (state == MemoryState.Free)
+ return "Free";
+ else if (state == MemoryState.Reserve)
+ return "Reserve";
+ else if (state == MemoryState.Reset)
+ return "Reset";
+ else
+ return "Unknown";
}
private string GetTypeStr(MemoryType type)
{
- switch (type)
- {
- case MemoryType.Image:
- return "Image";
- case MemoryType.Mapped:
- return "Mapped";
- case MemoryType.Private:
- return "Private";
- default:
- return "Unknown";
- }
+ if (type == MemoryType.Image)
+ return "Image";
+ else if (type == MemoryType.Mapped)
+ return "Mapped";
+ else if (type == MemoryType.Private)
+ return "Private";
+ else
+ return "Unknown";
}
private void provider_Updated()
@@ -289,27 +301,23 @@ namespace ProcessHacker.Components
private void FillMemoryListViewItem(ListViewItem litem, MemoryItem item)
{
- switch (item.State)
+ if (item.State == MemoryState.Free)
{
- case MemoryState.Free:
- litem.Text = "Free";
- break;
- default:
- if (item.Type == MemoryType.Image)
- {
- if (!string.IsNullOrEmpty(item.ModuleName))
- litem.Text = item.ModuleName;
- else
- litem.Text = "Image";
+ litem.Text = "Free";
+ }
+ else if (item.Type == MemoryType.Image)
+ {
+ if (item.ModuleName != null)
+ litem.Text = item.ModuleName;
+ else
+ litem.Text = "Image";
- litem.Text += " (" + this.GetStateStr(item.State) + ")";
- }
- else
- {
- litem.Text = this.GetTypeStr(item.Type);
- litem.Text += " (" + this.GetStateStr(item.State) + ")";
- }
- break;
+ litem.Text += " (" + GetStateStr(item.State) + ")";
+ }
+ else
+ {
+ litem.Text = GetTypeStr(item.Type);
+ litem.Text += " (" + GetStateStr(item.State) + ")";
}
litem.SubItems[1].Text = Utils.FormatAddress(item.Address);
@@ -322,14 +330,14 @@ namespace ProcessHacker.Components
{
this.BeginInvoke(new MethodInvoker(() =>
{
- HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, item.RunId > 0 && _runCount > 0)
- {
- Name = item.Address.ToString()
- };
+ HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
+ item.RunId > 0 && _runCount > 0);
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
+ litem.Name = item.Address.ToString();
+
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
this.FillMemoryListViewItem(litem, item);
@@ -340,34 +348,34 @@ namespace ProcessHacker.Components
private void provider_DictionaryModified(MemoryItem oldItem, MemoryItem newItem)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- lock (listMemory)
{
- ListViewItem litem = listMemory.Items[newItem.Address.ToString()];
+ lock (listMemory)
+ {
+ ListViewItem litem = listMemory.Items[newItem.Address.ToString()];
- if (litem != null)
- this.FillMemoryListViewItem(litem, newItem);
- }
- }));
+ if (litem != null)
+ this.FillMemoryListViewItem(litem, newItem);
+ }
+ }));
}
private void provider_DictionaryRemoved(MemoryItem item)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- lock (listMemory)
{
- // FIXME
- try
+ lock (listMemory)
{
- listMemory.Items.RemoveByKey(item.Address.ToString());
+ // FIXME
+ try
+ {
+ listMemory.Items.RemoveByKey(item.Address.ToString());
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
+ }
}
- catch (Exception ex)
- {
- Logging.Log(ex);
- }
- }
- }));
+ }));
}
public void SaveSettings()
@@ -397,7 +405,7 @@ namespace ProcessHacker.Components
}
else
{
- //menuMemory.DisableAll();
+ menuMemory.DisableAll();
dumpMemoryMenuItem.Enabled = true;
readWriteAddressMemoryMenuItem.Enabled = true;
@@ -420,12 +428,10 @@ namespace ProcessHacker.Components
private void changeMemoryProtectionMemoryMenuItem_Click(object sender, EventArgs e)
{
- MemoryItem item = listMemory.SelectedItems[0].Tag as MemoryItem;
+ MemoryItem item = (MemoryItem)listMemory.SelectedItems[0].Tag;
+ VirtualProtectWindow w = new VirtualProtectWindow(_pid, item.Address, item.Size);
- using (VirtualProtectWindow w = new VirtualProtectWindow(_pid, item.Address, item.Size))
- {
- w.ShowDialog();
- }
+ w.ShowDialog();
}
private void readWriteMemoryMemoryMenuItem_Click(object sender, EventArgs e)
@@ -433,42 +439,48 @@ namespace ProcessHacker.Components
if (listMemory.SelectedIndices.Count != 1)
return;
- MemoryItem item = listMemory.SelectedItems[0].Tag as MemoryItem;
+ MemoryItem item = (MemoryItem)listMemory.SelectedItems[0].Tag;
MemoryEditor.ReadWriteMemory(_pid, item.Address, (int)item.Size, false);
}
private void dumpMemoryMenuItem_Click(object sender, EventArgs e)
{
- using (SaveFileDialog sfd = new SaveFileDialog
- {
- FileName = "Memory.bin",
- Filter = "Binary Files (*.bin)|*.bin|All Files (*.*)|*.*"
- })
- {
- if (sfd.ShowDialog() == DialogResult.OK)
- {
- try
- {
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.VmRead))
- using (FileHandle fhandle = FileHandle.CreateWin32(sfd.FileName, FileAccess.GenericWrite, FileShareMode.Read))
- {
- foreach (ListViewItem litem in listMemory.SelectedItems)
- {
- MemoryItem item = (MemoryItem)litem.Tag;
+ SaveFileDialog sfd = new SaveFileDialog();
- using (MemoryAlloc alloc = new MemoryAlloc((int)item.Size))
+ sfd.FileName = "Memory.bin";
+ sfd.Filter = "Binary Files (*.bin)|*.bin|All Files (*.*)|*.*";
+
+ if (sfd.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ using (var phandle = new ProcessHandle(_pid, ProcessAccess.VmRead))
+ using (var fhandle = FileHandle.CreateWin32(sfd.FileName, FileAccess.GenericWrite, FileShareMode.Read))
+ {
+ foreach (ListViewItem litem in listMemory.SelectedItems)
+ {
+ MemoryItem item = (MemoryItem)litem.Tag;
+
+ using (MemoryAlloc alloc = new MemoryAlloc((int)item.Size))
+ {
+ try
{
- phandle.ReadMemory(item.Address, (IntPtr)alloc, (int)item.Size);
- fhandle.Write(alloc.Memory, (int)item.Size);
+ unsafe
+ {
+ phandle.ReadMemory(item.Address, (IntPtr)alloc, (int)item.Size);
+ fhandle.Write(alloc.Memory, (int)item.Size);
+ }
}
+ catch (WindowsException)
+ { }
}
}
}
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to dump the selected memory regions", ex);
- }
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to dump the selected memory regions", ex);
}
}
}
@@ -538,19 +550,14 @@ namespace ProcessHacker.Components
return;
}
- MemoryEditor.ReadWriteMemory(
- _pid,
- regionAddress,
- (int)regionSize,
- false,
- f => f.Select(address.Decrement(regionAddress).ToInt64(), 1)
- );
+ MemoryEditor m_e = MemoryEditor.ReadWriteMemory(_pid, regionAddress, (int)regionSize, false,
+ new Program.MemoryEditorInvokeAction(delegate(MemoryEditor f) { f.Select(address.Decrement(regionAddress).ToInt64(), 1); }));
}
}
private void selectAllMemoryMenuItem_Click(object sender, EventArgs e)
{
- this.listMemory.Items.SelectAll();
+ Utils.SelectAll(listMemory.Items);
}
private void freeMenuItem_Click(object sender, EventArgs e)
@@ -564,9 +571,10 @@ namespace ProcessHacker.Components
{
try
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.VmOperation))
+ using (var phandle =
+ new ProcessHandle(_pid, ProcessAccess.VmOperation))
{
- MemoryItem item = listMemory.SelectedItems[0].Tag as MemoryItem;
+ MemoryItem item = (MemoryItem)listMemory.SelectedItems[0].Tag;
phandle.FreeMemory(item.Address, (int)item.Size, false);
}
@@ -589,9 +597,10 @@ namespace ProcessHacker.Components
{
try
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.VmOperation))
+ using (ProcessHandle phandle =
+ new ProcessHandle(_pid, ProcessAccess.VmOperation))
{
- MemoryItem item = listMemory.SelectedItems[0].Tag as MemoryItem;
+ MemoryItem item = (MemoryItem)listMemory.SelectedItems[0].Tag;
phandle.FreeMemory(item.Address, (int)item.Size, true);
}
diff --git a/1.x/trunk/ProcessHacker/Components/MemoryList.resx b/1.x/trunk/ProcessHacker/Components/MemoryList.resx
index 5c63cffa4..c7d3b3761 100644
--- a/1.x/trunk/ProcessHacker/Components/MemoryList.resx
+++ b/1.x/trunk/ProcessHacker/Components/MemoryList.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
+
+ 125, 17
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/MenuStripEx.cs b/1.x/trunk/ProcessHacker/Components/MenuStripEx.cs
deleted file mode 100644
index 218221483..000000000
--- a/1.x/trunk/ProcessHacker/Components/MenuStripEx.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Windows.Forms;
-
-namespace System
-{
- ///
- /// This class adds some missing functionality that should have been provided in System.Windows.Forms.MenuStrip.
- ///
- public class MenuStripEx : MenuStrip
- {
- private const uint WM_MOUSEACTIVATE = 0x21;
- private static readonly IntPtr MA_ACTIVATE = new IntPtr(1);
- private static readonly IntPtr MA_ACTIVATEANDEAT = new IntPtr(2);
- private const uint MA_NOACTIVATE = 3;
- private static readonly IntPtr MA_NOACTIVATEANDEAT = new IntPtr(4);
-
- private bool clickThrough = true;
-
- /// Gets or sets whether the ToolStripEx honors item clicks when its containing form does not have input focus.
- /// Default value is true, which is the same behavior provided by the base ToolStrip class.
- public bool ClickThrough
- {
- get { return this.clickThrough; }
- set { this.clickThrough = value; }
- }
-
- protected override void WndProc(ref Message m)
- {
- base.WndProc(ref m);
-
- if (this.clickThrough && m.Msg == WM_MOUSEACTIVATE && m.Result == MA_ACTIVATEANDEAT)
- {
- m.Result = MA_ACTIVATE;
- }
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/MessageLabel.Designer.cs b/1.x/trunk/ProcessHacker/Components/MessageLabel.Designer.cs
index 3e7a7c74f..4317ba5ff 100644
--- a/1.x/trunk/ProcessHacker/Components/MessageLabel.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/MessageLabel.Designer.cs
@@ -46,9 +46,9 @@
//
// labelText
//
- this.labelText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelText.Location = new System.Drawing.Point(16, 0);
this.labelText.Name = "labelText";
this.labelText.Size = new System.Drawing.Size(170, 17);
@@ -58,7 +58,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.labelText);
this.Controls.Add(this.pictureIcon);
this.Name = "MessageLabel";
diff --git a/1.x/trunk/ProcessHacker/Components/MessageLabel.cs b/1.x/trunk/ProcessHacker/Components/MessageLabel.cs
index 10b29f6de..bd941c4f2 100644
--- a/1.x/trunk/ProcessHacker/Components/MessageLabel.cs
+++ b/1.x/trunk/ProcessHacker/Components/MessageLabel.cs
@@ -1,6 +1,9 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
+using System.Data;
+using System.Text;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Native.Api;
@@ -27,9 +30,11 @@ namespace ProcessHacker.Components
get { return _icon; }
set
{
+ Image oldImage;
+
_icon = value;
- Image oldImage = this.pictureIcon.Image;
+ oldImage = pictureIcon.Image;
pictureIcon.Image = this.GetBitmap(_icon);
diff --git a/1.x/trunk/ProcessHacker/Components/MessageLabel.resx b/1.x/trunk/ProcessHacker/Components/MessageLabel.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/MessageLabel.resx
+++ b/1.x/trunk/ProcessHacker/Components/MessageLabel.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/ModuleList.Designer.cs b/1.x/trunk/ProcessHacker/Components/ModuleList.Designer.cs
index 3ae00532a..05a595408 100644
--- a/1.x/trunk/ProcessHacker/Components/ModuleList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ModuleList.Designer.cs
@@ -32,11 +32,12 @@
///
private void InitializeComponent()
{
- this.listModules = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnBaseAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnDesc = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.components = new System.ComponentModel.Container();
+ this.listModules = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnBaseAddress = new System.Windows.Forms.ColumnHeader();
+ this.columnSize = new System.Windows.Forms.ColumnHeader();
+ this.columnDesc = new System.Windows.Forms.ColumnHeader();
this.changeMemoryProtectionModuleMenuItem = new System.Windows.Forms.MenuItem();
this.readMemoryModuleMenuItem = new System.Windows.Forms.MenuItem();
this.inspectModuleMenuItem = new System.Windows.Forms.MenuItem();
@@ -51,6 +52,8 @@
this.copyFileNameMenuItem = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.selectAllModuleMenuItem = new System.Windows.Forms.MenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// listModules
@@ -62,7 +65,6 @@
this.columnSize,
this.columnDesc});
this.listModules.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listModules.DoubleClickChecks = true;
this.listModules.FullRowSelect = true;
this.listModules.HideSelection = false;
this.listModules.Location = new System.Drawing.Point(0, 0);
@@ -96,41 +98,48 @@
//
// changeMemoryProtectionModuleMenuItem
//
+ this.vistaMenu.SetImage(this.changeMemoryProtectionModuleMenuItem, global::ProcessHacker.Properties.Resources.lock_edit);
this.changeMemoryProtectionModuleMenuItem.Index = 0;
this.changeMemoryProtectionModuleMenuItem.Text = "Change &Memory Protection...";
this.changeMemoryProtectionModuleMenuItem.Click += new System.EventHandler(this.changeMemoryProtectionModuleMenuItem_Click);
//
// readMemoryModuleMenuItem
//
+ this.vistaMenu.SetImage(this.readMemoryModuleMenuItem, global::ProcessHacker.Properties.Resources.page);
this.readMemoryModuleMenuItem.Index = 2;
this.readMemoryModuleMenuItem.Text = "Read Memory";
this.readMemoryModuleMenuItem.Click += new System.EventHandler(this.readMemoryModuleMenuItem_Click);
//
// inspectModuleMenuItem
//
+ this.vistaMenu.SetImage(this.inspectModuleMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
this.inspectModuleMenuItem.Index = 5;
this.inspectModuleMenuItem.Text = "&Inspect";
this.inspectModuleMenuItem.Click += new System.EventHandler(this.inspectModuleMenuItem_Click);
//
// copyModuleMenuItem
//
+ this.vistaMenu.SetImage(this.copyModuleMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyModuleMenuItem.Index = 8;
this.copyModuleMenuItem.Text = "Copy";
//
// openContainingFolderMenuItem
//
+ this.vistaMenu.SetImage(this.openContainingFolderMenuItem, global::ProcessHacker.Properties.Resources.folder_explore);
this.openContainingFolderMenuItem.Index = 9;
this.openContainingFolderMenuItem.Text = "&Open Containing Folder";
this.openContainingFolderMenuItem.Click += new System.EventHandler(this.openContainingFolderMenuItem_Click);
//
// propertiesMenuItem
//
+ this.vistaMenu.SetImage(this.propertiesMenuItem, global::ProcessHacker.Properties.Resources.application_view_detail);
this.propertiesMenuItem.Index = 10;
this.propertiesMenuItem.Text = "Prope&rties";
this.propertiesMenuItem.Click += new System.EventHandler(this.propertiesMenuItem_Click);
//
// unloadMenuItem
//
+ this.vistaMenu.SetImage(this.unloadMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.unloadMenuItem.Index = 3;
this.unloadMenuItem.Text = "&Unload";
this.unloadMenuItem.Click += new System.EventHandler(this.unloadMenuItem_Click);
@@ -187,24 +196,32 @@
this.selectAllModuleMenuItem.Text = "Select &All";
this.selectAllModuleMenuItem.Click += new System.EventHandler(this.selectAllModuleMenuItem_Click);
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// ModuleList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listModules);
+ this.DoubleBuffered = true;
this.Name = "ModuleList";
this.Size = new System.Drawing.Size(450, 472);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
+
}
#endregion
- private ExtendedListView listModules;
+ private System.Windows.Forms.ListView listModules;
private System.Windows.Forms.ColumnHeader columnBaseAddress;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnSize;
private System.Windows.Forms.ColumnHeader columnDesc;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.ContextMenu menuModule;
private System.Windows.Forms.MenuItem getFuncAddressMenuItem;
private System.Windows.Forms.MenuItem changeMemoryProtectionModuleMenuItem;
diff --git a/1.x/trunk/ProcessHacker/Components/ModuleList.cs b/1.x/trunk/ProcessHacker/Components/ModuleList.cs
index d6a001191..4e4f2d72c 100644
--- a/1.x/trunk/ProcessHacker/Components/ModuleList.cs
+++ b/1.x/trunk/ProcessHacker/Components/ModuleList.cs
@@ -24,6 +24,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
+using System.Reflection;
using System.Windows.Forms;
using Microsoft.Win32;
using ProcessHacker.Common;
@@ -39,9 +40,9 @@ namespace ProcessHacker.Components
public partial class ModuleList : UserControl
{
private ModuleProvider _provider;
- private int _runCount;
- private readonly List _needsAdd = new List();
- private readonly HighlightingContext _highlightingContext;
+ private int _runCount = 0;
+ private List _needsAdd = new List();
+ private HighlightingContext _highlightingContext;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
@@ -54,10 +55,10 @@ namespace ProcessHacker.Components
InitializeComponent();
_highlightingContext = new HighlightingContext(listModules);
- listModules.KeyDown += this.ModuleList_KeyDown;
- listModules.MouseDown += this.listModules_MouseDown;
- listModules.MouseUp += this.listModules_MouseUp;
- listModules.DoubleClick += this.listModules_DoubleClick;
+ listModules.KeyDown += new KeyEventHandler(ModuleList_KeyDown);
+ listModules.MouseDown += new MouseEventHandler(listModules_MouseDown);
+ listModules.MouseUp += new MouseEventHandler(listModules_MouseUp);
+ listModules.DoubleClick += new EventHandler(listModules_DoubleClick);
ColumnSettings.LoadSettings(Settings.Instance.ModuleListViewColumns, listModules);
listModules.ContextMenu = menuModule;
@@ -90,6 +91,20 @@ namespace ProcessHacker.Components
#region Properties
+ public new bool DoubleBuffered
+ {
+ get
+ {
+ return (bool)typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listModules, null);
+ }
+ set
+ {
+ typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listModules, value, null);
+ }
+ }
+
public override bool Focused
{
get
@@ -110,7 +125,7 @@ namespace ProcessHacker.Components
set { listModules.ContextMenuStrip = value; }
}
- public ExtendedListView List
+ public ListView List
{
get { return listModules; }
}
@@ -122,9 +137,9 @@ namespace ProcessHacker.Components
{
if (_provider != null)
{
- _provider.DictionaryAdded -= this.provider_DictionaryAdded;
- _provider.DictionaryRemoved -= this.provider_DictionaryRemoved;
- _provider.Updated -= this.provider_Updated;
+ _provider.DictionaryAdded -= new ModuleProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryRemoved -= new ModuleProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated -= new ModuleProvider.ProviderUpdateOnce(provider_Updated);
}
_provider = value;
@@ -141,9 +156,9 @@ namespace ProcessHacker.Components
provider_DictionaryAdded(item);
}
- _provider.DictionaryAdded += this.provider_DictionaryAdded;
- _provider.DictionaryRemoved += this.provider_DictionaryRemoved;
- _provider.Updated += this.provider_Updated;
+ _provider.DictionaryAdded += new ModuleProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryRemoved += new ModuleProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated += new ModuleProvider.ProviderUpdateOnce(provider_Updated);
_pid = _provider.Pid;
try
@@ -154,8 +169,10 @@ namespace ProcessHacker.Components
}
else
{
- using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights | Program.MinProcessReadMemoryRights))
- _mainModule = FileUtils.GetFileName(phandle.MainModule.FileName);
+ using (var phandle =
+ new ProcessHandle(_pid,
+ Program.MinProcessQueryRights | Program.MinProcessReadMemoryRights))
+ _mainModule = FileUtils.GetFileName(phandle.GetMainModule().FileName);
}
this.SetMainModule(_mainModule);
@@ -246,12 +263,12 @@ namespace ProcessHacker.Components
(item.Flags & LdrpDataTableEntryFlags.CorImage) != 0
)
return Settings.Instance.ColorDotNetProcesses;
- if (Settings.Instance.UseColorRelocatedDlls &&
+ else if (Settings.Instance.UseColorRelocatedDlls &&
(item.Flags & LdrpDataTableEntryFlags.ImageNotAtBase) != 0
)
return Settings.Instance.ColorRelocatedDlls;
-
- return SystemColors.Window;
+ else
+ return SystemColors.Window;
}
public void AddItem(ModuleItem item)
@@ -270,22 +287,22 @@ namespace ProcessHacker.Components
}
private void provider_DictionaryAdded(ModuleItem item)
- {
- HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, item.RunId > 0 && _runCount > 0)
- {
- Name = item.BaseAddress.ToString(),
- Text = item.Name
- };
+ {
+ HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
+ item.RunId > 0 && _runCount > 0);
+ litem.Name = item.BaseAddress.ToString();
+ litem.Text = item.Name;
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, Utils.FormatAddress(item.BaseAddress)));
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, Utils.FormatSize(item.Size)));
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.FileDescription));
- litem.ToolTipText = PhUtils.FormatFileInfo(item.FileName, item.FileDescription, item.FileCompanyName, item.FileVersion, 0);
+ litem.ToolTipText = PhUtils.FormatFileInfo(
+ item.FileName, item.FileDescription, item.FileCompanyName, item.FileVersion, 0);
litem.Tag = item;
litem.NormalColor = this.GetModuleColor(item);
if (item.FileName.Equals(_mainModule, StringComparison.OrdinalIgnoreCase))
- litem.Font = new Font(litem.Font, FontStyle.Bold);
+ litem.Font = new System.Drawing.Font(litem.Font, System.Drawing.FontStyle.Bold);
lock (_needsAdd)
_needsAdd.Add(litem);
@@ -293,7 +310,10 @@ namespace ProcessHacker.Components
private void provider_DictionaryRemoved(ModuleItem item)
{
- this.BeginInvoke(new MethodInvoker(() => this.listModules.Items[item.BaseAddress.ToString()].Remove()));
+ this.BeginInvoke(new MethodInvoker(() =>
+ {
+ listModules.Items[item.BaseAddress.ToString()].Remove();
+ }));
}
public void SaveSettings()
@@ -312,9 +332,9 @@ namespace ProcessHacker.Components
{
if (_pid == 4)
{
- //menuModule.DisableAll();
+ menuModule.DisableAll();
- //if (KProcessHacker.Instance != null)
+ if (KProcessHacker.Instance != null)
unloadMenuItem.Enabled = true;
inspectModuleMenuItem.Enabled = true;
@@ -331,7 +351,7 @@ namespace ProcessHacker.Components
}
else
{
- // menuModule.DisableAll();
+ menuModule.DisableAll();
if (listModules.SelectedItems.Count > 1)
{
@@ -365,7 +385,7 @@ namespace ProcessHacker.Components
private void copyFileNameMenuItem_Click(object sender, EventArgs e)
{
- string text = string.Empty;
+ string text = "";
for (int i = 0; i < listModules.SelectedItems.Count; i++)
{
@@ -399,14 +419,22 @@ namespace ProcessHacker.Components
{
try
{
- Program.GetPEWindow(this.GetItemFileName(listModules.SelectedItems[0]), f =>
- {
- if (!f.IsDisposed)
+ PEWindow pw = Program.GetPEWindow(this.GetItemFileName(listModules.SelectedItems[0]),
+ new Program.PEWindowInvokeAction(delegate(PEWindow f)
{
- f.Show();
- f.Activate();
- }
- });
+ if (!f.IsDisposed)
+ {
+ try
+ {
+ f.Show();
+ f.Activate();
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
+ }
+ }
+ }));
}
catch (Exception ex)
{
@@ -416,32 +444,30 @@ namespace ProcessHacker.Components
private void getFuncAddressMenuItem_Click(object sender, EventArgs e)
{
- using (GetProcAddressWindow gpaWindow = new GetProcAddressWindow(this.GetItemFileName(listModules.SelectedItems[0])))
- {
- gpaWindow.ShowDialog();
- }
+ GetProcAddressWindow gpaWindow = new GetProcAddressWindow(
+ this.GetItemFileName(listModules.SelectedItems[0]));
+
+ gpaWindow.ShowDialog();
}
private void changeMemoryProtectionModuleMenuItem_Click(object sender, EventArgs e)
{
- ModuleItem item = this.listModules.SelectedItems[0].Tag as ModuleItem;
-
- using (VirtualProtectWindow w = new VirtualProtectWindow(_pid, item.BaseAddress.ToIntPtr(), item.Size))
- {
- w.ShowDialog();
- }
+ ModuleItem item = (ModuleItem)listModules.SelectedItems[0].Tag;
+ VirtualProtectWindow w = new VirtualProtectWindow(_pid, item.BaseAddress.ToIntPtr(), item.Size);
+
+ w.ShowDialog();
}
private void readMemoryModuleMenuItem_Click(object sender, EventArgs e)
{
- ModuleItem item = this.listModules.SelectedItems[0].Tag as ModuleItem;
+ ModuleItem item = (ModuleItem)listModules.SelectedItems[0].Tag;
MemoryEditor.ReadWriteMemory(_pid, item.BaseAddress.ToIntPtr(), item.Size, true);
}
private void selectAllModuleMenuItem_Click(object sender, EventArgs e)
{
- this.listModules.Items.SelectAll();
+ Utils.SelectAll(listModules.Items);
}
private void unloadMenuItem_Click(object sender, EventArgs e)
@@ -460,23 +486,23 @@ namespace ProcessHacker.Components
{
try
{
- ModuleItem moduleItem = listModules.SelectedItems[0].Tag as ModuleItem;
+ var moduleItem = (ModuleItem)listModules.SelectedItems[0].Tag;
string serviceName = null;
// Try to find the name of the service key for the driver by
// looping through the objects in the Driver directory and
// opening each one.
- using (DirectoryHandle dhandle = new DirectoryHandle("\\Driver", DirectoryAccess.Query))
+ using (var dhandle = new DirectoryHandle("\\Driver", DirectoryAccess.Query))
{
- foreach (DirectoryHandle.ObjectEntry obj in dhandle.GetObjects())
+ foreach (var obj in dhandle.GetObjects())
{
try
{
- using (DriverHandle driverHandle = new DriverHandle("\\Driver\\" + obj.Name))
+ using (var driverHandle = new DriverHandle("\\Driver\\" + obj.Name))
{
- if (driverHandle.BasicInformation.DriverStart == moduleItem.BaseAddress.ToIntPtr())
+ if (driverHandle.GetBasicInformation().DriverStart == moduleItem.BaseAddress.ToIntPtr())
{
- serviceName = driverHandle.ServiceKeyName;
+ serviceName = driverHandle.GetServiceKeyName();
break;
}
}
@@ -487,7 +513,7 @@ namespace ProcessHacker.Components
}
// If we didn't find the service name, use the driver base name.
- if (string.IsNullOrEmpty(serviceName))
+ if (serviceName == null)
{
if (moduleItem.Name.EndsWith(".sys", StringComparison.OrdinalIgnoreCase))
serviceName = moduleItem.Name.Remove(moduleItem.Name.Length - 4, 4);
@@ -495,13 +521,15 @@ namespace ProcessHacker.Components
serviceName = moduleItem.Name;
}
- RegistryKey servicesKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services", true);
+ RegistryKey servicesKey =
+ Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services", true);
bool serviceKeyCreated;
RegistryKey serviceKey;
// Check if the service key exists so that we don't delete it
// later if it does.
- if (Array.Exists(servicesKey.GetSubKeyNames(), keyName => string.Compare(keyName, serviceName, true) == 0))
+ if (Array.Exists(servicesKey.GetSubKeyNames(),
+ (keyName) => (string.Compare(keyName, serviceName, true) == 0)))
{
serviceKeyCreated = false;
}
@@ -544,10 +572,11 @@ namespace ProcessHacker.Components
{
try
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights | ProcessAccess.VmOperation |
+ using (ProcessHandle phandle = new ProcessHandle(_pid,
+ Program.MinProcessQueryRights | ProcessAccess.VmOperation |
ProcessAccess.VmRead | ProcessAccess.VmWrite | ProcessAccess.CreateThread))
{
- IntPtr baseAddress = (listModules.SelectedItems[0].Tag as ModuleItem).BaseAddress.ToIntPtr();
+ IntPtr baseAddress = ((ModuleItem)listModules.SelectedItems[0].Tag).BaseAddress.ToIntPtr();
phandle.SetModuleReferenceCount(baseAddress, 1);
@@ -579,11 +608,13 @@ namespace ProcessHacker.Components
{
if (OSVersion.Architecture == OSArch.Amd64)
{
- PhUtils.ShowError("Unable to find the module to unload. This may be caused by an attempt to unload a mapped file or a 32-bit module.");
+ PhUtils.ShowError("Unable to find the module to unload. This may be caused " +
+ "by an attempt to unload a mapped file or a 32-bit module.");
}
else
{
- PhUtils.ShowError("Unable to find the module to unload. This may be caused by an attempt to unload a mapped file.");
+ PhUtils.ShowError("Unable to find the module to unload. This may be caused " +
+ "by an attempt to unload a mapped file.");
}
}
else
@@ -606,7 +637,7 @@ namespace ProcessHacker.Components
public class ModuleListComparer : ISortedListViewComparer
{
- private readonly string _mainModule;
+ private string _mainModule;
public ModuleListComparer(string mainModule)
{
@@ -615,8 +646,8 @@ namespace ProcessHacker.Components
public int Compare(ListViewItem x, ListViewItem y, int column)
{
- ModuleItem mx = x.Tag as ModuleItem;
- ModuleItem my = y.Tag as ModuleItem;
+ ModuleItem mx = (ModuleItem)x.Tag;
+ ModuleItem my = (ModuleItem)y.Tag;
if (mx.FileName.Equals(_mainModule, StringComparison.OrdinalIgnoreCase))
return -1;
diff --git a/1.x/trunk/ProcessHacker/Components/ModuleList.resx b/1.x/trunk/ProcessHacker/Components/ModuleList.resx
index 3863ef654..70244693e 100644
--- a/1.x/trunk/ProcessHacker/Components/ModuleList.resx
+++ b/1.x/trunk/ProcessHacker/Components/ModuleList.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+ 17, 17
+
+
120, 20
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/MutantProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/MutantProperties.Designer.cs
index cd693c704..9fccd3850 100644
--- a/1.x/trunk/ProcessHacker/Components/MutantProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/MutantProperties.Designer.cs
@@ -44,7 +44,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 3);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(84, 13);
+ this.label1.Size = new System.Drawing.Size(75, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Current Count:";
//
@@ -53,7 +53,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 26);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(71, 13);
+ this.label3.Size = new System.Drawing.Size(65, 13);
this.label3.TabIndex = 0;
this.label3.Text = "Abandoned:";
//
@@ -71,7 +71,7 @@
this.labelAbandoned.AutoSize = true;
this.labelAbandoned.Location = new System.Drawing.Point(102, 26);
this.labelAbandoned.Name = "labelAbandoned";
- this.labelAbandoned.Size = new System.Drawing.Size(33, 13);
+ this.labelAbandoned.Size = new System.Drawing.Size(32, 13);
this.labelAbandoned.TabIndex = 0;
this.labelAbandoned.Text = "False";
//
@@ -80,14 +80,14 @@
this.labelLabelOwner.AutoSize = true;
this.labelLabelOwner.Location = new System.Drawing.Point(6, 49);
this.labelLabelOwner.Name = "labelLabelOwner";
- this.labelLabelOwner.Size = new System.Drawing.Size(45, 13);
+ this.labelLabelOwner.Size = new System.Drawing.Size(41, 13);
this.labelLabelOwner.TabIndex = 1;
this.labelLabelOwner.Text = "Owner:";
//
// labelOwner
//
- this.labelOwner.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelOwner.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelOwner.AutoEllipsis = true;
this.labelOwner.Location = new System.Drawing.Point(102, 49);
this.labelOwner.Name = "labelOwner";
@@ -99,7 +99,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.labelOwner);
this.Controls.Add(this.labelLabelOwner);
this.Controls.Add(this.label3);
diff --git a/1.x/trunk/ProcessHacker/Components/MutantProperties.cs b/1.x/trunk/ProcessHacker/Components/MutantProperties.cs
index b0f1efe57..374225f07 100644
--- a/1.x/trunk/ProcessHacker/Components/MutantProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/MutantProperties.cs
@@ -1,13 +1,12 @@
using System.Windows.Forms;
using ProcessHacker.Native;
-using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
namespace ProcessHacker.Components
{
public partial class MutantProperties : UserControl
{
- private readonly MutantHandle _mutantHandle;
+ private MutantHandle _mutantHandle;
public MutantProperties(MutantHandle mutantHandle)
{
@@ -21,7 +20,7 @@ namespace ProcessHacker.Components
private void UpdateInfo()
{
- MutantBasicInformation basicInfo = _mutantHandle.BasicInformation;
+ var basicInfo = _mutantHandle.GetBasicInformation();
labelCurrentCount.Text = basicInfo.CurrentCount.ToString();
labelAbandoned.Text = basicInfo.AbandonedState.ToString();
@@ -29,7 +28,7 @@ namespace ProcessHacker.Components
// Windows Vista and above have owner information.
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
{
- MutantOwnerInformation ownerInfo = _mutantHandle.OwnerInformation;
+ var ownerInfo = _mutantHandle.GetOwnerInformation();
if (ownerInfo.ClientId.ProcessId != 0)
{
diff --git a/1.x/trunk/ProcessHacker/Components/MutantProperties.resx b/1.x/trunk/ProcessHacker/Components/MutantProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/MutantProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/MutantProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/NetworkList.Designer.cs b/1.x/trunk/ProcessHacker/Components/NetworkList.Designer.cs
index 5226dd496..9d62847ce 100644
--- a/1.x/trunk/ProcessHacker/Components/NetworkList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/NetworkList.Designer.cs
@@ -34,14 +34,14 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NetworkList));
- this.listNetwork = new ProcessHacker.Components.ExtendedListView();
- this.columnProcess = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnLocal = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnLocalPort = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnRemote = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnRemotePort = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnProtocol = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnState = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listNetwork = new System.Windows.Forms.ListView();
+ this.columnProcess = new System.Windows.Forms.ColumnHeader();
+ this.columnLocal = new System.Windows.Forms.ColumnHeader();
+ this.columnLocalPort = new System.Windows.Forms.ColumnHeader();
+ this.columnRemote = new System.Windows.Forms.ColumnHeader();
+ this.columnRemotePort = new System.Windows.Forms.ColumnHeader();
+ this.columnProtocol = new System.Windows.Forms.ColumnHeader();
+ this.columnState = new System.Windows.Forms.ColumnHeader();
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.SuspendLayout();
//
@@ -57,7 +57,6 @@
this.columnProtocol,
this.columnState});
this.listNetwork.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listNetwork.DoubleClickChecks = true;
this.listNetwork.FullRowSelect = true;
this.listNetwork.HideSelection = false;
this.listNetwork.Location = new System.Drawing.Point(0, 0);
@@ -115,8 +114,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listNetwork);
+ this.DoubleBuffered = true;
this.Name = "NetworkList";
this.Size = new System.Drawing.Size(685, 472);
this.ResumeLayout(false);
@@ -125,7 +124,7 @@
#endregion
- private ExtendedListView listNetwork;
+ private System.Windows.Forms.ListView listNetwork;
private System.Windows.Forms.ColumnHeader columnLocal;
private System.Windows.Forms.ColumnHeader columnRemote;
private System.Windows.Forms.ColumnHeader columnRemotePort;
diff --git a/1.x/trunk/ProcessHacker/Components/NetworkList.cs b/1.x/trunk/ProcessHacker/Components/NetworkList.cs
index 73c67c7e0..5e69f9658 100644
--- a/1.x/trunk/ProcessHacker/Components/NetworkList.cs
+++ b/1.x/trunk/ProcessHacker/Components/NetworkList.cs
@@ -23,6 +23,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Reflection;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Common.Ui;
@@ -33,11 +34,11 @@ namespace ProcessHacker.Components
public partial class NetworkList : UserControl
{
private NetworkProvider _provider;
- private int _runCount;
- private readonly List _needsAdd = new List();
- private readonly HighlightingContext _highlightingContext;
- private bool _needsSort;
- private bool _needsImageKeyReset;
+ private int _runCount = 0;
+ private List _needsAdd = new List();
+ private HighlightingContext _highlightingContext;
+ private bool _needsSort = false;
+ private bool _needsImageKeyReset = false;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseMove;
@@ -50,14 +51,14 @@ namespace ProcessHacker.Components
InitializeComponent();
_highlightingContext = new HighlightingContext(listNetwork);
-
+ listNetwork.SetTheme("explorer");
listNetwork.ListViewItemSorter = new SortedListViewComparer(listNetwork);
- listNetwork.KeyDown += this.NetworkList_KeyDown;
- listNetwork.MouseDown += this.listNetwork_MouseDown;
- listNetwork.MouseMove += this.listNetwork_MouseMove;
- listNetwork.MouseUp += this.listNetwork_MouseUp;
- listNetwork.DoubleClick += this.listNetwork_DoubleClick;
- listNetwork.SelectedIndexChanged += this.listNetwork_SelectedIndexChanged;
+ listNetwork.KeyDown += new KeyEventHandler(NetworkList_KeyDown);
+ listNetwork.MouseDown += new MouseEventHandler(listNetwork_MouseDown);
+ listNetwork.MouseMove += new MouseEventHandler(listNetwork_MouseMove);
+ listNetwork.MouseUp += new MouseEventHandler(listNetwork_MouseUp);
+ listNetwork.DoubleClick += new EventHandler(listNetwork_DoubleClick);
+ listNetwork.SelectedIndexChanged += new System.EventHandler(listNetwork_SelectedIndexChanged);
}
private void listNetwork_DoubleClick(object sender, EventArgs e)
@@ -95,7 +96,7 @@ namespace ProcessHacker.Components
}
}
- private void listNetwork_SelectedIndexChanged(object sender, EventArgs e)
+ private void listNetwork_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.SelectedIndexChanged != null)
this.SelectedIndexChanged(sender, e);
@@ -109,6 +110,20 @@ namespace ProcessHacker.Components
#region Properties
+ public new bool DoubleBuffered
+ {
+ get
+ {
+ return (bool)typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listNetwork, null);
+ }
+ set
+ {
+ typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listNetwork, value, null);
+ }
+ }
+
public override bool Focused
{
get
@@ -161,10 +176,10 @@ namespace ProcessHacker.Components
provider_DictionaryAdded(item);
}
- _provider.DictionaryAdded += this.provider_DictionaryAdded;
- _provider.DictionaryModified += this.provider_DictionaryModified;
- _provider.DictionaryRemoved += this.provider_DictionaryRemoved;
- _provider.Updated += this.provider_Updated;
+ _provider.DictionaryAdded += new NetworkProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified += new NetworkProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved += new NetworkProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated += new NetworkProvider.ProviderUpdateOnce(provider_Updated);
}
}
}
@@ -222,7 +237,7 @@ namespace ProcessHacker.Components
{
string t = lvItem.ImageKey;
- lvItem.ImageKey = string.Empty;
+ lvItem.ImageKey = "";
lvItem.ImageKey = t;
}
}
@@ -342,11 +357,10 @@ namespace ProcessHacker.Components
private void provider_DictionaryAdded(NetworkItem item)
{
- HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, item.Tag > 0 && _runCount > 0)
- {
- Name = item.Id,
- Tag = item
- };
+ HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, (int)item.Tag > 0 && _runCount > 0);
+
+ litem.Name = item.Id;
+ litem.Tag = item;
Icon icon = null;
@@ -394,8 +408,8 @@ namespace ProcessHacker.Components
}
else
{
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
}
if (item.Connection.Remote != null && !item.Connection.Remote.IsEmpty())
@@ -405,14 +419,14 @@ namespace ProcessHacker.Components
}
else
{
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
}
this.FillNetworkItemAddresses(litem, item);
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Connection.Protocol.ToString().ToUpper()));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Connection.State != 0 ? item.Connection.State.ToString() : string.Empty));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Connection.State != 0 ? item.Connection.State.ToString() : ""));
lock (_needsAdd)
_needsAdd.Add(litem);
@@ -432,7 +446,7 @@ namespace ProcessHacker.Components
this.FillNetworkItemAddresses(litem, newItem);
- litem.SubItems[6].Text = newItem.Connection.State != 0 ? newItem.Connection.State.ToString() : string.Empty;
+ litem.SubItems[6].Text = newItem.Connection.State != 0 ? newItem.Connection.State.ToString() : "";
_needsSort = true;
}
}));
diff --git a/1.x/trunk/ProcessHacker/Components/NetworkList.resx b/1.x/trunk/ProcessHacker/Components/NetworkList.resx
index 253cdb668..c680ceefe 100644
--- a/1.x/trunk/ProcessHacker/Components/NetworkList.resx
+++ b/1.x/trunk/ProcessHacker/Components/NetworkList.resx
@@ -112,40 +112,40 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
- AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACc
- BQAAAk1TRnQBSQFMAwEBAAEkAQABJAEAARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA
+ BQAAAk1TRnQBSQFMAwEBAAEcAQABHAEAARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA
ARADAAEBAQABIAYAARD/AP8AFAABlwGSAY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/
AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGS
AY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGSAY8B/8AAAZcBkgGPCf8D/gH/A/wB/wP6Af8D+AH/A/UB/wPz
Af8D8QH/A+4B/wPsAf8D6QH/A+gB/wPmAf8BlwGSAY8B/8AAAZcBkgGPCf8D/gH/A/wB/wP6Af8D+AH/
- A/UB/wP1Af8D8wH/A/AB/wPuAf8D6wH/A+kB/wPnAf8BlwGSAY8B/8AAAZcBkgGPBf8BhwGdAU0B/wGC
- AaIBUQH/AXUBqAFVAf8BbwGtAVkB/wFrAbEBXQH/A/cB/wHNAcwBygH/Ac0BzAHKAf8BzQHMAcoB/wHN
- AcwBygH/A+0B/wPrAf8D6AH/AZcBkgGPAf/AAAGXAZIBjwX/AY0BlAFHAf8BiQGaAUsB/wGEAaABTwH/
- AXcBpQFTAf8BcgGqAVcB/wP5Af8D9gH/A/QB/wP0Af8D8QH/A+8B/wPsAf8D6gH/AZcBkgGPAf/AAAGX
- AZIBjwX/AZMBiQFCAf8BjwGQAUUB/wGLAZcBSQH/AYcBnQFNAf8BggGiAVEB/wP7Af8BzQHMAcoB/wHN
- AcwBygH/Ac0BzAHKAf8BzQHMAcoB/wPxAf8BcwGpAVYB/wPsAf8BlwGSAY8B/8AAAZcBkgGPBf8BmAF0
- ATwB/wGVAYQBQAH/AZEBjAFDAf8BjQGUAUcB/wGJAZoBSwH/A/wB/wP6Af8D+AH/A/gB/wP1Af8D8wH/
- AYsBlwFJAf8D7gH/AZcBkgGPAf/AAAGXAZIBjwX/AZ0BagE3Af8BmgFxAToB/wGWAYABPgH/AZMBiQFC
- Af8BjwGQAUUB/wP9Af8BzQHMAcoB/wHNAcwBygH/Ac0BzAHKAf8BzQHMAcoB/wP1Af8BlwF2AT0B/wPv
- Af8BlwGSAY8B/8AAAZcBkgGPBf8BoAFiATQB/wGeAWcBNgH/AZsBbQE5Af8BmAF0ATwB/wGVAYQBQAH/
- A/4B/wP+Af8D/QH/A/sB/wP5Af8D9gH/AaABYgE0Af8D8QH/AZcBkgGPAf/AAAGXAZIBjxn/A/4B/wP+
+ A/UB/wP1Af8D8wH/A/AB/wPuAf8D6wH/A+kB/wPnAf8BlwGSAY8B/8AAAZcBkgGPBf8BhwGdAU4B/wGC
+ AaIBUgH/AXYBqAFWAf8BcAGtAVoB/wFsAbEBXgH/A/cB/wHNAcwBygH/Ac0BzAHKAf8BzQHMAcoB/wHN
+ AcwBygH/A+0B/wPrAf8D6AH/AZcBkgGPAf/AAAGXAZIBjwX/AY0BlAFIAf8BiQGaAUwB/wGEAaABUAH/
+ AXgBpQFUAf8BcwGqAVgB/wP5Af8D9gH/A/QB/wP0Af8D8QH/A+8B/wPsAf8D6gH/AZcBkgGPAf/AAAGX
+ AZIBjwX/AZMBiQFDAf8BjwGQAUYB/wGLAZcBSgH/AYcBnQFOAf8BggGiAVIB/wP7Af8BzQHMAcoB/wHN
+ AcwBygH/Ac0BzAHKAf8BzQHMAcoB/wPxAf8BdAGpAVcB/wPsAf8BlwGSAY8B/8AAAZcBkgGPBf8BmAF1
+ AT0B/wGVAYQBQQH/AZEBjAFEAf8BjQGUAUgB/wGJAZoBTAH/A/wB/wP6Af8D+AH/A/gB/wP1Af8D8wH/
+ AYsBlwFKAf8D7gH/AZcBkgGPAf/AAAGXAZIBjwX/AZ0BawE4Af8BmgFyATsB/wGWAYABPwH/AZMBiQFD
+ Af8BjwGQAUYB/wP9Af8BzQHMAcoB/wHNAcwBygH/Ac0BzAHKAf8BzQHMAcoB/wP1Af8BlwF3AT4B/wPv
+ Af8BlwGSAY8B/8AAAZcBkgGPBf8BoAFjATUB/wGeAWgBNwH/AZsBbgE6Af8BmAF1AT0B/wGVAYQBQQH/
+ A/4B/wP+Af8D/QH/A/sB/wP5Af8D9gH/AaABYwE1Af8D8QH/AZcBkgGPAf/AAAGXAZIBjxn/A/4B/wP+
Af8D/QH/A/sB/wP5Af8D9gH/A/QB/wPxAf8BlwGSAY8B/8AAAZcBkgGPAf8BzQHMAcoB/wHNAcwBygH/
Ac0BzAHKAf8BzQHMAcoB/wHNAcwBygH/Ac0BzAHKAf8BzQHMAcoB/wHNAcwBygH/Ac0BzAHKAf8BzQHM
AcoB/wHNAcwBygH/Ac0BzAHKAf8BzQHMAcoB/wHNAcwBygH/AZcBkgGPAf/AAAGXAZIBjwH/AeAB2QHT
Af8B4AHZAdMB/wHgAdkB0wH/AeAB2QHTAf8B4AHZAdMB/wHgAdkB0wH/AeAB2QHTAf8B4AHZAdMB/wHg
- AdkB0wH/AZEBcQFgAf8B4AHZAdMB/wGRAXEBYAH/AeAB2QHTAf8BkQFxAWAB/wGXAZIBjwH/wAABlwGS
+ AdkB0wH/AZEBcgFhAf8B4AHZAdMB/wGRAXIBYQH/AeAB2QHTAf8BkQFyAWEB/wGXAZIBjwH/wAABlwGS
AY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/
AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGSAY8B/wGXAZIBjwH/AZcBkgGPAf8BlwGS
AY8B//8AwQABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEAAQEFAAGAFwAD/wEAAv8GAAL/bgAC/wYA
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/NodePlotter.cs b/1.x/trunk/ProcessHacker/Components/NodePlotter.cs
similarity index 90%
rename from 1.x/trunk/ProcessHacker/Components/TreeViewAdv/NodePlotter.cs
rename to 1.x/trunk/ProcessHacker/Components/NodePlotter.cs
index 52dbff182..0a14d66eb 100644
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/NodePlotter.cs
+++ b/1.x/trunk/ProcessHacker/Components/NodePlotter.cs
@@ -57,12 +57,10 @@ namespace ProcessHacker.Components
if (_plotter == null)
{
- _plotter = new Plotter
- {
- BackColor = Color.Black,
- ShowGrid = false,
- OverlaySecondLine = false
- };
+ _plotter = new Plotter();
+ _plotter.BackColor = Color.Black;
+ _plotter.ShowGrid = false;
+ _plotter.OverlaySecondLine = false;
}
if (info.UseLongData)
@@ -93,7 +91,6 @@ namespace ProcessHacker.Components
using (Bitmap b = new Bitmap(_plotter.Width, _plotter.Height))
{
_plotter.DrawToBitmap(b, new Rectangle(0, 0, b.Width, b.Height));
-
context.Graphics.DrawImage(b, context.Bounds.Location);
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/Plotter.Designer.cs b/1.x/trunk/ProcessHacker/Components/Plotter.Designer.cs
index 8fb94fae8..9350da62c 100644
--- a/1.x/trunk/ProcessHacker/Components/Plotter.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/Plotter.Designer.cs
@@ -45,14 +45,13 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Name = "Plotter";
this.Size = new System.Drawing.Size(150, 163);
- this.Paint += new System.Windows.Forms.PaintEventHandler(this.Plotter_Paint);
- this.MouseEnter += new System.EventHandler(this.Plotter_MouseEnter);
this.MouseLeave += new System.EventHandler(this.Plotter_MouseLeave);
+ this.Paint += new System.Windows.Forms.PaintEventHandler(this.Plotter_Paint);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Plotter_MouseMove);
this.Resize += new System.EventHandler(this.Plotter_Resize);
+ this.MouseEnter += new System.EventHandler(this.Plotter_MouseEnter);
this.ResumeLayout(false);
}
diff --git a/1.x/trunk/ProcessHacker/Components/Plotter.cs b/1.x/trunk/ProcessHacker/Components/Plotter.cs
index 79aaf14b0..95e339cf9 100644
--- a/1.x/trunk/ProcessHacker/Components/Plotter.cs
+++ b/1.x/trunk/ProcessHacker/Components/Plotter.cs
@@ -65,11 +65,18 @@ namespace ProcessHacker.Components
public GetToolTipDelegate GetToolTip;
- private int _gridStartPos;
+ private int _gridStartPos = 0;
private void Plotter_Paint(object sender, PaintEventArgs e)
{
- this.Render(e.Graphics);
+ try
+ {
+ this.Render(e.Graphics);
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
+ }
}
public void Render(Graphics g)
@@ -148,11 +155,10 @@ namespace ProcessHacker.Components
int hPre = (int)(tHeight - (tHeight * fPre));
// Fill in the area below the line.
- g.FillPolygon(new SolidBrush(Color.FromArgb(100, _lineColor1)),new Point[]
- {
- new Point(px, h), new Point(px + moveStep, hPre),
- new Point(px + moveStep, tHeight), new Point(px, tHeight)
- });
+
+ g.FillPolygon(new SolidBrush(Color.FromArgb(100, _lineColor1)),
+ new Point[] { new Point(px, h), new Point(px + moveStep, hPre),
+ new Point(px + moveStep, tHeight), new Point(px, tHeight) });
g.DrawLine(lGrid1, px, h, px + moveStep, hPre);
if (this.UseSecondLine)
@@ -175,25 +181,20 @@ namespace ProcessHacker.Components
hPre = (int)(tHeight - (tHeight * fPre));
// Draw the second line.
+
if (this.OverlaySecondLine)
{
- g.FillPolygon(new SolidBrush(Color.FromArgb(100, _lineColor2)), new Point[]
- {
- new Point(px, h), new Point(px + moveStep, hPre),
- new Point(px + moveStep, tHeight), new Point(px, tHeight)
- });
-
+ g.FillPolygon(new SolidBrush(Color.FromArgb(100, _lineColor2)),
+ new Point[] { new Point(px, h), new Point(px + moveStep, hPre),
+ new Point(px + moveStep, tHeight), new Point(px, tHeight) });
g.DrawLine(lGrid2, px, h, px + moveStep, hPre);
}
else
{
- g.FillPolygon(new SolidBrush(Color.FromArgb(100, _lineColor2)), new Point[]
- {
- new Point(px, h), new Point(px + moveStep, hPre),
+ g.FillPolygon(new SolidBrush(Color.FromArgb(100, _lineColor2)),
+ new Point[] { new Point(px, h), new Point(px + moveStep, hPre),
new Point(px + moveStep, tHeight - (int)(tHeight * _data1[start])),
- new Point(px, tHeight - (int)(tHeight * _data1[start + 1]))
- });
-
+ new Point(px, tHeight - (int)(tHeight * _data1[start + 1])) });
g.DrawLine(lGrid2, px, h, px + moveStep, hPre);
}
}
@@ -219,7 +220,12 @@ namespace ProcessHacker.Components
}
}
- private void ShowToolTip(bool force = false)
+ private void ShowToolTip()
+ {
+ this.ShowToolTip(false);
+ }
+
+ private void ShowToolTip(bool force)
{
if (this.GetToolTip != null)
{
@@ -335,7 +341,7 @@ namespace ProcessHacker.Components
{
base.Text = _text = value;
- _textSize = this.CreateGraphics().GetCachedSize(this.Text, this.Font);
+ _textSize = TextRenderer.MeasureText(this.Text, this.Font);
_boxSize = new Size(
_textSize.Width + _textPadding.Left + _textPadding.Right,
_textSize.Height + _textPadding.Top + _textPadding.Bottom);
diff --git a/1.x/trunk/ProcessHacker/Components/Plotter.resx b/1.x/trunk/ProcessHacker/Components/Plotter.resx
index 026c576b4..a5979aadf 100644
--- a/1.x/trunk/ProcessHacker/Components/Plotter.resx
+++ b/1.x/trunk/ProcessHacker/Components/Plotter.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessStatistics.Designer.cs b/1.x/trunk/ProcessHacker/Components/ProcessStatistics.Designer.cs
index 9285e96ad..429319c24 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessStatistics.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessStatistics.Designer.cs
@@ -136,7 +136,7 @@
this.tableLayoutPanel1.Controls.Add(this.labelCPUCyclesText, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.labelCPUCycles, 1, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 18);
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
@@ -144,7 +144,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(189, 87);
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(189, 89);
this.tableLayoutPanel1.TabIndex = 1;
//
// label6
@@ -153,7 +153,7 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(3, 2);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(43, 13);
+ this.label6.Size = new System.Drawing.Size(38, 13);
this.label6.TabIndex = 1;
this.label6.Text = "Priority";
//
@@ -163,7 +163,7 @@
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(3, 36);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(65, 13);
+ this.label8.Size = new System.Drawing.Size(63, 13);
this.label8.TabIndex = 1;
this.label8.Text = "Kernel Time";
//
@@ -173,7 +173,7 @@
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(3, 53);
this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(56, 13);
+ this.label9.Size = new System.Drawing.Size(55, 13);
this.label9.TabIndex = 1;
this.label9.Text = "User Time";
//
@@ -181,9 +181,9 @@
//
this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(3, 71);
+ this.label10.Location = new System.Drawing.Point(3, 72);
this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(58, 13);
+ this.label10.Size = new System.Drawing.Size(57, 13);
this.label10.TabIndex = 1;
this.label10.Text = "Total Time";
//
@@ -191,9 +191,9 @@
//
this.labelCPUPriority.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelCPUPriority.AutoSize = true;
- this.labelCPUPriority.Location = new System.Drawing.Point(152, 2);
+ this.labelCPUPriority.Location = new System.Drawing.Point(153, 2);
this.labelCPUPriority.Name = "labelCPUPriority";
- this.labelCPUPriority.Size = new System.Drawing.Size(34, 13);
+ this.labelCPUPriority.Size = new System.Drawing.Size(33, 13);
this.labelCPUPriority.TabIndex = 1;
this.labelCPUPriority.Text = "value";
//
@@ -201,9 +201,9 @@
//
this.labelCPUKernelTime.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelCPUKernelTime.AutoSize = true;
- this.labelCPUKernelTime.Location = new System.Drawing.Point(152, 36);
+ this.labelCPUKernelTime.Location = new System.Drawing.Point(153, 36);
this.labelCPUKernelTime.Name = "labelCPUKernelTime";
- this.labelCPUKernelTime.Size = new System.Drawing.Size(34, 13);
+ this.labelCPUKernelTime.Size = new System.Drawing.Size(33, 13);
this.labelCPUKernelTime.TabIndex = 1;
this.labelCPUKernelTime.Text = "value";
//
@@ -211,9 +211,9 @@
//
this.labelCPUUserTime.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelCPUUserTime.AutoSize = true;
- this.labelCPUUserTime.Location = new System.Drawing.Point(152, 53);
+ this.labelCPUUserTime.Location = new System.Drawing.Point(153, 53);
this.labelCPUUserTime.Name = "labelCPUUserTime";
- this.labelCPUUserTime.Size = new System.Drawing.Size(34, 13);
+ this.labelCPUUserTime.Size = new System.Drawing.Size(33, 13);
this.labelCPUUserTime.TabIndex = 1;
this.labelCPUUserTime.Text = "value";
//
@@ -221,9 +221,9 @@
//
this.labelCPUTotalTime.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelCPUTotalTime.AutoSize = true;
- this.labelCPUTotalTime.Location = new System.Drawing.Point(152, 71);
+ this.labelCPUTotalTime.Location = new System.Drawing.Point(153, 72);
this.labelCPUTotalTime.Name = "labelCPUTotalTime";
- this.labelCPUTotalTime.Size = new System.Drawing.Size(34, 13);
+ this.labelCPUTotalTime.Size = new System.Drawing.Size(33, 13);
this.labelCPUTotalTime.TabIndex = 1;
this.labelCPUTotalTime.Text = "value";
//
@@ -241,9 +241,9 @@
//
this.labelCPUCycles.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelCPUCycles.AutoSize = true;
- this.labelCPUCycles.Location = new System.Drawing.Point(152, 19);
+ this.labelCPUCycles.Location = new System.Drawing.Point(153, 19);
this.labelCPUCycles.Name = "labelCPUCycles";
- this.labelCPUCycles.Size = new System.Drawing.Size(34, 13);
+ this.labelCPUCycles.Size = new System.Drawing.Size(33, 13);
this.labelCPUCycles.TabIndex = 1;
this.labelCPUCycles.Text = "value";
//
@@ -281,7 +281,7 @@
this.tableLayoutPanel2.Controls.Add(this.label30, 0, 8);
this.tableLayoutPanel2.Controls.Add(this.labelMemoryPP, 1, 8);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 18);
+ this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 9;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
@@ -293,7 +293,7 @@
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.tableLayoutPanel2.Size = new System.Drawing.Size(189, 173);
+ this.tableLayoutPanel2.Size = new System.Drawing.Size(189, 175);
this.tableLayoutPanel2.TabIndex = 1;
//
// label24
@@ -302,7 +302,7 @@
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(3, 117);
this.label24.Name = "label24";
- this.label24.Size = new System.Drawing.Size(110, 13);
+ this.label24.Size = new System.Drawing.Size(107, 13);
this.label24.TabIndex = 7;
this.label24.Text = "Peak Pagefile Usage";
//
@@ -312,7 +312,7 @@
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(3, 98);
this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(83, 13);
+ this.label22.Size = new System.Drawing.Size(79, 13);
this.label22.TabIndex = 5;
this.label22.Text = "Pagefile Usage";
//
@@ -322,7 +322,7 @@
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(3, 79);
this.label20.Name = "label20";
- this.label20.Size = new System.Drawing.Size(91, 13);
+ this.label20.Size = new System.Drawing.Size(87, 13);
this.label20.TabIndex = 3;
this.label20.Text = "Peak Virtual Size";
//
@@ -332,7 +332,7 @@
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(3, 3);
this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(71, 13);
+ this.label11.Size = new System.Drawing.Size(69, 13);
this.label11.TabIndex = 1;
this.label11.Text = "Private Bytes";
//
@@ -342,7 +342,7 @@
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(3, 22);
this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(71, 13);
+ this.label12.Size = new System.Drawing.Size(66, 13);
this.label12.TabIndex = 1;
this.label12.Text = "Working Set";
//
@@ -352,7 +352,7 @@
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(3, 41);
this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(98, 13);
+ this.label13.Size = new System.Drawing.Size(94, 13);
this.label13.TabIndex = 1;
this.label13.Text = "Peak Working Set";
//
@@ -362,7 +362,7 @@
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(3, 60);
this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(64, 13);
+ this.label14.Size = new System.Drawing.Size(59, 13);
this.label14.TabIndex = 1;
this.label14.Text = "Virtual Size";
//
@@ -370,9 +370,9 @@
//
this.labelMemoryPB.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPB.AutoSize = true;
- this.labelMemoryPB.Location = new System.Drawing.Point(152, 3);
+ this.labelMemoryPB.Location = new System.Drawing.Point(153, 3);
this.labelMemoryPB.Name = "labelMemoryPB";
- this.labelMemoryPB.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPB.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPB.TabIndex = 1;
this.labelMemoryPB.Text = "value";
//
@@ -380,9 +380,9 @@
//
this.labelMemoryWS.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryWS.AutoSize = true;
- this.labelMemoryWS.Location = new System.Drawing.Point(152, 22);
+ this.labelMemoryWS.Location = new System.Drawing.Point(153, 22);
this.labelMemoryWS.Name = "labelMemoryWS";
- this.labelMemoryWS.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryWS.Size = new System.Drawing.Size(33, 13);
this.labelMemoryWS.TabIndex = 1;
this.labelMemoryWS.Text = "value";
//
@@ -390,9 +390,9 @@
//
this.labelMemoryPWS.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPWS.AutoSize = true;
- this.labelMemoryPWS.Location = new System.Drawing.Point(152, 41);
+ this.labelMemoryPWS.Location = new System.Drawing.Point(153, 41);
this.labelMemoryPWS.Name = "labelMemoryPWS";
- this.labelMemoryPWS.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPWS.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPWS.TabIndex = 1;
this.labelMemoryPWS.Text = "value";
//
@@ -400,9 +400,9 @@
//
this.labelMemoryVS.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryVS.AutoSize = true;
- this.labelMemoryVS.Location = new System.Drawing.Point(152, 60);
+ this.labelMemoryVS.Location = new System.Drawing.Point(153, 60);
this.labelMemoryVS.Name = "labelMemoryVS";
- this.labelMemoryVS.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryVS.Size = new System.Drawing.Size(33, 13);
this.labelMemoryVS.TabIndex = 1;
this.labelMemoryVS.Text = "value";
//
@@ -410,9 +410,9 @@
//
this.labelMemoryPVS.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPVS.AutoSize = true;
- this.labelMemoryPVS.Location = new System.Drawing.Point(152, 79);
+ this.labelMemoryPVS.Location = new System.Drawing.Point(153, 79);
this.labelMemoryPVS.Name = "labelMemoryPVS";
- this.labelMemoryPVS.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPVS.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPVS.TabIndex = 1;
this.labelMemoryPVS.Text = "value";
//
@@ -420,9 +420,9 @@
//
this.labelMemoryPU.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPU.AutoSize = true;
- this.labelMemoryPU.Location = new System.Drawing.Point(152, 98);
+ this.labelMemoryPU.Location = new System.Drawing.Point(153, 98);
this.labelMemoryPU.Name = "labelMemoryPU";
- this.labelMemoryPU.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPU.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPU.TabIndex = 1;
this.labelMemoryPU.Text = "value";
//
@@ -430,9 +430,9 @@
//
this.labelMemoryPPU.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPPU.AutoSize = true;
- this.labelMemoryPPU.Location = new System.Drawing.Point(152, 117);
+ this.labelMemoryPPU.Location = new System.Drawing.Point(153, 117);
this.labelMemoryPPU.Name = "labelMemoryPPU";
- this.labelMemoryPPU.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPPU.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPPU.TabIndex = 1;
this.labelMemoryPPU.Text = "value";
//
@@ -442,7 +442,7 @@
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(3, 136);
this.label25.Name = "label25";
- this.label25.Size = new System.Drawing.Size(66, 13);
+ this.label25.Size = new System.Drawing.Size(63, 13);
this.label25.TabIndex = 7;
this.label25.Text = "Page Faults";
//
@@ -450,9 +450,9 @@
//
this.labelMemoryPF.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPF.AutoSize = true;
- this.labelMemoryPF.Location = new System.Drawing.Point(152, 136);
+ this.labelMemoryPF.Location = new System.Drawing.Point(153, 136);
this.labelMemoryPF.Name = "labelMemoryPF";
- this.labelMemoryPF.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPF.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPF.TabIndex = 1;
this.labelMemoryPF.Text = "value";
//
@@ -460,9 +460,9 @@
//
this.label30.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label30.AutoSize = true;
- this.label30.Location = new System.Drawing.Point(3, 156);
+ this.label30.Location = new System.Drawing.Point(3, 157);
this.label30.Name = "label30";
- this.label30.Size = new System.Drawing.Size(71, 13);
+ this.label30.Size = new System.Drawing.Size(66, 13);
this.label30.TabIndex = 7;
this.label30.Text = "Page Priority";
//
@@ -470,9 +470,9 @@
//
this.labelMemoryPP.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMemoryPP.AutoSize = true;
- this.labelMemoryPP.Location = new System.Drawing.Point(152, 156);
+ this.labelMemoryPP.Location = new System.Drawing.Point(153, 157);
this.labelMemoryPP.Name = "labelMemoryPP";
- this.labelMemoryPP.Size = new System.Drawing.Size(34, 13);
+ this.labelMemoryPP.Size = new System.Drawing.Size(33, 13);
this.labelMemoryPP.TabIndex = 1;
this.labelMemoryPP.Text = "value";
//
@@ -506,7 +506,7 @@
this.tableLayoutPanel3.Controls.Add(this.label31, 0, 6);
this.tableLayoutPanel3.Controls.Add(this.labelIOPriority, 1, 6);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 18);
+ this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 7;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
@@ -516,7 +516,7 @@
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
- this.tableLayoutPanel3.Size = new System.Drawing.Size(189, 127);
+ this.tableLayoutPanel3.Size = new System.Drawing.Size(189, 129);
this.tableLayoutPanel3.TabIndex = 1;
//
// label16
@@ -525,7 +525,7 @@
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(3, 92);
this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(67, 13);
+ this.label16.Size = new System.Drawing.Size(62, 13);
this.label16.TabIndex = 5;
this.label16.Text = "Other Bytes";
//
@@ -535,7 +535,7 @@
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(3, 74);
this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(37, 13);
+ this.label17.Size = new System.Drawing.Size(33, 13);
this.label17.TabIndex = 3;
this.label17.Text = "Other";
//
@@ -555,7 +555,7 @@
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(3, 20);
this.label19.Name = "label19";
- this.label19.Size = new System.Drawing.Size(63, 13);
+ this.label19.Size = new System.Drawing.Size(62, 13);
this.label19.TabIndex = 1;
this.label19.Text = "Read Bytes";
//
@@ -565,7 +565,7 @@
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(3, 38);
this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(40, 13);
+ this.label21.Size = new System.Drawing.Size(37, 13);
this.label21.TabIndex = 1;
this.label21.Text = "Writes";
//
@@ -575,7 +575,7 @@
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(3, 56);
this.label23.Name = "label23";
- this.label23.Size = new System.Drawing.Size(65, 13);
+ this.label23.Size = new System.Drawing.Size(61, 13);
this.label23.TabIndex = 1;
this.label23.Text = "Write Bytes";
//
@@ -583,9 +583,9 @@
//
this.labelIOReads.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOReads.AutoSize = true;
- this.labelIOReads.Location = new System.Drawing.Point(152, 2);
+ this.labelIOReads.Location = new System.Drawing.Point(153, 2);
this.labelIOReads.Name = "labelIOReads";
- this.labelIOReads.Size = new System.Drawing.Size(34, 13);
+ this.labelIOReads.Size = new System.Drawing.Size(33, 13);
this.labelIOReads.TabIndex = 1;
this.labelIOReads.Text = "value";
//
@@ -593,9 +593,9 @@
//
this.labelIOReadBytes.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOReadBytes.AutoSize = true;
- this.labelIOReadBytes.Location = new System.Drawing.Point(152, 20);
+ this.labelIOReadBytes.Location = new System.Drawing.Point(153, 20);
this.labelIOReadBytes.Name = "labelIOReadBytes";
- this.labelIOReadBytes.Size = new System.Drawing.Size(34, 13);
+ this.labelIOReadBytes.Size = new System.Drawing.Size(33, 13);
this.labelIOReadBytes.TabIndex = 1;
this.labelIOReadBytes.Text = "value";
//
@@ -603,9 +603,9 @@
//
this.labelIOWrites.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOWrites.AutoSize = true;
- this.labelIOWrites.Location = new System.Drawing.Point(152, 38);
+ this.labelIOWrites.Location = new System.Drawing.Point(153, 38);
this.labelIOWrites.Name = "labelIOWrites";
- this.labelIOWrites.Size = new System.Drawing.Size(34, 13);
+ this.labelIOWrites.Size = new System.Drawing.Size(33, 13);
this.labelIOWrites.TabIndex = 1;
this.labelIOWrites.Text = "value";
//
@@ -613,9 +613,9 @@
//
this.labelIOWriteBytes.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOWriteBytes.AutoSize = true;
- this.labelIOWriteBytes.Location = new System.Drawing.Point(152, 56);
+ this.labelIOWriteBytes.Location = new System.Drawing.Point(153, 56);
this.labelIOWriteBytes.Name = "labelIOWriteBytes";
- this.labelIOWriteBytes.Size = new System.Drawing.Size(34, 13);
+ this.labelIOWriteBytes.Size = new System.Drawing.Size(33, 13);
this.labelIOWriteBytes.TabIndex = 1;
this.labelIOWriteBytes.Text = "value";
//
@@ -623,9 +623,9 @@
//
this.labelIOOther.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOOther.AutoSize = true;
- this.labelIOOther.Location = new System.Drawing.Point(152, 74);
+ this.labelIOOther.Location = new System.Drawing.Point(153, 74);
this.labelIOOther.Name = "labelIOOther";
- this.labelIOOther.Size = new System.Drawing.Size(34, 13);
+ this.labelIOOther.Size = new System.Drawing.Size(33, 13);
this.labelIOOther.TabIndex = 1;
this.labelIOOther.Text = "value";
//
@@ -633,9 +633,9 @@
//
this.labelIOOtherBytes.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOOtherBytes.AutoSize = true;
- this.labelIOOtherBytes.Location = new System.Drawing.Point(152, 92);
+ this.labelIOOtherBytes.Location = new System.Drawing.Point(153, 92);
this.labelIOOtherBytes.Name = "labelIOOtherBytes";
- this.labelIOOtherBytes.Size = new System.Drawing.Size(34, 13);
+ this.labelIOOtherBytes.Size = new System.Drawing.Size(33, 13);
this.labelIOOtherBytes.TabIndex = 1;
this.labelIOOtherBytes.Text = "value";
//
@@ -643,9 +643,9 @@
//
this.label31.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label31.AutoSize = true;
- this.label31.Location = new System.Drawing.Point(3, 111);
+ this.label31.Location = new System.Drawing.Point(3, 112);
this.label31.Name = "label31";
- this.label31.Size = new System.Drawing.Size(62, 13);
+ this.label31.Size = new System.Drawing.Size(57, 13);
this.label31.TabIndex = 5;
this.label31.Text = "I/O Priority";
//
@@ -653,9 +653,9 @@
//
this.labelIOPriority.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelIOPriority.AutoSize = true;
- this.labelIOPriority.Location = new System.Drawing.Point(152, 111);
+ this.labelIOPriority.Location = new System.Drawing.Point(153, 112);
this.labelIOPriority.Name = "labelIOPriority";
- this.labelIOPriority.Size = new System.Drawing.Size(34, 13);
+ this.labelIOPriority.Size = new System.Drawing.Size(33, 13);
this.labelIOPriority.TabIndex = 1;
this.labelIOPriority.Text = "value";
//
@@ -682,23 +682,23 @@
this.tableLayoutPanel4.Controls.Add(this.labelOtherUSERHandles, 1, 2);
this.tableLayoutPanel4.Controls.Add(this.buttonHandleDetails, 1, 3);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 18);
+ this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 4;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
- this.tableLayoutPanel4.Size = new System.Drawing.Size(189, 78);
+ this.tableLayoutPanel4.Size = new System.Drawing.Size(189, 80);
this.tableLayoutPanel4.TabIndex = 1;
//
// label27
//
this.label27.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label27.AutoSize = true;
- this.label27.Location = new System.Drawing.Point(3, 1);
+ this.label27.Location = new System.Drawing.Point(3, 2);
this.label27.Name = "label27";
- this.label27.Size = new System.Drawing.Size(49, 13);
+ this.label27.Size = new System.Drawing.Size(46, 13);
this.label27.TabIndex = 1;
this.label27.Text = "Handles";
//
@@ -706,9 +706,9 @@
//
this.labelOtherHandles.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelOtherHandles.AutoSize = true;
- this.labelOtherHandles.Location = new System.Drawing.Point(152, 1);
+ this.labelOtherHandles.Location = new System.Drawing.Point(153, 2);
this.labelOtherHandles.Name = "labelOtherHandles";
- this.labelOtherHandles.Size = new System.Drawing.Size(34, 13);
+ this.labelOtherHandles.Size = new System.Drawing.Size(33, 13);
this.labelOtherHandles.TabIndex = 1;
this.labelOtherHandles.Text = "value";
//
@@ -716,9 +716,9 @@
//
this.label28.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label28.AutoSize = true;
- this.label28.Location = new System.Drawing.Point(3, 18);
+ this.label28.Location = new System.Drawing.Point(3, 19);
this.label28.Name = "label28";
- this.label28.Size = new System.Drawing.Size(71, 13);
+ this.label28.Size = new System.Drawing.Size(68, 13);
this.label28.TabIndex = 1;
this.label28.Text = "GDI Handles";
//
@@ -726,7 +726,7 @@
//
this.label29.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label29.AutoSize = true;
- this.label29.Location = new System.Drawing.Point(3, 35);
+ this.label29.Location = new System.Drawing.Point(3, 36);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(79, 13);
this.label29.TabIndex = 1;
@@ -736,9 +736,9 @@
//
this.labelOtherGDIHandles.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelOtherGDIHandles.AutoSize = true;
- this.labelOtherGDIHandles.Location = new System.Drawing.Point(152, 18);
+ this.labelOtherGDIHandles.Location = new System.Drawing.Point(153, 19);
this.labelOtherGDIHandles.Name = "labelOtherGDIHandles";
- this.labelOtherGDIHandles.Size = new System.Drawing.Size(34, 13);
+ this.labelOtherGDIHandles.Size = new System.Drawing.Size(33, 13);
this.labelOtherGDIHandles.TabIndex = 1;
this.labelOtherGDIHandles.Text = "value";
//
@@ -746,9 +746,9 @@
//
this.labelOtherUSERHandles.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelOtherUSERHandles.AutoSize = true;
- this.labelOtherUSERHandles.Location = new System.Drawing.Point(152, 35);
+ this.labelOtherUSERHandles.Location = new System.Drawing.Point(153, 36);
this.labelOtherUSERHandles.Name = "labelOtherUSERHandles";
- this.labelOtherUSERHandles.Size = new System.Drawing.Size(34, 13);
+ this.labelOtherUSERHandles.Size = new System.Drawing.Size(33, 13);
this.labelOtherUSERHandles.TabIndex = 1;
this.labelOtherUSERHandles.Text = "value";
//
@@ -756,9 +756,9 @@
//
this.buttonHandleDetails.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.buttonHandleDetails.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonHandleDetails.Location = new System.Drawing.Point(112, 53);
+ this.buttonHandleDetails.Location = new System.Drawing.Point(112, 54);
this.buttonHandleDetails.Name = "buttonHandleDetails";
- this.buttonHandleDetails.Size = new System.Drawing.Size(74, 22);
+ this.buttonHandleDetails.Size = new System.Drawing.Size(74, 23);
this.buttonHandleDetails.TabIndex = 2;
this.buttonHandleDetails.Text = "Details...";
this.buttonHandleDetails.UseVisualStyleBackColor = true;
@@ -768,7 +768,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.flowStats);
this.Name = "ProcessStatistics";
this.Size = new System.Drawing.Size(433, 374);
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessStatistics.cs b/1.x/trunk/ProcessHacker/Components/ProcessStatistics.cs
index dad9f635c..10632d2d4 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessStatistics.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessStatistics.cs
@@ -24,12 +24,13 @@ using System;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Native;
+using ProcessHacker.Native.Objects;
namespace ProcessHacker.Components
{
public partial class ProcessStatistics : UserControl
{
- private readonly int _pid;
+ private int _pid;
public ProcessStatistics(int pid)
{
@@ -45,37 +46,49 @@ namespace ProcessHacker.Components
{
labelCPUCyclesText.Text = "N/A";
}
+
+ _dontCalculate = false;
+ }
+
+ private bool _dontCalculate = true;
+
+ protected override void OnResize(EventArgs e)
+ {
+ if (_dontCalculate)
+ return;
+
+ base.OnResize(e);
}
public void ClearStatistics()
{
- labelCPUPriority.Text = string.Empty;
- labelCPUCycles.Text = string.Empty;
- labelCPUKernelTime.Text = string.Empty;
- labelCPUUserTime.Text = string.Empty;
- labelCPUTotalTime.Text = string.Empty;
+ labelCPUPriority.Text = "";
+ labelCPUCycles.Text = "";
+ labelCPUKernelTime.Text = "";
+ labelCPUUserTime.Text = "";
+ labelCPUTotalTime.Text = "";
- labelMemoryPB.Text = string.Empty;
- labelMemoryWS.Text = string.Empty;
- labelMemoryPWS.Text = string.Empty;
- labelMemoryVS.Text = string.Empty;
- labelMemoryPVS.Text = string.Empty;
- labelMemoryPU.Text = string.Empty;
- labelMemoryPPU.Text = string.Empty;
- labelMemoryPF.Text = string.Empty;
- labelMemoryPP.Text = string.Empty;
+ labelMemoryPB.Text = "";
+ labelMemoryWS.Text = "";
+ labelMemoryPWS.Text = "";
+ labelMemoryVS.Text = "";
+ labelMemoryPVS.Text = "";
+ labelMemoryPU.Text = "";
+ labelMemoryPPU.Text = "";
+ labelMemoryPF.Text = "";
+ labelMemoryPP.Text = "";
- labelIOReads.Text = string.Empty;
- labelIOReadBytes.Text = string.Empty;
- labelIOWrites.Text = string.Empty;
- labelIOWriteBytes.Text = string.Empty;
- labelIOOther.Text = string.Empty;
- labelIOOtherBytes.Text = string.Empty;
- labelIOPriority.Text = string.Empty;
+ labelIOReads.Text = "";
+ labelIOReadBytes.Text = "";
+ labelIOWrites.Text = "";
+ labelIOWriteBytes.Text = "";
+ labelIOOther.Text = "";
+ labelIOOtherBytes.Text = "";
+ labelIOPriority.Text = "";
- labelOtherHandles.Text = string.Empty;
- labelOtherGDIHandles.Text = string.Empty;
- labelOtherUSERHandles.Text = string.Empty;
+ labelOtherHandles.Text = "";
+ labelOtherGDIHandles.Text = "";
+ labelOtherUSERHandles.Text = "";
}
public void UpdateStatistics()
@@ -99,31 +112,34 @@ namespace ProcessHacker.Components
labelMemoryPPU.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakPagefileUsage);
labelMemoryPF.Text = ((ulong)item.Process.VirtualMemoryCounters.PageFaultCount).ToString("N0");
- labelIOReads.Text = item.Process.IoCounters.ReadOperationCount.ToString("N0");
+ labelIOReads.Text = ((ulong)item.Process.IoCounters.ReadOperationCount).ToString("N0");
labelIOReadBytes.Text = Utils.FormatSize(item.Process.IoCounters.ReadTransferCount);
- labelIOWrites.Text = item.Process.IoCounters.WriteOperationCount.ToString("N0");
+ labelIOWrites.Text = ((ulong)item.Process.IoCounters.WriteOperationCount).ToString("N0");
labelIOWriteBytes.Text = Utils.FormatSize(item.Process.IoCounters.WriteTransferCount);
- labelIOOther.Text = item.Process.IoCounters.OtherOperationCount.ToString("N0");
+ labelIOOther.Text = ((ulong)item.Process.IoCounters.OtherOperationCount).ToString("N0");
labelIOOtherBytes.Text = Utils.FormatSize(item.Process.IoCounters.OtherTransferCount);
labelOtherHandles.Text = ((ulong)item.Process.HandleCount).ToString("N0");
-
+
if (_pid > 0)
{
try
{
- labelOtherGDIHandles.Text = item.ProcessQueryHandle.GetGuiResources(false).ToString("N0");
- labelOtherUSERHandles.Text = item.ProcessQueryHandle.GetGuiResources(true).ToString("N0");
-
- if (OSVersion.HasCycleTime)
- labelCPUCycles.Text = item.ProcessQueryHandle.GetCycleTime().ToString("N0");
- else
- labelCPUCycles.Text = "N/A";
-
- if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
{
- labelMemoryPP.Text = item.ProcessQueryHandle.PagePriority.ToString();
- labelIOPriority.Text = item.ProcessQueryHandle.IoPriority.ToString();
+ labelOtherGDIHandles.Text = phandle.GetGuiResources(false).ToString("N0");
+ labelOtherUSERHandles.Text = phandle.GetGuiResources(true).ToString("N0");
+
+ if (OSVersion.HasCycleTime)
+ labelCPUCycles.Text = phandle.GetCycleTime().ToString("N0");
+ else
+ labelCPUCycles.Text = "N/A";
+
+ if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
+ {
+ labelMemoryPP.Text = phandle.GetPagePriority().ToString();
+ labelIOPriority.Text = phandle.GetIoPriority().ToString();
+ }
}
}
catch
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessStatistics.resx b/1.x/trunk/ProcessHacker/Components/ProcessStatistics.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessStatistics.resx
+++ b/1.x/trunk/ProcessHacker/Components/ProcessStatistics.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs
index 092c99a3d..3547d33e2 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs
@@ -38,16 +38,16 @@ namespace ProcessHacker
private static ProcessNode[] _processNodeTreePathBuffer;
private const int _processNodeTreePathMaxDepth = 512;
- private ProcessNode _parent;
- private readonly List _children = new List();
- private TreePath _treePath;
+ private ProcessNode _parent = null;
+ private List _children = new List();
+ private TreePath _treePath = null;
private ProcessItem _pitem;
- private bool _wasNoIcon;
+ private bool _wasNoIcon = false;
private Bitmap _icon;
private string _tooltipText;
- private int _lastTooltipTickCount;
+ private int _lastTooltipTickCount = 0;
public ProcessNode(ProcessItem pitem)
{
@@ -57,7 +57,7 @@ namespace ProcessHacker
if (_pitem.Icon == null)
{
_wasNoIcon = true;
- _icon = Properties.Resources.Process_small.ToBitmap();
+ _icon = global::ProcessHacker.Properties.Resources.Process_small.ToBitmap();
}
else
{
@@ -68,7 +68,7 @@ namespace ProcessHacker
catch
{
_wasNoIcon = true;
- _icon = Properties.Resources.Process_small.ToBitmap();
+ _icon = global::ProcessHacker.Properties.Resources.Process_small.ToBitmap();
}
}
}
@@ -161,7 +161,9 @@ namespace ProcessHacker
currentNode = currentNode.Parent;
}
- ProcessNode[] path = new ProcessNode[_processNodeTreePathMaxDepth - i];
+ ProcessNode[] path;
+
+ path = new ProcessNode[_processNodeTreePathMaxDepth - i];
Array.Copy(_processNodeTreePathBuffer, i, path, 0, _processNodeTreePathMaxDepth - i);
_treePath = new TreePath(path);
@@ -181,7 +183,7 @@ namespace ProcessHacker
{
get
{
- return new ProcessHacker.Components.NodePlotter.PlotterInfo
+ return new ProcessHacker.Components.NodePlotter.PlotterInfo()
{
UseSecondLine = true,
OverlaySecondLine = false,
@@ -198,7 +200,7 @@ namespace ProcessHacker
{
get
{
- return new ProcessHacker.Components.NodePlotter.PlotterInfo
+ return new ProcessHacker.Components.NodePlotter.PlotterInfo()
{
UseSecondLine = true,
OverlaySecondLine = true,
@@ -213,7 +215,7 @@ namespace ProcessHacker
public string Name
{
- get { return _pitem.Name ?? string.Empty; }
+ get { return _pitem.Name ?? ""; }
}
public string DisplayPid
@@ -222,8 +224,8 @@ namespace ProcessHacker
{
if (_pitem.Pid >= 0)
return _pitem.Pid.ToString();
-
- return string.Empty;
+ else
+ return "";
}
}
@@ -234,13 +236,7 @@ namespace ProcessHacker
public int PPid
{
- get
- {
- if (_pitem.Pid == _pitem.ParentPid)
- return -1;
-
- return this._pitem.ParentPid;
- }
+ get { if (_pitem.Pid == _pitem.ParentPid) return -1; else return _pitem.ParentPid; }
}
public string PvtMemory
@@ -263,16 +259,19 @@ namespace ProcessHacker
private int GetWorkingSetNumber(NProcessHacker.WsInformationClass WsInformationClass)
{
- if (_pitem.ProcessQueryHandle == null)
- return 0;
-
+ NtStatus status;
int wsInfo;
int retLen;
try
{
- if (NProcessHacker.PhQueryProcessWs(_pitem.ProcessQueryHandle, WsInformationClass, out wsInfo, 4, out retLen) < NtStatus.Error)
- return wsInfo * Program.ProcessProvider.System.PageSize;
+ using (var phandle = new ProcessHandle(_pitem.Pid,
+ ProcessAccess.QueryInformation | ProcessAccess.VmRead))
+ {
+ if ((status = NProcessHacker.PhQueryProcessWs(phandle, WsInformationClass, out wsInfo,
+ 4, out retLen)) < NtStatus.Error)
+ return wsInfo * Program.ProcessProvider.System.PageSize;
+ }
}
catch
{ }
@@ -345,9 +344,9 @@ namespace ProcessHacker
get
{
if (_pitem.CpuUsage == 0)
- return string.Empty;
-
- return this._pitem.CpuUsage.ToString("F2");
+ return "";
+ else
+ return _pitem.CpuUsage.ToString("F2");
}
}
@@ -361,9 +360,9 @@ namespace ProcessHacker
get
{
if (Pid < 4)
- return string.Empty;
-
- return this._pitem.SessionId.ToString();
+ return "";
+ else
+ return _pitem.SessionId.ToString();
}
}
@@ -371,16 +370,14 @@ namespace ProcessHacker
{
get
{
- if (_pitem.ProcessQueryHandle == null)
- return string.Empty;
-
try
{
- return PhUtils.FormatPriorityClass(_pitem.ProcessQueryHandle.PriorityClass);
+ using (var phandle = new ProcessHandle(Pid, Program.MinProcessQueryRights))
+ return PhUtils.FormatPriorityClass(phandle.GetPriorityClass());
}
catch
{
- return string.Empty;
+ return "";
}
}
}
@@ -390,9 +387,9 @@ namespace ProcessHacker
get
{
if (Pid < 4)
- return string.Empty;
-
- return this._pitem.Process.BasePriority.ToString();
+ return "";
+ else
+ return _pitem.Process.BasePriority.ToString();
}
}
@@ -400,22 +397,16 @@ namespace ProcessHacker
{
get
{
- switch (this.Pid)
- {
- case 0:
- return "System Idle Process";
- case -2:
- return "Deferred Procedure Calls";
- case -3:
- return "Interrupts";
- default:
- {
- if (this._pitem.VersionInfo != null && !string.IsNullOrEmpty(this._pitem.VersionInfo.FileDescription))
- return this._pitem.VersionInfo.FileDescription;
-
- return string.Empty;
- }
- }
+ if (Pid == 0)
+ return "System Idle Process";
+ else if (Pid == -2)
+ return "Deferred Procedure Calls";
+ else if (Pid == -3)
+ return "Interrupts";
+ else if (_pitem.VersionInfo != null && _pitem.VersionInfo.FileDescription != null)
+ return _pitem.VersionInfo.FileDescription;
+ else
+ return "";
}
}
@@ -423,10 +414,10 @@ namespace ProcessHacker
{
get
{
- if (_pitem.VersionInfo != null && !string.IsNullOrEmpty(_pitem.VersionInfo.CompanyName))
+ if (_pitem.VersionInfo != null && _pitem.VersionInfo.CompanyName != null)
return _pitem.VersionInfo.CompanyName;
-
- return string.Empty;
+ else
+ return "";
}
}
@@ -434,10 +425,10 @@ namespace ProcessHacker
{
get
{
- if (string.IsNullOrEmpty(_pitem.FileName))
- return string.Empty;
-
- return this._pitem.FileName;
+ if (_pitem.FileName == null)
+ return "";
+ else
+ return _pitem.FileName;
}
}
@@ -445,10 +436,10 @@ namespace ProcessHacker
{
get
{
- if (string.IsNullOrEmpty(_pitem.CmdLine))
- return string.Empty;
-
- return this._pitem.CmdLine;//.Replace("\0", string.Empty);
+ if (_pitem.CmdLine == null)
+ return "";
+ else
+ return _pitem.CmdLine.Replace("\0", "");
}
}
@@ -457,9 +448,9 @@ namespace ProcessHacker
get
{
if (Pid < 4)
- return string.Empty;
-
- return this._pitem.Process.NumberOfThreads.ToString();
+ return "";
+ else
+ return _pitem.Process.NumberOfThreads.ToString();
}
}
@@ -468,9 +459,9 @@ namespace ProcessHacker
get
{
if (Pid < 4)
- return string.Empty;
-
- return this._pitem.Process.HandleCount.ToString();
+ return "";
+ else
+ return _pitem.Process.HandleCount.ToString();
}
}
@@ -478,12 +469,10 @@ namespace ProcessHacker
{
get
{
- if (_pitem.ProcessQueryHandle == null)
- return 0;
-
try
{
- return _pitem.ProcessQueryHandle.GetGuiResources(false);
+ using (var phandle = new ProcessHandle(Pid, ProcessAccess.QueryInformation))
+ return phandle.GetGuiResources(false);
}
catch
{
@@ -497,14 +486,16 @@ namespace ProcessHacker
get
{
if (Pid < 4)
- return string.Empty;
-
- int number = this.GdiHandlesNumber;
+ return "";
+ else
+ {
+ int number = this.GdiHandlesNumber;
- if (number == 0)
- return string.Empty;
-
- return number.ToString();
+ if (number == 0)
+ return "";
+ else
+ return number.ToString();
+ }
}
}
@@ -512,12 +503,10 @@ namespace ProcessHacker
{
get
{
- if (_pitem.ProcessQueryHandle == null)
- return 0;
-
try
{
- return _pitem.ProcessQueryHandle.GetGuiResources(true);
+ using (var phandle = new ProcessHandle(Pid, ProcessAccess.QueryInformation))
+ return phandle.GetGuiResources(true);
}
catch
{
@@ -531,20 +520,26 @@ namespace ProcessHacker
get
{
if (Pid < 4)
- return string.Empty;
-
- int number = this.UserHandlesNumber;
+ return "";
+ else
+ {
+ int number = this.UserHandlesNumber;
- if (number == 0)
- return string.Empty;
-
- return number.ToString();
+ if (number == 0)
+ return "";
+ else
+ return number.ToString();
+ }
}
}
public long IoTotalNumber
{
- get { return (_pitem.IoReadDelta.Delta + _pitem.IoWriteDelta.Delta + _pitem.IoOtherDelta.Delta) * 1000 / Settings.Instance.RefreshInterval; }
+ get
+ {
+ return (_pitem.IoReadDelta.Delta + _pitem.IoWriteDelta.Delta +
+ _pitem.IoOtherDelta.Delta) * 1000 / Settings.Instance.RefreshInterval;
+ }
}
public string IoTotal
@@ -552,9 +547,9 @@ namespace ProcessHacker
get
{
if (this.IoTotalNumber == 0)
- return string.Empty;
-
- return Utils.FormatSize(this.IoTotalNumber) + "/s";
+ return "";
+ else
+ return Utils.FormatSize(this.IoTotalNumber) + "/s";
}
}
@@ -562,7 +557,8 @@ namespace ProcessHacker
{
get
{
- return (_pitem.IoReadDelta.Delta + _pitem.IoOtherDelta.Delta) * 1000 / Settings.Instance.RefreshInterval;
+ return (_pitem.IoReadDelta.Delta + _pitem.IoOtherDelta.Delta) * 1000 /
+ Settings.Instance.RefreshInterval;
}
}
@@ -571,15 +567,19 @@ namespace ProcessHacker
get
{
if (this.IoReadOtherNumber == 0)
- return string.Empty;
-
- return Utils.FormatSize(this.IoReadOtherNumber) + "/s";
+ return "";
+ else
+ return Utils.FormatSize(this.IoReadOtherNumber) + "/s";
}
}
public long IoWriteNumber
{
- get { return _pitem.IoWriteDelta.Delta * 1000 / Settings.Instance.RefreshInterval; }
+ get
+ {
+ return _pitem.IoWriteDelta.Delta * 1000 /
+ Settings.Instance.RefreshInterval;
+ }
}
public string IoWrite
@@ -587,9 +587,9 @@ namespace ProcessHacker
get
{
if (this.IoWriteNumber == 0)
- return string.Empty;
-
- return Utils.FormatSize(this.IoWriteNumber) + "/s";
+ return "";
+ else
+ return Utils.FormatSize(this.IoWriteNumber) + "/s";
}
}
@@ -607,12 +607,9 @@ namespace ProcessHacker
{
get
{
- if (_pitem.ProcessQueryHandle == null)
- return 0;
-
try
{
- return _pitem.ProcessQueryHandle.IoPriority;
+ return _pitem.ProcessQueryHandle.GetIoPriority();
}
catch
{
@@ -625,12 +622,9 @@ namespace ProcessHacker
{
get
{
- if (_pitem.ProcessQueryHandle == null)
- return 0;
-
try
{
- return _pitem.ProcessQueryHandle.PagePriority;
+ return _pitem.ProcessQueryHandle.GetPagePriority();
}
catch
{
@@ -649,9 +643,9 @@ namespace ProcessHacker
get
{
if (Pid < 4 || _pitem.CreateTime.Year == 1)
- return string.Empty;
-
- return this._pitem.CreateTime.ToString();
+ return "";
+ else
+ return _pitem.CreateTime.ToString();
}
}
@@ -660,9 +654,9 @@ namespace ProcessHacker
get
{
if (Pid < 4 || _pitem.CreateTime.Year == 1)
- return string.Empty;
-
- return Utils.FormatRelativeDateTime(this._pitem.CreateTime);
+ return "";
+ else
+ return Utils.FormatRelativeDateTime(_pitem.CreateTime);
}
}
@@ -683,12 +677,12 @@ namespace ProcessHacker
public string VerificationStatus
{
- get { return _pitem.VerifyResult == VerifyResult.Trusted ? "Verified" : string.Empty; }
+ get { return _pitem.VerifyResult == VerifyResult.Trusted ? "Verified" : ""; }
}
public string VerifiedSigner
{
- get { return _pitem.VerifyResult == VerifyResult.Trusted ? _pitem.VerifySignerName : string.Empty; }
+ get { return _pitem.VerifyResult == VerifyResult.Trusted ? _pitem.VerifySignerName : ""; }
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs
index 3cfd34fe2..9046d6086 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs
@@ -24,7 +24,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using Aga.Controls.Tree;
-using Microsoft.Win32;
using ProcessHacker.Common;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
@@ -33,7 +32,7 @@ namespace ProcessHacker
{
public class ProcessToolTipProvider : IToolTipProvider
{
- private readonly ProcessTree _tree;
+ private ProcessTree _tree;
public ProcessToolTipProvider(ProcessTree owner)
{
@@ -47,18 +46,18 @@ namespace ProcessHacker
// Use the process node's tooltip mechanism to allow caching.
if (pNode != null)
return pNode.GetTooltipText(this);
-
- return string.Empty;
+ else
+ return "";
}
public string GetToolTip(ProcessNode pNode)
{
try
{
- string cmdText = (!string.IsNullOrEmpty(pNode.ProcessItem.CmdLine) ?
- (Utils.CreateEllipsis(pNode.ProcessItem.CmdLine.Replace("\0", string.Empty), 100) + "\n") : string.Empty);
+ string cmdText = (pNode.ProcessItem.CmdLine != null ?
+ (Utils.CreateEllipsis(pNode.ProcessItem.CmdLine.Replace("\0", ""), 100) + "\n") : "");
- string fileText = string.Empty;
+ string fileText = "";
try
{
@@ -66,21 +65,22 @@ namespace ProcessHacker
{
var info = pNode.ProcessItem.VersionInfo;
- fileText = "File:\n" + PhUtils.FormatFileInfo(info.FileName, info.FileDescription, info.CompanyName, info.FileVersion, 4);
+ fileText = "File:\n" + PhUtils.FormatFileInfo(
+ info.FileName, info.FileDescription, info.CompanyName, info.FileVersion, 4);
}
}
catch
{
- if (!string.IsNullOrEmpty(pNode.ProcessItem.FileName))
+ if (pNode.ProcessItem.FileName != null)
fileText = "File:\n " + pNode.ProcessItem.FileName;
}
- string runDllText = string.Empty;
+ string runDllText = "";
- if (!string.IsNullOrEmpty(pNode.ProcessItem.FileName) &&
+ if (pNode.ProcessItem.FileName != null &&
pNode.ProcessItem.FileName.EndsWith("\\rundll32.exe",
StringComparison.InvariantCultureIgnoreCase) &&
- !string.IsNullOrEmpty(pNode.ProcessItem.CmdLine))
+ pNode.ProcessItem.CmdLine != null)
{
try
{
@@ -88,7 +88,7 @@ namespace ProcessHacker
string targetFile = pNode.ProcessItem.CmdLine.Split(new char[] { ' ' }, 2)[1].Split(',')[0];
// if it doesn't specify an absolute path, assume it's in system32.
- if (!targetFile.Contains(":", StringComparison.OrdinalIgnoreCase))
+ if (!targetFile.Contains(":"))
targetFile = Environment.SystemDirectory + "\\" + targetFile;
FileVersionInfo info = FileVersionInfo.GetVersionInfo(targetFile);
@@ -103,32 +103,31 @@ namespace ProcessHacker
}
}
- string dllhostText = string.Empty;
+ string dllhostText = "";
- if (!string.IsNullOrEmpty(pNode.ProcessItem.FileName) &&
- pNode.ProcessItem.FileName.EndsWith("\\dllhost.exe", StringComparison.InvariantCultureIgnoreCase) &&
- !string.IsNullOrEmpty(pNode.ProcessItem.CmdLine))
+ if (pNode.ProcessItem.FileName != null &&
+ pNode.ProcessItem.FileName.EndsWith("\\dllhost.exe",
+ StringComparison.InvariantCultureIgnoreCase) &&
+ pNode.ProcessItem.CmdLine != null)
{
try
{
- string clsid = pNode.ProcessItem.CmdLine.ToLowerInvariant().Split(new[]
+ string clsid = pNode.ProcessItem.CmdLine.ToLowerInvariant().Split(
+ new string[] { "/processid:" }, StringSplitOptions.None)[1].Split(' ')[0];
+ using (var key = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("CLSID\\" + clsid))
{
- "/processid:"
- }, StringSplitOptions.None)[1].Split(' ')[0];
+ using (var inprocServer32 = key.OpenSubKey("InprocServer32"))
+ {
+ string name = key.GetValue("") as string;
+ string fileName = inprocServer32.GetValue("") as string;
- using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("CLSID\\" + clsid))
- using (RegistryKey inprocServer32 = key.OpenSubKey("InprocServer32"))
- {
- string name = key.GetValue(string.Empty) as string;
- string fileName = inprocServer32.GetValue(string.Empty) as string;
+ FileVersionInfo info = FileVersionInfo.GetVersionInfo(Environment.ExpandEnvironmentVariables(fileName));
- FileVersionInfo info = FileVersionInfo.GetVersionInfo(Environment.ExpandEnvironmentVariables(fileName));
-
- dllhostText = "\nCOM Target:\n " + name + " (" + clsid.ToUpper() + ")\n " +
- info.FileName + "\n " +
- info.FileDescription + " " + info.FileVersion + "\n " + info.CompanyName;
+ dllhostText = "\nCOM Target:\n " + name + " (" + clsid.ToUpper() + ")\n " +
+ info.FileName + "\n " +
+ info.FileDescription + " " + info.FileVersion + "\n " + info.CompanyName;
+ }
}
-
}
catch (Exception ex)
{
@@ -136,7 +135,7 @@ namespace ProcessHacker
}
}
- string servicesText = string.Empty;
+ string servicesText = "";
try
{
@@ -160,8 +159,9 @@ namespace ProcessHacker
{
if (services.ContainsKey(service))
{
- if (string.IsNullOrEmpty(services[service].Status.DisplayName))
- servicesText += " " + service + " (" + services[service].Status.DisplayName + ")\n";
+ if (services[service].Status.DisplayName != "")
+ servicesText += " " + service + " (" +
+ services[service].Status.DisplayName + ")\n";
else
servicesText += " " + service + "\n";
}
@@ -179,7 +179,7 @@ namespace ProcessHacker
Logging.Log(ex);
}
- string otherNotes = string.Empty;
+ string otherNotes = "";
try
{
@@ -202,7 +202,7 @@ namespace ProcessHacker
else if (pNode.ProcessItem.VerifyResult == VerifyResult.Unknown &&
!Settings.Instance.VerifySignatures)
{
- otherNotes += string.Empty;
+ otherNotes += "";
}
else if (pNode.ProcessItem.VerifyResult == VerifyResult.Unknown &&
Settings.Instance.VerifySignatures && !_tree.DumpMode)
@@ -231,7 +231,7 @@ namespace ProcessHacker
if (pNode.ProcessItem.IsWow64)
otherNotes += "\n Process is 32-bit (running under WOW64).";
- if (otherNotes != string.Empty)
+ if (otherNotes != "")
otherNotes = "\nNotes:" + otherNotes;
}
catch (Exception ex)
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs
index c7108c9c5..4726cdc9a 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs
@@ -112,6 +112,7 @@
//
// treeProcesses
//
+ this.treeProcesses.AllowColumnReorder = true;
this.treeProcesses.BackColor = System.Drawing.SystemColors.Window;
this.treeProcesses.Columns.Add(this.columnName);
this.treeProcesses.Columns.Add(this.columnPID);
@@ -153,7 +154,10 @@
this.treeProcesses.Columns.Add(this.columnVerificationStatus);
this.treeProcesses.Columns.Add(this.columnVerifiedSigner);
this.treeProcesses.DefaultToolTipProvider = null;
+ this.treeProcesses.DisplayDraggingNodes = true;
this.treeProcesses.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.treeProcesses.DragDropMarkColor = System.Drawing.Color.Black;
+ this.treeProcesses.FullRowSelect = true;
this.treeProcesses.LineColor = System.Drawing.SystemColors.ControlDark;
this.treeProcesses.Location = new System.Drawing.Point(0, 0);
this.treeProcesses.Model = null;
@@ -203,6 +207,7 @@
this.treeProcesses.ShowNodeToolTips = true;
this.treeProcesses.Size = new System.Drawing.Size(808, 472);
this.treeProcesses.TabIndex = 2;
+ this.treeProcesses.UseColumns = true;
this.treeProcesses.NodeMouseDoubleClick += new System.EventHandler(this.treeProcesses_NodeMouseDoubleClick);
this.treeProcesses.SelectionChanged += new System.EventHandler(this.treeProcesses_SelectionChanged);
this.treeProcesses.ColumnClicked += new System.EventHandler(this.treeProcesses_ColumnClicked);
@@ -961,6 +966,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.treeProcesses);
+ this.DoubleBuffered = true;
this.Name = "ProcessTree";
this.Size = new System.Drawing.Size(808, 472);
this.ResumeLayout(false);
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs
index 414f3cd81..21783eca3 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs
@@ -35,51 +35,47 @@ namespace ProcessHacker
{
private ProcessSystemProvider _provider;
private ProcessTreeModel _treeModel;
- private readonly ProcessToolTipProvider _tooltipProvider;
- private int _runCount;
+ private ProcessToolTipProvider _tooltipProvider;
+ private int _runCount = 0;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
public new event EventHandler DoubleClick;
public event EventHandler SelectionChanged;
public event EventHandler NodeMouseDoubleClick;
- private readonly object _listLock = new object();
+ private object _listLock = new object();
private bool _draw = true;
- private bool _dumpMode;
+ private bool _dumpMode = false;
public ProcessTree()
{
InitializeComponent();
- TreeColumn column = new TreeColumn("CPU History", 60)
- {
- IsVisible = false,
- MinColumnWidth = 10
- };
+ var column = new TreeColumn("CPU History", 60);
+ column.IsVisible = false;
+ column.MinColumnWidth = 10;
treeProcesses.Columns.Add(column);
- treeProcesses.NodeControls.Add(new Components.NodePlotter
+ treeProcesses.NodeControls.Add(new ProcessHacker.Components.NodePlotter()
{
DataPropertyName = "CpuHistory",
ParentColumn = column
});
- column = new TreeColumn("I/O History", 60)
- {
- IsVisible = false,
- MinColumnWidth = 10
- };
+ column = new TreeColumn("I/O History", 60);
+ column.IsVisible = false;
+ column.MinColumnWidth = 10;
treeProcesses.Columns.Add(column);
- treeProcesses.NodeControls.Add(new Components.NodePlotter
+ treeProcesses.NodeControls.Add(new ProcessHacker.Components.NodePlotter()
{
DataPropertyName = "IoHistory",
ParentColumn = column
});
- treeProcesses.KeyDown += this.ProcessTree_KeyDown;
- treeProcesses.MouseDown += this.treeProcesses_MouseDown;
- treeProcesses.MouseUp += this.treeProcesses_MouseUp;
- treeProcesses.DoubleClick += this.treeProcesses_DoubleClick;
+ treeProcesses.KeyDown += new KeyEventHandler(ProcessTree_KeyDown);
+ treeProcesses.MouseDown += new MouseEventHandler(treeProcesses_MouseDown);
+ treeProcesses.MouseUp += new MouseEventHandler(treeProcesses_MouseUp);
+ treeProcesses.DoubleClick += new EventHandler(treeProcesses_DoubleClick);
nodeName.ToolTipProvider = _tooltipProvider = new ProcessToolTipProvider(this);
@@ -264,15 +260,15 @@ namespace ProcessHacker
{
if (_draw)
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- if (this._treeModel.GetSortColumn() != string.Empty)
+ if (_treeModel.GetSortColumn() != "")
{
- this._treeModel.CallStructureChanged(new TreePathEventArgs(new TreePath()));
+ _treeModel.CallStructureChanged(new TreePathEventArgs(new TreePath()));
}
//treeProcesses.InvalidateNodeControlCache();
- this.treeProcesses.Invalidate();
+ treeProcesses.Invalidate();
}));
}
@@ -283,12 +279,12 @@ namespace ProcessHacker
{
Timer t = new Timer();
- t.Tick += (sender, args) =>
+ t.Tick += new EventHandler(delegate(object o, EventArgs args)
{
t.Enabled = false;
action();
t.Dispose();
- };
+ });
t.Interval = delay;
t.Enabled = true;
@@ -298,66 +294,50 @@ namespace ProcessHacker
{
if (Settings.Instance.UseColorDebuggedProcesses && p.IsBeingDebugged)
return Settings.Instance.ColorDebuggedProcesses;
-
- if (Settings.Instance.UseColorElevatedProcesses && p.ElevationType == TokenElevationType.Full)
+ else if (Settings.Instance.UseColorElevatedProcesses &&
+ p.ElevationType == TokenElevationType.Full)
return Settings.Instance.ColorElevatedProcesses;
-
- if (Settings.Instance.UseColorPosixProcesses && p.IsPosix)
+ else if (Settings.Instance.UseColorPosixProcesses &&
+ p.IsPosix)
return Settings.Instance.ColorPosixProcesses;
-
- if (Settings.Instance.UseColorWow64Processes && p.IsWow64)
+ else if (Settings.Instance.UseColorWow64Processes &&
+ p.IsWow64)
return Settings.Instance.ColorWow64Processes;
-
- if (Settings.Instance.UseColorJobProcesses && p.IsInSignificantJob)
+ else if (Settings.Instance.UseColorJobProcesses && p.IsInSignificantJob)
return Settings.Instance.ColorJobProcesses;
-
- if (
- Settings.Instance.UseColorPackedProcesses &&
- Settings.Instance.VerifySignatures &&
- !string.IsNullOrEmpty(p.Name) &&
+ else if (Settings.Instance.UseColorPackedProcesses &&
+ Settings.Instance.VerifySignatures &&
+ p.Name != null &&
Program.ImposterNames.Contains(p.Name.ToLowerInvariant()) &&
- p.VerifyResult != VerifyResult.Trusted &&
- p.VerifyResult != VerifyResult.Unknown &&
- !string.IsNullOrEmpty(p.FileName)
- )
+ p.VerifyResult != VerifyResult.Trusted &&
+ p.VerifyResult != VerifyResult.Unknown &&
+ p.FileName != null)
return Settings.Instance.ColorPackedProcesses;
-
- if (Settings.Instance.UseColorPackedProcesses &&
+ else if (Settings.Instance.UseColorPackedProcesses &&
Settings.Instance.VerifySignatures &&
p.VerifyResult != VerifyResult.Trusted &&
p.VerifyResult != VerifyResult.NoSignature &&
p.VerifyResult != VerifyResult.Unknown)
return Settings.Instance.ColorPackedProcesses;
-
- if (Settings.Instance.UseColorDotNetProcesses && p.IsDotNet)
+ else if (Settings.Instance.UseColorDotNetProcesses && p.IsDotNet)
return Settings.Instance.ColorDotNetProcesses;
-
- if (Settings.Instance.UseColorPackedProcesses && p.IsPacked)
+ else if (Settings.Instance.UseColorPackedProcesses && p.IsPacked)
return Settings.Instance.ColorPackedProcesses;
-
- if (this._dumpMode && Settings.Instance.UseColorServiceProcesses &&
- this.DumpProcessServices.ContainsKey(p.Pid) && this.DumpProcessServices[p.Pid].Count > 0)
+ else if (_dumpMode && Settings.Instance.UseColorServiceProcesses &&
+ DumpProcessServices.ContainsKey(p.Pid) && DumpProcessServices[p.Pid].Count > 0)
return Settings.Instance.ColorServiceProcesses;
-
- if (!this._dumpMode && Settings.Instance.UseColorServiceProcesses &&
+ else if (!_dumpMode && Settings.Instance.UseColorServiceProcesses &&
Program.HackerWindow.ProcessServices.ContainsKey(p.Pid) &&
Program.HackerWindow.ProcessServices[p.Pid].Count > 0)
return Settings.Instance.ColorServiceProcesses;
-
- if (Settings.Instance.UseColorSystemProcesses && string.Equals(p.Username, "NT AUTHORITY\\SYSTEM", StringComparison.OrdinalIgnoreCase))
+ else if (Settings.Instance.UseColorSystemProcesses && p.Username == "NT AUTHORITY\\SYSTEM")
return Settings.Instance.ColorSystemProcesses;
-
- if (this._dumpMode &&
- Settings.Instance.UseColorOwnProcesses &&
- string.Equals(p.Username, this.DumpUserName, StringComparison.OrdinalIgnoreCase))
+ else if (_dumpMode && Settings.Instance.UseColorOwnProcesses && p.Username == DumpUserName)
return Settings.Instance.ColorOwnProcesses;
-
- if (!this._dumpMode &&
- Settings.Instance.UseColorOwnProcesses &&
- string.Equals(p.Username, Program.CurrentUsername, StringComparison.OrdinalIgnoreCase))
+ else if (!_dumpMode && Settings.Instance.UseColorOwnProcesses && p.Username == Program.CurrentUsername)
return Settings.Instance.ColorOwnProcesses;
-
- return SystemColors.Window;
+ else
+ return SystemColors.Window;
}
public void AddItem(ProcessItem item)
@@ -372,25 +352,25 @@ namespace ProcessHacker
private void provider_DictionaryAdded(ProcessItem item)
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- lock (this._listLock)
+ lock (_listLock)
{
- this._treeModel.Add(item);
+ _treeModel.Add(item);
TreeNodeAdv node = this.FindTreeNode(item.Pid);
if (node != null)
{
- if (item.RunId > 0 && this._runCount > 0)
+ if (item.RunId > 0 && _runCount > 0)
{
node.State = TreeNodeAdv.NodeState.New;
-
- this.PerformDelayed(Settings.Instance.HighlightingDuration, () =>
+ this.PerformDelayed(Settings.Instance.HighlightingDuration,
+ new MethodInvoker(delegate
{
node.State = TreeNodeAdv.NodeState.Normal;
- this.treeProcesses.Invalidate();
- });
+ treeProcesses.Invalidate();
+ }));
}
node.BackColor = this.GetProcessColor(item);
@@ -402,9 +382,9 @@ namespace ProcessHacker
private void provider_DictionaryModified(ProcessItem oldItem, ProcessItem newItem)
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- lock (this._listLock)
+ lock (_listLock)
{
TreeNodeAdv node = this.FindTreeNode(newItem.Pid);
@@ -413,16 +393,16 @@ namespace ProcessHacker
node.BackColor = this.GetProcessColor(newItem);
}
- this._treeModel.Nodes[newItem.Pid].ProcessItem = newItem;
+ _treeModel.Nodes[newItem.Pid].ProcessItem = newItem;
}
}));
}
private void provider_DictionaryRemoved(ProcessItem item)
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- lock (this._listLock)
+ lock (_listLock)
{
TreeNodeAdv node = this.FindTreeNode(item.Pid);
@@ -430,27 +410,27 @@ namespace ProcessHacker
{
//if (this.StateHighlighting)
//{
- node.State = TreeNodeAdv.NodeState.Removed;
-
- this.PerformDelayed(Settings.Instance.HighlightingDuration, () =>
- {
- try
+ node.State = TreeNodeAdv.NodeState.Removed;
+ this.PerformDelayed(Settings.Instance.HighlightingDuration,
+ new MethodInvoker(delegate
{
- this._treeModel.Remove(item);
- this.RefreshItems();
- }
- catch (Exception ex)
- {
- Logging.Log(ex);
- }
- });
+ try
+ {
+ _treeModel.Remove(item);
+ this.RefreshItems();
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
+ }
+ }));
//}
//else
//{
// _treeModel.Remove(item);
//}
- this.treeProcesses.Invalidate();
+ treeProcesses.Invalidate();
}
}
}));
@@ -498,8 +478,8 @@ namespace ProcessHacker
{
if (_treeModel.Nodes.ContainsKey(pid))
return treeProcesses.FindNode(_treeModel.GetPath(_treeModel.Nodes[pid]));
-
- return null;
+ else
+ return null;
}
public TreeNodeAdv FindTreeNode(ProcessNode node)
diff --git a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs
index be57269b4..d3583a538 100644
--- a/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs
+++ b/1.x/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs
@@ -37,9 +37,9 @@ namespace ProcessHacker
///
public class ProcessTreeModel : ITreeModel
{
- private readonly ProcessTree _tree;
- private readonly Dictionary _processes = new Dictionary();
- private readonly List _roots = new List();
+ private ProcessTree _tree;
+ private Dictionary _processes = new Dictionary();
+ private List _roots = new List();
public ProcessTreeModel(ProcessTree tree)
{
@@ -109,7 +109,7 @@ namespace ProcessHacker
public void Remove(ProcessItem item)
{
ProcessNode itemNode = _processes[item.Pid];
- ProcessNode[] itemChildren;
+ ProcessNode[] itemChildren = null;
// Dispose of the process node we're removing.
itemNode.Dispose();
@@ -141,19 +141,21 @@ namespace ProcessHacker
this.StructureChanged(this, new TreePathEventArgs(new TreePath()));
// Expand the children because TreeViewAdv collapses them by default.
- foreach (ProcessNode n in itemChildren)
+ if (itemChildren != null)
{
- try
+ foreach (ProcessNode n in itemChildren)
{
- _tree.FindTreeNode(n).ExpandAll();
- }
- catch (Exception ex)
- {
- Logging.Log(ex);
+ try
+ {
+ _tree.FindTreeNode(n).ExpandAll();
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
+ }
}
}
-
_tree.Invalidate();
}
@@ -162,12 +164,14 @@ namespace ProcessHacker
if (node == null)
return TreePath.Empty;
- if (this.GetSortColumn() != string.Empty)
+ if (this.GetSortColumn() != "")
{
return new TreePath(node);
}
-
- return node.TreePath;
+ else
+ {
+ return node.TreePath;
+ }
}
public void MoveChildrenToRoot(ProcessNode node)
@@ -199,7 +203,7 @@ namespace ProcessHacker
if (column.SortOrder != SortOrder.None)
return column.Header.ToLowerInvariant();
- return string.Empty;
+ return "";
}
public SortOrder GetSortOrder()
@@ -213,20 +217,17 @@ namespace ProcessHacker
public int ModifySort(int sortResult, SortOrder order)
{
- switch (order)
- {
- case SortOrder.Ascending:
- return -sortResult;
- case SortOrder.Descending:
- return sortResult;
- }
-
- return 0;
+ if (order == SortOrder.Ascending)
+ return -sortResult;
+ else if (order == SortOrder.Descending)
+ return sortResult;
+ else
+ return 0;
}
public System.Collections.IEnumerable GetChildren(TreePath treePath)
{
- if (this.GetSortColumn() != string.Empty)
+ if (this.GetSortColumn() != "")
{
List nodes = new List();
string sortC = this.GetSortColumn();
@@ -234,140 +235,143 @@ namespace ProcessHacker
nodes.AddRange(_processes.Values);
- nodes.Sort((n1, n2) =>
- {
- // We have a problem here - the GdiHandlesNumber and UserHandlesNumber
- // properties are dynamically retrieved, so if n1 == n2 we may end up
- // getting different values for the same process due to the timing.
- // If we do, then Array.Sort will throw an exception.
- //
- // The temporary HACK used here is to return 0 whenever n1 == n2.
- if (n1 == n2)
- return 0;
-
- switch (sortC)
+ nodes.Sort(new Comparison(delegate(ProcessNode n1, ProcessNode n2)
{
- case "name":
- return this.ModifySort(string.Compare(n1.Name, n2.Name), sortO);
- case "pid":
- return this.ModifySort(n1.Pid.CompareTo(n2.Pid), sortO);
- case "pvt. memory":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PrivatePageCount.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.PrivatePageCount), sortO);
- case "working set":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.WorkingSetSize.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.WorkingSetSize), sortO);
- case "peak working set":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakWorkingSetSize.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.PeakWorkingSetSize), sortO);
- case "private ws":
- return this.ModifySort(n1.PrivateWorkingSetNumber.CompareTo(n2.PrivateWorkingSetNumber), sortO);
- case "shared ws":
- return this.ModifySort(n1.SharedWorkingSetNumber.CompareTo(n2.SharedWorkingSetNumber), sortO);
- case "shareable ws":
- return this.ModifySort(n1.ShareableWorkingSetNumber.CompareTo(n2.ShareableWorkingSetNumber), sortO);
- case "virtual size":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.VirtualSize.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.VirtualSize), sortO);
- case "peak virtual size":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakVirtualSize.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.PeakVirtualSize), sortO);
- case "pagefile usage":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PagefileUsage.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.PagefileUsage), sortO);
- case "peak pagefile usage":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakPagefileUsage.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.PeakPagefileUsage), sortO);
- case "page faults":
- return this.ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PageFaultCount.CompareTo(
- n2.ProcessItem.Process.VirtualMemoryCounters.PageFaultCount), sortO);
- case "cpu":
- return this.ModifySort(n1.ProcessItem.CpuUsage.CompareTo(n2.ProcessItem.CpuUsage), sortO);
- case "username":
- return this.ModifySort(string.Compare(n1.Username, n2.Username), sortO);
- case "session id":
- return this.ModifySort(n1.ProcessItem.SessionId.CompareTo(n2.ProcessItem.SessionId), sortO);
- case "priority class":
- case "base priority":
- return this.ModifySort(n1.ProcessItem.Process.BasePriority.CompareTo(
- n2.ProcessItem.Process.BasePriority), sortO);
- case "description":
- return this.ModifySort(string.Compare(n1.Description, n2.Description), sortO);
- case "company":
- return this.ModifySort(string.Compare(n1.Company, n2.Company), sortO);
- case "file name":
- return this.ModifySort(string.Compare(n1.FileName, n2.FileName), sortO);
- case "command line":
- return this.ModifySort(string.Compare(n1.CommandLine, n2.CommandLine), sortO);
- case "threads":
- return this.ModifySort(n1.ProcessItem.Process.NumberOfThreads.CompareTo(
- n2.ProcessItem.Process.NumberOfThreads), sortO);
- case "handles":
- return this.ModifySort(n1.ProcessItem.Process.HandleCount.CompareTo(
- n2.ProcessItem.Process.HandleCount), sortO);
- case "gdi handles":
- return this.ModifySort(n1.GdiHandlesNumber.CompareTo(n2.GdiHandlesNumber), sortO);
- case "user handles":
- return this.ModifySort(n1.UserHandlesNumber.CompareTo(n2.UserHandlesNumber), sortO);
- case "i/o total":
- return this.ModifySort(n1.IoTotalNumber.CompareTo(n2.IoTotalNumber), sortO);
- case "i/o ro":
- return this.ModifySort(n1.IoReadOtherNumber.CompareTo(n2.IoReadOtherNumber), sortO);
- case "i/o w":
- return this.ModifySort(n1.IoWriteNumber.CompareTo(n2.IoWriteNumber), sortO);
- case "integrity":
- return this.ModifySort(n1.IntegrityLevel.CompareTo(n2.IntegrityLevel), sortO);
- case "i/o priority":
- return this.ModifySort(n1.IoPriority.CompareTo(n2.IoPriority), sortO);
- case "page priority":
- return this.ModifySort(n1.PagePriority.CompareTo(n2.PagePriority), sortO);
- case "start time":
- return this.ModifySort(n1.ProcessItem.CreateTime.CompareTo(n2.ProcessItem.CreateTime), sortO);
- case "start time (relative)":
- // Invert the order - bigger dates are actually smaller if we use the relative time span.
- return -this.ModifySort(n1.ProcessItem.CreateTime.CompareTo(n2.ProcessItem.CreateTime), sortO);
- case "total cpu time":
- return this.ModifySort((n1.ProcessItem.Process.KernelTime + n1.ProcessItem.Process.UserTime).
- CompareTo(n2.ProcessItem.Process.KernelTime + n2.ProcessItem.Process.UserTime), sortO);
- case "kernel cpu time":
- return this.ModifySort(n1.ProcessItem.Process.KernelTime.CompareTo(
- n2.ProcessItem.Process.KernelTime), sortO);
- case "user cpu time":
- return this.ModifySort(n1.ProcessItem.Process.UserTime.CompareTo(
- n2.ProcessItem.Process.UserTime), sortO);
- case "verification status":
- return this.ModifySort(string.Compare(n1.VerificationStatus, n2.VerificationStatus), sortO);
- case "verified signer":
- return this.ModifySort(string.Compare(n1.VerifiedSigner, n2.VerifiedSigner), sortO);
- default:
+ // We have a problem here - the GdiHandlesNumber and UserHandlesNumber
+ // properties are dynamically retrieved, so if n1 == n2 we may end up
+ // getting different values for the same process due to the timing.
+ // If we do, then Array.Sort will throw an exception.
+ //
+ // The temporary HACK used here is to return 0 whenever n1 == n2.
+ if (n1 == n2)
return 0;
- }
- });
+
+ switch (sortC)
+ {
+ case "name":
+ return ModifySort(string.Compare(n1.Name, n2.Name), sortO);
+ case "pid":
+ return ModifySort(n1.Pid.CompareTo(n2.Pid), sortO);
+ case "pvt. memory":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PrivatePageCount.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.PrivatePageCount), sortO);
+ case "working set":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.WorkingSetSize.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.WorkingSetSize), sortO);
+ case "peak working set":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakWorkingSetSize.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.PeakWorkingSetSize), sortO);
+ case "private ws":
+ return ModifySort(n1.PrivateWorkingSetNumber.CompareTo(n2.PrivateWorkingSetNumber), sortO);
+ case "shared ws":
+ return ModifySort(n1.SharedWorkingSetNumber.CompareTo(n2.SharedWorkingSetNumber), sortO);
+ case "shareable ws":
+ return ModifySort(n1.ShareableWorkingSetNumber.CompareTo(n2.ShareableWorkingSetNumber), sortO);
+ case "virtual size":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.VirtualSize.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.VirtualSize), sortO);
+ case "peak virtual size":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakVirtualSize.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.PeakVirtualSize), sortO);
+ case "pagefile usage":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PagefileUsage.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.PagefileUsage), sortO);
+ case "peak pagefile usage":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakPagefileUsage.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.PeakPagefileUsage), sortO);
+ case "page faults":
+ return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PageFaultCount.CompareTo(
+ n2.ProcessItem.Process.VirtualMemoryCounters.PageFaultCount), sortO);
+ case "cpu":
+ return ModifySort(n1.ProcessItem.CpuUsage.CompareTo(n2.ProcessItem.CpuUsage), sortO);
+ case "username":
+ return ModifySort(string.Compare(n1.Username, n2.Username), sortO);
+ case "session id":
+ return ModifySort(n1.ProcessItem.SessionId.CompareTo(n2.ProcessItem.SessionId), sortO);
+ case "priority class":
+ case "base priority":
+ return ModifySort(n1.ProcessItem.Process.BasePriority.CompareTo(
+ n2.ProcessItem.Process.BasePriority), sortO);
+ case "description":
+ return ModifySort(string.Compare(n1.Description, n2.Description), sortO);
+ case "company":
+ return ModifySort(string.Compare(n1.Company, n2.Company), sortO);
+ case "file name":
+ return ModifySort(string.Compare(n1.FileName, n2.FileName), sortO);
+ case "command line":
+ return ModifySort(string.Compare(n1.CommandLine, n2.CommandLine), sortO);
+ case "threads":
+ return ModifySort(n1.ProcessItem.Process.NumberOfThreads.CompareTo(
+ n2.ProcessItem.Process.NumberOfThreads), sortO);
+ case "handles":
+ return ModifySort(n1.ProcessItem.Process.HandleCount.CompareTo(
+ n2.ProcessItem.Process.HandleCount), sortO);
+ case "gdi handles":
+ return ModifySort(n1.GdiHandlesNumber.CompareTo(n2.GdiHandlesNumber), sortO);
+ case "user handles":
+ return ModifySort(n1.UserHandlesNumber.CompareTo(n2.UserHandlesNumber), sortO);
+ case "i/o total":
+ return ModifySort(n1.IoTotalNumber.CompareTo(n2.IoTotalNumber), sortO);
+ case "i/o ro":
+ return ModifySort(n1.IoReadOtherNumber.CompareTo(n2.IoReadOtherNumber), sortO);
+ case "i/o w":
+ return ModifySort(n1.IoWriteNumber.CompareTo(n2.IoWriteNumber), sortO);
+ case "integrity":
+ return ModifySort(n1.IntegrityLevel.CompareTo(n2.IntegrityLevel), sortO);
+ case "i/o priority":
+ return ModifySort(n1.IoPriority.CompareTo(n2.IoPriority), sortO);
+ case "page priority":
+ return ModifySort(n1.PagePriority.CompareTo(n2.PagePriority), sortO);
+ case "start time":
+ return ModifySort(n1.ProcessItem.CreateTime.CompareTo(n2.ProcessItem.CreateTime), sortO);
+ case "start time (relative)":
+ // Invert the order - bigger dates are actually smaller if we use the relative time span.
+ return -ModifySort(n1.ProcessItem.CreateTime.CompareTo(n2.ProcessItem.CreateTime), sortO);
+ case "total cpu time":
+ return ModifySort((n1.ProcessItem.Process.KernelTime + n1.ProcessItem.Process.UserTime).
+ CompareTo(n2.ProcessItem.Process.KernelTime + n2.ProcessItem.Process.UserTime), sortO);
+ case "kernel cpu time":
+ return ModifySort(n1.ProcessItem.Process.KernelTime.CompareTo(
+ n2.ProcessItem.Process.KernelTime), sortO);
+ case "user cpu time":
+ return ModifySort(n1.ProcessItem.Process.UserTime.CompareTo(
+ n2.ProcessItem.Process.UserTime), sortO);
+ case "verification status":
+ return ModifySort(string.Compare(n1.VerificationStatus, n2.VerificationStatus), sortO);
+ case "verified signer":
+ return ModifySort(string.Compare(n1.VerifiedSigner, n2.VerifiedSigner), sortO);
+ default:
+ return 0;
+ }
+ }));
return nodes;
}
if (treePath.IsEmpty())
return _roots;
-
- return (treePath.LastNode as ProcessNode).Children;
+ else
+ return (treePath.LastNode as ProcessNode).Children;
}
public bool IsLeaf(TreePath treePath)
{
// When we're sorting the whole tree is a flat list, so there are no children.
- if (this.GetSortColumn() != string.Empty)
+ if (this.GetSortColumn() != "")
return true;
if (treePath.IsEmpty())
return false;
-
- return (treePath.LastNode as ProcessNode).Children.Count == 0;
+ else
+ return (treePath.LastNode as ProcessNode).Children.Count == 0;
}
public event EventHandler NodesChanged;
+
public event EventHandler NodesInserted;
+
public event EventHandler NodesRemoved;
+
public event EventHandler StructureChanged;
public void CallStructureChanged(TreePathEventArgs args)
diff --git a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoveryData.cs b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoveryData.cs
index 5b79f4785..d3e500410 100644
--- a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoveryData.cs
+++ b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoveryData.cs
@@ -67,7 +67,7 @@ namespace ProcessHackerRestartRecovery
public void Invoke()
{
if(Callback != null)
- Callback(State);
+ Callback(State);
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoverySettings.cs b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoverySettings.cs
index f8679aadf..0b7d57446 100644
--- a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoverySettings.cs
+++ b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RecoverySettings.cs
@@ -34,8 +34,8 @@ namespace ProcessHackerRestartRecovery
///
public class RecoverySettings
{
- private readonly RecoveryData recoveryData;
- private readonly uint pingInterval;
+ private RecoveryData recoveryData;
+ private uint pingInterval;
///
/// Initializes a new instance of the RecoverySettings class.
@@ -83,10 +83,9 @@ namespace ProcessHackerRestartRecovery
public override string ToString()
{
return String.Format("delegate: {0}, state: {1}, ping: {2}",
- this.recoveryData.Callback.Method,
- this.recoveryData.State,
- this.PingInterval
- );
+ this.recoveryData.Callback.Method.ToString(),
+ this.recoveryData.State.ToString(),
+ this.PingInterval);
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryInterop.cs b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryInterop.cs
index 7a406b735..34976f142 100644
--- a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryInterop.cs
+++ b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryInterop.cs
@@ -44,7 +44,7 @@ namespace ProcessHackerRestartRecovery
private static UInt32 InternalRecoveryHandler(IntPtr parameter)
{
- bool cancelled;
+ bool cancelled = false;
ApplicationRecoveryInProgress(out cancelled);
GCHandle handle = GCHandle.FromIntPtr(parameter);
diff --git a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryManager.cs b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryManager.cs
index c42c6bee8..e2ea8dad4 100644
--- a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryManager.cs
+++ b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartRecoveryManager.cs
@@ -40,7 +40,10 @@ namespace ProcessHackerRestartRecovery
public static void RegisterForRestart()
{
// Register for automatic restart if the application was terminated for any reason other than a system reboot or a system update.
- RegisterForApplicationRestart(new RestartSettings("-recovered", RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch));
+ ApplicationRestartRecoveryManager.RegisterForApplicationRestart(
+ new RestartSettings("-recovered",
+ RestartRestrictions.NotOnReboot
+ | RestartRestrictions.NotOnPatch));
}
public static void RegisterForRecovery()
@@ -49,10 +52,9 @@ namespace ProcessHackerRestartRecovery
// In some cases it might make sense to pass this initial state.
// Another approach: When doing "auto-save", register for recovery everytime, and pass
// the current state I.E. data for recovery at that time.
- RecoveryData data = new RecoveryData(RecoveryProcedure, null);
+ RecoveryData data = new RecoveryData(new RecoveryCallback(RecoveryProcedure), null);
RecoverySettings settings = new RecoverySettings(data, 0);
-
- RegisterForApplicationRecovery(settings);
+ ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(settings);
}
///
@@ -71,12 +73,12 @@ namespace ProcessHackerRestartRecovery
try
{
// Remove the icons or they remain in the system try.
- ProcessHacker.Program.HackerWindow.ExecuteOnIcons(icon => icon.Visible = false);
- ProcessHacker.Program.HackerWindow.ExecuteOnIcons(icon => icon.Dispose());
+ ProcessHacker.Program.HackerWindow.ExecuteOnIcons((icon) => icon.Visible = false);
+ ProcessHacker.Program.HackerWindow.ExecuteOnIcons((icon) => icon.Dispose());
// Make sure KPH connection is closed.
- if (KProcessHacker2.Instance.KphIsConnected)
- KProcessHacker2.Instance.Dispose();
+ if (ProcessHacker.Native.KProcessHacker.Instance != null)
+ ProcessHacker.Native.KProcessHacker.Instance.Close();
}
catch { }
@@ -130,13 +132,10 @@ namespace ProcessHackerRestartRecovery
HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRecoveryCallback(AppRestartRecoveryNativeMethods.internalCallback, (IntPtr)handle, settings.PingInterval, (uint)0);
- switch (hr)
- {
- case HResult.InvalidArgument:
- throw new ArgumentException("Application was not registered for recovery due to bad parameters.");
- case HResult.Fail:
- throw new ExternalException("Application failed to register for recovery.");
- }
+ if (hr == HResult.InvalidArgument)
+ throw new ArgumentException("Application was not registered for recovery due to bad parameters.");
+ else if (hr == HResult.Fail)
+ throw new ExternalException("Application failed to register for recovery.");
}
}
@@ -177,7 +176,7 @@ namespace ProcessHackerRestartRecovery
{
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
{
- bool canceled;
+ bool canceled = false;
HResult hr = AppRestartRecoveryNativeMethods.ApplicationRecoveryInProgress(out canceled);
@@ -186,8 +185,8 @@ namespace ProcessHackerRestartRecovery
return canceled;
}
-
- return true;
+ else
+ return true;
}
///
@@ -219,13 +218,10 @@ namespace ProcessHackerRestartRecovery
{
HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRestart(settings.Command, settings.Restrictions);
- switch (hr)
- {
- case HResult.Fail:
- throw new InvalidOperationException("Application failed to registered for restart.");
- case HResult.InvalidArgument:
- throw new ArgumentException("Failed to register application for restart due to bad parameters.");
- }
+ if (hr == HResult.Fail)
+ throw new InvalidOperationException("Application failed to registered for restart.");
+ else if (hr == HResult.InvalidArgument)
+ throw new ArgumentException("Failed to register application for restart due to bad parameters.");
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartSettings.cs b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartSettings.cs
index 861f2b5df..877515386 100644
--- a/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartSettings.cs
+++ b/1.x/trunk/ProcessHacker/Components/RestartRecoveryLib/RestartSettings.cs
@@ -32,8 +32,8 @@ namespace ProcessHackerRestartRecovery
/// less than 60 seconds beforeterminating.
public class RestartSettings
{
- private readonly string command;
- private readonly RestartRestrictions restrictions;
+ private string command;
+ private RestartRestrictions restrictions;
///
/// Creates a new instance of the RestartSettings class.
diff --git a/1.x/trunk/ProcessHacker/Components/SectionProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/SectionProperties.Designer.cs
index 85bd5c3dd..8b9d45ebc 100644
--- a/1.x/trunk/ProcessHacker/Components/SectionProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/SectionProperties.Designer.cs
@@ -42,7 +42,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 3);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(61, 13);
+ this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Attributes:";
//
@@ -69,7 +69,7 @@
this.labelAttributes.AutoSize = true;
this.labelAttributes.Location = new System.Drawing.Point(75, 3);
this.labelAttributes.Name = "labelAttributes";
- this.labelAttributes.Size = new System.Drawing.Size(38, 13);
+ this.labelAttributes.Size = new System.Drawing.Size(36, 13);
this.labelAttributes.TabIndex = 0;
this.labelAttributes.Text = "Image";
//
@@ -77,7 +77,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.labelAttributes);
this.Controls.Add(this.labelSize);
this.Controls.Add(this.label2);
diff --git a/1.x/trunk/ProcessHacker/Components/SectionProperties.cs b/1.x/trunk/ProcessHacker/Components/SectionProperties.cs
index e0e9cb174..3dcc0c788 100644
--- a/1.x/trunk/ProcessHacker/Components/SectionProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/SectionProperties.cs
@@ -6,7 +6,7 @@ namespace ProcessHacker.Components
{
public partial class SectionProperties : UserControl
{
- private readonly SectionHandle _sectionHandle;
+ private SectionHandle _sectionHandle;
public SectionProperties(SectionHandle sectionHandle)
{
diff --git a/1.x/trunk/ProcessHacker/Components/SectionProperties.resx b/1.x/trunk/ProcessHacker/Components/SectionProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/SectionProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/SectionProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.Designer.cs
index c187078fb..d158aa1e9 100644
--- a/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.Designer.cs
@@ -44,7 +44,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 3);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(84, 13);
+ this.label1.Size = new System.Drawing.Size(75, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Current Count:";
//
@@ -53,7 +53,7 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 25);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(94, 13);
+ this.label2.Size = new System.Drawing.Size(85, 13);
this.label2.TabIndex = 0;
this.label2.Text = "Maximum Count:";
//
@@ -101,7 +101,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.buttonAcquire);
this.Controls.Add(this.buttonRelease);
this.Controls.Add(this.label2);
diff --git a/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.cs b/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.cs
index 89e44030b..0cd493efe 100644
--- a/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.cs
@@ -9,7 +9,7 @@ namespace ProcessHacker.Components
{
public partial class SemaphoreProperties : UserControl
{
- private readonly SemaphoreHandle _semaphoreHandle;
+ private SemaphoreHandle _semaphoreHandle;
public SemaphoreProperties(SemaphoreHandle semaphoreHandle)
{
diff --git a/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.resx b/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/SemaphoreProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/ServiceList.Designer.cs b/1.x/trunk/ProcessHacker/Components/ServiceList.Designer.cs
index e8d1ed296..33bd1aa98 100644
--- a/1.x/trunk/ProcessHacker/Components/ServiceList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ServiceList.Designer.cs
@@ -34,13 +34,13 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ServiceList));
- this.listServices = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnStartType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnPID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listServices = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnDescription = new System.Windows.Forms.ColumnHeader();
+ this.columnType = new System.Windows.Forms.ColumnHeader();
+ this.columnStatus = new System.Windows.Forms.ColumnHeader();
+ this.columnStartType = new System.Windows.Forms.ColumnHeader();
+ this.columnPID = new System.Windows.Forms.ColumnHeader();
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.SuspendLayout();
//
@@ -55,7 +55,6 @@
this.columnStartType,
this.columnPID});
this.listServices.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listServices.DoubleClickChecks = true;
this.listServices.FullRowSelect = true;
this.listServices.HideSelection = false;
this.listServices.Location = new System.Drawing.Point(0, 0);
@@ -110,8 +109,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listServices);
+ this.DoubleBuffered = true;
this.Name = "ServiceList";
this.Size = new System.Drawing.Size(685, 472);
this.ResumeLayout(false);
@@ -120,7 +119,7 @@
#endregion
- private ExtendedListView listServices;
+ private System.Windows.Forms.ListView listServices;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ImageList imageList;
private System.Windows.Forms.ColumnHeader columnDescription;
diff --git a/1.x/trunk/ProcessHacker/Components/ServiceList.cs b/1.x/trunk/ProcessHacker/Components/ServiceList.cs
index 8ed3b420a..851ae92d2 100644
--- a/1.x/trunk/ProcessHacker/Components/ServiceList.cs
+++ b/1.x/trunk/ProcessHacker/Components/ServiceList.cs
@@ -22,7 +22,9 @@
using System;
using System.Collections.Generic;
+using System.Reflection;
using System.Windows.Forms;
+using ProcessHacker.Common;
using ProcessHacker.Common.Ui;
using ProcessHacker.Native.Api;
using ProcessHacker.UI;
@@ -32,10 +34,10 @@ namespace ProcessHacker.Components
public partial class ServiceList : UserControl
{
private ServiceProvider _provider;
- private int _runCount;
- private readonly HighlightingContext _highlightingContext;
- private readonly List _needsAdd = new List();
- private bool _needsSort;
+ private int _runCount = 0;
+ private HighlightingContext _highlightingContext;
+ private List _needsAdd = new List();
+ private bool _needsSort = false;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
@@ -47,11 +49,12 @@ namespace ProcessHacker.Components
InitializeComponent();
_highlightingContext = new HighlightingContext(listServices);
- listServices.KeyDown += this.ServiceList_KeyDown;
- listServices.MouseDown += this.listServices_MouseDown;
- listServices.MouseUp += this.listServices_MouseUp;
- listServices.DoubleClick += this.listServices_DoubleClick;
- listServices.SelectedIndexChanged += this.listServices_SelectedIndexChanged;
+ listServices.SetTheme("explorer");
+ listServices.KeyDown += new KeyEventHandler(ServiceList_KeyDown);
+ listServices.MouseDown += new MouseEventHandler(listServices_MouseDown);
+ listServices.MouseUp += new MouseEventHandler(listServices_MouseUp);
+ listServices.DoubleClick += new EventHandler(listServices_DoubleClick);
+ listServices.SelectedIndexChanged += new System.EventHandler(listServices_SelectedIndexChanged);
listServices.ListViewItemSorter = new SortedListViewComparer(listServices);
}
@@ -87,6 +90,20 @@ namespace ProcessHacker.Components
#region Properties
+ public new bool DoubleBuffered
+ {
+ get
+ {
+ return (bool)typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listServices, null);
+ }
+ set
+ {
+ typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listServices, value, null);
+ }
+ }
+
public override bool Focused
{
get
@@ -107,7 +124,7 @@ namespace ProcessHacker.Components
set { listServices.ContextMenuStrip = value; }
}
- public ExtendedListView List
+ public ListView List
{
get { return listServices; }
}
@@ -119,10 +136,10 @@ namespace ProcessHacker.Components
{
if (_provider != null)
{
- _provider.DictionaryAdded -= this.provider_DictionaryAdded;
- _provider.DictionaryModified -= this.provider_DictionaryModified;
- _provider.DictionaryRemoved -= this.provider_DictionaryRemoved;
- _provider.Updated -= this.provider_Updated;
+ _provider.DictionaryAdded -= new ServiceProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified -= new ServiceProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved -= new ServiceProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated -= new ServiceProvider.ProviderUpdateOnce(provider_Updated);
}
_provider = value;
@@ -133,10 +150,10 @@ namespace ProcessHacker.Components
{
//_provider.InterlockedExecute(new MethodInvoker(() =>
//{
- _provider.DictionaryAdded += this.provider_DictionaryAdded;
- _provider.DictionaryModified += this.provider_DictionaryModified;
- _provider.DictionaryRemoved += this.provider_DictionaryRemoved;
- _provider.Updated += this.provider_Updated;
+ _provider.DictionaryAdded += new ServiceProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified += new ServiceProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved += new ServiceProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated += new ServiceProvider.ProviderUpdateOnce(provider_Updated);
foreach (ServiceItem item in _provider.Dictionary.Values)
{
@@ -196,13 +213,13 @@ namespace ProcessHacker.Components
if (_needsSort)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- if (_needsSort)
{
- listServices.Sort();
- _needsSort = false;
- }
- }));
+ if (_needsSort)
+ {
+ listServices.Sort();
+ _needsSort = false;
+ }
+ }));
}
_runCount++;
@@ -220,18 +237,21 @@ namespace ProcessHacker.Components
private void provider_DictionaryAdded(ServiceItem item)
{
- HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, item.RunId > 0 && _runCount > 0)
- {
- Name = item.Status.ServiceName,
- Text = item.Status.ServiceName
- };
+ HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
+ item.RunId > 0 && _runCount > 0);
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Status.DisplayName));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Status.ServiceStatusProcess.ServiceType.ToString()));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Status.ServiceStatusProcess.CurrentState.ToString()));
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Config.StartType.ToString()));
+ litem.Name = item.Status.ServiceName;
+ litem.Text = item.Status.ServiceName;
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem,
- item.Status.ServiceStatusProcess.ProcessID == 0 ? string.Empty :
+ item.Status.DisplayName));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem,
+ item.Status.ServiceStatusProcess.ServiceType.ToString()));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem,
+ item.Status.ServiceStatusProcess.CurrentState.ToString()));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem,
+ item.Config.StartType.ToString()));
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem,
+ item.Status.ServiceStatusProcess.ProcessID == 0 ? "" :
item.Status.ServiceStatusProcess.ProcessID.ToString()));
if ((item.Status.ServiceStatusProcess.ServiceType & ServiceType.InteractiveProcess) != 0)
@@ -267,7 +287,7 @@ namespace ProcessHacker.Components
litem.SubItems[2].Text = newItem.Status.ServiceStatusProcess.ServiceType.ToString();
litem.SubItems[3].Text = newItem.Status.ServiceStatusProcess.CurrentState.ToString();
litem.SubItems[4].Text = newItem.Config.StartType.ToString();
- litem.SubItems[5].Text = newItem.Status.ServiceStatusProcess.ProcessID == 0 ? string.Empty :
+ litem.SubItems[5].Text = newItem.Status.ServiceStatusProcess.ProcessID == 0 ? "" :
newItem.Status.ServiceStatusProcess.ProcessID.ToString();
_needsSort = true;
}
diff --git a/1.x/trunk/ProcessHacker/Components/ServiceList.resx b/1.x/trunk/ProcessHacker/Components/ServiceList.resx
index 2d0bf5c69..6cdf0e270 100644
--- a/1.x/trunk/ProcessHacker/Components/ServiceList.resx
+++ b/1.x/trunk/ProcessHacker/Components/ServiceList.resx
@@ -112,99 +112,99 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
- AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACa
- EwAAAk1TRnQBSQFMAgEBBAEAAQwBAAEMAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
+ EwAAAk1TRnQBSQFMAgEBBAEAAQwBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AegADOwFjA1gBvwNX
- Ab8DOwFjWAADQAFwAVICVAGmAVEBZQF5AeoBOwF/AaQB9wE7AX8BpAH3ATsBfwGkAfcBOwF/AaQB9wE7
- AX8BpAH3ATsBfwGkAfcBOwF/AaQB9wE7AX8BpAH3ATsBfQGkAfcBTAFwAZAB8QNMAZNUAAMdASkDCgEO
- AwEBAgNjAeoDvQH/A7IB/wNcAeoDAQECAwoBDgMdASkUAAMKAQ0DDgETA04BmAFkAlgB4wGAAUYBQQH1
- AZIBTQEpAfoBkgFNASkB+gF7AUgBNwH2AWYBVQFSAeoBVwJVAboDEAEWAwoBDQgAAVgBaQF0AeYBiQGP
- AZEB8AGnAcMB2gH9AZ4B2wH0Af8BlgHaAfMB/wGOAdgB8wH/AYYB1wHzAf8BdgHUAfIB/wFwAdMB8gH/
- AWkB0gHxAf8BYwHQAfEB/wFgAc8B8QH/AbEB2QHnAf4BTQFsAYcB8AgAA1IBqQHDAY4BXQH/AcABiwFb
- Af8BvgGIAVkB/wG7AYUBVgH/AbkBgwFUAf8BtAFzAVEB/wGyAXEBTwH/AbEBcAFNAf8BrgFuAUwB/wGt
- AWsBSwH/AasBagFJAf8BqQFoAUgB/wGpAWYBRgH/A1IBqQwAA1ABmwNaAf0DZAHnAxIBGQNkAecDywH/
- A8cB/wNiAecDEgEZA1wB5wNEAf0DTwGbDAADRAF5ASYBXwGlAfsBcwJfAfsBvwFVASoB/wH+AbkBVgH/
- Af4BuQFXAf8B/gG5AVcB/wH+AbkBVwH/Af4BuQFWAf8B/gG5AVYB/wGxAT4BGQH/AWgBWQFeAfUBPgFz
- AZwB+ANIAYMEAAE/AYQBpwH3Ae8B+gH+Af8BoQHpAfkB/wGRAeUB+AH/AYEB4QH3Af8BaQHeAfYB/wFa
- AdoB9QH/AUsB1wH0Af8BPgHTAfMB/wEwAdAB8gH/ASUBzQHxAf8BHQHLAfAB/wHKAfIB+wH/AT8BhAGn
- AfcIAAHIAZIBYTX/AakBZwFGAf8IAANEAXsDvAH/A94B/wOmAf8DZwH0A38B/gPEAf8DwgH/A20B/gNl
- AfQDpgH/A9IB/wOAAf8DRAF7CAABKQF9AbwB/gGCAboB7gH/AZ8BWwFNAf8B9QG7AYQC/wGsAVAB/wH+
- AagBTwH/Af4BogFMAf8B/gGcAUgC/wGjAUoC/wGfAUUB/wH4Aa4BbQH/AaQBUwE/Af8BgwG8Ae8B/wEq
- AXcBtQH+BAABPgGEAaoB+AHyAfoB/QH/AbMB7QH6Af8BpAHpAfkB/wGVAeYB+AH/AYUB4gH3Af8BgQHh
- AfcB/wFxAeAB9wH/AWYB3QH2Af8BWQHaAfUB/wFLAdYB8wH/AT4B0wHyAf8B6AH5Af0B/wEsAZQB2gH/
- CAABygGUAWML/wH+A/8B/QH/Av4B/QH/Av4B/AH/Av4B/AH/Av4B/AH/Av4B/AH/Av4B+gH/Av4B+gH/
- AvwB+QX/AaoBaAFIAf8IAANFAX0DkQH+A9UB/wPFAf8DywH/A9EB/wPJAf8DxwH/A8wB/wPFAf8DvQH/
- A8sB/wNuAf4DRQF9CAABKwFxAbMB/AFtAbMB6gH/AbMBngGUAv8BtwFVAv8BtgFYAf8B/gGyAVYB/wH+
- AawBUgH/Af4BpQFOAf8B/QGeAUgB/wH+AZcBQwL/AY0BOAH/AbwBjwGCAf8BcwG4Ae0B/wEqAWkBoAH6
- BAABQQGLAa8B+QH2AfwB/gH/AcgB8gH8Af8BuQHvAfsB/wGsAewB+gH/AYwB5AH4Af8BigHjAfgB/wGC
- AeEB9wH/AXAB3wH3Af8BZAHdAfYB/wFYAdoB9QH/AU4B1wH0Af8B5wH4Af0B/wEsAZQB2gH/CAABzAGX
- AWQH/wH8A/8B/QH/Av4B/AH/Av4B/AH/Av4B+wH/Av0B+gH/Av0B+gH/Av0B+gH/Av0B+gH/AvwB9wH/
- AvsB9gX/AawBagFJAf8MAANIAYUDxQH/A8EB/wPFAf8DxwH/A6oB/wOnAf8DwQH/A74B/wO1Af8DqgH/
- A0gBhQwAAzIBUAGKAUkBOQH/AfwByAGrAv8B0QGYAf8B/gHHAWIB/wH+Ab8BXQH/Af4BuQFZAf8B/gGx
- AVMB/wH+AagBTgH/Af0BoAFJAv8BtwFvAf8B/gGpAYAB/wGIAUUBNwH/AjoBOQFgBAABQAGSAa8B+gH+
+ Ab8DOwFjWAADQAFwAVICVAGmAVABZgF9AeoBOgGAAagB9wE6AYABqAH3AToBgAGoAfcBOgGAAagB9wE6
+ AYABqAH3AToBgAGoAfcBOgGAAagB9wE6AYABqAH3AToBfwGoAfcBSQFyAZQB8QNMAZNUAAMdASkDCgEO
+ AwEBAgNkAeoDvQH/A7IB/wNcAeoDAQECAwoBDgMdASkUAAMKAQ0DDgETA04BmAFlAlgB4wGCAUYBPgH1
+ AZUBTQEpAfoBlQFNASkB+gF9AUgBNgH2AWkBVQFRAeoBVwJVAboDEAEWAwoBDQgAAVgBagF5AeYBjgGW
+ AZgB8AGnAcYB3QH9AZ4B2wH0Af8BlgHaAfMB/wGOAdgB8wH/AYYB1wHzAf8BdwHUAfIB/wFxAdMB8gH/
+ AWoB0gHxAf8BZAHQAfEB/wFhAc8B8QH/AbMB2wHpAf4BSwFuAYwB8AgAA1IBqQHDAY4BXgH/AcABiwFc
+ Af8BvgGIAVoB/wG7AYUBVwH/AbkBgwFVAf8BtAF0AVIB/wGyAXIBUAH/AbEBcQFOAf8BrgFvAU0B/wGt
+ AWwBTAH/AasBawFKAf8BqQFpAUkB/wGpAWcBRwH/A1IBqQwAA1ABmwNcAf0DZAHnAxIBGQNkAecDywH/
+ A8cB/wNiAecDEgEZA1wB5wNFAf0DTwGbDAADRAF5ASYBXwGpAfsBdgJfAfsBvwFWASsB/wH+AbkBVwH/
+ Af4BuQFYAf8B/gG5AVgB/wH+AbkBWAH/Af4BuQFXAf8B/gG5AVcB/wGxAT8BGgH/AWkBWQFgAfUBPgF0
+ AZ8B+ANIAYMEAAE+AYUBqwH3Ae8B+gH+Af8BoQHpAfkB/wGRAeUB+AH/AYEB4QH3Af8BagHeAfYB/wFb
+ AdoB9QH/AUwB1wH0Af8BPwHTAfMB/wExAdAB8gH/ASYBzQHxAf8BHgHLAfAB/wHKAfIB+wH/AT4BhQGr
+ AfcIAAHIAZIBYjX/AakBaAFHAf8IAANEAXsDvAH/A94B/wOmAf8DagH0A38B/gPEAf8DwgH/A20B/gNl
+ AfQDpgH/A9IB/wOAAf8DRAF7CAABKQF9Ab4B/gGCAboB7gH/AZ8BXAFOAf8B9QG7AYQC/wGsAVEB/wH+
+ AagBUAH/Af4BogFNAf8B/gGcAUkC/wGjAUsC/wGfAUYB/wH4Aa4BbgH/AaQBVAFAAf8BgwG8Ae8B/wEq
+ AXcBtwH+BAABPgGHAa8B+AHyAfoB/QH/AbMB7QH6Af8BpAHpAfkB/wGVAeYB+AH/AYUB4gH3Af8BgQHh
+ AfcB/wFyAeAB9wH/AWcB3QH2Af8BWgHaAfUB/wFMAdYB8wH/AT8B0wHyAf8B6AH5Af0B/wEtAZQB2gH/
+ CAABygGUAWQL/wH+A/8B/QH/Av4B/QH/Av4B/AH/Av4B/AH/Av4B/AH/Av4B/AH/Av4B+gH/Av4B+gH/
+ AvwB+QX/AaoBaQFJAf8IAANFAX0DkwH+A9UB/wPFAf8DywH/A9EB/wPJAf8DxwH/A8wB/wPFAf8DvQH/
+ A8sB/wNuAf4DRQF9CAABKwFyAbUB/AFuAbMB6gH/AbMBngGUAv8BtwFWAv8BtgFZAf8B/gGyAVcB/wH+
+ AawBUwH/Af4BpQFPAf8B/QGeAUkB/wH+AZcBRAL/AY0BOQH/AbwBjwGCAf8BdAG4Ae0B/wEqAWoBogH6
+ BAABQQGMAbIB+QH2AfwB/gH/AcgB8gH8Af8BuQHvAfsB/wGsAewB+gH/AYwB5AH4Af8BigHjAfgB/wGC
+ AeEB9wH/AXEB3wH3Af8BZQHdAfYB/wFZAdoB9QH/AU8B1wH0Af8B5wH4Af0B/wEtAZQB2gH/CAABzAGX
+ AWUH/wH8A/8B/QH/Av4B/AH/Av4B/AH/Av4B+wH/Av0B+gH/Av0B+gH/Av0B+gH/Av0B+gH/AvwB9wH/
+ AvsB9gX/AawBawFKAf8MAANIAYUDxQH/A8EB/wPFAf8DxwH/A6oB/wOnAf8DwQH/A74B/wO1Af8DqgH/
+ A0gBhQwAAzIBUAGKAUoBOgH/AfwByAGrAv8B0QGYAf8B/gHHAWMB/wH+Ab8BXgH/Af4BuQFaAf8B/gGx
+ AVQB/wH+AagBTwH/Af0BoAFKAv8BtwFwAf8B/gGpAYAB/wGIAUYBOAH/AjoBOQFgBAABPwGVAbMB+gH+
A/8B+AH9Av8B9gH9Av8B9QH8Av8B3gHbAdEB/wGtAcoBxQH/AaYBxQHAAf8BpAHDAb0B/wGeAb0BtgH/
- AZcBugGzAf8BkgG4AbIB/wHhAcsBtwH/ASwBlAHaAf8BwwGEAUkB/wJVAVMBsAHRAZwBaAX/Av4B/AH/
+ AZcBugGzAf8BkgG4AbIB/wHhAcsBtwH/AS0BlAHaAf8BwwGEAUoB/wJVAVMBsAHRAZwBaQX/Av4B/AH/
Av4B/AH/Av4B/AH/Av0B+wH/Av0B+wH/Av0B+gH/Av0B+AH/AvsB+QH/AfsB+gH3Af8B+wH6AfYB/wH7
- AfgB9AX/AbABbwFNAf8EAANcAc0DYAHjA2wB7gPPAf8DxgH/A8wB/wNbAcYDLAFEAywBRANbAcYDwQH/
- A7wB/wO5Af8DYQHuA1kB4wNaAc0HAAEBAjoBOQFgAcQBQQEUAf8B9gHkAdYC/wHkAaQC/wHUAWcC/wHJ
- AV4C/wHAAVgC/wG2AVQC/wHBAYAB/wH2AdcBxgH/AcUBPgEUAf8DPQFpAwMBBAQAAT4BmAGvAfoB6AH2
- AfsB/wF1AcUB6gH/AVIBrgHjAf8BSAGoAeEB/wFYAa0B3wH/Ae0B9gH3Af8B7QH1AfYB/wHnAe8B8wH/
- AeUB7AHuAf8B5QHrAe0B/wHlAesB7QH/AfgB8wHvAf8BLAGUAdoB/wHwAeIB2AH/AbgBigFQAf0B1AGe
- AWoF/wL+AfwB/wL9AfsB/wL9AfwB/wL9AfsB/wL9AfkB/wL8AfgB/wH7AfkB9wH/AfsB+QH1Af8B+wH4
- AfQB/wH7AfcB8gH/AfsB9QHyBf8BsgFxAU8B/wQAA7QB/QPiAf8D0gH/A8YB/wPNAf8DsQH/AywBRAgA
- AywBRAOoAf8DwgH/A7cB/wPAAf8D0gH/A1AB/QgAAwUBBwM9AWkBvAE9AREB/wH0AeIB1AH/AUMBcAGp
- Af8BQgFwAagB/wFCAXABqAH/AUMBcAGpAf8B8wHWAcMB/wG+ATsBEQH/AkABPwFvAwcBCggAAUsBfwGQ
- AfIB8QH6Af0B/wGUAd4B9QH/AZMB3AH0Af8BgQHVAfIB/wHAAakBlwH/AZEBwQHkAf8BLAGUAdoB/wEs
- AZQB2gH/ASwBlAHaAf8BLAGUAdoB/wEsAZQB2gH/ASwBlAHaAf8BLAGUAdoB/wHwAeIB2AH/AcQBhgFL
- Af8B1QGgAWsF/wL9AfwB/wL9AfsB/wL9AfoB/wL8AfkB/wH8AfsB9wH/AfsB+QH1Af8B+wH4AfQB/wH7
- AfcB8wH/AfsB9QHyAf8B+gHzAe8B/wH4AfIB7AX/AbUBcwFRAf8EAAO2Af0D6QH/A9YB/wPJAf8DzgH/
- A6UB/wMsAUQIAAMsAUQDrAH/A8QB/wO6Af8DxgH/A90B/wNWAf0MAAMEAQUDUQGiASkBYgGnAf8BnAHM
- AfgB/wGvAdQB9wH/Aa8B1AH3Af8BpQHPAfYB/wEpAWkBrgH/AVUCUwGtAwcBCQwAAU4BeQGIAfAB9wH8
+ AfgB9AX/AbABcAFOAf8EAANcAc0DYgHjA24B7gPPAf8DxgH/A8wB/wNbAcYDLAFEAywBRANbAcYDwQH/
+ A7wB/wO5Af8DYQHuA1kB4wNaAc0HAAEBAjoBOQFgAcQBQgEVAf8B9gHkAdYC/wHkAaQC/wHUAWgC/wHJ
+ AV8C/wHAAVkC/wG2AVUC/wHBAYAB/wH2AdcBxgH/AcUBPwEVAf8DPQFpAwMBBAQAAT0BmgGzAfoB6AH2
+ AfsB/wF2AcUB6gH/AVMBrgHjAf8BSQGoAeEB/wFZAa0B3wH/Ae0B9gH3Af8B7QH1AfYB/wHnAe8B8wH/
+ AeUB7AHuAf8B5QHrAe0B/wHlAesB7QH/AfgB8wHvAf8BLQGUAdoB/wHwAeIB2AH/AbkBigFRAf0B1AGe
+ AWsF/wL+AfwB/wL9AfsB/wL9AfwB/wL9AfsB/wL9AfkB/wL8AfgB/wH7AfkB9wH/AfsB+QH1Af8B+wH4
+ AfQB/wH7AfcB8gH/AfsB9QHyBf8BsgFyAVAB/wQAA7UB/QPiAf8D0gH/A8YB/wPNAf8DsQH/AywBRAgA
+ AywBRAOoAf8DwgH/A7cB/wPAAf8D0gH/A1EB/QgAAwUBBwM9AWkBvAE+ARIB/wH0AeIB1AH/AUQBcQGp
+ Af8BQwFxAagB/wFDAXEBqAH/AUQBcQGpAf8B8wHWAcMB/wG+ATwBEgH/AkABPwFvAwcBCggAAUoBgwGW
+ AfIB8QH6Af0B/wGUAd4B9QH/AZMB3AH0Af8BgQHVAfIB/wHAAakBlwH/AZEBwQHkAf8BLQGUAdoB/wEt
+ AZQB2gH/AS0BlAHaAf8BLQGUAdoB/wEtAZQB2gH/AS0BlAHaAf8BLQGUAdoB/wHwAeIB2AH/AcQBhgFM
+ Af8B1QGgAWwF/wL9AfwB/wL9AfsB/wL9AfoB/wL8AfkB/wH8AfsB9wH/AfsB+QH1Af8B+wH4AfQB/wH7
+ AfcB8wH/AfsB9QHyAf8B+gHzAe8B/wH4AfIB7AX/AbUBdAFSAf8EAAO3Af0D6QH/A9YB/wPJAf8DzgH/
+ A6UB/wMsAUQIAAMsAUQDrAH/A8QB/wO6Af8DxgH/A90B/wNYAf0MAAMEAQUDUQGiASoBYwGnAf8BnAHM
+ AfgB/wGvAdQB9wH/Aa8B1AH3Af8BpQHPAfYB/wEqAWoBrgH/AVUCUwGtAwcBCQwAAUwBfAGNAfAB9wH8
Af4B/wGOAeQB+AH/AZEB3gH1Af8BnwHgAfUB/wHjAbEBjAH/AfoB9gHxAf8B6gHJAa4F/wHoAccBrBH/
- AfEB5QHbAf8BxgGGAUwB/wHYAaIBbgX/Av0B+gH/AvwB+gH/AfwB+wH5Af8B+wH6AfYB/wH7AfgB9QH/
- AfsB9wH0Af8B+wH2AfEB/wH4AfQB7gH/AfcB8gHrAf8B9wHwAeoB/wH2AewB6AX/AbcBgQFTAf8EAANc
- Ac0DZgHjA3YB7gPYAf8DzQH/A7wB/wNbAcYDLAFEAywBRANbAcYDwwH/A8IB/wPNAf8DZwHuA18B4wNc
+ AfEB5QHbAf8BxgGGAU0B/wHYAaIBbwX/Av0B+gH/AvwB+gH/AfwB+wH5Af8B+wH6AfYB/wH7AfgB9QH/
+ AfsB9wH0Af8B+wH2AfEB/wH4AfQB7gH/AfcB8gHrAf8B9wHwAeoB/wH2AewB6AX/AbcBgQFUAf8EAANc
+ Ac0DaAHjA3kB7gPYAf8DzQH/A7wB/wNbAcYDLAFEAywBRANbAcYDwwH/A8IB/wPNAf8DaQHuA2AB4wNc
Ac0QAAFZAlsBxAGmAcoB7gH/AasBzAHqAf8BpwHQAfYB/wGoAdAB9gH/AasBzAHqAf8BpwHNAe4B/wFZ
- AlwBzBAAAT4BlQGqAfgB/QL+Af8B/gP/Av4C/wH9Af4C/wHlAbQBjwH/AfoB9gHyAf8B6QHGAaoB/wHp
- AcYBrAH/AegBxwGsAf8B6AHHAawB/wHpAckBsAH/AegByAGwAf8B6AHMAbUB/wHyAecB3gH/AcgBigFQ
- Af8B2QGjAW4F/wH8AfsB+QH/AfwB+wH4Af8B+wH5AfcB/wH7AfcB9AH/AfoB9wHyAf8B+QH1AfAB/wH3
- AfMB7QH/AfYB7wHqAf8B9QHrAecB/wHzAeoB5AH/AfIB5wHeBf8BugGFAVUB/wwAA0gBhQPUAf8DzAH/
- A8kB/wO6Af8DnAH/A6EB/wPCAf8DxgH/A8EB/wO3Af8DSAGFGAABUQFdAWsB7QHZAegB9wH/AZcBxQHx
- Af8BjgG7AeUB/wF0AakB0QH/AYkBtQHfAf8BzQHfAe4B/wFMAWQBdwHxAwQBBgwAAVsBXgFgAdABUAGi
- AbYB+gFRAaMBtwH6AVEBowG3AfoBUQGjAbcB+gHnAbcBlAH/AfsB9wH0Af8B6QHDAaYF/wHoAccBrBH/
- AfcB8QHrAf8BywGPAVYB/wHbAaQBbzX/Ab0BhwFYAf8IAANFAX0DrwH+A9wB/wPUAf8D2QH/A9sB/wPW
- Af8D1AH/A9kB/wPSAf8DywH/A8gB/wN5Af4DRQF9FAABAQEzAYcB/wFxAZcBuAH/AYoBtwHkAf8BZgGc
- AcgB/wEKATUBYwH/AQ4BOQFnAf8BFwE6AWAB/wEjAUYBUgH6AwUBByAAAekBugGYAf8B+wH3AfQB/wHp
+ AlwBzBAAAT4BlwGvAfgB/QL+Af8B/gP/Av4C/wH9Af4C/wHlAbQBjwH/AfoB9gHyAf8B6QHGAaoB/wHp
+ AcYBrAH/AegBxwGsAf8B6AHHAawB/wHpAckBsAH/AegByAGwAf8B6AHMAbUB/wHyAecB3gH/AcgBigFR
+ Af8B2QGjAW8F/wH8AfsB+QH/AfwB+wH4Af8B+wH5AfcB/wH7AfcB9AH/AfoB9wHyAf8B+QH1AfAB/wH3
+ AfMB7QH/AfYB7wHqAf8B9QHrAecB/wHzAeoB5AH/AfIB5wHeBf8BugGFAVYB/wwAA0gBhQPUAf8DzAH/
+ A8kB/wO6Af8DnAH/A6EB/wPCAf8DxgH/A8EB/wO3Af8DSAGFGAABUAFdAW4B7QHZAegB9wH/AZcBxQHx
+ Af8BjgG7AeUB/wF1AakB0QH/AYkBtQHfAf8BzQHfAe4B/wFJAWQBewHxAwQBBgwAAVsBYAFiAdABUQGk
+ AbsB+gFSAaUBvAH6AVIBpQG8AfoBUgGlAbwB+gHnAbcBlAH/AfsB9wH0Af8B6QHDAaYF/wHoAccBrBH/
+ AfcB8QHrAf8BywGPAVcB/wHbAaQBcDX/Ab0BhwFZAf8IAANFAX0DsQH+A9wB/wPUAf8D2QH/A9sB/wPW
+ Af8D1AH/A9kB/wPSAf8DywH/A8gB/wN5Af4DRQF9FAABAgE0AYcB/wFyAZcBuAH/AYoBtwHkAf8BZwGc
+ AcgB/wELATYBZAH/AQ8BOgFoAf8BGAE7AWEB/wEiAUUBUwH6AwUBByAAAekBugGYAf8B+wH3AfQB/wHp
AcMBpgH/AekBwwGmAf8B6QHDAaYB/wHpAcMBpgH/AekBwwGmAf8B6QHDAaYB/wHpAcMBpgH/AfsB9wH0
- Af8BzgGTAVsB/wHcAacBcAH/AdwBpwFwAf8B3AGnAXAB/wHcAacBcAH/AdwBpwFwAf8B3AGnAXAB/wHc
- AacBcAH/AdwBpwFwAf8B3AGnAXAB/wHcAacBcAH/AdwBpwFwAf8B3AGnAXAB/wHcAacBcAH/AdwBpwFw
- Af8BwAGLAVsB/wgAA0QBewPcAf8D7QH/A9sB/wOGAfQDqQH+A9YB/wPUAf8DmwH+A30B9APLAf8D5wH/
- A7cB/wNEAXsUAAEEAUABlwH/AQcBTQGfAf8BBAE/AYoB/wEEAUABhwH/AQYBQAGHAf8BCgFBAYUB/wEH
- ATYBagH/AUcBUwFgAfEkAAHrAb0BmwH/AfsB9wH0Hf8B+wH3AfQB/wHRAZcBYQH/Ab4BqAGFAf0B6AG5
+ Af8BzgGTAVwB/wHcAacBcQH/AdwBpwFxAf8B3AGnAXEB/wHcAacBcQH/AdwBpwFxAf8B3AGnAXEB/wHc
+ AacBcQH/AdwBpwFxAf8B3AGnAXEB/wHcAacBcQH/AdwBpwFxAf8B3AGnAXEB/wHcAacBcQH/AdwBpwFx
+ Af8BwAGLAVwB/wgAA0QBewPcAf8D7QH/A9sB/wOKAfQDqwH+A9YB/wPUAf8DnQH+A38B9APLAf8D5wH/
+ A7cB/wNEAXsUAAEFAUEBlwH/AQgBTgGfAf8BBQFAAYoB/wEFAUEBhwH/AQcBQQGHAf8BCwFCAYUB/wEI
+ ATcBawH/AUUBUQFgAfEkAAHrAb0BmwH/AfsB9wH0Hf8B+wH3AfQB/wHRAZcBYgH/AcABqAGFAf0B6AG5
AZIB/wHoAbkBkgH/AegBuQGSAf8B6AG5AZIB/wHoAbkBkgH/AegBuQGSAf8B6AG5AZIB/wHoAbkBkgH/
- AegBuQGSAf8B6AG5AZIB/wHoAbkBkgH/AegBuQGSAf8B6AG5AZIB/wG1AZABWgH9DAADUAGbA7kB/QNt
- AecDEgEZA20B5wPeAf8D3QH/A2sB5wMSARkDaQHnA6cB/QNQAZsYAANDAXcBEQFOAYEB/gEHAU0BmwH/
- AQcBTQGZAf8BBgFIAZMB/wEEAT8BhwH/AQ4BPgFxAf4CRgFHAYEkAAHsAb8BngH/AfsB9wH0Af8BnAHV
- AaUB/wGYAdMBoQH/AYsBywGTAf8BggHGAYkB/wF1AcMBhAH/AXEBwQGAAf8BbQG+AXMB/wH7AfcB9AH/
- AdQBmwFmAf8DPgFrAY4BfQFvAfQB3AGnAXAB/wHcAaYBbwH/AdoBpAFvAf8B2AGiAW4B/wHVAaABawH/
- AdQBngFqAf8B0gGdAWgB/wHPAZoBZwH/Ac4BmQFlAf8BywGWAWQB/wHJAZQBYQH/AYcBdwFlAfQDPgFr
- EAADHQEpAwoBDgMBAQIDbwHqA+UB/wPkAf8DaQHqAwEBAgMKAQ4DHQEpIAADRQF9AT4BUgFvAfQBBQFA
- AZAB/wEEAT0BigH/ATcBQwFpAfUDSAGEKAABhAF5AXMB6wH7AfcB9AH/AfsB9wH0Af8B+wH3AfQB/wH7
- AfcB9AH/AfsB9wH0Af8B+wH3AfQB/wH7AfcB9AH/AfsB9wH0Af8B+wH3AfQB/wGnAYsBaQH4WAADOwFj
- A1kBvwNZAb8DOwFjbAADRgF+AXABaQFmAeMB7QHAAZ8B/wHrAb4BnQH/AecBtwGTAf8B5AGyAYwB/wHi
- Aa8BiAH/AeABrAGEAf8B3QGpAYAB/wHcAaUBdAH/A10BygFCAU0BPgcAAT4DAAEoAwABQAMAASADAAEB
+ AegBuQGSAf8B6AG5AZIB/wHoAbkBkgH/AegBuQGSAf8B6AG5AZIB/wG2AZABXAH9DAADUAGbA7oB/QNv
+ AecDEgEZA28B5wPeAf8D3QH/A20B5wMSARkDawHnA6cB/QNQAZsYAANDAXcBEQFOAYMB/gEIAU4BmwH/
+ AQgBTgGZAf8BBwFJAZMB/wEFAUABhwH/AQ4BPgFxAf4CRgFHAYEkAAHsAb8BngH/AfsB9wH0Af8BnAHV
+ AaUB/wGYAdMBoQH/AYsBywGTAf8BggHGAYkB/wF2AcMBhAH/AXIBwQGAAf8BbgG+AXQB/wH7AfcB9AH/
+ AdQBmwFnAf8DPgFrAZIBgQFyAfQB3AGnAXEB/wHcAaYBcAH/AdoBpAFwAf8B2AGiAW8B/wHVAaABbAH/
+ AdQBngFrAf8B0gGdAWkB/wHPAZoBaAH/Ac4BmQFmAf8BywGWAWUB/wHJAZQBYgH/AYsBeQFlAfQDPgFr
+ EAADHQEpAwoBDgMBAQIDcgHqA+UB/wPkAf8DbAHqAwEBAgMKAQ4DHQEpIAADRQF9AT0BUgFyAfQBBgFB
+ AZAB/wEFAT4BigH/ATQBQwFqAfUDSAGEKAABigF9AXYB6wH7AfcB9AH/AfsB9wH0Af8B+wH3AfQB/wH7
+ AfcB9AH/AfsB9wH0Af8B+wH3AfQB/wH7AfcB9AH/AfsB9wH0Af8B+wH3AfQB/wGsAY4BawH4WAADOwFj
+ A1kBvwNZAb8DOwFjbAADRgF+AXYBbQFoAeMB7QHAAZ8B/wHrAb4BnQH/AecBtwGTAf8B5AGyAYwB/wHi
+ Aa8BiAH/AeABrAGEAf8B3QGpAYAB/wHcAaUBdQH/A10BygFCAU0BPgcAAT4DAAEoAwABQAMAASADAAEB
AQABAQYAAQEWAAP/gQAC/wH8AT8C/wEAAQMC/wHgAQcBwAEDAQABAwEAAQEBwAEDAYABAQEAAQMBAAEB
AYABAQGAAQEBAAEDAQABAQGAAQEBgAEBAQABAwEAAQEBwAEDAYABAQMAAQECAAGAAQEDAAIBAYABwAED
AwACAQGAAeABBwMAAQECAAHwAQ8DAAEBAcABAwHwAQcDAAEBAYABAQHwAQcB+AIAAQEBgAEBAfABDwH4
diff --git a/1.x/trunk/ProcessHacker/Components/ServiceProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/ServiceProperties.Designer.cs
index acfc699af..8d374d3d0 100644
--- a/1.x/trunk/ProcessHacker/Components/ServiceProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ServiceProperties.Designer.cs
@@ -33,10 +33,10 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.listServices = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listServices = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnDescription = new System.Windows.Forms.ColumnHeader();
+ this.columnStatus = new System.Windows.Forms.ColumnHeader();
this.panelService = new System.Windows.Forms.Panel();
this.buttonPermissions = new System.Windows.Forms.Button();
this.textServiceDll = new System.Windows.Forms.TextBox();
@@ -70,14 +70,13 @@
//
// listServices
//
- this.listServices.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listServices.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listServices.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnName,
this.columnDescription,
this.columnStatus});
- this.listServices.DoubleClickChecks = true;
this.listServices.FullRowSelect = true;
this.listServices.HideSelection = false;
this.listServices.Location = new System.Drawing.Point(3, 3);
@@ -108,8 +107,8 @@
//
// panelService
//
- this.panelService.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.panelService.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.panelService.Controls.Add(this.buttonPermissions);
this.panelService.Controls.Add(this.textServiceDll);
this.panelService.Controls.Add(this.label8);
@@ -156,12 +155,12 @@
//
// textServiceDll
//
- this.textServiceDll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textServiceDll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textServiceDll.Location = new System.Drawing.Point(107, 222);
this.textServiceDll.Name = "textServiceDll";
this.textServiceDll.ReadOnly = true;
- this.textServiceDll.Size = new System.Drawing.Size(274, 22);
+ this.textServiceDll.Size = new System.Drawing.Size(274, 20);
this.textServiceDll.TabIndex = 23;
//
// label8
@@ -169,7 +168,7 @@
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 225);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(66, 13);
+ this.label8.Size = new System.Drawing.Size(69, 13);
this.label8.TabIndex = 22;
this.label8.Text = "Service DLL:";
//
@@ -188,11 +187,11 @@
//
// textPassword
//
- this.textPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textPassword.Location = new System.Drawing.Point(107, 196);
this.textPassword.Name = "textPassword";
- this.textPassword.Size = new System.Drawing.Size(251, 22);
+ this.textPassword.Size = new System.Drawing.Size(251, 20);
this.textPassword.TabIndex = 20;
this.textPassword.Text = "password";
this.textPassword.UseSystemPasswordChar = true;
@@ -203,7 +202,7 @@
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 199);
this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(59, 13);
+ this.label7.Size = new System.Drawing.Size(56, 13);
this.label7.TabIndex = 19;
this.label7.Text = "Password:";
//
@@ -233,17 +232,16 @@
//
// textDescription
//
- this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textDescription.BackColor = System.Drawing.Color.WhiteSmoke;
- this.textDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.textDescription.Location = new System.Drawing.Point(6, 21);
+ this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.textDescription.Location = new System.Drawing.Point(6, 47);
this.textDescription.Multiline = true;
this.textDescription.Name = "textDescription";
this.textDescription.ReadOnly = true;
this.textDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.textDescription.Size = new System.Drawing.Size(375, 64);
+ this.textDescription.Size = new System.Drawing.Size(375, 38);
this.textDescription.TabIndex = 17;
//
// buttonStart
@@ -272,11 +270,11 @@
//
// textLoadOrderGroup
//
- this.textLoadOrderGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textLoadOrderGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textLoadOrderGroup.Location = new System.Drawing.Point(240, 118);
this.textLoadOrderGroup.Name = "textLoadOrderGroup";
- this.textLoadOrderGroup.Size = new System.Drawing.Size(141, 22);
+ this.textLoadOrderGroup.Size = new System.Drawing.Size(141, 20);
this.textLoadOrderGroup.TabIndex = 15;
//
// comboErrorControl
@@ -311,7 +309,7 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(195, 94);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(60, 13);
+ this.label6.Size = new System.Drawing.Size(59, 13);
this.label6.TabIndex = 11;
this.label6.Text = "Start Type:";
//
@@ -320,7 +318,7 @@
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 121);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(77, 13);
+ this.label5.Size = new System.Drawing.Size(68, 13);
this.label5.TabIndex = 10;
this.label5.Text = "Error Control:";
//
@@ -329,7 +327,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 94);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(33, 13);
+ this.label4.Size = new System.Drawing.Size(34, 13);
this.label4.TabIndex = 9;
this.label4.Text = "Type:";
//
@@ -338,7 +336,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(195, 121);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(43, 13);
+ this.label3.Size = new System.Drawing.Size(39, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Group:";
//
@@ -359,17 +357,17 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 147);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(68, 13);
+ this.label2.Size = new System.Drawing.Size(64, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Binary Path:";
//
// textUserAccount
//
- this.textUserAccount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textUserAccount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textUserAccount.Location = new System.Drawing.Point(107, 170);
this.textUserAccount.Name = "textUserAccount";
- this.textUserAccount.Size = new System.Drawing.Size(274, 22);
+ this.textUserAccount.Size = new System.Drawing.Size(274, 20);
this.textUserAccount.TabIndex = 4;
//
// label1
@@ -377,34 +375,33 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 173);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(78, 13);
+ this.label1.Size = new System.Drawing.Size(75, 13);
this.label1.TabIndex = 3;
this.label1.Text = "User Account:";
//
// textServiceBinaryPath
//
- this.textServiceBinaryPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textServiceBinaryPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textServiceBinaryPath.Location = new System.Drawing.Point(107, 144);
this.textServiceBinaryPath.Name = "textServiceBinaryPath";
- this.textServiceBinaryPath.Size = new System.Drawing.Size(274, 22);
+ this.textServiceBinaryPath.Size = new System.Drawing.Size(274, 20);
this.textServiceBinaryPath.TabIndex = 2;
//
// labelServiceDisplayName
//
- this.labelServiceDisplayName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.labelServiceDisplayName.Location = new System.Drawing.Point(198, 5);
+ this.labelServiceDisplayName.AutoSize = true;
+ this.labelServiceDisplayName.Location = new System.Drawing.Point(6, 26);
this.labelServiceDisplayName.Name = "labelServiceDisplayName";
- this.labelServiceDisplayName.Size = new System.Drawing.Size(183, 13);
+ this.labelServiceDisplayName.Size = new System.Drawing.Size(111, 13);
this.labelServiceDisplayName.TabIndex = 1;
this.labelServiceDisplayName.Text = "Service Display Name";
- this.labelServiceDisplayName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// labelServiceName
//
this.labelServiceName.AutoSize = true;
this.labelServiceName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.labelServiceName.Location = new System.Drawing.Point(6, 4);
+ this.labelServiceName.Location = new System.Drawing.Point(6, 5);
this.labelServiceName.Name = "labelServiceName";
this.labelServiceName.Size = new System.Drawing.Size(86, 13);
this.labelServiceName.TabIndex = 0;
@@ -414,7 +411,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listServices);
this.Controls.Add(this.panelService);
this.Name = "ServiceProperties";
@@ -427,7 +423,7 @@
#endregion
- private ExtendedListView listServices;
+ private System.Windows.Forms.ListView listServices;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnDescription;
private System.Windows.Forms.ColumnHeader columnStatus;
diff --git a/1.x/trunk/ProcessHacker/Components/ServiceProperties.cs b/1.x/trunk/ProcessHacker/Components/ServiceProperties.cs
index bf15a7173..f24df402f 100644
--- a/1.x/trunk/ProcessHacker/Components/ServiceProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/ServiceProperties.cs
@@ -39,7 +39,7 @@ namespace ProcessHacker.Components
public partial class ServiceProperties : UserControl
{
private QueryServiceConfig _oldConfig;
- private readonly ServiceProvider _provider;
+ private ServiceProvider _provider;
public event EventHandler NeedsClose;
@@ -52,6 +52,7 @@ namespace ProcessHacker.Components
InitializeComponent();
listServices.ListViewItemSorter = new SortedListViewComparer(listServices);
+ listServices.SetTheme("explorer");
ColumnSettings.LoadSettings(Settings.Instance.ServiceMiniListColumns, listServices);
PID = -1;
@@ -73,12 +74,12 @@ namespace ProcessHacker.Components
_provider.Dictionary[s].Status.ServiceStatusProcess.CurrentState.ToString() })).Name = s;
}
- _provider.DictionaryModified += this._provider_DictionaryModified;
- _provider.DictionaryRemoved += this._provider_DictionaryRemoved;
+ _provider.DictionaryModified += new ServiceProvider.ProviderDictionaryModified(_provider_DictionaryModified);
+ _provider.DictionaryRemoved += new ServiceProvider.ProviderDictionaryRemoved(_provider_DictionaryRemoved);
- this.comboErrorControl.Fill(typeof(ServiceErrorControl));
- this.comboStartType.Fill(typeof(ServiceStartType));
- this.comboType.Fill(typeof(ProcessHacker.Native.Api.ServiceType));
+ Utils.Fill(comboErrorControl, typeof(ServiceErrorControl));
+ Utils.Fill(comboStartType, typeof(ServiceStartType));
+ Utils.Fill(comboType, typeof(ProcessHacker.Native.Api.ServiceType));
comboType.Items.Add("Win32OwnProcess, InteractiveProcess");
comboType.Items.Add("Win32ShareProcess, InteractiveProcess");
@@ -94,7 +95,7 @@ namespace ProcessHacker.Components
public int PID { get; set; }
- public ExtendedListView List
+ public ListView List
{
get { return listServices; }
}
@@ -126,11 +127,11 @@ namespace ProcessHacker.Components
private void _provider_DictionaryRemoved(ServiceItem item)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- // remove the item from the list if it's there
- if (listServices.Items.ContainsKey(item.Status.ServiceName))
- listServices.Items[item.Status.ServiceName].Remove();
- }));
+ {
+ // remove the item from the list if it's there
+ if (listServices.Items.ContainsKey(item.Status.ServiceName))
+ listServices.Items[item.Status.ServiceName].Remove();
+ }));
}
private void _provider_DictionaryModified(ServiceItem oldItem, ServiceItem newItem)
@@ -139,46 +140,40 @@ namespace ProcessHacker.Components
return;
this.BeginInvoke(new MethodInvoker(() =>
- {
- // update the state of the service
- if (listServices.Items.ContainsKey(newItem.Status.ServiceName))
- listServices.Items[newItem.Status.ServiceName].SubItems[2].Text =
- newItem.Status.ServiceStatusProcess.CurrentState.ToString();
-
- // update the start and stop buttons if we have a service selected
- if (listServices.SelectedItems.Count == 1)
{
- if (listServices.SelectedItems[0].Name == newItem.Status.ServiceName)
- {
- buttonStart.Enabled = false;
- buttonStop.Enabled = false;
+ // update the state of the service
+ if (listServices.Items.ContainsKey(newItem.Status.ServiceName))
+ listServices.Items[newItem.Status.ServiceName].SubItems[2].Text =
+ newItem.Status.ServiceStatusProcess.CurrentState.ToString();
- switch (newItem.Status.ServiceStatusProcess.CurrentState)
+ // update the start and stop buttons if we have a service selected
+ if (listServices.SelectedItems.Count == 1)
+ {
+ if (listServices.SelectedItems[0].Name == newItem.Status.ServiceName)
{
- case ServiceState.Running:
- this.buttonStop.Enabled = true;
- break;
- case ServiceState.Stopped:
- this.buttonStart.Enabled = true;
- break;
+ buttonStart.Enabled = false;
+ buttonStop.Enabled = false;
+
+ if (newItem.Status.ServiceStatusProcess.CurrentState == ServiceState.Running)
+ buttonStop.Enabled = true;
+ else if (newItem.Status.ServiceStatusProcess.CurrentState == ServiceState.Stopped)
+ buttonStart.Enabled = true;
}
}
- }
- // if the service was just started in this process, add it to the list
- if (newItem.Status.ServiceStatusProcess.ProcessID == this.PID && oldItem.Status.ServiceStatusProcess.ProcessID == 0)
- {
- if (!listServices.Items.ContainsKey(newItem.Status.ServiceName))
+ // if the service was just started in this process, add it to the list
+ if (newItem.Status.ServiceStatusProcess.ProcessID == this.PID && oldItem.Status.ServiceStatusProcess.ProcessID == 0)
{
- listServices.Items.Add(new ListViewItem(new string[]
+ if (!listServices.Items.ContainsKey(newItem.Status.ServiceName))
{
- newItem.Status.ServiceName,
- newItem.Status.DisplayName,
- newItem.Status.ServiceStatusProcess.CurrentState.ToString()
- })).Name = newItem.Status.ServiceName;
+ listServices.Items.Add(new ListViewItem(new string[] {
+ newItem.Status.ServiceName,
+ newItem.Status.DisplayName,
+ newItem.Status.ServiceStatusProcess.CurrentState.ToString()
+ })).Name = newItem.Status.ServiceName;
+ }
}
- }
- }));
+ }));
}
private void listServices_SelectedIndexChanged(object sender, EventArgs e)
@@ -270,10 +265,10 @@ namespace ProcessHacker.Components
}
catch
{
- textDescription.Text = string.Empty;
+ textDescription.Text = "";
}
- textServiceDll.Text = string.Empty;
+ textServiceDll.Text = "";
if (item.Config.ServiceType == ProcessHacker.Native.Api.ServiceType.Win32ShareProcess)
{
@@ -315,17 +310,17 @@ namespace ProcessHacker.Components
private void ClearControls()
{
- labelServiceName.Text = string.Empty;
- labelServiceDisplayName.Text = string.Empty;
- comboType.Text = string.Empty;
- comboStartType.Text = string.Empty;
- comboErrorControl.Text = string.Empty;
- textServiceBinaryPath.Text = string.Empty;
- textUserAccount.Text = string.Empty;
+ labelServiceName.Text = "";
+ labelServiceDisplayName.Text = "";
+ comboType.Text = "";
+ comboStartType.Text = "";
+ comboErrorControl.Text = "";
+ textServiceBinaryPath.Text = "";
+ textUserAccount.Text = "";
textPassword.Text = "password";
- textLoadOrderGroup.Text = string.Empty;
- textDescription.Text = string.Empty;
- textServiceDll.Text = string.Empty;
+ textLoadOrderGroup.Text = "";
+ textDescription.Text = "";
+ textServiceDll.Text = "";
}
private void buttonApply_Click(object sender, EventArgs e)
@@ -430,7 +425,8 @@ namespace ProcessHacker.Components
{
try
{
- using (ServiceController controller = new ServiceController(listServices.SelectedItems[0].Name))
+ using (ServiceController controller = new ServiceController(
+ listServices.SelectedItems[0].Name))
{
List dependents = new List();
@@ -452,7 +448,8 @@ namespace ProcessHacker.Components
{
try
{
- using (ServiceController controller = new ServiceController(listServices.SelectedItems[0].Name))
+ using (ServiceController controller = new ServiceController(
+ listServices.SelectedItems[0].Name))
{
List dependencies = new List();
@@ -482,7 +479,7 @@ namespace ProcessHacker.Components
SecurityEditor.EditSecurity(
this,
SecurityEditor.GetSecurableWrapper(
- access => new ServiceHandle(listServices.SelectedItems[0].Name, (ServiceAccess)access)
+ (access) => new ServiceHandle(listServices.SelectedItems[0].Name, (ServiceAccess)access)
),
listServices.SelectedItems[0].Name,
NativeTypeFactory.GetAccessEntries(NativeTypeFactory.ObjectType.Service)
diff --git a/1.x/trunk/ProcessHacker/Components/ServiceProperties.resx b/1.x/trunk/ProcessHacker/Components/ServiceProperties.resx
index 026c576b4..a5979aadf 100644
--- a/1.x/trunk/ProcessHacker/Components/ServiceProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/ServiceProperties.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/SplitButton.cs b/1.x/trunk/ProcessHacker/Components/SplitButton.cs
index 46c331906..49f3c78ca 100644
--- a/1.x/trunk/ProcessHacker/Components/SplitButton.cs
+++ b/1.x/trunk/ProcessHacker/Components/SplitButton.cs
@@ -20,18 +20,22 @@ using System.Windows.Forms.VisualStyles;
namespace wyDay.Controls
{
- public sealed class SplitButton : Button
+ public class SplitButton : Button
{
private PushButtonState _state;
private const int SplitSectionWidth = 18;
- private static readonly int BorderSize = SystemInformation.Border3DSize.Width * 2;
- private bool skipNextOpen;
- private Rectangle dropDownRectangle;
- private bool showSplit;
- private bool isSplitMenuVisible;
- private ContextMenuStrip m_SplitMenuStrip;
+ private static int BorderSize = SystemInformation.Border3DSize.Width * 2;
+ private bool skipNextOpen = false;
+ private Rectangle dropDownRectangle = new Rectangle();
+ private bool showSplit = false;
+
+ private bool isSplitMenuVisible = false;
+
+
+ private ContextMenuStrip m_SplitMenuStrip = null;
+ private ContextMenu m_SplitMenu = null;
TextFormatFlags textFormatFlags = TextFormatFlags.Default;
@@ -55,6 +59,31 @@ namespace wyDay.Controls
}
}
+ [DefaultValue(null)]
+ public ContextMenu SplitMenu
+ {
+ get { return m_SplitMenu; }
+ set
+ {
+ //remove the event handlers for the old SplitMenu
+ if (m_SplitMenu != null)
+ {
+ m_SplitMenu.Popup -= new EventHandler(SplitMenu_Popup);
+ }
+
+ //add the event handlers for the new SplitMenu
+ if (value != null)
+ {
+ ShowSplit = true;
+ value.Popup += new EventHandler(SplitMenu_Popup);
+ }
+ else
+ ShowSplit = false;
+
+ m_SplitMenu = value;
+ }
+ }
+
[DefaultValue(null)]
public ContextMenuStrip SplitMenuStrip
{
@@ -67,16 +96,16 @@ namespace wyDay.Controls
//remove the event handlers for the old SplitMenuStrip
if (m_SplitMenuStrip != null)
{
- m_SplitMenuStrip.Closing -= this.SplitMenuStrip_Closing;
- m_SplitMenuStrip.Opening -= this.SplitMenuStrip_Opening;
+ m_SplitMenuStrip.Closing -= new ToolStripDropDownClosingEventHandler(SplitMenuStrip_Closing);
+ m_SplitMenuStrip.Opening -= new CancelEventHandler(SplitMenuStrip_Opening);
}
//add the event handlers for the new SplitMenuStrip
if (value != null)
{
ShowSplit = true;
- value.Closing += this.SplitMenuStrip_Closing;
- value.Opening += this.SplitMenuStrip_Opening;
+ value.Closing += new ToolStripDropDownClosingEventHandler(SplitMenuStrip_Closing);
+ value.Opening += new CancelEventHandler(SplitMenuStrip_Opening);
}
else
ShowSplit = false;
@@ -262,7 +291,7 @@ namespace wyDay.Controls
}
//handle ContextMenu re-clicking the drop-down region to close the menu
- if (m_SplitMenuStrip != null && e.Button == MouseButtons.Left && !isMouseEntered)
+ if (m_SplitMenu != null && e.Button == MouseButtons.Left && !isMouseEntered)
skipNextOpen = true;
if (dropDownRectangle.Contains(e.Location) && !isSplitMenuVisible && e.Button == MouseButtons.Left)
@@ -288,7 +317,7 @@ namespace wyDay.Controls
{
ShowContextMenuStrip();
}
- else if (m_SplitMenuStrip == null && m_SplitMenuStrip == null || !isSplitMenuVisible)
+ else if (m_SplitMenuStrip == null && m_SplitMenu == null || !isSplitMenuVisible)
{
SetButtonDrawState();
@@ -429,8 +458,7 @@ namespace wyDay.Controls
{
if (AutoSize)
return CalculateButtonAutoSize();
-
- if (!string.IsNullOrEmpty(this.Text) && TextRenderer.MeasureText(this.Text, this.Font).Width + SplitSectionWidth > preferredSize.Width)
+ else if (!string.IsNullOrEmpty(Text) && TextRenderer.MeasureText(Text, Font).Width + SplitSectionWidth > preferredSize.Width)
return preferredSize + new Size(SplitSectionWidth + BorderSize * 2, 0);
}
@@ -607,9 +635,9 @@ namespace wyDay.Controls
else if (h_image == HorizontalAlignment.Right && h_text == HorizontalAlignment.Right)
offset = excess_width;
else if (h_image == HorizontalAlignment.Center && (h_text == HorizontalAlignment.Left || h_text == HorizontalAlignment.Center))
- offset += excess_width / 3;
+ offset += (int)(excess_width / 3);
else
- offset += 2 * (excess_width / 3);
+ offset += (int)(2 * (excess_width / 3));
if (textFirst)
{
@@ -658,9 +686,9 @@ namespace wyDay.Controls
else if (v_image == VerticalAlignment.Bottom && v_text == VerticalAlignment.Bottom)
offset = excess_height;
else if (v_image == VerticalAlignment.Center && (v_text == VerticalAlignment.Top || v_text == VerticalAlignment.Center))
- offset += excess_height / 3;
+ offset += (int)(excess_height / 3);
else
- offset += 2 * (excess_height / 3);
+ offset += (int)(2 * (excess_height / 3));
if (textFirst)
{
@@ -758,7 +786,11 @@ namespace wyDay.Controls
State = PushButtonState.Pressed;
- if (m_SplitMenuStrip != null)
+ if (m_SplitMenu != null)
+ {
+ m_SplitMenu.Show(this, new Point(0, Height));
+ }
+ else if (m_SplitMenuStrip != null)
{
m_SplitMenuStrip.Show(this, new Point(0, Height), ToolStripDropDownDirection.BelowRight);
}
diff --git a/1.x/trunk/ProcessHacker/Components/StructViewer.Designer.cs b/1.x/trunk/ProcessHacker/Components/StructViewer.Designer.cs
index 2076588ad..f9c95d1bc 100644
--- a/1.x/trunk/ProcessHacker/Components/StructViewer.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/StructViewer.Designer.cs
@@ -28,6 +28,7 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.treeStruct = new Aga.Controls.Tree.TreeViewAdv();
this.columnName = new Aga.Controls.Tree.TreeColumn();
this.columnValue = new Aga.Controls.Tree.TreeColumn();
@@ -38,6 +39,8 @@
this.decMenuItem = new System.Windows.Forms.MenuItem();
this.hexMenuItem = new System.Windows.Forms.MenuItem();
this.copyMenuItem = new System.Windows.Forms.MenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// treeStruct
@@ -47,6 +50,9 @@
this.treeStruct.Columns.Add(this.columnValue);
this.treeStruct.DefaultToolTipProvider = null;
this.treeStruct.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.treeStruct.DragDropMarkColor = System.Drawing.Color.Black;
+ this.treeStruct.FullRowSelect = true;
+ this.treeStruct.GridLineStyle = Aga.Controls.Tree.GridLineStyle.Horizontal;
this.treeStruct.LineColor = System.Drawing.SystemColors.ControlDark;
this.treeStruct.Location = new System.Drawing.Point(0, 0);
this.treeStruct.Model = null;
@@ -58,6 +64,7 @@
this.treeStruct.ShowNodeToolTips = true;
this.treeStruct.Size = new System.Drawing.Size(362, 331);
this.treeStruct.TabIndex = 0;
+ this.treeStruct.UseColumns = true;
//
// columnName
//
@@ -120,17 +127,22 @@
//
// copyMenuItem
//
+ this.vistaMenu.SetImage(this.copyMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyMenuItem.Index = 1;
this.copyMenuItem.Text = "&Copy";
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ //
// StructViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.treeStruct);
this.Name = "StructViewer";
this.Size = new System.Drawing.Size(362, 331);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
@@ -147,5 +159,6 @@
private System.Windows.Forms.MenuItem decMenuItem;
private System.Windows.Forms.MenuItem hexMenuItem;
private System.Windows.Forms.MenuItem copyMenuItem;
+ private wyDay.Controls.VistaMenu vistaMenu;
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/StructViewer.cs b/1.x/trunk/ProcessHacker/Components/StructViewer.cs
index b83c7d689..06a7ccc54 100644
--- a/1.x/trunk/ProcessHacker/Components/StructViewer.cs
+++ b/1.x/trunk/ProcessHacker/Components/StructViewer.cs
@@ -32,13 +32,17 @@ namespace ProcessHacker.Components
{
public partial class StructViewer : UserControl
{
- private readonly StructModel _model = new StructModel();
- readonly StructDef _struct;
+ private StructModel _model = new StructModel();
+ int _pid;
+ IntPtr _address;
+ StructDef _struct;
public StructViewer(int pid, IntPtr address, StructDef struc)
{
InitializeComponent();
+ _pid = pid;
+ _address = address;
_struct = struc;
treeStruct.Model = _model;
treeStruct.ContextMenu = menuStruct;
@@ -54,12 +58,8 @@ namespace ProcessHacker.Components
_struct.Structs = Program.Structs;
values = _struct.Read();
- _model.Nodes.Add(new StructNode(new FieldValue
- {
- Name = "Struct",
- FieldType = FieldType.StringUTF16,
- Value = string.Empty
- }));
+ _model.Nodes.Add(new StructNode(new FieldValue()
+ { Name = "Struct", FieldType = FieldType.StringUTF16, Value = "" }));
foreach (FieldValue val in values)
this.AddNode(_model.Nodes[0], val);
@@ -158,7 +158,8 @@ namespace ProcessHacker.Components
if (_value.StructName != null)
return _value.StructName + "[" + memberCount.ToString() + "]";
- return type.ToString() + "[" + memberCount.ToString() + "]";
+ else
+ return type.ToString() + "[" + memberCount.ToString() + "]";
}
if (_value.StructName != null)
diff --git a/1.x/trunk/ProcessHacker/Components/StructViewer.resx b/1.x/trunk/ProcessHacker/Components/StructViewer.resx
index 50dae8683..62e3a554d 100644
--- a/1.x/trunk/ProcessHacker/Components/StructViewer.resx
+++ b/1.x/trunk/ProcessHacker/Components/StructViewer.resx
@@ -112,12 +112,18 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
+
+ 132, 17
+
+
+ 132, 17
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TargetWindowButton.cs b/1.x/trunk/ProcessHacker/Components/TargetWindowButton.cs
index 2bc1a00a5..1c5723060 100644
--- a/1.x/trunk/ProcessHacker/Components/TargetWindowButton.cs
+++ b/1.x/trunk/ProcessHacker/Components/TargetWindowButton.cs
@@ -28,14 +28,14 @@ namespace ProcessHacker.Components
{
public delegate void TargetWindowFoundDelegate(int pid, int tid);
- public sealed class TargetWindowButton : ToolStripButton
+ public class TargetWindowButton : ToolStripButton
{
public event TargetWindowFoundDelegate TargetWindowFound;
private Control _parent;
- private readonly Control _dummy;
+ private Control _dummy;
private IntPtr _currentHWnd;
- private bool _targeting;
+ private bool _targeting = false;
public TargetWindowButton()
{
@@ -93,7 +93,12 @@ namespace ProcessHacker.Components
}
}
- private void RedrawWindow(IntPtr hWnd, bool workaround = true)
+ private void RedrawWindow(IntPtr hWnd)
+ {
+ this.RedrawWindow(hWnd, true);
+ }
+
+ private void RedrawWindow(IntPtr hWnd, bool workaround)
{
if (!Win32.RedrawWindow(
hWnd,
@@ -150,10 +155,11 @@ namespace ProcessHacker.Components
if (oldHWnd != IntPtr.Zero)
this.RedrawWindow(oldHWnd);
- int pid;
+ bool isPhWindow = false;
+ int pid, tid;
- Win32.GetWindowThreadProcessId(this._currentHWnd, out pid);
- bool isPhWindow = pid == Program.CurrentProcessId;
+ tid = Win32.GetWindowThreadProcessId(_currentHWnd, out pid);
+ isPhWindow = pid == Program.CurrentProcessId;
// Draw a rectangle over the current window.
if (
@@ -174,9 +180,9 @@ namespace ProcessHacker.Components
// Redraw the window we found.
this.RedrawWindow(_currentHWnd, false);
- int pid;
+ int pid, tid;
- int tid = Win32.GetWindowThreadProcessId(this._currentHWnd, out pid);
+ tid = Win32.GetWindowThreadProcessId(_currentHWnd, out pid);
if (this.TargetWindowFound != null)
this.TargetWindowFound(pid, tid);
diff --git a/1.x/trunk/ProcessHacker/Components/TaskDialog/ActiveTaskDialog.cs b/1.x/trunk/ProcessHacker/Components/TaskDialog/ActiveTaskDialog.cs
index 87581f86e..aaa4f1007 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskDialog/ActiveTaskDialog.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskDialog/ActiveTaskDialog.cs
@@ -11,6 +11,8 @@ namespace ProcessHacker.Components
using System;
using System.Drawing;
using System.Windows.Forms;
+ using System.Runtime.InteropServices;
+ using System.Diagnostics.CodeAnalysis;
///
/// The active Task Dialog window. Provides several methods for acting on the active TaskDialog.
@@ -22,7 +24,7 @@ namespace ProcessHacker.Components
///
/// The Task Dialog's window handle.
///
- private readonly IntPtr handle;
+ private IntPtr handle;
///
/// Creates a ActiveTaskDialog.
@@ -125,7 +127,7 @@ namespace ProcessHacker.Components
// TDM_SET_PROGRESS_BAR_RANGE = WM_USER+105, // lParam = MAKELPARAM(nMinRange, nMaxRange)
// #define MAKELPARAM(l, h) ((LPARAM)(DWORD)MAKELONG(l, h))
// #define MAKELONG(a, b) ((LONG)(((WORD)(((DWORD_PTR)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(b)) & 0xffff))) << 16))
- IntPtr lparam = (IntPtr)((minRange & 0xffff) | ((maxRange & 0xffff) << 16));
+ IntPtr lparam = (IntPtr)((((Int32)minRange) & 0xffff) | ((((Int32)maxRange) & 0xffff) << 16));
return UnsafeNativeMethods.SendMessage(
this.handle,
(uint)UnsafeNativeMethods.TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_RANGE,
@@ -365,7 +367,7 @@ namespace ProcessHacker.Components
this.handle,
(uint)UnsafeNativeMethods.TASKDIALOG_MESSAGES.TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE,
(IntPtr)buttonId,
- elevationRequired ? new IntPtr(1) : IntPtr.Zero);
+ (IntPtr)(elevationRequired ? new IntPtr(1) : IntPtr.Zero));
}
///
diff --git a/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialog.cs b/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialog.cs
index 8ecc00828..f71864eae 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialog.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialog.cs
@@ -13,7 +13,6 @@ namespace ProcessHacker.Components
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
- using ProcessHacker.Native;
///
/// The signature of the callback that recieves notificaitons from the Task Dialog.
@@ -267,8 +266,6 @@ namespace ProcessHacker.Components
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
public struct TaskDialogButton
{
- public static readonly int SizeOf;
-
///
/// The ID of the button. This value is returned by TaskDialog.Show when the button is clicked.
///
@@ -309,11 +306,6 @@ namespace ProcessHacker.Components
get { return this.buttonText; }
set { this.buttonText = value; }
}
-
- static TaskDialogButton()
- {
- SizeOf = Marshal.SizeOf(typeof(TaskDialogButton));
- }
}
///
@@ -1008,12 +1000,12 @@ namespace ProcessHacker.Components
{
verificationFlagChecked = false;
radioButtonResult = 0;
- int result;
+ int result = 0;
UnsafeNativeMethods.TASKDIALOGCONFIG config = new UnsafeNativeMethods.TASKDIALOGCONFIG();
try
{
- config.cbSize = (uint)UnsafeNativeMethods.TASKDIALOGCONFIG.SizeOf;
+ config.cbSize = (uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.TASKDIALOGCONFIG));
config.hwndParent = hwndOwner;
config.dwFlags = this.flags;
config.dwCommonButtons = this.commonButtons;
@@ -1044,8 +1036,8 @@ namespace ProcessHacker.Components
if (customButtons.Length > 0)
{
// Hand marshal the buttons array.
- int elementSize = TaskDialogButton.SizeOf;
- config.pButtons = MemoryAlloc.PrivateHeap.Allocate(elementSize * customButtons.Length);
+ int elementSize = Marshal.SizeOf(typeof(TaskDialogButton));
+ config.pButtons = Marshal.AllocHGlobal(elementSize * (int)customButtons.Length);
for (int i = 0; i < customButtons.Length; i++)
{
unsafe // Unsafe because of pointer arithmatic.
@@ -1062,8 +1054,8 @@ namespace ProcessHacker.Components
if (customRadioButtons.Length > 0)
{
// Hand marshal the buttons array.
- int elementSize = TaskDialogButton.SizeOf;
- config.pRadioButtons = MemoryAlloc.PrivateHeap.Allocate(elementSize * customRadioButtons.Length);
+ int elementSize = Marshal.SizeOf(typeof(TaskDialogButton));
+ config.pRadioButtons = Marshal.AllocHGlobal(elementSize * (int)customRadioButtons.Length);
for (int i = 0; i < customRadioButtons.Length; i++)
{
unsafe // Unsafe because of pointer arithmatic.
@@ -1115,7 +1107,7 @@ namespace ProcessHacker.Components
// translate to the friendly version.
if (this.callback != null)
{
- config.pfCallback = this.PrivateCallback;
+ config.pfCallback = new UnsafeNativeMethods.TaskDialogCallback(this.PrivateCallback);
}
////config.lpCallbackData = this.callbackData; // How do you do this? Need to pin the ref?
@@ -1132,7 +1124,7 @@ namespace ProcessHacker.Components
// that are not required for the users of this class.
if (config.pButtons != IntPtr.Zero)
{
- int elementSize = TaskDialogButton.SizeOf;
+ int elementSize = Marshal.SizeOf(typeof(TaskDialogButton));
for (int i = 0; i < config.cButtons; i++)
{
unsafe
@@ -1142,12 +1134,12 @@ namespace ProcessHacker.Components
}
}
- MemoryAlloc.PrivateHeap.Free(config.pButtons);
+ Marshal.FreeHGlobal(config.pButtons);
}
if (config.pRadioButtons != IntPtr.Zero)
{
- int elementSize = TaskDialogButton.SizeOf;
+ int elementSize = Marshal.SizeOf(typeof(TaskDialogButton));
for (int i = 0; i < config.cRadioButtons; i++)
{
unsafe
@@ -1157,7 +1149,7 @@ namespace ProcessHacker.Components
}
}
- MemoryAlloc.PrivateHeap.Free(config.pRadioButtons);
+ Marshal.FreeHGlobal(config.pRadioButtons);
}
}
@@ -1173,20 +1165,17 @@ namespace ProcessHacker.Components
/// Specifies additional noitification information. The contents of this parameter depends on the value of the msg parameter.
/// Specifies the application-defined value given in the call to TaskDialogIndirect.
/// A HRESULT. It's not clear in the spec what a failed result will do.
- private int PrivateCallback([In] IntPtr hwnd, [In] TaskDialogNotification msg, [In] UIntPtr wparam, [In] IntPtr lparam, [In] IntPtr refData)
+ private int PrivateCallback([In] IntPtr hwnd, [In] uint msg, [In] UIntPtr wparam, [In] IntPtr lparam, [In] IntPtr refData)
{
- TaskDialogCallback cb = this.callback;
- if (cb != null)
+ TaskDialogCallback callback = this.callback;
+ if (callback != null)
{
// Prepare arguments for the callback to the user we are insulating from Interop casting sillyness.
// Future: Consider reusing a single ActiveTaskDialog object and mark it as destroyed on the destry notification.
ActiveTaskDialog activeDialog = new ActiveTaskDialog(hwnd);
- TaskDialogNotificationArgs args = new TaskDialogNotificationArgs
- {
- Notification = msg
- };
-
+ TaskDialogNotificationArgs args = new TaskDialogNotificationArgs();
+ args.Notification = (TaskDialogNotification)msg;
switch (args.Notification)
{
case TaskDialogNotification.ButtonClicked:
@@ -1207,7 +1196,7 @@ namespace ProcessHacker.Components
break;
}
- return (cb(activeDialog, args, this.callbackData) ? 1 : 0);
+ return (callback(activeDialog, args, this.callbackData) ? 1 : 0);
}
return 0; // false;
diff --git a/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialogCommonDialog.cs b/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialogCommonDialog.cs
index a8700a423..e401e5d2b 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialogCommonDialog.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskDialog/TaskDialogCommonDialog.cs
@@ -22,7 +22,7 @@ namespace ProcessHacker.Components
///
/// The TaskDialog we will display.
///
- private readonly TaskDialog taskDialog;
+ private TaskDialog taskDialog;
///
/// The result of the dialog, either a DialogResult value for common push buttons set in the TaskDialog.CommonButtons
diff --git a/1.x/trunk/ProcessHacker/Components/TaskDialog/UnsafeNativeMethods.cs b/1.x/trunk/ProcessHacker/Components/TaskDialog/UnsafeNativeMethods.cs
index 075d50565..3f2273ede 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskDialog/UnsafeNativeMethods.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskDialog/UnsafeNativeMethods.cs
@@ -9,13 +9,14 @@
namespace ProcessHacker.Components
{
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
///
/// Class to hold native code interop declarations.
///
[System.Security.SuppressUnmanagedCodeSecurity]
- internal static class UnsafeNativeMethods
+ internal static partial class UnsafeNativeMethods
{
///
/// WM_USER taken from WinUser.h
@@ -31,7 +32,7 @@ namespace ProcessHacker.Components
/// wParam which is interpreted differently depending on the message.
/// The refrence data that was set to TaskDialog.CallbackData.
/// A HRESULT value. The return value is specific to the message being processed.
- internal delegate int TaskDialogCallback([In] IntPtr hwnd, [In] TaskDialogNotification msg, [In] UIntPtr wParam, [In] IntPtr lParam, [In] IntPtr refData);
+ internal delegate int TaskDialogCallback([In] IntPtr hwnd, [In] uint msg, [In] UIntPtr wParam, [In] IntPtr lParam, [In] IntPtr refData);
///
/// TASKDIALOG_FLAGS taken from CommCtrl.h.
@@ -312,8 +313,6 @@ namespace ProcessHacker.Components
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
internal struct TASKDIALOGCONFIG
{
- public static readonly int SizeOf;
-
///
/// Size of the structure in bytes.
///
@@ -441,12 +440,7 @@ namespace ProcessHacker.Components
/// Width of the Task Dialog's client area in DLU's.
/// If 0, Task Dialog will calculate the ideal width.
///
- public uint cxWidth;
-
- static TASKDIALOGCONFIG()
- {
- SizeOf = Marshal.SizeOf(typeof(TASKDIALOGCONFIG));
- }
+ public uint cxWidth;
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/COMTypes.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/COMTypes.cs
index d0c262547..3d938138b 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/COMTypes.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/COMTypes.cs
@@ -24,38 +24,39 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
+using System.Runtime.CompilerServices;
using ProcessHacker.Native.Api;
namespace TaskbarLib.Interop
{
#region "Interface Classes"
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("86C14003-4D6B-4EF3-A7B4-0506663B2E68")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
internal class CApplicationDestinations { }
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("86BEC222-30F2-47E0-9F25-60D11CD75C28")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
internal class CApplicationDocumentLists { }
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("56FDF344-FD6D-11d0-958A-006097C9A090")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
internal class CTaskbarList { }
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("00021401-0000-0000-C000-000000000046")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
internal class CShellLink { }
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("77F10CF0-3DB5-4966-B520-B7C54FD35ED6")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
internal class CDestinationList { }
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("2D3468C1-36A7-43B6-AC24-D3F02FD9607A")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
internal class CEnumerableObjectCollection { }
@@ -64,7 +65,7 @@ namespace TaskbarLib.Interop
#region "Interfaces"
- [ComImportAttribute]
+ [ComImportAttribute()]
[GuidAttribute("92CA9DCD-5622-4BBA-A805-5E9F541BD8C9")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IObjectArray
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/Interop.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/Interop.cs
index 87633043c..1724f50d0 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/Interop.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/Interop/Interop.cs
@@ -24,6 +24,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
+using System.Text;
using ProcessHacker.Native.Api;
namespace TaskbarLib.Interop
@@ -139,16 +140,16 @@ namespace TaskbarLib.Interop
}
[StructLayout(LayoutKind.Explicit)]
- public struct PropVariant : IDisposable
+ internal struct PropVariant : IDisposable
{
[FieldOffset(0)]
private ushort vt;
[FieldOffset(8)]
private IntPtr pointerValue;
[FieldOffset(8)]
- public byte byteValue;
+ private byte byteValue;
[FieldOffset(8)]
- public long longValue;
+ private long longValue;
[FieldOffset(8)]
private short boolValue;
[MarshalAs(UnmanagedType.Struct)]
@@ -245,10 +246,10 @@ namespace TaskbarLib.Interop
public static extern HResult SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID);
[DllImport("shell32.dll")]
- public static extern HResult GetCurrentProcessExplicitAppUserModelID([Out, MarshalAs(UnmanagedType.LPWStr)] out string AppID);
+ public static extern HResult GetCurrentProcessExplicitAppUserModelID([Out(), MarshalAs(UnmanagedType.LPWStr)] out string AppID);
[DllImport("shell32.dll")]
- public static extern HResult SHGetPropertyStoreForWindow(IntPtr hwnd, ref Guid iid /*IID_IPropertyStore*/, [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyStore propertyStore);
+ public static extern HResult SHGetPropertyStoreForWindow(IntPtr hwnd, ref Guid iid /*IID_IPropertyStore*/, [Out(), MarshalAs(UnmanagedType.Interface)] out IPropertyStore propertyStore);
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern HResult SHCreateItemFromParsingName(string path, /* The following parameter is not used - binding context. */ IntPtr pbc, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IShellItem shellItem);
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListImpl.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListImpl.cs
index 4fe093d2f..dfde269d8 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListImpl.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListImpl.cs
@@ -25,6 +25,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using TaskbarLib.Interop;
+using System.Runtime.InteropServices;
using ProcessHacker.Native.Api;
namespace TaskbarLib
@@ -36,7 +37,7 @@ namespace TaskbarLib
{
//TODO: This is highly inefficient, but we want to maintain insertion order when adding the categories
//because the bottom categories are first to be truncated if screen estate is low.
- private readonly SortedDictionary> _categorizedDestinations =
+ private SortedDictionary> _categorizedDestinations =
new SortedDictionary>();
public void AddDestination(IJumpListDestination destination)
@@ -96,7 +97,8 @@ namespace TaskbarLib
select _categorizedDestinations[d].First().Category);
}
}
- public IEnumerable GetDestinationsByCategory(string category)
+ public IEnumerable GetDestinationsByCategory(
+ string category)
{
return
(from k in _categorizedDestinations.Keys
@@ -116,7 +118,7 @@ namespace TaskbarLib
///
internal sealed class JumpListTasks
{
- private readonly List _tasks = new List();
+ private List _tasks = new List();
public void AddTask(IJumpListTask task)
{
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListManager.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListManager.cs
index 5b863e49a..dd058596b 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListManager.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/JumpLists/JumpListManager.cs
@@ -27,8 +27,10 @@ using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
+using System.Threading;
using Microsoft.Win32;
using TaskbarLib.Interop;
+using System.Runtime.CompilerServices;
using ProcessHacker.Native.Api;
namespace TaskbarLib
@@ -51,13 +53,13 @@ namespace TaskbarLib
{
#region Members
- readonly string _appId;
+ string _appId;
uint _maxSlotsInList;
- readonly JumpListTasks _tasks;
- readonly JumpListDestinations _destinations;
- readonly EventHandler _displaySettingsChangeHandler;
- readonly ICustomDestinationList _customDestinationList;
+ JumpListTasks _tasks;
+ JumpListDestinations _destinations;
+ EventHandler _displaySettingsChangeHandler;
+ ICustomDestinationList _customDestinationList;
ApplicationDestinationType _enabledAutoDestinationType; // = ApplicationDestinationType.Recent;
#endregion
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButton.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButton.cs
index 830a8b0dd..b3630b3ff 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButton.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButton.cs
@@ -32,7 +32,7 @@ namespace TaskbarLib
///
public sealed class ThumbButton
{
- private readonly ThumbButtonManager _manager;
+ private ThumbButtonManager _manager;
internal ThumbButton(ThumbButtonManager manager, int id, Icon icon, string tooltip)
{
@@ -70,15 +70,13 @@ namespace TaskbarLib
{
get
{
- THUMBBUTTON win32ThumbButton = new THUMBBUTTON
- {
- iId = this.Id,
- szTip = this.Tooltip,
- hIcon = this.Icon.Handle,
- dwFlags = this.Flags | ThumbnailButtonFlags.DISMISSONCLICK,
- dwMask = ThumbnailButtonMask.Flags
- };
+ THUMBBUTTON win32ThumbButton = new THUMBBUTTON();
+ win32ThumbButton.iId = Id;
+ win32ThumbButton.szTip = Tooltip;
+ win32ThumbButton.hIcon = Icon.Handle;
+ win32ThumbButton.dwFlags = Flags | ThumbnailButtonFlags.DISMISSONCLICK;
+ win32ThumbButton.dwMask = ThumbnailButtonMask.Flags;
if (Tooltip != null)
win32ThumbButton.dwMask |= ThumbnailButtonMask.Tooltip;
if (Icon != null)
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButtonManager.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButtonManager.cs
index 6d1e74ede..69ba0de5a 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButtonManager.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/ThumbnailButtons/ThumbButtonManager.cs
@@ -37,7 +37,7 @@ namespace TaskbarLib
{
private sealed class MessageFilter : IMessageFilter
{
- private readonly ThumbButtonManager _manager;
+ private ThumbButtonManager _manager;
public MessageFilter(ThumbButtonManager manager)
{
@@ -48,13 +48,12 @@ namespace TaskbarLib
{
if (m.Msg == (int)Windows7Taskbar.TaskbarButtonCreatedMessage)
{
- this._manager.OnTaskbarButtonCreated();
+ _manager.OnTaskbarButtonCreated();
return true;
}
-
- if (m.Msg == (int)ProcessHacker.Native.Api.WindowMessage.Command)
+ else if (m.Msg == (int)ProcessHacker.Native.Api.WindowMessage.Command)
{
- this._manager.OnCommand(m.WParam);
+ _manager.OnCommand(m.WParam);
}
return false;
@@ -63,8 +62,8 @@ namespace TaskbarLib
public event EventHandler TaskbarButtonCreated;
- private readonly Form _form;
- private readonly MessageFilter _filter;
+ private Form _form;
+ private MessageFilter _filter;
private bool _disposed;
///
@@ -166,7 +165,7 @@ namespace TaskbarLib
}
}
- private readonly Dictionary _thumbButtons = new Dictionary();
+ private Dictionary _thumbButtons = new Dictionary();
#endregion
}
diff --git a/1.x/trunk/ProcessHacker/Components/TaskbarLib/Windows7Taskbar.cs b/1.x/trunk/ProcessHacker/Components/TaskbarLib/Windows7Taskbar.cs
index b05156236..e24e2c8f2 100644
--- a/1.x/trunk/ProcessHacker/Components/TaskbarLib/Windows7Taskbar.cs
+++ b/1.x/trunk/ProcessHacker/Components/TaskbarLib/Windows7Taskbar.cs
@@ -72,8 +72,9 @@ namespace TaskbarLib
private static IPropertyStore InternalGetWindowPropertyStore(IntPtr hwnd)
{
IPropertyStore propStore;
-
- UnsafeNativeMethods.SHGetPropertyStoreForWindow(hwnd, ref SafeNativeMethods.IID_IPropertyStore, out propStore);
+ HResult shGetPropertyStoreResult = UnsafeNativeMethods.SHGetPropertyStoreForWindow(
+ hwnd, ref SafeNativeMethods.IID_IPropertyStore, out propStore);
+ shGetPropertyStoreResult.ThrowIf();
return propStore;
}
@@ -118,16 +119,15 @@ namespace TaskbarLib
set
{
IPropertyStore propStore = InternalGetWindowPropertyStore(Program.HackerWindowHandle);
- if (propStore != null)
- {
- PropVariant pv = new PropVariant();
- pv.SetValue(value);
- propStore.SetValue(ref PropertyKey.PKEY_AppUserModel_ID, ref pv);
+ PropVariant pv = new PropVariant();
+ pv.SetValue(value);
- Marshal.ReleaseComObject(propStore);
- pv.Dispose();
- }
+ HResult setValueResult = propStore.SetValue(ref PropertyKey.PKEY_AppUserModel_ID, ref pv);
+ setValueResult.ThrowIf();
+
+ Marshal.ReleaseComObject(propStore);
+ pv.Dispose();
}
}
@@ -139,12 +139,14 @@ namespace TaskbarLib
get
{
string appId;
- UnsafeNativeMethods.GetCurrentProcessExplicitAppUserModelID(out appId);
+ HResult getProcessAppUserModeIDResult = UnsafeNativeMethods.GetCurrentProcessExplicitAppUserModelID(out appId);
+ getProcessAppUserModeIDResult.ThrowIf();
return appId;
}
set
{
- UnsafeNativeMethods.SetCurrentProcessExplicitAppUserModelID(value);
+ HResult setProcessAppUserModeIDResult = UnsafeNativeMethods.SetCurrentProcessExplicitAppUserModelID(value);
+ setProcessAppUserModeIDResult.ThrowIf();
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/ThreadList.Designer.cs b/1.x/trunk/ProcessHacker/Components/ThreadList.Designer.cs
index 9cff647c8..8fd5967a5 100644
--- a/1.x/trunk/ProcessHacker/Components/ThreadList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/ThreadList.Designer.cs
@@ -32,11 +32,12 @@
///
private void InitializeComponent()
{
- this.listThreads = new ProcessHacker.Components.ExtendedListView();
- this.columnThreadID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnContextSwitchesDelta = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnStartAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnPriority = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.components = new System.ComponentModel.Container();
+ this.listThreads = new System.Windows.Forms.ListView();
+ this.columnThreadID = new System.Windows.Forms.ColumnHeader();
+ this.columnContextSwitchesDelta = new System.Windows.Forms.ColumnHeader();
+ this.columnStartAddress = new System.Windows.Forms.ColumnHeader();
+ this.columnPriority = new System.Windows.Forms.ColumnHeader();
this.menuThread = new System.Windows.Forms.ContextMenu();
this.inspectThreadMenuItem = new System.Windows.Forms.MenuItem();
this.terminateThreadMenuItem = new System.Windows.Forms.MenuItem();
@@ -83,22 +84,23 @@
this.label4 = new System.Windows.Forms.Label();
this.labelTEBAddress = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.fileModule = new ProcessHacker.Components.FileNameBox();
this.tableInformation.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// listThreads
//
this.listThreads.AllowColumnReorder = true;
- this.listThreads.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listThreads.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listThreads.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnThreadID,
this.columnContextSwitchesDelta,
this.columnStartAddress,
this.columnPriority});
- this.listThreads.DoubleClickChecks = true;
this.listThreads.FullRowSelect = true;
this.listThreads.HideSelection = false;
this.listThreads.Location = new System.Drawing.Point(0, 0);
@@ -154,12 +156,14 @@
// inspectThreadMenuItem
//
this.inspectThreadMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.inspectThreadMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
this.inspectThreadMenuItem.Index = 0;
this.inspectThreadMenuItem.Text = "&Inspect";
this.inspectThreadMenuItem.Click += new System.EventHandler(this.inspectThreadMenuItem_Click);
//
// terminateThreadMenuItem
//
+ this.vistaMenu.SetImage(this.terminateThreadMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.terminateThreadMenuItem.Index = 1;
this.terminateThreadMenuItem.Text = "&Terminate";
this.terminateThreadMenuItem.Click += new System.EventHandler(this.terminateThreadMenuItem_Click);
@@ -172,12 +176,14 @@
//
// suspendThreadMenuItem
//
+ this.vistaMenu.SetImage(this.suspendThreadMenuItem, global::ProcessHacker.Properties.Resources.control_pause_blue);
this.suspendThreadMenuItem.Index = 3;
this.suspendThreadMenuItem.Text = "&Suspend";
this.suspendThreadMenuItem.Click += new System.EventHandler(this.suspendThreadMenuItem_Click);
//
// resumeThreadMenuItem
//
+ this.vistaMenu.SetImage(this.resumeThreadMenuItem, global::ProcessHacker.Properties.Resources.control_play_blue);
this.resumeThreadMenuItem.Index = 4;
this.resumeThreadMenuItem.Text = "&Resume";
this.resumeThreadMenuItem.Click += new System.EventHandler(this.resumeThreadMenuItem_Click);
@@ -201,6 +207,7 @@
//
// tokenThreadMenuItem
//
+ this.vistaMenu.SetImage(this.tokenThreadMenuItem, global::ProcessHacker.Properties.Resources.locked);
this.tokenThreadMenuItem.Index = 8;
this.tokenThreadMenuItem.Text = "Token";
this.tokenThreadMenuItem.Click += new System.EventHandler(this.tokenThreadMenuItem_Click);
@@ -321,6 +328,7 @@
//
// copyThreadMenuItem
//
+ this.vistaMenu.SetImage(this.copyThreadMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyThreadMenuItem.Index = 13;
this.copyThreadMenuItem.Text = "C&opy";
//
@@ -332,8 +340,8 @@
//
// tableInformation
//
- this.tableInformation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.tableInformation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.tableInformation.ColumnCount = 4;
this.tableInformation.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableInformation.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
@@ -372,7 +380,7 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(3, 3);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(33, 13);
+ this.label6.Size = new System.Drawing.Size(32, 13);
this.label6.TabIndex = 1;
this.label6.Text = "State";
//
@@ -382,7 +390,7 @@
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(3, 22);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(65, 13);
+ this.label8.Size = new System.Drawing.Size(63, 13);
this.label8.TabIndex = 1;
this.label8.Text = "Kernel Time";
//
@@ -392,7 +400,7 @@
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(3, 41);
this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(56, 13);
+ this.label9.Size = new System.Drawing.Size(55, 13);
this.label9.TabIndex = 1;
this.label9.Text = "User Time";
//
@@ -400,9 +408,9 @@
//
this.labelState.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelState.AutoSize = true;
- this.labelState.Location = new System.Drawing.Point(187, 3);
+ this.labelState.Location = new System.Drawing.Point(188, 3);
this.labelState.Name = "labelState";
- this.labelState.Size = new System.Drawing.Size(34, 13);
+ this.labelState.Size = new System.Drawing.Size(33, 13);
this.labelState.TabIndex = 1;
this.labelState.Text = "value";
//
@@ -410,9 +418,9 @@
//
this.labelKernelTime.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelKernelTime.AutoSize = true;
- this.labelKernelTime.Location = new System.Drawing.Point(187, 22);
+ this.labelKernelTime.Location = new System.Drawing.Point(188, 22);
this.labelKernelTime.Name = "labelKernelTime";
- this.labelKernelTime.Size = new System.Drawing.Size(34, 13);
+ this.labelKernelTime.Size = new System.Drawing.Size(33, 13);
this.labelKernelTime.TabIndex = 1;
this.labelKernelTime.Text = "value";
//
@@ -420,9 +428,9 @@
//
this.labelUserTime.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelUserTime.AutoSize = true;
- this.labelUserTime.Location = new System.Drawing.Point(187, 41);
+ this.labelUserTime.Location = new System.Drawing.Point(188, 41);
this.labelUserTime.Name = "labelUserTime";
- this.labelUserTime.Size = new System.Drawing.Size(34, 13);
+ this.labelUserTime.Size = new System.Drawing.Size(33, 13);
this.labelUserTime.TabIndex = 1;
this.labelUserTime.Text = "value";
//
@@ -430,9 +438,9 @@
//
this.labelTotalTime.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelTotalTime.AutoSize = true;
- this.labelTotalTime.Location = new System.Drawing.Point(187, 61);
+ this.labelTotalTime.Location = new System.Drawing.Point(188, 61);
this.labelTotalTime.Name = "labelTotalTime";
- this.labelTotalTime.Size = new System.Drawing.Size(34, 13);
+ this.labelTotalTime.Size = new System.Drawing.Size(33, 13);
this.labelTotalTime.TabIndex = 1;
this.labelTotalTime.Text = "value";
//
@@ -442,7 +450,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(227, 61);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(95, 13);
+ this.label1.Size = new System.Drawing.Size(89, 13);
this.label1.TabIndex = 6;
this.label1.Text = "Context Switches";
//
@@ -452,7 +460,7 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(227, 41);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(70, 13);
+ this.label2.Size = new System.Drawing.Size(65, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Base Priority";
//
@@ -462,7 +470,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(227, 22);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(43, 13);
+ this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Priority";
//
@@ -470,9 +478,9 @@
//
this.labelContextSwitches.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelContextSwitches.AutoSize = true;
- this.labelContextSwitches.Location = new System.Drawing.Point(413, 61);
+ this.labelContextSwitches.Location = new System.Drawing.Point(414, 61);
this.labelContextSwitches.Name = "labelContextSwitches";
- this.labelContextSwitches.Size = new System.Drawing.Size(34, 13);
+ this.labelContextSwitches.Size = new System.Drawing.Size(33, 13);
this.labelContextSwitches.TabIndex = 7;
this.labelContextSwitches.Text = "value";
//
@@ -480,9 +488,9 @@
//
this.labelBasePriority.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelBasePriority.AutoSize = true;
- this.labelBasePriority.Location = new System.Drawing.Point(413, 41);
+ this.labelBasePriority.Location = new System.Drawing.Point(414, 41);
this.labelBasePriority.Name = "labelBasePriority";
- this.labelBasePriority.Size = new System.Drawing.Size(34, 13);
+ this.labelBasePriority.Size = new System.Drawing.Size(33, 13);
this.labelBasePriority.TabIndex = 4;
this.labelBasePriority.Text = "value";
//
@@ -490,9 +498,9 @@
//
this.labelPriority.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelPriority.AutoSize = true;
- this.labelPriority.Location = new System.Drawing.Point(413, 22);
+ this.labelPriority.Location = new System.Drawing.Point(414, 22);
this.labelPriority.Name = "labelPriority";
- this.labelPriority.Size = new System.Drawing.Size(34, 13);
+ this.labelPriority.Size = new System.Drawing.Size(33, 13);
this.labelPriority.TabIndex = 3;
this.labelPriority.Text = "value";
//
@@ -502,7 +510,7 @@
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(3, 61);
this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(58, 13);
+ this.label10.Size = new System.Drawing.Size(57, 13);
this.label10.TabIndex = 1;
this.label10.Text = "Total Time";
//
@@ -520,9 +528,9 @@
//
this.labelTEBAddress.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelTEBAddress.AutoSize = true;
- this.labelTEBAddress.Location = new System.Drawing.Point(413, 3);
+ this.labelTEBAddress.Location = new System.Drawing.Point(414, 3);
this.labelTEBAddress.Name = "labelTEBAddress";
- this.labelTEBAddress.Size = new System.Drawing.Size(34, 13);
+ this.labelTEBAddress.Size = new System.Drawing.Size(33, 13);
this.labelTEBAddress.TabIndex = 3;
this.labelTEBAddress.Text = "value";
//
@@ -532,14 +540,19 @@
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(3, 356);
this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(77, 13);
+ this.label7.Size = new System.Drawing.Size(70, 13);
this.label7.TabIndex = 5;
this.label7.Text = "Start Module:";
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// fileModule
//
- this.fileModule.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.fileModule.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.fileModule.Location = new System.Drawing.Point(79, 351);
this.fileModule.Name = "fileModule";
this.fileModule.ReadOnly = true;
@@ -550,15 +563,16 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.fileModule);
this.Controls.Add(this.label7);
this.Controls.Add(this.tableInformation);
this.Controls.Add(this.listThreads);
+ this.DoubleBuffered = true;
this.Name = "ThreadList";
this.Size = new System.Drawing.Size(450, 460);
this.tableInformation.ResumeLayout(false);
this.tableInformation.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -566,10 +580,11 @@
#endregion
- private ExtendedListView listThreads;
+ private System.Windows.Forms.ListView listThreads;
private System.Windows.Forms.ColumnHeader columnThreadID;
private System.Windows.Forms.ColumnHeader columnContextSwitchesDelta;
private System.Windows.Forms.ColumnHeader columnStartAddress;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.ContextMenu menuThread;
private System.Windows.Forms.MenuItem inspectThreadMenuItem;
private System.Windows.Forms.MenuItem terminateThreadMenuItem;
diff --git a/1.x/trunk/ProcessHacker/Components/ThreadList.cs b/1.x/trunk/ProcessHacker/Components/ThreadList.cs
index 88c816297..08803545f 100644
--- a/1.x/trunk/ProcessHacker/Components/ThreadList.cs
+++ b/1.x/trunk/ProcessHacker/Components/ThreadList.cs
@@ -23,6 +23,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Reflection;
using System.Text;
using System.Windows.Forms;
using ProcessHacker.Common;
@@ -40,11 +41,11 @@ namespace ProcessHacker.Components
public partial class ThreadList : UserControl
{
private ThreadProvider _provider;
- private bool _useCycleTime;
- private int _runCount;
- private readonly List _needsAdd = new List();
- private readonly HighlightingContext _highlightingContext;
- private bool _needsSort;
+ private bool _useCycleTime = false;
+ private int _runCount = 0;
+ private List _needsAdd = new List();
+ private HighlightingContext _highlightingContext;
+ private bool _needsSort = false;
public new event KeyEventHandler KeyDown;
public new event MouseEventHandler MouseDown;
public new event MouseEventHandler MouseUp;
@@ -71,16 +72,23 @@ namespace ProcessHacker.Components
var comparer = (SortedListViewComparer)
(listThreads.ListViewItemSorter = new SortedListViewComparer(listThreads));
- comparer.CustomSorters.Add(1, (x, y) =>
- {
- if (OSVersion.HasCycleTime)
+ comparer.CustomSorters.Add(1,
+ (x, y) =>
{
- return ((ThreadItem)x.Tag).CyclesDelta.CompareTo((y.Tag as ThreadItem).CyclesDelta);
- }
-
- return ((ThreadItem)x.Tag).ContextSwitchesDelta.CompareTo((y.Tag as ThreadItem).ContextSwitchesDelta);
- });
- comparer.CustomSorters.Add(3, (x, y) => ((ThreadItem)x.Tag).PriorityI.CompareTo((y.Tag as ThreadItem).PriorityI));
+ if (OSVersion.HasCycleTime)
+ {
+ return (x.Tag as ThreadItem).CyclesDelta.CompareTo((y.Tag as ThreadItem).CyclesDelta);
+ }
+ else
+ {
+ return (x.Tag as ThreadItem).ContextSwitchesDelta.CompareTo((y.Tag as ThreadItem).ContextSwitchesDelta);
+ }
+ });
+ comparer.CustomSorters.Add(3,
+ (x, y) =>
+ {
+ return (x.Tag as ThreadItem).PriorityI.CompareTo((y.Tag as ThreadItem).PriorityI);
+ });
comparer.ColumnSortOrder.Add(0);
comparer.ColumnSortOrder.Add(2);
comparer.ColumnSortOrder.Add(3);
@@ -88,15 +96,27 @@ namespace ProcessHacker.Components
comparer.SortColumn = 1;
comparer.SortOrder = SortOrder.Descending;
- listThreads.KeyDown += this.ThreadList_KeyDown;
- listThreads.MouseDown += this.listThreads_MouseDown;
- listThreads.MouseUp += this.listThreads_MouseUp;
- listThreads.SelectedIndexChanged += this.listThreads_SelectedIndexChanged;
+ listThreads.KeyDown += new KeyEventHandler(ThreadList_KeyDown);
+ listThreads.MouseDown += new MouseEventHandler(listThreads_MouseDown);
+ listThreads.MouseUp += new MouseEventHandler(listThreads_MouseUp);
+ listThreads.SelectedIndexChanged += new System.EventHandler(listThreads_SelectedIndexChanged);
ColumnSettings.LoadSettings(Settings.Instance.ThreadListViewColumns, listThreads);
listThreads.ContextMenu = menuThread;
GenericViewMenu.AddMenuItems(copyThreadMenuItem.MenuItems, listThreads, null);
listThreads_SelectedIndexChanged(null, null);
+
+ _dontCalculate = false;
+ }
+
+ private bool _dontCalculate = true;
+
+ protected override void OnResize(EventArgs e)
+ {
+ if (_dontCalculate)
+ return;
+
+ base.OnResize(e);
}
private void listThreads_MouseUp(object sender, MouseEventArgs e)
@@ -166,16 +186,16 @@ namespace ProcessHacker.Components
}
else
{
- fileModule.Text = string.Empty;
+ fileModule.Text = "";
fileModule.Enabled = false;
- labelState.Text = string.Empty;
- labelKernelTime.Text = string.Empty;
- labelUserTime.Text = string.Empty;
- labelTotalTime.Text = string.Empty;
- labelTEBAddress.Text = string.Empty;
- labelPriority.Text = string.Empty;
- labelBasePriority.Text = string.Empty;
- labelContextSwitches.Text = string.Empty;
+ labelState.Text = "";
+ labelKernelTime.Text = "";
+ labelUserTime.Text = "";
+ labelTotalTime.Text = "";
+ labelTEBAddress.Text = "";
+ labelPriority.Text = "";
+ labelBasePriority.Text = "";
+ labelContextSwitches.Text = "";
}
if (this.SelectedIndexChanged != null)
@@ -189,20 +209,33 @@ namespace ProcessHacker.Components
if (!e.Handled)
{
- switch (e.KeyCode)
+ if (e.KeyCode == Keys.Enter)
{
- case Keys.Enter:
- this.inspectThreadMenuItem_Click(null, null);
- break;
- case Keys.Delete:
- this.terminateThreadMenuItem_Click(null, null);
- break;
+ inspectThreadMenuItem_Click(null, null);
+ }
+ else if (e.KeyCode == Keys.Delete)
+ {
+ terminateThreadMenuItem_Click(null, null);
}
}
}
#region Properties
+ public new bool DoubleBuffered
+ {
+ get
+ {
+ return (bool)typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).GetValue(listThreads, null);
+ }
+ set
+ {
+ typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance).SetValue(listThreads, value, null);
+ }
+ }
+
public override bool Focused
{
get
@@ -223,7 +256,7 @@ namespace ProcessHacker.Components
set { listThreads.ContextMenuStrip = value; }
}
- public ExtendedListView List
+ public ListView List
{
get { return listThreads; }
}
@@ -237,11 +270,11 @@ namespace ProcessHacker.Components
if (_provider != null)
{
- _provider.DictionaryAdded -= this.provider_DictionaryAdded;
- _provider.DictionaryModified -= this.provider_DictionaryModified;
- _provider.DictionaryRemoved -= this.provider_DictionaryRemoved;
- _provider.Updated -= this.provider_Updated;
- _provider.LoadingStateChanged -= this.provider_LoadingStateChanged;
+ _provider.DictionaryAdded -= new ThreadProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified -= new ThreadProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved -= new ThreadProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated -= new ThreadProvider.ProviderUpdateOnce(provider_Updated);
+ _provider.LoadingStateChanged -= new ThreadProvider.LoadingStateChangedDelegate(provider_LoadingStateChanged);
}
_provider = value;
@@ -273,11 +306,11 @@ namespace ProcessHacker.Components
else
listThreads.Columns[1].Text = "Context Switches Delta";
- _provider.DictionaryAdded += this.provider_DictionaryAdded;
- _provider.DictionaryModified += this.provider_DictionaryModified;
- _provider.DictionaryRemoved += this.provider_DictionaryRemoved;
- _provider.Updated += this.provider_Updated;
- _provider.LoadingStateChanged += this.provider_LoadingStateChanged;
+ _provider.DictionaryAdded += new ThreadProvider.ProviderDictionaryAdded(provider_DictionaryAdded);
+ _provider.DictionaryModified += new ThreadProvider.ProviderDictionaryModified(provider_DictionaryModified);
+ _provider.DictionaryRemoved += new ThreadProvider.ProviderDictionaryRemoved(provider_DictionaryRemoved);
+ _provider.Updated += new ThreadProvider.ProviderUpdateOnce(provider_Updated);
+ _provider.LoadingStateChanged += new ThreadProvider.LoadingStateChangedDelegate(provider_LoadingStateChanged);
this.EnableDisableMenuItems();
}
@@ -335,13 +368,13 @@ namespace ProcessHacker.Components
if (_needsSort)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- if (_needsSort)
{
- listThreads.Sort();
- _needsSort = false;
- }
- }));
+ if (_needsSort)
+ {
+ listThreads.Sort();
+ _needsSort = false;
+ }
+ }));
}
_runCount++;
@@ -351,7 +384,7 @@ namespace ProcessHacker.Components
{
if (
// If KProcessHacker isn't available, hide Force Terminate.
- //KProcessHacker.Instance != null &&
+ KProcessHacker.Instance != null &&
// Terminating a system thread is the same as Force Terminate,
// so hide it if we're viewing PID 4.
_pid != 4
@@ -365,8 +398,7 @@ namespace ProcessHacker.Components
{
if (Settings.Instance.UseColorSuspended && titem.WaitReason == KWaitReason.Suspended)
return Settings.Instance.ColorSuspended;
-
- if (Settings.Instance.UseColorGuiThreads && titem.IsGuiThread)
+ else if (Settings.Instance.UseColorGuiThreads && titem.IsGuiThread)
return Settings.Instance.ColorGuiThreads;
return System.Drawing.SystemColors.Window;
@@ -374,13 +406,12 @@ namespace ProcessHacker.Components
private void provider_DictionaryAdded(ThreadItem item)
{
- HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext, item.RunId > 0 && _runCount > 0)
- {
- Name = item.Tid.ToString(),
- Text = item.Tid.ToString()
- };
+ HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
+ item.RunId > 0 && _runCount > 0);
- litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, string.Empty));
+ litem.Name = item.Tid.ToString();
+ litem.Text = item.Tid.ToString();
+ litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, ""));
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.StartAddress));
litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.Priority));
litem.Tag = item;
@@ -393,60 +424,60 @@ namespace ProcessHacker.Components
private void provider_DictionaryModified(ThreadItem oldItem, ThreadItem newItem)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- lock (listThreads)
{
- ListViewItem litem = listThreads.Items[newItem.Tid.ToString()];
-
- if (litem == null)
- return;
-
- if (!_useCycleTime)
+ lock (listThreads)
{
- if (newItem.ContextSwitchesDelta == 0)
- litem.SubItems[1].Text = string.Empty;
- else
- litem.SubItems[1].Text = newItem.ContextSwitchesDelta.ToString("N0");
- }
- else
- {
- if (newItem.CyclesDelta == 0)
- litem.SubItems[1].Text = string.Empty;
- else
- litem.SubItems[1].Text = newItem.CyclesDelta.ToString("N0");
- }
+ ListViewItem litem = listThreads.Items[newItem.Tid.ToString()];
- litem.SubItems[2].Text = newItem.StartAddress;
- litem.SubItems[3].Text = newItem.Priority;
- litem.Tag = newItem;
+ if (litem == null)
+ return;
- (litem as HighlightedListViewItem).NormalColor = GetThreadColor(newItem);
- _needsSort = true;
- }
- }));
+ if (!_useCycleTime)
+ {
+ if (newItem.ContextSwitchesDelta == 0)
+ litem.SubItems[1].Text = "";
+ else
+ litem.SubItems[1].Text = newItem.ContextSwitchesDelta.ToString("N0");
+ }
+ else
+ {
+ if (newItem.CyclesDelta == 0)
+ litem.SubItems[1].Text = "";
+ else
+ litem.SubItems[1].Text = newItem.CyclesDelta.ToString("N0");
+ }
+
+ litem.SubItems[2].Text = newItem.StartAddress;
+ litem.SubItems[3].Text = newItem.Priority;
+ litem.Tag = newItem;
+
+ (litem as HighlightedListViewItem).NormalColor = GetThreadColor(newItem);
+ _needsSort = true;
+ }
+ }));
}
private void provider_DictionaryRemoved(ThreadItem item)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- lock (listThreads)
{
- if (listThreads.Items.ContainsKey(item.Tid.ToString()))
- listThreads.Items[item.Tid.ToString()].Remove();
- }
- }));
+ lock (listThreads)
+ {
+ if (listThreads.Items.ContainsKey(item.Tid.ToString()))
+ listThreads.Items[item.Tid.ToString()].Remove();
+ }
+ }));
}
private void provider_LoadingStateChanged(bool loading)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- if (loading)
- listThreads.Cursor = Cursors.AppStarting;
- else
- listThreads.Cursor = Cursors.Default;
- }));
+ {
+ if (loading)
+ listThreads.Cursor = Cursors.AppStarting;
+ else
+ listThreads.Cursor = Cursors.Default;
+ }));
}
public void SaveSettings()
@@ -460,7 +491,7 @@ namespace ProcessHacker.Components
{
int tid = int.Parse(listThreads.SelectedItems[0].SubItems[0].Text);
- using (ThreadHandle thandle = new ThreadHandle(tid, OSVersion.MinThreadSetInfoAccess))
+ using (var thandle = new ThreadHandle(tid, OSVersion.MinThreadSetInfoAccess))
thandle.SetBasePriorityWin32(priority);
}
catch (Exception ex)
@@ -475,7 +506,7 @@ namespace ProcessHacker.Components
{
int tid = int.Parse(listThreads.SelectedItems[0].SubItems[0].Text);
- using (ThreadHandle thandle = new ThreadHandle(tid, OSVersion.MinThreadSetInfoAccess))
+ using (var thandle = new ThreadHandle(tid, OSVersion.MinThreadSetInfoAccess))
thandle.SetIoPriority(ioPriority);
}
catch (Exception ex)
@@ -491,120 +522,136 @@ namespace ProcessHacker.Components
private void menuThread_Popup(object sender, EventArgs e)
{
- switch (this.listThreads.SelectedItems.Count)
+ if (listThreads.SelectedItems.Count == 0)
{
- case 0:
- return;
- case 1:
- this.menuThread.EnableAll();
- this.terminateThreadMenuItem.Text = "&Terminate Thread";
- this.forceTerminateThreadMenuItem.Text = "Force Terminate Thread";
- this.suspendThreadMenuItem.Text = "&Suspend Thread";
- this.resumeThreadMenuItem.Text = "&Resume Thread";
- this.priorityThreadMenuItem.Text = "&Priority";
- this.timeCriticalThreadMenuItem.Checked = false;
- this.highestThreadMenuItem.Checked = false;
- this.aboveNormalThreadMenuItem.Checked = false;
- this.normalThreadMenuItem.Checked = false;
- this.belowNormalThreadMenuItem.Checked = false;
- this.lowestThreadMenuItem.Checked = false;
- this.idleThreadMenuItem.Checked = false;
- this.ioPriority0ThreadMenuItem.Checked = false;
- this.ioPriority1ThreadMenuItem.Checked = false;
- this.ioPriority2ThreadMenuItem.Checked = false;
- this.ioPriority3ThreadMenuItem.Checked = false;
- try
- {
- using (var thandle = new ThreadHandle(int.Parse(this.listThreads.SelectedItems[0].SubItems[0].Text), Program.MinThreadQueryRights))
- {
- try
- {
- switch (thandle.GetBasePriorityWin32())
- {
- case ThreadPriorityLevel.TimeCritical:
- this.timeCriticalThreadMenuItem.Checked = true;
- break;
- case ThreadPriorityLevel.Highest:
- this.highestThreadMenuItem.Checked = true;
- break;
- case ThreadPriorityLevel.AboveNormal:
- this.aboveNormalThreadMenuItem.Checked = true;
- break;
- case ThreadPriorityLevel.Normal:
- this.normalThreadMenuItem.Checked = true;
- break;
- case ThreadPriorityLevel.BelowNormal:
- this.belowNormalThreadMenuItem.Checked = true;
- break;
- case ThreadPriorityLevel.Lowest:
- this.lowestThreadMenuItem.Checked = true;
- break;
- case ThreadPriorityLevel.Idle:
- this.idleThreadMenuItem.Checked = true;
- break;
- }
- }
- catch
- {
- this.priorityThreadMenuItem.Enabled = false;
- }
+ menuThread.DisableAll();
- try
+ return;
+ }
+ else if (listThreads.SelectedItems.Count == 1)
+ {
+ menuThread.EnableAll();
+
+ terminateThreadMenuItem.Text = "&Terminate Thread";
+ forceTerminateThreadMenuItem.Text = "Force Terminate Thread";
+ suspendThreadMenuItem.Text = "&Suspend Thread";
+ resumeThreadMenuItem.Text = "&Resume Thread";
+ priorityThreadMenuItem.Text = "&Priority";
+
+ timeCriticalThreadMenuItem.Checked = false;
+ highestThreadMenuItem.Checked = false;
+ aboveNormalThreadMenuItem.Checked = false;
+ normalThreadMenuItem.Checked = false;
+ belowNormalThreadMenuItem.Checked = false;
+ lowestThreadMenuItem.Checked = false;
+ idleThreadMenuItem.Checked = false;
+
+ ioPriority0ThreadMenuItem.Checked = false;
+ ioPriority1ThreadMenuItem.Checked = false;
+ ioPriority2ThreadMenuItem.Checked = false;
+ ioPriority3ThreadMenuItem.Checked = false;
+
+ try
+ {
+ using (var thandle = new ThreadHandle(
+ int.Parse(listThreads.SelectedItems[0].SubItems[0].Text),
+ Program.MinThreadQueryRights))
+ {
+ try
+ {
+ switch (thandle.GetBasePriorityWin32())
{
- if (OSVersion.HasIoPriority)
- {
- switch (thandle.GetIoPriority())
- {
- case 0:
- this.ioPriority0ThreadMenuItem.Checked = true;
- break;
- case 1:
- this.ioPriority1ThreadMenuItem.Checked = true;
- break;
- case 2:
- this.ioPriority2ThreadMenuItem.Checked = true;
- break;
- case 3:
- this.ioPriority3ThreadMenuItem.Checked = true;
- break;
- }
- }
- }
- catch
- {
- this.ioPriorityThreadMenuItem.Enabled = false;
+ case ThreadPriorityLevel.TimeCritical:
+ timeCriticalThreadMenuItem.Checked = true;
+ break;
+ case ThreadPriorityLevel.Highest:
+ highestThreadMenuItem.Checked = true;
+ break;
+ case ThreadPriorityLevel.AboveNormal:
+ aboveNormalThreadMenuItem.Checked = true;
+ break;
+ case ThreadPriorityLevel.Normal:
+ normalThreadMenuItem.Checked = true;
+ break;
+ case ThreadPriorityLevel.BelowNormal:
+ belowNormalThreadMenuItem.Checked = true;
+ break;
+ case ThreadPriorityLevel.Lowest:
+ lowestThreadMenuItem.Checked = true;
+ break;
+ case ThreadPriorityLevel.Idle:
+ idleThreadMenuItem.Checked = true;
+ break;
}
}
+ catch
+ {
+ priorityThreadMenuItem.Enabled = false;
+ }
+
+ try
+ {
+ if (OSVersion.HasIoPriority)
+ {
+ switch (thandle.GetIoPriority())
+ {
+ case 0:
+ ioPriority0ThreadMenuItem.Checked = true;
+ break;
+ case 1:
+ ioPriority1ThreadMenuItem.Checked = true;
+ break;
+ case 2:
+ ioPriority2ThreadMenuItem.Checked = true;
+ break;
+ case 3:
+ ioPriority3ThreadMenuItem.Checked = true;
+ break;
+ }
+ }
+ }
+ catch
+ {
+ ioPriorityThreadMenuItem.Enabled = false;
+ }
}
- catch
+ }
+ catch
+ {
+ priorityThreadMenuItem.Enabled = false;
+ ioPriorityThreadMenuItem.Enabled = false;
+ }
+
+ try
+ {
+ using (ThreadHandle thandle = new ThreadHandle(
+ int.Parse(listThreads.SelectedItems[0].Text), Program.MinThreadQueryRights
+ ))
{
- this.priorityThreadMenuItem.Enabled = false;
- this.ioPriorityThreadMenuItem.Enabled = false;
- }
- try
- {
- using (ThreadHandle thandle = new ThreadHandle(int.Parse(this.listThreads.SelectedItems[0].Text), Program.MinThreadQueryRights))
using (TokenHandle tokenHandle = thandle.GetToken(TokenAccess.Query))
{
- this.tokenThreadMenuItem.Enabled = true;
+ tokenThreadMenuItem.Enabled = true;
}
}
- catch (WindowsException)
- {
- this.tokenThreadMenuItem.Enabled = false;
- }
- break;
- default:
- this.terminateThreadMenuItem.Enabled = true;
- this.forceTerminateThreadMenuItem.Enabled = true;
- this.suspendThreadMenuItem.Enabled = true;
- this.resumeThreadMenuItem.Enabled = true;
- this.terminateThreadMenuItem.Text = "&Terminate Threads";
- this.forceTerminateThreadMenuItem.Text = "Force Terminate Threads";
- this.suspendThreadMenuItem.Text = "&Suspend Threads";
- this.resumeThreadMenuItem.Text = "&Resume Threads";
- this.copyThreadMenuItem.Enabled = true;
- break;
+ }
+ catch (WindowsException)
+ {
+ tokenThreadMenuItem.Enabled = false;
+ }
+ }
+ else
+ {
+ menuThread.DisableAll();
+
+ terminateThreadMenuItem.Enabled = true;
+ forceTerminateThreadMenuItem.Enabled = true;
+ suspendThreadMenuItem.Enabled = true;
+ resumeThreadMenuItem.Enabled = true;
+ terminateThreadMenuItem.Text = "&Terminate Threads";
+ forceTerminateThreadMenuItem.Text = "Force Terminate Threads";
+ suspendThreadMenuItem.Text = "&Suspend Threads";
+ resumeThreadMenuItem.Text = "&Resume Threads";
+ copyThreadMenuItem.Enabled = true;
}
if (listThreads.Items.Count == 0)
@@ -623,7 +670,10 @@ namespace ProcessHacker.Components
return;
// Can't view system thread stacks if KPH isn't present.
- if (_pid == 4)
+ if (
+ _pid == 4 &&
+ KProcessHacker.Instance == null
+ )
{
PhUtils.ShowError(
"Process Hacker cannot view system thread stacks without KProcessHacker. " +
@@ -635,7 +685,7 @@ namespace ProcessHacker.Components
}
// Suspending PH threads is not a good idea :(
- if (_pid == ProcessHandle.CurrentId)
+ if (_pid == ProcessHandle.GetCurrentId())
{
if (!PhUtils.ShowConfirmMessage(
"inspect",
@@ -651,10 +701,18 @@ namespace ProcessHacker.Components
ProcessHandle phandle = null;
// If we have KPH, we don't need much access.
- if ((_provider.ProcessAccess & ProcessAccess.QueryLimitedInformation) != 0 ||
- (_provider.ProcessAccess & ProcessAccess.QueryInformation) != 0)
- phandle = _provider.ProcessHandle;
-
+ if (KProcessHacker.Instance != null)
+ {
+ if ((_provider.ProcessAccess & ProcessAccess.QueryLimitedInformation) != 0 ||
+ (_provider.ProcessAccess & ProcessAccess.QueryInformation) != 0)
+ phandle = _provider.ProcessHandle;
+ }
+ else
+ {
+ if ((_provider.ProcessAccess & (ProcessAccess.QueryInformation | ProcessAccess.VmRead)) != 0)
+ phandle = _provider.ProcessHandle;
+ }
+
// If we have KPH load kernel modules so we can get the kernel-mode stack.
try
{
@@ -684,7 +742,7 @@ namespace ProcessHacker.Components
// Special case for system threads.
if (
- // KProcessHacker.Instance != null &&
+ KProcessHacker.Instance != null &&
_pid == 4
)
{
@@ -723,19 +781,21 @@ namespace ProcessHacker.Components
return;
if (Program.ElevationType == TokenElevationType.Limited &&
+ KProcessHacker.Instance == null &&
Settings.Instance.ElevationLevel != (int)ElevationLevel.Never)
{
try
{
foreach (ListViewItem item in listThreads.SelectedItems)
{
- using (var thandle = new ThreadHandle(int.Parse(item.SubItems[0].Text), ThreadAccess.Terminate))
+ using (var thandle = new ThreadHandle(int.Parse(item.SubItems[0].Text),
+ ThreadAccess.Terminate))
{ }
}
}
catch
{
- string objects = string.Empty;
+ string objects = "";
foreach (ListViewItem item in listThreads.SelectedItems)
objects += item.SubItems[0].Text + ",";
@@ -808,24 +868,28 @@ namespace ProcessHacker.Components
// return;
//}
- if (Program.ElevationType == TokenElevationType.Limited && Settings.Instance.ElevationLevel != (int)ElevationLevel.Never)
+ if (Program.ElevationType == TokenElevationType.Limited &&
+ KProcessHacker.Instance == null &&
+ Settings.Instance.ElevationLevel != (int)ElevationLevel.Never)
{
try
{
foreach (ListViewItem item in listThreads.SelectedItems)
{
- using (var thandle = new ThreadHandle(int.Parse(item.SubItems[0].Text), ThreadAccess.SuspendResume))
+ using (var thandle = new ThreadHandle(int.Parse(item.SubItems[0].Text),
+ ThreadAccess.SuspendResume))
{ }
}
}
catch
{
- string objects = string.Empty;
+ string objects = "";
foreach (ListViewItem item in listThreads.SelectedItems)
objects += item.SubItems[0].Text + ",";
- Program.StartProcessHackerAdmin("-e -type thread -action suspend -obj \"" + objects + "\" -hwnd " + this.Handle.ToString(), null, this.Handle);
+ Program.StartProcessHackerAdmin("-e -type thread -action suspend -obj \"" +
+ objects + "\" -hwnd " + this.Handle.ToString(), null, this.Handle);
return;
}
@@ -835,7 +899,8 @@ namespace ProcessHacker.Components
{
try
{
- using (var thandle = new ThreadHandle(Int32.Parse(item.SubItems[0].Text), ThreadAccess.SuspendResume))
+ using (var thandle = new ThreadHandle(Int32.Parse(item.SubItems[0].Text),
+ ThreadAccess.SuspendResume))
thandle.Suspend();
}
catch (Exception ex)
@@ -861,7 +926,9 @@ namespace ProcessHacker.Components
// return;
//}
- if (Program.ElevationType == TokenElevationType.Limited && Settings.Instance.ElevationLevel != (int)ElevationLevel.Never)
+ if (Program.ElevationType == TokenElevationType.Limited &&
+ KProcessHacker.Instance == null &&
+ Settings.Instance.ElevationLevel != (int)ElevationLevel.Never)
{
try
{
@@ -874,7 +941,7 @@ namespace ProcessHacker.Components
}
catch
{
- string objects = string.Empty;
+ string objects = "";
foreach (ListViewItem item in listThreads.SelectedItems)
objects += item.SubItems[0].Text + ",";
@@ -889,7 +956,8 @@ namespace ProcessHacker.Components
{
try
{
- using (ThreadHandle thandle = new ThreadHandle(Int32.Parse(item.SubItems[0].Text), ThreadAccess.SuspendResume))
+ using (var thandle = new ThreadHandle(Int32.Parse(item.SubItems[0].Text),
+ ThreadAccess.SuspendResume))
thandle.Resume();
}
catch (Exception ex)
@@ -917,12 +985,20 @@ namespace ProcessHacker.Components
{
IntPtr tebBaseAddress = thandle.GetBasicInformation().TebBaseAddress;
- Program.HackerWindow.BeginInvoke(new MethodInvoker(() =>
- {
- StructWindow sw = new StructWindow(this._pid, tebBaseAddress, Program.Structs["TEB"]);
- sw.Show();
- sw.Activate();
- }));
+ Program.HackerWindow.BeginInvoke(new MethodInvoker(delegate
+ {
+ StructWindow sw = new StructWindow(_pid, tebBaseAddress, Program.Structs["TEB"]);
+
+ try
+ {
+ sw.Show();
+ sw.Activate();
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
+ }
+ }));
}
}
catch (Exception ex)
@@ -938,7 +1014,7 @@ namespace ProcessHacker.Components
SecurityEditor.EditSecurity(
this,
SecurityEditor.GetSecurableWrapper(
- access => new ThreadHandle(int.Parse(listThreads.SelectedItems[0].Text), (ThreadAccess)access)
+ (access) => new ThreadHandle(int.Parse(listThreads.SelectedItems[0].Text), (ThreadAccess)access)
),
"Thread " + listThreads.SelectedItems[0].Text,
NativeTypeFactory.GetAccessEntries(NativeTypeFactory.ObjectType.Thread)
@@ -954,13 +1030,18 @@ namespace ProcessHacker.Components
{
try
{
- using (ThreadHandle thandle = new ThreadHandle(int.Parse(listThreads.SelectedItems[0].Text), Program.MinThreadQueryRights))
- using (TokenWindow tokForm = new TokenWindow(thandle))
+ using (ThreadHandle thandle = new ThreadHandle(
+ int.Parse(listThreads.SelectedItems[0].Text), Program.MinThreadQueryRights
+ ))
{
+ TokenWindow tokForm = new TokenWindow(thandle);
+
tokForm.Text = "Thread Token";
tokForm.ShowDialog();
}
}
+ catch (ObjectDisposedException)
+ { }
catch (Exception ex)
{
PhUtils.ShowException("Unable to view the thread token", ex);
@@ -1006,287 +1087,287 @@ namespace ProcessHacker.Components
{
StringBuilder sb = new StringBuilder();
int tid = int.Parse(listThreads.SelectedItems[0].SubItems[0].Text);
- ProcessHandle phandle;
+ ProcessHandle phandle = null;
if ((_provider.ProcessAccess & (ProcessAccess.QueryInformation | ProcessAccess.VmRead)) != 0)
phandle = _provider.ProcessHandle;
else
phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation | ProcessAccess.VmRead);
- //ProcessHandle processDupHandle = new ProcessHandle(_pid, ProcessAccess.DupHandle);
+ ProcessHandle processDupHandle = new ProcessHandle(_pid, ProcessAccess.DupHandle);
bool found = false;
- using (ThreadHandle thandle = new ThreadHandle(tid, ThreadAccess.GetContext | ThreadAccess.SuspendResume))
+ using (var thandle = new ThreadHandle(tid, ThreadAccess.GetContext | ThreadAccess.SuspendResume))
{
IntPtr[] lastParams = new IntPtr[4];
- thandle.WalkStack(phandle, stackFrame =>
- {
- uint address = stackFrame.PcAddress.ToUInt32();
- string name = _provider.Symbols.GetSymbolFromAddress(address).ToLowerInvariant();
-
- if (string.IsNullOrEmpty(name))
+ thandle.WalkStack(phandle, (stackFrame) =>
{
- // dummy
- }
- else if (
- name.StartsWith("kernel32.dll!sleep", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
+ uint address = stackFrame.PcAddress.ToUInt32();
+ string name = _provider.Symbols.GetSymbolFromAddress(address).ToLowerInvariant();
- sb.Append("Thread is sleeping. Timeout: " +
- stackFrame.Params[0].ToInt32().ToString() + " milliseconds");
- }
- else if (
- name.StartsWith("ntdll.dll!zwdelayexecution", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntdelayexecution", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- //bool alertable = stackFrame.Params[0].ToInt32() != 0;
- IntPtr timeoutAddress = stackFrame.Params[1];
- long timeout;
-
- phandle.ReadMemory(timeoutAddress, &timeout, sizeof(long));
-
- if (timeout < 0)
+ if (name == null)
{
+ // dummy
+ }
+ else if (
+ name.StartsWith("kernel32.dll!sleep")
+ )
+ {
+ found = true;
+
sb.Append("Thread is sleeping. Timeout: " +
- (new TimeSpan(-timeout)).TotalMilliseconds.ToString() + " milliseconds");
+ stackFrame.Params[0].ToInt32().ToString() + " milliseconds");
}
- else
+ else if (
+ name.StartsWith("ntdll.dll!zwdelayexecution") ||
+ name.StartsWith("ntdll.dll!ntdelayexecution")
+ )
{
- sb.AppendLine("Thread is sleeping. Timeout: " + (new DateTime(timeout)).ToString());
+ found = true;
+
+ bool alertable = stackFrame.Params[0].ToInt32() != 0;
+ IntPtr timeoutAddress = stackFrame.Params[1];
+ long timeout;
+
+ phandle.ReadMemory(timeoutAddress, &timeout, sizeof(long));
+
+ if (timeout < 0)
+ {
+ sb.Append("Thread is sleeping. Timeout: " +
+ (new TimeSpan(-timeout)).TotalMilliseconds.ToString() + " milliseconds");
+ }
+ else
+ {
+ sb.AppendLine("Thread is sleeping. Timeout: " + (new DateTime(timeout)).ToString());
+ }
}
- }
- else if (
- name.StartsWith("ntdll.dll!zwdeviceiocontrolfile", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntdeviceiocontrolfile", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for an I/O control request:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!ntfscontrolfile", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwfscontrolfile", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for an FS control request:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!ntqueryobject", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwqueryobject", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- // Use the KiFastSystemCallRet args if the handle we have is wrong.
- if (handle.ToInt32() % 2 != 0 || handle == IntPtr.Zero)
- handle = lastParams[1];
-
- sb.AppendLine("Thread " + tid.ToString() + " is querying an object (most likely a named pipe):");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!zwreadfile", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntreadfile", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwwritefile", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwritefile", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for a named pipe or a file:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!zwremoveiocompletion", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntremoveiocompletion", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for an I/O completion object:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!zwreplywaitreceiveport", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntreplywaitreceiveport", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwrequestwaitreplyport", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntrequestwaitreplyport", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwalpcsendwaitreceiveport", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntalpcsendwaitreceiveport", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for a LPC port:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if
- (
- name.StartsWith("ntdll.dll!zwsethighwaitloweventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntsethighwaitloweventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwsetlowwaithigheventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntsetlowwaithigheventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwwaithigheventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaithigheventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwwaitloweventpair", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaitloweventpair", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- // Use the KiFastSystemCallRet args if the handle we have is wrong.
- if (handle.ToInt32() % 2 != 0)
- handle = lastParams[1];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting (" + name + ") for an event pair:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("user32.dll!ntusergetmessage", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("user32.dll!ntuserwaitmessage", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for a USER message.");
- }
- else if (
- name.StartsWith("ntdll.dll!zwwaitfordebugevent", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaitfordebugevent", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
-
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for a debug event:");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!zwwaitforkeyedevent", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaitforkeyedevent", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!zwreleasekeyedevent", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntreleasekeyedevent", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- IntPtr handle = stackFrame.Params[0];
- IntPtr key = stackFrame.Params[1];
-
- sb.AppendLine("Thread " + tid.ToString() +
- " is waiting (" + name + ") for a keyed event (key 0x" +
- key.ToString("x") + "):");
-
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!zwwaitformultipleobjects", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaitformultipleobjects", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("kernel32.dll!waitformultipleobjects", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
-
- int handleCount = stackFrame.Params[0].ToInt32();
- IntPtr handleAddress = stackFrame.Params[1];
- WaitType waitType = (WaitType)stackFrame.Params[2].ToInt32();
- bool alertable = stackFrame.Params[3].ToInt32() != 0;
-
- // use the KiFastSystemCallRet args if we have the wrong args
- if (handleCount > 64)
+ else if (
+ name.StartsWith("ntdll.dll!zwdeviceiocontrolfile") ||
+ name.StartsWith("ntdll.dll!ntdeviceiocontrolfile")
+ )
{
- handleCount = lastParams[1].ToInt32();
- handleAddress = lastParams[2];
- waitType = (WaitType)lastParams[3].ToInt32();
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for an I/O control request:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
}
-
- IntPtr* handles = stackalloc IntPtr[handleCount];
-
- phandle.ReadMemory(handleAddress, handles, handleCount * IntPtr.Size);
-
- sb.AppendLine("Thread " + tid.ToString() +
- " is waiting (alertable: " + alertable.ToString() + ", wait type: " +
- waitType.ToString() + ") for:");
-
- for (int i = 0; i < handleCount; i++)
+ else if (
+ name.StartsWith("ntdll.dll!ntfscontrolfile") ||
+ name.StartsWith("ntdll.dll!zwfscontrolfile")
+ )
{
- sb.AppendLine(this.GetHandleString(_pid, handles[i]));
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for an FS control request:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
}
- }
- else if (
- name.StartsWith("ntdll.dll!zwwaitforsingleobject", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaitforsingleobject", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("kernel32.dll!waitforsingleobject", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
+ else if (
+ name.StartsWith("ntdll.dll!ntqueryobject") ||
+ name.StartsWith("ntdll.dll!zwqueryobject")
+ )
+ {
+ found = true;
- IntPtr handle = stackFrame.Params[0];
- bool alertable = stackFrame.Params[1].ToInt32() != 0;
+ IntPtr handle = stackFrame.Params[0];
- sb.AppendLine("Thread " + tid.ToString() +
- " is waiting (alertable: " + alertable.ToString() + ") for:");
+ // Use the KiFastSystemCallRet args if the handle we have is wrong.
+ if (handle.ToInt32() % 2 != 0 || handle == IntPtr.Zero)
+ handle = lastParams[1];
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
- else if (
- name.StartsWith("ntdll.dll!zwwaitforworkviaworkerfactory", StringComparison.OrdinalIgnoreCase) ||
- name.StartsWith("ntdll.dll!ntwaitforworkviaworkerfactory", StringComparison.OrdinalIgnoreCase)
- )
- {
- found = true;
+ sb.AppendLine("Thread " + tid.ToString() + " is querying an object (most likely a named pipe):");
- IntPtr handle = stackFrame.Params[0];
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwreadfile") ||
+ name.StartsWith("ntdll.dll!ntreadfile") ||
+ name.StartsWith("ntdll.dll!zwwritefile") ||
+ name.StartsWith("ntdll.dll!ntwritefile")
+ )
+ {
+ found = true;
- sb.AppendLine("Thread " + tid.ToString() + " is waiting for work from a worker factory:");
+ IntPtr handle = stackFrame.Params[0];
- sb.AppendLine(this.GetHandleString(_pid, handle));
- }
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for a named pipe or a file:");
- lastParams = stackFrame.Params;
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwremoveiocompletion") ||
+ name.StartsWith("ntdll.dll!ntremoveiocompletion")
+ )
+ {
+ found = true;
- return !found;
- });
+ IntPtr handle = stackFrame.Params[0];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for an I/O completion object:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwreplywaitreceiveport") ||
+ name.StartsWith("ntdll.dll!ntreplywaitreceiveport") ||
+ name.StartsWith("ntdll.dll!zwrequestwaitreplyport") ||
+ name.StartsWith("ntdll.dll!ntrequestwaitreplyport") ||
+ name.StartsWith("ntdll.dll!zwalpcsendwaitreceiveport") ||
+ name.StartsWith("ntdll.dll!ntalpcsendwaitreceiveport")
+ )
+ {
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for a LPC port:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if
+ (
+ name.StartsWith("ntdll.dll!zwsethighwaitloweventpair") ||
+ name.StartsWith("ntdll.dll!ntsethighwaitloweventpair") ||
+ name.StartsWith("ntdll.dll!zwsetlowwaithigheventpair") ||
+ name.StartsWith("ntdll.dll!ntsetlowwaithigheventpair") ||
+ name.StartsWith("ntdll.dll!zwwaithigheventpair") ||
+ name.StartsWith("ntdll.dll!ntwaithigheventpair") ||
+ name.StartsWith("ntdll.dll!zwwaitloweventpair") ||
+ name.StartsWith("ntdll.dll!ntwaitloweventpair")
+ )
+ {
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+
+ // Use the KiFastSystemCallRet args if the handle we have is wrong.
+ if (handle.ToInt32() % 2 != 0)
+ handle = lastParams[1];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting (" + name + ") for an event pair:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("user32.dll!ntusergetmessage") ||
+ name.StartsWith("user32.dll!ntuserwaitmessage")
+ )
+ {
+ found = true;
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for a USER message.");
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwwaitfordebugevent") ||
+ name.StartsWith("ntdll.dll!ntwaitfordebugevent")
+ )
+ {
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for a debug event:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwwaitforkeyedevent") ||
+ name.StartsWith("ntdll.dll!ntwaitforkeyedevent") ||
+ name.StartsWith("ntdll.dll!zwreleasekeyedevent") ||
+ name.StartsWith("ntdll.dll!ntreleasekeyedevent")
+ )
+ {
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+ IntPtr key = stackFrame.Params[1];
+
+ sb.AppendLine("Thread " + tid.ToString() +
+ " is waiting (" + name + ") for a keyed event (key 0x" +
+ key.ToString("x") + "):");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwwaitformultipleobjects") ||
+ name.StartsWith("ntdll.dll!ntwaitformultipleobjects") ||
+ name.StartsWith("kernel32.dll!waitformultipleobjects")
+ )
+ {
+ found = true;
+
+ int handleCount = stackFrame.Params[0].ToInt32();
+ IntPtr handleAddress = stackFrame.Params[1];
+ WaitType waitType = (WaitType)stackFrame.Params[2].ToInt32();
+ bool alertable = stackFrame.Params[3].ToInt32() != 0;
+
+ // use the KiFastSystemCallRet args if we have the wrong args
+ if (handleCount > 64)
+ {
+ handleCount = lastParams[1].ToInt32();
+ handleAddress = lastParams[2];
+ waitType = (WaitType)lastParams[3].ToInt32();
+ }
+
+ IntPtr* handles = stackalloc IntPtr[handleCount];
+
+ phandle.ReadMemory(handleAddress, handles, handleCount * IntPtr.Size);
+
+ sb.AppendLine("Thread " + tid.ToString() +
+ " is waiting (alertable: " + alertable.ToString() + ", wait type: " +
+ waitType.ToString() + ") for:");
+
+ for (int i = 0; i < handleCount; i++)
+ {
+ sb.AppendLine(this.GetHandleString(_pid, handles[i]));
+ }
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwwaitforsingleobject") ||
+ name.StartsWith("ntdll.dll!ntwaitforsingleobject") ||
+ name.StartsWith("kernel32.dll!waitforsingleobject")
+ )
+ {
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+ bool alertable = stackFrame.Params[1].ToInt32() != 0;
+
+ sb.AppendLine("Thread " + tid.ToString() +
+ " is waiting (alertable: " + alertable.ToString() + ") for:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+ else if (
+ name.StartsWith("ntdll.dll!zwwaitforworkviaworkerfactory") ||
+ name.StartsWith("ntdll.dll!ntwaitforworkviaworkerfactory")
+ )
+ {
+ found = true;
+
+ IntPtr handle = stackFrame.Params[0];
+
+ sb.AppendLine("Thread " + tid.ToString() + " is waiting for work from a worker factory:");
+
+ sb.AppendLine(this.GetHandleString(_pid, handle));
+ }
+
+ lastParams = stackFrame.Params;
+
+ return !found;
+ });
}
if (found)
{
- new InformationBox(sb.ToString()).ShowDialog();
+ ScratchpadWindow.Create(sb.ToString());
}
else
{
@@ -1366,7 +1447,7 @@ namespace ProcessHacker.Components
private void selectAllThreadMenuItem_Click(object sender, EventArgs e)
{
- this.listThreads.Items.SelectAll();
+ Utils.SelectAll(listThreads.Items);
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/ThreadList.resx b/1.x/trunk/ProcessHacker/Components/ThreadList.resx
index b6e44613c..65a9bbfba 100644
--- a/1.x/trunk/ProcessHacker/Components/ThreadList.resx
+++ b/1.x/trunk/ProcessHacker/Components/ThreadList.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
125, 17
+
+ 17, 17
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TimerProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/TimerProperties.Designer.cs
index 74840966a..d803079f0 100644
--- a/1.x/trunk/ProcessHacker/Components/TimerProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/TimerProperties.Designer.cs
@@ -50,7 +50,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 3);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(55, 13);
+ this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Signaled:";
//
@@ -69,7 +69,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 25);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(91, 13);
+ this.label3.Size = new System.Drawing.Size(86, 13);
this.label3.TabIndex = 0;
this.label3.Text = "Time Remaining:";
this.label3.Visible = false;
@@ -79,7 +79,7 @@
this.labelSignaled.AutoSize = true;
this.labelSignaled.Location = new System.Drawing.Point(98, 3);
this.labelSignaled.Name = "labelSignaled";
- this.labelSignaled.Size = new System.Drawing.Size(33, 13);
+ this.labelSignaled.Size = new System.Drawing.Size(32, 13);
this.labelSignaled.TabIndex = 1;
this.labelSignaled.Text = "False";
//
@@ -98,7 +98,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.labelSignaled);
this.Controls.Add(this.labelTimeRemaining);
diff --git a/1.x/trunk/ProcessHacker/Components/TimerProperties.cs b/1.x/trunk/ProcessHacker/Components/TimerProperties.cs
index a5b60295e..ad7164745 100644
--- a/1.x/trunk/ProcessHacker/Components/TimerProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/TimerProperties.cs
@@ -8,7 +8,7 @@ namespace ProcessHacker.Components
{
public partial class TimerProperties : UserControl
{
- private readonly TimerHandle _timerHandle;
+ private TimerHandle _timerHandle;
public TimerProperties(TimerHandle timerHandle)
{
@@ -24,7 +24,7 @@ namespace ProcessHacker.Components
{
try
{
- var basicInfo = _timerHandle.BasicInformation;
+ var basicInfo = _timerHandle.GetBasicInformation();
labelSignaled.Text = basicInfo.TimerState.ToString();
labelTimeRemaining.Text = (new TimeSpan(-basicInfo.RemainingTime)).ToString();
diff --git a/1.x/trunk/ProcessHacker/Components/TimerProperties.resx b/1.x/trunk/ProcessHacker/Components/TimerProperties.resx
index bfd9c479b..3add4121b 100644
--- a/1.x/trunk/ProcessHacker/Components/TimerProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/TimerProperties.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TmRmProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/TmRmProperties.Designer.cs
index 4316da35f..e022334d4 100644
--- a/1.x/trunk/ProcessHacker/Components/TmRmProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/TmRmProperties.Designer.cs
@@ -42,7 +42,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 9);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(69, 13);
+ this.label1.Size = new System.Drawing.Size(63, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Description:";
//
@@ -57,29 +57,28 @@
//
// textDescription
//
- this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textDescription.Location = new System.Drawing.Point(75, 6);
this.textDescription.Name = "textDescription";
this.textDescription.ReadOnly = true;
- this.textDescription.Size = new System.Drawing.Size(252, 22);
+ this.textDescription.Size = new System.Drawing.Size(252, 20);
this.textDescription.TabIndex = 1;
//
// textGuid
//
- this.textGuid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textGuid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textGuid.Location = new System.Drawing.Point(49, 32);
this.textGuid.Name = "textGuid";
this.textGuid.ReadOnly = true;
- this.textGuid.Size = new System.Drawing.Size(278, 22);
+ this.textGuid.Size = new System.Drawing.Size(278, 20);
this.textGuid.TabIndex = 1;
//
// TmRmProperties
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.textGuid);
this.Controls.Add(this.textDescription);
this.Controls.Add(this.label2);
diff --git a/1.x/trunk/ProcessHacker/Components/TmRmProperties.cs b/1.x/trunk/ProcessHacker/Components/TmRmProperties.cs
index a981cd548..20db152ad 100644
--- a/1.x/trunk/ProcessHacker/Components/TmRmProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/TmRmProperties.cs
@@ -1,4 +1,9 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
using System.Windows.Forms;
using ProcessHacker.Native.Objects;
@@ -6,7 +11,7 @@ namespace ProcessHacker.Components
{
public partial class TmRmProperties : UserControl
{
- private readonly ResourceManagerHandle _rmHandle;
+ private ResourceManagerHandle _rmHandle;
public TmRmProperties(ResourceManagerHandle rmHandle)
{
@@ -22,8 +27,8 @@ namespace ProcessHacker.Components
{
try
{
- textDescription.Text = _rmHandle.Description;
- textGuid.Text = _rmHandle.Guid.ToString("B");
+ textDescription.Text = _rmHandle.GetDescription();
+ textGuid.Text = _rmHandle.GetGuid().ToString("B");
}
catch (Exception ex)
{
diff --git a/1.x/trunk/ProcessHacker/Components/TmRmProperties.resx b/1.x/trunk/ProcessHacker/Components/TmRmProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/TmRmProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/TmRmProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TmTmProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/TmTmProperties.Designer.cs
index e6bee1e3c..2dfb45364 100644
--- a/1.x/trunk/ProcessHacker/Components/TmTmProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/TmTmProperties.Designer.cs
@@ -48,12 +48,12 @@
//
// textGuid
//
- this.textGuid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textGuid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textGuid.Location = new System.Drawing.Point(49, 6);
this.textGuid.Name = "textGuid";
this.textGuid.ReadOnly = true;
- this.textGuid.Size = new System.Drawing.Size(244, 22);
+ this.textGuid.Size = new System.Drawing.Size(244, 20);
this.textGuid.TabIndex = 1;
//
// label2
@@ -61,25 +61,24 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 35);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(82, 13);
+ this.label2.Size = new System.Drawing.Size(78, 13);
this.label2.TabIndex = 0;
this.label2.Text = "Log File Name:";
//
// textLogFileName
//
- this.textLogFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textLogFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textLogFileName.Location = new System.Drawing.Point(90, 32);
this.textLogFileName.Name = "textLogFileName";
this.textLogFileName.ReadOnly = true;
- this.textLogFileName.Size = new System.Drawing.Size(203, 22);
+ this.textLogFileName.Size = new System.Drawing.Size(203, 20);
this.textLogFileName.TabIndex = 1;
//
// TmTmProperties
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.textLogFileName);
this.Controls.Add(this.textGuid);
this.Controls.Add(this.label2);
diff --git a/1.x/trunk/ProcessHacker/Components/TmTmProperties.cs b/1.x/trunk/ProcessHacker/Components/TmTmProperties.cs
index 117196aa9..6b6ad3bc7 100644
--- a/1.x/trunk/ProcessHacker/Components/TmTmProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/TmTmProperties.cs
@@ -1,4 +1,9 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
using System.Windows.Forms;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native;
@@ -7,7 +12,7 @@ namespace ProcessHacker.Components
{
public partial class TmTmProperties : UserControl
{
- private readonly TmHandle _tmHandle;
+ private TmHandle _tmHandle;
public TmTmProperties(TmHandle tmHandle)
{
@@ -23,8 +28,8 @@ namespace ProcessHacker.Components
{
try
{
- textGuid.Text = _tmHandle.BasicInformation.TmIdentity.ToString("B");
- textLogFileName.Text = FileUtils.GetFileName(FileUtils.GetFileName(_tmHandle.LogFileName));
+ textGuid.Text = _tmHandle.GetBasicInformation().TmIdentity.ToString("B");
+ textLogFileName.Text = FileUtils.GetFileName(FileUtils.GetFileName(_tmHandle.GetLogFileName()));
}
catch (Exception ex)
{
diff --git a/1.x/trunk/ProcessHacker/Components/TmTmProperties.resx b/1.x/trunk/ProcessHacker/Components/TmTmProperties.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/TmTmProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/TmTmProperties.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TokenGroupsList.Designer.cs b/1.x/trunk/ProcessHacker/Components/TokenGroupsList.Designer.cs
index ea9ca5c04..120f3f5d5 100644
--- a/1.x/trunk/ProcessHacker/Components/TokenGroupsList.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/TokenGroupsList.Designer.cs
@@ -28,9 +28,9 @@
///
private void InitializeComponent()
{
- this.listGroups = new ProcessHacker.Components.ExtendedListView();
- this.columnGroupName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnFlags = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listGroups = new System.Windows.Forms.ListView();
+ this.columnGroupName = new System.Windows.Forms.ColumnHeader();
+ this.columnFlags = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// listGroups
@@ -40,12 +40,11 @@
this.columnGroupName,
this.columnFlags});
this.listGroups.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listGroups.DoubleClickChecks = true;
this.listGroups.FullRowSelect = true;
this.listGroups.Location = new System.Drawing.Point(0, 0);
this.listGroups.Name = "listGroups";
this.listGroups.ShowItemToolTips = true;
- this.listGroups.Size = new System.Drawing.Size(416, 397);
+ this.listGroups.Size = new System.Drawing.Size(431, 397);
this.listGroups.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listGroups.TabIndex = 4;
this.listGroups.UseCompatibleStateImageBehavior = false;
@@ -61,21 +60,20 @@
this.columnFlags.Text = "Flags";
this.columnFlags.Width = 180;
//
- // TokenGroupsList
+ // TokenGroups
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.listGroups);
- this.Name = "TokenGroupsList";
- this.Size = new System.Drawing.Size(416, 397);
+ this.Name = "TokenGroups";
+ this.Size = new System.Drawing.Size(431, 397);
this.ResumeLayout(false);
}
#endregion
- private ExtendedListView listGroups;
+ private System.Windows.Forms.ListView listGroups;
private System.Windows.Forms.ColumnHeader columnGroupName;
private System.Windows.Forms.ColumnHeader columnFlags;
}
diff --git a/1.x/trunk/ProcessHacker/Components/TokenGroupsList.cs b/1.x/trunk/ProcessHacker/Components/TokenGroupsList.cs
index 9c3acb4e9..2af0f40cd 100644
--- a/1.x/trunk/ProcessHacker/Components/TokenGroupsList.cs
+++ b/1.x/trunk/ProcessHacker/Components/TokenGroupsList.cs
@@ -38,17 +38,18 @@ namespace ProcessHacker.Components
if (groups != null)
{
- foreach (Sid t in groups)
+ for (int i = 0; i < groups.Length; i++)
{
- ListViewItem item = this.listGroups.Items.Add(new ListViewItem());
+ ListViewItem item = listGroups.Items.Add(new ListViewItem());
- item.Text = t.GetFullName(Settings.Instance.ShowAccountDomains);
- item.BackColor = this.GetAttributeColor(t.Attributes);
- item.SubItems.Add(new ListViewItem.ListViewSubItem(item, this.GetAttributeString(t.Attributes)));
+ item.Text = groups[i].GetFullName(Settings.Instance.ShowAccountDomains);
+ item.BackColor = GetAttributeColor(groups[i].Attributes);
+ item.SubItems.Add(new ListViewItem.ListViewSubItem(item, GetAttributeString(groups[i].Attributes)));
}
}
listGroups.ListViewItemSorter = new SortedListViewComparer(listGroups);
+ listGroups.SetDoubleBuffered(true);
listGroups.ContextMenu = listGroups.GetCopyMenu();
ColumnSettings.LoadSettings(Settings.Instance.GroupListColumns, listGroups);
listGroups.AddShortcuts();
@@ -70,17 +71,16 @@ namespace ProcessHacker.Components
private string GetAttributeString(SidAttributes Attributes)
{
- string text = string.Empty;
+ string text = "";
if ((Attributes & SidAttributes.Integrity) != 0)
{
if ((Attributes & SidAttributes.IntegrityEnabled) != 0)
return "Integrity";
-
- return "Integrity (Disabled)";
+ else
+ return "Integrity (Disabled)";
}
-
- if ((Attributes & SidAttributes.LogonId) != 0)
+ else if ((Attributes & SidAttributes.LogonId) != 0)
text = "Logon ID";
else if ((Attributes & SidAttributes.Mandatory) != 0)
text = "Mandatory";
@@ -93,11 +93,10 @@ namespace ProcessHacker.Components
if ((Attributes & SidAttributes.EnabledByDefault) != 0)
return text + " (Default Enabled)";
-
- if ((Attributes & SidAttributes.Enabled) != 0)
+ else if ((Attributes & SidAttributes.Enabled) != 0)
return text;
-
- return text + " (Disabled)";
+ else
+ return text + " (Disabled)";
}
private Color GetAttributeColor(SidAttributes Attributes)
@@ -106,17 +105,16 @@ namespace ProcessHacker.Components
{
if ((Attributes & SidAttributes.IntegrityEnabled) == 0)
return Color.FromArgb(0xe0e0e0);
-
- return Color.White;
+ else
+ return Color.White;
}
if ((Attributes & SidAttributes.EnabledByDefault) != 0)
return Color.FromArgb(0xe0f0e0);
-
- if ((Attributes & SidAttributes.Enabled) != 0)
+ else if ((Attributes & SidAttributes.Enabled) != 0)
return Color.White;
-
- return Color.FromArgb(0xf0e0e0);
+ else
+ return Color.FromArgb(0xf0e0e0);
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Components/TokenGroupsList.resx b/1.x/trunk/ProcessHacker/Components/TokenGroupsList.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Components/TokenGroupsList.resx
+++ b/1.x/trunk/ProcessHacker/Components/TokenGroupsList.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TokenProperties.Designer.cs b/1.x/trunk/ProcessHacker/Components/TokenProperties.Designer.cs
index 7af872ded..42dcc3850 100644
--- a/1.x/trunk/ProcessHacker/Components/TokenProperties.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Components/TokenProperties.Designer.cs
@@ -32,6 +32,7 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.tabControl = new System.Windows.Forms.TabControl();
this.tabGeneral = new System.Windows.Forms.TabPage();
this.groupSource = new System.Windows.Forms.GroupBox();
@@ -71,10 +72,10 @@
this.label4 = new System.Windows.Forms.Label();
this.tabGroups = new System.Windows.Forms.TabPage();
this.tabPrivileges = new System.Windows.Forms.TabPage();
- this.listPrivileges = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnDesc = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listPrivileges = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnStatus = new System.Windows.Forms.ColumnHeader();
+ this.columnDesc = new System.Windows.Forms.ColumnHeader();
this.enableMenuItem = new System.Windows.Forms.MenuItem();
this.disableMenuItem = new System.Windows.Forms.MenuItem();
this.removeMenuItem = new System.Windows.Forms.MenuItem();
@@ -82,12 +83,14 @@
this.menuPrivileges = new System.Windows.Forms.ContextMenu();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.selectAllMenuItem = new System.Windows.Forms.MenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
this.groupSource.SuspendLayout();
this.groupToken.SuspendLayout();
this.tabAdvanced.SuspendLayout();
this.tabPrivileges.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// tabControl
@@ -100,7 +103,7 @@
this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
- this.tabControl.Size = new System.Drawing.Size(431, 433);
+ this.tabControl.Size = new System.Drawing.Size(575, 433);
this.tabControl.TabIndex = 3;
//
// tabGeneral
@@ -111,22 +114,22 @@
this.tabGeneral.Location = new System.Drawing.Point(4, 22);
this.tabGeneral.Name = "tabGeneral";
this.tabGeneral.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
- this.tabGeneral.Size = new System.Drawing.Size(423, 407);
+ this.tabGeneral.Size = new System.Drawing.Size(567, 407);
this.tabGeneral.TabIndex = 2;
this.tabGeneral.Text = "General";
this.tabGeneral.UseVisualStyleBackColor = true;
//
// groupSource
//
- this.groupSource.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupSource.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupSource.Controls.Add(this.label7);
this.groupSource.Controls.Add(this.label6);
this.groupSource.Controls.Add(this.textSourceName);
this.groupSource.Controls.Add(this.textSourceLUID);
this.groupSource.Location = new System.Drawing.Point(6, 247);
this.groupSource.Name = "groupSource";
- this.groupSource.Size = new System.Drawing.Size(411, 75);
+ this.groupSource.Size = new System.Drawing.Size(555, 75);
this.groupSource.TabIndex = 15;
this.groupSource.TabStop = false;
this.groupSource.Text = "Source";
@@ -136,7 +139,7 @@
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 48);
this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(34, 13);
+ this.label7.Size = new System.Drawing.Size(35, 13);
this.label7.TabIndex = 3;
this.label7.Text = "LUID:";
//
@@ -145,18 +148,18 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 22);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(39, 13);
+ this.label6.Size = new System.Drawing.Size(38, 13);
this.label6.TabIndex = 2;
this.label6.Text = "Name:";
//
// textSourceName
//
- this.textSourceName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textSourceName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textSourceName.Location = new System.Drawing.Point(73, 19);
this.textSourceName.Name = "textSourceName";
this.textSourceName.ReadOnly = true;
- this.textSourceName.Size = new System.Drawing.Size(332, 22);
+ this.textSourceName.Size = new System.Drawing.Size(476, 20);
this.textSourceName.TabIndex = 1;
//
// textSourceLUID
@@ -164,13 +167,13 @@
this.textSourceLUID.Location = new System.Drawing.Point(73, 45);
this.textSourceLUID.Name = "textSourceLUID";
this.textSourceLUID.ReadOnly = true;
- this.textSourceLUID.Size = new System.Drawing.Size(109, 22);
+ this.textSourceLUID.Size = new System.Drawing.Size(109, 20);
this.textSourceLUID.TabIndex = 4;
//
// groupToken
//
- this.groupToken.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupToken.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupToken.Controls.Add(this.buttonPermissions);
this.groupToken.Controls.Add(this.label9);
this.groupToken.Controls.Add(this.label1);
@@ -189,7 +192,7 @@
this.groupToken.Controls.Add(this.textUserSID);
this.groupToken.Location = new System.Drawing.Point(6, 8);
this.groupToken.Name = "groupToken";
- this.groupToken.Size = new System.Drawing.Size(411, 233);
+ this.groupToken.Size = new System.Drawing.Size(555, 233);
this.groupToken.TabIndex = 14;
this.groupToken.TabStop = false;
this.groupToken.Text = "Token";
@@ -198,7 +201,7 @@
//
this.buttonPermissions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonPermissions.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonPermissions.Location = new System.Drawing.Point(330, 201);
+ this.buttonPermissions.Location = new System.Drawing.Point(474, 201);
this.buttonPermissions.Name = "buttonPermissions";
this.buttonPermissions.Size = new System.Drawing.Size(75, 23);
this.buttonPermissions.TabIndex = 18;
@@ -211,7 +214,7 @@
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 100);
this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(83, 13);
+ this.label9.Size = new System.Drawing.Size(76, 13);
this.label9.TabIndex = 17;
this.label9.Text = "Primary Group:";
//
@@ -220,7 +223,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 22);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(33, 13);
+ this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 2;
this.label1.Text = "User:";
//
@@ -237,22 +240,22 @@
//
// textPrimaryGroup
//
- this.textPrimaryGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textPrimaryGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textPrimaryGroup.Location = new System.Drawing.Point(88, 97);
this.textPrimaryGroup.Name = "textPrimaryGroup";
this.textPrimaryGroup.ReadOnly = true;
- this.textPrimaryGroup.Size = new System.Drawing.Size(317, 22);
+ this.textPrimaryGroup.Size = new System.Drawing.Size(461, 20);
this.textPrimaryGroup.TabIndex = 16;
//
// textUser
//
- this.textUser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textUser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textUser.Location = new System.Drawing.Point(88, 19);
this.textUser.Name = "textUser";
this.textUser.ReadOnly = true;
- this.textUser.Size = new System.Drawing.Size(317, 22);
+ this.textUser.Size = new System.Drawing.Size(461, 20);
this.textUser.TabIndex = 1;
//
// textElevated
@@ -260,7 +263,7 @@
this.textElevated.Location = new System.Drawing.Point(88, 149);
this.textElevated.Name = "textElevated";
this.textElevated.ReadOnly = true;
- this.textElevated.Size = new System.Drawing.Size(109, 22);
+ this.textElevated.Size = new System.Drawing.Size(109, 20);
this.textElevated.TabIndex = 12;
//
// label8
@@ -268,18 +271,18 @@
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 74);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(45, 13);
+ this.label8.Size = new System.Drawing.Size(41, 13);
this.label8.TabIndex = 15;
this.label8.Text = "Owner:";
//
// textOwner
//
- this.textOwner.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textOwner.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textOwner.Location = new System.Drawing.Point(88, 71);
this.textOwner.Name = "textOwner";
this.textOwner.ReadOnly = true;
- this.textOwner.Size = new System.Drawing.Size(317, 22);
+ this.textOwner.Size = new System.Drawing.Size(461, 20);
this.textOwner.TabIndex = 14;
//
// label2
@@ -287,18 +290,18 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 126);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(63, 13);
+ this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Session ID:";
//
// textVirtualized
//
- this.textVirtualized.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textVirtualized.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textVirtualized.Location = new System.Drawing.Point(88, 175);
this.textVirtualized.Name = "textVirtualized";
this.textVirtualized.ReadOnly = true;
- this.textVirtualized.Size = new System.Drawing.Size(317, 22);
+ this.textVirtualized.Size = new System.Drawing.Size(461, 20);
this.textVirtualized.TabIndex = 11;
//
// textSessionID
@@ -306,7 +309,7 @@
this.textSessionID.Location = new System.Drawing.Point(88, 123);
this.textSessionID.Name = "textSessionID";
this.textSessionID.ReadOnly = true;
- this.textSessionID.Size = new System.Drawing.Size(109, 22);
+ this.textSessionID.Size = new System.Drawing.Size(109, 20);
this.textSessionID.TabIndex = 4;
//
// labelVirtualization
@@ -314,7 +317,7 @@
this.labelVirtualization.AutoSize = true;
this.labelVirtualization.Location = new System.Drawing.Point(6, 178);
this.labelVirtualization.Name = "labelVirtualization";
- this.labelVirtualization.Size = new System.Drawing.Size(79, 13);
+ this.labelVirtualization.Size = new System.Drawing.Size(69, 13);
this.labelVirtualization.TabIndex = 8;
this.labelVirtualization.Text = "Virtualization:";
//
@@ -332,18 +335,18 @@
this.labelElevated.AutoSize = true;
this.labelElevated.Location = new System.Drawing.Point(6, 152);
this.labelElevated.Name = "labelElevated";
- this.labelElevated.Size = new System.Drawing.Size(53, 13);
+ this.labelElevated.Size = new System.Drawing.Size(52, 13);
this.labelElevated.TabIndex = 7;
this.labelElevated.Text = "Elevated:";
//
// textUserSID
//
- this.textUserSID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textUserSID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textUserSID.Location = new System.Drawing.Point(88, 45);
this.textUserSID.Name = "textUserSID";
this.textUserSID.ReadOnly = true;
- this.textUserSID.Size = new System.Drawing.Size(317, 22);
+ this.textUserSID.Size = new System.Drawing.Size(461, 20);
this.textUserSID.TabIndex = 6;
//
// tabAdvanced
@@ -363,7 +366,7 @@
this.tabAdvanced.Location = new System.Drawing.Point(4, 22);
this.tabAdvanced.Name = "tabAdvanced";
this.tabAdvanced.Padding = new System.Windows.Forms.Padding(3);
- this.tabAdvanced.Size = new System.Drawing.Size(423, 407);
+ this.tabAdvanced.Size = new System.Drawing.Size(567, 407);
this.tabAdvanced.TabIndex = 3;
this.tabAdvanced.Text = "Advanced";
this.tabAdvanced.UseVisualStyleBackColor = true;
@@ -373,7 +376,7 @@
this.textMemoryAvailable.Location = new System.Drawing.Point(118, 136);
this.textMemoryAvailable.Name = "textMemoryAvailable";
this.textMemoryAvailable.ReadOnly = true;
- this.textMemoryAvailable.Size = new System.Drawing.Size(284, 22);
+ this.textMemoryAvailable.Size = new System.Drawing.Size(191, 20);
this.textMemoryAvailable.TabIndex = 1;
//
// textMemoryUsed
@@ -381,7 +384,7 @@
this.textMemoryUsed.Location = new System.Drawing.Point(118, 110);
this.textMemoryUsed.Name = "textMemoryUsed";
this.textMemoryUsed.ReadOnly = true;
- this.textMemoryUsed.Size = new System.Drawing.Size(284, 22);
+ this.textMemoryUsed.Size = new System.Drawing.Size(191, 20);
this.textMemoryUsed.TabIndex = 1;
//
// textAuthenticationId
@@ -389,7 +392,7 @@
this.textAuthenticationId.Location = new System.Drawing.Point(118, 84);
this.textAuthenticationId.Name = "textAuthenticationId";
this.textAuthenticationId.ReadOnly = true;
- this.textAuthenticationId.Size = new System.Drawing.Size(284, 22);
+ this.textAuthenticationId.Size = new System.Drawing.Size(191, 20);
this.textAuthenticationId.TabIndex = 1;
//
// textTokenId
@@ -397,7 +400,7 @@
this.textTokenId.Location = new System.Drawing.Point(118, 58);
this.textTokenId.Name = "textTokenId";
this.textTokenId.ReadOnly = true;
- this.textTokenId.Size = new System.Drawing.Size(284, 22);
+ this.textTokenId.Size = new System.Drawing.Size(191, 20);
this.textTokenId.TabIndex = 1;
//
// textImpersonationLevel
@@ -405,7 +408,7 @@
this.textImpersonationLevel.Location = new System.Drawing.Point(118, 32);
this.textImpersonationLevel.Name = "textImpersonationLevel";
this.textImpersonationLevel.ReadOnly = true;
- this.textImpersonationLevel.Size = new System.Drawing.Size(284, 22);
+ this.textImpersonationLevel.Size = new System.Drawing.Size(191, 20);
this.textImpersonationLevel.TabIndex = 1;
//
// textTokenType
@@ -413,7 +416,7 @@
this.textTokenType.Location = new System.Drawing.Point(118, 6);
this.textTokenType.Name = "textTokenType";
this.textTokenType.ReadOnly = true;
- this.textTokenType.Size = new System.Drawing.Size(284, 22);
+ this.textTokenType.Size = new System.Drawing.Size(191, 20);
this.textTokenType.TabIndex = 1;
//
// label13
@@ -421,7 +424,7 @@
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(6, 139);
this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(100, 13);
+ this.label13.Size = new System.Drawing.Size(93, 13);
this.label13.TabIndex = 0;
this.label13.Text = "Memory Available:";
//
@@ -430,7 +433,7 @@
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(6, 113);
this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(80, 13);
+ this.label12.Size = new System.Drawing.Size(75, 13);
this.label12.TabIndex = 0;
this.label12.Text = "Memory Used:";
//
@@ -439,7 +442,7 @@
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(6, 87);
this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(114, 13);
+ this.label11.Size = new System.Drawing.Size(106, 13);
this.label11.TabIndex = 0;
this.label11.Text = "Authentication LUID:";
//
@@ -448,7 +451,7 @@
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 61);
this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(68, 13);
+ this.label10.Size = new System.Drawing.Size(69, 13);
this.label10.TabIndex = 0;
this.label10.Text = "Token LUID:";
//
@@ -457,7 +460,7 @@
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 35);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(113, 13);
+ this.label5.Size = new System.Drawing.Size(105, 13);
this.label5.TabIndex = 0;
this.label5.Text = "Impersonation Level:";
//
@@ -466,7 +469,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 9);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(33, 13);
+ this.label4.Size = new System.Drawing.Size(34, 13);
this.label4.TabIndex = 0;
this.label4.Text = "Type:";
//
@@ -475,7 +478,7 @@
this.tabGroups.Location = new System.Drawing.Point(4, 22);
this.tabGroups.Name = "tabGroups";
this.tabGroups.Padding = new System.Windows.Forms.Padding(3);
- this.tabGroups.Size = new System.Drawing.Size(423, 407);
+ this.tabGroups.Size = new System.Drawing.Size(567, 407);
this.tabGroups.TabIndex = 1;
this.tabGroups.Text = "Groups";
this.tabGroups.UseVisualStyleBackColor = true;
@@ -486,7 +489,7 @@
this.tabPrivileges.Location = new System.Drawing.Point(4, 22);
this.tabPrivileges.Name = "tabPrivileges";
this.tabPrivileges.Padding = new System.Windows.Forms.Padding(3);
- this.tabPrivileges.Size = new System.Drawing.Size(423, 407);
+ this.tabPrivileges.Size = new System.Drawing.Size(567, 407);
this.tabPrivileges.TabIndex = 0;
this.tabPrivileges.Text = "Privileges";
this.tabPrivileges.UseVisualStyleBackColor = true;
@@ -499,12 +502,11 @@
this.columnStatus,
this.columnDesc});
this.listPrivileges.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listPrivileges.DoubleClickChecks = true;
this.listPrivileges.FullRowSelect = true;
this.listPrivileges.Location = new System.Drawing.Point(3, 3);
this.listPrivileges.Name = "listPrivileges";
this.listPrivileges.ShowItemToolTips = true;
- this.listPrivileges.Size = new System.Drawing.Size(417, 401);
+ this.listPrivileges.Size = new System.Drawing.Size(561, 401);
this.listPrivileges.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listPrivileges.TabIndex = 0;
this.listPrivileges.UseCompatibleStateImageBehavior = false;
@@ -527,24 +529,28 @@
//
// enableMenuItem
//
+ this.vistaMenu.SetImage(this.enableMenuItem, global::ProcessHacker.Properties.Resources.tick);
this.enableMenuItem.Index = 0;
this.enableMenuItem.Text = "&Enable";
this.enableMenuItem.Click += new System.EventHandler(this.enableMenuItem_Click);
//
// disableMenuItem
//
+ this.vistaMenu.SetImage(this.disableMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.disableMenuItem.Index = 1;
this.disableMenuItem.Text = "&Disable";
this.disableMenuItem.Click += new System.EventHandler(this.disableMenuItem_Click);
//
// removeMenuItem
//
+ this.vistaMenu.SetImage(this.removeMenuItem, global::ProcessHacker.Properties.Resources.delete);
this.removeMenuItem.Index = 2;
this.removeMenuItem.Text = "&Remove";
this.removeMenuItem.Click += new System.EventHandler(this.removeMenuItem_Click);
//
// copyMenuItem
//
+ this.vistaMenu.SetImage(this.copyMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyMenuItem.Index = 4;
this.copyMenuItem.Text = "&Copy";
//
@@ -570,14 +576,18 @@
this.selectAllMenuItem.Text = "Select &All";
this.selectAllMenuItem.Click += new System.EventHandler(this.selectAllMenuItem_Click);
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// TokenProperties
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.tabControl);
this.Name = "TokenProperties";
- this.Size = new System.Drawing.Size(431, 433);
+ this.Size = new System.Drawing.Size(575, 433);
this.tabControl.ResumeLayout(false);
this.tabGeneral.ResumeLayout(false);
this.groupSource.ResumeLayout(false);
@@ -587,6 +597,7 @@
this.tabAdvanced.ResumeLayout(false);
this.tabAdvanced.PerformLayout();
this.tabPrivileges.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
@@ -601,10 +612,11 @@
private System.Windows.Forms.TextBox textUser;
private System.Windows.Forms.TabPage tabGroups;
private System.Windows.Forms.TabPage tabPrivileges;
- private ExtendedListView listPrivileges;
+ private System.Windows.Forms.ListView listPrivileges;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnStatus;
private System.Windows.Forms.ColumnHeader columnDesc;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.MenuItem enableMenuItem;
private System.Windows.Forms.MenuItem disableMenuItem;
private System.Windows.Forms.MenuItem removeMenuItem;
diff --git a/1.x/trunk/ProcessHacker/Components/TokenProperties.cs b/1.x/trunk/ProcessHacker/Components/TokenProperties.cs
index c7cb9dcef..1cbd6e191 100644
--- a/1.x/trunk/ProcessHacker/Components/TokenProperties.cs
+++ b/1.x/trunk/ProcessHacker/Components/TokenProperties.cs
@@ -31,19 +31,19 @@ using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
using ProcessHacker.Native.Security.AccessControl;
using ProcessHacker.UI;
-using ProcessHacker.Api;
namespace ProcessHacker.Components
{
- public partial class TokenProperties : ProcessPropertySheetPage
+ public partial class TokenProperties : UserControl
{
- private readonly IWithToken _object;
+ private IWithToken _object;
private TokenGroupsList _groups;
public TokenProperties(IWithToken obj)
{
InitializeComponent();
+ listPrivileges.SetDoubleBuffered(true);
listPrivileges.ListViewItemSorter = new SortedListViewComparer(listPrivileges);
GenericViewMenu.AddMenuItems(copyMenuItem.MenuItems, listPrivileges, null);
listPrivileges.ContextMenu = menuPrivileges;
@@ -60,10 +60,10 @@ namespace ProcessHacker.Components
// "General"
try
{
- textUser.Text = thandle.User.GetFullName(true);
- textUserSID.Text = thandle.User.StringSid;
- textOwner.Text = thandle.Owner.GetFullName(true);
- textPrimaryGroup.Text = thandle.PrimaryGroup.GetFullName(true);
+ textUser.Text = thandle.GetUser().GetFullName(true);
+ textUserSID.Text = thandle.GetUser().StringSid;
+ textOwner.Text = thandle.GetOwner().GetFullName(true);
+ textPrimaryGroup.Text = thandle.GetPrimaryGroup().GetFullName(true);
}
catch (Exception ex)
{
@@ -72,7 +72,7 @@ namespace ProcessHacker.Components
try
{
- textSessionID.Text = thandle.SessionId.ToString();
+ textSessionID.Text = thandle.GetSessionId().ToString();
}
catch (Exception ex)
{
@@ -81,20 +81,14 @@ namespace ProcessHacker.Components
try
{
- TokenElevationType type = thandle.ElevationType;
+ var type = thandle.GetElevationType();
- switch (type)
- {
- case TokenElevationType.Default:
- this.textElevated.Text = "N/A";
- break;
- case TokenElevationType.Full:
- this.textElevated.Text = "True";
- break;
- case TokenElevationType.Limited:
- this.textElevated.Text = "False";
- break;
- }
+ if (type == TokenElevationType.Default)
+ textElevated.Text = "N/A";
+ else if (type == TokenElevationType.Full)
+ textElevated.Text = "True";
+ else if (type == TokenElevationType.Limited)
+ textElevated.Text = "False";
}
catch (Exception ex)
{
@@ -106,7 +100,7 @@ namespace ProcessHacker.Components
{
try
{
- TokenHandle linkedToken = thandle.LinkedToken;
+ TokenHandle linkedToken = thandle.GetLinkedToken();
if (linkedToken != null)
linkedToken.Dispose();
@@ -125,8 +119,8 @@ namespace ProcessHacker.Components
try
{
- bool virtAllowed = thandle.IsVirtualizationAllowed;
- bool virtEnabled = thandle.IsVirtualizationEnabled;
+ bool virtAllowed = thandle.IsVirtualizationAllowed();
+ bool virtEnabled = thandle.IsVirtualizationEnabled();
if (virtEnabled)
textVirtualized.Text = "Enabled";
@@ -144,7 +138,7 @@ namespace ProcessHacker.Components
{
using (TokenHandle tokenSource = _object.GetToken(TokenAccess.QuerySource))
{
- var source = tokenSource.Source;
+ var source = tokenSource.GetSource();
textSourceName.Text = source.SourceName.TrimEnd('\0', '\r', '\n', ' ');
@@ -161,7 +155,7 @@ namespace ProcessHacker.Components
// "Advanced"
try
{
- var statistics = thandle.Statistics;
+ var statistics = thandle.GetStatistics();
textTokenType.Text = statistics.TokenType.ToString();
textImpersonationLevel.Text = statistics.ImpersonationLevel.ToString();
@@ -177,7 +171,7 @@ namespace ProcessHacker.Components
try
{
- Sid[] groups = thandle.Groups;
+ var groups = thandle.GetGroups();
_groups = new TokenGroupsList(groups);
@@ -194,11 +188,11 @@ namespace ProcessHacker.Components
try
{
- var privileges = thandle.Privileges;
+ var privileges = thandle.GetPrivileges();
- foreach (Privilege t in privileges)
+ for (int i = 0; i < privileges.Length; i++)
{
- this.AddPrivilege(t);
+ this.AddPrivilege(privileges[i]);
}
}
catch (Exception ex)
@@ -211,10 +205,9 @@ namespace ProcessHacker.Components
{
tabControl.Visible = false;
- Label errorMessage = new Label
- {
- Text = ex.Message
- };
+ Label errorMessage = new Label();
+
+ errorMessage.Text = ex.Message;
this.Padding = new Padding(15, 10, 0, 0);
this.Controls.Add(errorMessage);
@@ -224,10 +217,10 @@ namespace ProcessHacker.Components
{
labelElevated.Enabled = false;
textElevated.Enabled = false;
- textElevated.Text = string.Empty;
+ textElevated.Text = "";
labelVirtualization.Enabled = false;
textVirtualized.Enabled = false;
- textVirtualized.Text = string.Empty;
+ textVirtualized.Text = "";
}
if (tabControl.TabPages[Settings.Instance.TokenWindowTab] != null)
@@ -257,10 +250,8 @@ namespace ProcessHacker.Components
buttonPermissions.Visible = false;
listPrivileges.ContextMenu = listPrivileges.GetCopyMenu();
- _groups = new TokenGroupsList(null)
- {
- Dock = DockStyle.Fill
- };
+ _groups = new TokenGroupsList(null);
+ _groups.Dock = DockStyle.Fill;
tabGroups.Controls.Add(_groups);
}
@@ -343,35 +334,31 @@ namespace ProcessHacker.Components
{
if ((Attributes & SePrivilegeAttributes.EnabledByDefault) != 0)
return "Default Enabled";
-
- if ((Attributes & SePrivilegeAttributes.Enabled) != 0)
+ else if ((Attributes & SePrivilegeAttributes.Enabled) != 0)
return "Enabled";
-
- if (Attributes == SePrivilegeAttributes.Disabled)
+ else if (Attributes == SePrivilegeAttributes.Disabled)
return "Disabled";
-
- return "Unknown";
+ else
+ return "Unknown";
}
private Color GetAttributeColor(SePrivilegeAttributes Attributes)
{
if ((Attributes & SePrivilegeAttributes.EnabledByDefault) != 0)
return Color.FromArgb(0xc0f0c0);
-
- if ((Attributes & SePrivilegeAttributes.Enabled) != 0)
+ else if ((Attributes & SePrivilegeAttributes.Enabled) != 0)
return Color.FromArgb(0xe0f0e0);
-
- if (Attributes == SePrivilegeAttributes.Disabled)
+ else if (Attributes == SePrivilegeAttributes.Disabled)
return Color.FromArgb(0xf0e0e0);
-
- return Color.White;
+ else
+ return Color.White;
}
private void menuPrivileges_Popup(object sender, EventArgs e)
{
if (listPrivileges.SelectedItems.Count == 0)
{
- //menuPrivileges.DisableAll();
+ menuPrivileges.DisableAll();
}
else
{
@@ -481,14 +468,14 @@ namespace ProcessHacker.Components
private void selectAllMenuItem_Click(object sender, EventArgs e)
{
- this.listPrivileges.Items.SelectAll();
+ Utils.SelectAll(listPrivileges.Items);
}
private void buttonLinkedToken_Click(object sender, EventArgs e)
{
- using (TokenHandle thandle = _object.GetToken(TokenAccess.Query))
+ using (var thandle = _object.GetToken(TokenAccess.Query))
{
- TokenWithLinkedToken token = new TokenWithLinkedToken(thandle);
+ var token = new TokenWithLinkedToken(thandle);
TokenWindow window = new TokenWindow(token);
window.ShowDialog();
@@ -501,7 +488,7 @@ namespace ProcessHacker.Components
{
SecurityEditor.EditSecurity(
this,
- SecurityEditor.GetSecurableWrapper(access => _object.GetToken((TokenAccess)access)),
+ SecurityEditor.GetSecurableWrapper((access) => _object.GetToken((TokenAccess)access)),
"Token",
NativeTypeFactory.GetAccessEntries(NativeTypeFactory.ObjectType.Token)
);
diff --git a/1.x/trunk/ProcessHacker/Components/TokenProperties.resx b/1.x/trunk/ProcessHacker/Components/TokenProperties.resx
index 802907d2f..0bae7478e 100644
--- a/1.x/trunk/ProcessHacker/Components/TokenProperties.resx
+++ b/1.x/trunk/ProcessHacker/Components/TokenProperties.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+ 17, 17
+
+
125, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/ToolStripEx.cs b/1.x/trunk/ProcessHacker/Components/ToolStripEx.cs
deleted file mode 100644
index 6a0907c20..000000000
--- a/1.x/trunk/ProcessHacker/Components/ToolStripEx.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System.Windows.Forms;
-using ProcessHacker.Common;
-
-namespace System
-{
- public class ToolStripEx : ToolStrip
- {
- private const uint WM_MOUSEACTIVATE = 0x21;
- private static readonly IntPtr MA_ACTIVATE = new IntPtr(1);
- private static readonly IntPtr MA_ACTIVATEANDEAT = new IntPtr(2);
- private const uint MA_NOACTIVATE = 3;
- private const uint MA_NOACTIVATEANDEAT = 4;
-
- private bool clickThrough = true;
-
- ///
- /// Gets or sets whether the ToolStripEx honors item clicks when its containing form does not have input focus.
- ///
- ///
- /// Default value is true, which is the same behavior provided by the base ToolStrip class.
- ///
- public bool ClickThrough
- {
- get { return this.clickThrough; }
- set { this.clickThrough = value; }
- }
-
- protected override void WndProc(ref Message m)
- {
- base.WndProc(ref m);
-
- if (this.clickThrough && m.Msg == WM_MOUSEACTIVATE && m.Result == MA_ACTIVATEANDEAT)
- {
- m.Result = MA_ACTIVATE;
- }
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/Tracker.cs b/1.x/trunk/ProcessHacker/Components/Tracker.cs
deleted file mode 100644
index af4882b58..000000000
--- a/1.x/trunk/ProcessHacker/Components/Tracker.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-using System;
-using ProcessHacker.Common;
-
-namespace ProcessHacker
-{
- using System.Windows.Forms;
- using System.ComponentModel;
- using System.Drawing;
-
- public class Tracker : Control
- {
- public Color DrawColor = Color.Empty;
-
- //SedondLine Maximum
- public int value2Max = 100;
-
- private int mover;
-
- public System.Collections.Generic.IList values;
- public System.Collections.Generic.IList values2;
-
- private int mValue;
- private int mMinimum;
- private int mMaximum = 100;
- private int mLower = 25;
- private int mUpper = 75;
-
- private int intDivision = 2;
- private int mGrid = 12;
-
- public bool UseSecondLine { get; set; }
-
- public Tracker()
- {
- this.SetStyle(ControlStyles.ResizeRedraw, true);
- this.SetStyle(ControlStyles.UserPaint, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- this.SetStyle(ControlStyles.DoubleBuffer, true);
-
- this.Draw();
- }
-
- [Category("Behavior"), DefaultValue(12), Description("The grid of Tracker.")]
- public int Grid
- {
- get { return mGrid; }
- set
- {
- if (value > 0)
- mGrid = value;
- }
- }
-
- [Category("Behavior"), DefaultValue(0), Description("The current value of Tracker, in the range specified by the Minimum and Maximum properties.")]
- public int Value
- {
- get { return this.mValue; }
- set
- {
- if (value > this.mMaximum)
- {
- this.mValue = this.mMaximum;
- }
- else if (value < this.mMinimum)
- {
- this.mValue = this.mMinimum;
- }
- else
- {
- this.mValue = value;
- }
- }
- }
-
- [Category("Behavior"), DefaultValue(0), Description("The lower bound of the range this Tracker is working with.")]
- public int Minimum
- {
- get { return mMinimum; }
- set
- {
- if (value > mLower)
- {
- mMinimum = mLower;
- }
- else
- {
- mMinimum = value;
- }
- this.Invalidate();
- }
- }
-
- [Category("Behavior"), DefaultValue(100), Description("The upper bound of the range this Tracker is working with.")]
- public int Maximum
- {
- get { return mMaximum; }
- set
- {
- if (value < mUpper)
- {
- mMaximum = mUpper;
- }
- else
- {
- mMaximum = value;
- }
-
- this.Invalidate();
- }
- }
-
- [Category("Behavior"), DefaultValue(75), Description("The upper value of the normal range.")]
- public int UpperRange
- {
- get { return mUpper; }
- set
- {
- if (value > mMaximum)
- {
- mUpper = mMaximum;
- }
- else if (value < mLower)
- {
- mUpper = mLower;
- }
- else
- {
- mUpper = value;
- }
- this.Invalidate();
- }
- }
-
- [Category("Behavior"), DefaultValue(25), Description("The lower value of the normal range.")]
- public int LowerRange
- {
- get { return mLower; }
- set
- {
- if (value > mUpper)
- {
- mLower = mUpper;
- }
- else if (value < mMinimum)
- {
- mLower = mMinimum;
- }
- else
- {
- mLower = value;
- }
- this.Invalidate();
- }
- }
-
- public void Draw()
- {
- if (this.mover >= this.mGrid - intDivision)
- {
- mover = 0;
- }
- else
- {
- mover += intDivision;
- }
-
- this.Refresh();
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
- e.Graphics.Clear(Color.Black);
- e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
-
- int width = this.Width;
- int height = this.Height;
-
- // draw grid
- using (Pen p = new Pen(Color.DarkGreen))
- {
- int pos;
-
- // X Axis
- for (int i = 0; i <= height / this.mGrid; i++)
- {
- pos = i * this.mGrid;
-
- e.Graphics.DrawLine(p, 0, pos, width, pos);
- }
- // Y Axis
- for (int i = 0; i <= width + 1 / this.mGrid; i++)
- {
- pos = i * this.mGrid - this.mover;
-
- e.Graphics.DrawLine(p, pos, 0, pos, height);
- }
- }
-
- if (this.values != null)
- {
- for (int i = 1; i <= this.values.Count - 1; i++)
- {
- int x = width - intDivision*(this.values.Count - i);
- int y = height*(this.Maximum - this.values[i])/(this.Maximum - this.Minimum);
-
- int xx = width - intDivision*(this.values.Count - i + 1);
- int yy = (height*(this.Maximum - this.values[i - 1])/(this.Maximum - this.Minimum));
-
- using (Pen p = new Pen(this.DrawColor))
- {
- p.Width = 2;
-
- using (SolidBrush b = new SolidBrush(Color.FromArgb(100, p.Color)))
- {
- // Fill in the area below the line.
- e.Graphics.FillPolygon(b, new[]
- {
- new Point(x, y),
- new Point(x + intDivision, yy),
- new Point(x + intDivision, height),
- new Point(x, height)
- });
-
- //draw first line
- e.Graphics.DrawLine(p, x, y, xx, yy);
- }
- }
- }
- }
-
-
- //todo: complete.
- if (this.UseSecondLine)
- {
- for (int i = 0; i <= this.values2.Count - 1; i++)
- {
- int x = width - intDivision*(values2.Count - i);
- int y = height*(value2Max - (int)values2[i])/(value2Max - this.Minimum);
-
- int xx = width - intDivision*(values2.Count - i + 1);
- int yy = (height*(value2Max - (int)values2[i - 1])/(value2Max - this.Minimum));
-
- using (Pen p = new Pen(Color.Pink))
- {
- // Fill in the area below the line.
- e.Graphics.FillPolygon(new SolidBrush(Color.FromArgb(100, p.Color)), new[]
- {
- new Point(x, y),
- new Point(x + intDivision, yy),
- new Point(x + intDivision, height),
- new Point(x, height)
- });
-
- //draw first line
- e.Graphics.DrawLine(p, x, y, xx, yy);
- }
- }
- }
-
- // Draw the text, if any.
- if (!string.IsNullOrEmpty(this.Text))
- {
- using (SolidBrush b = new SolidBrush(this._textBoxColor))
- {
- // Draw the background for the text.
- e.Graphics.FillRectangle(b, new Rectangle(this._boxPosition, this._boxSize));
- }
-
- // Draw the text.
- TextRenderer.DrawText(e.Graphics, this.Text, this.Font, this._textPosition, _textColor);
- }
-
- //todo: Draw the Border?
- //ControlPaint.DrawBorder3D(e.Graphics, 0, 0, this.Width, this.Height, Border3DStyle.Sunken);
- }
-
- private Color _textBoxColor = Color.FromArgb(127, Color.Black);
- public Color TextBoxColor
- {
- get { return _textBoxColor; }
- set { _textBoxColor = value; }
- }
-
- private Color _textColor = Color.FromArgb(0, 255, 0);
- public Color TextColor
- {
- get { return _textColor; }
- set { _textColor = value; }
- }
-
- private Point _textPosition, _boxPosition;
- private Size _textSize, _boxSize;
-
- private Padding _textMargin = new Padding(3, 3, 3, 3);
- public Padding TextMargin
- {
- get { return _textMargin; }
- set { _textMargin = value; }
- }
-
- private Padding _textPadding = new Padding(3, 3, 3, 3);
- public Padding TextPadding
- {
- get { return _textPadding; }
- set { _textPadding = value; }
- }
-
- private ContentAlignment _textAlign = ContentAlignment.TopLeft;
- public ContentAlignment TextPosition
- {
- get { return _textAlign; }
- set { _textAlign = value; }
- }
-
- private string _text;
- public override string Text
- {
- get { return _text; }
- set
- {
- _text = value;
-
- _textSize = TextRenderer.MeasureText(this.Text, this.Font);
- _boxSize = new Size(_textSize.Width + _textPadding.Left + _textPadding.Right, _textSize.Height + _textPadding.Top + _textPadding.Bottom);
-
- // work out Y
- switch (_textAlign)
- {
- case ContentAlignment.BottomCenter:
- case ContentAlignment.BottomLeft:
- case ContentAlignment.BottomRight:
- {
- _boxPosition.Y = this.Size.Height - _boxSize.Height - _textMargin.Bottom;
- break;
- }
- case ContentAlignment.MiddleCenter:
- case ContentAlignment.MiddleLeft:
- case ContentAlignment.MiddleRight:
- {
- _boxPosition.Y = (this.Size.Height - _boxSize.Height) / 2;
- break;
- }
-
- case ContentAlignment.TopCenter:
- case ContentAlignment.TopLeft:
- case ContentAlignment.TopRight:
- {
- _boxPosition.Y = _textMargin.Top;
- break;
- }
- }
-
- // work out X
- switch (_textAlign)
- {
- case ContentAlignment.BottomLeft:
- case ContentAlignment.MiddleLeft:
- case ContentAlignment.TopLeft:
- {
- _boxPosition.X = _textMargin.Left;
- break;
- }
- case ContentAlignment.BottomCenter:
- case ContentAlignment.MiddleCenter:
- case ContentAlignment.TopCenter:
- {
- _boxPosition.X = (this.Size.Width - _boxSize.Width) / 2;
- break;
- }
- case ContentAlignment.BottomRight:
- case ContentAlignment.MiddleRight:
- case ContentAlignment.TopRight:
- {
- _boxPosition.X = this.Size.Width - _boxSize.Width - _textMargin.Right;
- break;
- }
- }
-
- _textPosition = new Point(_boxPosition.X + _textPadding.Left, _boxPosition.Y + _textPadding.Top);
- }
- }
-
-
- }
-}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/PerformanceAnalyzer.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/PerformanceAnalyzer.cs
deleted file mode 100644
index 7d99ab48c..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/PerformanceAnalyzer.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Diagnostics;
-
-namespace Aga.Controls
-{
- ///
- /// Is used to analyze code performance
- ///
- public static class PerformanceAnalyzer
- {
- public class PerformanceInfo
- {
- public string Name { get; set; }
- public int Count { get; set; }
- public double TotalTime { get; set; }
-
- public Int64 Start { get; set; }
-
- public PerformanceInfo(string name)
- {
- this.Name = name;
- }
- }
-
- private static readonly Dictionary _performances = new Dictionary();
-
- public static IEnumerable Performances
- {
- get
- {
- return _performances.Values;
- }
- }
-
- [Conditional("DEBUG")]
- public static void Start(string pieceOfCode)
- {
- lock(_performances)
- {
- PerformanceInfo info;
-
- if (_performances.ContainsKey(pieceOfCode))
- info = _performances[pieceOfCode];
- else
- {
- info = new PerformanceInfo(pieceOfCode);
- _performances.Add(pieceOfCode, info);
- }
-
- info.Count++;
- info.Start = TimeCounter.GetStartValue();
- }
- }
-
- [Conditional("DEBUG")]
- public static void Finish(string pieceOfCode)
- {
- lock (_performances)
- {
- if (_performances.ContainsKey(pieceOfCode))
- {
- PerformanceInfo info = _performances[pieceOfCode];
- info.Count++;
- info.TotalTime += TimeCounter.Finish(info.Start);
- }
- }
- }
-
- public static void Reset()
- {
- _performances.Clear();
- }
-
- public static string GenerateReport()
- {
- return GenerateReport(0);
- }
-
- public static string GenerateReport(string mainPieceOfCode)
- {
- if (_performances.ContainsKey(mainPieceOfCode))
- return GenerateReport(_performances[mainPieceOfCode].TotalTime);
- else
- return GenerateReport(0);
- }
-
- public static string GenerateReport(double totalTime)
- {
- StringBuilder sb = new StringBuilder();
- int len = 0;
- foreach (PerformanceInfo info in Performances)
- len = Math.Max(info.Name.Length, len);
-
- sb.AppendLine("Name".PadRight(len) + " Count Total Time, ms Avg. Time, ms Percentage, %");
- sb.AppendLine("----------------------------------------------------------------------------------------------");
- foreach (PerformanceInfo info in Performances)
- {
- sb.Append(info.Name.PadRight(len));
- double p = 0;
- double avgt = 0;
- if (totalTime != 0)
- p = info.TotalTime / totalTime;
- if (info.Count > 0)
- avgt = info.TotalTime * 1000 / info.Count;
- string c = info.Count.ToString("0,0").PadRight(20);
- string tt = (info.TotalTime * 1000).ToString("0,0.00").PadRight(20);
- string t = avgt.ToString("0.0000").PadRight(20);
- string sp = (p * 100).ToString("###").PadRight(20);
- sb.AppendFormat(" " + c + tt + t + sp + "\n");
- }
- return sb.ToString();
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/TextHelper.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/TextHelper.cs
deleted file mode 100644
index 79f252391..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/TextHelper.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Drawing;
-
-namespace Aga.Controls
-{
- public static class TextHelper
- {
- public static StringAlignment TranslateAligment(HorizontalAlignment aligment)
- {
- switch (aligment)
- {
- case HorizontalAlignment.Left:
- {
- return StringAlignment.Near;
- }
- case HorizontalAlignment.Right:
- {
- return StringAlignment.Far;
- }
- default:
- {
- return StringAlignment.Center;
- }
- }
- }
-
- public static TextFormatFlags TranslateAligmentToFlag(HorizontalAlignment aligment)
- {
- switch (aligment)
- {
- case HorizontalAlignment.Left:
- {
- return TextFormatFlags.Left;
- }
- case HorizontalAlignment.Right:
- {
- return TextFormatFlags.Right;
- }
- default:
- {
- return TextFormatFlags.HorizontalCenter;
- }
- }
- }
-
- public static TextFormatFlags TranslateTrimmingToFlag(StringTrimming trimming)
- {
- switch (trimming)
- {
- case StringTrimming.EllipsisCharacter:
- {
- return TextFormatFlags.EndEllipsis;
- }
- case StringTrimming.EllipsisPath:
- {
- return TextFormatFlags.PathEllipsis;
- }
- case StringTrimming.EllipsisWord:
- {
- return TextFormatFlags.WordEllipsis;
- }
- case StringTrimming.Word:
- {
- return TextFormatFlags.WordBreak;
- }
- default:
- {
- return TextFormatFlags.Default;
- }
- }
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/DrawContext.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/DrawContext.cs
deleted file mode 100644
index d3a352494..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/DrawContext.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Drawing;
-
-using Aga.Controls.Tree.NodeControls;
-
-namespace Aga.Controls.Tree
-{
- public struct DrawContext
- {
- public Graphics Graphics;
- public Rectangle Bounds;
- public Font Font;
- public DrawSelectionMode DrawSelection;
- public bool DrawFocus;
- public NodeControl CurrentEditorOwner;
- public bool Enabled;
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/IncrementalSearch.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/IncrementalSearch.cs
deleted file mode 100644
index 6010a1c67..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/IncrementalSearch.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Aga.Controls.Tree.NodeControls;
-
-namespace Aga.Controls.Tree
-{
- internal class IncrementalSearch
- {
- private const int SearchTimeout = 300; //end of incremental search timeot in msec
-
- private readonly TreeViewAdv _tree;
- private TreeNodeAdv _currentNode;
- private string _searchString = string.Empty;
- private DateTime _lastKeyPressed = DateTime.Now;
-
- public IncrementalSearch(TreeViewAdv tree)
- {
- _tree = tree;
- }
-
- public void Search(Char value)
- {
- if (!Char.IsControl(value))
- {
- Char ch = Char.ToLowerInvariant(value);
- DateTime dt = DateTime.Now;
- TimeSpan ts = dt - _lastKeyPressed;
- _lastKeyPressed = dt;
- if (ts.TotalMilliseconds < SearchTimeout)
- {
- if (_searchString == value.ToString())
- FirstCharSearch(ch);
- else
- ContinuousSearch(ch);
- }
- else
- {
- FirstCharSearch(ch);
- }
- }
- }
-
- private void ContinuousSearch(Char value)
- {
- if (value == ' ' && String.IsNullOrEmpty(_searchString))
- return; //Ingnore leading space
-
- _searchString += value;
- DoContinuousSearch();
- }
-
- private void FirstCharSearch(Char value)
- {
- if (value == ' ')
- return;
-
- _searchString = value.ToString();
- TreeNodeAdv node = null;
- if (_tree.SelectedNode != null)
- node = _tree.SelectedNode.NextVisibleNode;
- if (node == null)
- node = _tree.Root;
-
- foreach (string label in IterateNodeLabels(node))
- {
- if (label.StartsWith(_searchString))
- {
- _tree.SelectedNode = _currentNode;
- return;
- }
- }
- }
-
- public virtual void EndSearch()
- {
- _currentNode = null;
- _searchString = string.Empty;
- }
-
- protected IEnumerable IterateNodeLabels(TreeNodeAdv start)
- {
- _currentNode = start;
- while(_currentNode != null)
- {
- foreach (string label in GetNodeLabels(_currentNode))
- yield return label;
-
- _currentNode = _currentNode.NextVisibleNode;
- if (_currentNode == null)
- _currentNode = _tree.Root;
-
- if (start == _currentNode)
- break;
- }
- }
-
- private IEnumerable GetNodeLabels(TreeNodeAdv node)
- {
- foreach (NodeControl nc in _tree.NodeControls)
- {
- BindableControl bc = nc as BindableControl;
- if (bc != null && bc.IncrementalSearchEnabled)
- {
- object obj = bc.GetValue(node);
- if (obj != null)
- yield return obj.ToString().ToLowerInvariant();
- }
- }
- }
-
- private void DoContinuousSearch()
- {
- if (!string.IsNullOrEmpty(_searchString))
- {
- TreeNodeAdv node = null;
- if (_tree.SelectedNode != null)
- node = _tree.SelectedNode;
- if (node == null)
- node = _tree.Root.NextVisibleNode;
-
- if (!string.IsNullOrEmpty(_searchString))
- {
- foreach (string label in IterateNodeLabels(node))
- {
- if (label.StartsWith(_searchString))
- {
- _tree.SelectedNode = _currentNode;
- break;
- }
- }
- }
- }
- return;
- }
-
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/Input/ColumnState.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/Input/ColumnState.cs
deleted file mode 100644
index 676ef6e62..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/Input/ColumnState.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Aga.Controls.Tree
-{
- internal abstract class ColumnState : InputState
- {
- public TreeColumn Column { get; private set; }
-
- protected ColumnState(TreeViewAdv tree, TreeColumn column)
- : base(tree)
- {
- this.Column = column;
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/Input/NormalInputState.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/Input/NormalInputState.cs
deleted file mode 100644
index 0c5a429ad..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/Input/NormalInputState.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace Aga.Controls.Tree
-{
- internal class NormalInputState : InputState
- {
- private bool _mouseDownFlag;
-
- public NormalInputState(TreeViewAdv tree) : base(tree)
- {
- }
-
- public override void KeyDown(KeyEventArgs args)
- {
- if (this.Tree.CurrentNode == null && this.Tree.Root.Nodes.Count > 0)
- this.Tree.CurrentNode = this.Tree.Root.Nodes[0];
-
- if (this.Tree.CurrentNode != null)
- {
- switch (args.KeyCode)
- {
- case Keys.Right:
- if (!this.Tree.CurrentNode.IsExpanded)
- {
- this.Tree.CurrentNode.IsExpanded = true;
- // by fliser
- this.Tree.FullUpdate();
- }
- else if (this.Tree.CurrentNode.Nodes.Count > 0)
- this.Tree.SelectedNode = this.Tree.CurrentNode.Nodes[0];
- args.Handled = true;
- break;
- case Keys.Left:
- if (this.Tree.CurrentNode.IsExpanded)
- {
- this.Tree.CurrentNode.IsExpanded = false;
- // by fliser
- this.Tree.FullUpdate();
- }
- else if (this.Tree.CurrentNode.Parent != this.Tree.Root)
- this.Tree.SelectedNode = this.Tree.CurrentNode.Parent;
- args.Handled = true;
- break;
- case Keys.Down:
- NavigateForward(1);
- args.Handled = true;
- break;
- case Keys.Up:
- NavigateBackward(1);
- args.Handled = true;
- break;
- case Keys.PageDown:
- NavigateForward(Math.Max(1, this.Tree.CurrentPageSize - 1));
- args.Handled = true;
- break;
- case Keys.PageUp:
- NavigateBackward(Math.Max(1, this.Tree.CurrentPageSize - 1));
- args.Handled = true;
- break;
- case Keys.Home:
- if (this.Tree.RowMap.Count > 0)
- FocusRow(this.Tree.RowMap[0]);
- args.Handled = true;
- break;
- case Keys.End:
- if (this.Tree.RowMap.Count > 0)
- FocusRow(this.Tree.RowMap[this.Tree.RowMap.Count-1]);
- args.Handled = true;
- break;
- case Keys.Subtract:
- this.Tree.CurrentNode.Collapse();
- // by fliser
- this.Tree.FullUpdate();
- args.Handled = true;
- args.SuppressKeyPress = true;
- break;
- case Keys.Add:
- this.Tree.CurrentNode.Expand();
- // by fliser
- this.Tree.FullUpdate();
- args.Handled = true;
- args.SuppressKeyPress = true;
- break;
- case Keys.Multiply:
- this.Tree.CurrentNode.ExpandAll();
- // by fliser
- this.Tree.FullUpdate();
- args.Handled = true;
- args.SuppressKeyPress = true;
- break;
- }
- }
- }
-
- public override void MouseDown(TreeNodeAdvMouseEventArgs args)
- {
- if (args.Node != null)
- {
- if (args.Button == MouseButtons.Left || args.Button == MouseButtons.Right)
- {
- this.Tree.BeginUpdate();
- try
- {
- this.Tree.CurrentNode = args.Node;
-
- if (args.Node.IsSelected)
- _mouseDownFlag = true;
- else
- {
- _mouseDownFlag = false;
- DoMouseOperation(args);
- }
- }
- finally
- {
- this.Tree.EndUpdate();
- }
- }
-
- }
- else
- {
- MouseDownAtEmptySpace(args);
- }
- }
-
- public override void MouseUp(TreeNodeAdvMouseEventArgs args)
- {
- if (_mouseDownFlag)
- {
- switch (args.Button)
- {
- case MouseButtons.Left:
- this.DoMouseOperation(args);
- break;
- case MouseButtons.Right:
- this.Tree.CurrentNode = args.Node;
- break;
- }
- }
- _mouseDownFlag = false;
- }
-
-
- private void NavigateBackward(int n)
- {
- int row = Math.Max(this.Tree.CurrentNode.Row - n, 0);
- if (row != this.Tree.CurrentNode.Row)
- FocusRow(this.Tree.RowMap[row]);
- }
-
- private void NavigateForward(int n)
- {
- int row = Math.Min(this.Tree.CurrentNode.Row + n, this.Tree.RowCount - 1);
- if (row != this.Tree.CurrentNode.Row)
- FocusRow(this.Tree.RowMap[row]);
- }
-
- protected virtual void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
- {
- this.Tree.ClearSelectionInternal();
- }
-
- protected virtual void FocusRow(TreeNodeAdv node)
- {
- this.Tree.SuspendSelectionEvent = true;
- try
- {
- this.Tree.ClearSelectionInternal();
- this.Tree.CurrentNode = node;
- this.Tree.SelectionStart = node;
- node.IsSelected = true;
- this.Tree.ScrollTo(node);
- }
- finally
- {
- this.Tree.SuspendSelectionEvent = false;
- }
- }
-
- protected bool CanSelect(TreeNodeAdv node)
- {
- if (this.Tree.SelectionMode == TreeSelectionMode.MultiSameParent)
- {
- return (this.Tree.SelectionStart == null || node.Parent == this.Tree.SelectionStart.Parent);
- }
-
- return true;
- }
-
- protected virtual void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
- {
- this.Tree.SuspendSelectionEvent = true;
- try
- {
- this.Tree.ClearSelectionInternal();
- if (args.Node != null)
- args.Node.IsSelected = true;
- this.Tree.SelectionStart = args.Node;
- }
- finally
- {
- this.Tree.SuspendSelectionEvent = false;
- }
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControlInfo.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControlInfo.cs
deleted file mode 100644
index 25d772ea9..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControlInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Aga.Controls.Tree.NodeControls;
-using System.Drawing;
-
-namespace Aga.Controls.Tree
-{
- public struct NodeControlInfo
- {
- public static readonly NodeControlInfo Empty = new NodeControlInfo(null, Rectangle.Empty, null);
-
- public NodeControl Control;
- public Rectangle Bounds;
- public TreeNodeAdv Node;
-
- public NodeControlInfo(NodeControl control, Rectangle bounds, TreeNodeAdv node) : this()
- {
- this.Control = control;
- this.Bounds = bounds;
- this.Node = node;
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/BindableControl.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/BindableControl.cs
deleted file mode 100644
index 2bc33036a..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/BindableControl.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using System;
-using System.Reflection;
-using System.ComponentModel;
-
-namespace Aga.Controls.Tree.NodeControls
-{
- public abstract class BindableControl : NodeControl
- {
- private struct MemberAdapter
- {
- private object _obj;
- private PropertyInfo _pi;
- private FieldInfo _fi;
-
- public static readonly MemberAdapter Empty;
-
- public Type MemberType
- {
- get
- {
- if (_pi != null)
- return _pi.PropertyType;
-
- if (_fi != null)
- return _fi.FieldType;
-
- return null;
- }
- }
-
- public object Value
- {
- get
- {
- if (_pi != null && _pi.CanRead)
- return _pi.GetValue(_obj, null);
-
- if (_fi != null)
- return _fi.GetValue(_obj);
-
- return null;
- }
- set
- {
- if (_pi != null && _pi.CanWrite)
- _pi.SetValue(_obj, value, null);
- else if (_fi != null)
- _fi.SetValue(_obj, value);
- }
- }
-
- public MemberAdapter(object obj, PropertyInfo pi)
- {
- _obj = obj;
- _pi = pi;
- _fi = null;
- }
-
- public MemberAdapter(object obj, FieldInfo fi)
- {
- _obj = obj;
- _fi = fi;
- _pi = null;
- }
- }
-
- #region Properties
-
- [DefaultValue(false), Category("Data")]
- public bool VirtualMode { get; set; }
-
- protected BindableControl()
- {
- this.DataPropertyName = string.Empty;
- }
-
- [DefaultValue(""), Category("Data")]
- public string DataPropertyName { get; set; }
-
- [DefaultValue(false)]
- public bool IncrementalSearchEnabled { get; set; }
-
- #endregion
-
- public virtual object GetValue(TreeNodeAdv node)
- {
- if (this.VirtualMode)
- {
- NodeControlValueEventArgs args = new NodeControlValueEventArgs(node);
- OnValueNeeded(args);
- return args.Value;
- }
-
- return this.GetMemberAdapter(node).Value;
- }
-
- public virtual void SetValue(TreeNodeAdv node, object value)
- {
- if (this.VirtualMode)
- {
- NodeControlValueEventArgs args = new NodeControlValueEventArgs(node)
- {
- Value = value
- };
-
- OnValuePushed(args);
- }
- else
- {
- MemberAdapter ma = GetMemberAdapter(node);
-
- ma.Value = value;
- }
- }
-
- public Type GetPropertyType(TreeNodeAdv node)
- {
- return GetMemberAdapter(node).MemberType;
- }
-
- private MemberAdapter GetMemberAdapter(TreeNodeAdv node)
- {
-
- MemberAdapter adapter = MemberAdapter.Empty;
-
- if (node.Tag != null && !string.IsNullOrEmpty(this.DataPropertyName))
- {
- Type type = node.Tag.GetType();
- PropertyInfo pi = type.GetProperty(this.DataPropertyName);
-
- if (pi != null)
- {
- return new MemberAdapter(node.Tag, pi);
- }
-
- FieldInfo fi = type.GetField(this.DataPropertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
-
- if (fi != null)
- return new MemberAdapter(node.Tag, fi);
- }
-
- return adapter;
- }
-
- public override string ToString()
- {
- if (string.IsNullOrEmpty(this.DataPropertyName))
- return GetType().Name;
-
- return this.GetType().Name + " (" + this.DataPropertyName + ")";
- }
-
- public event EventHandler ValueNeeded;
- private void OnValueNeeded(NodeControlValueEventArgs args)
- {
- if (this.ValueNeeded != null)
- this.ValueNeeded(this, args);
- }
-
- public event EventHandler ValuePushed;
- private void OnValuePushed(NodeControlValueEventArgs args)
- {
- if (this.ValuePushed != null)
- this.ValuePushed(this, args);
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/DrawEventArgs.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/DrawEventArgs.cs
deleted file mode 100644
index ce83c907b..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/DrawEventArgs.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Drawing;
-
-namespace Aga.Controls.Tree.NodeControls
-{
- public class DrawEventArgs : NodeEventArgs
- {
- public DrawContext Context { get; private set; }
- public Brush BackgroundBrush { get; set; }
- public Font Font { get; set; }
- public Color TextColor { get; set; }
- public string Text { get; private set; }
-
- public DrawEventArgs(TreeNodeAdv node, DrawContext context, string text)
- : base(node)
- {
- this.Context = context;
- this.Text = text;
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/NodeControlValueEventArgs.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/NodeControlValueEventArgs.cs
deleted file mode 100644
index 64697454b..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/NodeControlValueEventArgs.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Aga.Controls.Tree.NodeControls
-{
- public class NodeControlValueEventArgs : NodeEventArgs
- {
- public object Value { get; set; }
-
- public NodeControlValueEventArgs(TreeNodeAdv node)
- :base(node)
- {
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/NodeEventArgs.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/NodeEventArgs.cs
deleted file mode 100644
index d5cd00d67..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/NodeControls/NodeEventArgs.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace Aga.Controls.Tree.NodeControls
-{
- public class NodeEventArgs : EventArgs
- {
- public TreeNodeAdv Node { get; private set; }
-
- public NodeEventArgs(TreeNodeAdv node)
- {
- this.Node = node;
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeNodeAdvMouseEventArgs.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeNodeAdvMouseEventArgs.cs
deleted file mode 100644
index f39706790..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeNodeAdvMouseEventArgs.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Windows.Forms;
-using System.Drawing;
-using Aga.Controls.Tree.NodeControls;
-
-namespace Aga.Controls.Tree
-{
- public class TreeNodeAdvMouseEventArgs : MouseEventArgs
- {
- public TreeNodeAdv Node { get; internal set; }
- public NodeControl Control { get; internal set; }
- public Point ViewLocation { get; internal set; }
- public Keys ModifierKeys { get; internal set; }
- public bool Handled { get; set; }
- public Rectangle ControlBounds { get; internal set; }
-
- public TreeNodeAdvMouseEventArgs(MouseEventArgs args)
- : base(args.Button, args.Clicks, args.X, args.Y, args.Delta)
- {
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdv.Draw.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdv.Draw.cs
deleted file mode 100644
index 451e7fa41..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdv.Draw.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Modified by wj32.
- */
-
-using System;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-
-namespace Aga.Controls.Tree
-{
- public sealed partial class TreeViewAdv
- {
- private void CreatePens()
- {
- CreateLinePen();
- }
-
- private void CreateLinePen()
- {
- _linePen = new Pen(_lineColor)
- {
- DashStyle = DashStyle.Dot
- };
- }
-
- protected override void OnPaint(PaintEventArgs e)
- {
-#if DEBUG
- this.BeginPerformanceCount();
-#endif
- DrawContext context = new DrawContext
- {
- Graphics = e.Graphics,
- Font = this.Font,
- Enabled = Enabled
- };
-
- this.DrawColumnHeaders(e.Graphics);
-
- int y = this.ColumnHeaderHeight;
-
- if (this.Columns.Count == 0 || e.ClipRectangle.Height <= y)
- return;
-
- int firstRowY = _rowLayout.GetRowBounds(this.FirstVisibleRow).Y;
-
- y -= firstRowY;
-
- e.Graphics.ResetTransform();
- e.Graphics.TranslateTransform(-OffsetX, y);
-
- Rectangle displayRect = e.ClipRectangle;
-
- for (int row = this.FirstVisibleRow; row < this.RowCount; row++)
- {
- Rectangle rowRect = _rowLayout.GetRowBounds(row);
-
- if (rowRect.Y + y > displayRect.Bottom)
- break;
-
- this.DrawRow(e, ref context, row, rowRect);
- }
-
- e.Graphics.ResetTransform();
-
- this.DrawScrollBarsBox(e.Graphics);
-
-#if DEBUG
- this.EndPerformanceCount(e);
-#endif
- }
-
- private void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectangle rowRect)
- {
- TreeNodeAdv node = this.RowMap[row];
-
- context.DrawSelection = DrawSelectionMode.None;
- context.CurrentEditorOwner = _currentEditorOwner;
-
- bool focused = this.Focused;
-
- if (node.IsSelected && focused)
- {
- context.DrawSelection = DrawSelectionMode.Active;
- }
- else if (node.IsSelected && !focused && !this.HideSelection)
- {
- context.DrawSelection = DrawSelectionMode.Inactive;
- }
-
- Rectangle focusRect = new Rectangle(OffsetX, rowRect.Y, this.Width - (this._vScrollBar.Visible ? this._vScrollBar.Width : 0), rowRect.Height);
-
- context.DrawFocus = false;
-
- if (context.DrawSelection != DrawSelectionMode.Active)
- {
- using (SolidBrush b = new SolidBrush(node.BackColor))
- {
- e.Graphics.FillRectangle(b, focusRect);
- }
- }
-
- if (context.DrawSelection == DrawSelectionMode.Active || context.DrawSelection == DrawSelectionMode.Inactive)
- {
- if (context.DrawSelection == DrawSelectionMode.Active)
- {
- context.DrawSelection = DrawSelectionMode.FullRowSelect;
-
- if (ExplorerVisualStyle.VisualStylesEnabled)
- {
- ExplorerVisualStyle.TvItemSelectedRenderer.DrawBackground(context.Graphics, focusRect);
- }
- else
- {
- e.Graphics.FillRectangle(SystemBrushes.Highlight, focusRect);
- }
- }
- else
- {
- context.DrawSelection = DrawSelectionMode.None;
- }
- }
-
- this.DrawNode(node, context);
- }
-
- private void DrawColumnHeaders(Graphics gr)
- {
- ReorderColumnState reorder = this.Input as ReorderColumnState;
-
- int x = 0;
-
- TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, this.ColumnHeaderHeight - 1), false, false);
-
- gr.TranslateTransform(-OffsetX, 0);
-
- foreach (TreeColumn c in this.Columns)
- {
- if (!c.IsVisible)
- continue;
-
- if (x + c.Width >= this.OffsetX && x - this.OffsetX < this.Bounds.Width)// skip invisible columns (fixed by wj32)
- {
- Rectangle rect = new Rectangle(x, 0, c.Width, this.ColumnHeaderHeight - 1);
-
- gr.SetClip(rect);
-
- bool pressed = ((this.Input is ClickColumnState || reorder != null) && ((this.Input as ColumnState).Column == c));
-
- c.Draw(gr, rect, this.Font, pressed, this._hotColumn == c);
-
- gr.ResetClip();
-
- if (reorder != null && reorder.DropColumn == c)
- {
- TreeColumn.DrawDropMark(gr, rect);
- }
- }
- x += c.Width;
- }
-
- if (reorder != null)
- {
- if (reorder.DropColumn == null)
- {
- TreeColumn.DrawDropMark(gr, new Rectangle(x, 0, 0, this.ColumnHeaderHeight));
- }
-
- gr.DrawImage(reorder.GhostImage, new Point(reorder.Location.X + + reorder.DragOffset, reorder.Location.Y));
- }
- }
-
- public void DrawNode(TreeNodeAdv node, DrawContext context)
- {
- //todo, node collection needs locking.
- foreach (NodeControlInfo item in GetNodeControls(node))
- {
- if (item.Bounds.X + item.Bounds.Width >= OffsetX && item.Bounds.X - OffsetX < this.Bounds.Width)// skip invisible nodes (fixed by wj32)
- {
- context.Bounds = item.Bounds;
-
- context.Graphics.SetClip(context.Bounds);
-
- item.Control.Draw(node, context);
-
- context.Graphics.ResetClip();
- }
- }
- }
-
- private void DrawScrollBarsBox(Graphics gr)
- {
- Rectangle r1 = this.DisplayRectangle;
- Rectangle r2 = this.ClientRectangle;
-
- gr.FillRectangle(SystemBrushes.Control, new Rectangle(r1.Right, r1.Bottom, r2.Width - r1.Width, r2.Height - r1.Height));
- }
-
- private double _totalTime;
- private int _paintCount;
-
- private void BeginPerformanceCount()
- {
- _paintCount++;
- TimeCounter.Start();
- }
-
- private void EndPerformanceCount(PaintEventArgs e)
- {
- double time = TimeCounter.Finish();
- _totalTime += time;
-
- string debugText = string.Format("FPS {0:0.0}; Avg. FPS {1:0.0}", 1 / time, 1 / (_totalTime / _paintCount));
-
- e.Graphics.FillRectangle(Brushes.White, new Rectangle(this.DisplayRectangle.Width - 150, this.DisplayRectangle.Height - 20, 150, 20));
-
- TextRenderer.DrawText(e.Graphics, debugText, this.Font, new Point(this.DisplayRectangle.Width - 150, this.DisplayRectangle.Height - 20), Color.Black);
-
- //e.Graphics.DrawString(debugText, this.Font, Brushes.Gray, new PointF(DisplayRectangle.Width - 150, DisplayRectangle.Height - 20));
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdv.Properties.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdv.Properties.cs
deleted file mode 100644
index 32f2316b7..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdv.Properties.cs
+++ /dev/null
@@ -1,454 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-using System.Collections.ObjectModel;
-using System.Drawing.Design;
-
-using Aga.Controls.Tree.NodeControls;
-
-namespace Aga.Controls.Tree
-{
- public sealed partial class TreeViewAdv
- {
- private Cursor _innerCursor;
-
- public override Cursor Cursor
- {
- get
- {
- if (_innerCursor != null)
- return _innerCursor;
-
- return base.Cursor;
- }
- set { base.Cursor = value; }
- }
-
- #region Internal Properties
-
- private IRowLayout _rowLayout;
-
- public int ColumnHeaderHeight { get; private set; }
-
- ///
- /// returns all nodes, which parent is expanded
- ///
- private IEnumerable VisibleNodes
- {
- get
- {
- TreeNodeAdv node = this.Root;
-
- while (node != null)
- {
- node = node.NextVisibleNode;
-
- if (node != null)
- yield return node;
- }
- }
- }
-
- private bool _suspendSelectionEvent;
- internal bool SuspendSelectionEvent
- {
- get { return _suspendSelectionEvent; }
- set
- {
- if (value != _suspendSelectionEvent)
- {
- _suspendSelectionEvent = value;
- if (!_suspendSelectionEvent && _fireSelectionEvent)
- OnSelectionChanged();
- }
- }
- }
-
- internal List RowMap { get; private set; }
- internal TreeNodeAdv SelectionStart { get; set; }
- internal InputState Input { get; set; }
-
- ///
- /// Number of rows fits to the current page
- ///
- internal int CurrentPageSize
- {
- get { return _rowLayout.CurrentPageSize; }
- }
-
- ///
- /// Number of all visible nodes (which parent is expanded)
- ///
- internal int RowCount
- {
- get { return this.RowMap.Count; }
- }
-
- private int ContentWidth { get; set; }
-
- private int _firstVisibleRow;
- internal int FirstVisibleRow
- {
- get { return _firstVisibleRow; }
- set
- {
- HideEditor();
-
- _firstVisibleRow = value;
-
- UpdateView();
- }
- }
-
- private int _offsetX;
- internal int OffsetX
- {
- get { return _offsetX; }
- private set
- {
- HideEditor();
-
- _offsetX = value;
-
- UpdateView();
- }
- }
-
- public override Rectangle DisplayRectangle
- {
- get
- {
- Rectangle r = ClientRectangle;
- //r.Y += ColumnHeaderHeight;
- //r.Height -= ColumnHeaderHeight;
- int w = _vScrollBar.Visible ? _vScrollBar.Width : 0;
- int h = _hScrollBar.Visible ? _hScrollBar.Height : 0;
- return new Rectangle(r.X, r.Y, r.Width - w, r.Height - h);
- }
- }
-
- internal List Selection { get; private set; }
-
- #endregion
-
- #region Public Properties
-
- #region DesignTime
-
- private bool _showLines = true;
- [DefaultValue(true), Category("Behavior")]
- public bool ShowLines
- {
- get { return _showLines; }
- set
- {
- _showLines = value;
- UpdateView();
- }
- }
-
- private bool _showPlusMinus = true;
- [DefaultValue(true), Category("Behavior")]
- public bool ShowPlusMinus
- {
- get { return _showPlusMinus; }
- set
- {
- _showPlusMinus = value;
- FullUpdate();
- }
- }
-
- [DefaultValue(false), Category("Behavior")]
- public bool ShowNodeToolTips { get; set; }
-
- private ITreeModel _model;
- [Category("Data")]
- public ITreeModel Model
- {
- get { return _model; }
- set
- {
- if (_model != value)
- {
- if (_model != null)
- UnbindModelEvents();
-
- _model = value;
-
- CreateNodes();
- FullUpdate();
-
- if (_model != null)
- BindModelEvents();
- }
- }
- }
-
- // Font proprety for Tahoma as default font
- // wj32: Apparently some people don't have Tahoma...
- //private static Font _font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)), false);
- private static Font _font = DefaultFont;
- [Category("Appearance")]
- public override Font Font
- {
- get
- {
- return (base.Font);
- }
- set
- {
- if (value == null)
- base.Font = _font;
- else
- {
- if (value == Control.DefaultFont)
- base.Font = _font;
- else
- base.Font = value;
- }
- }
- }
- public override void ResetFont()
- {
- Font = null;
- }
- private bool ShouldSerializeFont()
- {
- return (!Font.Equals(_font));
- }
- // End font property
-
- private BorderStyle _borderStyle = BorderStyle.Fixed3D;
- [DefaultValue(BorderStyle.Fixed3D), Category("Appearance")]
- public BorderStyle BorderStyle
- {
- get { return this._borderStyle; }
- set
- {
- if (_borderStyle != value)
- {
- _borderStyle = value;
-
- this.RecreateHandle();
- this.Invalidate();
- }
- }
- }
-
- private bool _autoRowHeight;
- [DefaultValue(false), Category("Appearance")]
- public bool AutoRowHeight
- {
- get { return _autoRowHeight; }
- set
- {
- _autoRowHeight = value;
- if (value)
- _rowLayout = new AutoRowHeightLayout(this, RowHeight);
- else
- _rowLayout = new FixedRowHeightLayout(this, RowHeight);
- FullUpdate();
- }
- }
-
- private int _rowHeight = 16;
- [DefaultValue(16), Category("Appearance")]
- public int RowHeight
- {
- get
- {
- return _rowHeight;
- }
- set
- {
- if (value <= 0)
- throw new ArgumentOutOfRangeException("value");
-
- _rowHeight = value;
- _rowLayout.PreferredRowHeight = value;
- FullUpdate();
- }
- }
-
- private TreeSelectionMode _selectionMode = TreeSelectionMode.Single;
- [DefaultValue(TreeSelectionMode.Single), Category("Behavior")]
- public TreeSelectionMode SelectionMode
- {
- get { return _selectionMode; }
- set { _selectionMode = value; }
- }
-
- private bool _hideSelection;
- [DefaultValue(false), Category("Behavior")]
- public bool HideSelection
- {
- get { return _hideSelection; }
- set
- {
- _hideSelection = value;
- UpdateView();
- }
- }
-
- private float _topEdgeSensivity = 0.3f;
- [DefaultValue(0.3f), Category("Behavior")]
- public float TopEdgeSensivity
- {
- get { return _topEdgeSensivity; }
- set
- {
- if (value < 0 || value > 1)
- throw new ArgumentOutOfRangeException();
- _topEdgeSensivity = value;
- }
- }
-
- private float _bottomEdgeSensivity = 0.3f;
- [DefaultValue(0.3f), Category("Behavior")]
- public float BottomEdgeSensivity
- {
- get { return _bottomEdgeSensivity; }
- set
- {
- if (value < 0 || value > 1)
- throw new ArgumentOutOfRangeException("BottomEdgeSensivity", "value should be from 0 to 1");
- _bottomEdgeSensivity = value;
- }
- }
-
- [DefaultValue(false), Category("Behavior")]
- public bool LoadOnDemand { get; set; }
-
- private int _indent = 19;
- [DefaultValue(19), Category("Behavior")]
- public int Indent
- {
- get { return _indent; }
- set
- {
- _indent = value;
- UpdateView();
- }
- }
-
- private Color _lineColor = SystemColors.ControlDark;
- [Category("Behavior")]
- public Color LineColor
- {
- get { return _lineColor; }
- set
- {
- _lineColor = value;
- CreateLinePen();
- UpdateView();
- }
- }
-
- [Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public TreeColumnCollection Columns { get; private set; }
-
- [Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Editor(typeof(NodeControlCollectionEditor), typeof(UITypeEditor))]
- public NodeControlsCollection NodeControls { get; private set; }
-
- #endregion
-
- #region RunTime
-
- [Browsable(false)]
- public IToolTipProvider DefaultToolTipProvider { get; set; }
-
- [Browsable(false)]
- public IEnumerable AllNodes
- {
- get
- {
- if (this.Root.Nodes.Count > 0)
- {
- TreeNodeAdv node = this.Root.Nodes[0];
-
- while (node != null)
- {
- yield return node;
-
- if (node.Nodes.Count > 0)
- node = node.Nodes[0];
- else if (node.NextNode != null)
- node = node.NextNode;
- else
- node = node.BottomNode;
- }
- }
- }
- }
-
- [Browsable(false)]
- public TreeNodeAdv Root { get; private set; }
-
- [Browsable(false)]
- public ReadOnlyCollection SelectedNodes { get; private set; }
-
- [Browsable(false)]
- public TreeNodeAdv SelectedNode
- {
- get
- {
- if (this.Selection.Count > 0)
- {
- if (this.CurrentNode != null && this.CurrentNode.IsSelected)
- return this.CurrentNode;
-
- return this.Selection[0];
- }
-
- return null;
- }
- set
- {
- if (SelectedNode == value)
- return;
-
- BeginUpdate();
-
- try
- {
- if (value == null)
- {
- ClearSelectionInternal();
- }
- else
- {
- if (!IsMyNode(value))
- throw new ArgumentException();
-
- ClearSelectionInternal();
- value.IsSelected = true;
- this.CurrentNode = value;
- EnsureVisible(value);
- }
- }
- finally
- {
- EndUpdate();
- }
- }
- }
-
- [Browsable(false)]
- public TreeNodeAdv CurrentNode { get; internal set; }
-
- [Browsable(false)]
- public int ItemCount
- {
- get { return this.RowMap.Count; }
- }
-
- #endregion
-
- #endregion
-
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdvEventArgs.cs b/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdvEventArgs.cs
deleted file mode 100644
index a2e88438e..000000000
--- a/1.x/trunk/ProcessHacker/Components/TreeViewAdv/Tree/TreeViewAdvEventArgs.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace Aga.Controls.Tree
-{
- public class TreeViewAdvEventArgs : EventArgs
- {
- public TreeNodeAdv Node { get; private set; }
-
- public TreeViewAdvEventArgs(TreeNodeAdv node)
- {
- this.Node = node;
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Components/VerticleProgressBar.cs b/1.x/trunk/ProcessHacker/Components/VerticleProgressBar.cs
index ddde1dcaa..45693bae4 100644
--- a/1.x/trunk/ProcessHacker/Components/VerticleProgressBar.cs
+++ b/1.x/trunk/ProcessHacker/Components/VerticleProgressBar.cs
@@ -20,7 +20,12 @@
* along with Process Hacker. If not, see .
*/
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Drawing;
+using System.Data;
+using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
diff --git a/1.x/trunk/ProcessHacker/Components/VistaMenu/OwnerDrawnMenu.cs b/1.x/trunk/ProcessHacker/Components/VistaMenu/OwnerDrawnMenu.cs
new file mode 100644
index 000000000..10cab6d31
--- /dev/null
+++ b/1.x/trunk/ProcessHacker/Components/VistaMenu/OwnerDrawnMenu.cs
@@ -0,0 +1,235 @@
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Windows.Forms;
+
+
+namespace wyDay.Controls
+{
+ public partial class VistaMenu
+ {
+ ContainerControl ownerForm;
+
+ //conditionally draw the little lines under menu items with keyboard accelators on Win 2000+
+ private bool isUsingKeyboardAccel;
+
+
+ public VistaMenu(ContainerControl parentControl)
+ : this()
+ {
+ ownerForm = parentControl;
+ }
+ public ContainerControl ContainerControl
+ {
+ get { return ownerForm; }
+ set { ownerForm = value; }
+ }
+ public override ISite Site
+ {
+ set
+ {
+ // Runs at design time, ensures designer initializes ContainerControl
+ base.Site = value;
+ if (value == null) return;
+ IDesignerHost service = value.GetService(typeof(IDesignerHost)) as IDesignerHost;
+ if (service == null) return;
+ IComponent rootComponent = service.RootComponent;
+ ContainerControl = rootComponent as ContainerControl;
+ }
+ }
+
+
+ void ownerForm_ChangeUICues(object sender, UICuesEventArgs e)
+ {
+ isUsingKeyboardAccel = e.ShowKeyboard;
+ }
+
+
+ const int SEPARATOR_HEIGHT = 9;
+ const int BORDER_VERTICAL = 4;
+ const int LEFT_MARGIN = 4;
+ const int RIGHT_MARGIN = 6;
+ const int SHORTCUT_MARGIN = 20;
+ const int ARROW_MARGIN = 12;
+ const int ICON_SIZE = 16;
+
+
+ static void MenuItem_MeasureItem(object sender, MeasureItemEventArgs e)
+ {
+ Font font = ((MenuItem)sender).DefaultItem
+ ? new Font(SystemFonts.MenuFont, FontStyle.Bold)
+ : SystemFonts.MenuFont;
+
+ if (((MenuItem)sender).Text == "-")
+ e.ItemHeight = SEPARATOR_HEIGHT;
+ else
+ {
+ e.ItemHeight = ((SystemFonts.MenuFont.Height > ICON_SIZE) ? SystemFonts.MenuFont.Height : ICON_SIZE)
+ + BORDER_VERTICAL;
+
+ e.ItemWidth = LEFT_MARGIN + ICON_SIZE + RIGHT_MARGIN
+
+ //item text width
+ + TextRenderer.MeasureText(((MenuItem)sender).Text, font, Size.Empty, TextFormatFlags.SingleLine | TextFormatFlags.NoClipping).Width
+ + SHORTCUT_MARGIN
+
+ //shortcut text width
+ + TextRenderer.MeasureText(ShortcutToString(((MenuItem)sender).Shortcut), font, Size.Empty, TextFormatFlags.SingleLine | TextFormatFlags.NoClipping).Width
+
+ //arrow width
+ + ((((MenuItem)sender).IsParent) ? ARROW_MARGIN : 0);
+ }
+ }
+
+ void MenuItem_DrawItem(object sender, DrawItemEventArgs e)
+ {
+ e.Graphics.CompositingQuality = CompositingQuality.HighSpeed;
+ e.Graphics.InterpolationMode = InterpolationMode.Low;
+
+ bool menuSelected = (e.State & DrawItemState.Selected) == DrawItemState.Selected;
+
+ if (menuSelected)
+ e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds);
+ else
+ e.Graphics.FillRectangle(SystemBrushes.Menu, e.Bounds);
+
+ if (((MenuItem)sender).Text == "-")
+ {
+ //draw the separator
+ int yCenter = e.Bounds.Top + (e.Bounds.Height / 2) - 1;
+
+ e.Graphics.DrawLine(SystemPens.ControlDark, e.Bounds.Left + 1, yCenter, (e.Bounds.Left + e.Bounds.Width - 2), yCenter);
+ e.Graphics.DrawLine(SystemPens.ControlLightLight, e.Bounds.Left + 1, yCenter + 1, (e.Bounds.Left + e.Bounds.Width - 2), yCenter + 1);
+ }
+ else //regular menu items
+ {
+ //draw the item text
+ DrawText(sender, e, menuSelected);
+
+ if (((MenuItem)sender).Checked)
+ {
+ if (((MenuItem)sender).RadioCheck)
+ {
+ //draw the bullet
+ ControlPaint.DrawMenuGlyph(e.Graphics,
+ e.Bounds.Left + (LEFT_MARGIN + ICON_SIZE + RIGHT_MARGIN - SystemInformation.MenuCheckSize.Width) / 2,
+ e.Bounds.Top + (e.Bounds.Height - SystemInformation.MenuCheckSize.Height) / 2 + 1,
+ SystemInformation.MenuCheckSize.Width,
+ SystemInformation.MenuCheckSize.Height,
+ MenuGlyph.Bullet,
+ menuSelected ? SystemColors.HighlightText : SystemColors.MenuText,
+ menuSelected ? SystemColors.Highlight : SystemColors.Menu);
+ }
+ else
+ {
+ //draw the check mark
+ ControlPaint.DrawMenuGlyph(e.Graphics,
+ e.Bounds.Left + (LEFT_MARGIN + ICON_SIZE + RIGHT_MARGIN - SystemInformation.MenuCheckSize.Width) / 2,
+ e.Bounds.Top + (e.Bounds.Height - SystemInformation.MenuCheckSize.Height) / 2 + 1,
+ SystemInformation.MenuCheckSize.Width,
+ SystemInformation.MenuCheckSize.Height,
+ MenuGlyph.Checkmark,
+ menuSelected ? SystemColors.HighlightText : SystemColors.MenuText,
+ menuSelected ? SystemColors.Highlight : SystemColors.Menu);
+ }
+ }
+ else
+ {
+ Image drawImg = EnsurePropertiesExists((MenuItem)sender).PreVistaBitmap;
+
+ if (drawImg != null)
+ {
+ //draw the image
+ if (((MenuItem)sender).Enabled)
+ e.Graphics.DrawImage(drawImg, e.Bounds.Left + LEFT_MARGIN,
+ e.Bounds.Top + ((e.Bounds.Height - ICON_SIZE) / 2),
+ ICON_SIZE, ICON_SIZE);
+ else
+ ControlPaint.DrawImageDisabled(e.Graphics, drawImg,
+ e.Bounds.Left + LEFT_MARGIN,
+ e.Bounds.Top + ((e.Bounds.Height - ICON_SIZE) / 2),
+ SystemColors.Menu);
+ }
+ }
+ }
+ }
+
+
+ private static string ShortcutToString(Shortcut shortcut)
+ {
+ if (shortcut != Shortcut.None)
+ {
+ Keys keys = (Keys)shortcut;
+ return TypeDescriptor.GetConverter(keys.GetType()).ConvertToString(keys);
+ }
+
+ return null;
+ }
+
+ private void DrawText(object sender, DrawItemEventArgs e, bool isSelected)
+ {
+ string shortcutText = ShortcutToString(((MenuItem)sender).Shortcut);
+
+ int yPos = e.Bounds.Top + (e.Bounds.Height - SystemFonts.MenuFont.Height) / 2;
+
+ Font font = ((MenuItem)sender).DefaultItem
+ ? new Font(SystemFonts.MenuFont, FontStyle.Bold)
+ : SystemFonts.MenuFont;
+
+ Size textSize = TextRenderer.MeasureText(((MenuItem)sender).Text,
+ font, Size.Empty, TextFormatFlags.SingleLine | TextFormatFlags.NoClipping);
+
+ Rectangle textRect = new Rectangle(e.Bounds.Left + LEFT_MARGIN + ICON_SIZE + RIGHT_MARGIN, yPos,
+ textSize.Width, textSize.Height);
+
+ if (!((MenuItem)sender).Enabled && !isSelected) // disabled and not selected
+ {
+ textRect.Offset(1, 1);
+
+ TextRenderer.DrawText(e.Graphics, ((MenuItem)sender).Text, font,
+ textRect,
+ SystemColors.ControlLightLight,
+ TextFormatFlags.SingleLine | (isUsingKeyboardAccel ? 0 : TextFormatFlags.HidePrefix) | TextFormatFlags.NoClipping);
+
+ textRect.Offset(-1, -1);
+ }
+
+ //Draw the menu item text
+ TextRenderer.DrawText(e.Graphics, ((MenuItem)sender).Text, font,
+ textRect,
+ ((MenuItem)sender).Enabled ? (isSelected ? SystemColors.HighlightText : SystemColors.MenuText) : SystemColors.GrayText,
+ TextFormatFlags.SingleLine | (isUsingKeyboardAccel ? 0 : TextFormatFlags.HidePrefix) | TextFormatFlags.NoClipping);
+
+
+
+ //Draw the shortcut text
+ if (shortcutText != null)
+ {
+ textSize = TextRenderer.MeasureText(shortcutText,
+ font, Size.Empty, TextFormatFlags.SingleLine | TextFormatFlags.NoClipping);
+
+
+ textRect = new Rectangle(e.Bounds.Width - textSize.Width - ARROW_MARGIN, yPos, textSize.Width,
+ textSize.Height);
+
+ if (!((MenuItem)sender).Enabled && !isSelected) // disabled and not selected
+ {
+ textRect.Offset(1, 1);
+
+ TextRenderer.DrawText(e.Graphics, shortcutText, font,
+ textRect,
+ SystemColors.ControlLightLight,
+ TextFormatFlags.SingleLine | (isUsingKeyboardAccel ? 0 : TextFormatFlags.HidePrefix) | TextFormatFlags.NoClipping);
+
+ textRect.Offset(-1, -1);
+ }
+
+ TextRenderer.DrawText(e.Graphics, shortcutText, font,
+ textRect,
+ ((MenuItem)sender).Enabled ? (isSelected ? SystemColors.HighlightText : SystemColors.MenuText) : SystemColors.GrayText,
+ TextFormatFlags.SingleLine | TextFormatFlags.NoClipping);
+ }
+ }
+ }
+}
diff --git a/1.x/trunk/ProcessHacker/Components/VistaMenu/VistaMenu.cs b/1.x/trunk/ProcessHacker/Components/VistaMenu/VistaMenu.cs
new file mode 100644
index 000000000..60c06b132
--- /dev/null
+++ b/1.x/trunk/ProcessHacker/Components/VistaMenu/VistaMenu.cs
@@ -0,0 +1,411 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+using ProcessHacker.Native;
+
+
+//VistaMenu v1.7, created by Wyatt O'Day
+//Visit: http://wyday.com/vistamenu/
+
+namespace wyDay.Controls
+{
+ //Properties for the MenuItem
+ internal class Properties
+ {
+ public Image Image;
+ public IntPtr renderBmpHbitmap = IntPtr.Zero;
+ public Bitmap PreVistaBitmap;
+ }
+
+ //enum WindowsType { VistaOrLater, XP, PreXP }
+
+ [ProvideProperty("Image", typeof(MenuItem))]
+ public partial class VistaMenu : Component, IExtenderProvider, ISupportInitialize
+ {
+ private Container components;
+ private readonly Hashtable properties = new Hashtable();
+ private readonly Hashtable menuParents = new Hashtable();
+
+ private bool formHasBeenIntialized;
+
+ // performance hacks
+ private Queue> _pendingSetImageCalls =
+ new Queue>();
+
+ private static bool _firstVistaMenu = true;
+ private bool _delaySetImageCalls = false;
+
+ public bool DelaySetImageCalls
+ {
+ get { return _delaySetImageCalls; }
+ set { _delaySetImageCalls = value; }
+ }
+
+ #region Imports
+
+ [DllImport("user32.dll", CharSet = CharSet.Auto)]
+ public static extern bool SetMenuItemInfo(HandleRef hMenu, int uItem, bool fByPosition, MENUITEMINFO_T_RW lpmii);
+
+ [DllImport("user32.dll", CharSet = CharSet.Auto)]
+ public static extern bool SetMenuInfo(HandleRef hMenu, MENUINFO lpcmi);
+
+ [DllImport("gdi32.dll")]
+ public static extern bool DeleteObject(IntPtr hObject);
+
+ #endregion
+
+
+ public VistaMenu()
+ {
+ InitializeComponent();
+ }
+
+ public VistaMenu(IContainer container)
+ : this()
+ {
+ container.Add(this);
+
+ if (_firstVistaMenu)
+ {
+ _delaySetImageCalls = true;
+ _firstVistaMenu = false;
+ }
+ }
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new Container();
+ }
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ //release all the HBitmap handles created
+ foreach (DictionaryEntry de in properties)
+ {
+ if (((Properties)de.Value).renderBmpHbitmap != IntPtr.Zero)
+ DeleteObject(((Properties)de.Value).renderBmpHbitmap);
+ if (((Properties)de.Value).PreVistaBitmap != null)
+ ((Properties)de.Value).PreVistaBitmap.Dispose();
+ }
+
+
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose(disposing);
+ }
+
+ bool IExtenderProvider.CanExtend(object o)
+ {
+ if (o is MenuItem)
+ {
+ // reject the menuitem if it's a top level element on a MainMenu bar
+ if (((MenuItem)o).Parent != null)
+ return ((MenuItem)o).Parent.GetType() != typeof(MainMenu);
+
+ // parent is null - meaning it's a context menu
+ return true;
+ }
+
+ if (o is Form)
+ return true;
+
+ return false;
+ }
+
+ private Properties EnsurePropertiesExists(MenuItem key)
+ {
+ Properties p = (Properties)properties[key];
+
+ if (p == null)
+ {
+ p = new Properties();
+
+ properties[key] = p;
+ }
+
+ return p;
+ }
+
+
+ #region MenuItem.Image
+
+ [DefaultValue(null)]
+ [Description("The Image for the MenuItem")]
+ [Category("Appearance")]
+ public Image GetImage(MenuItem mnuItem)
+ {
+ return EnsurePropertiesExists(mnuItem).Image;
+ }
+
+ [DefaultValue(null)]
+ public void SetImage(MenuItem mnuItem, Image value)
+ {
+ this.SetImage(mnuItem, value, false);
+ }
+
+ public void SetImage(MenuItem mnuItem, Image value, bool ignorePending)
+ {
+ if (_delaySetImageCalls && !ignorePending)
+ {
+ _pendingSetImageCalls.Enqueue(new KeyValuePair
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DumpHackerWindow));
this.treeProcesses = new ProcessHacker.ProcessTree();
this.tabControl = new System.Windows.Forms.TabControl();
@@ -38,6 +39,7 @@
this.propertiesMenuItem = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.copyMenuItem = new System.Windows.Forms.MenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.goToProcessServiceMenuItem = new System.Windows.Forms.MenuItem();
this.propertiesServiceMenuItem = new System.Windows.Forms.MenuItem();
this.copyServiceMenuItem = new System.Windows.Forms.MenuItem();
@@ -46,6 +48,7 @@
this.tabControl.SuspendLayout();
this.tabProcesses.SuspendLayout();
this.tabServices.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// treeProcesses
@@ -100,6 +103,7 @@
// listServices
//
this.listServices.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listServices.DoubleBuffered = true;
this.listServices.Location = new System.Drawing.Point(3, 3);
this.listServices.Name = "listServices";
this.listServices.Provider = null;
@@ -117,6 +121,7 @@
// propertiesMenuItem
//
this.propertiesMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.propertiesMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
this.propertiesMenuItem.Index = 0;
this.propertiesMenuItem.Text = "Properties";
this.propertiesMenuItem.Click += new System.EventHandler(this.propertiesMenuItem_Click);
@@ -128,11 +133,18 @@
//
// copyMenuItem
//
+ this.vistaMenu.SetImage(this.copyMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyMenuItem.Index = 2;
this.copyMenuItem.Text = "Copy";
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// goToProcessServiceMenuItem
//
+ this.vistaMenu.SetImage(this.goToProcessServiceMenuItem, global::ProcessHacker.Properties.Resources.arrow_right);
this.goToProcessServiceMenuItem.Index = 0;
this.goToProcessServiceMenuItem.Text = "Go to Process";
this.goToProcessServiceMenuItem.Click += new System.EventHandler(this.goToProcessServiceMenuItem_Click);
@@ -140,12 +152,14 @@
// propertiesServiceMenuItem
//
this.propertiesServiceMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.propertiesServiceMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
this.propertiesServiceMenuItem.Index = 1;
this.propertiesServiceMenuItem.Text = "Properties";
this.propertiesServiceMenuItem.Click += new System.EventHandler(this.propertiesServiceMenuItem_Click);
//
// copyServiceMenuItem
//
+ this.vistaMenu.SetImage(this.copyServiceMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyServiceMenuItem.Index = 3;
this.copyServiceMenuItem.Text = "Copy";
//
@@ -167,17 +181,17 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(903, 525);
this.Controls.Add(this.tabControl);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DumpHackerWindow";
this.Text = "Dump Viewer";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DumpHackerWindow_FormClosing);
this.Load += new System.EventHandler(this.DumpHackerWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DumpHackerWindow_FormClosing);
this.tabControl.ResumeLayout(false);
this.tabProcesses.ResumeLayout(false);
this.tabServices.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
@@ -191,7 +205,7 @@
private ProcessHacker.Components.ServiceList listServices;
private System.Windows.Forms.ContextMenu menuProcess;
private System.Windows.Forms.MenuItem propertiesMenuItem;
-
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.MenuItem copyMenuItem;
private System.Windows.Forms.ContextMenu menuService;
private System.Windows.Forms.MenuItem goToProcessServiceMenuItem;
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.cs b/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.cs
index 8c214fdec..a3bcbf82d 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.cs
@@ -27,22 +27,23 @@ using ProcessHacker.Common;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Mfs;
+using ProcessHacker.Native.Objects;
using ProcessHacker.UI;
namespace ProcessHacker
{
public partial class DumpHackerWindow : Form
{
- private readonly MemoryFileSystem _mfs;
+ private MemoryFileSystem _mfs;
private MemoryObject _processesMo;
private MemoryObject _servicesMo;
private string _phVersion;
private string _osVersion;
private OSArch _architecture;
private string _userName;
- private readonly Dictionary _processes = new Dictionary();
- private readonly Dictionary _services = new Dictionary();
- private readonly Dictionary> _processServices = new Dictionary>();
+ private Dictionary _processes = new Dictionary();
+ private Dictionary _services = new Dictionary();
+ private Dictionary> _processServices = new Dictionary>();
public DumpHackerWindow(string fileName)
{
@@ -54,7 +55,7 @@ namespace ProcessHacker
ColumnSettings.LoadSettings(Settings.Instance.ProcessTreeColumns, treeProcesses.Tree);
ColumnSettings.LoadSettings(Settings.Instance.ServiceListViewColumns, listServices.List);
- listServices.DoubleClick += this.listServices_DoubleClick;
+ listServices.DoubleClick += new EventHandler(listServices_DoubleClick);
}
private void DumpHackerWindow_Load(object sender, EventArgs e)
@@ -105,7 +106,9 @@ namespace ProcessHacker
private void LoadSystemInformation()
{
- MemoryObject sysInfoMo = this._mfs.RootObject.GetChild("SystemInformation");
+ MemoryObject sysInfoMo;
+
+ sysInfoMo = _mfs.RootObject.GetChild("SystemInformation");
if (sysInfoMo == null)
{
@@ -114,7 +117,7 @@ namespace ProcessHacker
return;
}
- IDictionary dict = Dump.GetDictionary(sysInfoMo);
+ var dict = Dump.GetDictionary(sysInfoMo);
sysInfoMo.Dispose();
@@ -133,27 +136,30 @@ namespace ProcessHacker
private void LoadProcesses()
{
- MemoryObject processesMo = this._mfs.RootObject.GetChild("Processes");
+ MemoryObject processesMo;
+
+ processesMo = _mfs.RootObject.GetChild("Processes");
_processesMo = processesMo;
if (processesMo == null)
{
- PhUtils.ShowWarning("The dump file does not contain process information. This most likely means the file is corrupt.");
+ PhUtils.ShowWarning("The dump file does not contain process information. This most likely " +
+ "means the file is corrupt.");
return;
}
- processesMo.EnumChildren(childMo =>
- {
- using (childMo)
- this.LoadProcess(childMo);
+ processesMo.EnumChildren((childMo) =>
+ {
+ using (childMo)
+ this.LoadProcess(childMo);
- return true;
- });
+ return true;
+ });
}
private void LoadProcess(MemoryObject mo)
{
- var names = mo.ChildNames;
+ var names = mo.GetChildNames();
ProcessItem pitem;
if (!names.Contains("General"))
@@ -161,15 +167,13 @@ namespace ProcessHacker
IDictionary generalDict;
- using (MemoryObject general = mo.GetChild("General"))
+ using (var general = mo.GetChild("General"))
generalDict = Dump.GetDictionary(general);
- pitem = new ProcessItem
- {
- Pid = Dump.ParseInt32(generalDict["ProcessId"]),
- Name = generalDict["Name"],
- ParentPid = Dump.ParseInt32(generalDict["ParentPid"])
- };
+ pitem = new ProcessItem();
+ pitem.Pid = Dump.ParseInt32(generalDict["ProcessId"]);
+ pitem.Name = generalDict["Name"];
+ pitem.ParentPid = Dump.ParseInt32(generalDict["ParentPid"]);
if (generalDict.ContainsKey("HasParent"))
pitem.HasParent = Dump.ParseBool(generalDict["HasParent"]);
@@ -183,13 +187,11 @@ namespace ProcessHacker
if (generalDict.ContainsKey("FileDescription"))
{
- pitem.VersionInfo = new ImageVersionInfo
- {
- FileDescription = generalDict["FileDescription"],
- CompanyName = generalDict["FileCompanyName"],
- FileVersion = generalDict["FileVersion"],
- FileName = pitem.FileName
- };
+ pitem.VersionInfo = new ImageVersionInfo();
+ pitem.VersionInfo.FileDescription = generalDict["FileDescription"];
+ pitem.VersionInfo.CompanyName = generalDict["FileCompanyName"];
+ pitem.VersionInfo.FileVersion = generalDict["FileVersion"];
+ pitem.VersionInfo.FileName = pitem.FileName;
}
if (generalDict.ContainsKey("CommandLine"))
@@ -266,7 +268,7 @@ namespace ProcessHacker
return;
}
- servicesMo.EnumChildren(childMo =>
+ servicesMo.EnumChildren((childMo) =>
{
using (childMo)
this.LoadService(childMo);
@@ -363,17 +365,18 @@ namespace ProcessHacker
private void menuProcess_Popup(object sender, EventArgs e)
{
- switch (this.treeProcesses.SelectedTreeNodes.Count)
+ if (treeProcesses.SelectedTreeNodes.Count == 0)
{
- case 0:
- break;
- case 1:
- this.menuProcess.EnableAll();
- break;
- default:
- this.menuProcess.EnableAll();
- this.propertiesMenuItem.Enabled = false;
- break;
+ menuProcess.DisableAll();
+ }
+ else if (treeProcesses.SelectedTreeNodes.Count == 1)
+ {
+ menuProcess.EnableAll();
+ }
+ else
+ {
+ menuProcess.EnableAll();
+ propertiesMenuItem.Enabled = false;
}
}
@@ -396,7 +399,7 @@ namespace ProcessHacker
{
if (listServices.SelectedItems.Count == 0)
{
- //menuService.DisableAll();
+ menuService.DisableAll();
}
else if (listServices.SelectedItems.Count == 1)
{
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.resx b/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.resx
index 09cc1a538..a5532164d 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/DumpHackerWindow.resx
@@ -112,18 +112,18 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
-
- 249, 17
+
+ 141, 17
-
+
AAABAA8AMDAQAAEABABoBgAA9gAAACAgEAABAAQA6AIAAF4HAAAQEBAAAQAEACgBAABGCgAAAAAAAAEA
@@ -912,4 +912,7 @@
QQAArEEAAKxBAACsQXAArEFwAKxBcACsQXAArEFwAKxBAACsQQ==
+
+ 249, 17
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.Designer.cs
index cab4ac1ca..d9bb00827 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.Designer.cs
@@ -1,6 +1,6 @@
namespace ProcessHacker
{
- sealed partial class DumpProcessWindow
+ partial class DumpProcessWindow
{
///
/// Required designer variable.
@@ -34,6 +34,13 @@
{
this.tabControl = new System.Windows.Forms.TabControl();
this.tabGeneral = new System.Windows.Forms.TabPage();
+ this.tabToken = new System.Windows.Forms.TabPage();
+ this.tabModules = new System.Windows.Forms.TabPage();
+ this.tabEnvironment = new System.Windows.Forms.TabPage();
+ this.listEnvironment = new System.Windows.Forms.ListView();
+ this.columnVarName = new System.Windows.Forms.ColumnHeader();
+ this.columnVarValue = new System.Windows.Forms.ColumnHeader();
+ this.tabHandles = new System.Windows.Forms.TabPage();
this.groupProcess = new System.Windows.Forms.GroupBox();
this.labelProcessTypeValue = new System.Windows.Forms.Label();
this.labelProcessType = new System.Windows.Forms.Label();
@@ -46,7 +53,6 @@
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textStartTime = new System.Windows.Forms.TextBox();
- this.textCurrentDirectory = new System.Windows.Forms.TextBox();
this.textCmdLine = new System.Windows.Forms.TextBox();
this.groupFile = new System.Windows.Forms.GroupBox();
this.pictureIcon = new System.Windows.Forms.PictureBox();
@@ -54,25 +60,19 @@
this.textFileCompany = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
- this.textFileName = new System.Windows.Forms.TextBox();
this.textFileVersion = new System.Windows.Forms.TextBox();
- this.tabToken = new System.Windows.Forms.TabPage();
- this.tabModules = new System.Windows.Forms.TabPage();
+ this.textFileName = new System.Windows.Forms.TextBox();
+ this.textCurrentDirectory = new System.Windows.Forms.TextBox();
this.listModules = new ProcessHacker.Components.ModuleList();
- this.tabEnvironment = new System.Windows.Forms.TabPage();
- this.listEnvironment = new ProcessHacker.Components.ExtendedListView();
- this.columnVarName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnVarValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.tabHandles = new System.Windows.Forms.TabPage();
this.listHandles = new ProcessHacker.Components.HandleList();
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
- this.groupProcess.SuspendLayout();
- this.groupFile.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).BeginInit();
this.tabModules.SuspendLayout();
this.tabEnvironment.SuspendLayout();
this.tabHandles.SuspendLayout();
+ this.groupProcess.SuspendLayout();
+ this.groupFile.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).BeginInit();
this.SuspendLayout();
//
// tabControl
@@ -101,11 +101,80 @@
this.tabGeneral.Text = "General";
this.tabGeneral.UseVisualStyleBackColor = true;
//
+ // tabToken
+ //
+ this.tabToken.Location = new System.Drawing.Point(4, 22);
+ this.tabToken.Name = "tabToken";
+ this.tabToken.Size = new System.Drawing.Size(469, 441);
+ this.tabToken.TabIndex = 4;
+ this.tabToken.Text = "Token";
+ this.tabToken.UseVisualStyleBackColor = true;
+ //
+ // tabModules
+ //
+ this.tabModules.Controls.Add(this.listModules);
+ this.tabModules.Location = new System.Drawing.Point(4, 22);
+ this.tabModules.Name = "tabModules";
+ this.tabModules.Padding = new System.Windows.Forms.Padding(3);
+ this.tabModules.Size = new System.Drawing.Size(469, 441);
+ this.tabModules.TabIndex = 1;
+ this.tabModules.Text = "Modules";
+ this.tabModules.UseVisualStyleBackColor = true;
+ //
+ // tabEnvironment
+ //
+ this.tabEnvironment.Controls.Add(this.listEnvironment);
+ this.tabEnvironment.Location = new System.Drawing.Point(4, 22);
+ this.tabEnvironment.Name = "tabEnvironment";
+ this.tabEnvironment.Padding = new System.Windows.Forms.Padding(3);
+ this.tabEnvironment.Size = new System.Drawing.Size(469, 441);
+ this.tabEnvironment.TabIndex = 3;
+ this.tabEnvironment.Text = "Environment";
+ this.tabEnvironment.UseVisualStyleBackColor = true;
+ //
+ // listEnvironment
+ //
+ this.listEnvironment.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnVarName,
+ this.columnVarValue});
+ this.listEnvironment.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listEnvironment.FullRowSelect = true;
+ this.listEnvironment.HideSelection = false;
+ this.listEnvironment.Location = new System.Drawing.Point(3, 3);
+ this.listEnvironment.Name = "listEnvironment";
+ this.listEnvironment.ShowItemToolTips = true;
+ this.listEnvironment.Size = new System.Drawing.Size(463, 435);
+ this.listEnvironment.Sorting = System.Windows.Forms.SortOrder.Ascending;
+ this.listEnvironment.TabIndex = 1;
+ this.listEnvironment.UseCompatibleStateImageBehavior = false;
+ this.listEnvironment.View = System.Windows.Forms.View.Details;
+ //
+ // columnVarName
+ //
+ this.columnVarName.Text = "Name";
+ this.columnVarName.Width = 150;
+ //
+ // columnVarValue
+ //
+ this.columnVarValue.Text = "Value";
+ this.columnVarValue.Width = 250;
+ //
+ // tabHandles
+ //
+ this.tabHandles.Controls.Add(this.listHandles);
+ this.tabHandles.Location = new System.Drawing.Point(4, 22);
+ this.tabHandles.Name = "tabHandles";
+ this.tabHandles.Padding = new System.Windows.Forms.Padding(3);
+ this.tabHandles.Size = new System.Drawing.Size(469, 441);
+ this.tabHandles.TabIndex = 2;
+ this.tabHandles.Text = "Handles";
+ this.tabHandles.UseVisualStyleBackColor = true;
+ //
// groupProcess
//
- this.groupProcess.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupProcess.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupProcess.Controls.Add(this.labelProcessTypeValue);
this.groupProcess.Controls.Add(this.labelProcessType);
this.groupProcess.Controls.Add(this.label26);
@@ -141,7 +210,7 @@
this.labelProcessType.AutoSize = true;
this.labelProcessType.Location = new System.Drawing.Point(6, 157);
this.labelProcessType.Name = "labelProcessType";
- this.labelProcessType.Size = new System.Drawing.Size(74, 13);
+ this.labelProcessType.Size = new System.Drawing.Size(75, 13);
this.labelProcessType.TabIndex = 19;
this.labelProcessType.Text = "Process Type:";
this.labelProcessType.Visible = false;
@@ -151,19 +220,19 @@
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(6, 22);
this.label26.Name = "label26";
- this.label26.Size = new System.Drawing.Size(47, 13);
+ this.label26.Size = new System.Drawing.Size(44, 13);
this.label26.TabIndex = 12;
this.label26.Text = "Started:";
//
// textDEP
//
- this.textDEP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDEP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textDEP.BackColor = System.Drawing.SystemColors.Control;
this.textDEP.Location = new System.Drawing.Point(101, 128);
this.textDEP.Name = "textDEP";
this.textDEP.ReadOnly = true;
- this.textDEP.Size = new System.Drawing.Size(348, 22);
+ this.textDEP.Size = new System.Drawing.Size(348, 20);
this.textDEP.TabIndex = 8;
//
// labelDEP
@@ -171,7 +240,7 @@
this.labelDEP.AutoSize = true;
this.labelDEP.Location = new System.Drawing.Point(6, 131);
this.labelDEP.Name = "labelDEP";
- this.labelDEP.Size = new System.Drawing.Size(30, 13);
+ this.labelDEP.Size = new System.Drawing.Size(32, 13);
this.labelDEP.TabIndex = 17;
this.labelDEP.Text = "DEP:";
//
@@ -191,19 +260,19 @@
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 105);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(43, 13);
+ this.label5.Size = new System.Drawing.Size(41, 13);
this.label5.TabIndex = 16;
this.label5.Text = "Parent:";
//
// textParent
//
- this.textParent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textParent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textParent.BackColor = System.Drawing.SystemColors.Control;
this.textParent.Location = new System.Drawing.Point(101, 102);
this.textParent.Name = "textParent";
this.textParent.ReadOnly = true;
- this.textParent.Size = new System.Drawing.Size(318, 22);
+ this.textParent.Size = new System.Drawing.Size(318, 20);
this.textParent.TabIndex = 6;
//
// label4
@@ -211,7 +280,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 76);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(98, 13);
+ this.label4.Size = new System.Drawing.Size(89, 13);
this.label4.TabIndex = 14;
this.label4.Text = "Current Directory:";
//
@@ -220,44 +289,34 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 48);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(86, 13);
+ this.label2.Size = new System.Drawing.Size(80, 13);
this.label2.TabIndex = 13;
this.label2.Text = "Command Line:";
//
// textStartTime
//
- this.textStartTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textStartTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textStartTime.Location = new System.Drawing.Point(101, 19);
this.textStartTime.Name = "textStartTime";
this.textStartTime.ReadOnly = true;
- this.textStartTime.Size = new System.Drawing.Size(348, 22);
+ this.textStartTime.Size = new System.Drawing.Size(348, 20);
this.textStartTime.TabIndex = 0;
//
- // textCurrentDirectory
- //
- this.textCurrentDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textCurrentDirectory.Location = new System.Drawing.Point(101, 73);
- this.textCurrentDirectory.Name = "textCurrentDirectory";
- this.textCurrentDirectory.ReadOnly = true;
- this.textCurrentDirectory.Size = new System.Drawing.Size(348, 22);
- this.textCurrentDirectory.TabIndex = 2;
- //
// textCmdLine
//
- this.textCmdLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textCmdLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textCmdLine.Location = new System.Drawing.Point(101, 45);
this.textCmdLine.Name = "textCmdLine";
this.textCmdLine.ReadOnly = true;
- this.textCmdLine.Size = new System.Drawing.Size(348, 22);
+ this.textCmdLine.Size = new System.Drawing.Size(348, 20);
this.textCmdLine.TabIndex = 2;
//
// groupFile
//
- this.groupFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupFile.Controls.Add(this.pictureIcon);
this.groupFile.Controls.Add(this.textFileDescription);
this.groupFile.Controls.Add(this.textFileCompany);
@@ -283,27 +342,27 @@
//
// textFileDescription
//
- this.textFileDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileDescription.BackColor = System.Drawing.SystemColors.Window;
this.textFileDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textFileDescription.Location = new System.Drawing.Point(44, 20);
this.textFileDescription.Name = "textFileDescription";
this.textFileDescription.ReadOnly = true;
- this.textFileDescription.Size = new System.Drawing.Size(407, 15);
+ this.textFileDescription.Size = new System.Drawing.Size(407, 13);
this.textFileDescription.TabIndex = 2;
this.textFileDescription.Text = "File Description";
//
// textFileCompany
//
- this.textFileCompany.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileCompany.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileCompany.BackColor = System.Drawing.SystemColors.Window;
this.textFileCompany.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textFileCompany.Location = new System.Drawing.Point(44, 38);
this.textFileCompany.Name = "textFileCompany";
this.textFileCompany.ReadOnly = true;
- this.textFileCompany.Size = new System.Drawing.Size(407, 15);
+ this.textFileCompany.Size = new System.Drawing.Size(407, 13);
this.textFileCompany.TabIndex = 3;
this.textFileCompany.Text = "File Company";
//
@@ -312,7 +371,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 60);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(83, 13);
+ this.label1.Size = new System.Drawing.Size(77, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Image Version:";
//
@@ -321,112 +380,54 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 88);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(94, 13);
+ this.label3.Size = new System.Drawing.Size(89, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Image File Name:";
//
- // textFileName
- //
- this.textFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textFileName.Location = new System.Drawing.Point(103, 85);
- this.textFileName.Name = "textFileName";
- this.textFileName.ReadOnly = true;
- this.textFileName.Size = new System.Drawing.Size(348, 22);
- this.textFileName.TabIndex = 0;
- //
// textFileVersion
//
- this.textFileVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileVersion.Location = new System.Drawing.Point(103, 57);
this.textFileVersion.Name = "textFileVersion";
this.textFileVersion.ReadOnly = true;
- this.textFileVersion.Size = new System.Drawing.Size(348, 22);
+ this.textFileVersion.Size = new System.Drawing.Size(348, 20);
this.textFileVersion.TabIndex = 0;
//
- // tabToken
+ // textFileName
//
- this.tabToken.Location = new System.Drawing.Point(4, 22);
- this.tabToken.Name = "tabToken";
- this.tabToken.Size = new System.Drawing.Size(469, 441);
- this.tabToken.TabIndex = 4;
- this.tabToken.Text = "Token";
- this.tabToken.UseVisualStyleBackColor = true;
+ this.textFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileName.Location = new System.Drawing.Point(103, 85);
+ this.textFileName.Name = "textFileName";
+ this.textFileName.ReadOnly = true;
+ this.textFileName.Size = new System.Drawing.Size(348, 20);
+ this.textFileName.TabIndex = 0;
//
- // tabModules
+ // textCurrentDirectory
//
- this.tabModules.Controls.Add(this.listModules);
- this.tabModules.Location = new System.Drawing.Point(4, 22);
- this.tabModules.Name = "tabModules";
- this.tabModules.Padding = new System.Windows.Forms.Padding(3);
- this.tabModules.Size = new System.Drawing.Size(469, 441);
- this.tabModules.TabIndex = 1;
- this.tabModules.Text = "Modules";
- this.tabModules.UseVisualStyleBackColor = true;
+ this.textCurrentDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textCurrentDirectory.Location = new System.Drawing.Point(101, 73);
+ this.textCurrentDirectory.Name = "textCurrentDirectory";
+ this.textCurrentDirectory.ReadOnly = true;
+ this.textCurrentDirectory.Size = new System.Drawing.Size(348, 20);
+ this.textCurrentDirectory.TabIndex = 2;
//
// listModules
//
this.listModules.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listModules.DoubleBuffered = true;
this.listModules.Location = new System.Drawing.Point(3, 3);
this.listModules.Name = "listModules";
this.listModules.Provider = null;
this.listModules.Size = new System.Drawing.Size(463, 435);
this.listModules.TabIndex = 0;
//
- // tabEnvironment
- //
- this.tabEnvironment.Controls.Add(this.listEnvironment);
- this.tabEnvironment.Location = new System.Drawing.Point(4, 22);
- this.tabEnvironment.Name = "tabEnvironment";
- this.tabEnvironment.Padding = new System.Windows.Forms.Padding(3);
- this.tabEnvironment.Size = new System.Drawing.Size(469, 441);
- this.tabEnvironment.TabIndex = 3;
- this.tabEnvironment.Text = "Environment";
- this.tabEnvironment.UseVisualStyleBackColor = true;
- //
- // listEnvironment
- //
- this.listEnvironment.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnVarName,
- this.columnVarValue});
- this.listEnvironment.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listEnvironment.DoubleClickChecks = true;
- this.listEnvironment.FullRowSelect = true;
- this.listEnvironment.HideSelection = false;
- this.listEnvironment.Location = new System.Drawing.Point(3, 3);
- this.listEnvironment.Name = "listEnvironment";
- this.listEnvironment.ShowItemToolTips = true;
- this.listEnvironment.Size = new System.Drawing.Size(463, 435);
- this.listEnvironment.Sorting = System.Windows.Forms.SortOrder.Ascending;
- this.listEnvironment.TabIndex = 1;
- this.listEnvironment.UseCompatibleStateImageBehavior = false;
- this.listEnvironment.View = System.Windows.Forms.View.Details;
- //
- // columnVarName
- //
- this.columnVarName.Text = "Name";
- this.columnVarName.Width = 150;
- //
- // columnVarValue
- //
- this.columnVarValue.Text = "Value";
- this.columnVarValue.Width = 250;
- //
- // tabHandles
- //
- this.tabHandles.Controls.Add(this.listHandles);
- this.tabHandles.Location = new System.Drawing.Point(4, 22);
- this.tabHandles.Name = "tabHandles";
- this.tabHandles.Padding = new System.Windows.Forms.Padding(3);
- this.tabHandles.Size = new System.Drawing.Size(469, 441);
- this.tabHandles.TabIndex = 2;
- this.tabHandles.Text = "Handles";
- this.tabHandles.UseVisualStyleBackColor = true;
- //
// listHandles
//
this.listHandles.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listHandles.DoubleBuffered = true;
this.listHandles.Location = new System.Drawing.Point(3, 3);
this.listHandles.Name = "listHandles";
this.listHandles.Provider = null;
@@ -437,24 +438,23 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(483, 473);
this.Controls.Add(this.tabControl);
this.Name = "DumpProcessWindow";
this.Padding = new System.Windows.Forms.Padding(3);
this.Text = "Process";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DumpProcessWindow_FormClosing);
this.Load += new System.EventHandler(this.DumpProcessWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DumpProcessWindow_FormClosing);
this.tabControl.ResumeLayout(false);
this.tabGeneral.ResumeLayout(false);
+ this.tabModules.ResumeLayout(false);
+ this.tabEnvironment.ResumeLayout(false);
+ this.tabHandles.ResumeLayout(false);
this.groupProcess.ResumeLayout(false);
this.groupProcess.PerformLayout();
this.groupFile.ResumeLayout(false);
this.groupFile.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).EndInit();
- this.tabModules.ResumeLayout(false);
- this.tabEnvironment.ResumeLayout(false);
- this.tabHandles.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -469,7 +469,7 @@
private System.Windows.Forms.TabPage tabEnvironment;
private ProcessHacker.Components.ModuleList listModules;
private ProcessHacker.Components.HandleList listHandles;
- private ProcessHacker.Components.ExtendedListView listEnvironment;
+ private System.Windows.Forms.ListView listEnvironment;
private System.Windows.Forms.ColumnHeader columnVarName;
private System.Windows.Forms.ColumnHeader columnVarValue;
private System.Windows.Forms.GroupBox groupProcess;
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.cs b/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.cs
index de9275d00..171e72bc1 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.cs
@@ -21,7 +21,6 @@
*/
using System;
-using System.Collections.Generic;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Components;
@@ -33,11 +32,11 @@ using ProcessHacker.UI;
namespace ProcessHacker
{
- public sealed partial class DumpProcessWindow : Form
+ public partial class DumpProcessWindow : Form
{
- private readonly DumpHackerWindow _hw;
- private readonly ProcessItem _item;
- private readonly MemoryObject _processMo;
+ private DumpHackerWindow _hw;
+ private ProcessItem _item;
+ private MemoryObject _processMo;
private TokenProperties _tokenProps;
@@ -66,10 +65,8 @@ namespace ProcessHacker
{
this.LoadProperties();
- _tokenProps = new TokenProperties(null)
- {
- Dock = DockStyle.Fill
- };
+ _tokenProps = new TokenProperties(null);
+ _tokenProps.Dock = DockStyle.Fill;
tabToken.Controls.Add(_tokenProps);
_tokenProps.DumpInitialize();
this.LoadToken();
@@ -77,6 +74,7 @@ namespace ProcessHacker
// Modules
if (_item.FileName != null)
listModules.DumpSetMainModule(_item.FileName);
+ listModules.List.SetTheme("explorer");
listModules.List.AddShortcuts();
listModules.List.ContextMenu = listModules.List.GetCopyMenu();
@@ -84,6 +82,7 @@ namespace ProcessHacker
listModules.UpdateItems();
// Environment
+ listEnvironment.SetTheme("explorer");
listEnvironment.AddShortcuts();
listEnvironment.ContextMenu = listEnvironment.GetCopyMenu();
@@ -91,6 +90,7 @@ namespace ProcessHacker
// Handles
listHandles.DumpDisableEvents();
+ listHandles.List.SetTheme("explorer");
listHandles.List.AddShortcuts();
listHandles.List.ContextMenu = listHandles.List.GetCopyMenu();
@@ -110,7 +110,7 @@ namespace ProcessHacker
private void LoadProperties()
{
- var names = _processMo.ChildNames;
+ var names = _processMo.GetChildNames();
if (names.Contains("LargeIcon"))
{
@@ -131,8 +131,8 @@ namespace ProcessHacker
else
{
textFileDescription.Text = _item.Name;
- textFileCompany.Text = string.Empty;
- textFileVersion.Text = string.Empty;
+ textFileCompany.Text = "";
+ textFileVersion.Text = "";
}
textFileName.Text = _item.FileName;
@@ -297,7 +297,7 @@ namespace ProcessHacker
if (modulesMo == null)
return;
- modulesMo.EnumChildren(childMo =>
+ modulesMo.EnumChildren((childMo) =>
{
using (childMo)
this.LoadModule(childMo);
@@ -331,17 +331,17 @@ namespace ProcessHacker
private void LoadEnvironment()
{
- MemoryObject env = _processMo.GetChild("Environment");
+ var env = _processMo.GetChild("Environment");
if (env == null)
return;
- IDictionary dict = Dump.GetDictionary(env);
+ var dict = Dump.GetDictionary(env);
foreach (var kvp in dict)
{
if (!string.IsNullOrEmpty(kvp.Key))
- listEnvironment.Items.Add(new ListViewItem(new[] { kvp.Key, kvp.Value }));
+ listEnvironment.Items.Add(new ListViewItem(new string[] { kvp.Key, kvp.Value }));
}
env.Dispose();
@@ -356,7 +356,7 @@ namespace ProcessHacker
if (handlesMo == null)
return;
- handlesMo.EnumChildren(childMo =>
+ handlesMo.EnumChildren((childMo) =>
{
using (childMo)
this.LoadHandles(childMo);
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.resx b/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/DumpProcessWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.Designer.cs
index 96c14100f..eab5689bc 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.Designer.cs
@@ -50,127 +50,126 @@
//
// textServiceDll
//
- this.textServiceDll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textServiceDll.Location = new System.Drawing.Point(91, 230);
+ this.textServiceDll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textServiceDll.Location = new System.Drawing.Point(93, 200);
this.textServiceDll.Name = "textServiceDll";
this.textServiceDll.ReadOnly = true;
- this.textServiceDll.Size = new System.Drawing.Size(303, 22);
+ this.textServiceDll.Size = new System.Drawing.Size(303, 20);
this.textServiceDll.TabIndex = 43;
//
// label8
//
this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(10, 233);
+ this.label8.Location = new System.Drawing.Point(12, 203);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(66, 13);
+ this.label8.Size = new System.Drawing.Size(69, 13);
this.label8.TabIndex = 42;
this.label8.Text = "Service DLL:";
//
// textDescription
//
- this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.textDescription.Location = new System.Drawing.Point(13, 44);
+ this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.textDescription.Location = new System.Drawing.Point(12, 51);
this.textDescription.Multiline = true;
this.textDescription.Name = "textDescription";
this.textDescription.ReadOnly = true;
this.textDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.textDescription.Size = new System.Drawing.Size(384, 75);
+ this.textDescription.Size = new System.Drawing.Size(384, 38);
this.textDescription.TabIndex = 38;
- this.textDescription.TextChanged += new System.EventHandler(this.textDescription_TextChanged);
//
// textLoadOrderGroup
//
- this.textLoadOrderGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textLoadOrderGroup.Location = new System.Drawing.Point(244, 152);
+ this.textLoadOrderGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textLoadOrderGroup.Location = new System.Drawing.Point(246, 122);
this.textLoadOrderGroup.Name = "textLoadOrderGroup";
this.textLoadOrderGroup.ReadOnly = true;
- this.textLoadOrderGroup.Size = new System.Drawing.Size(150, 22);
+ this.textLoadOrderGroup.Size = new System.Drawing.Size(150, 20);
this.textLoadOrderGroup.TabIndex = 37;
//
// label6
//
this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(199, 128);
+ this.label6.Location = new System.Drawing.Point(201, 98);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(60, 13);
+ this.label6.Size = new System.Drawing.Size(59, 13);
this.label6.TabIndex = 33;
this.label6.Text = "Start Type:";
//
// label5
//
this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(10, 155);
+ this.label5.Location = new System.Drawing.Point(12, 125);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(77, 13);
+ this.label5.Size = new System.Drawing.Size(68, 13);
this.label5.TabIndex = 32;
this.label5.Text = "Error Control:";
//
// label4
//
this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(10, 128);
+ this.label4.Location = new System.Drawing.Point(12, 98);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(33, 13);
+ this.label4.Size = new System.Drawing.Size(34, 13);
this.label4.TabIndex = 31;
this.label4.Text = "Type:";
//
// label3
//
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(199, 155);
+ this.label3.Location = new System.Drawing.Point(201, 125);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(43, 13);
+ this.label3.Size = new System.Drawing.Size(39, 13);
this.label3.TabIndex = 30;
this.label3.Text = "Group:";
//
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(10, 181);
+ this.label2.Location = new System.Drawing.Point(12, 151);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(68, 13);
+ this.label2.Size = new System.Drawing.Size(64, 13);
this.label2.TabIndex = 29;
this.label2.Text = "Binary Path:";
//
// textUserAccount
//
- this.textUserAccount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textUserAccount.Location = new System.Drawing.Point(91, 204);
+ this.textUserAccount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textUserAccount.Location = new System.Drawing.Point(93, 174);
this.textUserAccount.Name = "textUserAccount";
this.textUserAccount.ReadOnly = true;
- this.textUserAccount.Size = new System.Drawing.Size(303, 22);
+ this.textUserAccount.Size = new System.Drawing.Size(303, 20);
this.textUserAccount.TabIndex = 28;
//
// label1
//
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(10, 207);
+ this.label1.Location = new System.Drawing.Point(12, 177);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(78, 13);
+ this.label1.Size = new System.Drawing.Size(75, 13);
this.label1.TabIndex = 27;
this.label1.Text = "User Account:";
//
// textServiceBinaryPath
//
- this.textServiceBinaryPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textServiceBinaryPath.Location = new System.Drawing.Point(91, 178);
+ this.textServiceBinaryPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textServiceBinaryPath.Location = new System.Drawing.Point(93, 148);
this.textServiceBinaryPath.Name = "textServiceBinaryPath";
this.textServiceBinaryPath.ReadOnly = true;
- this.textServiceBinaryPath.Size = new System.Drawing.Size(303, 22);
+ this.textServiceBinaryPath.Size = new System.Drawing.Size(303, 20);
this.textServiceBinaryPath.TabIndex = 26;
//
// labelServiceDisplayName
//
this.labelServiceDisplayName.AutoSize = true;
- this.labelServiceDisplayName.Location = new System.Drawing.Point(12, 28);
+ this.labelServiceDisplayName.Location = new System.Drawing.Point(12, 30);
this.labelServiceDisplayName.Name = "labelServiceDisplayName";
- this.labelServiceDisplayName.Size = new System.Drawing.Size(114, 13);
+ this.labelServiceDisplayName.Size = new System.Drawing.Size(111, 13);
this.labelServiceDisplayName.TabIndex = 25;
this.labelServiceDisplayName.Text = "Service Display Name";
//
@@ -188,7 +187,7 @@
//
this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonClose.Location = new System.Drawing.Point(321, 272);
+ this.buttonClose.Location = new System.Drawing.Point(321, 232);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 23);
this.buttonClose.TabIndex = 44;
@@ -198,40 +197,39 @@
//
// textServiceType
//
- this.textServiceType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textServiceType.Location = new System.Drawing.Point(50, 125);
+ this.textServiceType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textServiceType.Location = new System.Drawing.Point(52, 95);
this.textServiceType.Name = "textServiceType";
this.textServiceType.ReadOnly = true;
- this.textServiceType.Size = new System.Drawing.Size(143, 22);
+ this.textServiceType.Size = new System.Drawing.Size(143, 20);
this.textServiceType.TabIndex = 37;
//
// textStartType
//
- this.textStartType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textStartType.Location = new System.Drawing.Point(264, 125);
+ this.textStartType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textStartType.Location = new System.Drawing.Point(266, 95);
this.textStartType.Name = "textStartType";
this.textStartType.ReadOnly = true;
- this.textStartType.Size = new System.Drawing.Size(130, 22);
+ this.textStartType.Size = new System.Drawing.Size(130, 20);
this.textStartType.TabIndex = 37;
//
// textErrorControl
//
- this.textErrorControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textErrorControl.Location = new System.Drawing.Point(84, 152);
+ this.textErrorControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textErrorControl.Location = new System.Drawing.Point(86, 122);
this.textErrorControl.Name = "textErrorControl";
this.textErrorControl.ReadOnly = true;
- this.textErrorControl.Size = new System.Drawing.Size(109, 22);
+ this.textErrorControl.Size = new System.Drawing.Size(109, 20);
this.textErrorControl.TabIndex = 37;
//
// DumpServiceWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(408, 307);
+ this.ClientSize = new System.Drawing.Size(408, 267);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.textServiceDll);
this.Controls.Add(this.label8);
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.cs b/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.cs
index 2aa10ddd6..544c5a8d5 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.cs
@@ -29,7 +29,7 @@ namespace ProcessHacker
{
public partial class DumpServiceWindow : Form
{
- private readonly MemoryObject _serviceMo;
+ private MemoryObject _serviceMo;
public DumpServiceWindow(ServiceItem item, MemoryObject serviceMo)
{
@@ -76,10 +76,5 @@ namespace ProcessHacker
{
this.Close();
}
-
- private void textDescription_TextChanged(object sender, EventArgs e)
- {
-
- }
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.resx b/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/DumpServiceWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.Designer.cs
index 81cbf9b4c..003cd449a 100644
--- a/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.Designer.cs
@@ -40,14 +40,14 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(68, 13);
+ this.label1.Size = new System.Drawing.Size(65, 13);
this.label1.TabIndex = 0;
this.label1.Text = "New Status:";
//
// comboStatus
//
- this.comboStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.comboStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.comboStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboStatus.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.comboStatus.FormattingEnabled = true;
@@ -90,7 +90,7 @@
this.checkPermanent.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkPermanent.Location = new System.Drawing.Point(12, 39);
this.checkPermanent.Name = "checkPermanent";
- this.checkPermanent.Size = new System.Drawing.Size(87, 18);
+ this.checkPermanent.Size = new System.Drawing.Size(83, 18);
this.checkPermanent.TabIndex = 2;
this.checkPermanent.Text = "Permanent";
this.checkPermanent.UseVisualStyleBackColor = true;
@@ -101,7 +101,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(315, 104);
this.Controls.Add(this.checkPermanent);
this.Controls.Add(this.buttonCancel);
diff --git a/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.cs b/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.cs
index 96202ba6b..62d29908a 100644
--- a/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.cs
@@ -32,12 +32,11 @@ namespace ProcessHacker
{
public partial class EditDEPWindow : Form
{
- private readonly int _pid;
+ private int _pid;
public EditDEPWindow(int PID)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
@@ -45,9 +44,10 @@ namespace ProcessHacker
try
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation))
+ using (ProcessHandle phandle
+ = new ProcessHandle(_pid, ProcessAccess.QueryInformation))
{
- var depStatus = phandle.DepStatus;
+ var depStatus = phandle.GetDepStatus();
string str;
if ((depStatus & DepStatus.Enabled) != 0)
@@ -64,7 +64,7 @@ namespace ProcessHacker
comboStatus.SelectedItem = str;
- if (KProcessHacker2.Instance.KphIsConnected)
+ if (KProcessHacker.Instance != null)
checkPermanent.Visible = true;
}
}
@@ -74,7 +74,7 @@ namespace ProcessHacker
private void buttonOK_Click(object sender, EventArgs e)
{
- if (KProcessHacker2.Instance.KphIsConnected)
+ if (KProcessHacker.Instance != null)
this.SetDepStatusKph();
else
this.SetDepStatusNoKph();
@@ -82,22 +82,18 @@ namespace ProcessHacker
private void SetDepStatusKph()
{
- DepStatus depStatus;
+ DepStatus depStatus = DepStatus.Enabled;
- switch (this.comboStatus.SelectedItem.ToString())
+ if (comboStatus.SelectedItem.ToString() == "Disabled")
+ depStatus = 0;
+ else if (comboStatus.SelectedItem.ToString() == "Enabled")
+ depStatus = DepStatus.Enabled;
+ else if (comboStatus.SelectedItem.ToString() == "Enabled, DEP-ATL thunk emulation disabled")
+ depStatus = DepStatus.Enabled | DepStatus.AtlThunkEmulationDisabled;
+ else
{
- case "Disabled":
- depStatus = 0;
- break;
- case "Enabled":
- depStatus = DepStatus.Enabled;
- break;
- case "Enabled, DEP-ATL thunk emulation disabled":
- depStatus = DepStatus.Enabled | DepStatus.AtlThunkEmulationDisabled;
- break;
- default:
- PhUtils.ShowError("Invalid value.");
- return;
+ PhUtils.ShowError("Invalid value.");
+ return;
}
if (checkPermanent.Checked)
@@ -105,8 +101,8 @@ namespace ProcessHacker
try
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- phandle.DepStatus = depStatus;
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ phandle.SetDepStatus(depStatus);
this.DialogResult = DialogResult.OK;
this.Close();
@@ -119,15 +115,13 @@ namespace ProcessHacker
private void SetDepStatusNoKph()
{
- if (comboStatus.SelectedItem.ToString().StartsWith("Enabled", StringComparison.OrdinalIgnoreCase))
- {
+ if (comboStatus.SelectedItem.ToString().StartsWith("Enabled"))
if (!PhUtils.ShowConfirmMessage(
"set",
"the DEP status",
"Enabling DEP in a process is a permanent action.",
false))
return;
- }
DepFlags flags = DepFlags.Enable;
diff --git a/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.resx b/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/EditDEPWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ErrorDialog.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ErrorDialog.Designer.cs
index 63d062393..d894fef35 100644
--- a/1.x/trunk/ProcessHacker/Forms/ErrorDialog.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ErrorDialog.Designer.cs
@@ -39,15 +39,15 @@
//
// labelIntro
//
- this.labelIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelIntro.Location = new System.Drawing.Point(12, 26);
this.labelIntro.Name = "labelIntro";
this.labelIntro.Size = new System.Drawing.Size(484, 32);
this.labelIntro.TabIndex = 0;
this.labelIntro.Text = "Please report this error to the Process Hacker team via our bug tracker hosted at" +
- " SourceForge by clicking Send Report. You will recieve a tracker item for keeing" +
- " track of its resolution status.";
+ " SourceForge by clicking Send Report. You will recieve a tracker item for keeing" +
+ " track of its resolution status.";
//
// buttonContinue
//
@@ -75,9 +75,9 @@
//
// textException
//
- this.textException.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textException.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textException.BackColor = System.Drawing.SystemColors.Control;
this.textException.Location = new System.Drawing.Point(12, 61);
this.textException.Multiline = true;
@@ -106,7 +106,7 @@
this.statusLinkLabel.Enabled = false;
this.statusLinkLabel.Location = new System.Drawing.Point(12, 336);
this.statusLinkLabel.Name = "statusLinkLabel";
- this.statusLinkLabel.Size = new System.Drawing.Size(210, 13);
+ this.statusLinkLabel.Size = new System.Drawing.Size(199, 13);
this.statusLinkLabel.TabIndex = 6;
this.statusLinkLabel.TabStop = true;
this.statusLinkLabel.Text = "Please Wait, Reporting to Bug Tracker...";
@@ -128,7 +128,7 @@
this.AcceptButton = this.buttonQuit;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(508, 366);
this.Controls.Add(this.labelIntro);
this.Controls.Add(this.label1);
diff --git a/1.x/trunk/ProcessHacker/Forms/ErrorDialog.cs b/1.x/trunk/ProcessHacker/Forms/ErrorDialog.cs
index 3ebc7552a..651e5ef8e 100644
--- a/1.x/trunk/ProcessHacker/Forms/ErrorDialog.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ErrorDialog.cs
@@ -27,14 +27,13 @@ using System.Net;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using ProcessHacker.Common;
-using ProcessHacker.Native;
using ProcessHacker.Native.Api;
namespace ProcessHacker
{
public partial class ErrorDialog : Form
{
- private readonly Exception _exception;
+ private Exception _exception;
private string _trackerItem;
public ErrorDialog(Exception ex, bool terminating)
@@ -79,12 +78,12 @@ namespace ProcessHacker
Settings.Instance.Save();
// Remove the icons or they remain in the system try.
- Program.HackerWindow.ExecuteOnIcons(icon => icon.Visible = false);
- Program.HackerWindow.ExecuteOnIcons(icon => icon.Dispose());
+ Program.HackerWindow.ExecuteOnIcons((icon) => icon.Visible = false);
+ Program.HackerWindow.ExecuteOnIcons((icon) => icon.Dispose());
// Make sure KPH connection is closed.
- if (KProcessHacker2.Instance != null)
- KProcessHacker2.Instance.Dispose();
+ if (ProcessHacker.Native.KProcessHacker.Instance != null)
+ ProcessHacker.Native.KProcessHacker.Instance.Close();
}
catch (Exception ex)
{
@@ -102,8 +101,8 @@ namespace ProcessHacker
this.statusLinkLabel.Visible = true;
SFBugReporter wc = new SFBugReporter();
- wc.DownloadProgressChanged += wc_DownloadProgressChanged;
- wc.DownloadStringCompleted += wc_DownloadStringCompleted;
+ wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
+ wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
NameValueCollection qc = new NameValueCollection();
qc.Add("group_id", "242527"); //PH BugTracker ID: Required Do Not Change!
@@ -136,7 +135,7 @@ namespace ProcessHacker
buttonContinue.Enabled = true;
buttonQuit.Enabled = true;
- if (e.Error != null || this.GetTitle(e.Result).Contains("ERROR", StringComparison.OrdinalIgnoreCase))
+ if (e.Error != null || this.GetTitle(e.Result).Contains("ERROR"))
{
buttonSubmitReport.Enabled = true;
statusLinkLabel.Visible = false;
@@ -170,8 +169,10 @@ namespace ProcessHacker
{
return m.Groups[1].Value;
}
-
- return string.Empty;
+ else
+ {
+ return "";
+ }
}
private string GetResult(string data)
@@ -182,8 +183,10 @@ namespace ProcessHacker
{
return m.Groups[1].Value;
}
-
- return string.Empty;
+ else
+ {
+ return "";
+ }
}
private string GetUrl(string data)
@@ -194,15 +197,17 @@ namespace ProcessHacker
{
return m.Value;
}
-
- return string.Empty;
+ else
+ {
+ return "";
+ }
}
- public class SFBugReporter : WebClient
+ public partial class SFBugReporter : WebClient
{
protected override WebRequest GetWebRequest(Uri uri)
{
- HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);
+ System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri);
webRequest.UserAgent = "Process Hacker " + Application.ProductVersion;
webRequest.Timeout = System.Threading.Timeout.Infinite;
webRequest.ServicePoint.Expect100Continue = true; //fix for Sourceforge's lighttpd Server
diff --git a/1.x/trunk/ProcessHacker/Forms/ErrorDialog.resx b/1.x/trunk/ProcessHacker/Forms/ErrorDialog.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ErrorDialog.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ErrorDialog.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.Designer.cs
index fbe53d50e..042fd6062 100644
--- a/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.Designer.cs
@@ -41,7 +41,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(118, 13);
+ this.label1.Size = new System.Drawing.Size(109, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Export Name/Ordinal:";
//
@@ -50,29 +50,29 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 41);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(51, 13);
+ this.label2.Size = new System.Drawing.Size(48, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Address:";
//
// textProcName
//
- this.textProcName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textProcName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textProcName.Location = new System.Drawing.Point(127, 12);
this.textProcName.Name = "textProcName";
- this.textProcName.Size = new System.Drawing.Size(255, 22);
+ this.textProcName.Size = new System.Drawing.Size(255, 20);
this.textProcName.TabIndex = 0;
- this.textProcName.Enter += new System.EventHandler(this.textProcName_Enter);
this.textProcName.Leave += new System.EventHandler(this.textProcName_Leave);
+ this.textProcName.Enter += new System.EventHandler(this.textProcName_Enter);
//
// textProcAddress
//
- this.textProcAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textProcAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textProcAddress.Location = new System.Drawing.Point(127, 38);
this.textProcAddress.Name = "textProcAddress";
this.textProcAddress.ReadOnly = true;
- this.textProcAddress.Size = new System.Drawing.Size(255, 22);
+ this.textProcAddress.Size = new System.Drawing.Size(255, 20);
this.textProcAddress.TabIndex = 1;
//
// buttonLookup
@@ -103,7 +103,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(394, 99);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.buttonLookup);
diff --git a/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.cs b/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.cs
index 196dd5453..fccbc20c6 100644
--- a/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.cs
@@ -29,7 +29,7 @@ namespace ProcessHacker
{
public partial class GetProcAddressWindow : Form
{
- private readonly string _fileName;
+ private string _fileName;
public GetProcAddressWindow(string fileName)
{
@@ -45,7 +45,7 @@ namespace ProcessHacker
private void buttonLookup_Click(object sender, EventArgs e)
{
IntPtr module = Win32.LoadLibraryEx(_fileName, IntPtr.Zero, Win32.DontResolveDllReferences);
- IntPtr address;
+ IntPtr address = IntPtr.Zero;
int ordinal = 0;
if (module == IntPtr.Zero)
diff --git a/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.resx b/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/GetProcAddressWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs
index 105cfb5a0..5841ae453 100644
--- a/1.x/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs
@@ -30,6 +30,54 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HackerWindow));
+ this.menuProcess = new System.Windows.Forms.ContextMenu();
+ this.terminateMenuItem = new System.Windows.Forms.MenuItem();
+ this.terminateProcessTreeMenuItem = new System.Windows.Forms.MenuItem();
+ this.suspendMenuItem = new System.Windows.Forms.MenuItem();
+ this.resumeMenuItem = new System.Windows.Forms.MenuItem();
+ this.restartProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.reduceWorkingSetProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.virtualizationProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem5 = new System.Windows.Forms.MenuItem();
+ this.affinityProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.createDumpFileProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.terminatorProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.miscellaneousProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.analyzeWaitChainProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.detachFromDebuggerProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.heapsProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.injectDllProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.ioPriorityThreadMenuItem = new System.Windows.Forms.MenuItem();
+ this.ioPriority0ThreadMenuItem = new System.Windows.Forms.MenuItem();
+ this.ioPriority1ThreadMenuItem = new System.Windows.Forms.MenuItem();
+ this.ioPriority2ThreadMenuItem = new System.Windows.Forms.MenuItem();
+ this.ioPriority3ThreadMenuItem = new System.Windows.Forms.MenuItem();
+ this.protectionProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.setTokenProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.VirusTotalMenuItem = new System.Windows.Forms.MenuItem();
+ this.priorityMenuItem = new System.Windows.Forms.MenuItem();
+ this.realTimeMenuItem = new System.Windows.Forms.MenuItem();
+ this.highMenuItem = new System.Windows.Forms.MenuItem();
+ this.aboveNormalMenuItem = new System.Windows.Forms.MenuItem();
+ this.normalMenuItem = new System.Windows.Forms.MenuItem();
+ this.belowNormalMenuItem = new System.Windows.Forms.MenuItem();
+ this.idleMenuItem = new System.Windows.Forms.MenuItem();
+ this.runAsProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.launchAsUserProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.launchAsThisUserProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.windowProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.bringToFrontProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.restoreProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.minimizeProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.maximizeProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem15 = new System.Windows.Forms.MenuItem();
+ this.closeProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.propertiesProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem7 = new System.Windows.Forms.MenuItem();
+ this.searchProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.reanalyzeProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.copyProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.selectAllProcessMenuItem = new System.Windows.Forms.MenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
@@ -37,170 +85,464 @@
this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripMenuItem();
+ this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
+ this.hackerMenuItem = new System.Windows.Forms.MenuItem();
+ this.runMenuItem = new System.Windows.Forms.MenuItem();
+ this.runAsAdministratorMenuItem = new System.Windows.Forms.MenuItem();
+ this.runAsMenuItem = new System.Windows.Forms.MenuItem();
+ this.runAsServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.showDetailsForAllProcessesMenuItem = new System.Windows.Forms.MenuItem();
+ this.uacSeparatorMenuItem = new System.Windows.Forms.MenuItem();
+ this.openMenuItem = new System.Windows.Forms.MenuItem();
+ this.saveMenuItem = new System.Windows.Forms.MenuItem();
+ this.findHandlesMenuItem = new System.Windows.Forms.MenuItem();
+ this.inspectPEFileMenuItem = new System.Windows.Forms.MenuItem();
+ this.reloadStructsMenuItem = new System.Windows.Forms.MenuItem();
+ this.optionsMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem2 = new System.Windows.Forms.MenuItem();
+ this.shutdownMenuItem = new System.Windows.Forms.MenuItem();
+ this.exitMenuItem = new System.Windows.Forms.MenuItem();
+ this.viewMenuItem = new System.Windows.Forms.MenuItem();
+ this.toolbarMenuItem = new System.Windows.Forms.MenuItem();
+ this.sysInfoMenuItem = new System.Windows.Forms.MenuItem();
+ this.trayIconsMenuItem = new System.Windows.Forms.MenuItem();
+ this.cpuHistoryMenuItem = new System.Windows.Forms.MenuItem();
+ this.cpuUsageMenuItem = new System.Windows.Forms.MenuItem();
+ this.ioHistoryMenuItem = new System.Windows.Forms.MenuItem();
+ this.commitHistoryMenuItem = new System.Windows.Forms.MenuItem();
+ this.physMemHistoryMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem3 = new System.Windows.Forms.MenuItem();
+ this.updateNowMenuItem = new System.Windows.Forms.MenuItem();
+ this.updateProcessesMenuItem = new System.Windows.Forms.MenuItem();
+ this.updateServicesMenuItem = new System.Windows.Forms.MenuItem();
+ this.toolsMenuItem = new System.Windows.Forms.MenuItem();
+ this.createServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.hiddenProcessesMenuItem = new System.Windows.Forms.MenuItem();
+ this.verifyFileSignatureMenuItem = new System.Windows.Forms.MenuItem();
+ this.usersMenuItem = new System.Windows.Forms.MenuItem();
+ this.windowMenuItem = new System.Windows.Forms.MenuItem();
+ this.helpMenu = new System.Windows.Forms.MenuItem();
+ this.freeMemoryMenuItem = new System.Windows.Forms.MenuItem();
+ this.checkForUpdatesMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem1 = new System.Windows.Forms.MenuItem();
+ this.logMenuItem = new System.Windows.Forms.MenuItem();
+ this.helpMenuItem = new System.Windows.Forms.MenuItem();
+ this.donateMenuItem = new System.Windows.Forms.MenuItem();
+ this.aboutMenuItem = new System.Windows.Forms.MenuItem();
+ this.statusBar = new System.Windows.Forms.StatusBar();
+ this.statusGeneral = new System.Windows.Forms.StatusBarPanel();
+ this.statusCPU = new System.Windows.Forms.StatusBarPanel();
+ this.statusMemory = new System.Windows.Forms.StatusBarPanel();
this.tabControl = new System.Windows.Forms.TabControl();
this.tabProcesses = new System.Windows.Forms.TabPage();
this.treeProcesses = new ProcessHacker.ProcessTree();
- this.contextMenuStripProcess = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.terminateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.terminateProcessTreeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.suspendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.resumeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.restartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.reduceWorkingSetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.virtualizationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
- this.affinityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.createDumpFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.terminatorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.miscellaneousToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.analyzeWaitChainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.detachFromDebuggerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.heapsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.injectDLLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.iOPriorityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.ioPriority0ThreadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.ioPriority1ThreadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.ioPriority3ThreadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
- this.protectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.setTokenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.uploadToVirusTotalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.priorityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.realTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.highToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.aboveNormalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.normalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.belowNormalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.idleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.runAsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.launchAsUserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.launchAsThisUserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.windowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.bringToFrontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.minimizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.maximizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
- this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
- this.searchOnlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.reanalyzeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.copyProcessMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
- this.propertiesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.tabServices = new System.Windows.Forms.TabPage();
this.listServices = new ProcessHacker.Components.ServiceList();
- this.contextMenuStripService = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.goToProcessServiceMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
- this.startToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.pauseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.continueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
- this.copyToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.selectAllServiceMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
- this.propertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabNetwork = new System.Windows.Forms.TabPage();
this.listNetwork = new ProcessHacker.Components.NetworkList();
- this.contextMenuStripNetwork = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.goToProcessNetworkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.whoisNetworkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.tracertNetworkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.pingNetworkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.closeNetworkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
- this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.selectAllNetworkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStrip = new System.ToolStripEx();
+ this.toolStrip = new System.Windows.Forms.ToolStrip();
this.refreshToolStripButton = new System.Windows.Forms.ToolStripButton();
this.optionsToolStripButton = new System.Windows.Forms.ToolStripButton();
this.shutDownToolStripMenuItem = new System.Windows.Forms.ToolStripDropDownButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.findHandlesToolStripButton = new System.Windows.Forms.ToolStripButton();
this.sysInfoToolStripButton = new System.Windows.Forms.ToolStripButton();
- this.toolStripTextBox2 = new ProcessHacker.HackerWindow.ToolStripSearchBox();
- this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.statusMemory = new System.Windows.Forms.ToolStripStatusLabel();
- this.statusCPU = new System.Windows.Forms.ToolStripStatusLabel();
- this.statusGeneral = new System.Windows.Forms.ToolStripStatusLabel();
- this.menuStripEx1 = new System.MenuStripEx();
- this.hackerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.runAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.runAsAdministratorMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.showDetailsForAllProcessesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
- this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
- this.findHandlesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.inspectPEFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.optionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
- this.shutdownMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolbarMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.sysInfoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.trayIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.cpuHistoryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.cpuUsageMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.ioHistoryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.commitHistoryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.physMemHistoryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
- this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.updateProcessesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.updateServicesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.createServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.hiddenProcessesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.verifyFileSignatureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.usersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.checkForUpdatesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
- this.logToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.contextMenuStripTray = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.showHideProcessHackerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.systemInformationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.networkInfomationMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
- this.processesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.notificationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.enableAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.disableAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
- this.newProcessesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.terminatedProcessesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.newServicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.startedServicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.stoppedServicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.deletedServicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
- this.shutdownTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuService = new System.Windows.Forms.ContextMenu();
+ this.goToProcessServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.startServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.continueServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.pauseServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.stopServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.deleteServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.propertiesServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem8 = new System.Windows.Forms.MenuItem();
+ this.copyServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.selectAllServiceMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuIcon = new System.Windows.Forms.ContextMenu();
+ this.showHideMenuItem = new System.Windows.Forms.MenuItem();
+ this.sysInformationIconMenuItem = new System.Windows.Forms.MenuItem();
+ this.networkInfomationMenuItem = new System.Windows.Forms.MenuItem();
+ this.notificationsMenuItem = new System.Windows.Forms.MenuItem();
+ this.enableAllNotificationsMenuItem = new System.Windows.Forms.MenuItem();
+ this.disableAllNotificationsMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem4 = new System.Windows.Forms.MenuItem();
+ this.NPMenuItem = new System.Windows.Forms.MenuItem();
+ this.TPMenuItem = new System.Windows.Forms.MenuItem();
+ this.NSMenuItem = new System.Windows.Forms.MenuItem();
+ this.startedSMenuItem = new System.Windows.Forms.MenuItem();
+ this.stoppedSMenuItem = new System.Windows.Forms.MenuItem();
+ this.DSMenuItem = new System.Windows.Forms.MenuItem();
+ this.processesMenuItem = new System.Windows.Forms.MenuItem();
+ this.shutdownTrayMenuItem = new System.Windows.Forms.MenuItem();
+ this.exitTrayMenuItem = new System.Windows.Forms.MenuItem();
+ this.goToProcessNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.copyNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.closeNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuNetwork = new System.Windows.Forms.ContextMenu();
+ this.toolsNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.whoisNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.tracertNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.pingNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.menuItem6 = new System.Windows.Forms.MenuItem();
+ this.selectAllNetworkMenuItem = new System.Windows.Forms.MenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.statusGeneral)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.statusCPU)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.statusMemory)).BeginInit();
this.tabControl.SuspendLayout();
this.tabProcesses.SuspendLayout();
- this.contextMenuStripProcess.SuspendLayout();
this.tabServices.SuspendLayout();
- this.contextMenuStripService.SuspendLayout();
this.tabNetwork.SuspendLayout();
- this.contextMenuStripNetwork.SuspendLayout();
this.toolStrip.SuspendLayout();
- this.statusStrip1.SuspendLayout();
- this.menuStripEx1.SuspendLayout();
- this.contextMenuStripTray.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
+ // menuProcess
+ //
+ this.menuProcess.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.terminateMenuItem,
+ this.terminateProcessTreeMenuItem,
+ this.suspendMenuItem,
+ this.resumeMenuItem,
+ this.restartProcessMenuItem,
+ this.reduceWorkingSetProcessMenuItem,
+ this.virtualizationProcessMenuItem,
+ this.menuItem5,
+ this.affinityProcessMenuItem,
+ this.createDumpFileProcessMenuItem,
+ this.terminatorProcessMenuItem,
+ this.miscellaneousProcessMenuItem,
+ this.priorityMenuItem,
+ this.runAsProcessMenuItem,
+ this.windowProcessMenuItem,
+ this.propertiesProcessMenuItem,
+ this.menuItem7,
+ this.searchProcessMenuItem,
+ this.reanalyzeProcessMenuItem,
+ this.copyProcessMenuItem,
+ this.selectAllProcessMenuItem});
+ this.menuProcess.Popup += new System.EventHandler(this.menuProcess_Popup);
+ //
+ // terminateMenuItem
+ //
+ this.vistaMenu.SetImage(this.terminateMenuItem, global::ProcessHacker.Properties.Resources.cross);
+ this.terminateMenuItem.Index = 0;
+ this.terminateMenuItem.Shortcut = System.Windows.Forms.Shortcut.Del;
+ this.terminateMenuItem.Text = "&Terminate";
+ this.terminateMenuItem.Click += new System.EventHandler(this.terminateMenuItem_Click);
+ //
+ // terminateProcessTreeMenuItem
+ //
+ this.terminateProcessTreeMenuItem.Index = 1;
+ this.terminateProcessTreeMenuItem.Text = "Terminate Process Tree";
+ this.terminateProcessTreeMenuItem.Click += new System.EventHandler(this.terminateProcessTreeMenuItem_Click);
+ //
+ // suspendMenuItem
+ //
+ this.vistaMenu.SetImage(this.suspendMenuItem, global::ProcessHacker.Properties.Resources.control_pause_blue);
+ this.suspendMenuItem.Index = 2;
+ this.suspendMenuItem.Text = "&Suspend";
+ this.suspendMenuItem.Click += new System.EventHandler(this.suspendMenuItem_Click);
+ //
+ // resumeMenuItem
+ //
+ this.vistaMenu.SetImage(this.resumeMenuItem, global::ProcessHacker.Properties.Resources.control_play_blue);
+ this.resumeMenuItem.Index = 3;
+ this.resumeMenuItem.Text = "&Resume";
+ this.resumeMenuItem.Click += new System.EventHandler(this.resumeMenuItem_Click);
+ //
+ // restartProcessMenuItem
+ //
+ this.restartProcessMenuItem.Index = 4;
+ this.restartProcessMenuItem.Text = "Restart";
+ this.restartProcessMenuItem.Click += new System.EventHandler(this.restartProcessMenuItem_Click);
+ //
+ // reduceWorkingSetProcessMenuItem
+ //
+ this.reduceWorkingSetProcessMenuItem.Index = 5;
+ this.reduceWorkingSetProcessMenuItem.Text = "Reduce Working Set";
+ this.reduceWorkingSetProcessMenuItem.Click += new System.EventHandler(this.reduceWorkingSetProcessMenuItem_Click);
+ //
+ // virtualizationProcessMenuItem
+ //
+ this.virtualizationProcessMenuItem.Index = 6;
+ this.virtualizationProcessMenuItem.Text = "Virtualization";
+ this.virtualizationProcessMenuItem.Click += new System.EventHandler(this.virtualizationProcessMenuItem_Click);
+ //
+ // menuItem5
+ //
+ this.menuItem5.Index = 7;
+ this.menuItem5.Text = "-";
+ //
+ // affinityProcessMenuItem
+ //
+ this.affinityProcessMenuItem.Index = 8;
+ this.affinityProcessMenuItem.Text = "Affinity...";
+ this.affinityProcessMenuItem.Click += new System.EventHandler(this.affinityProcessMenuItem_Click);
+ //
+ // createDumpFileProcessMenuItem
+ //
+ this.createDumpFileProcessMenuItem.Index = 9;
+ this.createDumpFileProcessMenuItem.Text = "Create Dump File...";
+ this.createDumpFileProcessMenuItem.Click += new System.EventHandler(this.createDumpFileProcessMenuItem_Click);
+ //
+ // terminatorProcessMenuItem
+ //
+ this.terminatorProcessMenuItem.Index = 10;
+ this.terminatorProcessMenuItem.Text = "Terminator";
+ this.terminatorProcessMenuItem.Click += new System.EventHandler(this.terminatorProcessMenuItem_Click);
+ //
+ // miscellaneousProcessMenuItem
+ //
+ this.miscellaneousProcessMenuItem.Index = 11;
+ this.miscellaneousProcessMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.analyzeWaitChainProcessMenuItem,
+ this.detachFromDebuggerProcessMenuItem,
+ this.heapsProcessMenuItem,
+ this.injectDllProcessMenuItem,
+ this.ioPriorityThreadMenuItem,
+ this.protectionProcessMenuItem,
+ this.setTokenProcessMenuItem,
+ this.VirusTotalMenuItem});
+ this.miscellaneousProcessMenuItem.Text = "Miscellaneous";
+ //
+ // analyzeWaitChainProcessMenuItem
+ //
+ this.analyzeWaitChainProcessMenuItem.Index = 0;
+ this.analyzeWaitChainProcessMenuItem.Text = "Analyze Wait Chain";
+ this.analyzeWaitChainProcessMenuItem.Click += new System.EventHandler(this.analyzeWaitChainProcessMenuItem_Click);
+ //
+ // detachFromDebuggerProcessMenuItem
+ //
+ this.detachFromDebuggerProcessMenuItem.Index = 1;
+ this.detachFromDebuggerProcessMenuItem.Text = "Detach from Debugger";
+ this.detachFromDebuggerProcessMenuItem.Click += new System.EventHandler(this.detachFromDebuggerProcessMenuItem_Click);
+ //
+ // heapsProcessMenuItem
+ //
+ this.heapsProcessMenuItem.Index = 2;
+ this.heapsProcessMenuItem.Text = "Heaps";
+ this.heapsProcessMenuItem.Click += new System.EventHandler(this.heapsProcessMenuItem_Click);
+ //
+ // injectDllProcessMenuItem
+ //
+ this.injectDllProcessMenuItem.Index = 3;
+ this.injectDllProcessMenuItem.Text = "Inject DLL...";
+ this.injectDllProcessMenuItem.Click += new System.EventHandler(this.injectDllProcessMenuItem_Click);
+ //
+ // ioPriorityThreadMenuItem
+ //
+ this.ioPriorityThreadMenuItem.Index = 4;
+ this.ioPriorityThreadMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.ioPriority0ThreadMenuItem,
+ this.ioPriority1ThreadMenuItem,
+ this.ioPriority2ThreadMenuItem,
+ this.ioPriority3ThreadMenuItem});
+ this.ioPriorityThreadMenuItem.Text = "I/O Priority";
+ //
+ // ioPriority0ThreadMenuItem
+ //
+ this.ioPriority0ThreadMenuItem.Index = 0;
+ this.ioPriority0ThreadMenuItem.Text = "0";
+ this.ioPriority0ThreadMenuItem.Click += new System.EventHandler(this.ioPriority0ThreadMenuItem_Click);
+ //
+ // ioPriority1ThreadMenuItem
+ //
+ this.ioPriority1ThreadMenuItem.Index = 1;
+ this.ioPriority1ThreadMenuItem.Text = "1";
+ this.ioPriority1ThreadMenuItem.Click += new System.EventHandler(this.ioPriority1ThreadMenuItem_Click);
+ //
+ // ioPriority2ThreadMenuItem
+ //
+ this.ioPriority2ThreadMenuItem.Index = 2;
+ this.ioPriority2ThreadMenuItem.Text = "2";
+ this.ioPriority2ThreadMenuItem.Click += new System.EventHandler(this.ioPriority2ThreadMenuItem_Click);
+ //
+ // ioPriority3ThreadMenuItem
+ //
+ this.ioPriority3ThreadMenuItem.Index = 3;
+ this.ioPriority3ThreadMenuItem.Text = "3";
+ this.ioPriority3ThreadMenuItem.Click += new System.EventHandler(this.ioPriority3ThreadMenuItem_Click);
+ //
+ // protectionProcessMenuItem
+ //
+ this.protectionProcessMenuItem.Index = 5;
+ this.protectionProcessMenuItem.Text = "Protection";
+ this.protectionProcessMenuItem.Click += new System.EventHandler(this.protectionProcessMenuItem_Click);
+ //
+ // setTokenProcessMenuItem
+ //
+ this.setTokenProcessMenuItem.Index = 6;
+ this.setTokenProcessMenuItem.Text = "Set Token...";
+ this.setTokenProcessMenuItem.Click += new System.EventHandler(this.setTokenProcessMenuItem_Click);
+ //
+ // VirusTotalMenuItem
+ //
+ this.VirusTotalMenuItem.Index = 7;
+ this.VirusTotalMenuItem.Text = "Upload to VirusTotal";
+ this.VirusTotalMenuItem.Click += new System.EventHandler(this.virusTotalMenuItem_Click);
+ //
+ // priorityMenuItem
+ //
+ this.vistaMenu.SetImage(this.priorityMenuItem, global::ProcessHacker.Properties.Resources.control_equalizer_blue);
+ this.priorityMenuItem.Index = 12;
+ this.priorityMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.realTimeMenuItem,
+ this.highMenuItem,
+ this.aboveNormalMenuItem,
+ this.normalMenuItem,
+ this.belowNormalMenuItem,
+ this.idleMenuItem});
+ this.priorityMenuItem.Text = "&Priority";
+ //
+ // realTimeMenuItem
+ //
+ this.realTimeMenuItem.Index = 0;
+ this.realTimeMenuItem.RadioCheck = true;
+ this.realTimeMenuItem.Text = "Real Time";
+ this.realTimeMenuItem.Click += new System.EventHandler(this.realTimeMenuItem_Click);
+ //
+ // highMenuItem
+ //
+ this.highMenuItem.Index = 1;
+ this.highMenuItem.RadioCheck = true;
+ this.highMenuItem.Text = "High";
+ this.highMenuItem.Click += new System.EventHandler(this.highMenuItem_Click);
+ //
+ // aboveNormalMenuItem
+ //
+ this.aboveNormalMenuItem.Index = 2;
+ this.aboveNormalMenuItem.RadioCheck = true;
+ this.aboveNormalMenuItem.Text = "Above Normal";
+ this.aboveNormalMenuItem.Click += new System.EventHandler(this.aboveNormalMenuItem_Click);
+ //
+ // normalMenuItem
+ //
+ this.normalMenuItem.Index = 3;
+ this.normalMenuItem.RadioCheck = true;
+ this.normalMenuItem.Text = "Normal";
+ this.normalMenuItem.Click += new System.EventHandler(this.normalMenuItem_Click);
+ //
+ // belowNormalMenuItem
+ //
+ this.belowNormalMenuItem.Index = 4;
+ this.belowNormalMenuItem.RadioCheck = true;
+ this.belowNormalMenuItem.Text = "Below Normal";
+ this.belowNormalMenuItem.Click += new System.EventHandler(this.belowNormalMenuItem_Click);
+ //
+ // idleMenuItem
+ //
+ this.idleMenuItem.Index = 5;
+ this.idleMenuItem.RadioCheck = true;
+ this.idleMenuItem.Text = "Idle";
+ this.idleMenuItem.Click += new System.EventHandler(this.idleMenuItem_Click);
+ //
+ // runAsProcessMenuItem
+ //
+ this.runAsProcessMenuItem.Index = 13;
+ this.runAsProcessMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.launchAsUserProcessMenuItem,
+ this.launchAsThisUserProcessMenuItem});
+ this.runAsProcessMenuItem.Text = "Run As";
+ //
+ // launchAsUserProcessMenuItem
+ //
+ this.launchAsUserProcessMenuItem.Index = 0;
+ this.launchAsUserProcessMenuItem.Text = "Launch As User...";
+ this.launchAsUserProcessMenuItem.Click += new System.EventHandler(this.launchAsUserProcessMenuItem_Click);
+ //
+ // launchAsThisUserProcessMenuItem
+ //
+ this.launchAsThisUserProcessMenuItem.Index = 1;
+ this.launchAsThisUserProcessMenuItem.Text = "Launch As This User...";
+ this.launchAsThisUserProcessMenuItem.Click += new System.EventHandler(this.launchAsThisUserProcessMenuItem_Click);
+ //
+ // windowProcessMenuItem
+ //
+ this.windowProcessMenuItem.Index = 14;
+ this.windowProcessMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.bringToFrontProcessMenuItem,
+ this.restoreProcessMenuItem,
+ this.minimizeProcessMenuItem,
+ this.maximizeProcessMenuItem,
+ this.menuItem15,
+ this.closeProcessMenuItem});
+ this.windowProcessMenuItem.Text = "&Window";
+ //
+ // bringToFrontProcessMenuItem
+ //
+ this.bringToFrontProcessMenuItem.Index = 0;
+ this.bringToFrontProcessMenuItem.Text = "&Bring to Front";
+ this.bringToFrontProcessMenuItem.Click += new System.EventHandler(this.bringToFrontProcessMenuItem_Click);
+ //
+ // restoreProcessMenuItem
+ //
+ this.restoreProcessMenuItem.Index = 1;
+ this.restoreProcessMenuItem.Text = "&Restore";
+ this.restoreProcessMenuItem.Click += new System.EventHandler(this.restoreProcessMenuItem_Click);
+ //
+ // minimizeProcessMenuItem
+ //
+ this.minimizeProcessMenuItem.Index = 2;
+ this.minimizeProcessMenuItem.Text = "&Minimize";
+ this.minimizeProcessMenuItem.Click += new System.EventHandler(this.minimizeProcessMenuItem_Click);
+ //
+ // maximizeProcessMenuItem
+ //
+ this.maximizeProcessMenuItem.Index = 3;
+ this.maximizeProcessMenuItem.Text = "Ma&ximize";
+ this.maximizeProcessMenuItem.Click += new System.EventHandler(this.maximizeProcessMenuItem_Click);
+ //
+ // menuItem15
+ //
+ this.menuItem15.Index = 4;
+ this.menuItem15.Text = "-";
+ //
+ // closeProcessMenuItem
+ //
+ this.closeProcessMenuItem.Index = 5;
+ this.closeProcessMenuItem.Text = "&Close";
+ this.closeProcessMenuItem.Click += new System.EventHandler(this.closeProcessMenuItem_Click);
+ //
+ // propertiesProcessMenuItem
+ //
+ this.propertiesProcessMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.propertiesProcessMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
+ this.propertiesProcessMenuItem.Index = 15;
+ this.propertiesProcessMenuItem.Text = "&Properties";
+ this.propertiesProcessMenuItem.Click += new System.EventHandler(this.propertiesProcessMenuItem_Click);
+ //
+ // menuItem7
+ //
+ this.menuItem7.Index = 16;
+ this.menuItem7.Text = "-";
+ //
+ // searchProcessMenuItem
+ //
+ this.searchProcessMenuItem.Index = 17;
+ this.searchProcessMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlM;
+ this.searchProcessMenuItem.Text = "&Search Online";
+ this.searchProcessMenuItem.Click += new System.EventHandler(this.searchProcessMenuItem_Click);
+ //
+ // reanalyzeProcessMenuItem
+ //
+ this.reanalyzeProcessMenuItem.Index = 18;
+ this.reanalyzeProcessMenuItem.Text = "Re-analyze";
+ this.reanalyzeProcessMenuItem.Click += new System.EventHandler(this.reanalyzeProcessMenuItem_Click);
+ //
+ // copyProcessMenuItem
+ //
+ this.vistaMenu.SetImage(this.copyProcessMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
+ this.copyProcessMenuItem.Index = 19;
+ this.copyProcessMenuItem.Text = "&Copy";
+ //
+ // selectAllProcessMenuItem
+ //
+ this.selectAllProcessMenuItem.Index = 20;
+ this.selectAllProcessMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
+ this.selectAllProcessMenuItem.Text = "Select &All";
+ this.selectAllProcessMenuItem.Click += new System.EventHandler(this.selectAllProcessMenuItem_Click);
+ //
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
@@ -243,16 +585,365 @@
this.toolStripMenuItem15.Size = new System.Drawing.Size(151, 22);
this.toolStripMenuItem15.Text = "Idle";
//
+ // mainMenu
+ //
+ this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.hackerMenuItem,
+ this.viewMenuItem,
+ this.toolsMenuItem,
+ this.usersMenuItem,
+ this.windowMenuItem,
+ this.helpMenu});
+ //
+ // hackerMenuItem
+ //
+ this.hackerMenuItem.Index = 0;
+ this.hackerMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.runMenuItem,
+ this.runAsAdministratorMenuItem,
+ this.runAsMenuItem,
+ this.runAsServiceMenuItem,
+ this.showDetailsForAllProcessesMenuItem,
+ this.uacSeparatorMenuItem,
+ this.openMenuItem,
+ this.saveMenuItem,
+ this.findHandlesMenuItem,
+ this.inspectPEFileMenuItem,
+ this.reloadStructsMenuItem,
+ this.optionsMenuItem,
+ this.menuItem2,
+ this.shutdownMenuItem,
+ this.exitMenuItem});
+ this.hackerMenuItem.Text = "&Hacker";
+ //
+ // runMenuItem
+ //
+ this.runMenuItem.Index = 0;
+ this.runMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlR;
+ this.runMenuItem.Text = "&Run...";
+ this.runMenuItem.Click += new System.EventHandler(this.runMenuItem_Click);
+ //
+ // runAsAdministratorMenuItem
+ //
+ this.runAsAdministratorMenuItem.Index = 1;
+ this.runAsAdministratorMenuItem.Text = "Run As Administrator...";
+ this.runAsAdministratorMenuItem.Click += new System.EventHandler(this.runAsAdministratorMenuItem_Click);
+ //
+ // runAsMenuItem
+ //
+ this.runAsMenuItem.Index = 2;
+ this.runAsMenuItem.Text = "Run As...";
+ this.runAsMenuItem.Visible = false;
+ this.runAsMenuItem.Click += new System.EventHandler(this.runAsMenuItem_Click);
+ //
+ // runAsServiceMenuItem
+ //
+ this.runAsServiceMenuItem.Index = 3;
+ this.runAsServiceMenuItem.Text = "Run As...";
+ this.runAsServiceMenuItem.Click += new System.EventHandler(this.runAsServiceMenuItem_Click);
+ //
+ // showDetailsForAllProcessesMenuItem
+ //
+ this.showDetailsForAllProcessesMenuItem.Index = 4;
+ this.showDetailsForAllProcessesMenuItem.Text = "Show Details for All Processes";
+ this.showDetailsForAllProcessesMenuItem.Click += new System.EventHandler(this.showDetailsForAllProcessesMenuItem_Click);
+ //
+ // uacSeparatorMenuItem
+ //
+ this.uacSeparatorMenuItem.Index = 5;
+ this.uacSeparatorMenuItem.Text = "-";
+ //
+ // openMenuItem
+ //
+ this.vistaMenu.SetImage(this.openMenuItem, global::ProcessHacker.Properties.Resources.folder);
+ this.openMenuItem.Index = 6;
+ this.openMenuItem.Text = "Open...";
+ this.openMenuItem.Click += new System.EventHandler(this.openMenuItem_Click);
+ //
+ // saveMenuItem
+ //
+ this.vistaMenu.SetImage(this.saveMenuItem, global::ProcessHacker.Properties.Resources.disk);
+ this.saveMenuItem.Index = 7;
+ this.saveMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
+ this.saveMenuItem.Text = "Save...";
+ this.saveMenuItem.Click += new System.EventHandler(this.saveMenuItem_Click);
+ //
+ // findHandlesMenuItem
+ //
+ this.vistaMenu.SetImage(this.findHandlesMenuItem, global::ProcessHacker.Properties.Resources.find);
+ this.findHandlesMenuItem.Index = 8;
+ this.findHandlesMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
+ this.findHandlesMenuItem.Text = "&Find Handles or DLLs...";
+ this.findHandlesMenuItem.Click += new System.EventHandler(this.findHandlesMenuItem_Click);
+ //
+ // inspectPEFileMenuItem
+ //
+ this.vistaMenu.SetImage(this.inspectPEFileMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
+ this.inspectPEFileMenuItem.Index = 9;
+ this.inspectPEFileMenuItem.Text = "Inspect &PE File...";
+ this.inspectPEFileMenuItem.Click += new System.EventHandler(this.inspectPEFileMenuItem_Click);
+ //
+ // reloadStructsMenuItem
+ //
+ this.vistaMenu.SetImage(this.reloadStructsMenuItem, global::ProcessHacker.Properties.Resources.arrow_refresh);
+ this.reloadStructsMenuItem.Index = 10;
+ this.reloadStructsMenuItem.Text = "Reload Struct Definitions";
+ this.reloadStructsMenuItem.Click += new System.EventHandler(this.reloadStructsMenuItem_Click);
+ //
+ // optionsMenuItem
+ //
+ this.vistaMenu.SetImage(this.optionsMenuItem, global::ProcessHacker.Properties.Resources.page_gear);
+ this.optionsMenuItem.Index = 11;
+ this.optionsMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
+ this.optionsMenuItem.Text = "&Options...";
+ this.optionsMenuItem.Click += new System.EventHandler(this.optionsMenuItem_Click);
+ //
+ // menuItem2
+ //
+ this.menuItem2.Index = 12;
+ this.menuItem2.Text = "-";
+ //
+ // shutdownMenuItem
+ //
+ this.shutdownMenuItem.Index = 13;
+ this.shutdownMenuItem.Text = "Shutdown";
+ //
+ // exitMenuItem
+ //
+ this.vistaMenu.SetImage(this.exitMenuItem, global::ProcessHacker.Properties.Resources.door_out);
+ this.exitMenuItem.Index = 14;
+ this.exitMenuItem.Text = "E&xit";
+ this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
+ //
+ // viewMenuItem
+ //
+ this.viewMenuItem.Index = 1;
+ this.viewMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.toolbarMenuItem,
+ this.sysInfoMenuItem,
+ this.trayIconsMenuItem,
+ this.menuItem3,
+ this.updateNowMenuItem,
+ this.updateProcessesMenuItem,
+ this.updateServicesMenuItem});
+ this.viewMenuItem.Text = "&View";
+ //
+ // toolbarMenuItem
+ //
+ this.toolbarMenuItem.Index = 0;
+ this.toolbarMenuItem.Text = "Toolbar";
+ this.toolbarMenuItem.Click += new System.EventHandler(this.toolbarMenuItem_Click);
+ //
+ // sysInfoMenuItem
+ //
+ this.sysInfoMenuItem.Index = 1;
+ this.sysInfoMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlI;
+ this.sysInfoMenuItem.Text = "System &Information";
+ this.sysInfoMenuItem.Click += new System.EventHandler(this.sysInfoMenuItem_Click);
+ //
+ // trayIconsMenuItem
+ //
+ this.trayIconsMenuItem.Index = 2;
+ this.trayIconsMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.cpuHistoryMenuItem,
+ this.cpuUsageMenuItem,
+ this.ioHistoryMenuItem,
+ this.commitHistoryMenuItem,
+ this.physMemHistoryMenuItem});
+ this.trayIconsMenuItem.Text = "Tray Icons";
+ //
+ // cpuHistoryMenuItem
+ //
+ this.cpuHistoryMenuItem.Index = 0;
+ this.cpuHistoryMenuItem.Text = "CPU History";
+ this.cpuHistoryMenuItem.Click += new System.EventHandler(this.cpuHistoryMenuItem_Click);
+ //
+ // cpuUsageMenuItem
+ //
+ this.cpuUsageMenuItem.Index = 1;
+ this.cpuUsageMenuItem.Text = "CPU Usage";
+ this.cpuUsageMenuItem.Click += new System.EventHandler(this.cpuUsageMenuItem_Click);
+ //
+ // ioHistoryMenuItem
+ //
+ this.ioHistoryMenuItem.Index = 2;
+ this.ioHistoryMenuItem.Text = "I/O History";
+ this.ioHistoryMenuItem.Click += new System.EventHandler(this.ioHistoryMenuItem_Click);
+ //
+ // commitHistoryMenuItem
+ //
+ this.commitHistoryMenuItem.Index = 3;
+ this.commitHistoryMenuItem.Text = "Commit History";
+ this.commitHistoryMenuItem.Click += new System.EventHandler(this.commitHistoryMenuItem_Click);
+ //
+ // physMemHistoryMenuItem
+ //
+ this.physMemHistoryMenuItem.Index = 4;
+ this.physMemHistoryMenuItem.Text = "Physical Memory History";
+ this.physMemHistoryMenuItem.Click += new System.EventHandler(this.physMemHistoryMenuItem_Click);
+ //
+ // menuItem3
+ //
+ this.menuItem3.Index = 3;
+ this.menuItem3.Text = "-";
+ //
+ // updateNowMenuItem
+ //
+ this.vistaMenu.SetImage(this.updateNowMenuItem, global::ProcessHacker.Properties.Resources.arrow_refresh);
+ this.updateNowMenuItem.Index = 4;
+ this.updateNowMenuItem.Shortcut = System.Windows.Forms.Shortcut.F5;
+ this.updateNowMenuItem.Text = "&Refresh";
+ this.updateNowMenuItem.Click += new System.EventHandler(this.updateNowMenuItem_Click);
+ //
+ // updateProcessesMenuItem
+ //
+ this.updateProcessesMenuItem.Index = 5;
+ this.updateProcessesMenuItem.Text = "Update &Processes";
+ this.updateProcessesMenuItem.Click += new System.EventHandler(this.updateProcessesMenuItem_Click);
+ //
+ // updateServicesMenuItem
+ //
+ this.updateServicesMenuItem.Index = 6;
+ this.updateServicesMenuItem.Text = "Update &Services";
+ this.updateServicesMenuItem.Click += new System.EventHandler(this.updateServicesMenuItem_Click);
+ //
+ // toolsMenuItem
+ //
+ this.toolsMenuItem.Index = 2;
+ this.toolsMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.createServiceMenuItem,
+ this.hiddenProcessesMenuItem,
+ this.verifyFileSignatureMenuItem});
+ this.toolsMenuItem.Text = "&Tools";
+ //
+ // createServiceMenuItem
+ //
+ this.createServiceMenuItem.Index = 0;
+ this.createServiceMenuItem.Text = "Create &Service...";
+ this.createServiceMenuItem.Click += new System.EventHandler(this.createServiceMenuItem_Click);
+ //
+ // hiddenProcessesMenuItem
+ //
+ this.hiddenProcessesMenuItem.Index = 1;
+ this.hiddenProcessesMenuItem.Text = "&Hidden Processes";
+ this.hiddenProcessesMenuItem.Click += new System.EventHandler(this.hiddenProcessesMenuItem_Click);
+ //
+ // verifyFileSignatureMenuItem
+ //
+ this.verifyFileSignatureMenuItem.Index = 2;
+ this.verifyFileSignatureMenuItem.Text = "&Verify File Signature...";
+ this.verifyFileSignatureMenuItem.Click += new System.EventHandler(this.verifyFileSignatureMenuItem_Click);
+ //
+ // usersMenuItem
+ //
+ this.usersMenuItem.Index = 3;
+ this.usersMenuItem.Text = "&Users";
+ //
+ // windowMenuItem
+ //
+ this.windowMenuItem.Index = 4;
+ this.windowMenuItem.Text = "&Window";
+ //
+ // helpMenu
+ //
+ this.helpMenu.Index = 5;
+ this.helpMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.freeMemoryMenuItem,
+ this.checkForUpdatesMenuItem,
+ this.menuItem1,
+ this.logMenuItem,
+ this.helpMenuItem,
+ this.donateMenuItem,
+ this.aboutMenuItem});
+ this.helpMenu.Text = "H&elp";
+ //
+ // freeMemoryMenuItem
+ //
+ this.freeMemoryMenuItem.Index = 0;
+ this.freeMemoryMenuItem.Text = "Free Memory";
+ this.freeMemoryMenuItem.Click += new System.EventHandler(this.freeMemoryMenuItem_Click);
+ //
+ // checkForUpdatesMenuItem
+ //
+ this.checkForUpdatesMenuItem.Index = 1;
+ this.checkForUpdatesMenuItem.Text = "Check for Updates";
+ this.checkForUpdatesMenuItem.Click += new System.EventHandler(this.checkForUpdatesMenuItem_Click);
+ //
+ // menuItem1
+ //
+ this.menuItem1.Index = 2;
+ this.menuItem1.Text = "-";
+ //
+ // logMenuItem
+ //
+ this.vistaMenu.SetImage(this.logMenuItem, global::ProcessHacker.Properties.Resources.page_white_text);
+ this.logMenuItem.Index = 3;
+ this.logMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlL;
+ this.logMenuItem.Text = "&Log";
+ this.logMenuItem.Click += new System.EventHandler(this.logMenuItem_Click);
+ //
+ // helpMenuItem
+ //
+ this.vistaMenu.SetImage(this.helpMenuItem, global::ProcessHacker.Properties.Resources.help);
+ this.helpMenuItem.Index = 4;
+ this.helpMenuItem.Shortcut = System.Windows.Forms.Shortcut.F1;
+ this.helpMenuItem.Text = "&Help";
+ this.helpMenuItem.Click += new System.EventHandler(this.helpMenuItem_Click);
+ //
+ // donateMenuItem
+ //
+ this.vistaMenu.SetImage(this.donateMenuItem, global::ProcessHacker.Properties.Resources.money);
+ this.donateMenuItem.Index = 5;
+ this.donateMenuItem.Text = "Donate";
+ this.donateMenuItem.Click += new System.EventHandler(this.donateMenuItem_Click);
+ //
+ // aboutMenuItem
+ //
+ this.vistaMenu.SetImage(this.aboutMenuItem, global::ProcessHacker.Properties.Resources.information);
+ this.aboutMenuItem.Index = 6;
+ this.aboutMenuItem.Text = "&About";
+ this.aboutMenuItem.Click += new System.EventHandler(this.aboutMenuItem_Click);
+ //
+ // statusBar
+ //
+ this.statusBar.Location = new System.Drawing.Point(0, 350);
+ this.statusBar.Name = "statusBar";
+ this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
+ this.statusGeneral,
+ this.statusCPU,
+ this.statusMemory});
+ this.statusBar.ShowPanels = true;
+ this.statusBar.Size = new System.Drawing.Size(804, 22);
+ this.statusBar.TabIndex = 5;
+ //
+ // statusGeneral
+ //
+ this.statusGeneral.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
+ this.statusGeneral.Name = "statusGeneral";
+ this.statusGeneral.Width = 10;
+ //
+ // statusCPU
+ //
+ this.statusCPU.Name = "statusCPU";
+ this.statusCPU.Text = "CPU: 99.99%";
+ this.statusCPU.Width = 80;
+ //
+ // statusMemory
+ //
+ this.statusMemory.Name = "statusMemory";
+ this.statusMemory.Text = "Phys. Memory: 50%";
+ this.statusMemory.Width = 120;
+ //
// tabControl
//
this.tabControl.Controls.Add(this.tabProcesses);
this.tabControl.Controls.Add(this.tabServices);
this.tabControl.Controls.Add(this.tabNetwork);
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl.Location = new System.Drawing.Point(0, 52);
+ this.tabControl.Location = new System.Drawing.Point(0, 25);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
- this.tabControl.Size = new System.Drawing.Size(804, 494);
+ this.tabControl.Size = new System.Drawing.Size(804, 325);
this.tabControl.TabIndex = 6;
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControlBig_SelectedIndexChanged);
//
@@ -262,390 +953,23 @@
this.tabProcesses.Location = new System.Drawing.Point(4, 22);
this.tabProcesses.Name = "tabProcesses";
this.tabProcesses.Padding = new System.Windows.Forms.Padding(3);
- this.tabProcesses.Size = new System.Drawing.Size(796, 468);
+ this.tabProcesses.Size = new System.Drawing.Size(796, 299);
this.tabProcesses.TabIndex = 0;
this.tabProcesses.Text = "Processes";
this.tabProcesses.UseVisualStyleBackColor = true;
//
// treeProcesses
//
- this.treeProcesses.ContextMenuStrip = this.contextMenuStripProcess;
this.treeProcesses.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeProcesses.Draw = true;
- this.treeProcesses.DumpMode = false;
- this.treeProcesses.DumpProcesses = null;
- this.treeProcesses.DumpProcessServices = null;
- this.treeProcesses.DumpServices = null;
- this.treeProcesses.DumpUserName = null;
this.treeProcesses.Location = new System.Drawing.Point(3, 3);
this.treeProcesses.Name = "treeProcesses";
this.treeProcesses.Provider = null;
- this.treeProcesses.Size = new System.Drawing.Size(790, 462);
+ this.treeProcesses.Size = new System.Drawing.Size(790, 293);
this.treeProcesses.TabIndex = 4;
- this.treeProcesses.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeProcesses_KeyDown);
this.treeProcesses.SelectionChanged += new System.EventHandler(this.treeProcesses_SelectionChanged);
this.treeProcesses.NodeMouseDoubleClick += new System.EventHandler(this.treeProcesses_NodeMouseDoubleClick);
- //
- // contextMenuStripProcess
- //
- this.contextMenuStripProcess.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.terminateToolStripMenuItem,
- this.terminateProcessTreeToolStripMenuItem,
- this.suspendToolStripMenuItem,
- this.resumeToolStripMenuItem,
- this.restartToolStripMenuItem,
- this.reduceWorkingSetToolStripMenuItem,
- this.virtualizationToolStripMenuItem,
- this.toolStripSeparator14,
- this.affinityToolStripMenuItem,
- this.createDumpFileToolStripMenuItem,
- this.terminatorToolStripMenuItem,
- this.miscellaneousToolStripMenuItem,
- this.priorityToolStripMenuItem,
- this.runAsToolStripMenuItem1,
- this.windowToolStripMenuItem1,
- this.toolStripSeparator15,
- this.searchOnlineToolStripMenuItem,
- this.reanalyzeToolStripMenuItem,
- this.copyProcessMenuItem,
- this.selectAllToolStripMenuItem,
- this.toolStripSeparator16,
- this.propertiesToolStripMenuItem1});
- this.contextMenuStripProcess.Name = "contextMenuStripProcess";
- this.contextMenuStripProcess.Size = new System.Drawing.Size(198, 462);
- //
- // terminateToolStripMenuItem
- //
- this.terminateToolStripMenuItem.Name = "terminateToolStripMenuItem";
- this.terminateToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.terminateToolStripMenuItem.Text = "&Terminate";
- this.terminateToolStripMenuItem.Click += new System.EventHandler(this.terminateMenuItem_Click);
- //
- // terminateProcessTreeToolStripMenuItem
- //
- this.terminateProcessTreeToolStripMenuItem.Name = "terminateProcessTreeToolStripMenuItem";
- this.terminateProcessTreeToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.terminateProcessTreeToolStripMenuItem.Text = "Terminate Process Tree";
- this.terminateProcessTreeToolStripMenuItem.Click += new System.EventHandler(this.terminateProcessTreeMenuItem_Click);
- //
- // suspendToolStripMenuItem
- //
- this.suspendToolStripMenuItem.Name = "suspendToolStripMenuItem";
- this.suspendToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.suspendToolStripMenuItem.Text = "&Suspend";
- this.suspendToolStripMenuItem.Click += new System.EventHandler(this.suspendMenuItem_Click);
- //
- // resumeToolStripMenuItem
- //
- this.resumeToolStripMenuItem.Name = "resumeToolStripMenuItem";
- this.resumeToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.resumeToolStripMenuItem.Text = "&Resume";
- this.resumeToolStripMenuItem.Click += new System.EventHandler(this.resumeMenuItem_Click);
- //
- // restartToolStripMenuItem
- //
- this.restartToolStripMenuItem.Name = "restartToolStripMenuItem";
- this.restartToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.restartToolStripMenuItem.Text = "Restart";
- this.restartToolStripMenuItem.Click += new System.EventHandler(this.restartProcessMenuItem_Click);
- //
- // reduceWorkingSetToolStripMenuItem
- //
- this.reduceWorkingSetToolStripMenuItem.Name = "reduceWorkingSetToolStripMenuItem";
- this.reduceWorkingSetToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.reduceWorkingSetToolStripMenuItem.Text = "Reduce Working Set";
- this.reduceWorkingSetToolStripMenuItem.Click += new System.EventHandler(this.reduceWorkingSetProcessMenuItem_Click);
- //
- // virtualizationToolStripMenuItem
- //
- this.virtualizationToolStripMenuItem.Name = "virtualizationToolStripMenuItem";
- this.virtualizationToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.virtualizationToolStripMenuItem.Text = "Virtualization";
- this.virtualizationToolStripMenuItem.Click += new System.EventHandler(this.virtualizationProcessMenuItem_Click);
- //
- // toolStripSeparator14
- //
- this.toolStripSeparator14.Name = "toolStripSeparator14";
- this.toolStripSeparator14.Size = new System.Drawing.Size(194, 6);
- //
- // affinityToolStripMenuItem
- //
- this.affinityToolStripMenuItem.Name = "affinityToolStripMenuItem";
- this.affinityToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.affinityToolStripMenuItem.Text = "Affinity...";
- this.affinityToolStripMenuItem.Click += new System.EventHandler(this.affinityProcessMenuItem_Click);
- //
- // createDumpFileToolStripMenuItem
- //
- this.createDumpFileToolStripMenuItem.Name = "createDumpFileToolStripMenuItem";
- this.createDumpFileToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.createDumpFileToolStripMenuItem.Text = "Create Dump File...";
- this.createDumpFileToolStripMenuItem.Click += new System.EventHandler(this.createDumpFileProcessMenuItem_Click);
- //
- // terminatorToolStripMenuItem
- //
- this.terminatorToolStripMenuItem.Name = "terminatorToolStripMenuItem";
- this.terminatorToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.terminatorToolStripMenuItem.Text = "Terminator";
- this.terminatorToolStripMenuItem.Click += new System.EventHandler(this.terminatorProcessMenuItem_Click);
- //
- // miscellaneousToolStripMenuItem
- //
- this.miscellaneousToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.analyzeWaitChainToolStripMenuItem,
- this.detachFromDebuggerToolStripMenuItem,
- this.heapsToolStripMenuItem,
- this.injectDLLToolStripMenuItem,
- this.iOPriorityToolStripMenuItem,
- this.protectionToolStripMenuItem,
- this.setTokenToolStripMenuItem,
- this.uploadToVirusTotalToolStripMenuItem});
- this.miscellaneousToolStripMenuItem.Name = "miscellaneousToolStripMenuItem";
- this.miscellaneousToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.miscellaneousToolStripMenuItem.Text = "Miscellaneous";
- //
- // analyzeWaitChainToolStripMenuItem
- //
- this.analyzeWaitChainToolStripMenuItem.Name = "analyzeWaitChainToolStripMenuItem";
- this.analyzeWaitChainToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.analyzeWaitChainToolStripMenuItem.Text = "Analyze Wait Chain";
- //
- // detachFromDebuggerToolStripMenuItem
- //
- this.detachFromDebuggerToolStripMenuItem.Name = "detachFromDebuggerToolStripMenuItem";
- this.detachFromDebuggerToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.detachFromDebuggerToolStripMenuItem.Text = "Detach from Debugger";
- //
- // heapsToolStripMenuItem
- //
- this.heapsToolStripMenuItem.Name = "heapsToolStripMenuItem";
- this.heapsToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.heapsToolStripMenuItem.Text = "Heaps";
- //
- // injectDLLToolStripMenuItem
- //
- this.injectDLLToolStripMenuItem.Name = "injectDLLToolStripMenuItem";
- this.injectDLLToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.injectDLLToolStripMenuItem.Text = "Inject DLL...";
- //
- // iOPriorityToolStripMenuItem
- //
- this.iOPriorityToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.ioPriority0ThreadMenuItem,
- this.ioPriority1ThreadMenuItem,
- this.ioPriority3ThreadMenuItem,
- this.toolStripMenuItem5});
- this.iOPriorityToolStripMenuItem.Name = "iOPriorityToolStripMenuItem";
- this.iOPriorityToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.iOPriorityToolStripMenuItem.Text = "I/O Priority";
- //
- // ioPriority0ThreadMenuItem
- //
- this.ioPriority0ThreadMenuItem.Name = "ioPriority0ThreadMenuItem";
- this.ioPriority0ThreadMenuItem.Size = new System.Drawing.Size(80, 22);
- this.ioPriority0ThreadMenuItem.Text = "0";
- //
- // ioPriority1ThreadMenuItem
- //
- this.ioPriority1ThreadMenuItem.Name = "ioPriority1ThreadMenuItem";
- this.ioPriority1ThreadMenuItem.Size = new System.Drawing.Size(80, 22);
- this.ioPriority1ThreadMenuItem.Text = "1";
- //
- // ioPriority3ThreadMenuItem
- //
- this.ioPriority3ThreadMenuItem.Name = "ioPriority3ThreadMenuItem";
- this.ioPriority3ThreadMenuItem.Size = new System.Drawing.Size(80, 22);
- this.ioPriority3ThreadMenuItem.Text = "2";
- //
- // toolStripMenuItem5
- //
- this.toolStripMenuItem5.Name = "toolStripMenuItem5";
- this.toolStripMenuItem5.Size = new System.Drawing.Size(80, 22);
- this.toolStripMenuItem5.Text = "3";
- //
- // protectionToolStripMenuItem
- //
- this.protectionToolStripMenuItem.Name = "protectionToolStripMenuItem";
- this.protectionToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.protectionToolStripMenuItem.Text = "Protection";
- //
- // setTokenToolStripMenuItem
- //
- this.setTokenToolStripMenuItem.Name = "setTokenToolStripMenuItem";
- this.setTokenToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.setTokenToolStripMenuItem.Text = "Set Token...";
- //
- // uploadToVirusTotalToolStripMenuItem
- //
- this.uploadToVirusTotalToolStripMenuItem.Name = "uploadToVirusTotalToolStripMenuItem";
- this.uploadToVirusTotalToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
- this.uploadToVirusTotalToolStripMenuItem.Text = "Upload to VirusTotal";
- //
- // priorityToolStripMenuItem
- //
- this.priorityToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.realTimeToolStripMenuItem,
- this.highToolStripMenuItem,
- this.aboveNormalToolStripMenuItem,
- this.normalToolStripMenuItem,
- this.belowNormalToolStripMenuItem,
- this.idleToolStripMenuItem});
- this.priorityToolStripMenuItem.Name = "priorityToolStripMenuItem";
- this.priorityToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.priorityToolStripMenuItem.Text = "&Priority";
- //
- // realTimeToolStripMenuItem
- //
- this.realTimeToolStripMenuItem.Name = "realTimeToolStripMenuItem";
- this.realTimeToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
- this.realTimeToolStripMenuItem.Text = "Real Time";
- //
- // highToolStripMenuItem
- //
- this.highToolStripMenuItem.Name = "highToolStripMenuItem";
- this.highToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
- this.highToolStripMenuItem.Text = "High";
- //
- // aboveNormalToolStripMenuItem
- //
- this.aboveNormalToolStripMenuItem.Name = "aboveNormalToolStripMenuItem";
- this.aboveNormalToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
- this.aboveNormalToolStripMenuItem.Text = "Above Normal";
- //
- // normalToolStripMenuItem
- //
- this.normalToolStripMenuItem.Name = "normalToolStripMenuItem";
- this.normalToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
- this.normalToolStripMenuItem.Text = "Normal";
- //
- // belowNormalToolStripMenuItem
- //
- this.belowNormalToolStripMenuItem.Name = "belowNormalToolStripMenuItem";
- this.belowNormalToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
- this.belowNormalToolStripMenuItem.Text = "Below Normal";
- //
- // idleToolStripMenuItem
- //
- this.idleToolStripMenuItem.Name = "idleToolStripMenuItem";
- this.idleToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
- this.idleToolStripMenuItem.Text = "Idle";
- //
- // runAsToolStripMenuItem1
- //
- this.runAsToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.launchAsUserToolStripMenuItem,
- this.launchAsThisUserToolStripMenuItem});
- this.runAsToolStripMenuItem1.Name = "runAsToolStripMenuItem1";
- this.runAsToolStripMenuItem1.Size = new System.Drawing.Size(197, 22);
- this.runAsToolStripMenuItem1.Text = "Run As";
- //
- // launchAsUserToolStripMenuItem
- //
- this.launchAsUserToolStripMenuItem.Name = "launchAsUserToolStripMenuItem";
- this.launchAsUserToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.launchAsUserToolStripMenuItem.Text = "Launch As User...";
- //
- // launchAsThisUserToolStripMenuItem
- //
- this.launchAsThisUserToolStripMenuItem.Name = "launchAsThisUserToolStripMenuItem";
- this.launchAsThisUserToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.launchAsThisUserToolStripMenuItem.Text = "Launch As This User...";
- //
- // windowToolStripMenuItem1
- //
- this.windowToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.bringToFrontToolStripMenuItem,
- this.restoreToolStripMenuItem,
- this.minimizeToolStripMenuItem,
- this.maximizeToolStripMenuItem,
- this.toolStripSeparator17,
- this.closeToolStripMenuItem});
- this.windowToolStripMenuItem1.Name = "windowToolStripMenuItem1";
- this.windowToolStripMenuItem1.Size = new System.Drawing.Size(197, 22);
- this.windowToolStripMenuItem1.Text = "&Window";
- //
- // bringToFrontToolStripMenuItem
- //
- this.bringToFrontToolStripMenuItem.Name = "bringToFrontToolStripMenuItem";
- this.bringToFrontToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
- this.bringToFrontToolStripMenuItem.Text = "&Bring to Front";
- //
- // restoreToolStripMenuItem
- //
- this.restoreToolStripMenuItem.Name = "restoreToolStripMenuItem";
- this.restoreToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
- this.restoreToolStripMenuItem.Text = "&Restore";
- this.restoreToolStripMenuItem.Click += new System.EventHandler(this.restoreProcessMenuItem_Click);
- //
- // minimizeToolStripMenuItem
- //
- this.minimizeToolStripMenuItem.Name = "minimizeToolStripMenuItem";
- this.minimizeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
- this.minimizeToolStripMenuItem.Text = "&Minimize";
- this.minimizeToolStripMenuItem.Click += new System.EventHandler(this.minimizeProcessMenuItem_Click);
- //
- // maximizeToolStripMenuItem
- //
- this.maximizeToolStripMenuItem.Name = "maximizeToolStripMenuItem";
- this.maximizeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
- this.maximizeToolStripMenuItem.Text = "Ma&ximize";
- this.maximizeToolStripMenuItem.Click += new System.EventHandler(this.maximizeProcessMenuItem_Click);
- //
- // toolStripSeparator17
- //
- this.toolStripSeparator17.Name = "toolStripSeparator17";
- this.toolStripSeparator17.Size = new System.Drawing.Size(144, 6);
- //
- // closeToolStripMenuItem
- //
- this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
- this.closeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
- this.closeToolStripMenuItem.Text = "&Close";
- this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeProcessMenuItem_Click);
- //
- // toolStripSeparator15
- //
- this.toolStripSeparator15.Name = "toolStripSeparator15";
- this.toolStripSeparator15.Size = new System.Drawing.Size(194, 6);
- //
- // searchOnlineToolStripMenuItem
- //
- this.searchOnlineToolStripMenuItem.Name = "searchOnlineToolStripMenuItem";
- this.searchOnlineToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.searchOnlineToolStripMenuItem.Text = "&Search Online";
- this.searchOnlineToolStripMenuItem.Click += new System.EventHandler(this.searchProcessMenuItem_Click);
- //
- // reanalyzeToolStripMenuItem
- //
- this.reanalyzeToolStripMenuItem.Name = "reanalyzeToolStripMenuItem";
- this.reanalyzeToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.reanalyzeToolStripMenuItem.Text = "Re-analyze";
- this.reanalyzeToolStripMenuItem.Click += new System.EventHandler(this.reanalyzeProcessMenuItem_Click);
- //
- // copyProcessMenuItem
- //
- this.copyProcessMenuItem.Name = "copyProcessMenuItem";
- this.copyProcessMenuItem.Size = new System.Drawing.Size(197, 22);
- this.copyProcessMenuItem.Text = "&Copy";
- //
- // selectAllToolStripMenuItem
- //
- this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
- this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
- this.selectAllToolStripMenuItem.Text = "Select All";
- this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllProcessMenuItem_Click);
- //
- // toolStripSeparator16
- //
- this.toolStripSeparator16.Name = "toolStripSeparator16";
- this.toolStripSeparator16.Size = new System.Drawing.Size(194, 6);
- //
- // propertiesToolStripMenuItem1
- //
- this.propertiesToolStripMenuItem1.Name = "propertiesToolStripMenuItem1";
- this.propertiesToolStripMenuItem1.Size = new System.Drawing.Size(197, 22);
- this.propertiesToolStripMenuItem1.Text = "&Properties";
- this.propertiesToolStripMenuItem1.Click += new System.EventHandler(this.propertiesProcessMenuItem_Click);
+ this.treeProcesses.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeProcesses_KeyDown);
//
// tabServices
//
@@ -653,118 +977,22 @@
this.tabServices.Location = new System.Drawing.Point(4, 22);
this.tabServices.Name = "tabServices";
this.tabServices.Padding = new System.Windows.Forms.Padding(3);
- this.tabServices.Size = new System.Drawing.Size(796, 468);
+ this.tabServices.Size = new System.Drawing.Size(796, 299);
this.tabServices.TabIndex = 1;
this.tabServices.Text = "Services";
this.tabServices.UseVisualStyleBackColor = true;
//
// listServices
//
- this.listServices.ContextMenuStrip = this.contextMenuStripService;
this.listServices.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listServices.DoubleBuffered = true;
this.listServices.Location = new System.Drawing.Point(3, 3);
this.listServices.Name = "listServices";
this.listServices.Provider = null;
- this.listServices.Size = new System.Drawing.Size(790, 462);
+ this.listServices.Size = new System.Drawing.Size(790, 293);
this.listServices.TabIndex = 0;
- this.listServices.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listServices_KeyDown);
this.listServices.DoubleClick += new System.EventHandler(this.listServices_DoubleClick);
- //
- // contextMenuStripService
- //
- this.contextMenuStripService.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.goToProcessServiceMenuItem,
- this.toolStripSeparator11,
- this.startToolStripMenuItem,
- this.pauseToolStripMenuItem,
- this.continueToolStripMenuItem,
- this.stopToolStripMenuItem,
- this.deleteToolStripMenuItem,
- this.toolStripSeparator12,
- this.copyToolStripMenuItem1,
- this.selectAllServiceMenuItem,
- this.toolStripSeparator13,
- this.propertiesToolStripMenuItem});
- this.contextMenuStripService.Name = "contextMenuStripService";
- this.contextMenuStripService.Size = new System.Drawing.Size(147, 220);
- this.contextMenuStripService.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripService_Opening);
- //
- // goToProcessServiceMenuItem
- //
- this.goToProcessServiceMenuItem.Name = "goToProcessServiceMenuItem";
- this.goToProcessServiceMenuItem.Size = new System.Drawing.Size(146, 22);
- this.goToProcessServiceMenuItem.Text = "&Go to Process";
- this.goToProcessServiceMenuItem.Click += new System.EventHandler(this.goToProcessServiceMenuItem_Click);
- //
- // toolStripSeparator11
- //
- this.toolStripSeparator11.Name = "toolStripSeparator11";
- this.toolStripSeparator11.Size = new System.Drawing.Size(143, 6);
- //
- // startToolStripMenuItem
- //
- this.startToolStripMenuItem.Name = "startToolStripMenuItem";
- this.startToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.startToolStripMenuItem.Text = "&Start";
- this.startToolStripMenuItem.Click += new System.EventHandler(this.startServiceMenuItem_Click);
- //
- // pauseToolStripMenuItem
- //
- this.pauseToolStripMenuItem.Name = "pauseToolStripMenuItem";
- this.pauseToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.pauseToolStripMenuItem.Text = "&Pause";
- this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseServiceMenuItem_Click);
- //
- // continueToolStripMenuItem
- //
- this.continueToolStripMenuItem.Name = "continueToolStripMenuItem";
- this.continueToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.continueToolStripMenuItem.Text = "&Continue";
- this.continueToolStripMenuItem.Click += new System.EventHandler(this.continueServiceMenuItem_Click);
- //
- // stopToolStripMenuItem
- //
- this.stopToolStripMenuItem.Name = "stopToolStripMenuItem";
- this.stopToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.stopToolStripMenuItem.Text = "S&top";
- this.stopToolStripMenuItem.Click += new System.EventHandler(this.stopServiceMenuItem_Click);
- //
- // deleteToolStripMenuItem
- //
- this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
- this.deleteToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.deleteToolStripMenuItem.Text = "Delete";
- this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteServiceMenuItem_Click);
- //
- // toolStripSeparator12
- //
- this.toolStripSeparator12.Name = "toolStripSeparator12";
- this.toolStripSeparator12.Size = new System.Drawing.Size(143, 6);
- //
- // copyToolStripMenuItem1
- //
- this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1";
- this.copyToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
- this.copyToolStripMenuItem1.Text = "Copy";
- //
- // selectAllServiceMenuItem
- //
- this.selectAllServiceMenuItem.Name = "selectAllServiceMenuItem";
- this.selectAllServiceMenuItem.Size = new System.Drawing.Size(146, 22);
- this.selectAllServiceMenuItem.Text = "Select All";
- this.selectAllServiceMenuItem.Click += new System.EventHandler(this.selectAllServiceMenuItem_Click);
- //
- // toolStripSeparator13
- //
- this.toolStripSeparator13.Name = "toolStripSeparator13";
- this.toolStripSeparator13.Size = new System.Drawing.Size(143, 6);
- //
- // propertiesToolStripMenuItem
- //
- this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem";
- this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.propertiesToolStripMenuItem.Text = "&Properties";
- this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.propertiesServiceMenuItem_Click);
+ this.listServices.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listServices_KeyDown);
//
// tabNetwork
//
@@ -772,101 +1000,25 @@
this.tabNetwork.Location = new System.Drawing.Point(4, 22);
this.tabNetwork.Name = "tabNetwork";
this.tabNetwork.Padding = new System.Windows.Forms.Padding(3);
- this.tabNetwork.Size = new System.Drawing.Size(796, 468);
+ this.tabNetwork.Size = new System.Drawing.Size(796, 299);
this.tabNetwork.TabIndex = 2;
this.tabNetwork.Text = "Network";
this.tabNetwork.UseVisualStyleBackColor = true;
//
// listNetwork
//
- this.listNetwork.ContextMenuStrip = this.contextMenuStripNetwork;
this.listNetwork.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listNetwork.DoubleBuffered = true;
this.listNetwork.Location = new System.Drawing.Point(3, 3);
this.listNetwork.Name = "listNetwork";
this.listNetwork.Provider = null;
- this.listNetwork.Size = new System.Drawing.Size(790, 462);
+ this.listNetwork.Size = new System.Drawing.Size(790, 293);
this.listNetwork.TabIndex = 0;
- this.listNetwork.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listNetwork_KeyDown);
this.listNetwork.DoubleClick += new System.EventHandler(this.listNetwork_DoubleClick);
- //
- // contextMenuStripNetwork
- //
- this.contextMenuStripNetwork.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.goToProcessNetworkMenuItem,
- this.toolsToolStripMenuItem1,
- this.closeNetworkMenuItem,
- this.toolStripSeparator7,
- this.copyToolStripMenuItem,
- this.selectAllNetworkMenuItem});
- this.contextMenuStripNetwork.Name = "contextMenuStripNetwork";
- this.contextMenuStripNetwork.Size = new System.Drawing.Size(147, 120);
- //
- // goToProcessNetworkMenuItem
- //
- this.goToProcessNetworkMenuItem.Name = "goToProcessNetworkMenuItem";
- this.goToProcessNetworkMenuItem.Size = new System.Drawing.Size(146, 22);
- this.goToProcessNetworkMenuItem.Text = "&Go to Process";
- this.goToProcessNetworkMenuItem.Click += new System.EventHandler(this.goToProcessNetworkMenuItem_Click);
- //
- // toolsToolStripMenuItem1
- //
- this.toolsToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.whoisNetworkMenuItem,
- this.tracertNetworkMenuItem,
- this.pingNetworkMenuItem});
- this.toolsToolStripMenuItem1.Name = "toolsToolStripMenuItem1";
- this.toolsToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
- this.toolsToolStripMenuItem1.Text = "Tools";
- //
- // whoisNetworkMenuItem
- //
- this.whoisNetworkMenuItem.Name = "whoisNetworkMenuItem";
- this.whoisNetworkMenuItem.Size = new System.Drawing.Size(111, 22);
- this.whoisNetworkMenuItem.Text = "Whois";
- this.whoisNetworkMenuItem.Click += new System.EventHandler(this.whoisNetworkMenuItem_Click);
- //
- // tracertNetworkMenuItem
- //
- this.tracertNetworkMenuItem.Name = "tracertNetworkMenuItem";
- this.tracertNetworkMenuItem.Size = new System.Drawing.Size(111, 22);
- this.tracertNetworkMenuItem.Text = "Tracert";
- this.tracertNetworkMenuItem.Click += new System.EventHandler(this.tracertNetworkMenuItem_Click);
- //
- // pingNetworkMenuItem
- //
- this.pingNetworkMenuItem.Name = "pingNetworkMenuItem";
- this.pingNetworkMenuItem.Size = new System.Drawing.Size(111, 22);
- this.pingNetworkMenuItem.Text = "Ping";
- this.pingNetworkMenuItem.Click += new System.EventHandler(this.pingNetworkMenuItem_Click);
- //
- // closeNetworkMenuItem
- //
- this.closeNetworkMenuItem.Name = "closeNetworkMenuItem";
- this.closeNetworkMenuItem.Size = new System.Drawing.Size(146, 22);
- this.closeNetworkMenuItem.Text = "Close";
- this.closeNetworkMenuItem.Click += new System.EventHandler(this.closeNetworkMenuItem_Click);
- //
- // toolStripSeparator7
- //
- this.toolStripSeparator7.Name = "toolStripSeparator7";
- this.toolStripSeparator7.Size = new System.Drawing.Size(143, 6);
- //
- // copyToolStripMenuItem
- //
- this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
- this.copyToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
- this.copyToolStripMenuItem.Text = "Copy";
- //
- // selectAllNetworkMenuItem
- //
- this.selectAllNetworkMenuItem.Name = "selectAllNetworkMenuItem";
- this.selectAllNetworkMenuItem.Size = new System.Drawing.Size(146, 22);
- this.selectAllNetworkMenuItem.Text = "Select All";
- this.selectAllNetworkMenuItem.Click += new System.EventHandler(this.selectAllNetworkMenuItem_Click);
+ this.listNetwork.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listNetwork_KeyDown);
//
// toolStrip
//
- this.toolStrip.ClickThrough = true;
this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.refreshToolStripButton,
@@ -874,30 +1026,31 @@
this.shutDownToolStripMenuItem,
this.toolStripSeparator1,
this.findHandlesToolStripButton,
- this.sysInfoToolStripButton,
- this.toolStripTextBox2});
- this.toolStrip.Location = new System.Drawing.Point(0, 24);
+ this.sysInfoToolStripButton});
+ this.toolStrip.Location = new System.Drawing.Point(0, 0);
this.toolStrip.Name = "toolStrip";
- this.toolStrip.Size = new System.Drawing.Size(804, 28);
+ this.toolStrip.Size = new System.Drawing.Size(804, 25);
this.toolStrip.TabIndex = 5;
this.toolStrip.Text = "toolStrip1";
//
// refreshToolStripButton
//
+ this.refreshToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.refreshToolStripButton.Image = global::ProcessHacker.Properties.Resources.arrow_refresh;
this.refreshToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.refreshToolStripButton.Name = "refreshToolStripButton";
- this.refreshToolStripButton.Size = new System.Drawing.Size(66, 25);
+ this.refreshToolStripButton.Size = new System.Drawing.Size(23, 22);
this.refreshToolStripButton.Text = "Refresh";
this.refreshToolStripButton.ToolTipText = "Refresh (F5)";
this.refreshToolStripButton.Click += new System.EventHandler(this.refreshToolStripButton_Click);
//
// optionsToolStripButton
//
+ this.optionsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.optionsToolStripButton.Image = global::ProcessHacker.Properties.Resources.cog_edit;
this.optionsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.optionsToolStripButton.Name = "optionsToolStripButton";
- this.optionsToolStripButton.Size = new System.Drawing.Size(69, 25);
+ this.optionsToolStripButton.Size = new System.Drawing.Size(23, 22);
this.optionsToolStripButton.Text = "Options";
this.optionsToolStripButton.ToolTipText = "Options... (Ctrl+O)";
this.optionsToolStripButton.Click += new System.EventHandler(this.optionsToolStripButton_Click);
@@ -908,561 +1061,331 @@
this.shutDownToolStripMenuItem.Image = global::ProcessHacker.Properties.Resources.lightbulb_off;
this.shutDownToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;
this.shutDownToolStripMenuItem.Name = "shutDownToolStripMenuItem";
- this.shutDownToolStripMenuItem.Size = new System.Drawing.Size(29, 25);
+ this.shutDownToolStripMenuItem.Size = new System.Drawing.Size(29, 22);
this.shutDownToolStripMenuItem.Text = "Shutdown";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(6, 28);
+ this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// findHandlesToolStripButton
//
+ this.findHandlesToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.findHandlesToolStripButton.Image = global::ProcessHacker.Properties.Resources.find;
this.findHandlesToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.findHandlesToolStripButton.Name = "findHandlesToolStripButton";
- this.findHandlesToolStripButton.Size = new System.Drawing.Size(147, 25);
+ this.findHandlesToolStripButton.Size = new System.Drawing.Size(23, 22);
this.findHandlesToolStripButton.Text = "Find Handles or DLLs...";
this.findHandlesToolStripButton.ToolTipText = "Find Handles or DLLs... (Ctrl+F)";
this.findHandlesToolStripButton.Click += new System.EventHandler(this.findHandlesToolStripButton_Click);
//
// sysInfoToolStripButton
//
+ this.sysInfoToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.sysInfoToolStripButton.Image = global::ProcessHacker.Properties.Resources.chart_line;
this.sysInfoToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.sysInfoToolStripButton.Name = "sysInfoToolStripButton";
- this.sysInfoToolStripButton.Size = new System.Drawing.Size(140, 25);
+ this.sysInfoToolStripButton.Size = new System.Drawing.Size(23, 22);
this.sysInfoToolStripButton.Text = "System Information...";
this.sysInfoToolStripButton.ToolTipText = "System Information... (Ctrl+I)";
this.sysInfoToolStripButton.Click += new System.EventHandler(this.sysInfoToolStripButton_Click);
//
- // toolStripTextBox2
+ // menuService
//
- this.toolStripTextBox2.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
- this.toolStripTextBox2.BackColor = System.Drawing.SystemColors.InactiveBorder;
- this.toolStripTextBox2.ForeColor = System.Drawing.SystemColors.GrayText;
- this.toolStripTextBox2.Name = "toolStripTextBox2";
- this.toolStripTextBox2.Size = new System.Drawing.Size(180, 25);
+ this.menuService.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.goToProcessServiceMenuItem,
+ this.startServiceMenuItem,
+ this.continueServiceMenuItem,
+ this.pauseServiceMenuItem,
+ this.stopServiceMenuItem,
+ this.deleteServiceMenuItem,
+ this.propertiesServiceMenuItem,
+ this.menuItem8,
+ this.copyServiceMenuItem,
+ this.selectAllServiceMenuItem});
+ this.menuService.Popup += new System.EventHandler(this.menuService_Popup);
//
- // statusStrip1
+ // goToProcessServiceMenuItem
//
- this.statusStrip1.AllowItemReorder = true;
- this.statusStrip1.BackColor = System.Drawing.SystemColors.Control;
- this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.statusMemory,
- this.statusCPU,
- this.statusGeneral});
- this.statusStrip1.Location = new System.Drawing.Point(0, 546);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode;
- this.statusStrip1.Size = new System.Drawing.Size(804, 22);
- this.statusStrip1.TabIndex = 7;
- this.statusStrip1.Text = "statusStrip1";
+ this.vistaMenu.SetImage(this.goToProcessServiceMenuItem, global::ProcessHacker.Properties.Resources.arrow_right);
+ this.goToProcessServiceMenuItem.Index = 0;
+ this.goToProcessServiceMenuItem.Text = "&Go to Process";
+ this.goToProcessServiceMenuItem.Click += new System.EventHandler(this.goToProcessServiceMenuItem_Click);
//
- // statusMemory
+ // startServiceMenuItem
//
- this.statusMemory.Name = "statusMemory";
- this.statusMemory.Size = new System.Drawing.Size(52, 17);
- this.statusMemory.Text = "Memory";
+ this.vistaMenu.SetImage(this.startServiceMenuItem, global::ProcessHacker.Properties.Resources.control_play_blue);
+ this.startServiceMenuItem.Index = 1;
+ this.startServiceMenuItem.Text = "&Start";
+ this.startServiceMenuItem.Click += new System.EventHandler(this.startServiceMenuItem_Click);
//
- // statusCPU
+ // continueServiceMenuItem
//
- this.statusCPU.Name = "statusCPU";
- this.statusCPU.Size = new System.Drawing.Size(30, 17);
- this.statusCPU.Text = "CPU";
+ this.continueServiceMenuItem.Index = 2;
+ this.continueServiceMenuItem.Text = "&Continue";
+ this.continueServiceMenuItem.Click += new System.EventHandler(this.continueServiceMenuItem_Click);
//
- // statusGeneral
+ // pauseServiceMenuItem
//
- this.statusGeneral.Name = "statusGeneral";
- this.statusGeneral.Size = new System.Drawing.Size(47, 17);
- this.statusGeneral.Text = "General";
+ this.vistaMenu.SetImage(this.pauseServiceMenuItem, global::ProcessHacker.Properties.Resources.control_pause_blue);
+ this.pauseServiceMenuItem.Index = 3;
+ this.pauseServiceMenuItem.Text = "&Pause";
+ this.pauseServiceMenuItem.Click += new System.EventHandler(this.pauseServiceMenuItem_Click);
//
- // menuStripEx1
+ // stopServiceMenuItem
//
- this.menuStripEx1.ClickThrough = true;
- this.menuStripEx1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.hackerToolStripMenuItem,
- this.viewToolStripMenuItem,
- this.toolsToolStripMenuItem,
- this.usersToolStripMenuItem,
- this.windowToolStripMenuItem,
- this.helpToolStripMenuItem});
- this.menuStripEx1.Location = new System.Drawing.Point(0, 0);
- this.menuStripEx1.Name = "menuStripEx1";
- this.menuStripEx1.Size = new System.Drawing.Size(804, 24);
- this.menuStripEx1.TabIndex = 8;
- this.menuStripEx1.Text = "menuStripEx1";
+ this.vistaMenu.SetImage(this.stopServiceMenuItem, global::ProcessHacker.Properties.Resources.control_stop_blue);
+ this.stopServiceMenuItem.Index = 4;
+ this.stopServiceMenuItem.Text = "S&top";
+ this.stopServiceMenuItem.Click += new System.EventHandler(this.stopServiceMenuItem_Click);
//
- // hackerToolStripMenuItem
+ // deleteServiceMenuItem
//
- this.hackerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.runToolStripMenuItem,
- this.runAsToolStripMenuItem,
- this.runAsAdministratorMenuItem,
- this.showDetailsForAllProcessesMenuItem,
- this.toolStripSeparator4,
- this.openToolStripMenuItem,
- this.saveToolStripMenuItem,
- this.toolStripSeparator6,
- this.findHandlesMenuItem,
- this.inspectPEFileToolStripMenuItem,
- this.optionsMenuItem,
- this.toolStripSeparator5,
- this.shutdownMenuItem,
- this.exitToolStripMenuItem});
- this.hackerToolStripMenuItem.Name = "hackerToolStripMenuItem";
- this.hackerToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
- this.hackerToolStripMenuItem.Text = "Hacker";
+ this.vistaMenu.SetImage(this.deleteServiceMenuItem, global::ProcessHacker.Properties.Resources.cross);
+ this.deleteServiceMenuItem.Index = 5;
+ this.deleteServiceMenuItem.Shortcut = System.Windows.Forms.Shortcut.Del;
+ this.deleteServiceMenuItem.Text = "Delete";
+ this.deleteServiceMenuItem.Click += new System.EventHandler(this.deleteServiceMenuItem_Click);
//
- // runToolStripMenuItem
+ // propertiesServiceMenuItem
//
- this.runToolStripMenuItem.Name = "runToolStripMenuItem";
- this.runToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
- this.runToolStripMenuItem.Text = "Run...";
- this.runToolStripMenuItem.Click += new System.EventHandler(this.runMenuItem_Click);
+ this.propertiesServiceMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.propertiesServiceMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
+ this.propertiesServiceMenuItem.Index = 6;
+ this.propertiesServiceMenuItem.Text = "&Properties";
+ this.propertiesServiceMenuItem.Click += new System.EventHandler(this.propertiesServiceMenuItem_Click);
//
- // runAsToolStripMenuItem
+ // menuItem8
//
- this.runAsToolStripMenuItem.Name = "runAsToolStripMenuItem";
- this.runAsToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
- this.runAsToolStripMenuItem.Text = "Run As...";
- this.runAsToolStripMenuItem.Click += new System.EventHandler(this.runAsServiceMenuItem_Click);
+ this.menuItem8.Index = 7;
+ this.menuItem8.Text = "-";
//
- // runAsAdministratorMenuItem
+ // copyServiceMenuItem
//
- this.runAsAdministratorMenuItem.Name = "runAsAdministratorMenuItem";
- this.runAsAdministratorMenuItem.Size = new System.Drawing.Size(230, 22);
- this.runAsAdministratorMenuItem.Text = "Run As Administrator...";
- this.runAsAdministratorMenuItem.Click += new System.EventHandler(this.runAsAdministratorMenuItem_Click);
+ this.vistaMenu.SetImage(this.copyServiceMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
+ this.copyServiceMenuItem.Index = 8;
+ this.copyServiceMenuItem.Text = "Copy";
//
- // showDetailsForAllProcessesMenuItem
+ // selectAllServiceMenuItem
//
- this.showDetailsForAllProcessesMenuItem.Name = "showDetailsForAllProcessesMenuItem";
- this.showDetailsForAllProcessesMenuItem.Size = new System.Drawing.Size(230, 22);
- this.showDetailsForAllProcessesMenuItem.Text = "Show Details for All Processes";
- this.showDetailsForAllProcessesMenuItem.Click += new System.EventHandler(this.showDetailsForAllProcessesMenuItem_Click);
+ this.selectAllServiceMenuItem.Index = 9;
+ this.selectAllServiceMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
+ this.selectAllServiceMenuItem.Text = "Select &All";
+ this.selectAllServiceMenuItem.Click += new System.EventHandler(this.selectAllServiceMenuItem_Click);
//
- // toolStripSeparator4
+ // menuIcon
//
- this.toolStripSeparator4.Name = "toolStripSeparator4";
- this.toolStripSeparator4.Size = new System.Drawing.Size(227, 6);
- //
- // openToolStripMenuItem
- //
- this.openToolStripMenuItem.Name = "openToolStripMenuItem";
- this.openToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
- this.openToolStripMenuItem.Text = "Open";
- this.openToolStripMenuItem.Click += new System.EventHandler(this.openMenuItem_Click);
- //
- // saveToolStripMenuItem
- //
- this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
- this.saveToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
- this.saveToolStripMenuItem.Text = "Save";
- this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveMenuItem_Click);
- //
- // toolStripSeparator6
- //
- this.toolStripSeparator6.Name = "toolStripSeparator6";
- this.toolStripSeparator6.Size = new System.Drawing.Size(227, 6);
- //
- // findHandlesMenuItem
- //
- this.findHandlesMenuItem.Name = "findHandlesMenuItem";
- this.findHandlesMenuItem.Size = new System.Drawing.Size(230, 22);
- this.findHandlesMenuItem.Text = "&Find Handles or DLLs...";
- this.findHandlesMenuItem.Click += new System.EventHandler(this.findHandlesMenuItem_Click);
- //
- // inspectPEFileToolStripMenuItem
- //
- this.inspectPEFileToolStripMenuItem.Name = "inspectPEFileToolStripMenuItem";
- this.inspectPEFileToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
- this.inspectPEFileToolStripMenuItem.Text = "Inspect &PE File...";
- this.inspectPEFileToolStripMenuItem.Click += new System.EventHandler(this.inspectPEFileMenuItem_Click);
- //
- // optionsMenuItem
- //
- this.optionsMenuItem.Name = "optionsMenuItem";
- this.optionsMenuItem.Size = new System.Drawing.Size(230, 22);
- this.optionsMenuItem.Text = "&Options...";
- this.optionsMenuItem.Click += new System.EventHandler(this.optionsMenuItem_Click);
- //
- // toolStripSeparator5
- //
- this.toolStripSeparator5.Name = "toolStripSeparator5";
- this.toolStripSeparator5.Size = new System.Drawing.Size(227, 6);
- //
- // shutdownMenuItem
- //
- this.shutdownMenuItem.Name = "shutdownMenuItem";
- this.shutdownMenuItem.Size = new System.Drawing.Size(230, 22);
- this.shutdownMenuItem.Text = "Shutdown";
- //
- // exitToolStripMenuItem
- //
- this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- this.exitToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
- this.exitToolStripMenuItem.Text = "Exit";
- this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
- //
- // viewToolStripMenuItem
- //
- this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolbarMenuItem,
- this.sysInfoMenuItem,
- this.trayIconsToolStripMenuItem,
- this.toolStripSeparator3,
- this.refreshToolStripMenuItem,
- this.updateProcessesMenuItem,
- this.updateServicesMenuItem});
- this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
- this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
- this.viewToolStripMenuItem.Text = "View";
- //
- // toolbarMenuItem
- //
- this.toolbarMenuItem.Name = "toolbarMenuItem";
- this.toolbarMenuItem.Size = new System.Drawing.Size(178, 22);
- this.toolbarMenuItem.Text = "Toolbar";
- this.toolbarMenuItem.Click += new System.EventHandler(this.toolbarMenuItem_Click);
- //
- // sysInfoMenuItem
- //
- this.sysInfoMenuItem.Name = "sysInfoMenuItem";
- this.sysInfoMenuItem.Size = new System.Drawing.Size(178, 22);
- this.sysInfoMenuItem.Text = "System &Information";
- this.sysInfoMenuItem.Click += new System.EventHandler(this.sysInfoMenuItem_Click);
- //
- // trayIconsToolStripMenuItem
- //
- this.trayIconsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.cpuHistoryMenuItem,
- this.cpuUsageMenuItem,
- this.ioHistoryMenuItem,
- this.commitHistoryMenuItem,
- this.physMemHistoryMenuItem});
- this.trayIconsToolStripMenuItem.Name = "trayIconsToolStripMenuItem";
- this.trayIconsToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
- this.trayIconsToolStripMenuItem.Text = "Tray Icons";
- //
- // cpuHistoryMenuItem
- //
- this.cpuHistoryMenuItem.Name = "cpuHistoryMenuItem";
- this.cpuHistoryMenuItem.Size = new System.Drawing.Size(206, 22);
- this.cpuHistoryMenuItem.Text = "CPU History";
- this.cpuHistoryMenuItem.Click += new System.EventHandler(this.cpuHistoryMenuItem_Click);
- //
- // cpuUsageMenuItem
- //
- this.cpuUsageMenuItem.Name = "cpuUsageMenuItem";
- this.cpuUsageMenuItem.Size = new System.Drawing.Size(206, 22);
- this.cpuUsageMenuItem.Text = "CPU Usage";
- this.cpuUsageMenuItem.Click += new System.EventHandler(this.cpuUsageMenuItem_Click);
- //
- // ioHistoryMenuItem
- //
- this.ioHistoryMenuItem.Name = "ioHistoryMenuItem";
- this.ioHistoryMenuItem.Size = new System.Drawing.Size(206, 22);
- this.ioHistoryMenuItem.Text = "I/O History";
- this.ioHistoryMenuItem.Click += new System.EventHandler(this.ioHistoryMenuItem_Click);
- //
- // commitHistoryMenuItem
- //
- this.commitHistoryMenuItem.Name = "commitHistoryMenuItem";
- this.commitHistoryMenuItem.Size = new System.Drawing.Size(206, 22);
- this.commitHistoryMenuItem.Text = "Commit History";
- this.commitHistoryMenuItem.Click += new System.EventHandler(this.commitHistoryMenuItem_Click);
- //
- // physMemHistoryMenuItem
- //
- this.physMemHistoryMenuItem.Name = "physMemHistoryMenuItem";
- this.physMemHistoryMenuItem.Size = new System.Drawing.Size(206, 22);
- this.physMemHistoryMenuItem.Text = "Physical Memory History";
- this.physMemHistoryMenuItem.Click += new System.EventHandler(this.physMemHistoryMenuItem_Click);
- //
- // toolStripSeparator3
- //
- this.toolStripSeparator3.Name = "toolStripSeparator3";
- this.toolStripSeparator3.Size = new System.Drawing.Size(175, 6);
- //
- // refreshToolStripMenuItem
- //
- this.refreshToolStripMenuItem.Name = "refreshToolStripMenuItem";
- this.refreshToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
- this.refreshToolStripMenuItem.Text = "Refresh";
- this.refreshToolStripMenuItem.Click += new System.EventHandler(this.refreshToolStripButton_Click);
- //
- // updateProcessesMenuItem
- //
- this.updateProcessesMenuItem.Name = "updateProcessesMenuItem";
- this.updateProcessesMenuItem.Size = new System.Drawing.Size(178, 22);
- this.updateProcessesMenuItem.Text = "Update &Processes";
- this.updateProcessesMenuItem.Click += new System.EventHandler(this.updateProcessesMenuItem_Click);
- //
- // updateServicesMenuItem
- //
- this.updateServicesMenuItem.Name = "updateServicesMenuItem";
- this.updateServicesMenuItem.Size = new System.Drawing.Size(178, 22);
- this.updateServicesMenuItem.Text = "Update &Services";
- this.updateServicesMenuItem.Click += new System.EventHandler(this.updateServicesMenuItem_Click);
- //
- // toolsToolStripMenuItem
- //
- this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.createServiceToolStripMenuItem,
- this.hiddenProcessesToolStripMenuItem,
- this.verifyFileSignatureToolStripMenuItem});
- this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
- this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
- this.toolsToolStripMenuItem.Text = "Tools";
- //
- // createServiceToolStripMenuItem
- //
- this.createServiceToolStripMenuItem.Name = "createServiceToolStripMenuItem";
- this.createServiceToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
- this.createServiceToolStripMenuItem.Text = "Create &Service";
- this.createServiceToolStripMenuItem.Click += new System.EventHandler(this.createServiceMenuItem_Click);
- //
- // hiddenProcessesToolStripMenuItem
- //
- this.hiddenProcessesToolStripMenuItem.Name = "hiddenProcessesToolStripMenuItem";
- this.hiddenProcessesToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
- this.hiddenProcessesToolStripMenuItem.Text = "&Hidden Processes";
- this.hiddenProcessesToolStripMenuItem.Click += new System.EventHandler(this.hiddenProcessesMenuItem_Click);
- //
- // verifyFileSignatureToolStripMenuItem
- //
- this.verifyFileSignatureToolStripMenuItem.Name = "verifyFileSignatureToolStripMenuItem";
- this.verifyFileSignatureToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
- this.verifyFileSignatureToolStripMenuItem.Text = "&Verify File Signature...";
- this.verifyFileSignatureToolStripMenuItem.Click += new System.EventHandler(this.verifyFileSignatureMenuItem_Click);
- //
- // usersToolStripMenuItem
- //
- this.usersToolStripMenuItem.Name = "usersToolStripMenuItem";
- this.usersToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
- this.usersToolStripMenuItem.Text = "Users";
- //
- // windowToolStripMenuItem
- //
- this.windowToolStripMenuItem.Name = "windowToolStripMenuItem";
- this.windowToolStripMenuItem.Size = new System.Drawing.Size(63, 20);
- this.windowToolStripMenuItem.Text = "Window";
- //
- // helpToolStripMenuItem
- //
- this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.checkForUpdatesMenuItem,
- this.toolStripSeparator2,
- this.logToolStripMenuItem,
- this.helpToolStripMenuItem1,
- this.aboutToolStripMenuItem});
- this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
- this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
- this.helpToolStripMenuItem.Text = "Help";
- //
- // checkForUpdatesMenuItem
- //
- this.checkForUpdatesMenuItem.Enabled = false;
- this.checkForUpdatesMenuItem.Name = "checkForUpdatesMenuItem";
- this.checkForUpdatesMenuItem.Size = new System.Drawing.Size(173, 22);
- this.checkForUpdatesMenuItem.Text = "Check For Updates";
- //
- // toolStripSeparator2
- //
- this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(170, 6);
- //
- // logToolStripMenuItem
- //
- this.logToolStripMenuItem.Name = "logToolStripMenuItem";
- this.logToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
- this.logToolStripMenuItem.Text = "Log";
- this.logToolStripMenuItem.Click += new System.EventHandler(this.logMenuItem_Click);
- //
- // helpToolStripMenuItem1
- //
- this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1";
- this.helpToolStripMenuItem1.Size = new System.Drawing.Size(173, 22);
- this.helpToolStripMenuItem1.Text = "Help";
- this.helpToolStripMenuItem1.Click += new System.EventHandler(this.helpMenuItem_Click);
- //
- // aboutToolStripMenuItem
- //
- this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
- this.aboutToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
- this.aboutToolStripMenuItem.Text = "About";
- this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutMenuItem_Click);
- //
- // contextMenuStripTray
- //
- this.contextMenuStripTray.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.showHideProcessHackerToolStripMenuItem,
- this.systemInformationToolStripMenuItem,
+ this.menuIcon.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.showHideMenuItem,
+ this.sysInformationIconMenuItem,
this.networkInfomationMenuItem,
- this.toolStripSeparator9,
+ this.notificationsMenuItem,
this.processesMenuItem,
- this.notificationsToolStripMenuItem,
- this.toolStripSeparator8,
this.shutdownTrayMenuItem,
- this.exitToolStripMenuItem1});
- this.contextMenuStripTray.Name = "contextMenuStripTray";
- this.contextMenuStripTray.Size = new System.Drawing.Size(217, 170);
+ this.exitTrayMenuItem});
+ this.menuIcon.Popup += new System.EventHandler(this.menuIcon_Popup);
//
- // showHideProcessHackerToolStripMenuItem
+ // showHideMenuItem
//
- this.showHideProcessHackerToolStripMenuItem.Name = "showHideProcessHackerToolStripMenuItem";
- this.showHideProcessHackerToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
- this.showHideProcessHackerToolStripMenuItem.Text = "&Show/Hide Process Hacker";
- this.showHideProcessHackerToolStripMenuItem.Click += new System.EventHandler(this.showHideMenuItem_Click);
+ this.showHideMenuItem.Index = 0;
+ this.showHideMenuItem.Text = "&Show/Hide Process Hacker";
+ this.showHideMenuItem.Click += new System.EventHandler(this.showHideMenuItem_Click);
//
- // systemInformationToolStripMenuItem
+ // sysInformationIconMenuItem
//
- this.systemInformationToolStripMenuItem.Name = "systemInformationToolStripMenuItem";
- this.systemInformationToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
- this.systemInformationToolStripMenuItem.Text = "System &Information";
- this.systemInformationToolStripMenuItem.Click += new System.EventHandler(this.sysInfoMenuItem_Click);
+ this.sysInformationIconMenuItem.Index = 1;
+ this.sysInformationIconMenuItem.Text = "System &Information";
+ this.sysInformationIconMenuItem.Click += new System.EventHandler(this.sysInformationIconMenuItem_Click);
//
// networkInfomationMenuItem
//
- this.networkInfomationMenuItem.Name = "networkInfomationMenuItem";
- this.networkInfomationMenuItem.Size = new System.Drawing.Size(216, 22);
+ this.networkInfomationMenuItem.Index = 2;
this.networkInfomationMenuItem.Text = "Network Infomation";
this.networkInfomationMenuItem.Click += new System.EventHandler(this.networkInfomationMenuItem_Click);
//
- // toolStripSeparator9
+ // notificationsMenuItem
//
- this.toolStripSeparator9.Name = "toolStripSeparator9";
- this.toolStripSeparator9.Size = new System.Drawing.Size(213, 6);
+ this.notificationsMenuItem.Index = 3;
+ this.notificationsMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.enableAllNotificationsMenuItem,
+ this.disableAllNotificationsMenuItem,
+ this.menuItem4,
+ this.NPMenuItem,
+ this.TPMenuItem,
+ this.NSMenuItem,
+ this.startedSMenuItem,
+ this.stoppedSMenuItem,
+ this.DSMenuItem});
+ this.notificationsMenuItem.Text = "&Notifications";
+ //
+ // enableAllNotificationsMenuItem
+ //
+ this.enableAllNotificationsMenuItem.Index = 0;
+ this.enableAllNotificationsMenuItem.Text = "&Enable All";
+ this.enableAllNotificationsMenuItem.Click += new System.EventHandler(this.enableAllNotificationsMenuItem_Click);
+ //
+ // disableAllNotificationsMenuItem
+ //
+ this.disableAllNotificationsMenuItem.Index = 1;
+ this.disableAllNotificationsMenuItem.Text = "&Disable All";
+ this.disableAllNotificationsMenuItem.Click += new System.EventHandler(this.disableAllNotificationsMenuItem_Click);
+ //
+ // menuItem4
+ //
+ this.menuItem4.Index = 2;
+ this.menuItem4.Text = "-";
+ //
+ // NPMenuItem
+ //
+ this.NPMenuItem.Index = 3;
+ this.NPMenuItem.Text = "New Processes";
+ //
+ // TPMenuItem
+ //
+ this.TPMenuItem.Index = 4;
+ this.TPMenuItem.Text = "Terminated Processes";
+ //
+ // NSMenuItem
+ //
+ this.NSMenuItem.Index = 5;
+ this.NSMenuItem.Text = "New Services";
+ //
+ // startedSMenuItem
+ //
+ this.startedSMenuItem.Index = 6;
+ this.startedSMenuItem.Text = "Started Services";
+ //
+ // stoppedSMenuItem
+ //
+ this.stoppedSMenuItem.Index = 7;
+ this.stoppedSMenuItem.Text = "Stopped Services";
+ //
+ // DSMenuItem
+ //
+ this.DSMenuItem.Index = 8;
+ this.DSMenuItem.Text = "Deleted Services";
//
// processesMenuItem
//
- this.processesMenuItem.Name = "processesMenuItem";
- this.processesMenuItem.Size = new System.Drawing.Size(216, 22);
+ this.processesMenuItem.Index = 4;
this.processesMenuItem.Text = "&Processes";
//
- // notificationsToolStripMenuItem
- //
- this.notificationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.enableAllToolStripMenuItem,
- this.disableAllToolStripMenuItem,
- this.toolStripSeparator10,
- this.newProcessesToolStripMenuItem,
- this.terminatedProcessesToolStripMenuItem,
- this.newServicesToolStripMenuItem,
- this.startedServicesToolStripMenuItem,
- this.stoppedServicesToolStripMenuItem,
- this.deletedServicesToolStripMenuItem});
- this.notificationsToolStripMenuItem.Name = "notificationsToolStripMenuItem";
- this.notificationsToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
- this.notificationsToolStripMenuItem.Text = "&Notifications";
- //
- // enableAllToolStripMenuItem
- //
- this.enableAllToolStripMenuItem.Name = "enableAllToolStripMenuItem";
- this.enableAllToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.enableAllToolStripMenuItem.Text = "&Enable All";
- this.enableAllToolStripMenuItem.Click += new System.EventHandler(this.enableAllNotificationsMenuItem_Click);
- //
- // disableAllToolStripMenuItem
- //
- this.disableAllToolStripMenuItem.Name = "disableAllToolStripMenuItem";
- this.disableAllToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.disableAllToolStripMenuItem.Text = "&Disable All";
- this.disableAllToolStripMenuItem.Click += new System.EventHandler(this.disableAllNotificationsMenuItem_Click);
- //
- // toolStripSeparator10
- //
- this.toolStripSeparator10.Name = "toolStripSeparator10";
- this.toolStripSeparator10.Size = new System.Drawing.Size(186, 6);
- //
- // newProcessesToolStripMenuItem
- //
- this.newProcessesToolStripMenuItem.Name = "newProcessesToolStripMenuItem";
- this.newProcessesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.newProcessesToolStripMenuItem.Text = "New Processes";
- this.newProcessesToolStripMenuItem.Click += new System.EventHandler(this.CheckedMenuItem_Click);
- //
- // terminatedProcessesToolStripMenuItem
- //
- this.terminatedProcessesToolStripMenuItem.Name = "terminatedProcessesToolStripMenuItem";
- this.terminatedProcessesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.terminatedProcessesToolStripMenuItem.Text = "Terminated Processes";
- //
- // newServicesToolStripMenuItem
- //
- this.newServicesToolStripMenuItem.Name = "newServicesToolStripMenuItem";
- this.newServicesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.newServicesToolStripMenuItem.Text = "New Services";
- //
- // startedServicesToolStripMenuItem
- //
- this.startedServicesToolStripMenuItem.Name = "startedServicesToolStripMenuItem";
- this.startedServicesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.startedServicesToolStripMenuItem.Text = "Started Services";
- //
- // stoppedServicesToolStripMenuItem
- //
- this.stoppedServicesToolStripMenuItem.Name = "stoppedServicesToolStripMenuItem";
- this.stoppedServicesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.stoppedServicesToolStripMenuItem.Text = "Stopped Services";
- //
- // deletedServicesToolStripMenuItem
- //
- this.deletedServicesToolStripMenuItem.Name = "deletedServicesToolStripMenuItem";
- this.deletedServicesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
- this.deletedServicesToolStripMenuItem.Text = "Deleted Services";
- //
- // toolStripSeparator8
- //
- this.toolStripSeparator8.Name = "toolStripSeparator8";
- this.toolStripSeparator8.Size = new System.Drawing.Size(213, 6);
- //
// shutdownTrayMenuItem
//
- this.shutdownTrayMenuItem.Name = "shutdownTrayMenuItem";
- this.shutdownTrayMenuItem.Size = new System.Drawing.Size(216, 22);
+ this.shutdownTrayMenuItem.Index = 5;
this.shutdownTrayMenuItem.Text = "Shutdown";
//
- // exitToolStripMenuItem1
+ // exitTrayMenuItem
//
- this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
- this.exitToolStripMenuItem1.Size = new System.Drawing.Size(216, 22);
- this.exitToolStripMenuItem1.Text = "Exit";
- this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitMenuItem_Click);
+ this.vistaMenu.SetImage(this.exitTrayMenuItem, global::ProcessHacker.Properties.Resources.door_out);
+ this.exitTrayMenuItem.Index = 6;
+ this.exitTrayMenuItem.Text = "E&xit";
+ this.exitTrayMenuItem.Click += new System.EventHandler(this.exitTrayMenuItem_Click);
+ //
+ // goToProcessNetworkMenuItem
+ //
+ this.goToProcessNetworkMenuItem.DefaultItem = true;
+ this.vistaMenu.SetImage(this.goToProcessNetworkMenuItem, global::ProcessHacker.Properties.Resources.arrow_right);
+ this.goToProcessNetworkMenuItem.Index = 0;
+ this.goToProcessNetworkMenuItem.Text = "&Go to Process";
+ this.goToProcessNetworkMenuItem.Click += new System.EventHandler(this.goToProcessNetworkMenuItem_Click);
+ //
+ // copyNetworkMenuItem
+ //
+ this.vistaMenu.SetImage(this.copyNetworkMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
+ this.copyNetworkMenuItem.Index = 4;
+ this.copyNetworkMenuItem.Text = "&Copy";
+ //
+ // closeNetworkMenuItem
+ //
+ this.vistaMenu.SetImage(this.closeNetworkMenuItem, global::ProcessHacker.Properties.Resources.cross);
+ this.closeNetworkMenuItem.Index = 2;
+ this.closeNetworkMenuItem.Text = "Close";
+ this.closeNetworkMenuItem.Click += new System.EventHandler(this.closeNetworkMenuItem_Click);
+ //
+ // menuNetwork
+ //
+ this.menuNetwork.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.goToProcessNetworkMenuItem,
+ this.toolsNetworkMenuItem,
+ this.closeNetworkMenuItem,
+ this.menuItem6,
+ this.copyNetworkMenuItem,
+ this.selectAllNetworkMenuItem});
+ this.menuNetwork.Popup += new System.EventHandler(this.menuNetwork_Popup);
+ //
+ // toolsNetworkMenuItem
+ //
+ this.toolsNetworkMenuItem.Index = 1;
+ this.toolsNetworkMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.whoisNetworkMenuItem,
+ this.tracertNetworkMenuItem,
+ this.pingNetworkMenuItem});
+ this.toolsNetworkMenuItem.Text = "Tools";
+ //
+ // whoisNetworkMenuItem
+ //
+ this.whoisNetworkMenuItem.Index = 0;
+ this.whoisNetworkMenuItem.Text = "Whois";
+ this.whoisNetworkMenuItem.Click += new System.EventHandler(this.whoisNetworkMenuItem_Click);
+ //
+ // tracertNetworkMenuItem
+ //
+ this.tracertNetworkMenuItem.Index = 1;
+ this.tracertNetworkMenuItem.Text = "Tracert";
+ this.tracertNetworkMenuItem.Click += new System.EventHandler(this.tracertNetworkMenuItem_Click);
+ //
+ // pingNetworkMenuItem
+ //
+ this.pingNetworkMenuItem.Index = 2;
+ this.pingNetworkMenuItem.Text = "Ping";
+ this.pingNetworkMenuItem.Click += new System.EventHandler(this.pingNetworkMenuItem_Click);
+ //
+ // menuItem6
+ //
+ this.menuItem6.Index = 3;
+ this.menuItem6.Text = "-";
+ //
+ // selectAllNetworkMenuItem
+ //
+ this.selectAllNetworkMenuItem.Index = 5;
+ this.selectAllNetworkMenuItem.Text = "Select &All";
+ this.selectAllNetworkMenuItem.Click += new System.EventHandler(this.selectAllNetworkMenuItem_Click);
+ //
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
//
// HackerWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(804, 568);
+ this.ClientSize = new System.Drawing.Size(804, 372);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.toolStrip);
- this.Controls.Add(this.statusStrip1);
- this.Controls.Add(this.menuStripEx1);
+ this.Controls.Add(this.statusBar);
+ this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
- this.MainMenuStrip = this.menuStripEx1;
+ this.Menu = this.mainMenu;
this.Name = "HackerWindow";
this.Text = "Process Hacker";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HackerWindow_FormClosing);
this.Load += new System.EventHandler(this.HackerWindow_Load);
+ this.SizeChanged += new System.EventHandler(this.HackerWindow_SizeChanged);
this.VisibleChanged += new System.EventHandler(this.HackerWindow_VisibleChanged);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HackerWindow_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.statusGeneral)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.statusCPU)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.statusMemory)).EndInit();
this.tabControl.ResumeLayout(false);
this.tabProcesses.ResumeLayout(false);
- this.contextMenuStripProcess.ResumeLayout(false);
this.tabServices.ResumeLayout(false);
- this.contextMenuStripService.ResumeLayout(false);
this.tabNetwork.ResumeLayout(false);
- this.contextMenuStripNetwork.ResumeLayout(false);
this.toolStrip.ResumeLayout(false);
this.toolStrip.PerformLayout();
- this.statusStrip1.ResumeLayout(false);
- this.statusStrip1.PerformLayout();
- this.menuStripEx1.ResumeLayout(false);
- this.menuStripEx1.PerformLayout();
- this.contextMenuStripTray.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -1470,6 +1393,19 @@
#endregion
+ private System.Windows.Forms.ContextMenu menuProcess;
+ private System.Windows.Forms.MenuItem terminateMenuItem;
+ private System.Windows.Forms.MenuItem suspendMenuItem;
+ private System.Windows.Forms.MenuItem resumeMenuItem;
+ private System.Windows.Forms.MenuItem menuItem5;
+ private System.Windows.Forms.MenuItem priorityMenuItem;
+ private System.Windows.Forms.MenuItem menuItem7;
+ private System.Windows.Forms.MenuItem realTimeMenuItem;
+ private System.Windows.Forms.MenuItem highMenuItem;
+ private System.Windows.Forms.MenuItem aboveNormalMenuItem;
+ private System.Windows.Forms.MenuItem normalMenuItem;
+ private System.Windows.Forms.MenuItem belowNormalMenuItem;
+ private System.Windows.Forms.MenuItem idleMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem10;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
@@ -1477,157 +1413,142 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem13;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem14;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem15;
+ private wyDay.Controls.VistaMenu vistaMenu;
+ private System.Windows.Forms.MainMenu mainMenu;
+ private System.Windows.Forms.MenuItem hackerMenuItem;
+ private System.Windows.Forms.MenuItem aboutMenuItem;
+ private System.Windows.Forms.MenuItem optionsMenuItem;
+ private System.Windows.Forms.MenuItem helpMenuItem;
+ private System.Windows.Forms.MenuItem exitMenuItem;
+ private System.Windows.Forms.MenuItem windowMenuItem;
private ProcessHacker.ProcessTree treeProcesses;
+ private System.Windows.Forms.MenuItem inspectPEFileMenuItem;
+ private System.Windows.Forms.MenuItem propertiesProcessMenuItem;
+ private System.Windows.Forms.MenuItem searchProcessMenuItem;
+ private System.Windows.Forms.StatusBar statusBar;
+ private System.Windows.Forms.MenuItem logMenuItem;
+ private System.Windows.Forms.StatusBarPanel statusGeneral;
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.TabPage tabProcesses;
private System.Windows.Forms.TabPage tabServices;
private ProcessHacker.Components.ServiceList listServices;
+ private System.Windows.Forms.ContextMenu menuService;
+ private System.Windows.Forms.MenuItem propertiesServiceMenuItem;
+ private System.Windows.Forms.MenuItem startServiceMenuItem;
+ private System.Windows.Forms.MenuItem pauseServiceMenuItem;
+ private System.Windows.Forms.MenuItem stopServiceMenuItem;
+ private System.Windows.Forms.MenuItem deleteServiceMenuItem;
+ private System.Windows.Forms.MenuItem continueServiceMenuItem;
+ private System.Windows.Forms.MenuItem goToProcessServiceMenuItem;
+ private System.Windows.Forms.MenuItem menuItem8;
+ private System.Windows.Forms.MenuItem copyServiceMenuItem;
+ private System.Windows.Forms.MenuItem selectAllServiceMenuItem;
+ private System.Windows.Forms.MenuItem toolsMenuItem;
+ private System.Windows.Forms.ContextMenu menuIcon;
+ private System.Windows.Forms.MenuItem showHideMenuItem;
+ private System.Windows.Forms.MenuItem exitTrayMenuItem;
+ private System.Windows.Forms.MenuItem notificationsMenuItem;
+ private System.Windows.Forms.MenuItem NPMenuItem;
+ private System.Windows.Forms.MenuItem TPMenuItem;
+ private System.Windows.Forms.MenuItem NSMenuItem;
+ private System.Windows.Forms.MenuItem startedSMenuItem;
+ private System.Windows.Forms.MenuItem stoppedSMenuItem;
+ private System.Windows.Forms.MenuItem DSMenuItem;
+ private System.Windows.Forms.MenuItem findHandlesMenuItem;
+ private System.Windows.Forms.MenuItem affinityProcessMenuItem;
+ private System.Windows.Forms.MenuItem runAsServiceMenuItem;
+ private System.Windows.Forms.MenuItem runAsProcessMenuItem;
+ private System.Windows.Forms.MenuItem launchAsUserProcessMenuItem;
+ private System.Windows.Forms.MenuItem launchAsThisUserProcessMenuItem;
+ private System.Windows.Forms.MenuItem sysInfoMenuItem;
+ private System.Windows.Forms.MenuItem copyProcessMenuItem;
+ private System.Windows.Forms.MenuItem selectAllProcessMenuItem;
+ private System.Windows.Forms.MenuItem terminatorProcessMenuItem;
+ private System.Windows.Forms.MenuItem menuItem2;
+ private System.Windows.Forms.StatusBarPanel statusCPU;
+ private System.Windows.Forms.StatusBarPanel statusMemory;
+ private System.Windows.Forms.MenuItem reloadStructsMenuItem;
private System.Windows.Forms.TabPage tabNetwork;
private ProcessHacker.Components.NetworkList listNetwork;
- private System.ToolStripEx toolStrip;
+ private System.Windows.Forms.MenuItem sysInformationIconMenuItem;
+ private System.Windows.Forms.MenuItem hiddenProcessesMenuItem;
+ private System.Windows.Forms.MenuItem viewMenuItem;
+ private System.Windows.Forms.MenuItem updateNowMenuItem;
+ private System.Windows.Forms.MenuItem updateProcessesMenuItem;
+ private System.Windows.Forms.MenuItem updateServicesMenuItem;
+ private System.Windows.Forms.MenuItem processesMenuItem;
+ private System.Windows.Forms.MenuItem restartProcessMenuItem;
+ private System.Windows.Forms.MenuItem setTokenProcessMenuItem;
+ private System.Windows.Forms.MenuItem helpMenu;
+ private System.Windows.Forms.MenuItem menuItem3;
+ private System.Windows.Forms.MenuItem verifyFileSignatureMenuItem;
+ private System.Windows.Forms.MenuItem enableAllNotificationsMenuItem;
+ private System.Windows.Forms.MenuItem disableAllNotificationsMenuItem;
+ private System.Windows.Forms.MenuItem menuItem4;
+ private System.Windows.Forms.MenuItem shutdownTrayMenuItem;
+ private System.Windows.Forms.MenuItem shutdownMenuItem;
+ private System.Windows.Forms.MenuItem runAsAdministratorMenuItem;
+ private System.Windows.Forms.MenuItem showDetailsForAllProcessesMenuItem;
+ private System.Windows.Forms.MenuItem uacSeparatorMenuItem;
+ private System.Windows.Forms.MenuItem runMenuItem;
+ private System.Windows.Forms.MenuItem runAsMenuItem;
+ private System.Windows.Forms.MenuItem freeMemoryMenuItem;
+ private System.Windows.Forms.MenuItem menuItem1;
+ private System.Windows.Forms.MenuItem reanalyzeProcessMenuItem;
+ private System.Windows.Forms.MenuItem reduceWorkingSetProcessMenuItem;
+ private System.Windows.Forms.MenuItem virtualizationProcessMenuItem;
+ private System.Windows.Forms.ToolStrip toolStrip;
private System.Windows.Forms.ToolStripButton refreshToolStripButton;
private System.Windows.Forms.ToolStripButton findHandlesToolStripButton;
private System.Windows.Forms.ToolStripButton sysInfoToolStripButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripDropDownButton shutDownToolStripMenuItem;
private System.Windows.Forms.ToolStripButton optionsToolStripButton;
- private System.Windows.Forms.StatusStrip statusStrip1;
- private System.Windows.Forms.ToolStripStatusLabel statusMemory;
- private System.Windows.Forms.ToolStripStatusLabel statusCPU;
- private System.Windows.Forms.ToolStripStatusLabel statusGeneral;
- private System.MenuStripEx menuStripEx1;
- private System.Windows.Forms.ToolStripMenuItem hackerToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem usersToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem checkForUpdatesMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
- private System.Windows.Forms.ToolStripMenuItem logToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
- private ToolStripSearchBox toolStripTextBox2;
- private System.Windows.Forms.ToolStripMenuItem toolbarMenuItem;
- private System.Windows.Forms.ToolStripMenuItem sysInfoMenuItem;
- private System.Windows.Forms.ToolStripMenuItem trayIconsToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
- private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem updateProcessesMenuItem;
- private System.Windows.Forms.ToolStripMenuItem updateServicesMenuItem;
- private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem runAsToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem runAsAdministratorMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
- private System.Windows.Forms.ToolStripMenuItem shutdownMenuItem;
- private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem showDetailsForAllProcessesMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
- private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
- private System.Windows.Forms.ToolStripMenuItem findHandlesMenuItem;
- private System.Windows.Forms.ToolStripMenuItem inspectPEFileToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem optionsMenuItem;
- private System.Windows.Forms.ToolStripMenuItem createServiceToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem hiddenProcessesToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem verifyFileSignatureToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem cpuHistoryMenuItem;
- private System.Windows.Forms.ToolStripMenuItem cpuUsageMenuItem;
- private System.Windows.Forms.ToolStripMenuItem ioHistoryMenuItem;
- private System.Windows.Forms.ToolStripMenuItem commitHistoryMenuItem;
- private System.Windows.Forms.ToolStripMenuItem physMemHistoryMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStripNetwork;
- private System.Windows.Forms.ToolStripMenuItem goToProcessNetworkMenuItem;
- private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem closeNetworkMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
- private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem selectAllNetworkMenuItem;
- private System.Windows.Forms.ToolStripMenuItem whoisNetworkMenuItem;
- private System.Windows.Forms.ToolStripMenuItem tracertNetworkMenuItem;
- private System.Windows.Forms.ToolStripMenuItem pingNetworkMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStripTray;
- private System.Windows.Forms.ToolStripMenuItem showHideProcessHackerToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem systemInformationToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem networkInfomationMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
- private System.Windows.Forms.ToolStripMenuItem shutdownTrayMenuItem;
- private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
- private System.Windows.Forms.ToolStripMenuItem processesMenuItem;
- private System.Windows.Forms.ToolStripMenuItem notificationsToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem enableAllToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem disableAllToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
- private System.Windows.Forms.ToolStripMenuItem newProcessesToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem terminatedProcessesToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem newServicesToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem startedServicesToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem stoppedServicesToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem deletedServicesToolStripMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStripService;
- private System.Windows.Forms.ToolStripMenuItem goToProcessServiceMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
- private System.Windows.Forms.ToolStripMenuItem startToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem continueToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem pauseToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
- private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem selectAllServiceMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
- private System.Windows.Forms.ToolStripMenuItem propertiesToolStripMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStripProcess;
- private System.Windows.Forms.ToolStripMenuItem terminateToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem terminateProcessTreeToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem suspendToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem resumeToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem restartToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem reduceWorkingSetToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem virtualizationToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
- private System.Windows.Forms.ToolStripMenuItem affinityToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem createDumpFileToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem terminatorToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem miscellaneousToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem priorityToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem runAsToolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem1;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator15;
- private System.Windows.Forms.ToolStripMenuItem searchOnlineToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem reanalyzeToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem copyProcessMenuItem;
- private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
- private System.Windows.Forms.ToolStripMenuItem propertiesToolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem launchAsUserToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem launchAsThisUserToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem bringToFrontToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem minimizeToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem maximizeToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator17;
- private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem realTimeToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem highToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem aboveNormalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem normalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem belowNormalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem idleToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem analyzeWaitChainToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem detachFromDebuggerToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem heapsToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem injectDLLToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem iOPriorityToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem protectionToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem setTokenToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem uploadToVirusTotalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem ioPriority0ThreadMenuItem;
- private System.Windows.Forms.ToolStripMenuItem ioPriority1ThreadMenuItem;
- private System.Windows.Forms.ToolStripMenuItem ioPriority3ThreadMenuItem;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
+ private System.Windows.Forms.MenuItem toolbarMenuItem;
+ private System.Windows.Forms.MenuItem saveMenuItem;
+ private System.Windows.Forms.ContextMenu menuNetwork;
+ private System.Windows.Forms.MenuItem goToProcessNetworkMenuItem;
+ private System.Windows.Forms.MenuItem copyNetworkMenuItem;
+ private System.Windows.Forms.MenuItem menuItem6;
+ private System.Windows.Forms.MenuItem selectAllNetworkMenuItem;
+ private System.Windows.Forms.MenuItem injectDllProcessMenuItem;
+ private System.Windows.Forms.MenuItem terminateProcessTreeMenuItem;
+ private System.Windows.Forms.MenuItem trayIconsMenuItem;
+ private System.Windows.Forms.MenuItem cpuHistoryMenuItem;
+ private System.Windows.Forms.MenuItem cpuUsageMenuItem;
+ private System.Windows.Forms.MenuItem ioHistoryMenuItem;
+ private System.Windows.Forms.MenuItem commitHistoryMenuItem;
+ private System.Windows.Forms.MenuItem physMemHistoryMenuItem;
+ private System.Windows.Forms.MenuItem closeNetworkMenuItem;
+ private System.Windows.Forms.MenuItem protectionProcessMenuItem;
+ private System.Windows.Forms.MenuItem createDumpFileProcessMenuItem;
+ private System.Windows.Forms.MenuItem miscellaneousProcessMenuItem;
+ private System.Windows.Forms.MenuItem detachFromDebuggerProcessMenuItem;
+ private System.Windows.Forms.MenuItem usersMenuItem;
+ private System.Windows.Forms.MenuItem createServiceMenuItem;
+ private System.Windows.Forms.MenuItem heapsProcessMenuItem;
+ private System.Windows.Forms.MenuItem windowProcessMenuItem;
+ private System.Windows.Forms.MenuItem bringToFrontProcessMenuItem;
+ private System.Windows.Forms.MenuItem restoreProcessMenuItem;
+ private System.Windows.Forms.MenuItem minimizeProcessMenuItem;
+ private System.Windows.Forms.MenuItem maximizeProcessMenuItem;
+ private System.Windows.Forms.MenuItem menuItem15;
+ private System.Windows.Forms.MenuItem closeProcessMenuItem;
+ private System.Windows.Forms.MenuItem checkForUpdatesMenuItem;
+ private System.Windows.Forms.MenuItem toolsNetworkMenuItem;
+ private System.Windows.Forms.MenuItem whoisNetworkMenuItem;
+ private System.Windows.Forms.MenuItem tracertNetworkMenuItem;
+ private System.Windows.Forms.MenuItem pingNetworkMenuItem;
+ private System.Windows.Forms.MenuItem VirusTotalMenuItem;
+ private System.Windows.Forms.MenuItem networkInfomationMenuItem;
+ private System.Windows.Forms.MenuItem analyzeWaitChainProcessMenuItem;
+ private System.Windows.Forms.MenuItem donateMenuItem;
+ private System.Windows.Forms.MenuItem ioPriorityThreadMenuItem;
+ private System.Windows.Forms.MenuItem ioPriority0ThreadMenuItem;
+ private System.Windows.Forms.MenuItem ioPriority1ThreadMenuItem;
+ private System.Windows.Forms.MenuItem ioPriority2ThreadMenuItem;
+ private System.Windows.Forms.MenuItem ioPriority3ThreadMenuItem;
+ private System.Windows.Forms.MenuItem openMenuItem;
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/HackerWindow.cs b/1.x/trunk/ProcessHacker/Forms/HackerWindow.cs
index 83593796e..28c3c81b1 100644
--- a/1.x/trunk/ProcessHacker/Forms/HackerWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HackerWindow.cs
@@ -35,7 +35,6 @@ using ProcessHacker.Native.Api;
using ProcessHacker.Native.Debugging;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
-using ProcessHacker.Native.Threading;
using ProcessHacker.UI;
using ProcessHacker.UI.Actions;
using TaskbarLib;
@@ -46,10 +45,10 @@ namespace ProcessHacker
{
public delegate void LogUpdatedEventHandler(KeyValuePair? value);
- private readonly ThumbButtonManager thumbButtonManager;
+ private ThumbButtonManager thumbButtonManager;
//private JumpListManager jumpListManager; //Reserved for future use
- public delegate void AddMenuItemDelegate(string text, EventHandler onClick);
+ private delegate void AddMenuItemDelegate(string text, EventHandler onClick);
// This entire file is a big monolithic mess.
@@ -73,6 +72,11 @@ namespace ProcessHacker
///
public SysInfoWindow SysInfoWindow;
+ ///
+ /// The UAC shield bitmap. Used for the various menu items which
+ /// require UAC elevation.
+ ///
+ Bitmap uacShieldIcon;
///
/// A black icon which all notification icons are set to initially
/// before their first paint.
@@ -86,7 +90,7 @@ namespace ProcessHacker
///
/// The list of notification icons.
///
- readonly List notifyIcons = new List();
+ List notifyIcons = new List();
///
/// The CPU history icon, with a history of CPU usage.
///
@@ -114,7 +118,7 @@ namespace ProcessHacker
/// A dictionary relating services to processes. Each key is a PID and
/// each value is a list of service names hosted in that particular process.
///
- readonly Dictionary> processServices = new Dictionary>();
+ Dictionary> processServices = new Dictionary>();
///
/// The number of selected processes. Not used.
@@ -129,7 +133,7 @@ namespace ProcessHacker
/// The PH log, with events such as process creation/termination and various
/// service events.
///
- readonly List> _log = new List>();
+ List> _log = new List>();
///
/// windowhandle owned by the currently selected process.
@@ -157,9 +161,14 @@ namespace ProcessHacker
// The following two properties were used by the Window menu system.
// Not very useful, but still needed for now.
- public ToolStripMenuItem WindowMenuItem
+ public MenuItem WindowMenuItem
{
- get { return windowToolStripMenuItem; }
+ get { return windowMenuItem; }
+ }
+
+ public wyDay.Controls.VistaMenu VistaMenu
+ {
+ get { return vistaMenu; }
}
// Mostly used by Save.cs.
@@ -259,18 +268,15 @@ namespace ProcessHacker
private void runAsAdministratorMenuItem_Click(object sender, EventArgs e)
{
- using (PromptBox box = new PromptBox
- {
- Text = "Enter the command to start"
- })
- {
- box.TextBox.AutoCompleteSource = AutoCompleteSource.AllSystemSources;
- box.TextBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
+ PromptBox box = new PromptBox();
- if (box.ShowDialog() == DialogResult.OK)
- {
- Program.StartProgramAdmin(box.Value, "", null, ShowWindowType.Show, this.Handle);
- }
+ box.Text = "Enter the command to start";
+ box.TextBox.AutoCompleteSource = AutoCompleteSource.AllSystemSources;
+ box.TextBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
+
+ if (box.ShowDialog() == DialogResult.OK)
+ {
+ Program.StartProgramAdmin(box.Value, "", null, ShowWindowType.Show, this.Handle);
}
}
@@ -282,7 +288,10 @@ namespace ProcessHacker
private void showDetailsForAllProcessesMenuItem_Click(object sender, EventArgs e)
{
- Program.StartProcessHackerAdmin("-v", this.Exit, this.Handle);
+ Program.StartProcessHackerAdmin("-v", () =>
+ {
+ this.Exit();
+ }, this.Handle);
}
private void findHandlesMenuItem_Click(object sender, EventArgs e)
@@ -343,7 +352,7 @@ namespace ProcessHacker
}
else
{
- SysInfoWindow.BeginInvoke(new MethodInvoker(() =>
+ SysInfoWindow.BeginInvoke(new MethodInvoker(delegate
{
SysInfoWindow.Show();
SysInfoWindow.Activate();
@@ -368,21 +377,20 @@ namespace ProcessHacker
private void aboutMenuItem_Click(object sender, EventArgs e)
{
- using (AboutWindow about = new AboutWindow())
- {
- about.ShowDialog();
- }
+ AboutWindow about = new AboutWindow();
+ about.ShowDialog();
}
private void optionsMenuItem_Click(object sender, EventArgs e)
{
- using (OptionsWindow options = new OptionsWindow())
- {
- if (options.ShowDialog() == DialogResult.OK)
- {
- this.LoadOtherSettings();
- }
- }
+ OptionsWindow options = new OptionsWindow();
+
+ DialogResult result = options.ShowDialog();
+
+ if (result == DialogResult.OK)
+ {
+ this.LoadOtherSettings();
+ }
}
private void freeMemoryMenuItem_Click(object sender, EventArgs e)
@@ -410,6 +418,15 @@ namespace ProcessHacker
Settings.Instance.ToolbarVisible = toolStrip.Visible = toolbarMenuItem.Checked;
}
+ private void updateNowMenuItem_Click(object sender, EventArgs e)
+ {
+ if (Program.ProcessProvider.RunCount > 1)
+ Program.ProcessProvider.Boost();
+
+ if (Program.ServiceProvider.RunCount > 1)
+ Program.ServiceProvider.Boost();
+ }
+
private void updateProcessesMenuItem_Click(object sender, EventArgs e)
{
updateProcessesMenuItem.Checked = !updateProcessesMenuItem.Checked;
@@ -437,85 +454,81 @@ namespace ProcessHacker
private void verifyFileSignatureMenuItem_Click(object sender, EventArgs e)
{
- using (OpenFileDialog ofd = new OpenFileDialog
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ ofd.CheckFileExists = true;
+ ofd.CheckPathExists = true;
+ ofd.Filter = "Executable files (*.exe;*.dll;*.sys;*.scr;*.cpl)|*.exe;*.dll;*.sys;*.scr;*.cpl|All files (*.*)|*.*";
+
+ if (ofd.ShowDialog() == DialogResult.OK)
{
- CheckFileExists = true,
- CheckPathExists = true,
- Filter = "Executable files (*.exe;*.dll;*.sys;*.scr;*.cpl)|*.exe;*.dll;*.sys;*.scr;*.cpl|All files (*.*)|*.*"
- })
- {
- if (ofd.ShowDialog() == DialogResult.OK)
+ try
{
- try
- {
- var result = Cryptography.VerifyFile(ofd.FileName);
- string message = string.Empty;
+ var result = Cryptography.VerifyFile(ofd.FileName);
+ string message = "";
- switch (result)
- {
- case VerifyResult.Distrust:
- message = "is not trusted";
- break;
- case VerifyResult.Expired:
- message = "has an expired certificate";
- break;
- case VerifyResult.NoSignature:
- message = "does not have a digital signature";
- break;
- case VerifyResult.Revoked:
- message = "has a revoked certificate";
- break;
- case VerifyResult.SecuritySettings:
- message = "could not be verified due to security settings";
- break;
- case VerifyResult.Trusted:
- message = "is trusted";
- break;
- case VerifyResult.Unknown:
- message = "could not be verified";
- break;
- default:
- message = "could not be verified";
- break;
- }
-
- PhUtils.ShowInformation("The file \"" + ofd.FileName + "\" " + message + ".");
- }
- catch (Exception ex)
+ switch (result)
{
- PhUtils.ShowException("Unable to verify the file", ex);
+ case VerifyResult.Distrust:
+ message = "is not trusted";
+ break;
+ case VerifyResult.Expired:
+ message = "has an expired certificate";
+ break;
+ case VerifyResult.NoSignature:
+ message = "does not have a digital signature";
+ break;
+ case VerifyResult.Revoked:
+ message = "has a revoked certificate";
+ break;
+ case VerifyResult.SecuritySettings:
+ message = "could not be verified due to security settings";
+ break;
+ case VerifyResult.Trusted:
+ message = "is trusted";
+ break;
+ case VerifyResult.Unknown:
+ message = "could not be verified";
+ break;
+ default:
+ message = "could not be verified";
+ break;
}
+
+ PhUtils.ShowInformation("The file \"" + ofd.FileName + "\" " + message + ".");
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to verify the file", ex);
}
}
}
private void openMenuItem_Click(object sender, EventArgs e)
{
- using (OpenFileDialog ofd = new OpenFileDialog
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ ofd.Filter = "Process Hacker Dump Files (*.phi)|*.phi|All Files (*.*)|*.*";
+
+ if (ofd.ShowDialog() == DialogResult.OK)
{
- Filter = "Process Hacker Dump Files (*.phi)|*.phi|All Files (*.*)|*.*"
- })
- {
- if (ofd.ShowDialog() == DialogResult.OK)
+ DumpHackerWindow dhw = null;
+
+ try
{
- DumpHackerWindow dhw = null;
-
- try
- {
- dhw = new DumpHackerWindow(ofd.FileName);
- }
- catch (ProcessHacker.Native.Mfs.MfsInvalidFileSystemException)
- {
- PhUtils.ShowError("Unable to open the dump file: the dump file is invalid.");
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to open the dump file", ex);
- }
-
- if (dhw != null)
- dhw.Show();
+ dhw = new DumpHackerWindow(ofd.FileName);
}
+ catch (ProcessHacker.Native.Mfs.MfsInvalidFileSystemException)
+ {
+ PhUtils.ShowError("Unable to open the dump file: the dump file is invalid.");
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to open the dump file", ex);
+ }
+
+ if (dhw != null)
+ dhw.Show();
}
}
@@ -590,30 +603,21 @@ namespace ProcessHacker
#endregion
- public class ToolStripSearchBox : ToolStripControlHost
- {
- public ToolStripSearchBox()
- : base(new VistaSearchBox())
- {
-
- }
- }
-
#region Network Context Menu
private void menuNetwork_Popup(object sender, EventArgs e)
{
if (listNetwork.SelectedItems.Count == 0)
{
- //contextMenuStripNetwork.DisableAll();
+ menuNetwork.DisableAll();
}
else if (listNetwork.SelectedItems.Count == 1)
{
- //contextMenuStripNetwork.EnableAll();
+ menuNetwork.EnableAll();
}
else
{
- //contextMenuStripNetwork.EnableAll();
+ menuNetwork.EnableAll();
goToProcessNetworkMenuItem.Enabled = false;
}
@@ -799,7 +803,7 @@ namespace ProcessHacker
private void selectAllNetworkMenuItem_Click(object sender, EventArgs e)
{
- this.listNetwork.List.Items.SelectAll();
+ Utils.SelectAll(listNetwork.List.Items);
}
#endregion
@@ -816,10 +820,10 @@ namespace ProcessHacker
List processes = new List();
// Clear the images so we don't get GDI+ handle leaks
- //foreach (MenuItem item in processesMenuItem.MenuItems)
- //vistaMenu.SetImage(item, null);
+ foreach (MenuItem item in processesMenuItem.MenuItems)
+ vistaMenu.SetImage(item, null);
- processesMenuItem.DropDownItems.Clear();
+ processesMenuItem.MenuItems.DisposeAndClear();
// HACK: To be fixed later - we need some sort of locking for the process provider
try
@@ -872,61 +876,62 @@ namespace ProcessHacker
processItem.Text = process.Name + " (" + process.Pid.ToString() + ")";
processItem.Tag = process;
- terminateItem.Click += (sender_, e_) =>
+ terminateItem.Click += new EventHandler((sender_, e_) =>
{
- ProcessItem item = ((MenuItem)sender_).Parent.Tag as ProcessItem;
+ ProcessItem item = (ProcessItem)((MenuItem)sender_).Parent.Tag;
ProcessActions.Terminate(this, new int[] { item.Pid }, new string[] { item.Name }, true);
- };
+ });
terminateItem.Text = "Terminate";
- suspendItem.Click += (sender_, e_) =>
+ suspendItem.Click += new EventHandler((sender_, e_) =>
{
- ProcessItem item = ((MenuItem)sender_).Parent.Tag as ProcessItem;
+ ProcessItem item = (ProcessItem)((MenuItem)sender_).Parent.Tag;
ProcessActions.Suspend(this, new int[] { item.Pid }, new string[] { item.Name }, true);
- };
+ });
suspendItem.Text = "Suspend";
- resumeItem.Click += (sender_, e_) =>
+ resumeItem.Click += new EventHandler((sender_, e_) =>
{
- ProcessItem item = ((MenuItem)sender_).Parent.Tag as ProcessItem;
+ ProcessItem item = (ProcessItem)((MenuItem)sender_).Parent.Tag;
ProcessActions.Resume(this, new int[] { item.Pid }, new string[] { item.Name }, true);
- };
+ });
resumeItem.Text = "Resume";
- //propertiesItem.Click += (sender_, e_) =>
- //{
- // try
- // {
- // ProcessItem item = (ProcessItem)((MenuItem)sender_).Parent.Tag;
+ propertiesItem.Click += new EventHandler((sender_, e_) =>
+ {
+ try
+ {
+ ProcessItem item = (ProcessItem)((MenuItem)sender_).Parent.Tag;
- // Program.GetProcessWindow(Program.ProcessProvider.Dictionary[item.Pid], f =>
- // {
- // f.Show();
- // f.Activate();
- // });
- // }
- // catch (Exception ex)
- // {
- // PhUtils.ShowException("Unable to inspect the process", ex);
- // }
- //};
- //propertiesItem.Text = "Properties";
+ ProcessWindow pForm = Program.GetProcessWindow(Program.ProcessProvider.Dictionary[item.Pid],
+ new Program.PWindowInvokeAction(delegate(ProcessWindow f)
+ {
+ f.Show();
+ f.Activate();
+ }));
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to inspect the process", ex);
+ }
+ });
+ propertiesItem.Text = "Properties";
- //processItem.MenuItems.AddRange(new MenuItem[] { terminateItem, suspendItem, resumeItem, propertiesItem });
- //processesMenuItem.DropDownItems.Add(processItem);
+ processItem.MenuItems.AddRange(new MenuItem[] { terminateItem, suspendItem, resumeItem, propertiesItem });
+ processesMenuItem.MenuItems.Add(processItem);
- // vistaMenu.SetImage(processItem, (treeProcesses.Tree.Model as ProcessTreeModel).Nodes[process.Pid].Icon);
+ vistaMenu.SetImage(processItem, (treeProcesses.Tree.Model as ProcessTreeModel).Nodes[process.Pid].Icon);
}
}
catch
{
- //foreach (MenuItem item in processesMenuItem.MenuItems)
- //vistaMenu.SetImage(item, null);
+ foreach (MenuItem item in processesMenuItem.MenuItems)
+ vistaMenu.SetImage(item, null);
- processesMenuItem.DropDownItems.Clear();
+ processesMenuItem.MenuItems.DisposeAndClear();
}
}
@@ -962,22 +967,22 @@ namespace ProcessHacker
private void enableAllNotificationsMenuItem_Click(object sender, EventArgs e)
{
- newProcessesToolStripMenuItem.Checked = true;
- terminatedProcessesToolStripMenuItem.Checked = true;
- newServicesToolStripMenuItem.Checked = true;
- startedServicesToolStripMenuItem.Checked = true;
- stoppedServicesToolStripMenuItem.Checked = true;
- deletedServicesToolStripMenuItem.Checked = true;
+ NPMenuItem.Checked = true;
+ TPMenuItem.Checked = true;
+ NSMenuItem.Checked = true;
+ startedSMenuItem.Checked = true;
+ stoppedSMenuItem.Checked = true;
+ DSMenuItem.Checked = true;
}
private void disableAllNotificationsMenuItem_Click(object sender, EventArgs e)
{
- newProcessesToolStripMenuItem.Checked = false;
- terminatedProcessesToolStripMenuItem.Checked = false;
- newServicesToolStripMenuItem.Checked = false;
- startedServicesToolStripMenuItem.Checked = false;
- stoppedServicesToolStripMenuItem.Checked = false;
- deletedServicesToolStripMenuItem.Checked = false;
+ NPMenuItem.Checked = false;
+ TPMenuItem.Checked = false;
+ NSMenuItem.Checked = false;
+ startedSMenuItem.Checked = false;
+ stoppedSMenuItem.Checked = false;
+ DSMenuItem.Checked = false;
}
private void exitTrayMenuItem_Click(object sender, EventArgs e)
@@ -991,7 +996,7 @@ namespace ProcessHacker
private void menuProcess_Popup(object sender, EventArgs e)
{
- virtualizationToolStripMenuItem.Checked = false;
+ virtualizationProcessMenuItem.Checked = false;
// Menu item fixup...
if (treeProcesses.SelectedTreeNodes.Count == 0)
@@ -999,72 +1004,72 @@ namespace ProcessHacker
// If nothing is selected, disable everything.
// The Select All menu item will be enabled later if
// we have at least one process in the tree.
- //contextMenuStripProcess.DisableAll();
+ menuProcess.DisableAll();
}
else if (treeProcesses.SelectedTreeNodes.Count == 1)
{
// All actions should work with one process selected.
- //contextMenuStripProcess.EnableAll();
+ menuProcess.EnableAll();
// Singular nouns.
- //priorityMenuItem.Text = "&Priority";
- //terminateToolStripMenuItem.Text = "&Terminate Process";
- //suspendToolStripMenuItem.Text = "&Suspend Process";
- //resumeToolStripMenuItem.Text = "&Resume Process";
+ priorityMenuItem.Text = "&Priority";
+ terminateMenuItem.Text = "&Terminate Process";
+ suspendMenuItem.Text = "&Suspend Process";
+ resumeMenuItem.Text = "&Resume Process";
// Clear the priority menu items.
- realTimeToolStripMenuItem.Checked = false;
- highToolStripMenuItem.Checked = false;
- aboveNormalToolStripMenuItem.Checked = false;
- normalToolStripMenuItem.Checked = false;
- belowNormalToolStripMenuItem.Checked = false;
- idleToolStripMenuItem.Checked = false;
+ realTimeMenuItem.Checked = false;
+ highMenuItem.Checked = false;
+ aboveNormalMenuItem.Checked = false;
+ normalMenuItem.Checked = false;
+ belowNormalMenuItem.Checked = false;
+ idleMenuItem.Checked = false;
// Clear the I/O priority menu items.
- iOPriorityToolStripMenuItem.Enabled = true;
+ ioPriorityThreadMenuItem.Enabled = true;
ioPriority0ThreadMenuItem.Checked = false;
ioPriority1ThreadMenuItem.Checked = false;
- ioPriority3ThreadMenuItem.Checked = false;
+ ioPriority2ThreadMenuItem.Checked = false;
ioPriority3ThreadMenuItem.Checked = false;
try
{
- using (ProcessHandle phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
+ using (var phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
{
try
{
- switch (phandle.PriorityClass)
+ switch (phandle.GetPriorityClass())
{
case ProcessPriorityClass.RealTime:
- realTimeToolStripMenuItem.Checked = true;
+ realTimeMenuItem.Checked = true;
break;
case ProcessPriorityClass.High:
- highToolStripMenuItem.Checked = true;
+ highMenuItem.Checked = true;
break;
case ProcessPriorityClass.AboveNormal:
- aboveNormalToolStripMenuItem.Checked = true;
+ aboveNormalMenuItem.Checked = true;
break;
case ProcessPriorityClass.Normal:
- normalToolStripMenuItem.Checked = true;
+ normalMenuItem.Checked = true;
break;
case ProcessPriorityClass.BelowNormal:
- belowNormalToolStripMenuItem.Checked = true;
+ belowNormalMenuItem.Checked = true;
break;
case ProcessPriorityClass.Idle:
- idleToolStripMenuItem.Checked = true;
+ idleMenuItem.Checked = true;
break;
}
}
catch
{
- realTimeToolStripMenuItem.Enabled = false;
+ priorityMenuItem.Enabled = false;
}
try
{
if (OSVersion.HasIoPriority)
{
- switch (phandle.IoPriority)
+ switch (phandle.GetIoPriority())
{
case 0:
ioPriority0ThreadMenuItem.Checked = true;
@@ -1073,7 +1078,7 @@ namespace ProcessHacker
ioPriority1ThreadMenuItem.Checked = true;
break;
case 2:
- ioPriority3ThreadMenuItem.Checked = true;
+ ioPriority2ThreadMenuItem.Checked = true;
break;
case 3:
ioPriority3ThreadMenuItem.Checked = true;
@@ -1083,37 +1088,44 @@ namespace ProcessHacker
}
catch
{
- iOPriorityToolStripMenuItem.Enabled = false;
+ ioPriorityThreadMenuItem.Enabled = false;
}
}
}
catch
{
- priorityToolStripMenuItem.Enabled = false;
- iOPriorityToolStripMenuItem.Enabled = false;
+ priorityMenuItem.Enabled = false;
+ ioPriorityThreadMenuItem.Enabled = false;
}
// Check if we think the process exists. If we don't, disable all menu items
// to avoid random exceptions occurring when the user clicks on certain things.
if (!Program.ProcessProvider.Dictionary.ContainsKey(processSelectedPid))
{
- //menuProcess.DisableAll();
+ menuProcess.DisableAll();
}
else
{
// Check the virtualization menu item.
try
{
- using (ProcessHandle phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
- using (TokenHandle thandle = phandle.GetToken(TokenAccess.Query))
+ using (var phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
{
- if (virtualizationToolStripMenuItem.Enabled = thandle.IsVirtualizationAllowed)
- virtualizationToolStripMenuItem.Checked = thandle.IsVirtualizationEnabled;
+ try
+ {
+ using (var thandle = phandle.GetToken(TokenAccess.Query))
+ {
+ if (virtualizationProcessMenuItem.Enabled = thandle.IsVirtualizationAllowed())
+ virtualizationProcessMenuItem.Checked = thandle.IsVirtualizationEnabled();
+ }
+ }
+ catch
+ { }
}
}
catch
{
- virtualizationToolStripMenuItem.Enabled = false;
+ virtualizationProcessMenuItem.Enabled = false;
}
// Enable/disable DLL injection based on the process' session ID. This only applies
@@ -1124,9 +1136,9 @@ namespace ProcessHacker
OSVersion.IsBelowOrEqual(WindowsVersion.XP) &&
Program.ProcessProvider.Dictionary[processSelectedPid].SessionId != Program.CurrentSessionId
)
- injectDLLToolStripMenuItem.Enabled = false;
+ injectDllProcessMenuItem.Enabled = false;
else
- injectDLLToolStripMenuItem.Enabled = true;
+ injectDllProcessMenuItem.Enabled = true;
}
catch (Exception ex)
{
@@ -1138,10 +1150,11 @@ namespace ProcessHacker
// is sorting the list (!).
try
{
- if (treeProcesses.SelectedTreeNodes[0].IsLeaf && string.IsNullOrEmpty((treeProcesses.Tree.Model as ProcessTreeModel).GetSortColumn()))
- terminateProcessTreeToolStripMenuItem.Visible = false;
+ if (treeProcesses.SelectedTreeNodes[0].IsLeaf &&
+ (treeProcesses.Tree.Model as ProcessTreeModel).GetSortColumn() == "")
+ terminateProcessTreeMenuItem.Visible = false;
else
- terminateProcessTreeToolStripMenuItem.Visible = true;
+ terminateProcessTreeMenuItem.Visible = true;
}
catch (Exception ex)
{
@@ -1150,47 +1163,48 @@ namespace ProcessHacker
// Find the process' window (if any).
windowHandle = WindowHandle.Zero;
- WindowHandle.Enumerate(handle =>
- {
- // GetWindowLong
- // Shell_TrayWnd
- if (handle.IsWindow && handle.IsVisible && handle.IsParent)
+ WindowHandle.Enumerate(
+ (handle) =>
{
- int pid;
- Win32.GetWindowThreadProcessId(handle, out pid);
-
- if (pid == processSelectedPid)
+ // GetWindowLong
+ // Shell_TrayWnd
+ if (handle.IsWindow() && handle.IsVisible() && handle.IsParent())
{
- windowHandle = handle;
- return false;
+ int pid;
+ Win32.GetWindowThreadProcessId(handle, out pid);
+
+ if (pid == processSelectedPid)
+ {
+ windowHandle = handle;
+ return false;
+ }
}
- }
- return true;
- });
+ return true;
+ });
// Enable the Window submenu if we found window owned
// by the process. Otherwise, disable the submenu.
if (windowHandle.IsInvalid)
{
- windowToolStripMenuItem1.Enabled = false;
+ windowProcessMenuItem.Enabled = false;
}
else
{
- windowToolStripMenuItem1.Enabled = true;
- //windowToolStripMenuItem1.EnableAll();
+ windowProcessMenuItem.Enabled = true;
+ windowProcessMenuItem.EnableAll();
- switch (windowHandle.Placement.ShowState)
+ switch (windowHandle.GetPlacement().ShowState)
{
case ShowWindowType.ShowMinimized:
- minimizeToolStripMenuItem.Enabled = false;
+ minimizeProcessMenuItem.Enabled = false;
break;
case ShowWindowType.ShowMaximized:
- maximizeToolStripMenuItem.Enabled = false;
+ maximizeProcessMenuItem.Enabled = false;
break;
case ShowWindowType.ShowNormal:
- restoreToolStripMenuItem.Enabled = false;
+ restoreProcessMenuItem.Enabled = false;
break;
}
}
@@ -1199,37 +1213,37 @@ namespace ProcessHacker
else
{
// Assume most process actions will not work with more than one process.
- //menuProcess.DisableAll();
+ menuProcess.DisableAll();
// Use plural nouns.
- terminateProcessTreeToolStripMenuItem.Text = "&Terminate Processes";
- suspendToolStripMenuItem.Text = "&Suspend Processes";
- resumeToolStripMenuItem.Text = "&Resume Processes";
+ terminateMenuItem.Text = "&Terminate Processes";
+ suspendMenuItem.Text = "&Suspend Processes";
+ resumeMenuItem.Text = "&Resume Processes";
// Enable a specific set of actions.
- terminateToolStripMenuItem.Enabled = true;
- suspendToolStripMenuItem.Enabled = true;
- resumeToolStripMenuItem.Enabled = true;
- reduceWorkingSetToolStripMenuItem.Enabled = true;
+ terminateMenuItem.Enabled = true;
+ suspendMenuItem.Enabled = true;
+ resumeMenuItem.Enabled = true;
+ reduceWorkingSetProcessMenuItem.Enabled = true;
copyProcessMenuItem.Enabled = true;
}
// Special case for invalid PIDs.
if (processSelectedPid <= 0 && treeProcesses.SelectedNodes.Count == 1)
{
- //priorityMenuItem.Text = "&Priority";
- //menuProcess.DisableAll();
- propertiesToolStripMenuItem1.Enabled = true;
+ priorityMenuItem.Text = "&Priority";
+ menuProcess.DisableAll();
+ propertiesProcessMenuItem.Enabled = true;
}
// Enable/disable the Select All menu item.
if (treeProcesses.Model.Nodes.Count == 0)
{
- selectAllToolStripMenuItem.Enabled = false;
+ selectAllProcessMenuItem.Enabled = false;
}
else
{
- selectAllToolStripMenuItem.Enabled = true;
+ selectAllProcessMenuItem.Enabled = true;
}
}
@@ -1418,10 +1432,12 @@ namespace ProcessHacker
try
{
- using (ProcessHandle phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
- using (TokenHandle thandle = phandle.GetToken(TokenAccess.GenericWrite))
+ using (var phandle = new ProcessHandle(processSelectedPid, Program.MinProcessQueryRights))
{
- thandle.IsVirtualizationEnabled = !virtualizationToolStripMenuItem.Checked;
+ using (var thandle = phandle.GetToken(TokenAccess.GenericWrite))
+ {
+ thandle.SetVirtualizationEnabled(!virtualizationProcessMenuItem.Checked);
+ }
}
}
catch (Exception ex)
@@ -1441,16 +1457,15 @@ namespace ProcessHacker
private void affinityProcessMenuItem_Click(object sender, EventArgs e)
{
- using (ProcessAffinity affForm = new ProcessAffinity(processSelectedPid))
+ ProcessAffinity affForm = new ProcessAffinity(processSelectedPid);
+
+ try
{
- try
- {
- affForm.ShowDialog();
- }
- catch (Exception ex)
- {
- Logging.Log(ex);
- }
+ affForm.ShowDialog();
+ }
+ catch (Exception ex)
+ {
+ Logging.Log(ex);
}
}
@@ -1500,7 +1515,6 @@ namespace ProcessHacker
td.MainInstruction = "Creating the dump file...";
td.ShowMarqueeProgressBar = true;
td.EnableHyperlinks = true;
- td.PositionRelativeToWindow = true;
td.CallbackTimer = true;
td.Callback = (taskDialog, args, userData) =>
{
@@ -1571,14 +1585,11 @@ namespace ProcessHacker
private void terminatorProcessMenuItem_Click(object sender, EventArgs e)
{
- using (TerminatorWindow w = new TerminatorWindow(processSelectedPid)
- {
- Text = "Terminator - " + Program.ProcessProvider.Dictionary[this.processSelectedPid].Name +
- " (PID " + this.processSelectedPid.ToString() + ")"
- })
- {
- w.ShowDialog();
- }
+ TerminatorWindow w = new TerminatorWindow(processSelectedPid);
+
+ w.Text = "Terminator - " + Program.ProcessProvider.Dictionary[processSelectedPid].Name +
+ " (PID " + processSelectedPid.ToString() + ")";
+ w.ShowDialog();
}
#region Run As
@@ -1589,10 +1600,8 @@ namespace ProcessHacker
{
Settings.Instance.RunAsCommand = Program.ProcessProvider.Dictionary[processSelectedPid].FileName;
- using (RunWindow run = new RunWindow())
- {
- run.ShowDialog();
- }
+ RunWindow run = new RunWindow();
+ run.ShowDialog();
}
catch (Exception ex)
{
@@ -1604,11 +1613,9 @@ namespace ProcessHacker
{
try
{
- using (RunWindow run = new RunWindow())
- {
- run.UsePID(processSelectedPid);
- run.ShowDialog();
- }
+ RunWindow run = new RunWindow();
+ run.UsePID(processSelectedPid);
+ run.ShowDialog();
}
catch (Exception ex)
{
@@ -1674,25 +1681,24 @@ namespace ProcessHacker
private void injectDllProcessMenuItem_Click(object sender, EventArgs e)
{
- using (OpenFileDialog ofd = new OpenFileDialog
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ ofd.Filter = "DLL Files (*.dll)|*.dll|All Files (*.*)|*.*";
+
+ if (ofd.ShowDialog() == DialogResult.OK)
{
- Filter = "DLL Files (*.dll)|*.dll|All Files (*.*)|*.*"
- })
- {
- if (ofd.ShowDialog() == DialogResult.OK)
+ try
{
- try
+ using (var phandle = new ProcessHandle(processSelectedPid,
+ ProcessAccess.CreateThread | ProcessAccess.VmOperation | ProcessAccess.VmWrite))
{
- using (ProcessHandle phandle = new ProcessHandle(processSelectedPid, ProcessAccess.CreateThread | ProcessAccess.VmOperation | ProcessAccess.VmWrite))
- {
- phandle.InjectDll(ofd.FileName, 5000);
- }
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to inject the DLL", ex);
+ phandle.InjectDll(ofd.FileName, 5000);
}
}
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to inject the DLL", ex);
+ }
}
}
@@ -1728,21 +1734,19 @@ namespace ProcessHacker
private void setTokenProcessMenuItem_Click(object sender, EventArgs e)
{
- using (ProcessPickerWindow picker = new ProcessPickerWindow
+ ProcessPickerWindow picker = new ProcessPickerWindow();
+
+ picker.Label = "Select the source of the token:";
+
+ if (picker.ShowDialog() == DialogResult.OK)
{
- Label = "Select the source of the token:"
- })
- {
- if (picker.ShowDialog() == DialogResult.OK)
+ try
{
- try
- {
- //KProcessHacker2.Instance.KphOpenProcessToken(picker, processSelectedPid);
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to set the process token", ex);
- }
+ KProcessHacker.Instance.SetProcessToken(picker.SelectedPid, processSelectedPid);
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to set the process token", ex);
}
}
}
@@ -1787,9 +1791,9 @@ namespace ProcessHacker
private void bringToFrontProcessMenuItem_Click(object sender, EventArgs e)
{
- if (!windowHandle.IsInvalid && windowHandle.IsWindow)
+ if (!windowHandle.IsInvalid && windowHandle.IsWindow())
{
- WindowPlacement placement = windowHandle.Placement;
+ WindowPlacement placement = windowHandle.GetPlacement();
if (placement.ShowState == ShowWindowType.ShowMinimized)
windowHandle.Show(ShowWindowType.Restore);
@@ -1800,7 +1804,7 @@ namespace ProcessHacker
private void restoreProcessMenuItem_Click(object sender, EventArgs e)
{
- if (!windowHandle.IsInvalid && windowHandle.IsWindow)
+ if (!windowHandle.IsInvalid && windowHandle.IsWindow())
{
windowHandle.Show(ShowWindowType.Restore);
}
@@ -1808,7 +1812,7 @@ namespace ProcessHacker
private void minimizeProcessMenuItem_Click(object sender, EventArgs e)
{
- if (!windowHandle.IsInvalid && windowHandle.IsWindow)
+ if (!windowHandle.IsInvalid && windowHandle.IsWindow())
{
windowHandle.Show(ShowWindowType.ShowMinimized);
}
@@ -1816,7 +1820,7 @@ namespace ProcessHacker
private void maximizeProcessMenuItem_Click(object sender, EventArgs e)
{
- if (!windowHandle.IsInvalid && windowHandle.IsWindow)
+ if (!windowHandle.IsInvalid && windowHandle.IsWindow())
{
windowHandle.Show(ShowWindowType.ShowMaximized);
}
@@ -1824,7 +1828,7 @@ namespace ProcessHacker
private void closeProcessMenuItem_Click(object sender, EventArgs e)
{
- if (!windowHandle.IsInvalid && windowHandle.IsWindow)
+ if (!windowHandle.IsInvalid && windowHandle.IsWindow())
{
windowHandle.PostMessage(WindowMessage.Close, 0, 0);
//windowHandle.Close();
@@ -1838,7 +1842,8 @@ namespace ProcessHacker
if (treeProcesses.SelectedNodes.Count != 1)
return;
- Program.TryStart(Settings.Instance.SearchEngine.Replace("%s", treeProcesses.SelectedNodes[0].Name));
+ Program.TryStart(Settings.Instance.SearchEngine.Replace("%s",
+ treeProcesses.SelectedNodes[0].Name));
}
private void reanalyzeProcessMenuItem_Click(object sender, EventArgs e)
@@ -1884,9 +1889,7 @@ namespace ProcessHacker
vt.Show();
}
else
- {
PhUtils.ShowError("An Internet session could not be established. Please verify connectivity.");
- }
}
private void analyzeWaitChainProcessMenuItem_Click(object sender, EventArgs e)
@@ -1912,41 +1915,41 @@ namespace ProcessHacker
Program.ProcessProvider.DictionaryRemoved += processP_DictionaryRemoved;
Program.ProcessProvider.Updated -= processP_Updated;
- ProcessHandle.Current.PriorityClass = ProcessPriorityClass.High;
+ try { ProcessHandle.Current.SetPriorityClass(ProcessPriorityClass.High); }
+ catch { }
_enableNetworkProviderSync.Increment();
_refreshHighlightingSync.Increment();
if (Program.ProcessProvider.RunCount >= 1)
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- this.treeProcesses.Tree.EndCompleteUpdate();
- this.treeProcesses.Tree.EndUpdate();
+ treeProcesses.Tree.EndCompleteUpdate();
+ treeProcesses.Tree.EndUpdate();
if (Settings.Instance.ScrollDownProcessTree)
{
// HACK
try
{
- foreach (var process in this.treeProcesses.Model.Roots)
+ foreach (var process in treeProcesses.Model.Roots)
{
if (
string.Equals(process.Name, "explorer.exe",
- StringComparison.OrdinalIgnoreCase) &&
+ StringComparison.OrdinalIgnoreCase) &&
process.ProcessItem.Username == Program.CurrentUsername)
{
- this.treeProcesses.FindTreeNode(process).EnsureVisible2();
+ treeProcesses.FindTreeNode(process).EnsureVisible2();
break;
}
}
}
catch
- {
- }
+ { }
}
- this.treeProcesses.Invalidate();
+ treeProcesses.Invalidate();
Program.ProcessProvider.Boost();
this.Cursor = Cursors.Default;
}));
@@ -1954,7 +1957,10 @@ namespace ProcessHacker
private void processP_InfoUpdater()
{
- this.BeginInvoke(new MethodInvoker(this.UpdateStatusInfo));
+ this.BeginInvoke(new MethodInvoker(delegate
+ {
+ UpdateStatusInfo();
+ }));
}
private void processP_FileProcessingReceived(int stage, int pid)
@@ -1970,7 +1976,7 @@ namespace ProcessHacker
public void processP_DictionaryAdded(ProcessItem item)
{
ProcessItem parent = null;
- string parentText = string.Empty;
+ string parentText = "";
if (item.HasParent && Program.ProcessProvider.Dictionary.ContainsKey(item.ParentPid))
{
@@ -1988,11 +1994,11 @@ namespace ProcessHacker
this.QueueMessage("New Process: " + item.Name + " (PID " + item.Pid.ToString() + ")" + parentText);
- if (newProcessesToolStripMenuItem.Checked)
+ if (NPMenuItem.Checked)
this.GetFirstIcon().ShowBalloonTip(2000, "New Process",
"The process " + item.Name + " (" + item.Pid.ToString() +
- ") was started" + ((parentText != string.Empty) ? " by " +
- parent.Name + " (" + parent.Pid.ToString() + ")" : string.Empty) + ".", ToolTipIcon.Info);
+ ") was started" + ((parentText != "") ? " by " +
+ parent.Name + " (" + parent.Pid.ToString() + ")" : "") + ".", ToolTipIcon.Info);
}
public void processP_DictionaryRemoved(ProcessItem item)
@@ -2002,14 +2008,17 @@ namespace ProcessHacker
if (processServices.ContainsKey(item.Pid))
processServices.Remove(item.Pid);
- if (terminatedProcessesToolStripMenuItem.Checked)
+ if (TPMenuItem.Checked)
this.GetFirstIcon().ShowBalloonTip(2000, "Terminated Process",
"The process " + item.Name + " (" + item.Pid.ToString() + ") was terminated.", ToolTipIcon.Info);
}
private void serviceP_Updated()
{
- listServices.BeginInvoke(new MethodInvoker(() => this.listServices.List.EndUpdate()));
+ listServices.BeginInvoke(new MethodInvoker(delegate
+ {
+ listServices.List.EndUpdate();
+ }));
HighlightingContext.StateHighlighting = true;
@@ -2025,11 +2034,11 @@ namespace ProcessHacker
{
this.QueueMessage("New Service: " + item.Status.ServiceName +
" (" + item.Status.ServiceStatusProcess.ServiceType.ToString() + ")" +
- (!string.IsNullOrEmpty(item.Status.DisplayName) ?
+ ((item.Status.DisplayName != "") ?
" (" + item.Status.DisplayName + ")" :
- string.Empty));
+ ""));
- if (newServicesToolStripMenuItem.Checked)
+ if (NSMenuItem.Checked)
this.GetFirstIcon().ShowBalloonTip(2000, "New Service",
"The service " + item.Status.ServiceName + " (" + item.Status.DisplayName + ") has been created.",
ToolTipIcon.Info);
@@ -2057,11 +2066,11 @@ namespace ProcessHacker
{
this.QueueMessage("Service Started: " + newItem.Status.ServiceName +
" (" + newItem.Status.ServiceStatusProcess.ServiceType.ToString() + ")" +
- ((newItem.Status.DisplayName != string.Empty) ?
+ ((newItem.Status.DisplayName != "") ?
" (" + newItem.Status.DisplayName + ")" :
- string.Empty));
+ ""));
- if (startedServicesToolStripMenuItem.Checked)
+ if (startedSMenuItem.Checked)
this.GetFirstIcon().ShowBalloonTip(2000, "Service Started",
"The service " + newItem.Status.ServiceName + " (" + newItem.Status.DisplayName + ") has been started.",
ToolTipIcon.Info);
@@ -2071,20 +2080,20 @@ namespace ProcessHacker
newState == ServiceState.Paused)
this.QueueMessage("Service Paused: " + newItem.Status.ServiceName +
" (" + newItem.Status.ServiceStatusProcess.ServiceType.ToString() + ")" +
- ((newItem.Status.DisplayName != string.Empty) ?
+ ((newItem.Status.DisplayName != "") ?
" (" + newItem.Status.DisplayName + ")" :
- string.Empty));
+ ""));
if (oldState == ServiceState.Running &&
newState == ServiceState.Stopped)
{
this.QueueMessage("Service Stopped: " + newItem.Status.ServiceName +
" (" + newItem.Status.ServiceStatusProcess.ServiceType.ToString() + ")" +
- ((newItem.Status.DisplayName != string.Empty) ?
+ ((newItem.Status.DisplayName != "") ?
" (" + newItem.Status.DisplayName + ")" :
- string.Empty));
+ ""));
- if (stoppedServicesToolStripMenuItem.Checked)
+ if (stoppedSMenuItem.Checked)
this.GetFirstIcon().ShowBalloonTip(2000, "Service Stopped",
"The service " + newItem.Status.ServiceName + " (" + newItem.Status.DisplayName + ") has been stopped.",
ToolTipIcon.Info);
@@ -2123,11 +2132,11 @@ namespace ProcessHacker
{
this.QueueMessage("Deleted Service: " + item.Status.ServiceName +
" (" + item.Status.ServiceStatusProcess.ServiceType.ToString() + ")" +
- ((item.Status.DisplayName != string.Empty) ?
+ ((item.Status.DisplayName != "") ?
" (" + item.Status.DisplayName + ")" :
- string.Empty));
+ ""));
- if (deletedServicesToolStripMenuItem.Checked)
+ if (DSMenuItem.Checked)
this.GetFirstIcon().ShowBalloonTip(2000, "Service Deleted",
"The service " + item.Status.ServiceName + " (" + item.Status.DisplayName + ") has been deleted.",
ToolTipIcon.Info);
@@ -2150,6 +2159,102 @@ namespace ProcessHacker
#region Service Context Menu
+ private void menuService_Popup(object sender, EventArgs e)
+ {
+ if (listServices.SelectedItems.Count == 0)
+ {
+ menuService.DisableAll();
+ goToProcessServiceMenuItem.Visible = true;
+ startServiceMenuItem.Visible = true;
+ continueServiceMenuItem.Visible = true;
+ pauseServiceMenuItem.Visible = true;
+ stopServiceMenuItem.Visible = true;
+
+ selectAllServiceMenuItem.Enabled = true;
+ }
+ else if (listServices.SelectedItems.Count == 1)
+ {
+ menuService.EnableAll();
+
+ goToProcessServiceMenuItem.Visible = true;
+ startServiceMenuItem.Visible = true;
+ continueServiceMenuItem.Visible = true;
+ pauseServiceMenuItem.Visible = true;
+ stopServiceMenuItem.Visible = true;
+
+ try
+ {
+ ServiceItem item = Program.ServiceProvider.Dictionary[listServices.SelectedItems[0].Name];
+
+ if (item.Status.ServiceStatusProcess.ProcessID != 0)
+ {
+ goToProcessServiceMenuItem.Enabled = true;
+ }
+ else
+ {
+ goToProcessServiceMenuItem.Enabled = false;
+ }
+
+ if ((item.Status.ServiceStatusProcess.ControlsAccepted & ServiceAccept.PauseContinue)
+ == 0)
+ {
+ continueServiceMenuItem.Visible = false;
+ pauseServiceMenuItem.Visible = false;
+ }
+ else
+ {
+ continueServiceMenuItem.Visible = true;
+ pauseServiceMenuItem.Visible = true;
+ }
+
+ if (item.Status.ServiceStatusProcess.CurrentState == ServiceState.Paused)
+ {
+ startServiceMenuItem.Enabled = false;
+ pauseServiceMenuItem.Enabled = false;
+ }
+ else if (item.Status.ServiceStatusProcess.CurrentState == ServiceState.Running)
+ {
+ startServiceMenuItem.Enabled = false;
+ continueServiceMenuItem.Enabled = false;
+ }
+ else if (item.Status.ServiceStatusProcess.CurrentState == ServiceState.Stopped)
+ {
+ pauseServiceMenuItem.Enabled = false;
+ stopServiceMenuItem.Enabled = false;
+ }
+
+ if ((item.Status.ServiceStatusProcess.ControlsAccepted & ServiceAccept.Stop) == 0 &&
+ item.Status.ServiceStatusProcess.CurrentState == ServiceState.Running)
+ {
+ stopServiceMenuItem.Enabled = false;
+ }
+ }
+ catch
+ {
+ menuService.DisableAll();
+ copyServiceMenuItem.Enabled = true;
+ propertiesServiceMenuItem.Enabled = true;
+ }
+ }
+ else
+ {
+ menuService.DisableAll();
+
+ goToProcessServiceMenuItem.Visible = false;
+ startServiceMenuItem.Visible = false;
+ continueServiceMenuItem.Visible = false;
+ pauseServiceMenuItem.Visible = false;
+ stopServiceMenuItem.Visible = false;
+
+ copyServiceMenuItem.Enabled = true;
+ propertiesServiceMenuItem.Enabled = true;
+ selectAllServiceMenuItem.Enabled = true;
+ }
+
+ if (listServices.List.Items.Count == 0)
+ selectAllServiceMenuItem.Enabled = false;
+ }
+
private void goToProcessServiceMenuItem_Click(object sender, EventArgs e)
{
this.SelectProcess(
@@ -2209,7 +2314,7 @@ namespace ProcessHacker
private void selectAllServiceMenuItem_Click(object sender, EventArgs e)
{
- this.listServices.Items.SelectAll();
+ Utils.SelectAll(listServices.Items);
}
#endregion
@@ -2328,26 +2433,22 @@ namespace ProcessHacker
private void findHandlesToolStripButton_Click(object sender, EventArgs e)
{
- findHandlesMenuItem.PerformClick();
+ findHandlesMenuItem_Click(sender, e);
}
private void refreshToolStripButton_Click(object sender, EventArgs e)
{
- if (Program.ProcessProvider.RunCount > 1)
- Program.ProcessProvider.Boost();
-
- if (Program.ServiceProvider.RunCount > 1)
- Program.ServiceProvider.Boost();
+ updateNowMenuItem_Click(sender, e);
}
private void sysInfoToolStripButton_Click(object sender, EventArgs e)
{
- sysInfoMenuItem.PerformClick();
+ sysInfoMenuItem_Click(sender, e);
}
private void optionsToolStripButton_Click(object sender, EventArgs e)
{
- optionsMenuItem.PerformClick();
+ optionsMenuItem_Click(sender, e);
}
#endregion
@@ -2422,18 +2523,18 @@ namespace ProcessHacker
private void CreateShutdownMenuItems()
{
- AddMenuItemDelegate addMenuItem = (text, onClick) =>
+ AddMenuItemDelegate addMenuItem = (string text, EventHandler onClick) =>
{
- shutdownMenuItem.DropDownItems.Add(text, null, onClick);
- shutdownTrayMenuItem.DropDownItems.Add(text, null, onClick);
+ shutdownMenuItem.MenuItems.Add(new MenuItem(text, onClick));
+ shutdownTrayMenuItem.MenuItems.Add(new MenuItem(text, onClick));
shutDownToolStripMenuItem.DropDownItems.Add(text, null, onClick);
};
- addMenuItem("Lock", (sender, e) => Win32.LockWorkStation());
- addMenuItem("Logoff", (sender, e) => Win32.ExitWindowsEx(ExitWindowsFlags.Logoff, 0));
+ addMenuItem("Lock", (sender, e) => { Win32.LockWorkStation(); });
+ addMenuItem("Logoff", (sender, e) => { Win32.ExitWindowsEx(ExitWindowsFlags.Logoff, 0); });
addMenuItem("-", null);
- addMenuItem("Sleep", (sender, e) => Win32.SetSuspendState(false, false, false));
- addMenuItem("Hibernate", (sender, e) => Win32.SetSuspendState(true, false, false));
+ addMenuItem("Sleep", (sender, e) => { Win32.SetSuspendState(false, false, false); });
+ addMenuItem("Hibernate", (sender, e) => { Win32.SetSuspendState(true, false, false); });
addMenuItem("-", null);
addMenuItem("Restart", (sender, e) =>
{
@@ -2471,7 +2572,7 @@ namespace ProcessHacker
const int height = 50;
const int margin = 4;
Bitmap shieldImage;
- Button button = new Button
+ Button button = new Button()
{
Text = " ",
Size = new Size(width, height),
@@ -2614,10 +2715,25 @@ namespace ProcessHacker
if (Loader.LoadDll(Settings.Instance.DbgHelpPath) == IntPtr.Zero)
Loader.LoadDll("dbghelp.dll");
- // Load symsrv.dll from the same directory as dbghelp.dll.
- // TODO: improve logic.
- if (Loader.LoadDll(System.IO.Path.GetDirectoryName(Settings.Instance.DbgHelpPath) + "\\symsrv.dll") == IntPtr.Zero)
- Loader.LoadDll("symsrv.dll");
+ // Find the location of the dbghelp.dll we loaded and load symsrv.dll.
+ try
+ {
+ ProcessHandle.Current.EnumModules((module) =>
+ {
+ if (module.FileName.ToLowerInvariant().EndsWith("dbghelp.dll"))
+ {
+ // Load symsrv.dll from the same directory as dbghelp.dll.
+
+ Loader.LoadDll(System.IO.Path.GetDirectoryName(module.FileName) + "\\symsrv.dll");
+
+ return false;
+ }
+
+ return true;
+ });
+ }
+ catch
+ { }
// Set the first run setting here.
Settings.Instance.FirstRun = false;
@@ -2657,12 +2773,12 @@ namespace ProcessHacker
Settings.Instance.ServiceListViewColumns = ColumnSettings.SaveSettings(listServices.List);
Settings.Instance.NetworkListViewColumns = ColumnSettings.SaveSettings(listNetwork.List);
- Settings.Instance.NewProcesses = newProcessesToolStripMenuItem.Checked;
- Settings.Instance.TerminatedProcesses = terminatedProcessesToolStripMenuItem.Checked;
- Settings.Instance.NewServices = newServicesToolStripMenuItem.Checked;
- Settings.Instance.StartedServices = startedServicesToolStripMenuItem.Checked;
- Settings.Instance.StoppedServices = stoppedServicesToolStripMenuItem.Checked;
- Settings.Instance.DeletedServices = deletedServicesToolStripMenuItem.Checked;
+ Settings.Instance.NewProcesses = NPMenuItem.Checked;
+ Settings.Instance.TerminatedProcesses = TPMenuItem.Checked;
+ Settings.Instance.NewServices = NSMenuItem.Checked;
+ Settings.Instance.StartedServices = startedSMenuItem.Checked;
+ Settings.Instance.StoppedServices = stoppedSMenuItem.Checked;
+ Settings.Instance.DeletedServices = DSMenuItem.Checked;
try
{
@@ -2705,18 +2821,20 @@ namespace ProcessHacker
{
checkForUpdatesMenuItem.Enabled = false;
- NativeThreadPool.QueueWorkItem(o =>
- {
- Updater.Update(this, interactive);
- this.BeginInvoke(new MethodInvoker(() => this.checkForUpdatesMenuItem.Enabled = true));
- }, null);
+ Thread t = new Thread(new ThreadStart(() =>
+ {
+ Updater.Update(this, interactive);
+ this.Invoke(new MethodInvoker(() => checkForUpdatesMenuItem.Enabled = true));
+ }), Utils.SixteenthStackSize);
+ t.IsBackground = true;
+ t.Start();
}
private void UpdateSessions()
{
- TerminalServerHandle currentServer = TerminalServerHandle.GetCurrent();
+ var currentServer = TerminalServerHandle.GetCurrent();
- usersToolStripMenuItem.DropDownItems.Clear();
+ usersMenuItem.MenuItems.Clear();
foreach (var session in currentServer.GetSessions())
{
@@ -2729,82 +2847,88 @@ namespace ProcessHacker
continue;
}
- AddMenuItemDelegate addMenuItem = (text, onClick) =>
+ MenuItem userMenuItem = new MenuItem();
+
+ userMenuItem.Text = session.SessionId + ": " + displayName;
+
+ MenuItem currentMenuItem;
+
+ currentMenuItem = new MenuItem() { Text = "Disconnect", Tag = session.SessionId };
+ currentMenuItem.Click += (sender, e) =>
+ {
+ int sessionId = (int)((MenuItem)sender).Tag;
+
+ SessionActions.Disconnect(this, sessionId, false);
+ };
+ userMenuItem.MenuItems.Add(currentMenuItem);
+ currentMenuItem = new MenuItem() { Text = "Logoff", Tag = session.SessionId };
+ currentMenuItem.Click += (sender, e) =>
{
- usersToolStripMenuItem.DropDownItems.Add(text, null, onClick);
- shutdownTrayMenuItem.DropDownItems.Add(text, null, onClick);
- shutDownToolStripMenuItem.DropDownItems.Add(text, null, onClick);
+ int sessionId = (int)((MenuItem)sender).Tag;
+
+ SessionActions.Logoff(this, sessionId, true);
};
-
- addMenuItem("Disconnect", (sender, e) =>
+ userMenuItem.MenuItems.Add(currentMenuItem);
+ currentMenuItem = new MenuItem() { Text = "Send Message...", Tag = session.SessionId };
+ currentMenuItem.Click += (sender, e) =>
{
int sessionId = (int)((MenuItem)sender).Tag;
- SessionActions.Disconnect(this, session.SessionId, false);
- });
-
- //MenuItem userMenuItem = new MenuItem();
- //userMenuItem.Text = session.SessionId + ": " + displayName;
- addMenuItem("Logoff", (sender, e) =>
- {
- int sessionId = (int)((MenuItem)sender).Tag;
-
- SessionActions.Logoff(this, session.SessionId, true);
- });
-
- addMenuItem("Send Message...", (sender, e) =>
- {
try
{
- MessageBoxWindow mbw = new MessageBoxWindow
- {
- MessageBoxTitle = "Message from " + Program.CurrentUsername
- };
+ var mbw = new MessageBoxWindow();
+ mbw.MessageBoxTitle = "Message from " + Program.CurrentUsername;
mbw.OkButtonClicked += () =>
- {
- try
{
- TerminalServerHandle.GetCurrent().GetSession(session.SessionId).SendMessage(
- mbw.MessageBoxTitle,
- mbw.MessageBoxText,
- MessageBoxButtons.OK,
- mbw.MessageBoxIcon,
- 0,
- 0,
- mbw.MessageBoxTimeout,
- false
- );
-
- return true;
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to send the message", ex);
- return false;
- }
- };
+ try
+ {
+ TerminalServerHandle.GetCurrent().GetSession(sessionId).SendMessage(
+ mbw.MessageBoxTitle,
+ mbw.MessageBoxText,
+ MessageBoxButtons.OK,
+ mbw.MessageBoxIcon,
+ 0,
+ 0,
+ mbw.MessageBoxTimeout,
+ false
+ );
+ return true;
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to send the message", ex);
+ return false;
+ }
+ };
mbw.ShowDialog();
}
catch (Exception ex)
{
PhUtils.ShowException("Unable to show the message window", ex);
}
- });
-
- addMenuItem("Properties...", (sender, e) =>
+ };
+ userMenuItem.MenuItems.Add(currentMenuItem);
+ currentMenuItem = new MenuItem() { Text = "Properties...", Tag = session.SessionId };
+ currentMenuItem.Click += (sender, e) =>
{
+ int sessionId = (int)((MenuItem)sender).Tag;
+
try
{
- using (var sessionWindow = new SessionInformationWindow(TerminalServerHandle.GetCurrent().GetSession(session.SessionId)))
- sessionWindow.ShowDialog();
+ var sessionInformationWindow =
+ new SessionInformationWindow(TerminalServerHandle.GetCurrent().GetSession(sessionId));
+
+ sessionInformationWindow.ShowDialog();
}
catch (Exception ex)
{
PhUtils.ShowException("Unable to show session properties", ex);
}
- });
+ };
+ userMenuItem.MenuItems.Add(currentMenuItem);
+ usersMenuItem.MenuItems.Add(userMenuItem);
session.Dispose();
}
}
@@ -2830,8 +2954,8 @@ namespace ProcessHacker
{
try
{
- using (ProcessHandle phandle = new ProcessHandle(processSelectedPid, ProcessAccess.SetInformation))
- phandle.PriorityClass = priority;
+ using (var phandle = new ProcessHandle(processSelectedPid, ProcessAccess.SetInformation))
+ phandle.SetPriorityClass(priority);
}
catch (Exception ex)
{
@@ -2843,8 +2967,8 @@ namespace ProcessHacker
{
try
{
- using (ProcessHandle phandle = new ProcessHandle(processSelectedPid, ProcessAccess.SetInformation))
- phandle.IoPriority = ioPriority;
+ using (var phandle = new ProcessHandle(processSelectedPid, ProcessAccess.SetInformation))
+ phandle.SetIoPriority(ioPriority);
}
catch (Exception ex)
{
@@ -2942,6 +3066,11 @@ namespace ProcessHacker
}
}
break;
+
+ case (int)WindowMessage.Paint:
+ this.Painting();
+ break;
+
case (int)WindowMessage.Activate:
case (int)WindowMessage.KillFocus:
{
@@ -2974,7 +3103,7 @@ namespace ProcessHacker
case (int)WindowMessage.SettingChange:
{
// Refresh icon sizes.
- this.ExecuteOnIcons(icon => icon.Size = UsageIcon.GetSmallIconSize());
+ this.ExecuteOnIcons((icon) => icon.Size = UsageIcon.GetSmallIconSize());
// Refresh the tree view visual style.
treeProcesses.Tree.RefreshVisualStyles();
}
@@ -2991,27 +3120,29 @@ namespace ProcessHacker
public void Exit(bool saveSettings)
{
- Program.ProcessProvider.Enabled = false;
- Program.ProcessProvider.Dispose();
+ //processP.Dispose();
+ //serviceP.Dispose();
+ //networkP.Dispose();
- Program.ServiceProvider.Enabled = false;
- Program.ServiceProvider.Dispose();
-
- Program.NetworkProvider.Enabled = false;
- Program.NetworkProvider.Dispose();
-
- this.ExecuteOnIcons(icon => icon.Visible = false);
- this.ExecuteOnIcons(icon => icon.Dispose());
+ this.ExecuteOnIcons((icon) => icon.Visible = false);
+ this.ExecuteOnIcons((icon) => icon.Dispose());
// Only save settings if requested and no other instance of
// PH is running.
if (saveSettings && !Program.CheckPreviousInstance())
SaveSettings();
- if (KProcessHacker2.Instance != null)
- KProcessHacker2.Instance.Dispose();
+ this.Visible = false;
- Win32.NtTerminateProcess(ProcessHandle.Current, NtStatus.Success);
+ if (KProcessHacker.Instance != null)
+ KProcessHacker.Instance.Close();
+
+ try
+ {
+ Win32.ExitProcess(0);
+ }
+ catch
+ { }
}
private void HackerWindow_FormClosing(object sender, FormClosingEventArgs e)
@@ -3023,7 +3154,7 @@ namespace ProcessHacker
)
{
e.Cancel = true;
- this.showHideProcessHackerToolStripMenuItem.PerformClick();
+ showHideMenuItem_Click(sender, null);
return;
}
@@ -3037,26 +3168,26 @@ namespace ProcessHacker
public void LoadFixOSSpecific()
{
- //if (KProcessHacker.Instance == null)
- //hiddenProcessesMenuItem.Visible = false;
+ if (KProcessHacker.Instance == null)
+ hiddenProcessesMenuItem.Visible = false;
- //if (KProcessHacker.Instance == null || !OSVersion.HasSetAccessToken)
- setTokenToolStripMenuItem.Visible = false;
+ if (KProcessHacker.Instance == null || !OSVersion.HasSetAccessToken)
+ setTokenProcessMenuItem.Visible = false;
- //if (KProcessHacker.Instance == null || !Settings.Instance.EnableExperimentalFeatures)
- protectionToolStripMenuItem.Visible = false;
+ if (KProcessHacker.Instance == null || !Settings.Instance.EnableExperimentalFeatures)
+ protectionProcessMenuItem.Visible = false;
if (!OSVersion.HasUac)
- virtualizationToolStripMenuItem.Visible = false;
+ virtualizationProcessMenuItem.Visible = false;
if (OSVersion.IsBelow(WindowsVersion.Vista))
- analyzeWaitChainToolStripMenuItem.Visible = false;
+ analyzeWaitChainProcessMenuItem.Visible = false;
if (OSVersion.IsBelow(WindowsVersion.XP))
tabControl.TabPages.Remove(tabNetwork);
if (!OSVersion.HasIoPriority)
- iOPriorityToolStripMenuItem.Visible = false;
+ ioPriorityThreadMenuItem.Visible = false;
}
private void LoadFixNProcessHacker()
@@ -3105,8 +3236,9 @@ namespace ProcessHacker
{
if (Program.ElevationType == TokenElevationType.Limited)
{
- this.showDetailsForAllProcessesMenuItem.Image = this.GetUacShieldIcon();
- //vistaMenu.SetImage(showDetailsForAllProcessesMenuItem, uacShieldIcon);
+ uacShieldIcon = this.GetUacShieldIcon();
+
+ vistaMenu.SetImage(showDetailsForAllProcessesMenuItem, uacShieldIcon);
//vistaMenu.SetImage(startServiceMenuItem, uacShieldIcon);
//vistaMenu.SetImage(continueServiceMenuItem, uacShieldIcon);
//vistaMenu.SetImage(pauseServiceMenuItem, uacShieldIcon);
@@ -3143,39 +3275,42 @@ namespace ProcessHacker
foreach (var icon in notifyIcons)
icon.Icon = (Icon)blackIcon.Clone();
- this.ExecuteOnIcons(icon => icon.ContextMenu = contextMenuStripTray);
- this.ExecuteOnIcons(icon => icon.MouseDoubleClick += notifyIcon_MouseDoubleClick);
-
- this.cpuHistoryMenuItem.Checked = Settings.Instance.CpuHistoryIconVisible;
- this.cpuUsageMenuItem.Checked = Settings.Instance.CpuUsageIconVisible;
- this.ioHistoryMenuItem.Checked = Settings.Instance.IoHistoryIconVisible;
- this.commitHistoryMenuItem.Checked = Settings.Instance.CommitHistoryIconVisible;
- this.physMemHistoryMenuItem.Checked = Settings.Instance.PhysMemHistoryIconVisible;
+ this.ExecuteOnIcons((icon) => icon.ContextMenu = menuIcon);
+ this.ExecuteOnIcons((icon) => icon.MouseDoubleClick += notifyIcon_MouseDoubleClick);
+ cpuHistoryMenuItem.Checked = Settings.Instance.CpuHistoryIconVisible;
+ cpuUsageMenuItem.Checked = Settings.Instance.CpuUsageIconVisible;
+ ioHistoryMenuItem.Checked = Settings.Instance.IoHistoryIconVisible;
+ commitHistoryMenuItem.Checked = Settings.Instance.CommitHistoryIconVisible;
+ physMemHistoryMenuItem.Checked = Settings.Instance.PhysMemHistoryIconVisible;
this.ApplyIconVisibilities();
- this.newProcessesToolStripMenuItem.Checked = Settings.Instance.NewProcesses;
- this.terminatedProcessesToolStripMenuItem.Checked = Settings.Instance.TerminatedProcesses;
- this.newServicesToolStripMenuItem.Checked = Settings.Instance.NewServices;
- this.startedServicesToolStripMenuItem.Checked = Settings.Instance.StartedServices;
- this.stoppedServicesToolStripMenuItem.Checked = Settings.Instance.StoppedServices;
- this.deletedServicesToolStripMenuItem.Checked = Settings.Instance.DeletedServices;
+ NPMenuItem.Checked = Settings.Instance.NewProcesses;
+ TPMenuItem.Checked = Settings.Instance.TerminatedProcesses;
+ NSMenuItem.Checked = Settings.Instance.NewServices;
+ startedSMenuItem.Checked = Settings.Instance.StartedServices;
+ stoppedSMenuItem.Checked = Settings.Instance.StoppedServices;
+ DSMenuItem.Checked = Settings.Instance.DeletedServices;
- this.newProcessesToolStripMenuItem.Click += this.CheckedMenuItem_Click;
- this.terminatedProcessesToolStripMenuItem.Click += this.CheckedMenuItem_Click;
- this.newServicesToolStripMenuItem.Click += this.CheckedMenuItem_Click;
- this.startedServicesToolStripMenuItem.Click += this.CheckedMenuItem_Click;
- this.stoppedServicesToolStripMenuItem.Click += this.CheckedMenuItem_Click;
- this.deletedServicesToolStripMenuItem.Click += this.CheckedMenuItem_Click;
+ NPMenuItem.Click += new EventHandler(CheckedMenuItem_Click);
+ TPMenuItem.Click += new EventHandler(CheckedMenuItem_Click);
+ NSMenuItem.Click += new EventHandler(CheckedMenuItem_Click);
+ startedSMenuItem.Click += new EventHandler(CheckedMenuItem_Click);
+ stoppedSMenuItem.Click += new EventHandler(CheckedMenuItem_Click);
+ DSMenuItem.Click += new EventHandler(CheckedMenuItem_Click);
}
private void LoadControls()
{
networkInfomationMenuItem.Visible = false; // not ready
- analyzeWaitChainToolStripMenuItem.Visible = false; // not ready
+ analyzeWaitChainProcessMenuItem.Visible = false; // not ready
- //GenericViewMenu.AddMenuItems(copyProcessMenuItem.MenuItems, treeProcesses.Tree);
- //GenericViewMenu.AddMenuItems(copyToolStripMenuItem1.MenuItems, listServices.List, null);
- //GenericViewMenu.AddMenuItems(copyNetworkMenuItem.MenuItems, listNetwork.List, null);
+ GenericViewMenu.AddMenuItems(copyProcessMenuItem.MenuItems, treeProcesses.Tree);
+ GenericViewMenu.AddMenuItems(copyServiceMenuItem.MenuItems, listServices.List, null);
+ GenericViewMenu.AddMenuItems(copyNetworkMenuItem.MenuItems, listNetwork.List, null);
+
+ treeProcesses.ContextMenu = menuProcess;
+ listServices.ContextMenu = menuService;
+ listNetwork.ContextMenu = menuNetwork;
treeProcesses.Provider = Program.ProcessProvider;
treeProcesses.Tree.BeginUpdate();
@@ -3205,33 +3340,30 @@ namespace ProcessHacker
}
treeProcesses.Tree.MouseDown += (sender, e) =>
- {
- if (e.Button == MouseButtons.Right && e.Location.Y < treeProcesses.Tree.ColumnHeaderHeight)
{
- ContextMenu menu = new ContextMenu();
-
- menu.MenuItems.Add(new MenuItem("Choose Columns...", (sender_, e_) =>
+ if (e.Button == MouseButtons.Right && e.Location.Y < treeProcesses.Tree.ColumnHeaderHeight)
{
- using (var c = new ChooseColumnsWindow(treeProcesses.Tree))
- {
- c.ShowDialog();
- }
+ ContextMenu menu = new ContextMenu();
- copyProcessMenuItem.DropDownItems.Clear();
- //GenericViewMenu.AddMenuItems(copyProcessMenuItem.MenuItems, treeProcesses.Tree);
- treeProcesses.Tree.InvalidateNodeControlCache();
- treeProcesses.Tree.Invalidate();
- }));
+ menu.MenuItems.Add(new MenuItem("Choose Columns...", (sender_, e_) =>
+ {
+ (new ChooseColumnsWindow(treeProcesses.Tree)
+ { }).ShowDialog();
- menu.Show(treeProcesses.Tree, e.Location);
- }
- };
+ copyProcessMenuItem.MenuItems.DisposeAndClear();
+ GenericViewMenu.AddMenuItems(copyProcessMenuItem.MenuItems, treeProcesses.Tree);
+ treeProcesses.Tree.InvalidateNodeControlCache();
+ treeProcesses.Tree.Invalidate();
+ }));
- treeProcesses.Tree.ColumnClicked += (sender, e) => this.DeselectAll(this.treeProcesses.Tree);
+ menu.Show(treeProcesses.Tree, e.Location);
+ }
+ };
+ treeProcesses.Tree.ColumnClicked += (sender, e) => { DeselectAll(treeProcesses.Tree); };
treeProcesses.Tree.ColumnReordered += (sender, e) =>
{
- copyProcessMenuItem.DropDownItems.Clear();
- // GenericViewMenu.AddMenuItems(copyProcessMenuItem.MenuItems, treeProcesses.Tree);
+ copyProcessMenuItem.MenuItems.DisposeAndClear();
+ GenericViewMenu.AddMenuItems(copyProcessMenuItem.MenuItems, treeProcesses.Tree);
};
tabControlBig_SelectedIndexChanged(null, null);
@@ -3239,17 +3371,17 @@ namespace ProcessHacker
private void LoadAddShortcuts()
{
- treeProcesses.Tree.KeyDown += (sender, e) =>
- {
- if (e.Control && e.KeyCode == Keys.A)
+ treeProcesses.Tree.KeyDown +=
+ (sender, e) =>
{
- treeProcesses.TreeNodes.SelectAll();
- treeProcesses.Tree.Invalidate();
- }
-
- if (e.Control && e.KeyCode == Keys.C) GenericViewMenu.TreeViewAdvCopy(treeProcesses.Tree, -1);
- };
+ if (e.Control && e.KeyCode == Keys.A)
+ {
+ treeProcesses.TreeNodes.SelectAll();
+ treeProcesses.Tree.Invalidate();
+ }
+ if (e.Control && e.KeyCode == Keys.C) GenericViewMenu.TreeViewAdvCopy(treeProcesses.Tree, -1);
+ };
listServices.List.AddShortcuts();
listNetwork.List.AddShortcuts();
}
@@ -3261,31 +3393,31 @@ namespace ProcessHacker
private void LoadStructs()
{
- WorkQueue.GlobalQueueWorkItemTag(new MethodInvoker(() =>
- {
- try
+ WorkQueue.GlobalQueueWorkItemTag(new Action(() =>
{
- if (System.IO.File.Exists(Application.StartupPath + "\\structs.txt"))
+ try
{
- Structs.StructParser parser = new ProcessHacker.Structs.StructParser(Program.Structs);
+ if (System.IO.File.Exists(Application.StartupPath + "\\structs.txt"))
+ {
+ Structs.StructParser parser = new ProcessHacker.Structs.StructParser(Program.Structs);
- parser.Parse(Application.StartupPath + "\\structs.txt");
+ parser.Parse(Application.StartupPath + "\\structs.txt");
+ }
}
- }
- catch (Exception ex)
- {
- QueueMessage("Error loading structure definitions: " + ex.Message);
- }
- }), "load-structs");
+ catch (Exception ex)
+ {
+ QueueMessage("Error loading structure definitions: " + ex.Message);
+ }
+ }), "load-structs");
}
private void LoadOther()
{
try
{
- using (TokenHandle thandle = ProcessHandle.Current.GetToken(TokenAccess.Query))
- using (Sid sid = thandle.User)
- this.Text += " [" + sid.GetFullName(true) + "]" + (KProcessHacker2.Instance != null ? "+" : string.Empty);
+ using (var thandle = ProcessHandle.Current.GetToken(TokenAccess.Query))
+ using (var sid = thandle.GetUser())
+ this.Text += " [" + sid.GetFullName(true) + (KProcessHacker.Instance != null ? "+" : "") + "]";
}
catch
{ }
@@ -3303,6 +3435,10 @@ namespace ProcessHacker
{
InitializeComponent();
+ // Force the handle to be created
+ { var handle = this.Handle; }
+ Program.HackerWindowHandle = this.Handle;
+
if (OSVersion.HasExtendedTaskbar)
{
// We need to call this here or we don't receive the TaskbarButtonCreated message
@@ -3311,7 +3447,7 @@ namespace ProcessHacker
Windows7Taskbar.ProcessAppId = "ProcessHacker";
thumbButtonManager = new ThumbButtonManager(this);
- thumbButtonManager.TaskbarButtonCreated += this.thumbButtonManager_TaskbarButtonCreated;
+ thumbButtonManager.TaskbarButtonCreated += new EventHandler(thumbButtonManager_TaskbarButtonCreated);
}
this.AddEscapeToClose();
@@ -3323,8 +3459,11 @@ namespace ProcessHacker
Program.NetworkProvider.Enabled = true;
Program.NetworkProvider.Boost();
}, 2);
-
- _refreshHighlightingSync = new ActionSync(() => this.BeginInvoke(new MethodInvoker(this.treeProcesses.RefreshItems), null), 2);
+ _refreshHighlightingSync = new ActionSync(
+ () =>
+ {
+ this.BeginInvoke(new Action(treeProcesses.RefreshItems), null);
+ }, 2);
Logging.Logged += this.QueueMessage;
this.LoadWindowSettings();
@@ -3332,7 +3471,8 @@ namespace ProcessHacker
this.LoadControls();
this.LoadNotificationIcons();
- if ((!Settings.Instance.StartHidden && !Program.StartHidden) || Program.StartVisible)
+ if ((!Settings.Instance.StartHidden && !Program.StartHidden) ||
+ Program.StartVisible)
{
this.Visible = true;
}
@@ -3343,145 +3483,110 @@ namespace ProcessHacker
this.LoadOther();
this.LoadStructs();
+ vistaMenu.DelaySetImageCalls = false;
+ vistaMenu.PerformPendingSetImageCalls();
+
Program.ServiceProvider.Enabled = true;
Program.ServiceProvider.Boost();
- ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRestart();
- //ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRecovery();
-
- this.CreateShutdownMenuItems();
- this.LoadFixOSSpecific();
- this.LoadUac();
- this.LoadAddShortcuts();
- this.LoadFixNProcessHacker();
-
- toolStrip.Items.Add(new ToolStripSeparator());
- var targetButton = new TargetWindowButton();
- targetButton.TargetWindowFound += (pid, tid) => this.SelectProcess(pid);
- toolStrip.Items.Add(targetButton);
-
- var targetThreadButton = new TargetWindowButton();
- targetThreadButton.TargetWindowFound += (pid, tid) => Program.GetProcessWindow(Program.ProcessProvider.Dictionary[pid], f =>
- {
- Program.FocusWindow(f);
- f.SelectThread(tid);
- });
- targetThreadButton.Image = Properties.Resources.application_go;
- targetThreadButton.Text = "Find window and select thread";
- targetThreadButton.ToolTipText = "Find window and select thread";
- toolStrip.Items.Add(targetThreadButton);
-
- try { TerminalServerHandle.RegisterNotificationsCurrent(this, true); }
- catch (Exception ex) { Logging.Log(ex); }
- try { this.UpdateSessions(); }
- catch (Exception ex) { Logging.Log(ex); }
-
- try { Win32.SetProcessShutdownParameters(0x100, 0); }
- catch { }
-
- if (Settings.Instance.AppUpdateAutomatic)
- this.UpdateProgram(false);
-
- ToolStripManager.Renderer = new AeroRenderer(ToolbarTheme.Blue);
+ _dontCalculate = false;
}
private void HackerWindow_Load(object sender, EventArgs e)
{
- Program.UpdateWindowMenu(windowToolStripMenuItem, this);
+ Program.UpdateWindowMenu(windowMenuItem, this);
this.ApplyFont(Settings.Instance.Font);
this.BeginInvoke(new MethodInvoker(this.LoadApplyCommandLineArgs));
}
+ private void HackerWindow_SizeChanged(object sender, EventArgs e)
+ {
+ tabControl.Invalidate(false);
+ }
+
private void HackerWindow_VisibleChanged(object sender, EventArgs e)
{
treeProcesses.Draw = this.Visible;
}
- private void contextMenuStripService_Opening(object sender, System.ComponentModel.CancelEventArgs e)
+ // ==== Performance hacks section ====
+ private bool _dontCalculate = true;
+ private int _layoutCount = 0;
+
+ protected override void OnLayout(LayoutEventArgs levent)
{
- switch (this.listServices.SelectedItems.Count)
+ _layoutCount++;
+
+ if (_layoutCount < 3)
+ return;
+
+ base.OnLayout(levent);
+ }
+
+ protected override void OnResize(EventArgs e)
+ {
+ if (_dontCalculate)
+ return;
+
+ //
+ // Size grip bug fix as per
+ // http://jelle.druyts.net/2003/10/20/StatusBarResizeBug.aspx
+ //
+ if (statusBar != null)
{
- case 0:
- this.goToProcessServiceMenuItem.Visible = true;
- this.startToolStripMenuItem.Visible = true;
- this.continueToolStripMenuItem.Visible = true;
- this.pauseToolStripMenuItem.Visible = true;
- this.stopToolStripMenuItem.Visible = true;
- this.selectAllServiceMenuItem.Enabled = true;
- break;
- case 1:
- this.goToProcessServiceMenuItem.Visible = true;
- this.startToolStripMenuItem.Visible = true;
- this.continueToolStripMenuItem.Visible = true;
- this.pauseToolStripMenuItem.Visible = true;
- this.stopToolStripMenuItem.Visible = true;
- try
- {
- ServiceItem item = Program.ServiceProvider.Dictionary[this.listServices.SelectedItems[0].Name];
-
- if (item.Status.ServiceStatusProcess.ProcessID != 0)
- {
- this.goToProcessServiceMenuItem.Enabled = true;
- }
- else
- {
- this.goToProcessServiceMenuItem.Enabled = false;
- }
-
- if ((item.Status.ServiceStatusProcess.ControlsAccepted & ServiceAccept.PauseContinue) == 0)
- {
- this.continueToolStripMenuItem.Visible = false;
- this.pauseToolStripMenuItem.Visible = false;
- }
- else
- {
- this.continueToolStripMenuItem.Visible = true;
- this.pauseToolStripMenuItem.Visible = true;
- }
-
- switch (item.Status.ServiceStatusProcess.CurrentState)
- {
- case ServiceState.Paused:
- this.startToolStripMenuItem.Enabled = false;
- this.pauseToolStripMenuItem.Enabled = false;
- break;
- case ServiceState.Running:
- this.startToolStripMenuItem.Enabled = false;
- this.continueToolStripMenuItem.Enabled = false;
- break;
- case ServiceState.Stopped:
- this.pauseToolStripMenuItem.Enabled = false;
- this.stopToolStripMenuItem.Enabled = false;
- break;
- }
-
- if ((item.Status.ServiceStatusProcess.ControlsAccepted & ServiceAccept.Stop) == 0 &&
- item.Status.ServiceStatusProcess.CurrentState == ServiceState.Running)
- {
- this.stopToolStripMenuItem.Enabled = false;
- }
- }
- catch
- {
- //contextMenuStripService.DisableAll();
- this.copyToolStripMenuItem1.Enabled = true;
- this.propertiesToolStripMenuItem.Enabled = true;
- }
- break;
- default:
- this.goToProcessServiceMenuItem.Visible = false;
- this.startToolStripMenuItem.Visible = false;
- this.continueToolStripMenuItem.Visible = false;
- this.pauseToolStripMenuItem.Visible = false;
- this.stopToolStripMenuItem.Visible = false;
- this.copyToolStripMenuItem1.Enabled = true;
- this.propertiesToolStripMenuItem.Enabled = true;
- this.selectAllServiceMenuItem.Enabled = true;
- break;
+ statusBar.SizingGrip = (WindowState == FormWindowState.Normal);
}
- if (listServices.List.Items.Count == 0)
- selectAllServiceMenuItem.Enabled = false;
+ base.OnResize(e);
+ }
+
+ private bool isFirstPaint = true;
+
+ private void Painting()
+ {
+ if (isFirstPaint)
+ {
+ isFirstPaint = false;
+
+ ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRestart();
+ //ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRecovery();
+
+ this.CreateShutdownMenuItems();
+ this.LoadFixOSSpecific();
+ this.LoadUac();
+ this.LoadAddShortcuts();
+ this.LoadFixNProcessHacker();
+
+ toolStrip.Items.Add(new ToolStripSeparator());
+ var targetButton = new TargetWindowButton();
+ targetButton.TargetWindowFound += (pid, tid) => this.SelectProcess(pid);
+ toolStrip.Items.Add(targetButton);
+
+ var targetThreadButton = new TargetWindowButton();
+ targetThreadButton.TargetWindowFound += (pid, tid) =>
+ {
+ Program.GetProcessWindow(Program.ProcessProvider.Dictionary[pid], (f) =>
+ {
+ Program.FocusWindow(f);
+ f.SelectThread(tid);
+ });
+ };
+ targetThreadButton.Image = Properties.Resources.application_go;
+ targetThreadButton.Text = "Find window and select thread";
+ targetThreadButton.ToolTipText = "Find window and select thread";
+ toolStrip.Items.Add(targetThreadButton);
+
+ try { TerminalServerHandle.RegisterNotificationsCurrent(this, true); }
+ catch (Exception ex) { Logging.Log(ex); }
+ try { this.UpdateSessions(); }
+ catch (Exception ex) { Logging.Log(ex); }
+
+ try { Win32.SetProcessShutdownParameters(0x100, 0); }
+ catch { }
+
+ if (Settings.Instance.AppUpdateAutomatic)
+ this.UpdateProgram(false);
+ }
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/HackerWindow.resx b/1.x/trunk/ProcessHacker/Forms/HackerWindow.resx
index 127dec02d..9f272f97e 100644
--- a/1.x/trunk/ProcessHacker/Forms/HackerWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/HackerWindow.resx
@@ -112,36 +112,24 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 357, 17
-
-
- 742, 17
-
-
- 547, 17
-
-
- 143, 17
-
-
- 241, 17
-
-
+
17, 17
-
- 929, 17
+
+ 141, 17
-
- 69
+
+ 113
-
+
+ 586, 17
+
+
AAABAA0AMDAQAAEABABoBgAA1gAAACAgEAABAAQA6AIAAD4HAAAYGBAAAQAEAOgBAAAmCgAAEBAQAAEA
@@ -1771,4 +1759,16 @@
QeAArEH//6xB
+
+ 249, 17
+
+
+ 359, 17
+
+
+ 480, 17
+
+
+ 684, 17
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs
index 29627348a..476c399f1 100644
--- a/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class HandleFilterWindow
{
@@ -30,21 +28,24 @@ namespace ProcessHacker
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HandleFilterWindow));
this.label1 = new System.Windows.Forms.Label();
this.textFilter = new System.Windows.Forms.TextBox();
this.buttonFind = new System.Windows.Forms.Button();
- this.listHandles = new ProcessHacker.Components.ExtendedListView();
- this.columnProcess = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnHandle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listHandles = new System.Windows.Forms.ListView();
+ this.columnProcess = new System.Windows.Forms.ColumnHeader();
+ this.columnType = new System.Windows.Forms.ColumnHeader();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnHandle = new System.Windows.Forms.ColumnHeader();
this.menuHandle = new System.Windows.Forms.ContextMenu();
this.closeMenuItem = new System.Windows.Forms.MenuItem();
this.processPropertiesMenuItem = new System.Windows.Forms.MenuItem();
this.propertiesMenuItem = new System.Windows.Forms.MenuItem();
this.copyMenuItem = new System.Windows.Forms.MenuItem();
this.progress = new System.Windows.Forms.ProgressBar();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// label1
@@ -52,21 +53,21 @@ namespace ProcessHacker
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 17);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(36, 13);
+ this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Filter:";
//
// textFilter
//
- this.textFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFilter.Location = new System.Drawing.Point(50, 14);
this.textFilter.Name = "textFilter";
- this.textFilter.Size = new System.Drawing.Size(395, 22);
+ this.textFilter.Size = new System.Drawing.Size(395, 20);
this.textFilter.TabIndex = 1;
this.textFilter.TextChanged += new System.EventHandler(this.textFilter_TextChanged);
- this.textFilter.Enter += new System.EventHandler(this.textFilter_Enter);
this.textFilter.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textFilter_KeyPress);
+ this.textFilter.Enter += new System.EventHandler(this.textFilter_Enter);
//
// buttonFind
//
@@ -84,15 +85,14 @@ namespace ProcessHacker
// listHandles
//
this.listHandles.AllowColumnReorder = true;
- this.listHandles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listHandles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listHandles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnProcess,
this.columnType,
this.columnName,
this.columnHandle});
- this.listHandles.DoubleClickChecks = true;
this.listHandles.FullRowSelect = true;
this.listHandles.HideSelection = false;
this.listHandles.Location = new System.Drawing.Point(12, 41);
@@ -136,6 +136,7 @@ namespace ProcessHacker
//
// closeMenuItem
//
+ this.vistaMenu.SetImage(this.closeMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.closeMenuItem.Index = 0;
this.closeMenuItem.Text = "Close";
this.closeMenuItem.Click += new System.EventHandler(this.closeMenuItem_Click);
@@ -154,25 +155,30 @@ namespace ProcessHacker
//
// copyMenuItem
//
+ this.vistaMenu.SetImage(this.copyMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyMenuItem.Index = 3;
this.copyMenuItem.Text = "&Copy";
//
// progress
//
- this.progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.progress.Location = new System.Drawing.Point(50, 11);
this.progress.Name = "progress";
this.progress.Size = new System.Drawing.Size(395, 23);
this.progress.TabIndex = 4;
this.progress.Visible = false;
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// HandleFilterWindow
//
this.AcceptButton = this.buttonFind;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(538, 427);
this.Controls.Add(this.progress);
this.Controls.Add(this.listHandles);
@@ -183,9 +189,10 @@ namespace ProcessHacker
this.Name = "HandleFilterWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Find Handles or DLLs";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HandleFilterWindow_FormClosing);
this.Load += new System.EventHandler(this.HandleFilterWindow_Load);
this.VisibleChanged += new System.EventHandler(this.HandleFilterWindow_VisibleChanged);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HandleFilterWindow_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -196,13 +203,14 @@ namespace ProcessHacker
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textFilter;
private System.Windows.Forms.Button buttonFind;
- private ExtendedListView listHandles;
+ private System.Windows.Forms.ListView listHandles;
private System.Windows.Forms.ColumnHeader columnProcess;
private System.Windows.Forms.ColumnHeader columnType;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnHandle;
private System.Windows.Forms.ContextMenu menuHandle;
private System.Windows.Forms.MenuItem closeMenuItem;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.MenuItem copyMenuItem;
private System.Windows.Forms.ProgressBar progress;
private System.Windows.Forms.MenuItem propertiesMenuItem;
diff --git a/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.cs b/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
index b2be8bf99..7f108d7a7 100644
--- a/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
@@ -44,10 +44,11 @@ namespace ProcessHacker
public HandleFilterWindow()
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
+ listHandles.SetDoubleBuffered(true);
+ listHandles.SetTheme("explorer");
GenericViewMenu.AddMenuItems(copyMenuItem.MenuItems, listHandles, null);
listHandles.ContextMenu = menuHandle;
@@ -94,6 +95,7 @@ namespace ProcessHacker
{
if (this.Visible)
{
+ this.SetPhParent();
textFilter.SelectAll();
}
}
@@ -102,7 +104,7 @@ namespace ProcessHacker
{
if (listHandles.SelectedItems.Count == 0)
{
- // menuHandle.DisableAll();
+ menuHandle.DisableAll();
}
else if (listHandles.SelectedItems.Count == 1)
{
@@ -322,7 +324,7 @@ namespace ProcessHacker
private void textFilter_TextChanged(object sender, EventArgs e)
{
- if (textFilter.Text == string.Empty)
+ if (textFilter.Text == "")
buttonFind.Enabled = false;
else
buttonFind.Enabled = true;
diff --git a/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.resx b/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.resx
index e2f9da947..f917f4d06 100644
--- a/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/HandleFilterWindow.resx
@@ -112,15 +112,18 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
-
+
+ 138, 17
+
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.Designer.cs
index 565980585..1272243fe 100644
--- a/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class HandleStatisticsWindow
{
@@ -31,9 +29,9 @@ namespace ProcessHacker
private void InitializeComponent()
{
this.buttonClose = new System.Windows.Forms.Button();
- this.listTypes = new ProcessHacker.Components.ExtendedListView();
- this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnNumber = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listTypes = new System.Windows.Forms.ListView();
+ this.columnType = new System.Windows.Forms.ColumnHeader();
+ this.columnNumber = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// buttonClose
@@ -50,13 +48,12 @@ namespace ProcessHacker
//
// listTypes
//
- this.listTypes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listTypes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listTypes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnType,
this.columnNumber});
- this.listTypes.DoubleClickChecks = true;
this.listTypes.FullRowSelect = true;
this.listTypes.HideSelection = false;
this.listTypes.Location = new System.Drawing.Point(12, 12);
@@ -82,7 +79,6 @@ namespace ProcessHacker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(351, 303);
this.Controls.Add(this.listTypes);
this.Controls.Add(this.buttonClose);
@@ -101,7 +97,7 @@ namespace ProcessHacker
#endregion
private System.Windows.Forms.Button buttonClose;
- private ExtendedListView listTypes;
+ private System.Windows.Forms.ListView listTypes;
private System.Windows.Forms.ColumnHeader columnType;
private System.Windows.Forms.ColumnHeader columnNumber;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.cs b/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.cs
index 34527dc7c..8431841c0 100644
--- a/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.cs
@@ -12,13 +12,18 @@ namespace ProcessHacker
{
public partial class HandleStatisticsWindow : Form
{
+ private int _pid;
+
public HandleStatisticsWindow(int pid)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
+ _pid = pid;
+
+ listTypes.SetDoubleBuffered(true);
+ listTypes.SetTheme("explorer");
listTypes.AddShortcuts();
listTypes.ContextMenu = listTypes.GetCopyMenu();
listTypes.ListViewItemSorter = new SortedListViewComparer(listTypes);
diff --git a/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.resx b/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/HandleStatisticsWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/HeapsWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/HeapsWindow.Designer.cs
index 0285815ca..01a3f1238 100644
--- a/1.x/trunk/ProcessHacker/Forms/HeapsWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HeapsWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class HeapsWindow
{
@@ -30,16 +28,19 @@ namespace ProcessHacker
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.buttonClose = new System.Windows.Forms.Button();
- this.listHeaps = new ProcessHacker.Components.ExtendedListView();
- this.columnAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnUsed = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnCommitted = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnEntries = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listHeaps = new System.Windows.Forms.ListView();
+ this.columnAddress = new System.Windows.Forms.ColumnHeader();
+ this.columnUsed = new System.Windows.Forms.ColumnHeader();
+ this.columnCommitted = new System.Windows.Forms.ColumnHeader();
+ this.columnEntries = new System.Windows.Forms.ColumnHeader();
this.menuHeap = new System.Windows.Forms.ContextMenu();
this.destroyMenuItem = new System.Windows.Forms.MenuItem();
this.copyMenuItem = new System.Windows.Forms.MenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.checkSizesInBytes = new System.Windows.Forms.CheckBox();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// buttonClose
@@ -56,15 +57,14 @@ namespace ProcessHacker
//
// listHeaps
//
- this.listHeaps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listHeaps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listHeaps.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnAddress,
this.columnUsed,
this.columnCommitted,
this.columnEntries});
- this.listHeaps.DoubleClickChecks = true;
this.listHeaps.FullRowSelect = true;
this.listHeaps.HideSelection = false;
this.listHeaps.Location = new System.Drawing.Point(12, 12);
@@ -102,15 +102,22 @@ namespace ProcessHacker
//
// destroyMenuItem
//
+ this.vistaMenu.SetImage(this.destroyMenuItem, global::ProcessHacker.Properties.Resources.cross);
this.destroyMenuItem.Index = 0;
this.destroyMenuItem.Text = "&Destroy";
this.destroyMenuItem.Click += new System.EventHandler(this.destroyMenuItem_Click);
//
// copyMenuItem
//
+ this.vistaMenu.SetImage(this.copyMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
this.copyMenuItem.Index = 1;
this.copyMenuItem.Text = "&Copy";
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// checkSizesInBytes
//
this.checkSizesInBytes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -120,7 +127,7 @@ namespace ProcessHacker
this.checkSizesInBytes.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkSizesInBytes.Location = new System.Drawing.Point(12, 423);
this.checkSizesInBytes.Name = "checkSizesInBytes";
- this.checkSizesInBytes.Size = new System.Drawing.Size(100, 18);
+ this.checkSizesInBytes.Size = new System.Drawing.Size(96, 18);
this.checkSizesInBytes.TabIndex = 1;
this.checkSizesInBytes.Text = "Sizes in bytes";
this.checkSizesInBytes.UseVisualStyleBackColor = true;
@@ -131,7 +138,6 @@ namespace ProcessHacker
this.AcceptButton = this.buttonClose;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(503, 454);
this.Controls.Add(this.checkSizesInBytes);
this.Controls.Add(this.listHeaps);
@@ -144,6 +150,7 @@ namespace ProcessHacker
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Process Heaps";
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -152,13 +159,14 @@ namespace ProcessHacker
#endregion
private System.Windows.Forms.Button buttonClose;
- private ExtendedListView listHeaps;
+ private System.Windows.Forms.ListView listHeaps;
private System.Windows.Forms.ColumnHeader columnAddress;
private System.Windows.Forms.ColumnHeader columnUsed;
private System.Windows.Forms.ColumnHeader columnCommitted;
private System.Windows.Forms.ColumnHeader columnEntries;
private System.Windows.Forms.ContextMenu menuHeap;
private System.Windows.Forms.MenuItem destroyMenuItem;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.MenuItem copyMenuItem;
private System.Windows.Forms.CheckBox checkSizesInBytes;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/HeapsWindow.cs b/1.x/trunk/ProcessHacker/Forms/HeapsWindow.cs
index 96797edbb..e3f0b3025 100644
--- a/1.x/trunk/ProcessHacker/Forms/HeapsWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HeapsWindow.cs
@@ -36,7 +36,7 @@ namespace ProcessHacker
{
public partial class HeapsWindow : Form
{
- private readonly int _pid;
+ private int _pid;
public HeapsWindow(int pid, HeapInformation[] heaps)
{
@@ -44,6 +44,8 @@ namespace ProcessHacker
this.AddEscapeToClose();
this.SetTopMost();
+ listHeaps.SetDoubleBuffered(true);
+ listHeaps.SetTheme("explorer");
listHeaps.AddShortcuts();
listHeaps.ContextMenu = menuHeap;
GenericViewMenu.AddMenuItems(copyMenuItem.MenuItems, listHeaps, null);
@@ -135,18 +137,21 @@ namespace ProcessHacker
private void menuHeap_Popup(object sender, EventArgs e)
{
- switch (this.listHeaps.SelectedItems.Count)
+ if (listHeaps.SelectedItems.Count == 0)
{
- case 0:
- break;
- case 1:
- this.menuHeap.EnableAll();
- if (this.listHeaps.SelectedItems[0].Text == "Totals")
- this.destroyMenuItem.Enabled = false;
- break;
- default:
- this.copyMenuItem.Enabled = true;
- break;
+ menuHeap.DisableAll();
+ }
+ else if (listHeaps.SelectedItems.Count == 1)
+ {
+ menuHeap.EnableAll();
+
+ if (listHeaps.SelectedItems[0].Text == "Totals")
+ destroyMenuItem.Enabled = false;
+ }
+ else
+ {
+ menuHeap.DisableAll();
+ copyMenuItem.Enabled = true;
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/HeapsWindow.resx b/1.x/trunk/ProcessHacker/Forms/HeapsWindow.resx
index 8979fb40e..aae741422 100644
--- a/1.x/trunk/ProcessHacker/Forms/HeapsWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/HeapsWindow.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
+
+ 128, 17
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/HelpWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/HelpWindow.Designer.cs
index 1414f2ecc..a7872fa97 100644
--- a/1.x/trunk/ProcessHacker/Forms/HelpWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HelpWindow.Designer.cs
@@ -37,26 +37,26 @@
//
this.webBrowser.AllowNavigation = false;
this.webBrowser.AllowWebBrowserDrop = false;
- this.webBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.webBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.webBrowser.IsWebBrowserContextMenuEnabled = false;
this.webBrowser.Location = new System.Drawing.Point(201, 12);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
- this.webBrowser.Size = new System.Drawing.Size(535, 404);
+ this.webBrowser.Size = new System.Drawing.Size(535, 490);
this.webBrowser.TabIndex = 0;
this.webBrowser.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.webBrowser_PreviewKeyDown);
//
// listBoxContents
//
- this.listBoxContents.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
+ this.listBoxContents.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)));
this.listBoxContents.FormattingEnabled = true;
this.listBoxContents.IntegralHeight = false;
this.listBoxContents.Location = new System.Drawing.Point(12, 12);
this.listBoxContents.Name = "listBoxContents";
- this.listBoxContents.Size = new System.Drawing.Size(183, 404);
+ this.listBoxContents.Size = new System.Drawing.Size(183, 490);
this.listBoxContents.TabIndex = 1;
this.listBoxContents.SelectedIndexChanged += new System.EventHandler(this.listBoxContents_SelectedIndexChanged);
//
@@ -64,8 +64,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(748, 428);
+ this.ClientSize = new System.Drawing.Size(748, 514);
this.Controls.Add(this.listBoxContents);
this.Controls.Add(this.webBrowser);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
diff --git a/1.x/trunk/ProcessHacker/Forms/HelpWindow.resx b/1.x/trunk/ProcessHacker/Forms/HelpWindow.resx
index 816fcb8b7..a9216861a 100644
--- a/1.x/trunk/ProcessHacker/Forms/HelpWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/HelpWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.Designer.cs
index 7f66d5c89..73655bf0d 100644
--- a/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.Designer.cs
@@ -29,9 +29,9 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiddenProcessesWindow));
- this.listProcesses = new ProcessHacker.Components.ExtendedListView();
- this.columnProcess = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnPID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listProcesses = new System.Windows.Forms.ListView();
+ this.columnProcess = new System.Windows.Forms.ColumnHeader();
+ this.columnPID = new System.Windows.Forms.ColumnHeader();
this.buttonClose = new System.Windows.Forms.Button();
this.buttonScan = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
@@ -43,13 +43,12 @@
//
// listProcesses
//
- this.listProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listProcesses.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnProcess,
this.columnPID});
- this.listProcesses.DoubleClickChecks = true;
this.listProcesses.FullRowSelect = true;
this.listProcesses.HideSelection = false;
this.listProcesses.Location = new System.Drawing.Point(12, 44);
@@ -97,15 +96,15 @@
//
// label2
//
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoEllipsis = true;
this.label2.Location = new System.Drawing.Point(12, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(487, 32);
this.label2.TabIndex = 0;
this.label2.Text = "Processes highlighted red are hidden while those highlighted gray have terminated" +
- " but are still being referenced by other processes.";
+ " but are still being referenced by other processes.";
//
// buttonTerminate
//
@@ -134,8 +133,8 @@
//
// labelCount
//
- this.labelCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelCount.Location = new System.Drawing.Point(12, 343);
this.labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(487, 15);
@@ -161,7 +160,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(511, 396);
this.Controls.Add(this.comboMethod);
this.Controls.Add(this.labelCount);
@@ -175,15 +173,15 @@
this.KeyPreview = true;
this.Name = "HiddenProcessesWindow";
this.Text = "Hidden Processes";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiddenProcessesWindow_FormClosing);
this.Load += new System.EventHandler(this.HiddenProcessesWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiddenProcessesWindow_FormClosing);
this.ResumeLayout(false);
}
#endregion
- private ProcessHacker.Components.ExtendedListView listProcesses;
+ private System.Windows.Forms.ListView listProcesses;
private System.Windows.Forms.ColumnHeader columnProcess;
private System.Windows.Forms.ColumnHeader columnPID;
private System.Windows.Forms.Button buttonClose;
diff --git a/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs b/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
index 1109ea605..ad1e1417f 100644
--- a/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
@@ -39,17 +39,19 @@ namespace ProcessHacker
{
public HiddenProcessesWindow()
{
+ this.SetPhParent();
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
listProcesses.ListViewItemSorter = new SortedListViewComparer(listProcesses);
listProcesses.ContextMenu = listProcesses.GetCopyMenu();
listProcesses.AddShortcuts();
+ listProcesses.SetDoubleBuffered(true);
+ listProcesses.SetTheme("explorer");
comboMethod.SelectedItem = "CSR Handles";
- labelCount.Text = string.Empty;
+ labelCount.Text = "";
}
private void HiddenProcessesWindow_Load(object sender, EventArgs e)
@@ -80,19 +82,19 @@ namespace ProcessHacker
Func exists
)
{
- string fileName = phandle.ImageFileName;
+ string fileName = phandle.GetImageFileName();
- if (!string.IsNullOrEmpty(fileName))
+ if (fileName != null)
fileName = FileUtils.GetFileName(fileName);
if (pid == 0)
pid = phandle.GetBasicInformation().UniqueProcessId.ToInt32();
- ListViewItem item = listProcesses.Items.Add(new ListViewItem(new string[]
- {
- fileName,
- pid.ToString()
- }));
+ var item = listProcesses.Items.Add(new ListViewItem(new string[]
+ {
+ fileName,
+ pid.ToString()
+ }));
// Check if the process has terminated. This is possible because
// a process can be terminated while its object is still being
@@ -131,10 +133,10 @@ namespace ProcessHacker
return;
var item = listProcesses.Items.Add(new ListViewItem(new string[]
- {
- "(" + ex.Message + ")",
- pid.ToString()
- }));
+ {
+ "(" + ex.Message + ")",
+ pid.ToString()
+ }));
item.BackColor = Color.Red;
item.ForeColor = Color.White;
@@ -161,7 +163,7 @@ namespace ProcessHacker
phandle,
pid,
ref totalCount, ref hiddenCount, ref terminatedCount,
- processes.ContainsKey
+ (pid_) => processes.ContainsKey(pid_)
);
}
catch (WindowsException ex)
@@ -202,77 +204,84 @@ namespace ProcessHacker
var csrProcesses = this.GetCsrProcesses();
// Duplicate each process handle and check if they exist in the normal list.
- foreach (ProcessHandle csrhandle in csrProcesses)
+ foreach (var csrhandle in csrProcesses)
{
try
{
- //var handles = csrhandle.GetHandles();
+ var handles = csrhandle.GetHandles();
- //foreach (ProcessHandleInformation handle in handles)
- //{
- // int pid = 0;
- // bool isThread = false;
+ foreach (var handle in handles)
+ {
+ int pid = 0;
+ bool isThread = false;
- // try
- // {
- // pid = 0;//pid = KProcessHacker.Instance.KphGetProcessId(csrhandle, handle.Handle);
+ try
+ {
+ pid = KProcessHacker.Instance.KphGetProcessId(csrhandle, handle.Handle);
- // // HACK: Using exception for program flow!
- // if (pid == 0)
- // throw new Exception();
- // }
- // catch
- // {
- // // Probably not a process handle.
- // // Try opening it as a thread.
- // try
- // {
- // int tid =0;// KProcessHacker.Instance.KphGetThreadId(csrhandle, handle.Handle, out pid);
- // isThread = true;
+ // HACK: Using exception for program flow!
+ if (pid == 0)
+ throw new Exception();
+ }
+ catch
+ {
+ // Probably not a process handle.
+ // Try opening it as a thread.
+ try
+ {
+ int tid = KProcessHacker.Instance.KphGetThreadId(csrhandle, handle.Handle, out pid);
+ isThread = true;
- // if (tid == 0)
- // throw new Exception();
- // }
- // catch
- // {
- // continue;
- // }
- // }
+ if (tid == 0)
+ throw new Exception();
+ }
+ catch
+ {
+ continue;
+ }
+ }
- // // Avoid duplicate PIDs.
- // if (foundPids.Contains(pid))
- // continue;
+ // Avoid duplicate PIDs.
+ if (foundPids.Contains(pid))
+ continue;
- // foundPids.Add(pid);
+ foundPids.Add(pid);
- // try
- // {
- // ProcessHandle phandle;
+ try
+ {
+ ProcessHandle phandle;
- // if (!isThread)
- // {
- // var dupHandle = new NativeHandle(csrhandle, handle.Handle, Program.MinProcessQueryRights);
- // phandle = ProcessHandle.FromHandle(dupHandle);
- // }
- // else
- // {
- // using (var dupHandle = new NativeHandle(csrhandle, handle.Handle, Program.MinThreadQueryRights))
- // phandle = ThreadHandle.FromHandle(dupHandle).GetProcess(Program.MinProcessQueryRights);
- // }
+ if (!isThread)
+ {
+ var dupHandle =
+ new NativeHandle(csrhandle,
+ handle.Handle,
+ Program.MinProcessQueryRights);
+ phandle = ProcessHandle.FromHandle(dupHandle);
+ }
+ else
+ {
+ using (var dupHandle =
+ new NativeHandle(csrhandle,
+ handle.Handle,
+ Program.MinThreadQueryRights))
+ phandle = ThreadHandle.FromHandle(dupHandle).
+ GetProcess(Program.MinProcessQueryRights);
+ }
- // AddProcessItem(
- // phandle,
- // pid,
- // ref totalCount, ref hiddenCount, ref terminatedCount,
- // processes.ContainsKey
- // );
- // phandle.Dispose();
- // }
- // catch (WindowsException ex2)
- // {
- // AddErrorItem(ex2, pid, ref totalCount, ref hiddenCount, ref terminatedCount);
- // }
- //}
+ AddProcessItem(
+ phandle,
+ pid,
+ ref totalCount, ref hiddenCount, ref terminatedCount,
+ (pid_) => processes.ContainsKey(pid_)
+ );
+ phandle.Dispose();
+ }
+ catch (WindowsException ex2)
+ {
+ AddErrorItem(ex2, pid, ref totalCount, ref hiddenCount, ref terminatedCount);
+ }
+ }
}
catch (WindowsException ex)
{
@@ -298,24 +307,24 @@ namespace ProcessHacker
}
}
- private ProcessHandle[] GetCsrProcesses()
+ private List GetCsrProcesses()
{
List csrProcesses = new List();
try
{
- foreach (KeyValuePair process in Windows.GetProcesses())
+ foreach (var process in Windows.GetProcesses())
{
if (process.Key <= 4)
continue;
try
{
- ProcessHandle phandle = new ProcessHandle(process.Key,
+ var phandle = new ProcessHandle(process.Key,
Program.MinProcessQueryRights | ProcessAccess.DupHandle
);
- if (phandle.KnownProcessType == KnownProcess.WindowsSubsystem)
+ if (phandle.GetKnownProcessType() == KnownProcess.WindowsSubsystem)
csrProcesses.Add(phandle);
else
phandle.Dispose();
@@ -327,9 +336,10 @@ namespace ProcessHacker
catch (Exception ex)
{
PhUtils.ShowException("Unable to get the list of CSR processes", ex);
+ return new List();
}
- return csrProcesses.ToArray();
+ return csrProcesses;
}
private ProcessHandle OpenProcessCsr(int pid, ProcessAccess access)
@@ -338,43 +348,43 @@ namespace ProcessHacker
foreach (var csrProcess in csrProcesses)
{
- // foreach (var handle in csrProcess.GetHandles())
- // {
- // try
- // {
- // // Assume that the handle is a process handle.
- // int handlePid = 0;// KProcessHacker.Instance.KphGetProcessId(csrProcess, handle.Handle);
+ foreach (var handle in csrProcess.GetHandles())
+ {
+ try
+ {
+ // Assume that the handle is a process handle.
+ int handlePid = KProcessHacker.Instance.KphGetProcessId(csrProcess, handle.Handle);
- // if (handlePid == pid)
- // return ProcessHandle.FromHandle(
- // new NativeHandle(csrProcess, handle.Handle, access)
- // );
- // else if (handlePid == 0)
- // throw new Exception(); // HACK
- // }
- // catch
- // {
- // try
- // {
- // // Assume that the handle is a thread handle.
- // int handlePid = 0;
+ if (handlePid == pid)
+ return ProcessHandle.FromHandle(
+ new NativeHandle(csrProcess, handle.Handle, access)
+ );
+ else if (handlePid == 0)
+ throw new Exception(); // HACK
+ }
+ catch
+ {
+ try
+ {
+ // Assume that the handle is a thread handle.
+ int handlePid;
- // int tid = 0;// KProcessHacker.Instance.KphGetThreadId(csrProcess, handle.Handle, out handlePid);
+ int tid = KProcessHacker.Instance.KphGetThreadId(csrProcess, handle.Handle, out handlePid);
- // if (tid == 0)
- // throw new Exception();
+ if (tid == 0)
+ throw new Exception();
- // if (handlePid == pid)
- // {
- // using (var dupHandle =
- // new NativeHandle(csrProcess, handle.Handle, Program.MinThreadQueryRights))
- // return ThreadHandle.FromHandle(dupHandle).GetProcess(access);
- // }
- // }
- // catch
- // { }
- // }
- // }
+ if (handlePid == pid)
+ {
+ using (var dupHandle =
+ new NativeHandle(csrProcess, handle.Handle, Program.MinThreadQueryRights))
+ return ThreadHandle.FromHandle(dupHandle).GetProcess(access);
+ }
+ }
+ catch
+ { }
+ }
+ }
csrProcess.Dispose();
}
@@ -465,35 +475,34 @@ namespace ProcessHacker
private void buttonSave_Click(object sender, EventArgs e)
{
- using (SaveFileDialog sfd = new SaveFileDialog())
+ SaveFileDialog sfd = new SaveFileDialog();
+
+ sfd.FileName = "Process Scan.txt";
+ sfd.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
+ sfd.OverwritePrompt = true;
+
+ if (sfd.ShowDialog() == DialogResult.OK)
{
- sfd.FileName = "Process Scan.txt";
- sfd.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
- sfd.OverwritePrompt = true;
-
- if (sfd.ShowDialog() == DialogResult.OK)
+ try
{
- try
+ using (var sw = new StreamWriter(sfd.FileName))
{
- using (var sw = new StreamWriter(sfd.FileName))
- {
- sw.WriteLine("Process Hacker Hidden Processes Scan");
- sw.WriteLine("Method: " + comboMethod.SelectedItem.ToString());
- sw.WriteLine();
+ sw.WriteLine("Process Hacker Hidden Processes Scan");
+ sw.WriteLine("Method: " + comboMethod.SelectedItem.ToString());
+ sw.WriteLine();
- foreach (ListViewItem item in listProcesses.Items)
- {
- sw.WriteLine(
- (item.BackColor == Color.Red ? "[HIDDEN] " : "") +
- (item.BackColor == Color.DarkGray ? "[Terminated] " : "") +
- item.SubItems[1].Text + ": " + item.SubItems[0].Text);
- }
+ foreach (ListViewItem item in listProcesses.Items)
+ {
+ sw.WriteLine(
+ (item.BackColor == Color.Red ? "[HIDDEN] " : "") +
+ (item.BackColor == Color.DarkGray ? "[Terminated] " : "") +
+ item.SubItems[1].Text + ": " + item.SubItems[0].Text);
}
}
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to save the scan results", ex);
- }
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to save the scan results", ex);
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.resx b/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.resx
index 1e4b7cfa9..912b30118 100644
--- a/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/HiddenProcessesWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAA0AMDAQAAEABABoBgAA1gAAACAgEAABAAQA6AIAAD4HAAAYGBAAAQAEAOgBAAAmCgAAEBAQAAEA
diff --git a/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.Designer.cs
index 3e3b50b28..c712a064e 100644
--- a/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class IPInfoWindow
{
@@ -32,7 +30,7 @@ namespace ProcessHacker
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IPInfoWindow));
this.buttonClose = new System.Windows.Forms.Button();
- this.listInfo = new ProcessHacker.Components.ExtendedListView();
+ this.listInfo = new System.Windows.Forms.ListView();
this.labelInfo = new System.Windows.Forms.Label();
this.labelStatus = new System.Windows.Forms.Label();
this.SuspendLayout();
@@ -51,10 +49,9 @@ namespace ProcessHacker
//
// listInfo
//
- this.listInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listInfo.DoubleClickChecks = true;
+ this.listInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listInfo.FullRowSelect = true;
this.listInfo.Location = new System.Drawing.Point(12, 31);
this.listInfo.Name = "listInfo";
@@ -69,7 +66,7 @@ namespace ProcessHacker
this.labelInfo.AutoSize = true;
this.labelInfo.Location = new System.Drawing.Point(12, 9);
this.labelInfo.Name = "labelInfo";
- this.labelInfo.Size = new System.Drawing.Size(38, 13);
+ this.labelInfo.Size = new System.Drawing.Size(35, 13);
this.labelInfo.TabIndex = 3;
this.labelInfo.Text = "label1";
//
@@ -79,7 +76,7 @@ namespace ProcessHacker
this.labelStatus.AutoSize = true;
this.labelStatus.Location = new System.Drawing.Point(12, 334);
this.labelStatus.Name = "labelStatus";
- this.labelStatus.Size = new System.Drawing.Size(61, 13);
+ this.labelStatus.Size = new System.Drawing.Size(56, 13);
this.labelStatus.TabIndex = 4;
this.labelStatus.Text = "Working...";
//
@@ -87,7 +84,6 @@ namespace ProcessHacker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(463, 364);
this.Controls.Add(this.listInfo);
this.Controls.Add(this.labelStatus);
@@ -101,8 +97,8 @@ namespace ProcessHacker
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "IP information";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IPInfoWindow_FormClosing);
this.Load += new System.EventHandler(this.IPInfoWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IPInfoWindow_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();
@@ -111,7 +107,7 @@ namespace ProcessHacker
#endregion
private System.Windows.Forms.Button buttonClose;
- private ExtendedListView listInfo;
+ private System.Windows.Forms.ListView listInfo;
private System.Windows.Forms.Label labelInfo;
private System.Windows.Forms.Label labelStatus;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.cs b/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.cs
index a3a0cb17c..ccb9df110 100644
--- a/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.cs
@@ -42,8 +42,8 @@ namespace ProcessHacker
public partial class IPInfoWindow : Form
{
- private readonly IPAddress _ipAddress;
- private readonly IpAction _ipAction;
+ private IPAddress _ipAddress;
+ private IpAction _ipAction;
public IPInfoWindow(IPAddress ipAddress, IpAction action)
{
@@ -56,36 +56,38 @@ namespace ProcessHacker
listInfo.AddShortcuts();
listInfo.ContextMenu = listInfo.GetCopyMenu();
+ listInfo.SetTheme("explorer");
+ listInfo.SetDoubleBuffered(true);
}
private void IPInfoWindow_Load(object sender, EventArgs e)
{
Thread t = null;
- switch (this._ipAction)
+ if (_ipAction == IpAction.Whois)
{
- case IpAction.Whois:
- t = new Thread(this.Whois, Utils.SixteenthStackSize);
- this.labelInfo.Text = "Whois host infomation for address: " + this._ipAddress.ToString();
- this.labelStatus.Text = "Checking...";
- this.listInfo.Columns.Add("Results");
- ColumnSettings.LoadSettings(Settings.Instance.IPInfoWhoIsListViewColumns, this.listInfo);
- break;
- case IpAction.Tracert:
- t = new Thread(this.Tracert, Utils.SixteenthStackSize);
- this.labelStatus.Text = "Tracing route...";
- this.listInfo.Columns.Add("Count");
- this.listInfo.Columns.Add("Reply Time");
- this.listInfo.Columns.Add("IP Address");
- this.listInfo.Columns.Add("Hostname");
- ColumnSettings.LoadSettings(Settings.Instance.IPInfoTracertListViewColumns, this.listInfo);
- break;
- case IpAction.Ping:
- t = new Thread(this.Ping, Utils.SixteenthStackSize);
- this.labelStatus.Text = "Pinging...";
- this.listInfo.Columns.Add("Results");
- ColumnSettings.LoadSettings(Settings.Instance.IPInfoPingListViewColumns, this.listInfo);
- break;
+ t = new Thread(new ParameterizedThreadStart(Whois), Utils.SixteenthStackSize);
+ labelInfo.Text = "Whois host infomation for address: " + _ipAddress.ToString();
+ labelStatus.Text = "Checking...";
+ listInfo.Columns.Add("Results");
+ ColumnSettings.LoadSettings(Settings.Instance.IPInfoWhoIsListViewColumns, listInfo);
+ }
+ else if (_ipAction == IpAction.Tracert)
+ {
+ t = new Thread(new ParameterizedThreadStart(Tracert), Utils.SixteenthStackSize);
+ labelStatus.Text = "Tracing route...";
+ listInfo.Columns.Add("Count");
+ listInfo.Columns.Add("Reply Time");
+ listInfo.Columns.Add("IP Address");
+ listInfo.Columns.Add("Hostname");
+ ColumnSettings.LoadSettings(Settings.Instance.IPInfoTracertListViewColumns, listInfo);
+ }
+ else if (_ipAction == IpAction.Ping)
+ {
+ t = new Thread(new ParameterizedThreadStart(Ping), Utils.SixteenthStackSize);
+ labelStatus.Text = "Pinging...";
+ listInfo.Columns.Add("Results");
+ ColumnSettings.LoadSettings(Settings.Instance.IPInfoPingListViewColumns, listInfo);
}
t.IsBackground = true;
@@ -94,18 +96,12 @@ namespace ProcessHacker
private void IPInfoWindow_FormClosing(object sender, FormClosingEventArgs e)
{
- switch (this._ipAction)
- {
- case IpAction.Whois:
- Settings.Instance.IPInfoWhoIsListViewColumns = ColumnSettings.SaveSettings(this.listInfo);
- break;
- case IpAction.Tracert:
- Settings.Instance.IPInfoTracertListViewColumns = ColumnSettings.SaveSettings(this.listInfo);
- break;
- case IpAction.Ping:
- Settings.Instance.IPInfoPingListViewColumns = ColumnSettings.SaveSettings(this.listInfo);
- break;
- }
+ if (_ipAction == IpAction.Whois)
+ Settings.Instance.IPInfoWhoIsListViewColumns = ColumnSettings.SaveSettings(listInfo);
+ else if (_ipAction == IpAction.Tracert)
+ Settings.Instance.IPInfoTracertListViewColumns = ColumnSettings.SaveSettings(listInfo);
+ else if (_ipAction == IpAction.Ping)
+ Settings.Instance.IPInfoPingListViewColumns = ColumnSettings.SaveSettings(listInfo);
Settings.Instance.Save();
}
@@ -120,6 +116,7 @@ namespace ProcessHacker
using (Ping pingSender = new Ping())
{
PingOptions pingOptions = new PingOptions();
+ PingReply pingReply = null;
IPAddress ipAddress = (IPAddress)ip;
int numberOfPings = 4;
@@ -141,7 +138,6 @@ namespace ProcessHacker
{
sentPings++;
- PingReply pingReply;
try
{
pingReply = pingSender.Send(ipAddress, pingTimeout, buffer, pingOptions);
@@ -152,47 +148,44 @@ namespace ProcessHacker
break;
}
- if (pingReply != null)
+ if (pingReply.Status == IPStatus.Success)
{
- if (pingReply.Status == IPStatus.Success)
+ if (pingReply.Options != null) //IPv6 ping causes pingReply.Options to become null
{
- if (pingReply.Options != null) //IPv6 ping causes pingReply.Options to become null
- {
- WriteResult(string.Format("Reply from {0}: bytes={1} time={2}ms TTL={3}", ipAddress, byteSize, pingReply.RoundtripTime, pingReply.Options.Ttl), string.Empty, string.Empty);
- }
- else
- {
- WriteResult(string.Format("Reply from {0}: bytes={1} time={2}ms TTL={3}", ipAddress, byteSize, pingReply.RoundtripTime, pingOptions.Ttl), string.Empty, string.Empty);
- }
-
- if (minPingResponse == 0)
- {
- minPingResponse = pingReply.RoundtripTime;
- maxPingResponse = minPingResponse;
- }
- else if (pingReply.RoundtripTime < minPingResponse)
- {
- minPingResponse = pingReply.RoundtripTime;
- }
- else if (pingReply.RoundtripTime > maxPingResponse)
- {
- maxPingResponse = pingReply.RoundtripTime;
- }
-
- receivedPings++;
+ WriteResult(string.Format("Reply from {0}: bytes={1} time={2}ms TTL={3}", ipAddress, byteSize, pingReply.RoundtripTime, pingReply.Options.Ttl), "", "");
}
else
{
- WriteResult(pingReply.Status.ToString(), string.Empty, string.Empty);
- lostPings++;
+ WriteResult(string.Format("Reply from {0}: bytes={1} time={2}ms TTL={3}", ipAddress, byteSize, pingReply.RoundtripTime, pingOptions.Ttl), "", "");
}
+
+ if (minPingResponse == 0)
+ {
+ minPingResponse = pingReply.RoundtripTime;
+ maxPingResponse = minPingResponse;
+ }
+ else if (pingReply.RoundtripTime < minPingResponse)
+ {
+ minPingResponse = pingReply.RoundtripTime;
+ }
+ else if (pingReply.RoundtripTime > maxPingResponse)
+ {
+ maxPingResponse = pingReply.RoundtripTime;
+ }
+
+ receivedPings++;
+ }
+ else
+ {
+ WriteResult(pingReply.Status.ToString(), "", "");
+ lostPings++;
}
}
- WriteResult(string.Empty, string.Empty, string.Empty);
- WriteResult(string.Format("Ping statistics for {0}:", ipAddress), string.Empty, string.Empty);
- WriteResult(string.Format(" Packets: Sent = {0}, Received = {1}, Lost = {2}", sentPings, receivedPings, lostPings), string.Empty, string.Empty);
- WriteResult("Approximate round trip times in milli-seconds:", string.Empty, string.Empty);
- WriteResult(string.Format(" Minimum = {0}ms, Maximum = {1}ms", minPingResponse, maxPingResponse), string.Empty, string.Empty);
+ WriteResult("", "", "");
+ WriteResult(string.Format("Ping statistics for {0}:", ipAddress), "", "");
+ WriteResult(string.Format(" Packets: Sent = {0}, Received = {1}, Lost = {2}", sentPings, receivedPings, lostPings), "", "");
+ WriteResult("Approximate round trip times in milli-seconds:", "", "");
+ WriteResult(string.Format(" Minimum = {0}ms, Maximum = {1}ms", minPingResponse, maxPingResponse), "", "");
}
WriteStatus("Ping complete.", false);
}
@@ -205,6 +198,7 @@ namespace ProcessHacker
{
PingOptions pingOptions = new PingOptions();
Stopwatch stopWatch = new Stopwatch();
+ byte[] bytes = new byte[32];
pingOptions.DontFragment = true;
pingOptions.Ttl = 1;
@@ -236,33 +230,33 @@ namespace ProcessHacker
WriteResult(string.Format("{0}" , i), string.Format("{0} ms", stopWatch.ElapsedMilliseconds), string.Format("{0}", pingReply.Address));
WorkQueue.GlobalQueueWorkItemTag(new Action((address, hopNumber) =>
- {
- string hostName;
+ {
+ string hostName;
- try
- {
- hostName = Dns.GetHostEntry(address).HostName;
- }
- catch
- {
- hostName = string.Empty;
- }
-
- if (this.IsHandleCreated)
- {
- this.BeginInvoke(new MethodInvoker(() =>
+ try
{
- foreach (ListViewItem item in listInfo.Items)
- {
- if (item.Text == hopNumber.ToString())
+ hostName = Dns.GetHostEntry(address).HostName;
+ }
+ catch
+ {
+ hostName = "";
+ }
+
+ if (this.IsHandleCreated)
+ {
+ this.BeginInvoke(new MethodInvoker(() =>
{
- item.SubItems[3].Text = hostName;
- break;
- }
- }
- }));
- }
- }), "ipinfowindow-resolveaddress", pingReply.Address, i);
+ foreach (ListViewItem item in listInfo.Items)
+ {
+ if (item.Text == hopNumber.ToString())
+ {
+ item.SubItems[3].Text = hostName;
+ break;
+ }
+ }
+ }));
+ }
+ }), "ipinfowindow-resolveaddress", pingReply.Address, i);
if (pingReply.Status == IPStatus.Success)
{
@@ -293,9 +287,9 @@ namespace ProcessHacker
while (!streamReaderReceive.EndOfStream)
{
string data = streamReaderReceive.ReadLine();
- if (!data.Contains("#", StringComparison.OrdinalIgnoreCase) | !data.Contains("?", StringComparison.OrdinalIgnoreCase))
+ if (!data.Contains("#") | !data.Contains("?"))
{
- WriteResult(data, string.Empty, string.Empty);
+ WriteResult(data, "", "");
}
}
}
@@ -342,7 +336,7 @@ namespace ProcessHacker
ListViewItem litem = new ListViewItem(hop);
litem.SubItems.Add(time);
litem.SubItems.Add(ip);
- litem.SubItems.Add(string.Empty);
+ litem.SubItems.Add("");
listInfo.Items.Add(litem);
}
diff --git a/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.resx b/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.resx
index 2cbf80acc..4a18a8b93 100644
--- a/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/IPInfoWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAA0AMDAQAAEABABoBgAA1gAAACAgEAABAAQA6AIAAD4HAAAYGBAAAQAEAOgBAAAmCgAAEBAQAAEA
diff --git a/1.x/trunk/ProcessHacker/Forms/InformationBox.Designer.cs b/1.x/trunk/ProcessHacker/Forms/InformationBox.Designer.cs
index 5e8fe8422..3eea860c3 100644
--- a/1.x/trunk/ProcessHacker/Forms/InformationBox.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/InformationBox.Designer.cs
@@ -36,10 +36,9 @@
//
// textValues
//
- this.textValues.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textValues.BackColor = System.Drawing.Color.WhiteSmoke;
+ this.textValues.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textValues.HideSelection = false;
this.textValues.Location = new System.Drawing.Point(12, 12);
this.textValues.Multiline = true;
@@ -52,7 +51,6 @@
// buttonClose
//
this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonClose.Location = new System.Drawing.Point(462, 306);
this.buttonClose.Name = "buttonClose";
@@ -88,11 +86,8 @@
//
// InformationBox
//
- this.AcceptButton = this.buttonSave;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.CancelButton = this.buttonClose;
this.ClientSize = new System.Drawing.Size(549, 341);
this.Controls.Add(this.buttonCopy);
this.Controls.Add(this.buttonSave);
@@ -106,8 +101,8 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Information";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InformationBox_FormClosing);
this.Load += new System.EventHandler(this.InformationBox_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InformationBox_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.InformationBox_KeyDown);
this.ResumeLayout(false);
this.PerformLayout();
diff --git a/1.x/trunk/ProcessHacker/Forms/InformationBox.cs b/1.x/trunk/ProcessHacker/Forms/InformationBox.cs
index fd8b427ee..c18306c41 100644
--- a/1.x/trunk/ProcessHacker/Forms/InformationBox.cs
+++ b/1.x/trunk/ProcessHacker/Forms/InformationBox.cs
@@ -30,7 +30,7 @@ namespace ProcessHacker
public InformationBox(string values)
{
InitializeComponent();
-
+ this.AddEscapeToClose();
this.SetTopMost();
if (!Program.BadConfig)
@@ -76,15 +76,13 @@ namespace ProcessHacker
private void buttonSave_Click(object sender, EventArgs e)
{
- using (SaveFileDialog sfd = new SaveFileDialog
- {
- FileName = this.DefaultFileName,
- Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
- })
- {
- if (sfd.ShowDialog() == DialogResult.OK)
- System.IO.File.WriteAllText(sfd.FileName, textValues.Text);
- }
+ SaveFileDialog sfd = new SaveFileDialog();
+
+ sfd.FileName = DefaultFileName;
+ sfd.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
+
+ if (sfd.ShowDialog() == DialogResult.OK)
+ System.IO.File.WriteAllText(sfd.FileName, textValues.Text);
}
private void buttonCopy_Click(object sender, EventArgs e)
diff --git a/1.x/trunk/ProcessHacker/Forms/InformationBox.resx b/1.x/trunk/ProcessHacker/Forms/InformationBox.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/InformationBox.resx
+++ b/1.x/trunk/ProcessHacker/Forms/InformationBox.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/JobWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/JobWindow.Designer.cs
index 3a0fe6c84..dd7b2f571 100644
--- a/1.x/trunk/ProcessHacker/Forms/JobWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/JobWindow.Designer.cs
@@ -37,9 +37,9 @@
//
// panelJob
//
- this.panelJob.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.panelJob.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.panelJob.Location = new System.Drawing.Point(12, 12);
this.panelJob.Name = "panelJob";
this.panelJob.Size = new System.Drawing.Size(444, 372);
@@ -61,7 +61,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(468, 425);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.panelJob);
diff --git a/1.x/trunk/ProcessHacker/Forms/JobWindow.cs b/1.x/trunk/ProcessHacker/Forms/JobWindow.cs
index 0095a986a..b0b83e3ca 100644
--- a/1.x/trunk/ProcessHacker/Forms/JobWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/JobWindow.cs
@@ -1,4 +1,9 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
using System.Windows.Forms;
using ProcessHacker.Components;
using ProcessHacker.Native.Objects;
@@ -7,19 +12,16 @@ namespace ProcessHacker
{
public partial class JobWindow : Form
{
- readonly JobProperties _jobProps;
+ JobProperties _jobProps;
public JobWindow(JobObjectHandle jobHandle)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
- _jobProps = new JobProperties(jobHandle)
- {
- Dock = DockStyle.Fill
- };
+ _jobProps = new JobProperties(jobHandle);
+ _jobProps.Dock = DockStyle.Fill;
panelJob.Controls.Add(_jobProps);
}
diff --git a/1.x/trunk/ProcessHacker/Forms/JobWindow.resx b/1.x/trunk/ProcessHacker/Forms/JobWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/JobWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/JobWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.Designer.cs
index c803bba79..907e29d57 100644
--- a/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.Designer.cs
@@ -35,9 +35,9 @@
//
// listItems
//
- this.listItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listItems.FormattingEnabled = true;
this.listItems.IntegralHeight = false;
this.listItems.Location = new System.Drawing.Point(12, 12);
@@ -75,7 +75,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(406, 171);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
diff --git a/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.resx b/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ListPickerWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ListWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ListWindow.Designer.cs
index 14a39cd3a..de2be5cbf 100644
--- a/1.x/trunk/ProcessHacker/Forms/ListWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ListWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class ListWindow
{
@@ -31,9 +29,9 @@ namespace ProcessHacker
private void InitializeComponent()
{
this.buttonClose = new System.Windows.Forms.Button();
- this.listView = new ProcessHacker.Components.ExtendedListView();
- this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listView = new System.Windows.Forms.ListView();
+ this.columnName = new System.Windows.Forms.ColumnHeader();
+ this.columnValue = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// buttonClose
@@ -50,13 +48,12 @@ namespace ProcessHacker
//
// listView
//
- this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnName,
this.columnValue});
- this.listView.DoubleClickChecks = true;
this.listView.FullRowSelect = true;
this.listView.Location = new System.Drawing.Point(12, 12);
this.listView.Name = "listView";
@@ -80,7 +77,6 @@ namespace ProcessHacker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(511, 310);
this.Controls.Add(this.listView);
this.Controls.Add(this.buttonClose);
@@ -92,6 +88,7 @@ namespace ProcessHacker
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "List";
+ this.Load += new System.EventHandler(this.ListWindow_Load);
this.ResumeLayout(false);
}
@@ -99,7 +96,7 @@ namespace ProcessHacker
#endregion
private System.Windows.Forms.Button buttonClose;
- private ExtendedListView listView;
+ private System.Windows.Forms.ListView listView;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.ColumnHeader columnValue;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ListWindow.cs b/1.x/trunk/ProcessHacker/Forms/ListWindow.cs
index f35a26dcc..777fc1d00 100644
--- a/1.x/trunk/ProcessHacker/Forms/ListWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ListWindow.cs
@@ -23,6 +23,7 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
+using ProcessHacker.Common;
using ProcessHacker.UI;
namespace ProcessHacker
@@ -37,11 +38,9 @@ namespace ProcessHacker
foreach (KeyValuePair kvp in list)
{
- ListViewItem item = new ListViewItem
- {
- Text = kvp.Key
- };
+ ListViewItem item = new ListViewItem();
+ item.Text = kvp.Key;
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, kvp.Value));
listView.Items.Add(item);
@@ -50,6 +49,11 @@ namespace ProcessHacker
listView.ContextMenu = listView.GetCopyMenu();
}
+ private void ListWindow_Load(object sender, EventArgs e)
+ {
+ listView.SetTheme("explorer");
+ }
+
private void buttonClose_Click(object sender, EventArgs e)
{
this.Close();
diff --git a/1.x/trunk/ProcessHacker/Forms/ListWindow.resx b/1.x/trunk/ProcessHacker/Forms/ListWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ListWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ListWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/LogWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/LogWindow.Designer.cs
index bdc180cc3..bbc6bfa84 100644
--- a/1.x/trunk/ProcessHacker/Forms/LogWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/LogWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class LogWindow
{
@@ -31,9 +29,9 @@ namespace ProcessHacker
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.listLog = new ProcessHacker.Components.ExtendedListView();
- this.columnTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnMessage = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listLog = new System.Windows.Forms.ListView();
+ this.columnTime = new System.Windows.Forms.ColumnHeader();
+ this.columnMessage = new System.Windows.Forms.ColumnHeader();
this.buttonClose = new System.Windows.Forms.Button();
this.timerScroll = new System.Windows.Forms.Timer(this.components);
this.buttonCopy = new System.Windows.Forms.Button();
@@ -44,25 +42,24 @@ namespace ProcessHacker
//
// listLog
//
- this.listLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listLog.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnTime,
this.columnMessage});
- this.listLog.DoubleClickChecks = true;
this.listLog.FullRowSelect = true;
this.listLog.HideSelection = false;
this.listLog.Location = new System.Drawing.Point(12, 12);
this.listLog.Name = "listLog";
this.listLog.ShowItemToolTips = true;
- this.listLog.Size = new System.Drawing.Size(555, 297);
+ this.listLog.Size = new System.Drawing.Size(555, 419);
this.listLog.TabIndex = 0;
this.listLog.UseCompatibleStateImageBehavior = false;
this.listLog.View = System.Windows.Forms.View.Details;
this.listLog.VirtualMode = true;
- this.listLog.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listLog_RetrieveVirtualItem);
this.listLog.DoubleClick += new System.EventHandler(this.listLog_DoubleClick);
+ this.listLog.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listLog_RetrieveVirtualItem);
//
// columnTime
//
@@ -78,7 +75,7 @@ namespace ProcessHacker
//
this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonClose.Location = new System.Drawing.Point(492, 315);
+ this.buttonClose.Location = new System.Drawing.Point(492, 437);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 23);
this.buttonClose.TabIndex = 5;
@@ -96,7 +93,7 @@ namespace ProcessHacker
//
this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCopy.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonCopy.Location = new System.Drawing.Point(411, 315);
+ this.buttonCopy.Location = new System.Drawing.Point(411, 437);
this.buttonCopy.Name = "buttonCopy";
this.buttonCopy.Size = new System.Drawing.Size(75, 23);
this.buttonCopy.TabIndex = 4;
@@ -108,7 +105,7 @@ namespace ProcessHacker
//
this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSave.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonSave.Location = new System.Drawing.Point(330, 315);
+ this.buttonSave.Location = new System.Drawing.Point(330, 437);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(75, 23);
this.buttonSave.TabIndex = 3;
@@ -120,7 +117,7 @@ namespace ProcessHacker
//
this.buttonClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonClear.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonClear.Location = new System.Drawing.Point(12, 315);
+ this.buttonClear.Location = new System.Drawing.Point(12, 437);
this.buttonClear.Name = "buttonClear";
this.buttonClear.Size = new System.Drawing.Size(75, 23);
this.buttonClear.TabIndex = 1;
@@ -135,9 +132,9 @@ namespace ProcessHacker
this.checkAutoscroll.Checked = true;
this.checkAutoscroll.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkAutoscroll.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.checkAutoscroll.Location = new System.Drawing.Point(93, 318);
+ this.checkAutoscroll.Location = new System.Drawing.Point(93, 440);
this.checkAutoscroll.Name = "checkAutoscroll";
- this.checkAutoscroll.Size = new System.Drawing.Size(88, 18);
+ this.checkAutoscroll.Size = new System.Drawing.Size(81, 18);
this.checkAutoscroll.TabIndex = 2;
this.checkAutoscroll.Text = "Auto-scroll";
this.checkAutoscroll.UseVisualStyleBackColor = true;
@@ -146,8 +143,7 @@ namespace ProcessHacker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(579, 350);
+ this.ClientSize = new System.Drawing.Size(579, 472);
this.Controls.Add(this.checkAutoscroll);
this.Controls.Add(this.buttonClear);
this.Controls.Add(this.buttonSave);
@@ -155,6 +151,7 @@ namespace ProcessHacker
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.listLog);
this.Name = "LogWindow";
+ this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Log";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LogWindow_FormClosing);
@@ -165,7 +162,7 @@ namespace ProcessHacker
#endregion
- private ExtendedListView listLog;
+ private System.Windows.Forms.ListView listLog;
private System.Windows.Forms.ColumnHeader columnTime;
private System.Windows.Forms.ColumnHeader columnMessage;
private System.Windows.Forms.Button buttonClose;
diff --git a/1.x/trunk/ProcessHacker/Forms/LogWindow.cs b/1.x/trunk/ProcessHacker/Forms/LogWindow.cs
index 2be5bcce8..9917bcf1a 100644
--- a/1.x/trunk/ProcessHacker/Forms/LogWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/LogWindow.cs
@@ -35,23 +35,25 @@ namespace ProcessHacker
public LogWindow()
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
- this.listLog.ContextMenu = this.listLog.GetCopyMenu(this.listLog_RetrieveVirtualItem);
- this.listLog.AddShortcuts(this.listLog_RetrieveVirtualItem);
+ listLog.SetDoubleBuffered(true);
+ listLog.SetTheme("explorer");
+ listLog.ContextMenu = listLog.GetCopyMenu(listLog_RetrieveVirtualItem);
+ listLog.AddShortcuts(listLog_RetrieveVirtualItem);
this.UpdateLog();
- if (this.listLog.SelectedIndices.Count == 0 && this.listLog.VirtualListSize > 0)
- this.listLog.EnsureVisible(this.listLog.VirtualListSize - 1);
+ if (listLog.SelectedIndices.Count == 0 && listLog.VirtualListSize > 0)
+ listLog.EnsureVisible(listLog.VirtualListSize - 1);
- Program.HackerWindow.LogUpdated += this.HackerWindow_LogUpdated;
+ Program.HackerWindow.LogUpdated += new HackerWindow.LogUpdatedEventHandler(HackerWindow_LogUpdated);
this.Size = Settings.Instance.LogWindowSize;
- this.Location = Utils.FitRectangle(new Rectangle(Settings.Instance.LogWindowLocation, this.Size), this).Location;
- this.checkAutoscroll.Checked = Settings.Instance.LogWindowAutoScroll;
+ this.Location = Utils.FitRectangle(new Rectangle(
+ Settings.Instance.LogWindowLocation, this.Size), this).Location;
+ checkAutoscroll.Checked = Settings.Instance.LogWindowAutoScroll;
}
private void HackerWindow_LogUpdated(KeyValuePair? value)
@@ -83,7 +85,7 @@ namespace ProcessHacker
Settings.Instance.LogWindowAutoScroll = checkAutoscroll.Checked;
- Program.HackerWindow.LogUpdated -= this.HackerWindow_LogUpdated;
+ Program.HackerWindow.LogUpdated -= new HackerWindow.LogUpdatedEventHandler(HackerWindow_LogUpdated);
}
private void buttonClose_Click(object sender, EventArgs e)
@@ -123,29 +125,27 @@ namespace ProcessHacker
private void buttonSave_Click(object sender, EventArgs e)
{
- using (SaveFileDialog sfd = new SaveFileDialog
+ SaveFileDialog sfd = new SaveFileDialog();
+
+ sfd.FileName = "Process Hacker Log.txt";
+ sfd.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
+
+ if (sfd.ShowDialog() == DialogResult.OK)
{
- FileName = "Process Hacker Log.txt",
- Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
- })
- {
- if (sfd.ShowDialog() == DialogResult.OK)
+ StringBuilder sb = new StringBuilder();
+
+ foreach (var value in Program.HackerWindow.Log)
{
- StringBuilder sb = new StringBuilder();
+ sb.AppendLine(value.Key.ToString() + ": " + value.Value);
+ }
- foreach (var value in Program.HackerWindow.Log)
- {
- sb.AppendLine(value.Key.ToString() + ": " + value.Value);
- }
-
- try
- {
- System.IO.File.WriteAllText(sfd.FileName, sb.ToString());
- }
- catch (Exception ex)
- {
- PhUtils.ShowException("Unable to save the log", ex);
- }
+ try
+ {
+ System.IO.File.WriteAllText(sfd.FileName, sb.ToString());
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowException("Unable to save the log", ex);
}
}
}
@@ -157,10 +157,9 @@ namespace ProcessHacker
private void listLog_DoubleClick(object sender, EventArgs e)
{
- using (InformationBox info = new InformationBox(Program.HackerWindow.Log[listLog.SelectedIndices[0]].Value))
- {
- info.ShowDialog();
- }
+ InformationBox info = new InformationBox(Program.HackerWindow.Log[listLog.SelectedIndices[0]].Value);
+
+ info.ShowDialog();
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/LogWindow.resx b/1.x/trunk/ProcessHacker/Forms/LogWindow.resx
index dd32a4d9f..c4b54ad1e 100644
--- a/1.x/trunk/ProcessHacker/Forms/LogWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/LogWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/MemoryEditor.Designer.cs b/1.x/trunk/ProcessHacker/Forms/MemoryEditor.Designer.cs
index 236fb809f..a4ab33a23 100644
--- a/1.x/trunk/ProcessHacker/Forms/MemoryEditor.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/MemoryEditor.Designer.cs
@@ -57,20 +57,22 @@ namespace ProcessHacker
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.windowMenuItem = new System.Windows.Forms.MenuItem();
this.buttonStruct = new System.Windows.Forms.Button();
- this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.hexBoxMemory = new Be.Windows.Forms.HexBox();
this.utilitiesButtonMemory = new ProcessHacker.Components.UtilitiesButton();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
+ this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// labelHexSelection
//
- this.labelHexSelection.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelHexSelection.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelHexSelection.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.labelHexSelection.Location = new System.Drawing.Point(12, 2);
this.labelHexSelection.Name = "labelHexSelection";
this.labelHexSelection.ReadOnly = true;
- this.labelHexSelection.Size = new System.Drawing.Size(751, 15);
+ this.labelHexSelection.Size = new System.Drawing.Size(751, 13);
this.labelHexSelection.TabIndex = 0;
this.labelHexSelection.Text = "Selection:";
//
@@ -78,7 +80,7 @@ namespace ProcessHacker
//
this.buttonValues.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonValues.Image = global::ProcessHacker.Properties.Resources.information;
- this.buttonValues.Location = new System.Drawing.Point(709, 202);
+ this.buttonValues.Location = new System.Drawing.Point(709, 328);
this.buttonValues.Name = "buttonValues";
this.buttonValues.Size = new System.Drawing.Size(24, 24);
this.buttonValues.TabIndex = 9;
@@ -90,7 +92,7 @@ namespace ProcessHacker
//
this.buttonGoToMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonGoToMemory.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonGoToMemory.Location = new System.Drawing.Point(275, 204);
+ this.buttonGoToMemory.Location = new System.Drawing.Point(275, 330);
this.buttonGoToMemory.Name = "buttonGoToMemory";
this.buttonGoToMemory.Size = new System.Drawing.Size(47, 23);
this.buttonGoToMemory.TabIndex = 7;
@@ -102,18 +104,18 @@ namespace ProcessHacker
// textGoTo
//
this.textGoTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.textGoTo.Location = new System.Drawing.Point(188, 206);
+ this.textGoTo.Location = new System.Drawing.Point(188, 332);
this.textGoTo.Name = "textGoTo";
- this.textGoTo.Size = new System.Drawing.Size(81, 22);
+ this.textGoTo.Size = new System.Drawing.Size(81, 20);
this.textGoTo.TabIndex = 6;
- this.textGoTo.Enter += new System.EventHandler(this.textGoTo_Enter);
this.textGoTo.Leave += new System.EventHandler(this.textGoTo_Leave);
+ this.textGoTo.Enter += new System.EventHandler(this.textGoTo_Enter);
//
// buttonTopFind
//
this.buttonTopFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonTopFind.Image = global::ProcessHacker.Properties.Resources.arrow_up;
- this.buttonTopFind.Location = new System.Drawing.Point(159, 204);
+ this.buttonTopFind.Location = new System.Drawing.Point(159, 330);
this.buttonTopFind.Name = "buttonTopFind";
this.buttonTopFind.Size = new System.Drawing.Size(23, 23);
this.buttonTopFind.TabIndex = 5;
@@ -125,7 +127,7 @@ namespace ProcessHacker
//
this.buttonNextFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonNextFind.Image = global::ProcessHacker.Properties.Resources.arrow_right;
- this.buttonNextFind.Location = new System.Drawing.Point(130, 204);
+ this.buttonNextFind.Location = new System.Drawing.Point(130, 330);
this.buttonNextFind.Name = "buttonNextFind";
this.buttonNextFind.Size = new System.Drawing.Size(23, 23);
this.buttonNextFind.TabIndex = 4;
@@ -136,21 +138,21 @@ namespace ProcessHacker
// textSearchMemory
//
this.textSearchMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.textSearchMemory.Location = new System.Drawing.Point(48, 206);
+ this.textSearchMemory.Location = new System.Drawing.Point(48, 332);
this.textSearchMemory.Name = "textSearchMemory";
- this.textSearchMemory.Size = new System.Drawing.Size(76, 22);
+ this.textSearchMemory.Size = new System.Drawing.Size(76, 20);
this.textSearchMemory.TabIndex = 3;
this.textSearchMemory.TextChanged += new System.EventHandler(this.textSearchMemory_TextChanged);
- this.textSearchMemory.Enter += new System.EventHandler(this.textSearchMemory_Enter);
this.textSearchMemory.Leave += new System.EventHandler(this.textSearchMemory_Leave);
+ this.textSearchMemory.Enter += new System.EventHandler(this.textSearchMemory_Enter);
//
// labelFind
//
this.labelFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelFind.AutoSize = true;
- this.labelFind.Location = new System.Drawing.Point(12, 209);
+ this.labelFind.Location = new System.Drawing.Point(12, 335);
this.labelFind.Name = "labelFind";
- this.labelFind.Size = new System.Drawing.Size(33, 13);
+ this.labelFind.Size = new System.Drawing.Size(30, 13);
this.labelFind.TabIndex = 2;
this.labelFind.Text = "Find:";
//
@@ -173,6 +175,7 @@ namespace ProcessHacker
//
// menuItem6
//
+ this.vistaMenu.SetImage(this.menuItem6, global::ProcessHacker.Properties.Resources.page);
this.menuItem6.Index = 0;
this.menuItem6.Shortcut = System.Windows.Forms.Shortcut.F5;
this.menuItem6.Text = "&Read";
@@ -180,12 +183,14 @@ namespace ProcessHacker
//
// writeMenuItem
//
+ this.vistaMenu.SetImage(this.writeMenuItem, global::ProcessHacker.Properties.Resources.page_edit);
this.writeMenuItem.Index = 1;
this.writeMenuItem.Text = "&Write";
this.writeMenuItem.Click += new System.EventHandler(this.writeMenuItem_Click);
//
// menuItem2
//
+ this.vistaMenu.SetImage(this.menuItem2, global::ProcessHacker.Properties.Resources.disk);
this.menuItem2.Index = 2;
this.menuItem2.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
this.menuItem2.Text = "&Save...";
@@ -198,6 +203,7 @@ namespace ProcessHacker
//
// menuItem4
//
+ this.vistaMenu.SetImage(this.menuItem4, global::ProcessHacker.Properties.Resources.door_out);
this.menuItem4.Index = 4;
this.menuItem4.Text = "&Close";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
@@ -211,7 +217,7 @@ namespace ProcessHacker
//
this.buttonStruct.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonStruct.Image = global::ProcessHacker.Properties.Resources.bricks;
- this.buttonStruct.Location = new System.Drawing.Point(679, 202);
+ this.buttonStruct.Location = new System.Drawing.Point(679, 328);
this.buttonStruct.Name = "buttonStruct";
this.buttonStruct.Size = new System.Drawing.Size(24, 24);
this.buttonStruct.TabIndex = 8;
@@ -221,9 +227,9 @@ namespace ProcessHacker
//
// hexBoxMemory
//
- this.hexBoxMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.hexBoxMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.hexBoxMemory.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hexBoxMemory.HexCasing = Be.Windows.Forms.HexCasing.Lower;
this.hexBoxMemory.LineInfoForeColor = System.Drawing.Color.Empty;
@@ -231,7 +237,7 @@ namespace ProcessHacker
this.hexBoxMemory.Location = new System.Drawing.Point(12, 21);
this.hexBoxMemory.Name = "hexBoxMemory";
this.hexBoxMemory.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
- this.hexBoxMemory.Size = new System.Drawing.Size(751, 175);
+ this.hexBoxMemory.Size = new System.Drawing.Size(751, 301);
this.hexBoxMemory.StringViewVisible = true;
this.hexBoxMemory.TabIndex = 1;
this.hexBoxMemory.UseFixedBytesPerLine = true;
@@ -243,18 +249,22 @@ namespace ProcessHacker
//
this.utilitiesButtonMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.utilitiesButtonMemory.HexBox = this.hexBoxMemory;
- this.utilitiesButtonMemory.Location = new System.Drawing.Point(739, 202);
+ this.utilitiesButtonMemory.Location = new System.Drawing.Point(739, 328);
this.utilitiesButtonMemory.Name = "utilitiesButtonMemory";
this.utilitiesButtonMemory.Size = new System.Drawing.Size(24, 24);
this.utilitiesButtonMemory.TabIndex = 10;
this.toolTip.SetToolTip(this.utilitiesButtonMemory, "Insert Data");
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// MemoryEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(775, 238);
+ this.ClientSize = new System.Drawing.Size(775, 364);
this.Controls.Add(this.hexBoxMemory);
this.Controls.Add(this.labelFind);
this.Controls.Add(this.utilitiesButtonMemory);
@@ -270,8 +280,9 @@ namespace ProcessHacker
this.Menu = this.mainMenu;
this.Name = "MemoryEditor";
this.Text = "Memory Editor";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MemoryEditor_FormClosing);
this.Load += new System.EventHandler(this.MemoryEditor_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MemoryEditor_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -292,6 +303,7 @@ namespace ProcessHacker
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.MenuItem writeMenuItem;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem4;
diff --git a/1.x/trunk/ProcessHacker/Forms/MemoryEditor.cs b/1.x/trunk/ProcessHacker/Forms/MemoryEditor.cs
index 6ae3c4f61..4df828dd8 100644
--- a/1.x/trunk/ProcessHacker/Forms/MemoryEditor.cs
+++ b/1.x/trunk/ProcessHacker/Forms/MemoryEditor.cs
@@ -34,23 +34,28 @@ namespace ProcessHacker
{
public static MemoryEditor ReadWriteMemory(int pid, IntPtr address, int size, bool RO)
{
- return ReadWriteMemory(pid, address, size, RO, editor => { });
+ return ReadWriteMemory(pid, address, size, RO,
+ new Program.MemoryEditorInvokeAction(delegate(MemoryEditor f) { }));
}
- public static MemoryEditor ReadWriteMemory(int pid, IntPtr address, int size, bool RO, Program.MemoryEditorInvokeAction action)
+ public static MemoryEditor ReadWriteMemory(int pid, IntPtr address, int size, bool RO,
+ Program.MemoryEditorInvokeAction action)
{
try
{
- MemoryEditor ed = Program.GetMemoryEditor(pid, address, size, f =>
- {
- if (!f.IsDisposed)
+ MemoryEditor ed = null;
+
+ ed = Program.GetMemoryEditor(pid, address, size,
+ new Program.MemoryEditorInvokeAction(delegate(MemoryEditor f)
{
- f.ReadOnly = RO;
- f.Show();
- action(f);
- f.Activate();
- }
- });
+ if (!f.IsDisposed)
+ {
+ f.ReadOnly = RO;
+ f.Show();
+ action(f);
+ f.Activate();
+ }
+ }));
return ed;
}
@@ -60,8 +65,8 @@ namespace ProcessHacker
}
}
- private readonly int _pid;
- private readonly long _length;
+ private int _pid;
+ private long _length;
private IntPtr _address;
private byte[] _data;
@@ -110,9 +115,10 @@ namespace ProcessHacker
private void MemoryEditor_Load(object sender, EventArgs e)
{
- //Program.UpdateWindowMenu(windowMenuItem, this);
+ Program.UpdateWindowMenu(windowMenuItem, this);
this.Size = Settings.Instance.MemoryWindowSize;
+ this.SetPhParent(false);
}
private void MemoryEditor_FormClosing(object sender, FormClosingEventArgs e)
@@ -155,7 +161,7 @@ namespace ProcessHacker
private void ReadMemory()
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessReadMemoryRights))
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessReadMemoryRights))
{
_data = new byte[_length];
@@ -182,7 +188,7 @@ namespace ProcessHacker
private void buttonValues_Click(object sender, EventArgs e)
{
- string values = string.Empty;
+ string values = "";
InformationBox valuesForm;
long addr = hexBoxMemory.SelectionStart;
long space = hexBoxMemory.ByteProvider.Length - hexBoxMemory.SelectionStart;
@@ -301,9 +307,9 @@ namespace ProcessHacker
try
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
{
- string fileName = phandle.ImageFileName;
+ string fileName = phandle.GetImageFileName();
sfd.FileName = fileName.Substring(fileName.LastIndexOf('\\') + 1) + "-" + Utils.FormatAddress(_address) + ".bin";
}
@@ -403,12 +409,19 @@ namespace ProcessHacker
if (Program.Structs.ContainsKey(lpw.SelectedItem))
{
// stupid TreeViewAdv only works on the one thread
- Program.HackerWindow.BeginInvoke(new MethodInvoker(() =>
- {
- StructWindow sw = new StructWindow(this._pid, (this._address.Increment(selectionStart)), Program.Structs[lpw.SelectedItem]);
- sw.Show();
- sw.Activate();
- }));
+ Program.HackerWindow.BeginInvoke(new MethodInvoker(delegate
+ {
+ StructWindow sw = new StructWindow(_pid, (_address.Increment(selectionStart)),
+ Program.Structs[lpw.SelectedItem]);
+
+ try
+ {
+ sw.Show();
+ sw.Activate();
+ }
+ catch
+ { }
+ }));
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/MemoryEditor.resx b/1.x/trunk/ProcessHacker/Forms/MemoryEditor.resx
index 01d2c7ff3..434f2b895 100644
--- a/1.x/trunk/ProcessHacker/Forms/MemoryEditor.resx
+++ b/1.x/trunk/ProcessHacker/Forms/MemoryEditor.resx
@@ -112,18 +112,21 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
235, 17
-
+
17, 17
-
+
+ 127, 17
+
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.Designer.cs
index 093bd7f7f..0ba239b6a 100644
--- a/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.Designer.cs
@@ -45,7 +45,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(31, 13);
+ this.label1.Size = new System.Drawing.Size(30, 13);
this.label1.TabIndex = 6;
this.label1.Text = "Title:";
//
@@ -54,24 +54,24 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 41);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(30, 13);
+ this.label2.Size = new System.Drawing.Size(31, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Text:";
//
// textTitle
//
- this.textTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textTitle.Location = new System.Drawing.Point(49, 12);
this.textTitle.Name = "textTitle";
- this.textTitle.Size = new System.Drawing.Size(354, 22);
+ this.textTitle.Size = new System.Drawing.Size(354, 20);
this.textTitle.TabIndex = 0;
//
// textText
//
- this.textText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textText.Location = new System.Drawing.Point(49, 38);
this.textText.Multiline = true;
this.textText.Name = "textText";
@@ -84,7 +84,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 155);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(32, 13);
+ this.label3.Size = new System.Drawing.Size(31, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Icon:";
//
@@ -94,14 +94,14 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 182);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(65, 13);
+ this.label4.Size = new System.Drawing.Size(62, 13);
this.label4.TabIndex = 9;
this.label4.Text = "Timeout (s):";
//
// comboIcon
//
- this.comboIcon.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.comboIcon.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.comboIcon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboIcon.FormattingEnabled = true;
this.comboIcon.Items.AddRange(new object[] {
@@ -120,7 +120,7 @@
this.textTimeout.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textTimeout.Location = new System.Drawing.Point(80, 179);
this.textTimeout.Name = "textTimeout";
- this.textTimeout.Size = new System.Drawing.Size(100, 22);
+ this.textTimeout.Size = new System.Drawing.Size(100, 20);
this.textTimeout.TabIndex = 3;
//
// buttonCancel
@@ -152,7 +152,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(415, 240);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
diff --git a/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.resx b/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/MessageBoxWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/MiniSysInfo.cs b/1.x/trunk/ProcessHacker/Forms/MiniSysInfo.cs
index 1a39ae3b5..b213852ab 100644
--- a/1.x/trunk/ProcessHacker/Forms/MiniSysInfo.cs
+++ b/1.x/trunk/ProcessHacker/Forms/MiniSysInfo.cs
@@ -42,13 +42,7 @@ namespace ProcessHacker
[DllImport("dwmapi.dll", SetLastError = true)]
static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS inset);
- readonly MARGINS margins = new MARGINS
- {
- Left = -1,
- Right = -1,
- Top = -1,
- Bottom = -1
- };
+ MARGINS margins = new MARGINS() { Left = -1, Right = -1, Top = -1, Bottom = -1 };
public MiniSysInfo()
{
@@ -68,7 +62,7 @@ namespace ProcessHacker
plotterIO.LongData1 = Program.ProcessProvider.IoReadOtherHistory;
plotterIO.LongData2 = Program.ProcessProvider.IoWriteHistory;
- Program.ProcessProvider.Updated += this.ProcessProvider_Updated;
+ Program.ProcessProvider.Updated += new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
}
protected override void WndProc(ref Message m)
@@ -91,22 +85,22 @@ namespace ProcessHacker
private void MiniSysInfo_FormClosing(object sender, FormClosingEventArgs e)
{
- Program.ProcessProvider.Updated -= this.ProcessProvider_Updated;
+ Program.ProcessProvider.Updated -= new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
}
private void ProcessProvider_Updated()
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- this.plotterCPU.LineColor1 = Settings.Instance.PlotterCPUKernelColor;
- this.plotterCPU.LineColor2 = Settings.Instance.PlotterCPUUserColor;
- this.plotterCPU.MoveGrid();
- this.plotterCPU.Draw();
+ plotterCPU.LineColor1 = Settings.Instance.PlotterCPUKernelColor;
+ plotterCPU.LineColor2 = Settings.Instance.PlotterCPUUserColor;
+ plotterCPU.MoveGrid();
+ plotterCPU.Draw();
- this.plotterIO.LineColor1 = Settings.Instance.PlotterIOROColor;
- this.plotterIO.LineColor2 = Settings.Instance.PlotterIOWColor;
- this.plotterIO.MoveGrid();
- this.plotterIO.Draw();
+ plotterIO.LineColor1 = Settings.Instance.PlotterIOROColor;
+ plotterIO.LineColor2 = Settings.Instance.PlotterIOWColor;
+ plotterIO.MoveGrid();
+ plotterIO.Draw();
}));
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.Designer.cs
index 089da0f73..549b40492 100644
--- a/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.Designer.cs
@@ -46,7 +46,6 @@
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.plotter1 = new ProcessHacker.Components.Plotter();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
@@ -60,6 +59,7 @@
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
+ this.plotter1 = new ProcessHacker.Components.Plotter();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -94,7 +94,7 @@
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(122, 157);
this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(44, 13);
+ this.label15.Size = new System.Drawing.Size(41, 13);
this.label15.TabIndex = 14;
this.label15.Text = "label15";
//
@@ -103,7 +103,7 @@
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(122, 133);
this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(44, 13);
+ this.label14.Size = new System.Drawing.Size(41, 13);
this.label14.TabIndex = 13;
this.label14.Text = "label14";
//
@@ -112,7 +112,7 @@
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(122, 105);
this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(44, 13);
+ this.label13.Size = new System.Drawing.Size(41, 13);
this.label13.TabIndex = 12;
this.label13.Text = "label13";
//
@@ -121,7 +121,7 @@
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(6, 157);
this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(44, 13);
+ this.label12.Size = new System.Drawing.Size(41, 13);
this.label12.TabIndex = 11;
this.label12.Text = "label12";
//
@@ -130,7 +130,7 @@
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(6, 133);
this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(44, 13);
+ this.label11.Size = new System.Drawing.Size(41, 13);
this.label11.TabIndex = 10;
this.label11.Text = "label11";
//
@@ -139,7 +139,7 @@
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 105);
this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(44, 13);
+ this.label10.Size = new System.Drawing.Size(41, 13);
this.label10.TabIndex = 9;
this.label10.Text = "label10";
//
@@ -148,7 +148,7 @@
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(231, 75);
this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(38, 13);
+ this.label9.Size = new System.Drawing.Size(35, 13);
this.label9.TabIndex = 8;
this.label9.Text = "label9";
//
@@ -157,7 +157,7 @@
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(231, 51);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(38, 13);
+ this.label8.Size = new System.Drawing.Size(35, 13);
this.label8.TabIndex = 7;
this.label8.Text = "label8";
//
@@ -166,7 +166,7 @@
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(231, 28);
this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(38, 13);
+ this.label7.Size = new System.Drawing.Size(35, 13);
this.label7.TabIndex = 6;
this.label7.Text = "label7";
//
@@ -175,7 +175,7 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(122, 75);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(38, 13);
+ this.label6.Size = new System.Drawing.Size(35, 13);
this.label6.TabIndex = 5;
this.label6.Text = "label6";
//
@@ -184,7 +184,7 @@
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(122, 51);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(38, 13);
+ this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 4;
this.label5.Text = "label5";
//
@@ -193,7 +193,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(122, 28);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(38, 13);
+ this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 3;
this.label4.Text = "label4";
//
@@ -202,7 +202,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 75);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(38, 13);
+ this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 2;
this.label3.Text = "label3";
//
@@ -211,7 +211,7 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 51);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(38, 13);
+ this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 1;
this.label2.Text = "label2";
//
@@ -220,7 +220,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 28);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(38, 13);
+ this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
@@ -234,6 +234,125 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Network Usage";
//
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.label20);
+ this.groupBox3.Controls.Add(this.label19);
+ this.groupBox3.Controls.Add(this.label18);
+ this.groupBox3.Controls.Add(this.label17);
+ this.groupBox3.Controls.Add(this.label16);
+ this.groupBox3.Location = new System.Drawing.Point(373, 111);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(190, 186);
+ this.groupBox3.TabIndex = 3;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "UDP Stats";
+ //
+ // label20
+ //
+ this.label20.AutoSize = true;
+ this.label20.Location = new System.Drawing.Point(6, 105);
+ this.label20.Name = "label20";
+ this.label20.Size = new System.Drawing.Size(41, 13);
+ this.label20.TabIndex = 11;
+ this.label20.Text = "label20";
+ //
+ // label19
+ //
+ this.label19.AutoSize = true;
+ this.label19.Location = new System.Drawing.Point(114, 28);
+ this.label19.Name = "label19";
+ this.label19.Size = new System.Drawing.Size(41, 13);
+ this.label19.TabIndex = 10;
+ this.label19.Text = "label19";
+ //
+ // label18
+ //
+ this.label18.AutoSize = true;
+ this.label18.Location = new System.Drawing.Point(114, 64);
+ this.label18.Name = "label18";
+ this.label18.Size = new System.Drawing.Size(41, 13);
+ this.label18.TabIndex = 9;
+ this.label18.Text = "label18";
+ //
+ // label17
+ //
+ this.label17.AutoSize = true;
+ this.label17.Location = new System.Drawing.Point(6, 64);
+ this.label17.Name = "label17";
+ this.label17.Size = new System.Drawing.Size(41, 13);
+ this.label17.TabIndex = 8;
+ this.label17.Text = "label17";
+ //
+ // label16
+ //
+ this.label16.AutoSize = true;
+ this.label16.Location = new System.Drawing.Point(6, 28);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(41, 13);
+ this.label16.TabIndex = 7;
+ this.label16.Text = "label16";
+ //
+ // timer1
+ //
+ this.timer1.Enabled = true;
+ this.timer1.Interval = 1000;
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ //
+ // label21
+ //
+ this.label21.AutoSize = true;
+ this.label21.Location = new System.Drawing.Point(18, 309);
+ this.label21.Name = "label21";
+ this.label21.Size = new System.Drawing.Size(41, 13);
+ this.label21.TabIndex = 16;
+ this.label21.Text = "label21";
+ //
+ // label22
+ //
+ this.label22.AutoSize = true;
+ this.label22.Location = new System.Drawing.Point(18, 331);
+ this.label22.Name = "label22";
+ this.label22.Size = new System.Drawing.Size(41, 13);
+ this.label22.TabIndex = 15;
+ this.label22.Text = "label22";
+ //
+ // label23
+ //
+ this.label23.AutoSize = true;
+ this.label23.Location = new System.Drawing.Point(169, 309);
+ this.label23.Name = "label23";
+ this.label23.Size = new System.Drawing.Size(41, 13);
+ this.label23.TabIndex = 18;
+ this.label23.Text = "label23";
+ //
+ // label24
+ //
+ this.label24.AutoSize = true;
+ this.label24.Location = new System.Drawing.Point(169, 331);
+ this.label24.Name = "label24";
+ this.label24.Size = new System.Drawing.Size(41, 13);
+ this.label24.TabIndex = 17;
+ this.label24.Text = "label24";
+ //
+ // label25
+ //
+ this.label25.AutoSize = true;
+ this.label25.Location = new System.Drawing.Point(308, 309);
+ this.label25.Name = "label25";
+ this.label25.Size = new System.Drawing.Size(41, 13);
+ this.label25.TabIndex = 20;
+ this.label25.Text = "label25";
+ //
+ // label26
+ //
+ this.label26.AutoSize = true;
+ this.label26.Location = new System.Drawing.Point(308, 331);
+ this.label26.Name = "label26";
+ this.label26.Size = new System.Drawing.Size(41, 13);
+ this.label26.TabIndex = 19;
+ this.label26.Text = "label26";
+ //
// plotter1
//
this.plotter1.BackColor = System.Drawing.Color.Black;
@@ -261,130 +380,10 @@
this.plotter1.UseLongData = false;
this.plotter1.UseSecondLine = true;
//
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.label20);
- this.groupBox3.Controls.Add(this.label19);
- this.groupBox3.Controls.Add(this.label18);
- this.groupBox3.Controls.Add(this.label17);
- this.groupBox3.Controls.Add(this.label16);
- this.groupBox3.Location = new System.Drawing.Point(373, 111);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(190, 186);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "UDP Stats";
- //
- // label20
- //
- this.label20.AutoSize = true;
- this.label20.Location = new System.Drawing.Point(6, 105);
- this.label20.Name = "label20";
- this.label20.Size = new System.Drawing.Size(44, 13);
- this.label20.TabIndex = 11;
- this.label20.Text = "label20";
- //
- // label19
- //
- this.label19.AutoSize = true;
- this.label19.Location = new System.Drawing.Point(114, 28);
- this.label19.Name = "label19";
- this.label19.Size = new System.Drawing.Size(44, 13);
- this.label19.TabIndex = 10;
- this.label19.Text = "label19";
- //
- // label18
- //
- this.label18.AutoSize = true;
- this.label18.Location = new System.Drawing.Point(114, 64);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(44, 13);
- this.label18.TabIndex = 9;
- this.label18.Text = "label18";
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(6, 64);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(44, 13);
- this.label17.TabIndex = 8;
- this.label17.Text = "label17";
- //
- // label16
- //
- this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(6, 28);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(44, 13);
- this.label16.TabIndex = 7;
- this.label16.Text = "label16";
- //
- // timer1
- //
- this.timer1.Enabled = true;
- this.timer1.Interval = 1000;
- this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
- //
- // label21
- //
- this.label21.AutoSize = true;
- this.label21.Location = new System.Drawing.Point(18, 309);
- this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(44, 13);
- this.label21.TabIndex = 16;
- this.label21.Text = "label21";
- //
- // label22
- //
- this.label22.AutoSize = true;
- this.label22.Location = new System.Drawing.Point(18, 331);
- this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(44, 13);
- this.label22.TabIndex = 15;
- this.label22.Text = "label22";
- //
- // label23
- //
- this.label23.AutoSize = true;
- this.label23.Location = new System.Drawing.Point(169, 309);
- this.label23.Name = "label23";
- this.label23.Size = new System.Drawing.Size(44, 13);
- this.label23.TabIndex = 18;
- this.label23.Text = "label23";
- //
- // label24
- //
- this.label24.AutoSize = true;
- this.label24.Location = new System.Drawing.Point(169, 331);
- this.label24.Name = "label24";
- this.label24.Size = new System.Drawing.Size(44, 13);
- this.label24.TabIndex = 17;
- this.label24.Text = "label24";
- //
- // label25
- //
- this.label25.AutoSize = true;
- this.label25.Location = new System.Drawing.Point(308, 309);
- this.label25.Name = "label25";
- this.label25.Size = new System.Drawing.Size(44, 13);
- this.label25.TabIndex = 20;
- this.label25.Text = "label25";
- //
- // label26
- //
- this.label26.AutoSize = true;
- this.label26.Location = new System.Drawing.Point(308, 331);
- this.label26.Name = "label26";
- this.label26.Size = new System.Drawing.Size(44, 13);
- this.label26.TabIndex = 19;
- this.label26.Text = "label26";
- //
// NetInfoWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(573, 353);
this.Controls.Add(this.label25);
this.Controls.Add(this.label26);
diff --git a/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.cs b/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.cs
index c254f01ac..9ec37bffd 100644
--- a/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.cs
@@ -251,9 +251,9 @@ public class NetworkInformation
///
public class NetworkMonitor
{
- private readonly System.Timers.Timer timer; // The timer event executes every second to refresh the values in adapters.
- private readonly ArrayList adapters; // The list of adapters on the computer.
- private readonly ArrayList monitoredAdapters; // The list of currently monitored adapters.
+ private System.Timers.Timer timer; // The timer event executes every second to refresh the values in adapters.
+ private ArrayList adapters; // The list of adapters on the computer.
+ private ArrayList monitoredAdapters; // The list of currently monitored adapters.
///
/// NetworkMonitor
@@ -265,7 +265,7 @@ public class NetworkMonitor
this.EnumerateNetworkAdapters();
this.timer = new System.Timers.Timer(1000);
- this.timer.Elapsed += this.timer_Elapsed;
+ this.timer.Elapsed += new ElapsedEventHandler(this.timer_Elapsed);
}
///
diff --git a/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.resx b/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.resx
index bb3c53021..93f75a972 100644
--- a/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/NetInfoWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs
index a59f10aff..d0d92eca5 100644
--- a/1.x/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs
@@ -39,6 +39,7 @@
this.tabGeneral = new System.Windows.Forms.TabPage();
this.label20 = new System.Windows.Forms.Label();
this.comboToolbarStyle = new System.Windows.Forms.ComboBox();
+ this.checkFloatChildWindows = new System.Windows.Forms.CheckBox();
this.checkScrollDownProcessTree = new System.Windows.Forms.CheckBox();
this.checkAllowOnlyOneInstance = new System.Windows.Forms.CheckBox();
this.buttonFont = new System.Windows.Forms.Button();
@@ -67,10 +68,14 @@
this.label11 = new System.Windows.Forms.Label();
this.buttonDisableAll = new System.Windows.Forms.Button();
this.buttonEnableAll = new System.Windows.Forms.Button();
+ this.listHighlightingColors = new ProcessHacker.Components.ExtendedListView();
+ this.columnDescription = new System.Windows.Forms.ColumnHeader();
this.textHighlightingDuration = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
+ this.colorRemovedProcesses = new ProcessHacker.Components.ColorModifier();
+ this.colorNewProcesses = new ProcessHacker.Components.ColorModifier();
this.tabPlotting = new System.Windows.Forms.TabPage();
this.textStep = new System.Windows.Forms.NumericUpDown();
this.label8 = new System.Windows.Forms.Label();
@@ -81,6 +86,12 @@
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
+ this.colorIORO = new ProcessHacker.Components.ColorModifier();
+ this.colorIOW = new ProcessHacker.Components.ColorModifier();
+ this.colorMemoryWS = new ProcessHacker.Components.ColorModifier();
+ this.colorMemoryPB = new ProcessHacker.Components.ColorModifier();
+ this.colorCPUUT = new ProcessHacker.Components.ColorModifier();
+ this.colorCPUKT = new ProcessHacker.Components.ColorModifier();
this.tabSymbols = new System.Windows.Forms.TabPage();
this.checkUndecorate = new System.Windows.Forms.CheckBox();
this.textSearchPath = new System.Windows.Forms.TextBox();
@@ -97,16 +108,6 @@
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonApply = new System.Windows.Forms.Button();
this.buttonReset = new System.Windows.Forms.Button();
- this.listHighlightingColors = new ProcessHacker.Components.ExtendedListView();
- this.columnDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.colorRemovedProcesses = new ProcessHacker.Components.ColorModifier();
- this.colorNewProcesses = new ProcessHacker.Components.ColorModifier();
- this.colorIORO = new ProcessHacker.Components.ColorModifier();
- this.colorIOW = new ProcessHacker.Components.ColorModifier();
- this.colorMemoryWS = new ProcessHacker.Components.ColorModifier();
- this.colorMemoryPB = new ProcessHacker.Components.ColorModifier();
- this.colorCPUUT = new ProcessHacker.Components.ColorModifier();
- this.colorCPUKT = new ProcessHacker.Components.ColorModifier();
((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).BeginInit();
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
@@ -137,7 +138,7 @@
0,
0,
0});
- this.textUpdateInterval.Location = new System.Drawing.Point(136, 6);
+ this.textUpdateInterval.Location = new System.Drawing.Point(134, 6);
this.textUpdateInterval.Maximum = new decimal(new int[] {
10000,
0,
@@ -203,18 +204,18 @@
//
// textSearchEngine
//
- this.textSearchEngine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textSearchEngine.Location = new System.Drawing.Point(136, 58);
+ this.textSearchEngine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textSearchEngine.Location = new System.Drawing.Point(134, 58);
this.textSearchEngine.Name = "textSearchEngine";
- this.textSearchEngine.Size = new System.Drawing.Size(339, 20);
+ this.textSearchEngine.Size = new System.Drawing.Size(341, 20);
this.textSearchEngine.TabIndex = 2;
//
// tabControl
//
- this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tabGeneral);
this.tabControl.Controls.Add(this.tabAdvanced);
this.tabControl.Controls.Add(this.tabHighlighting);
@@ -231,6 +232,7 @@
//
this.tabGeneral.Controls.Add(this.label20);
this.tabGeneral.Controls.Add(this.comboToolbarStyle);
+ this.tabGeneral.Controls.Add(this.checkFloatChildWindows);
this.tabGeneral.Controls.Add(this.checkScrollDownProcessTree);
this.tabGeneral.Controls.Add(this.checkAllowOnlyOneInstance);
this.tabGeneral.Controls.Add(this.buttonFont);
@@ -279,6 +281,17 @@
this.comboToolbarStyle.Size = new System.Drawing.Size(135, 21);
this.comboToolbarStyle.TabIndex = 18;
//
+ // checkFloatChildWindows
+ //
+ this.checkFloatChildWindows.AutoSize = true;
+ this.checkFloatChildWindows.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.checkFloatChildWindows.Location = new System.Drawing.Point(211, 199);
+ this.checkFloatChildWindows.Name = "checkFloatChildWindows";
+ this.checkFloatChildWindows.Size = new System.Drawing.Size(124, 18);
+ this.checkFloatChildWindows.TabIndex = 10;
+ this.checkFloatChildWindows.Text = "Float child windows";
+ this.checkFloatChildWindows.UseVisualStyleBackColor = true;
+ //
// checkScrollDownProcessTree
//
this.checkScrollDownProcessTree.AutoSize = true;
@@ -314,11 +327,11 @@
//
// textImposterNames
//
- this.textImposterNames.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textImposterNames.Location = new System.Drawing.Point(136, 84);
+ this.textImposterNames.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textImposterNames.Location = new System.Drawing.Point(134, 84);
this.textImposterNames.Name = "textImposterNames";
- this.textImposterNames.Size = new System.Drawing.Size(339, 20);
+ this.textImposterNames.Size = new System.Drawing.Size(341, 20);
this.textImposterNames.TabIndex = 3;
//
// label21
@@ -401,7 +414,7 @@
//
// textIconMenuProcesses
//
- this.textIconMenuProcesses.Location = new System.Drawing.Point(136, 32);
+ this.textIconMenuProcesses.Location = new System.Drawing.Point(134, 32);
this.textIconMenuProcesses.Minimum = new decimal(new int[] {
1,
0,
@@ -434,7 +447,7 @@
this.tabAdvanced.Location = new System.Drawing.Point(4, 22);
this.tabAdvanced.Name = "tabAdvanced";
this.tabAdvanced.Padding = new System.Windows.Forms.Padding(3);
- this.tabAdvanced.Size = new System.Drawing.Size(481, 306);
+ this.tabAdvanced.Size = new System.Drawing.Size(481, 333);
this.tabAdvanced.TabIndex = 3;
this.tabAdvanced.Text = "Advanced";
this.tabAdvanced.UseVisualStyleBackColor = true;
@@ -590,7 +603,7 @@
this.tabHighlighting.Location = new System.Drawing.Point(4, 22);
this.tabHighlighting.Name = "tabHighlighting";
this.tabHighlighting.Padding = new System.Windows.Forms.Padding(3);
- this.tabHighlighting.Size = new System.Drawing.Size(481, 306);
+ this.tabHighlighting.Size = new System.Drawing.Size(481, 333);
this.tabHighlighting.TabIndex = 1;
this.tabHighlighting.Text = "Highlighting";
this.tabHighlighting.UseVisualStyleBackColor = true;
@@ -629,6 +642,33 @@
this.buttonEnableAll.UseVisualStyleBackColor = true;
this.buttonEnableAll.Click += new System.EventHandler(this.buttonEnableAll_Click);
//
+ // listHighlightingColors
+ //
+ this.listHighlightingColors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.listHighlightingColors.CheckBoxes = true;
+ this.listHighlightingColors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnDescription});
+ this.listHighlightingColors.DoubleClickChecks = false;
+ this.listHighlightingColors.FullRowSelect = true;
+ this.listHighlightingColors.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+ this.listHighlightingColors.HideSelection = false;
+ this.listHighlightingColors.Location = new System.Drawing.Point(6, 60);
+ this.listHighlightingColors.MultiSelect = false;
+ this.listHighlightingColors.Name = "listHighlightingColors";
+ this.listHighlightingColors.ShowItemToolTips = true;
+ this.listHighlightingColors.Size = new System.Drawing.Size(469, 238);
+ this.listHighlightingColors.TabIndex = 3;
+ this.listHighlightingColors.UseCompatibleStateImageBehavior = false;
+ this.listHighlightingColors.View = System.Windows.Forms.View.Details;
+ this.listHighlightingColors.DoubleClick += new System.EventHandler(this.listHighlightingColors_DoubleClick);
+ //
+ // columnDescription
+ //
+ this.columnDescription.Text = "Description";
+ this.columnDescription.Width = 250;
+ //
// textHighlightingDuration
//
this.textHighlightingDuration.Increment = new decimal(new int[] {
@@ -636,7 +676,7 @@
0,
0,
0});
- this.textHighlightingDuration.Location = new System.Drawing.Point(130, 7);
+ this.textHighlightingDuration.Location = new System.Drawing.Point(127, 7);
this.textHighlightingDuration.Maximum = new decimal(new int[] {
10000,
0,
@@ -683,6 +723,22 @@
this.label3.TabIndex = 7;
this.label3.Text = "New Objects:";
//
+ // colorRemovedProcesses
+ //
+ this.colorRemovedProcesses.Color = System.Drawing.Color.Transparent;
+ this.colorRemovedProcesses.Location = new System.Drawing.Point(351, 34);
+ this.colorRemovedProcesses.Name = "colorRemovedProcesses";
+ this.colorRemovedProcesses.Size = new System.Drawing.Size(40, 20);
+ this.colorRemovedProcesses.TabIndex = 2;
+ //
+ // colorNewProcesses
+ //
+ this.colorNewProcesses.Color = System.Drawing.Color.Transparent;
+ this.colorNewProcesses.Location = new System.Drawing.Point(127, 33);
+ this.colorNewProcesses.Name = "colorNewProcesses";
+ this.colorNewProcesses.Size = new System.Drawing.Size(40, 20);
+ this.colorNewProcesses.TabIndex = 1;
+ //
// tabPlotting
//
this.tabPlotting.Controls.Add(this.textStep);
@@ -703,14 +759,14 @@
this.tabPlotting.Location = new System.Drawing.Point(4, 22);
this.tabPlotting.Name = "tabPlotting";
this.tabPlotting.Padding = new System.Windows.Forms.Padding(3);
- this.tabPlotting.Size = new System.Drawing.Size(481, 306);
+ this.tabPlotting.Size = new System.Drawing.Size(481, 333);
this.tabPlotting.TabIndex = 2;
this.tabPlotting.Text = "Plotting";
this.tabPlotting.UseVisualStyleBackColor = true;
//
// textStep
//
- this.textStep.Location = new System.Drawing.Point(44, 6);
+ this.textStep.Location = new System.Drawing.Point(44, 30);
this.textStep.Minimum = new decimal(new int[] {
1,
0,
@@ -728,7 +784,7 @@
// label8
//
this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(6, 8);
+ this.label8.Location = new System.Drawing.Point(6, 32);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(32, 13);
this.label8.TabIndex = 8;
@@ -738,7 +794,7 @@
//
this.checkPlotterAntialias.AutoSize = true;
this.checkPlotterAntialias.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.checkPlotterAntialias.Location = new System.Drawing.Point(124, 8);
+ this.checkPlotterAntialias.Location = new System.Drawing.Point(6, 6);
this.checkPlotterAntialias.Name = "checkPlotterAntialias";
this.checkPlotterAntialias.Size = new System.Drawing.Size(110, 18);
this.checkPlotterAntialias.TabIndex = 0;
@@ -748,7 +804,7 @@
// label12
//
this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(6, 141);
+ this.label12.Location = new System.Drawing.Point(6, 165);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(92, 13);
this.label12.TabIndex = 13;
@@ -757,7 +813,7 @@
// label13
//
this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(6, 166);
+ this.label13.Location = new System.Drawing.Point(6, 190);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(59, 13);
this.label13.TabIndex = 14;
@@ -766,7 +822,7 @@
// label14
//
this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(6, 115);
+ this.label14.Location = new System.Drawing.Point(6, 139);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(69, 13);
this.label14.TabIndex = 12;
@@ -775,7 +831,7 @@
// label15
//
this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(6, 89);
+ this.label15.Location = new System.Drawing.Point(6, 113);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(72, 13);
this.label15.TabIndex = 11;
@@ -784,7 +840,7 @@
// label16
//
this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(6, 64);
+ this.label16.Location = new System.Drawing.Point(6, 88);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(83, 13);
this.label16.TabIndex = 10;
@@ -793,12 +849,60 @@
// label17
//
this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(6, 38);
+ this.label17.Location = new System.Drawing.Point(6, 62);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(91, 13);
this.label17.TabIndex = 9;
this.label17.Text = "CPU Kernel Time:";
//
+ // colorIORO
+ //
+ this.colorIORO.Color = System.Drawing.Color.Transparent;
+ this.colorIORO.Location = new System.Drawing.Point(124, 163);
+ this.colorIORO.Name = "colorIORO";
+ this.colorIORO.Size = new System.Drawing.Size(40, 20);
+ this.colorIORO.TabIndex = 6;
+ //
+ // colorIOW
+ //
+ this.colorIOW.Color = System.Drawing.Color.Transparent;
+ this.colorIOW.Location = new System.Drawing.Point(124, 189);
+ this.colorIOW.Name = "colorIOW";
+ this.colorIOW.Size = new System.Drawing.Size(40, 20);
+ this.colorIOW.TabIndex = 7;
+ //
+ // colorMemoryWS
+ //
+ this.colorMemoryWS.Color = System.Drawing.Color.Transparent;
+ this.colorMemoryWS.Location = new System.Drawing.Point(124, 137);
+ this.colorMemoryWS.Name = "colorMemoryWS";
+ this.colorMemoryWS.Size = new System.Drawing.Size(40, 20);
+ this.colorMemoryWS.TabIndex = 5;
+ //
+ // colorMemoryPB
+ //
+ this.colorMemoryPB.Color = System.Drawing.Color.Transparent;
+ this.colorMemoryPB.Location = new System.Drawing.Point(124, 111);
+ this.colorMemoryPB.Name = "colorMemoryPB";
+ this.colorMemoryPB.Size = new System.Drawing.Size(40, 20);
+ this.colorMemoryPB.TabIndex = 4;
+ //
+ // colorCPUUT
+ //
+ this.colorCPUUT.Color = System.Drawing.Color.Transparent;
+ this.colorCPUUT.Location = new System.Drawing.Point(124, 85);
+ this.colorCPUUT.Name = "colorCPUUT";
+ this.colorCPUUT.Size = new System.Drawing.Size(40, 20);
+ this.colorCPUUT.TabIndex = 3;
+ //
+ // colorCPUKT
+ //
+ this.colorCPUKT.Color = System.Drawing.Color.Transparent;
+ this.colorCPUKT.Location = new System.Drawing.Point(124, 59);
+ this.colorCPUKT.Name = "colorCPUKT";
+ this.colorCPUKT.Size = new System.Drawing.Size(40, 20);
+ this.colorCPUKT.TabIndex = 2;
+ //
// tabSymbols
//
this.tabSymbols.Controls.Add(this.checkUndecorate);
@@ -810,7 +914,7 @@
this.tabSymbols.Location = new System.Drawing.Point(4, 22);
this.tabSymbols.Name = "tabSymbols";
this.tabSymbols.Padding = new System.Windows.Forms.Padding(3);
- this.tabSymbols.Size = new System.Drawing.Size(481, 306);
+ this.tabSymbols.Size = new System.Drawing.Size(481, 333);
this.tabSymbols.TabIndex = 4;
this.tabSymbols.Text = "Symbols";
this.tabSymbols.UseVisualStyleBackColor = true;
@@ -828,11 +932,11 @@
//
// textSearchPath
//
- this.textSearchPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textSearchPath.Location = new System.Drawing.Point(110, 34);
+ this.textSearchPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textSearchPath.Location = new System.Drawing.Point(99, 34);
this.textSearchPath.Name = "textSearchPath";
- this.textSearchPath.Size = new System.Drawing.Size(365, 20);
+ this.textSearchPath.Size = new System.Drawing.Size(376, 20);
this.textSearchPath.TabIndex = 2;
//
// label10
@@ -858,11 +962,11 @@
//
// textDbghelpPath
//
- this.textDbghelpPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textDbghelpPath.Location = new System.Drawing.Point(110, 8);
+ this.textDbghelpPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDbghelpPath.Location = new System.Drawing.Point(99, 8);
this.textDbghelpPath.Name = "textDbghelpPath";
- this.textDbghelpPath.Size = new System.Drawing.Size(284, 20);
+ this.textDbghelpPath.Size = new System.Drawing.Size(295, 20);
this.textDbghelpPath.TabIndex = 0;
//
// label9
@@ -884,7 +988,7 @@
this.tabUpdates.Location = new System.Drawing.Point(4, 22);
this.tabUpdates.Name = "tabUpdates";
this.tabUpdates.Padding = new System.Windows.Forms.Padding(3);
- this.tabUpdates.Size = new System.Drawing.Size(481, 306);
+ this.tabUpdates.Size = new System.Drawing.Size(481, 333);
this.tabUpdates.TabIndex = 5;
this.tabUpdates.Text = "Updates";
this.tabUpdates.UseVisualStyleBackColor = true;
@@ -892,7 +996,6 @@
// checkUpdateAutomatically
//
this.checkUpdateAutomatically.AutoSize = true;
- this.checkUpdateAutomatically.Enabled = false;
this.checkUpdateAutomatically.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkUpdateAutomatically.Location = new System.Drawing.Point(6, 6);
this.checkUpdateAutomatically.Name = "checkUpdateAutomatically";
@@ -914,7 +1017,6 @@
//
this.optUpdateStable.AutoSize = true;
this.optUpdateStable.Checked = true;
- this.optUpdateStable.Enabled = false;
this.optUpdateStable.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.optUpdateStable.Location = new System.Drawing.Point(68, 30);
this.optUpdateStable.Name = "optUpdateStable";
@@ -927,7 +1029,6 @@
// optUpdateBeta
//
this.optUpdateBeta.AutoSize = true;
- this.optUpdateBeta.Enabled = false;
this.optUpdateBeta.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.optUpdateBeta.Location = new System.Drawing.Point(68, 54);
this.optUpdateBeta.Name = "optUpdateBeta";
@@ -939,7 +1040,6 @@
// optUpdateAlpha
//
this.optUpdateAlpha.AutoSize = true;
- this.optUpdateAlpha.Enabled = false;
this.optUpdateAlpha.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.optUpdateAlpha.Location = new System.Drawing.Point(68, 78);
this.optUpdateAlpha.Name = "optUpdateAlpha";
@@ -984,126 +1084,27 @@
this.buttonReset.UseVisualStyleBackColor = true;
this.buttonReset.Click += new System.EventHandler(this.buttonReset_Click);
//
- // listHighlightingColors
- //
- this.listHighlightingColors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listHighlightingColors.CheckBoxes = true;
- this.listHighlightingColors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnDescription});
- this.listHighlightingColors.DoubleClickChecks = false;
- this.listHighlightingColors.FullRowSelect = true;
- this.listHighlightingColors.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
- this.listHighlightingColors.HideSelection = false;
- this.listHighlightingColors.Location = new System.Drawing.Point(6, 60);
- this.listHighlightingColors.MultiSelect = false;
- this.listHighlightingColors.Name = "listHighlightingColors";
- this.listHighlightingColors.ShowItemToolTips = true;
- this.listHighlightingColors.Size = new System.Drawing.Size(469, 238);
- this.listHighlightingColors.TabIndex = 3;
- this.listHighlightingColors.UseCompatibleStateImageBehavior = false;
- this.listHighlightingColors.View = System.Windows.Forms.View.Details;
- this.listHighlightingColors.DoubleClick += new System.EventHandler(this.listHighlightingColors_DoubleClick);
- //
- // columnDescription
- //
- this.columnDescription.Text = "Description";
- this.columnDescription.Width = 250;
- //
- // colorRemovedProcesses
- //
- this.colorRemovedProcesses.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorRemovedProcesses.Color = System.Drawing.Color.Transparent;
- this.colorRemovedProcesses.Location = new System.Drawing.Point(351, 34);
- this.colorRemovedProcesses.Name = "colorRemovedProcesses";
- this.colorRemovedProcesses.Size = new System.Drawing.Size(40, 20);
- this.colorRemovedProcesses.TabIndex = 2;
- //
- // colorNewProcesses
- //
- this.colorNewProcesses.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorNewProcesses.Color = System.Drawing.Color.Transparent;
- this.colorNewProcesses.Location = new System.Drawing.Point(130, 33);
- this.colorNewProcesses.Name = "colorNewProcesses";
- this.colorNewProcesses.Size = new System.Drawing.Size(40, 20);
- this.colorNewProcesses.TabIndex = 1;
- //
- // colorIORO
- //
- this.colorIORO.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorIORO.Color = System.Drawing.Color.Transparent;
- this.colorIORO.Location = new System.Drawing.Point(124, 139);
- this.colorIORO.Name = "colorIORO";
- this.colorIORO.Size = new System.Drawing.Size(40, 20);
- this.colorIORO.TabIndex = 6;
- //
- // colorIOW
- //
- this.colorIOW.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorIOW.Color = System.Drawing.Color.Transparent;
- this.colorIOW.Location = new System.Drawing.Point(124, 165);
- this.colorIOW.Name = "colorIOW";
- this.colorIOW.Size = new System.Drawing.Size(40, 20);
- this.colorIOW.TabIndex = 7;
- //
- // colorMemoryWS
- //
- this.colorMemoryWS.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorMemoryWS.Color = System.Drawing.Color.Transparent;
- this.colorMemoryWS.Location = new System.Drawing.Point(124, 113);
- this.colorMemoryWS.Name = "colorMemoryWS";
- this.colorMemoryWS.Size = new System.Drawing.Size(40, 20);
- this.colorMemoryWS.TabIndex = 5;
- //
- // colorMemoryPB
- //
- this.colorMemoryPB.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorMemoryPB.Color = System.Drawing.Color.Transparent;
- this.colorMemoryPB.Location = new System.Drawing.Point(124, 87);
- this.colorMemoryPB.Name = "colorMemoryPB";
- this.colorMemoryPB.Size = new System.Drawing.Size(40, 20);
- this.colorMemoryPB.TabIndex = 4;
- //
- // colorCPUUT
- //
- this.colorCPUUT.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorCPUUT.Color = System.Drawing.Color.Transparent;
- this.colorCPUUT.Location = new System.Drawing.Point(124, 61);
- this.colorCPUUT.Name = "colorCPUUT";
- this.colorCPUUT.Size = new System.Drawing.Size(40, 20);
- this.colorCPUUT.TabIndex = 3;
- //
- // colorCPUKT
- //
- this.colorCPUKT.BackColor = System.Drawing.Color.WhiteSmoke;
- this.colorCPUKT.Color = System.Drawing.Color.Transparent;
- this.colorCPUKT.Location = new System.Drawing.Point(124, 35);
- this.colorCPUKT.Name = "colorCPUKT";
- this.colorCPUKT.Size = new System.Drawing.Size(40, 20);
- this.colorCPUKT.TabIndex = 2;
- //
// OptionsWindow
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(513, 385);
this.Controls.Add(this.buttonReset);
this.Controls.Add(this.buttonApply);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.buttonOK);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OptionsWindow";
+ this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Options";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OptionsWindow_FormClosing);
this.Load += new System.EventHandler(this.OptionsWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OptionsWindow_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).EndInit();
this.tabControl.ResumeLayout(false);
this.tabGeneral.ResumeLayout(false);
@@ -1194,6 +1195,7 @@
private System.Windows.Forms.CheckBox checkEnableExperimentalFeatures;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.CheckBox checkScrollDownProcessTree;
+ private System.Windows.Forms.CheckBox checkFloatChildWindows;
private System.Windows.Forms.TabPage tabUpdates;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.RadioButton optUpdateAlpha;
diff --git a/1.x/trunk/ProcessHacker/Forms/OptionsWindow.cs b/1.x/trunk/ProcessHacker/Forms/OptionsWindow.cs
index 92069ce16..82e0182d7 100644
--- a/1.x/trunk/ProcessHacker/Forms/OptionsWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/OptionsWindow.cs
@@ -32,17 +32,21 @@ using ProcessHacker.Components;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
-using ProcessHacker.Native.Threading;
using ProcessHacker.UI;
+using System.Runtime.InteropServices;
+using System.Net;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
namespace ProcessHacker
{
public partial class OptionsWindow : Form
{
+ private bool _isFirstPaint = true;
private string _oldDbghelp;
private string _oldTaskMgrDebugger;
private Font _font;
- private readonly bool _dontApply;
+ private bool _dontApply;
public OptionsWindow()
: this(false)
@@ -51,13 +55,10 @@ namespace ProcessHacker
public OptionsWindow(bool dontApply)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
_dontApply = dontApply;
-
- this.LoadStage1();
}
public TabPage SelectedTab
@@ -83,6 +84,25 @@ namespace ProcessHacker
}
}
+ protected override void WndProc(ref Message m)
+ {
+ switch (m.Msg)
+ {
+ case (int)WindowMessage.Paint:
+ {
+ if (_isFirstPaint)
+ {
+ this.LoadStage1();
+ }
+
+ _isFirstPaint = false;
+ }
+ break;
+ }
+
+ base.WndProc(ref m);
+ }
+
private void LoadStage1()
{
this.InitializeHighlightingColors();
@@ -118,9 +138,7 @@ namespace ProcessHacker
else if (c is ColorModifier)
(c as ColorModifier).ColorChanged += (sender, e) => this.EnableApplyButton();
else if (c is Button || c is Label || c is GroupBox)
- {
- // Nothing
- }
+ Program.Void(); // Nothing
else
c.Click += (sender, e) => this.EnableApplyButton();
}
@@ -140,38 +158,54 @@ namespace ProcessHacker
private void AddToList(string key, string description, string longDescription)
{
- listHighlightingColors.Items.Add(new ListViewItem
- {
- Name = key,
- Text = description,
- ToolTipText = longDescription
- });
+ listHighlightingColors.Items.Add(new ListViewItem()
+ {
+ Name = key,
+ Text = description,
+ ToolTipText = longDescription
+ });
}
private void InitializeHighlightingColors()
{
- AddToList("ColorOwnProcesses", "Own Processes", "Processes running under the same user account as Process Hacker.");
- AddToList("ColorSystemProcesses", "System Processes", "Processes running under the NT AUTHORITY\\SYSTEM user account.");
- AddToList("ColorServiceProcesses", "Service Processes", "Processes which host one or more services.");
- AddToList("ColorDebuggedProcesses", "Debugged Processes", "Processes that are currently being debugged.");
- AddToList("ColorElevatedProcesses", "Elevated Processes", "Processes with full privileges on a Windows Vista system with UAC enabled.");
- AddToList("ColorJobProcesses", "Job Processes", "Processes associated with a job.");
- AddToList("ColorDotNetProcesses", ".NET Processes and DLLs", ".NET, or managed processes and DLLs.");
- AddToList("ColorPosixProcesses", "POSIX Processes", "Processes running under the POSIX subsystem.");
- AddToList("ColorPackedProcesses", "Packed/Dangerous Processes", "Executables are sometimes \"packed\" to reduce their size.\n" +
- "\"Dangerous processes\" includes processes with invalid signatures and unverified " + "processes with the name of a system process.");
+ AddToList("ColorOwnProcesses", "Own Processes",
+ "Processes running under the same user account as Process Hacker.");
+ AddToList("ColorSystemProcesses", "System Processes",
+ "Processes running under the NT AUTHORITY\\SYSTEM user account.");
+ AddToList("ColorServiceProcesses", "Service Processes",
+ "Processes which host one or more services.");
+ AddToList("ColorDebuggedProcesses", "Debugged Processes",
+ "Processes that are currently being debugged.");
+ AddToList("ColorElevatedProcesses", "Elevated Processes",
+ "Processes with full privileges on a Windows Vista system with UAC enabled.");
+ AddToList("ColorJobProcesses", "Job Processes",
+ "Processes associated with a job.");
+ AddToList("ColorDotNetProcesses", ".NET Processes and DLLs",
+ ".NET, or managed processes and DLLs.");
+ AddToList("ColorPosixProcesses", "POSIX Processes",
+ "Processes running under the POSIX subsystem.");
+ AddToList("ColorPackedProcesses", "Packed/Dangerous Processes",
+ "Executables are sometimes \"packed\" to reduce their size.\n" +
+ "\"Dangerous processes\" includes processes with invalid signatures and unverified " +
+ "processes with the name of a system process.");
// WOW64, 64-bit only.
if (OSVersion.Architecture == OSArch.Amd64)
{
- AddToList("ColorWow64Processes", "32-bit Processes", "Processes running under WOW64, i.e. 32-bit.");
+ AddToList("ColorWow64Processes", "32-bit Processes",
+ "Processes running under WOW64, i.e. 32-bit.");
}
- AddToList("ColorSuspended", "Suspended Threads","Threads that are suspended from execution.");
- AddToList("ColorGuiThreads", "GUI Threads", "Threads that have made at least one GUI-related system call.");
- AddToList("ColorRelocatedDlls", "Relocated DLLs", "DLLs that were not loaded at their preferred image bases.");
- AddToList("ColorProtectedHandles", "Protected Handles", "Handles that are protected from being closed.");
- AddToList("ColorInheritHandles", "Inherit Handles", "Handles that are to be inherited by any child processes.");
+ AddToList("ColorSuspended", "Suspended Threads",
+ "Threads that are suspended from execution.");
+ AddToList("ColorGuiThreads", "GUI Threads",
+ "Threads that have made at least one GUI-related system call.");
+ AddToList("ColorRelocatedDlls", "Relocated DLLs",
+ "DLLs that were not loaded at their preferred image bases.");
+ AddToList("ColorProtectedHandles", "Protected Handles",
+ "Handles that are protected from being closed.");
+ AddToList("ColorInheritHandles", "Inherit Handles",
+ "Handles that are to be inherited by any child processes.");
}
private void listHighlightingColors_DoubleClick(object sender, EventArgs e)
@@ -233,10 +267,12 @@ namespace ProcessHacker
checkAllowOnlyOneInstance.Checked = Settings.Instance.AllowOnlyOneInstance;
checkVerifySignatures.Checked = Settings.Instance.VerifySignatures;
checkHideHandlesWithNoName.Checked = Settings.Instance.HideHandlesWithNoName;
+ checkEnableKPH.Enabled = OSVersion.Architecture == OSArch.I386;
checkEnableKPH.Checked = Settings.Instance.EnableKPH;
checkEnableExperimentalFeatures.Checked = Settings.Instance.EnableExperimentalFeatures;
checkStartHidden.Checked = Settings.Instance.StartHidden;
checkScrollDownProcessTree.Checked = Settings.Instance.ScrollDownProcessTree;
+ checkFloatChildWindows.Checked = Settings.Instance.FloatChildWindows;
checkHidePhConnections.Checked = Settings.Instance.HideProcessHackerNetworkConnections;
if (OSVersion.HasUac)
@@ -301,7 +337,7 @@ namespace ProcessHacker
try
{
- if (!Array.Exists(key.GetSubKeyNames(), s => s.Equals("taskmgr.exe", StringComparison.OrdinalIgnoreCase)))
+ if (!Array.Exists(key.GetSubKeyNames(), s => s.Equals("taskmgr.exe", StringComparison.OrdinalIgnoreCase)))
key.CreateSubKey("taskmgr.exe");
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
@@ -326,8 +362,8 @@ namespace ProcessHacker
false
))
{
- if ((_oldTaskMgrDebugger = (string)key.GetValue("Debugger", string.Empty)).Trim('"').Equals(
- ProcessHandle.Current.MainModule.FileName, StringComparison.OrdinalIgnoreCase))
+ if ((_oldTaskMgrDebugger = (string)key.GetValue("Debugger", "")).Trim('"').Equals(
+ ProcessHandle.Current.GetMainModule().FileName, StringComparison.OrdinalIgnoreCase))
{
checkReplaceTaskManager.Checked = true;
}
@@ -393,6 +429,7 @@ namespace ProcessHacker
Settings.Instance.VerifySignatures = checkVerifySignatures.Checked;
Settings.Instance.HideHandlesWithNoName = checkHideHandlesWithNoName.Checked;
Settings.Instance.ScrollDownProcessTree = checkScrollDownProcessTree.Checked;
+ Settings.Instance.FloatChildWindows = checkFloatChildWindows.Checked;
Settings.Instance.StartHidden = checkStartHidden.Checked;
Settings.Instance.EnableKPH = checkEnableKPH.Checked;
Settings.Instance.EnableExperimentalFeatures = checkEnableExperimentalFeatures.Checked;
@@ -403,7 +440,7 @@ namespace ProcessHacker
Settings.Instance.MaxSamples = (int)textMaxSamples.Value;
Program.ProcessProvider.HistoryMaxSize = Settings.Instance.MaxSamples;
Settings.Instance.PlotterStep = (int)textStep.Value;
- Plotter.GlobalMoveStep = Settings.Instance.PlotterStep;
+ ProcessHacker.Components.Plotter.GlobalMoveStep = Settings.Instance.PlotterStep;
Settings.Instance.HighlightingDuration = (int)textHighlightingDuration.Value;
Settings.Instance.ColorNew = colorNewProcesses.Color;
@@ -466,7 +503,7 @@ namespace ProcessHacker
{
try
{
- string fileName = ProcessHandle.Current.MainModule.FileName;
+ string fileName = ProcessHandle.Current.GetMainModule().FileName;
using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\taskmgr.exe",
@@ -486,7 +523,7 @@ namespace ProcessHacker
if (_oldTaskMgrDebugger.Trim('"').Equals(fileName, StringComparison.OrdinalIgnoreCase))
{
key.DeleteValue("Debugger");
- _oldTaskMgrDebugger = string.Empty;
+ _oldTaskMgrDebugger = "";
}
}
}
@@ -547,19 +584,17 @@ namespace ProcessHacker
private void buttonFont_Click(object sender, EventArgs e)
{
- using (FontDialog fd = new FontDialog
+ FontDialog fd = new FontDialog();
+
+ fd.Font = _font;
+ fd.FontMustExist = true;
+ fd.ShowEffects = true;
+
+ if (fd.ShowDialog() == DialogResult.OK)
{
- Font = this._font,
- FontMustExist = true,
- ShowEffects = true
- })
- {
- if (fd.ShowDialog() == DialogResult.OK)
- {
- _font = fd.Font;
- buttonFont.Font = _font;
- this.EnableApplyButton();
- }
+ _font = fd.Font;
+ buttonFont.Font = _font;
+ this.EnableApplyButton();
}
}
@@ -571,26 +606,28 @@ namespace ProcessHacker
buttonApply.Enabled = false;
string args = "-o -hwnd " + this.Handle.ToString() +
- " -rect " + this.Location.X.ToString() + "," + this.Location.Y.ToString() + "," +
- this.Size.Width.ToString() + "," + this.Size.Height.ToString();
+ " -rect " + this.Location.X.ToString() + "," + this.Location.Y.ToString() + "," +
+ this.Size.Width.ToString() + "," + this.Size.Height.ToString();
- NativeThreadPool.QueueWorkItem(thisHandle =>
- {
- Program.StartProcessHackerAdminWait(args, (IntPtr)thisHandle, 0xffffffff);
+ // Avoid cross-thread operation.
+ IntPtr thisHandle = this.Handle;
- this.BeginInvoke(new MethodInvoker(() =>
+ Thread t = new Thread(() =>
{
- Settings.Instance.Reload();
- this.LoadSettings();
+ Program.StartProcessHackerAdminWait(args, thisHandle, 0xffffffff);
- if (!_dontApply)
- this.ApplySettings();
+ this.BeginInvoke(new MethodInvoker(() =>
+ {
+ Settings.Instance.Reload();
+ this.LoadSettings();
+ if (!_dontApply)
+ this.ApplySettings();
+ buttonApply.Enabled = false;
+ buttonOK.Select();
+ }));
+ }, Utils.SixteenthStackSize);
- buttonApply.Enabled = false;
- buttonOK.Select();
- }));
-
- }, this.Handle);
+ t.Start();
}
private void buttonEnableAll_Click(object sender, EventArgs e)
@@ -611,15 +648,13 @@ namespace ProcessHacker
private void buttonDbghelpBrowse_Click(object sender, EventArgs e)
{
- using (OpenFileDialog ofd = new OpenFileDialog
- {
- Filter = "dbghelp.dll|dbghelp.dll|DLL files (*.dll)|*.dll|All files (*.*)|*.*",
- FileName = this.textDbghelpPath.Text
- })
- {
- if (ofd.ShowDialog() == DialogResult.OK)
- textDbghelpPath.Text = ofd.FileName;
- }
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ ofd.Filter = "dbghelp.dll|dbghelp.dll|DLL files (*.dll)|*.dll|All files (*.*)|*.*";
+ ofd.FileName = textDbghelpPath.Text;
+
+ if (ofd.ShowDialog() == DialogResult.OK)
+ textDbghelpPath.Text = ofd.FileName;
}
private void buttonApply_Click(object sender, EventArgs e)
@@ -636,7 +671,7 @@ namespace ProcessHacker
{
Settings.Instance.Reset();
Program.GlobalMutex.Dispose();
- Program.TryStart(ProcessHandle.Current.MainModule.FileName);
+ Program.TryStart(ProcessHandle.Current.GetMainModule().FileName);
Program.HackerWindow.Exit(false);
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/OptionsWindow.resx b/1.x/trunk/ProcessHacker/Forms/OptionsWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/OptionsWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/OptionsWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/PEWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/PEWindow.Designer.cs
index 333d6811c..a69c4c5d2 100644
--- a/1.x/trunk/ProcessHacker/Forms/PEWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/PEWindow.Designer.cs
@@ -1,8 +1,6 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
- sealed partial class PEWindow
+ partial class PEWindow
{
///
/// Required designer variable.
@@ -33,37 +31,39 @@ namespace ProcessHacker
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PEWindow));
this.tabControl = new System.Windows.Forms.TabControl();
this.tabCOFFHeader = new System.Windows.Forms.TabPage();
- this.listCOFFHeader = new ProcessHacker.Components.ExtendedListView();
- this.columnCHName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnCHValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listCOFFHeader = new System.Windows.Forms.ListView();
+ this.columnCHName = new System.Windows.Forms.ColumnHeader();
+ this.columnCHValue = new System.Windows.Forms.ColumnHeader();
this.tabCOFFOptionalHeader = new System.Windows.Forms.TabPage();
- this.listCOFFOptionalHeader = new ProcessHacker.Components.ExtendedListView();
- this.columnCOHName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnCOHValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listCOFFOptionalHeader = new System.Windows.Forms.ListView();
+ this.columnCOHName = new System.Windows.Forms.ColumnHeader();
+ this.columnCOHValue = new System.Windows.Forms.ColumnHeader();
this.tabImageData = new System.Windows.Forms.TabPage();
- this.listImageData = new ProcessHacker.Components.ExtendedListView();
- this.columnIDName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnIDRVA = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnIDSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listImageData = new System.Windows.Forms.ListView();
+ this.columnIDName = new System.Windows.Forms.ColumnHeader();
+ this.columnIDRVA = new System.Windows.Forms.ColumnHeader();
+ this.columnIDSize = new System.Windows.Forms.ColumnHeader();
this.tabSections = new System.Windows.Forms.TabPage();
- this.listSections = new ProcessHacker.Components.ExtendedListView();
- this.columnSectionName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnSectionVA = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnSectionVS = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnSectionFileAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnSectionCharacteristics = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listSections = new System.Windows.Forms.ListView();
+ this.columnSectionName = new System.Windows.Forms.ColumnHeader();
+ this.columnSectionVA = new System.Windows.Forms.ColumnHeader();
+ this.columnSectionVS = new System.Windows.Forms.ColumnHeader();
+ this.columnSectionFileAddress = new System.Windows.Forms.ColumnHeader();
+ this.columnSectionCharacteristics = new System.Windows.Forms.ColumnHeader();
this.tabExports = new System.Windows.Forms.TabPage();
- this.listExports = new ProcessHacker.Components.ExtendedListView();
- this.columnExportOrdinal = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnExportName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnExportFileAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listExports = new System.Windows.Forms.ListView();
+ this.columnExportOrdinal = new System.Windows.Forms.ColumnHeader();
+ this.columnExportName = new System.Windows.Forms.ColumnHeader();
+ this.columnExportFileAddress = new System.Windows.Forms.ColumnHeader();
this.tabImports = new System.Windows.Forms.TabPage();
this.listImports = new ProcessHacker.Components.ExtendedListView();
- this.columnImportName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnImportHint = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.columnImportName = new System.Windows.Forms.ColumnHeader();
+ this.columnImportHint = new System.Windows.Forms.ColumnHeader();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.tabControl.SuspendLayout();
this.tabCOFFHeader.SuspendLayout();
this.tabCOFFOptionalHeader.SuspendLayout();
@@ -71,23 +71,22 @@ namespace ProcessHacker
this.tabSections.SuspendLayout();
this.tabExports.SuspendLayout();
this.tabImports.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// tabControl
//
- this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tabCOFFHeader);
this.tabControl.Controls.Add(this.tabCOFFOptionalHeader);
this.tabControl.Controls.Add(this.tabImageData);
this.tabControl.Controls.Add(this.tabSections);
this.tabControl.Controls.Add(this.tabExports);
this.tabControl.Controls.Add(this.tabImports);
- this.tabControl.Location = new System.Drawing.Point(12, 12);
+ this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
- this.tabControl.Size = new System.Drawing.Size(439, 465);
+ this.tabControl.Size = new System.Drawing.Size(423, 402);
this.tabControl.TabIndex = 0;
//
// tabCOFFHeader
@@ -96,7 +95,7 @@ namespace ProcessHacker
this.tabCOFFHeader.Location = new System.Drawing.Point(4, 22);
this.tabCOFFHeader.Name = "tabCOFFHeader";
this.tabCOFFHeader.Padding = new System.Windows.Forms.Padding(3);
- this.tabCOFFHeader.Size = new System.Drawing.Size(431, 439);
+ this.tabCOFFHeader.Size = new System.Drawing.Size(415, 376);
this.tabCOFFHeader.TabIndex = 0;
this.tabCOFFHeader.Text = "COFF Header";
this.tabCOFFHeader.UseVisualStyleBackColor = true;
@@ -107,13 +106,12 @@ namespace ProcessHacker
this.columnCHName,
this.columnCHValue});
this.listCOFFHeader.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listCOFFHeader.DoubleClickChecks = true;
this.listCOFFHeader.FullRowSelect = true;
this.listCOFFHeader.HideSelection = false;
this.listCOFFHeader.Location = new System.Drawing.Point(3, 3);
this.listCOFFHeader.Name = "listCOFFHeader";
this.listCOFFHeader.ShowItemToolTips = true;
- this.listCOFFHeader.Size = new System.Drawing.Size(425, 433);
+ this.listCOFFHeader.Size = new System.Drawing.Size(409, 370);
this.listCOFFHeader.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listCOFFHeader.TabIndex = 0;
this.listCOFFHeader.UseCompatibleStateImageBehavior = false;
@@ -146,7 +144,6 @@ namespace ProcessHacker
this.columnCOHName,
this.columnCOHValue});
this.listCOFFOptionalHeader.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listCOFFOptionalHeader.DoubleClickChecks = true;
this.listCOFFOptionalHeader.FullRowSelect = true;
this.listCOFFOptionalHeader.HideSelection = false;
this.listCOFFOptionalHeader.Location = new System.Drawing.Point(3, 3);
@@ -186,7 +183,6 @@ namespace ProcessHacker
this.columnIDRVA,
this.columnIDSize});
this.listImageData.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listImageData.DoubleClickChecks = true;
this.listImageData.FullRowSelect = true;
this.listImageData.HideSelection = false;
this.listImageData.Location = new System.Drawing.Point(3, 3);
@@ -232,7 +228,6 @@ namespace ProcessHacker
this.columnSectionFileAddress,
this.columnSectionCharacteristics});
this.listSections.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listSections.DoubleClickChecks = true;
this.listSections.FullRowSelect = true;
this.listSections.HideSelection = false;
this.listSections.Location = new System.Drawing.Point(3, 3);
@@ -285,7 +280,6 @@ namespace ProcessHacker
this.columnExportName,
this.columnExportFileAddress});
this.listExports.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listExports.DoubleClickChecks = true;
this.listExports.FullRowSelect = true;
this.listExports.HideSelection = false;
this.listExports.Location = new System.Drawing.Point(3, 3);
@@ -297,8 +291,8 @@ namespace ProcessHacker
this.listExports.UseCompatibleStateImageBehavior = false;
this.listExports.View = System.Windows.Forms.View.Details;
this.listExports.VirtualMode = true;
- this.listExports.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listExports_RetrieveVirtualItem);
this.listExports.DoubleClick += new System.EventHandler(this.listExports_DoubleClick);
+ this.listExports.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listExports_RetrieveVirtualItem);
//
// columnExportOrdinal
//
@@ -354,18 +348,22 @@ namespace ProcessHacker
this.columnImportHint.Text = "Hint";
this.columnImportHint.Width = 80;
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// PEWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(463, 489);
+ this.ClientSize = new System.Drawing.Size(423, 402);
this.Controls.Add(this.tabControl);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "PEWindow";
this.Text = "PE File";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PEWindow_FormClosing);
this.Load += new System.EventHandler(this.PEWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PEWindow_FormClosing);
this.tabControl.ResumeLayout(false);
this.tabCOFFHeader.ResumeLayout(false);
this.tabCOFFOptionalHeader.ResumeLayout(false);
@@ -373,36 +371,38 @@ namespace ProcessHacker
this.tabSections.ResumeLayout(false);
this.tabExports.ResumeLayout(false);
this.tabImports.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
#endregion
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.TabPage tabCOFFHeader;
private System.Windows.Forms.TabPage tabCOFFOptionalHeader;
private System.Windows.Forms.TabPage tabSections;
private System.Windows.Forms.TabPage tabExports;
private System.Windows.Forms.TabPage tabImports;
- private ExtendedListView listExports;
+ private System.Windows.Forms.ListView listExports;
private System.Windows.Forms.ColumnHeader columnExportName;
private System.Windows.Forms.ColumnHeader columnExportOrdinal;
private System.Windows.Forms.ColumnHeader columnExportFileAddress;
- private ExtendedListView listCOFFHeader;
+ private System.Windows.Forms.ListView listCOFFHeader;
private System.Windows.Forms.ColumnHeader columnCHName;
private System.Windows.Forms.ColumnHeader columnCHValue;
- private ExtendedListView listCOFFOptionalHeader;
+ private System.Windows.Forms.ListView listCOFFOptionalHeader;
private System.Windows.Forms.ColumnHeader columnCOHName;
private System.Windows.Forms.ColumnHeader columnCOHValue;
- private ExtendedListView listSections;
+ private System.Windows.Forms.ListView listSections;
private System.Windows.Forms.ColumnHeader columnSectionName;
private System.Windows.Forms.ColumnHeader columnSectionVA;
private System.Windows.Forms.ColumnHeader columnSectionFileAddress;
private System.Windows.Forms.ColumnHeader columnSectionCharacteristics;
private System.Windows.Forms.ColumnHeader columnSectionVS;
private System.Windows.Forms.TabPage tabImageData;
- private ExtendedListView listImageData;
+ private System.Windows.Forms.ListView listImageData;
private System.Windows.Forms.ColumnHeader columnIDName;
private System.Windows.Forms.ColumnHeader columnIDRVA;
private System.Windows.Forms.ColumnHeader columnIDSize;
diff --git a/1.x/trunk/ProcessHacker/Forms/PEWindow.cs b/1.x/trunk/ProcessHacker/Forms/PEWindow.cs
index 83c901b93..0146968df 100644
--- a/1.x/trunk/ProcessHacker/Forms/PEWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/PEWindow.cs
@@ -32,10 +32,10 @@ using ProcessHacker.UI;
namespace ProcessHacker
{
- public sealed partial class PEWindow : Form
+ public partial class PEWindow : Form
{
- private readonly string _path;
- private readonly MappedImage _mappedImage;
+ private string _path;
+ private MappedImage _mappedImage;
public PEWindow(string path)
{
@@ -44,7 +44,6 @@ namespace ProcessHacker
this.SetTopMost();
_path = path;
-
this.Text = "PE File - " + path;
Program.PEWindows.Add(Id, this);
@@ -66,6 +65,8 @@ namespace ProcessHacker
private void PEWindow_Load(object sender, EventArgs e)
{
this.Size = Settings.Instance.PEWindowSize;
+
+ this.SetPhParent();
}
private void PEWindow_FormClosing(object sender, FormClosingEventArgs e)
@@ -86,26 +87,38 @@ namespace ProcessHacker
private void InitializeLists()
{
+ listCOFFHeader.SetDoubleBuffered(true);
+ listCOFFHeader.SetTheme("explorer");
listCOFFHeader.ContextMenu = listCOFFHeader.GetCopyMenu();
listCOFFHeader.AddShortcuts();
ColumnSettings.LoadSettings(Settings.Instance.PECOFFHColumns, listCOFFHeader);
+ listCOFFOptionalHeader.SetDoubleBuffered(true);
+ listCOFFOptionalHeader.SetTheme("explorer");
listCOFFOptionalHeader.ContextMenu = listCOFFOptionalHeader.GetCopyMenu();
listCOFFOptionalHeader.AddShortcuts();
ColumnSettings.LoadSettings(Settings.Instance.PECOFFOHColumns, listCOFFOptionalHeader);
+ listImageData.SetDoubleBuffered(true);
+ listImageData.SetTheme("explorer");
listImageData.ContextMenu = listImageData.GetCopyMenu();
listImageData.AddShortcuts();
ColumnSettings.LoadSettings(Settings.Instance.PEImageDataColumns, listImageData);
+ listSections.SetDoubleBuffered(true);
+ listSections.SetTheme("explorer");
listSections.ContextMenu = listSections.GetCopyMenu();
listSections.AddShortcuts();
ColumnSettings.LoadSettings(Settings.Instance.PESectionsColumns, listSections);
+ listExports.SetDoubleBuffered(true);
+ listExports.SetTheme("explorer");
listExports.ContextMenu = listExports.GetCopyMenu(listExports_RetrieveVirtualItem);
listExports.AddShortcuts(this.listExports_RetrieveVirtualItem);
ColumnSettings.LoadSettings(Settings.Instance.PEExportsColumns, listExports);
+ listImports.SetDoubleBuffered(true);
+ listImports.SetTheme("explorer");
listImports.ContextMenu = listImports.GetCopyMenu();
listImports.AddShortcuts();
ColumnSettings.LoadSettings(Settings.Instance.PEImportsColumns, listImports);
@@ -212,11 +225,9 @@ namespace ProcessHacker
if (dataEntry != null && dataEntry->VirtualAddress != 0)
{
- ListViewItem item = new ListViewItem
- {
- Text = ((ImageDataEntry)i).ToString()
- };
+ ListViewItem item = new ListViewItem();
+ item.Text = ((ImageDataEntry)i).ToString();
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "0x" + dataEntry->VirtualAddress.ToString("x")));
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "0x" + dataEntry->Size.ToString("x")));
@@ -233,11 +244,9 @@ namespace ProcessHacker
for (int i = 0; i < _mappedImage.NumberOfSections; i++)
{
ImageSectionHeader* section = &_mappedImage.Sections[i];
- ListViewItem item = new ListViewItem
- {
- Text = this._mappedImage.GetSectionName(section)
- };
+ ListViewItem item = new ListViewItem();
+ item.Text = _mappedImage.GetSectionName(section);
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "0x" + section->VirtualAddress.ToString("x")));
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "0x" + section->SizeOfRawData.ToString("x")));
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "0x" + section->PointerToRawData.ToString("x")));
@@ -299,17 +308,22 @@ namespace ProcessHacker
#endregion
}
- private unsafe void listExports_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
+ private void listExports_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
{
- ImageExportEntry entry = this._mappedImage.Exports.GetEntry(e.ItemIndex);
- ImageExportFunction function = this._mappedImage.Exports.GetFunction(entry.Ordinal);
-
- e.Item = new ListViewItem(new string[]
+ unsafe
{
- entry.Ordinal.ToString(),
- !string.IsNullOrEmpty(function.ForwardedName) ? entry.Name + " > " + function.ForwardedName : entry.Name,
- string.IsNullOrEmpty(function.ForwardedName) ? "0x" + function.Function.Decrement(new IntPtr(this._mappedImage.Memory)).ToString("x") : string.Empty
- });
+ var entry = _mappedImage.Exports.GetEntry(e.ItemIndex);
+ var function = _mappedImage.Exports.GetFunction(entry.Ordinal);
+
+ e.Item = new ListViewItem(new string[]
+ {
+ entry.Ordinal.ToString(),
+ function.ForwardedName != null ? entry.Name + " > " + function.ForwardedName : entry.Name,
+ function.ForwardedName == null ?
+ "0x" + function.Function.Decrement(new IntPtr(_mappedImage.Memory)).ToString("x") :
+ ""
+ });
+ }
}
private void listExports_DoubleClick(object sender, EventArgs e)
@@ -330,9 +344,9 @@ namespace ProcessHacker
{
fileName = FileUtils.FindFile(System.IO.Path.GetDirectoryName(_path), e.Group.Header);
- if (!string.IsNullOrEmpty(fileName))
+ if (fileName != null)
{
- Program.GetPEWindow(fileName, Program.FocusWindow);
+ Program.GetPEWindow(fileName, (f) => Program.FocusWindow(f));
}
else
{
diff --git a/1.x/trunk/ProcessHacker/Forms/PEWindow.resx b/1.x/trunk/ProcessHacker/Forms/PEWindow.resx
index 12b61ce8c..d2605a850 100644
--- a/1.x/trunk/ProcessHacker/Forms/PEWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/PEWindow.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+ 127, 17
+
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.Designer.cs
index 71d883670..6be25606b 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.Designer.cs
@@ -47,9 +47,9 @@
//
// flowPanel
//
- this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.flowPanel.AutoScroll = true;
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowPanel.Location = new System.Drawing.Point(12, 12);
@@ -74,7 +74,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(448, 222);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.flowPanel);
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.cs b/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.cs
index 1ed4907cc..b157c4d33 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.cs
@@ -30,12 +30,11 @@ namespace ProcessHacker
{
public partial class ProcessAffinity : Form
{
- private readonly int _pid;
+ private int _pid;
public ProcessAffinity(int pid)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
@@ -46,20 +45,21 @@ namespace ProcessHacker
using (ProcessHandle phandle = new ProcessHandle(pid, ProcessAccess.QueryInformation))
{
long systemMask;
+ long processMask;
- long processMask = phandle.GetAffinityMask(out systemMask);
+ processMask = phandle.GetAffinityMask(out systemMask);
for (int i = 0; (systemMask & (1 << i)) != 0; i++)
{
- CheckBox c = new CheckBox
- {
- Name = "cpu" + i,
- Text = "CPU " + i,
- Tag = i,
- FlatStyle = FlatStyle.System,
- Checked = (processMask & (1 << i)) != 0,
- Margin = new Padding(3, 3, 3, 0)
- };
+ CheckBox c = new CheckBox();
+
+ c.Name = "cpu" + i.ToString();
+ c.Text = "CPU " + i.ToString();
+ c.Tag = i;
+
+ c.FlatStyle = FlatStyle.System;
+ c.Checked = (processMask & (1 << i)) != 0;
+ c.Margin = new Padding(3, 3, 3, 0);
flowPanel.Controls.Add(c);
}
@@ -93,7 +93,7 @@ namespace ProcessHacker
try
{
using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.SetInformation))
- phandle.AffinityMask = newMask;
+ phandle.SetAffinityMask(newMask);
this.Close();
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.resx b/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessAffinity.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.Designer.cs
index 9721a4965..75dfdf22c 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.Designer.cs
@@ -61,15 +61,10 @@
//
// treeProcesses
//
- this.treeProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.treeProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.treeProcesses.Draw = true;
- this.treeProcesses.DumpMode = false;
- this.treeProcesses.DumpProcesses = null;
- this.treeProcesses.DumpProcessServices = null;
- this.treeProcesses.DumpServices = null;
- this.treeProcesses.DumpUserName = null;
this.treeProcesses.Location = new System.Drawing.Point(12, 28);
this.treeProcesses.Name = "treeProcesses";
this.treeProcesses.Provider = null;
@@ -80,8 +75,8 @@
//
// labelLabel
//
- this.labelLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelLabel.AutoEllipsis = true;
this.labelLabel.Location = new System.Drawing.Point(12, 9);
this.labelLabel.Name = "labelLabel";
@@ -94,7 +89,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(485, 392);
this.Controls.Add(this.labelLabel);
this.Controls.Add(this.treeProcesses);
@@ -107,8 +101,8 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose a Process";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProcessPickerWindow_FormClosing);
this.Load += new System.EventHandler(this.ProcessPickerWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProcessPickerWindow_FormClosing);
this.ResumeLayout(false);
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.resx b/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessPickerWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ProcessWindow.Designer.cs
index ab872d370..7730e7c7d 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessWindow.Designer.cs
@@ -1,6 +1,4 @@
using ProcessHacker.Common;
-using ProcessHacker.Components;
-
namespace ProcessHacker
{
partial class ProcessWindow
@@ -77,6 +75,10 @@ namespace ProcessHacker
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
+ this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
+ this.processMenuItem = new System.Windows.Forms.MenuItem();
+ this.inspectImageFileMenuItem = new System.Windows.Forms.MenuItem();
+ this.windowMenuItem = new System.Windows.Forms.MenuItem();
this.tabControl = new System.Windows.Forms.TabControl();
this.tabGeneral = new System.Windows.Forms.TabPage();
this.groupProcess = new System.Windows.Forms.GroupBox();
@@ -134,25 +136,26 @@ namespace ProcessHacker
this.label15 = new System.Windows.Forms.Label();
this.checkHideFreeRegions = new System.Windows.Forms.CheckBox();
this.buttonSearch = new wyDay.Controls.SplitButton();
+ this.menuSearch = new System.Windows.Forms.ContextMenu();
+ this.newWindowSearchMenuItem = new System.Windows.Forms.MenuItem();
+ this.literalSearchMenuItem = new System.Windows.Forms.MenuItem();
+ this.regexSearchMenuItem = new System.Windows.Forms.MenuItem();
+ this.stringScanMenuItem = new System.Windows.Forms.MenuItem();
+ this.heapScanMenuItem = new System.Windows.Forms.MenuItem();
+ this.structSearchMenuItem = new System.Windows.Forms.MenuItem();
this.listMemory = new ProcessHacker.Components.MemoryList();
this.tabEnvironment = new System.Windows.Forms.TabPage();
- this.listEnvironment = new ProcessHacker.Components.ExtendedListView();
- this.columnVarName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnVarValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listEnvironment = new System.Windows.Forms.ListView();
+ this.columnVarName = new System.Windows.Forms.ColumnHeader();
+ this.columnVarValue = new System.Windows.Forms.ColumnHeader();
this.tabHandles = new System.Windows.Forms.TabPage();
this.checkHideHandlesNoName = new System.Windows.Forms.CheckBox();
this.listHandles = new ProcessHacker.Components.HandleList();
this.tabJob = new System.Windows.Forms.TabPage();
this.tabServices = new System.Windows.Forms.TabPage();
- this.tabDotNet = new System.Windows.Forms.TabPage();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
- this.contextMenuStripSearch = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.newWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.literalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.regexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.stringScanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.heapScanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.structToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
+ this.tabDotNet = new System.Windows.Forms.TabPage();
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
this.groupProcess.SuspendLayout();
@@ -171,14 +174,49 @@ namespace ProcessHacker
this.tabMemory.SuspendLayout();
this.tabEnvironment.SuspendLayout();
this.tabHandles.SuspendLayout();
- this.contextMenuStripSearch.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
+ // ProcessWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(488, 431);
+ this.KeyPreview = true;
+ this.Menu = this.mainMenu;
+ this.MinimumSize = new System.Drawing.Size(454, 433);
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
+ this.Text = "Process";
+ this.Load += new System.EventHandler(this.ProcessWindow_Load);
+ this.SizeChanged += new System.EventHandler(this.ProcessWindow_SizeChanged);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProcessWindow_FormClosing);
+ //
+ // mainMenu
+ //
+ this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.processMenuItem,
+ this.windowMenuItem});
+ //
+ // processMenuItem
+ //
+ this.processMenuItem.Index = 0;
+ this.processMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.inspectImageFileMenuItem});
+ this.processMenuItem.Text = "&Process";
+ //
+ // inspectImageFileMenuItem
+ //
+ this.inspectImageFileMenuItem.Index = 0;
+ this.inspectImageFileMenuItem.Text = "&Inspect Image File...";
+ this.inspectImageFileMenuItem.Click += new System.EventHandler(this.inspectImageFileMenuItem_Click);
+ //
+ // windowMenuItem
+ //
+ this.windowMenuItem.Index = 1;
+ this.windowMenuItem.Text = "&Window";
+ //
// tabControl
//
- this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tabGeneral);
this.tabControl.Controls.Add(this.tabStatistics);
this.tabControl.Controls.Add(this.tabPerformance);
@@ -191,12 +229,12 @@ namespace ProcessHacker
this.tabControl.Controls.Add(this.tabJob);
this.tabControl.Controls.Add(this.tabServices);
this.tabControl.Controls.Add(this.tabDotNet);
+ this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl.ItemSize = new System.Drawing.Size(80, 18);
- this.tabControl.Location = new System.Drawing.Point(12, 12);
+ this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Multiline = true;
- this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
- this.tabControl.Size = new System.Drawing.Size(483, 524);
+ this.tabControl.Size = new System.Drawing.Size(488, 431);
this.tabControl.SizeMode = System.Windows.Forms.TabSizeMode.FillToRight;
this.tabControl.TabIndex = 0;
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
@@ -207,18 +245,17 @@ namespace ProcessHacker
this.tabGeneral.Controls.Add(this.groupProcess);
this.tabGeneral.Controls.Add(this.groupFile);
this.tabGeneral.Location = new System.Drawing.Point(4, 40);
- this.tabGeneral.Name = "tabGeneral";
this.tabGeneral.Padding = new System.Windows.Forms.Padding(3);
- this.tabGeneral.Size = new System.Drawing.Size(475, 480);
+ this.tabGeneral.Size = new System.Drawing.Size(480, 387);
this.tabGeneral.TabIndex = 2;
this.tabGeneral.Text = "General";
this.tabGeneral.UseVisualStyleBackColor = true;
//
// groupProcess
//
- this.groupProcess.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupProcess.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupProcess.Controls.Add(this.buttonPermissions);
this.groupProcess.Controls.Add(this.labelProcessTypeValue);
this.groupProcess.Controls.Add(this.labelProcessType);
@@ -242,8 +279,7 @@ namespace ProcessHacker
this.groupProcess.Controls.Add(this.textStartTime);
this.groupProcess.Controls.Add(this.textCmdLine);
this.groupProcess.Location = new System.Drawing.Point(8, 126);
- this.groupProcess.Name = "groupProcess";
- this.groupProcess.Size = new System.Drawing.Size(461, 348);
+ this.groupProcess.Size = new System.Drawing.Size(466, 255);
this.groupProcess.TabIndex = 1;
this.groupProcess.TabStop = false;
this.groupProcess.Text = "Process";
@@ -252,8 +288,7 @@ namespace ProcessHacker
//
this.buttonPermissions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonPermissions.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonPermissions.Location = new System.Drawing.Point(299, 206);
- this.buttonPermissions.Name = "buttonPermissions";
+ this.buttonPermissions.Location = new System.Drawing.Point(304, 206);
this.buttonPermissions.Size = new System.Drawing.Size(75, 23);
this.buttonPermissions.TabIndex = 21;
this.buttonPermissions.Text = "Permissions";
@@ -264,7 +299,6 @@ namespace ProcessHacker
//
this.labelProcessTypeValue.AutoSize = true;
this.labelProcessTypeValue.Location = new System.Drawing.Point(98, 208);
- this.labelProcessTypeValue.Name = "labelProcessTypeValue";
this.labelProcessTypeValue.Size = new System.Drawing.Size(16, 13);
this.labelProcessTypeValue.TabIndex = 20;
this.labelProcessTypeValue.Text = "...";
@@ -273,29 +307,26 @@ namespace ProcessHacker
// labelProcessType
//
this.labelProcessType.AutoSize = true;
- this.labelProcessType.Location = new System.Drawing.Point(4, 208);
- this.labelProcessType.Name = "labelProcessType";
- this.labelProcessType.Size = new System.Drawing.Size(74, 13);
+ this.labelProcessType.Location = new System.Drawing.Point(6, 208);
+ this.labelProcessType.Size = new System.Drawing.Size(75, 13);
this.labelProcessType.TabIndex = 19;
this.labelProcessType.Text = "Process Type:";
this.labelProcessType.Visible = false;
//
// fileCurrentDirectory
//
- this.fileCurrentDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.fileCurrentDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.fileCurrentDirectory.Location = new System.Drawing.Point(101, 71);
- this.fileCurrentDirectory.Name = "fileCurrentDirectory";
this.fileCurrentDirectory.ReadOnly = true;
- this.fileCurrentDirectory.Size = new System.Drawing.Size(354, 24);
+ this.fileCurrentDirectory.Size = new System.Drawing.Size(359, 24);
this.fileCurrentDirectory.TabIndex = 3;
//
// label26
//
this.label26.AutoSize = true;
- this.label26.Location = new System.Drawing.Point(4, 22);
- this.label26.Name = "label26";
- this.label26.Size = new System.Drawing.Size(47, 13);
+ this.label26.Location = new System.Drawing.Point(6, 22);
+ this.label26.Size = new System.Drawing.Size(44, 13);
this.label26.TabIndex = 12;
this.label26.Text = "Started:";
this.toolTip.SetToolTip(this.label26, "The time at which the program was started.");
@@ -303,51 +334,46 @@ namespace ProcessHacker
// label7
//
this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(4, 104);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(73, 13);
+ this.label7.Location = new System.Drawing.Point(6, 104);
+ this.label7.Size = new System.Drawing.Size(72, 13);
this.label7.TabIndex = 15;
this.label7.Text = "PEB Address:";
this.toolTip.SetToolTip(this.label7, "The address of the Process Environment Block (PEB).");
//
// textProtected
//
- this.textProtected.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textProtected.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textProtected.BackColor = System.Drawing.SystemColors.Control;
this.textProtected.Location = new System.Drawing.Point(101, 179);
- this.textProtected.Name = "textProtected";
this.textProtected.ReadOnly = true;
- this.textProtected.Size = new System.Drawing.Size(324, 22);
+ this.textProtected.Size = new System.Drawing.Size(329, 20);
this.textProtected.TabIndex = 10;
//
// labelProtected
//
this.labelProtected.AutoSize = true;
- this.labelProtected.Location = new System.Drawing.Point(4, 182);
- this.labelProtected.Name = "labelProtected";
- this.labelProtected.Size = new System.Drawing.Size(59, 13);
+ this.labelProtected.Location = new System.Drawing.Point(6, 182);
+ this.labelProtected.Size = new System.Drawing.Size(56, 13);
this.labelProtected.TabIndex = 18;
this.labelProtected.Text = "Protected:";
this.toolTip.SetToolTip(this.labelProtected, "Whether the process is DRM-protected.");
//
// textDEP
//
- this.textDEP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDEP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textDEP.BackColor = System.Drawing.SystemColors.Control;
this.textDEP.Location = new System.Drawing.Point(101, 153);
- this.textDEP.Name = "textDEP";
this.textDEP.ReadOnly = true;
- this.textDEP.Size = new System.Drawing.Size(324, 22);
+ this.textDEP.Size = new System.Drawing.Size(329, 20);
this.textDEP.TabIndex = 8;
//
// labelDEP
//
this.labelDEP.AutoSize = true;
- this.labelDEP.Location = new System.Drawing.Point(4, 156);
- this.labelDEP.Name = "labelDEP";
- this.labelDEP.Size = new System.Drawing.Size(30, 13);
+ this.labelDEP.Location = new System.Drawing.Point(6, 156);
+ this.labelDEP.Size = new System.Drawing.Size(32, 13);
this.labelDEP.TabIndex = 17;
this.labelDEP.Text = "DEP:";
this.toolTip.SetToolTip(this.labelDEP, "The status of Data Execution Prevention (DEP) for this process.");
@@ -356,8 +382,7 @@ namespace ProcessHacker
//
this.buttonTerminate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonTerminate.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonTerminate.Location = new System.Drawing.Point(380, 206);
- this.buttonTerminate.Name = "buttonTerminate";
+ this.buttonTerminate.Location = new System.Drawing.Point(385, 206);
this.buttonTerminate.Size = new System.Drawing.Size(75, 23);
this.buttonTerminate.TabIndex = 1;
this.buttonTerminate.Text = "Terminate";
@@ -368,8 +393,7 @@ namespace ProcessHacker
//
this.buttonInspectPEB.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonInspectPEB.Image = global::ProcessHacker.Properties.Resources.application_form_magnify;
- this.buttonInspectPEB.Location = new System.Drawing.Point(431, 98);
- this.buttonInspectPEB.Name = "buttonInspectPEB";
+ this.buttonInspectPEB.Location = new System.Drawing.Point(436, 98);
this.buttonInspectPEB.Size = new System.Drawing.Size(24, 24);
this.buttonInspectPEB.TabIndex = 5;
this.toolTip.SetToolTip(this.buttonInspectPEB, "Inspects the PEB.");
@@ -380,8 +404,7 @@ namespace ProcessHacker
//
this.buttonEditProtected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonEditProtected.Image = global::ProcessHacker.Properties.Resources.cog_edit;
- this.buttonEditProtected.Location = new System.Drawing.Point(431, 176);
- this.buttonEditProtected.Name = "buttonEditProtected";
+ this.buttonEditProtected.Location = new System.Drawing.Point(436, 176);
this.buttonEditProtected.Size = new System.Drawing.Size(24, 24);
this.buttonEditProtected.TabIndex = 11;
this.toolTip.SetToolTip(this.buttonEditProtected, "Allows you to protect or unprotect the process.");
@@ -392,8 +415,7 @@ namespace ProcessHacker
//
this.buttonInspectParent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonInspectParent.Image = global::ProcessHacker.Properties.Resources.application_form_magnify;
- this.buttonInspectParent.Location = new System.Drawing.Point(431, 124);
- this.buttonInspectParent.Name = "buttonInspectParent";
+ this.buttonInspectParent.Location = new System.Drawing.Point(436, 124);
this.buttonInspectParent.Size = new System.Drawing.Size(24, 24);
this.buttonInspectParent.TabIndex = 7;
this.toolTip.SetToolTip(this.buttonInspectParent, "Inspects the parent process.");
@@ -404,8 +426,7 @@ namespace ProcessHacker
//
this.buttonEditDEP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonEditDEP.Image = global::ProcessHacker.Properties.Resources.cog_edit;
- this.buttonEditDEP.Location = new System.Drawing.Point(431, 150);
- this.buttonEditDEP.Name = "buttonEditDEP";
+ this.buttonEditDEP.Location = new System.Drawing.Point(436, 150);
this.buttonEditDEP.Size = new System.Drawing.Size(24, 24);
this.buttonEditDEP.TabIndex = 9;
this.toolTip.SetToolTip(this.buttonEditDEP, "Allows you to change the process\' DEP policy.");
@@ -415,78 +436,71 @@ namespace ProcessHacker
// label5
//
this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(4, 130);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(43, 13);
+ this.label5.Location = new System.Drawing.Point(6, 130);
+ this.label5.Size = new System.Drawing.Size(41, 13);
this.label5.TabIndex = 16;
this.label5.Text = "Parent:";
this.toolTip.SetToolTip(this.label5, "The name and ID of the process which started this process.");
//
// textParent
//
- this.textParent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textParent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textParent.BackColor = System.Drawing.SystemColors.Control;
this.textParent.Location = new System.Drawing.Point(101, 127);
- this.textParent.Name = "textParent";
this.textParent.ReadOnly = true;
- this.textParent.Size = new System.Drawing.Size(324, 22);
+ this.textParent.Size = new System.Drawing.Size(329, 20);
this.textParent.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(4, 76);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(98, 13);
+ this.label4.Location = new System.Drawing.Point(6, 76);
+ this.label4.Size = new System.Drawing.Size(89, 13);
this.label4.TabIndex = 14;
this.label4.Text = "Current Directory:";
this.toolTip.SetToolTip(this.label4, "The program\'s current directory.");
//
// textPEBAddress
//
- this.textPEBAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textPEBAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textPEBAddress.Location = new System.Drawing.Point(101, 101);
- this.textPEBAddress.Name = "textPEBAddress";
this.textPEBAddress.ReadOnly = true;
- this.textPEBAddress.Size = new System.Drawing.Size(324, 22);
+ this.textPEBAddress.Size = new System.Drawing.Size(329, 20);
this.textPEBAddress.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(4, 48);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(86, 13);
+ this.label2.Location = new System.Drawing.Point(6, 48);
+ this.label2.Size = new System.Drawing.Size(80, 13);
this.label2.TabIndex = 13;
this.label2.Text = "Command Line:";
this.toolTip.SetToolTip(this.label2, "The command used to start the program.");
//
// textStartTime
//
- this.textStartTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textStartTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textStartTime.Location = new System.Drawing.Point(101, 19);
- this.textStartTime.Name = "textStartTime";
this.textStartTime.ReadOnly = true;
- this.textStartTime.Size = new System.Drawing.Size(354, 22);
+ this.textStartTime.Size = new System.Drawing.Size(359, 20);
this.textStartTime.TabIndex = 0;
//
// textCmdLine
//
- this.textCmdLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textCmdLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textCmdLine.Location = new System.Drawing.Point(101, 45);
- this.textCmdLine.Name = "textCmdLine";
this.textCmdLine.ReadOnly = true;
- this.textCmdLine.Size = new System.Drawing.Size(354, 22);
+ this.textCmdLine.Size = new System.Drawing.Size(359, 20);
this.textCmdLine.TabIndex = 2;
//
// groupFile
//
- this.groupFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.groupFile.Controls.Add(this.fileImage);
this.groupFile.Controls.Add(this.pictureIcon);
this.groupFile.Controls.Add(this.textFileDescription);
@@ -495,26 +509,23 @@ namespace ProcessHacker
this.groupFile.Controls.Add(this.label3);
this.groupFile.Controls.Add(this.textFileVersion);
this.groupFile.Location = new System.Drawing.Point(6, 7);
- this.groupFile.Name = "groupFile";
- this.groupFile.Size = new System.Drawing.Size(463, 114);
+ this.groupFile.Size = new System.Drawing.Size(468, 114);
this.groupFile.TabIndex = 0;
this.groupFile.TabStop = false;
this.groupFile.Text = "File";
//
// fileImage
//
- this.fileImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.fileImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.fileImage.Location = new System.Drawing.Point(103, 83);
- this.fileImage.Name = "fileImage";
this.fileImage.ReadOnly = true;
- this.fileImage.Size = new System.Drawing.Size(354, 24);
+ this.fileImage.Size = new System.Drawing.Size(359, 24);
this.fileImage.TabIndex = 1;
//
// pictureIcon
//
this.pictureIcon.Location = new System.Drawing.Point(6, 19);
- this.pictureIcon.Name = "pictureIcon";
this.pictureIcon.Size = new System.Drawing.Size(32, 32);
this.pictureIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureIcon.TabIndex = 1;
@@ -522,27 +533,25 @@ namespace ProcessHacker
//
// textFileDescription
//
- this.textFileDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileDescription.BackColor = System.Drawing.SystemColors.Window;
this.textFileDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textFileDescription.Location = new System.Drawing.Point(44, 20);
- this.textFileDescription.Name = "textFileDescription";
this.textFileDescription.ReadOnly = true;
- this.textFileDescription.Size = new System.Drawing.Size(413, 15);
+ this.textFileDescription.Size = new System.Drawing.Size(418, 13);
this.textFileDescription.TabIndex = 2;
this.textFileDescription.Text = "File Description";
//
// textFileCompany
//
- this.textFileCompany.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileCompany.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileCompany.BackColor = System.Drawing.SystemColors.Window;
this.textFileCompany.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textFileCompany.Location = new System.Drawing.Point(44, 38);
- this.textFileCompany.Name = "textFileCompany";
this.textFileCompany.ReadOnly = true;
- this.textFileCompany.Size = new System.Drawing.Size(413, 15);
+ this.textFileCompany.Size = new System.Drawing.Size(418, 13);
this.textFileCompany.TabIndex = 3;
this.textFileCompany.Text = "File Company";
//
@@ -550,8 +559,7 @@ namespace ProcessHacker
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 60);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(83, 13);
+ this.label1.Size = new System.Drawing.Size(77, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Image Version:";
this.toolTip.SetToolTip(this.label1, "The version of the program.");
@@ -560,28 +568,25 @@ namespace ProcessHacker
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 88);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(94, 13);
+ this.label3.Size = new System.Drawing.Size(89, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Image File Name:";
this.toolTip.SetToolTip(this.label3, "The file name of the program.");
//
// textFileVersion
//
- this.textFileVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textFileVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textFileVersion.Location = new System.Drawing.Point(103, 57);
- this.textFileVersion.Name = "textFileVersion";
this.textFileVersion.ReadOnly = true;
- this.textFileVersion.Size = new System.Drawing.Size(354, 22);
+ this.textFileVersion.Size = new System.Drawing.Size(359, 20);
this.textFileVersion.TabIndex = 0;
//
// tabStatistics
//
- this.tabStatistics.Location = new System.Drawing.Point(4, 40);
- this.tabStatistics.Name = "tabStatistics";
+ this.tabStatistics.Location = new System.Drawing.Point(4, 22);
this.tabStatistics.Padding = new System.Windows.Forms.Padding(3);
- this.tabStatistics.Size = new System.Drawing.Size(475, 480);
+ this.tabStatistics.Size = new System.Drawing.Size(480, 405);
this.tabStatistics.TabIndex = 9;
this.tabStatistics.Text = "Statistics";
this.tabStatistics.UseVisualStyleBackColor = true;
@@ -589,10 +594,9 @@ namespace ProcessHacker
// tabPerformance
//
this.tabPerformance.Controls.Add(this.tablePerformance);
- this.tabPerformance.Location = new System.Drawing.Point(4, 40);
- this.tabPerformance.Name = "tabPerformance";
+ this.tabPerformance.Location = new System.Drawing.Point(4, 22);
this.tabPerformance.Padding = new System.Windows.Forms.Padding(3);
- this.tabPerformance.Size = new System.Drawing.Size(475, 480);
+ this.tabPerformance.Size = new System.Drawing.Size(480, 405);
this.tabPerformance.TabIndex = 8;
this.tabPerformance.Text = "Performance";
this.tabPerformance.UseVisualStyleBackColor = true;
@@ -610,21 +614,19 @@ namespace ProcessHacker
this.tablePerformance.Controls.Add(this.groupBoxCpu, 0, 0);
this.tablePerformance.Dock = System.Windows.Forms.DockStyle.Fill;
this.tablePerformance.Location = new System.Drawing.Point(3, 3);
- this.tablePerformance.Name = "tablePerformance";
this.tablePerformance.RowCount = 3;
this.tablePerformance.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tablePerformance.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tablePerformance.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
- this.tablePerformance.Size = new System.Drawing.Size(469, 474);
+ this.tablePerformance.Size = new System.Drawing.Size(474, 399);
this.tablePerformance.TabIndex = 1;
//
// groupBoxIO
//
this.groupBoxIO.Controls.Add(this.indicatorIO);
this.groupBoxIO.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBoxIO.Location = new System.Drawing.Point(3, 319);
- this.groupBoxIO.Name = "groupBoxIO";
- this.groupBoxIO.Size = new System.Drawing.Size(80, 152);
+ this.groupBoxIO.Location = new System.Drawing.Point(3, 269);
+ this.groupBoxIO.Size = new System.Drawing.Size(80, 127);
this.groupBoxIO.TabIndex = 3;
this.groupBoxIO.TabStop = false;
this.groupBoxIO.Text = "I/O (R+O)";
@@ -639,11 +641,10 @@ namespace ProcessHacker
this.indicatorIO.Dock = System.Windows.Forms.DockStyle.Fill;
this.indicatorIO.ForeColor = System.Drawing.Color.Lime;
this.indicatorIO.GraphWidth = 33;
- this.indicatorIO.Location = new System.Drawing.Point(3, 18);
+ this.indicatorIO.Location = new System.Drawing.Point(3, 16);
this.indicatorIO.Maximum = ((long)(2147483647));
this.indicatorIO.Minimum = ((long)(0));
- this.indicatorIO.Name = "indicatorIO";
- this.indicatorIO.Size = new System.Drawing.Size(74, 131);
+ this.indicatorIO.Size = new System.Drawing.Size(74, 108);
this.indicatorIO.TabIndex = 1;
this.indicatorIO.TextValue = "";
//
@@ -651,9 +652,8 @@ namespace ProcessHacker
//
this.groupBoxPvt.Controls.Add(this.indicatorPvt);
this.groupBoxPvt.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBoxPvt.Location = new System.Drawing.Point(3, 161);
- this.groupBoxPvt.Name = "groupBoxPvt";
- this.groupBoxPvt.Size = new System.Drawing.Size(80, 152);
+ this.groupBoxPvt.Location = new System.Drawing.Point(3, 136);
+ this.groupBoxPvt.Size = new System.Drawing.Size(80, 127);
this.groupBoxPvt.TabIndex = 2;
this.groupBoxPvt.TabStop = false;
this.groupBoxPvt.Text = "Pvt. Pages";
@@ -668,11 +668,10 @@ namespace ProcessHacker
this.indicatorPvt.Dock = System.Windows.Forms.DockStyle.Fill;
this.indicatorPvt.ForeColor = System.Drawing.Color.Lime;
this.indicatorPvt.GraphWidth = 33;
- this.indicatorPvt.Location = new System.Drawing.Point(3, 18);
+ this.indicatorPvt.Location = new System.Drawing.Point(3, 16);
this.indicatorPvt.Maximum = ((long)(2147483647));
this.indicatorPvt.Minimum = ((long)(0));
- this.indicatorPvt.Name = "indicatorPvt";
- this.indicatorPvt.Size = new System.Drawing.Size(74, 131);
+ this.indicatorPvt.Size = new System.Drawing.Size(74, 108);
this.indicatorPvt.TabIndex = 1;
this.indicatorPvt.TextValue = "";
//
@@ -681,8 +680,7 @@ namespace ProcessHacker
this.groupCPUUsage.Controls.Add(this.plotterCPUUsage);
this.groupCPUUsage.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupCPUUsage.Location = new System.Drawing.Point(89, 3);
- this.groupCPUUsage.Name = "groupCPUUsage";
- this.groupCPUUsage.Size = new System.Drawing.Size(377, 152);
+ this.groupCPUUsage.Size = new System.Drawing.Size(382, 127);
this.groupCPUUsage.TabIndex = 0;
this.groupCPUUsage.TabStop = false;
this.groupCPUUsage.Text = "CPU Usage (Kernel, User)";
@@ -690,22 +688,16 @@ namespace ProcessHacker
// plotterCPUUsage
//
this.plotterCPUUsage.BackColor = System.Drawing.Color.Black;
- this.plotterCPUUsage.Data1 = null;
- this.plotterCPUUsage.Data2 = null;
this.plotterCPUUsage.Dock = System.Windows.Forms.DockStyle.Fill;
this.plotterCPUUsage.GridColor = System.Drawing.Color.Green;
this.plotterCPUUsage.GridSize = new System.Drawing.Size(12, 12);
this.plotterCPUUsage.LineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.plotterCPUUsage.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.plotterCPUUsage.Location = new System.Drawing.Point(3, 18);
- this.plotterCPUUsage.LongData1 = null;
- this.plotterCPUUsage.LongData2 = null;
+ this.plotterCPUUsage.Location = new System.Drawing.Point(3, 16);
this.plotterCPUUsage.MinMaxValue = ((long)(0));
this.plotterCPUUsage.MoveStep = -1;
- this.plotterCPUUsage.Name = "plotterCPUUsage";
this.plotterCPUUsage.OverlaySecondLine = false;
- this.plotterCPUUsage.ShowGrid = true;
- this.plotterCPUUsage.Size = new System.Drawing.Size(371, 131);
+ this.plotterCPUUsage.Size = new System.Drawing.Size(376, 108);
this.plotterCPUUsage.TabIndex = 0;
this.plotterCPUUsage.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.plotterCPUUsage.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
@@ -719,9 +711,8 @@ namespace ProcessHacker
//
this.groupBox2.Controls.Add(this.plotterMemory);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox2.Location = new System.Drawing.Point(89, 161);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(377, 152);
+ this.groupBox2.Location = new System.Drawing.Point(89, 136);
+ this.groupBox2.Size = new System.Drawing.Size(382, 127);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Memory (Private Pages, Working Set)";
@@ -729,22 +720,16 @@ namespace ProcessHacker
// plotterMemory
//
this.plotterMemory.BackColor = System.Drawing.Color.Black;
- this.plotterMemory.Data1 = null;
- this.plotterMemory.Data2 = null;
this.plotterMemory.Dock = System.Windows.Forms.DockStyle.Fill;
this.plotterMemory.GridColor = System.Drawing.Color.Green;
this.plotterMemory.GridSize = new System.Drawing.Size(12, 12);
this.plotterMemory.LineColor1 = System.Drawing.Color.Orange;
this.plotterMemory.LineColor2 = System.Drawing.Color.Cyan;
- this.plotterMemory.Location = new System.Drawing.Point(3, 18);
- this.plotterMemory.LongData1 = null;
- this.plotterMemory.LongData2 = null;
+ this.plotterMemory.Location = new System.Drawing.Point(3, 16);
this.plotterMemory.MinMaxValue = ((long)(0));
this.plotterMemory.MoveStep = -1;
- this.plotterMemory.Name = "plotterMemory";
this.plotterMemory.OverlaySecondLine = true;
- this.plotterMemory.ShowGrid = true;
- this.plotterMemory.Size = new System.Drawing.Size(371, 131);
+ this.plotterMemory.Size = new System.Drawing.Size(376, 108);
this.plotterMemory.TabIndex = 0;
this.plotterMemory.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.plotterMemory.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
@@ -758,9 +743,8 @@ namespace ProcessHacker
//
this.groupBox3.Controls.Add(this.plotterIO);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox3.Location = new System.Drawing.Point(89, 319);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(377, 152);
+ this.groupBox3.Location = new System.Drawing.Point(89, 269);
+ this.groupBox3.Size = new System.Drawing.Size(382, 127);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "I/O (R+O, W)";
@@ -775,15 +759,14 @@ namespace ProcessHacker
this.plotterIO.GridSize = new System.Drawing.Size(12, 12);
this.plotterIO.LineColor1 = System.Drawing.Color.Yellow;
this.plotterIO.LineColor2 = System.Drawing.Color.Purple;
- this.plotterIO.Location = new System.Drawing.Point(3, 18);
+ this.plotterIO.Location = new System.Drawing.Point(3, 16);
this.plotterIO.LongData1 = null;
this.plotterIO.LongData2 = null;
this.plotterIO.MinMaxValue = ((long)(0));
this.plotterIO.MoveStep = -1;
- this.plotterIO.Name = "plotterIO";
this.plotterIO.OverlaySecondLine = true;
this.plotterIO.ShowGrid = true;
- this.plotterIO.Size = new System.Drawing.Size(371, 131);
+ this.plotterIO.Size = new System.Drawing.Size(376, 108);
this.plotterIO.TabIndex = 0;
this.plotterIO.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.plotterIO.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
@@ -798,8 +781,7 @@ namespace ProcessHacker
this.groupBoxCpu.Controls.Add(this.indicatorCpu);
this.groupBoxCpu.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBoxCpu.Location = new System.Drawing.Point(3, 3);
- this.groupBoxCpu.Name = "groupBoxCpu";
- this.groupBoxCpu.Size = new System.Drawing.Size(80, 152);
+ this.groupBoxCpu.Size = new System.Drawing.Size(80, 127);
this.groupBoxCpu.TabIndex = 1;
this.groupBoxCpu.TabStop = false;
this.groupBoxCpu.Text = "CPU Usage";
@@ -814,20 +796,18 @@ namespace ProcessHacker
this.indicatorCpu.Dock = System.Windows.Forms.DockStyle.Fill;
this.indicatorCpu.ForeColor = System.Drawing.Color.Lime;
this.indicatorCpu.GraphWidth = 33;
- this.indicatorCpu.Location = new System.Drawing.Point(3, 18);
+ this.indicatorCpu.Location = new System.Drawing.Point(3, 16);
this.indicatorCpu.Maximum = ((long)(2147483647));
this.indicatorCpu.Minimum = ((long)(0));
- this.indicatorCpu.Name = "indicatorCpu";
- this.indicatorCpu.Size = new System.Drawing.Size(74, 131);
+ this.indicatorCpu.Size = new System.Drawing.Size(74, 108);
this.indicatorCpu.TabIndex = 0;
this.indicatorCpu.TextValue = "";
//
// tabThreads
//
this.tabThreads.Controls.Add(this.listThreads);
- this.tabThreads.Location = new System.Drawing.Point(4, 40);
- this.tabThreads.Name = "tabThreads";
- this.tabThreads.Size = new System.Drawing.Size(475, 480);
+ this.tabThreads.Location = new System.Drawing.Point(4, 22);
+ this.tabThreads.Size = new System.Drawing.Size(480, 405);
this.tabThreads.TabIndex = 3;
this.tabThreads.Text = "Threads";
this.tabThreads.UseVisualStyleBackColor = true;
@@ -836,18 +816,16 @@ namespace ProcessHacker
//
this.listThreads.Cursor = System.Windows.Forms.Cursors.Default;
this.listThreads.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listThreads.DoubleBuffered = true;
this.listThreads.Location = new System.Drawing.Point(0, 0);
- this.listThreads.Name = "listThreads";
- this.listThreads.Provider = null;
- this.listThreads.Size = new System.Drawing.Size(475, 480);
+ this.listThreads.Size = new System.Drawing.Size(480, 405);
this.listThreads.TabIndex = 0;
//
// tabToken
//
- this.tabToken.Location = new System.Drawing.Point(4, 40);
- this.tabToken.Name = "tabToken";
+ this.tabToken.Location = new System.Drawing.Point(4, 22);
this.tabToken.Padding = new System.Windows.Forms.Padding(3);
- this.tabToken.Size = new System.Drawing.Size(475, 480);
+ this.tabToken.Size = new System.Drawing.Size(480, 405);
this.tabToken.TabIndex = 1;
this.tabToken.Text = "Token";
this.tabToken.UseVisualStyleBackColor = true;
@@ -855,9 +833,8 @@ namespace ProcessHacker
// tabModules
//
this.tabModules.Controls.Add(this.listModules);
- this.tabModules.Location = new System.Drawing.Point(4, 40);
- this.tabModules.Name = "tabModules";
- this.tabModules.Size = new System.Drawing.Size(475, 480);
+ this.tabModules.Location = new System.Drawing.Point(4, 22);
+ this.tabModules.Size = new System.Drawing.Size(480, 405);
this.tabModules.TabIndex = 6;
this.tabModules.Text = "Modules";
this.tabModules.UseVisualStyleBackColor = true;
@@ -865,10 +842,9 @@ namespace ProcessHacker
// listModules
//
this.listModules.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.listModules.DoubleBuffered = true;
this.listModules.Location = new System.Drawing.Point(0, 0);
- this.listModules.Name = "listModules";
- this.listModules.Provider = null;
- this.listModules.Size = new System.Drawing.Size(475, 480);
+ this.listModules.Size = new System.Drawing.Size(480, 405);
this.listModules.TabIndex = 0;
//
// tabMemory
@@ -877,10 +853,9 @@ namespace ProcessHacker
this.tabMemory.Controls.Add(this.checkHideFreeRegions);
this.tabMemory.Controls.Add(this.buttonSearch);
this.tabMemory.Controls.Add(this.listMemory);
- this.tabMemory.Location = new System.Drawing.Point(4, 40);
- this.tabMemory.Name = "tabMemory";
+ this.tabMemory.Location = new System.Drawing.Point(4, 22);
this.tabMemory.Padding = new System.Windows.Forms.Padding(3);
- this.tabMemory.Size = new System.Drawing.Size(475, 480);
+ this.tabMemory.Size = new System.Drawing.Size(480, 405);
this.tabMemory.TabIndex = 4;
this.tabMemory.Text = "Memory";
this.tabMemory.UseVisualStyleBackColor = true;
@@ -889,7 +864,6 @@ namespace ProcessHacker
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(8, 11);
- this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(44, 13);
this.label15.TabIndex = 3;
this.label15.Text = "Search:";
@@ -901,8 +875,7 @@ namespace ProcessHacker
this.checkHideFreeRegions.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkHideFreeRegions.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkHideFreeRegions.Location = new System.Drawing.Point(6, 35);
- this.checkHideFreeRegions.Name = "checkHideFreeRegions";
- this.checkHideFreeRegions.Size = new System.Drawing.Size(126, 18);
+ this.checkHideFreeRegions.Size = new System.Drawing.Size(120, 18);
this.checkHideFreeRegions.TabIndex = 1;
this.checkHideFreeRegions.Text = "Hide Free Regions";
this.checkHideFreeRegions.UseVisualStyleBackColor = true;
@@ -912,31 +885,75 @@ namespace ProcessHacker
//
this.buttonSearch.AutoSize = true;
this.buttonSearch.Location = new System.Drawing.Point(58, 7);
- this.buttonSearch.Name = "buttonSearch";
this.buttonSearch.Size = new System.Drawing.Size(117, 25);
+ this.buttonSearch.SplitMenu = this.menuSearch;
this.buttonSearch.TabIndex = 0;
this.buttonSearch.Text = "&String Scan...";
this.buttonSearch.UseVisualStyleBackColor = true;
this.buttonSearch.Click += new System.EventHandler(this.buttonSearch_Click);
//
+ // menuSearch
+ //
+ this.menuSearch.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.newWindowSearchMenuItem,
+ this.literalSearchMenuItem,
+ this.regexSearchMenuItem,
+ this.stringScanMenuItem,
+ this.heapScanMenuItem,
+ this.structSearchMenuItem});
+ //
+ // newWindowSearchMenuItem
+ //
+ this.newWindowSearchMenuItem.Index = 0;
+ this.newWindowSearchMenuItem.Text = "&New Window...";
+ this.newWindowSearchMenuItem.Click += new System.EventHandler(this.newWindowSearchMenuItem_Click);
+ //
+ // literalSearchMenuItem
+ //
+ this.literalSearchMenuItem.Index = 1;
+ this.literalSearchMenuItem.Text = "&Literal...";
+ this.literalSearchMenuItem.Click += new System.EventHandler(this.literalSearchMenuItem_Click);
+ //
+ // regexSearchMenuItem
+ //
+ this.regexSearchMenuItem.Index = 2;
+ this.regexSearchMenuItem.Text = "&Regex...";
+ this.regexSearchMenuItem.Click += new System.EventHandler(this.regexSearchMenuItem_Click);
+ //
+ // stringScanMenuItem
+ //
+ this.stringScanMenuItem.Index = 3;
+ this.stringScanMenuItem.Text = "&String Scan...";
+ this.stringScanMenuItem.Click += new System.EventHandler(this.stringScanMenuItem_Click);
+ //
+ // heapScanMenuItem
+ //
+ this.heapScanMenuItem.Index = 4;
+ this.heapScanMenuItem.Text = "&Heap Scan...";
+ this.heapScanMenuItem.Click += new System.EventHandler(this.heapScanMenuItem_Click);
+ //
+ // structSearchMenuItem
+ //
+ this.structSearchMenuItem.Index = 5;
+ this.structSearchMenuItem.Text = "S&truct...";
+ this.structSearchMenuItem.Click += new System.EventHandler(this.structSearchMenuItem_Click);
+ //
// listMemory
//
- this.listMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.listMemory.DoubleBuffered = true;
this.listMemory.Location = new System.Drawing.Point(6, 59);
- this.listMemory.Name = "listMemory";
- this.listMemory.Provider = null;
- this.listMemory.Size = new System.Drawing.Size(463, 415);
+ this.listMemory.Size = new System.Drawing.Size(469, 340);
this.listMemory.TabIndex = 2;
//
// tabEnvironment
//
this.tabEnvironment.Controls.Add(this.listEnvironment);
- this.tabEnvironment.Location = new System.Drawing.Point(4, 40);
- this.tabEnvironment.Name = "tabEnvironment";
+ this.tabEnvironment.Location = new System.Drawing.Point(4, 22);
this.tabEnvironment.Padding = new System.Windows.Forms.Padding(3);
- this.tabEnvironment.Size = new System.Drawing.Size(475, 480);
+ this.tabEnvironment.Size = new System.Drawing.Size(480, 405);
this.tabEnvironment.TabIndex = 10;
this.tabEnvironment.Text = "Environment";
this.tabEnvironment.UseVisualStyleBackColor = true;
@@ -947,13 +964,11 @@ namespace ProcessHacker
this.columnVarName,
this.columnVarValue});
this.listEnvironment.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listEnvironment.DoubleClickChecks = true;
this.listEnvironment.FullRowSelect = true;
this.listEnvironment.HideSelection = false;
this.listEnvironment.Location = new System.Drawing.Point(3, 3);
- this.listEnvironment.Name = "listEnvironment";
this.listEnvironment.ShowItemToolTips = true;
- this.listEnvironment.Size = new System.Drawing.Size(469, 474);
+ this.listEnvironment.Size = new System.Drawing.Size(474, 399);
this.listEnvironment.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listEnvironment.TabIndex = 0;
this.listEnvironment.UseCompatibleStateImageBehavior = false;
@@ -974,9 +989,8 @@ namespace ProcessHacker
this.tabHandles.Controls.Add(this.checkHideHandlesNoName);
this.tabHandles.Controls.Add(this.listHandles);
this.tabHandles.Location = new System.Drawing.Point(4, 40);
- this.tabHandles.Name = "tabHandles";
this.tabHandles.Padding = new System.Windows.Forms.Padding(3);
- this.tabHandles.Size = new System.Drawing.Size(475, 480);
+ this.tabHandles.Size = new System.Drawing.Size(480, 387);
this.tabHandles.TabIndex = 5;
this.tabHandles.Text = "Handles";
this.tabHandles.UseVisualStyleBackColor = true;
@@ -986,8 +1000,7 @@ namespace ProcessHacker
this.checkHideHandlesNoName.AutoSize = true;
this.checkHideHandlesNoName.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkHideHandlesNoName.Location = new System.Drawing.Point(6, 7);
- this.checkHideHandlesNoName.Name = "checkHideHandlesNoName";
- this.checkHideHandlesNoName.Size = new System.Drawing.Size(174, 18);
+ this.checkHideHandlesNoName.Size = new System.Drawing.Size(160, 18);
this.checkHideHandlesNoName.TabIndex = 0;
this.checkHideHandlesNoName.Text = "Hide handles with no name";
this.checkHideHandlesNoName.UseVisualStyleBackColor = true;
@@ -995,20 +1008,18 @@ namespace ProcessHacker
//
// listHandles
//
- this.listHandles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listHandles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.listHandles.DoubleBuffered = true;
this.listHandles.Location = new System.Drawing.Point(6, 30);
- this.listHandles.Name = "listHandles";
- this.listHandles.Provider = null;
- this.listHandles.Size = new System.Drawing.Size(463, 444);
+ this.listHandles.Size = new System.Drawing.Size(469, 351);
this.listHandles.TabIndex = 1;
//
// tabJob
//
this.tabJob.Location = new System.Drawing.Point(4, 40);
- this.tabJob.Name = "tabJob";
- this.tabJob.Size = new System.Drawing.Size(475, 480);
+ this.tabJob.Size = new System.Drawing.Size(480, 387);
this.tabJob.TabIndex = 11;
this.tabJob.Text = "Job";
this.tabJob.UseVisualStyleBackColor = true;
@@ -1016,91 +1027,27 @@ namespace ProcessHacker
// tabServices
//
this.tabServices.Location = new System.Drawing.Point(4, 40);
- this.tabServices.Name = "tabServices";
- this.tabServices.Size = new System.Drawing.Size(475, 480);
+ this.tabServices.Size = new System.Drawing.Size(480, 387);
this.tabServices.TabIndex = 7;
this.tabServices.Text = "Services";
this.tabServices.UseVisualStyleBackColor = true;
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// tabDotNet
//
this.tabDotNet.Location = new System.Drawing.Point(4, 40);
- this.tabDotNet.Name = "tabDotNet";
this.tabDotNet.Padding = new System.Windows.Forms.Padding(3);
- this.tabDotNet.Size = new System.Drawing.Size(475, 480);
+ this.tabDotNet.Size = new System.Drawing.Size(480, 387);
this.tabDotNet.TabIndex = 12;
this.tabDotNet.Text = ".NET";
this.tabDotNet.UseVisualStyleBackColor = true;
- //
- // contextMenuStripSearch
- //
- this.contextMenuStripSearch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.newWindowToolStripMenuItem,
- this.literalToolStripMenuItem,
- this.regexToolStripMenuItem,
- this.stringScanToolStripMenuItem,
- this.heapScanToolStripMenuItem,
- this.structToolStripMenuItem});
- this.contextMenuStripSearch.Name = "contextMenuStripSearch";
- this.contextMenuStripSearch.Size = new System.Drawing.Size(155, 136);
- //
- // newWindowToolStripMenuItem
- //
- this.newWindowToolStripMenuItem.Name = "newWindowToolStripMenuItem";
- this.newWindowToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
- this.newWindowToolStripMenuItem.Text = "&New Window...";
- this.newWindowToolStripMenuItem.Click += new System.EventHandler(this.newWindowSearchMenuItem_Click);
- //
- // literalToolStripMenuItem
- //
- this.literalToolStripMenuItem.Name = "literalToolStripMenuItem";
- this.literalToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
- this.literalToolStripMenuItem.Text = "&Literal...";
- this.literalToolStripMenuItem.Click += new System.EventHandler(this.literalSearchMenuItem_Click);
- //
- // regexToolStripMenuItem
- //
- this.regexToolStripMenuItem.Name = "regexToolStripMenuItem";
- this.regexToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
- this.regexToolStripMenuItem.Text = "&Regex...";
- this.regexToolStripMenuItem.Click += new System.EventHandler(this.regexSearchMenuItem_Click);
- //
- // stringScanToolStripMenuItem
- //
- this.stringScanToolStripMenuItem.Name = "stringScanToolStripMenuItem";
- this.stringScanToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
- this.stringScanToolStripMenuItem.Text = "&String Scan...";
- this.stringScanToolStripMenuItem.Click += new System.EventHandler(this.stringScanMenuItem_Click);
- //
- // heapScanToolStripMenuItem
- //
- this.heapScanToolStripMenuItem.Name = "heapScanToolStripMenuItem";
- this.heapScanToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
- this.heapScanToolStripMenuItem.Text = "&Heap Scan...";
- this.heapScanToolStripMenuItem.Click += new System.EventHandler(this.heapScanMenuItem_Click);
- //
- // structToolStripMenuItem
- //
- this.structToolStripMenuItem.Name = "structToolStripMenuItem";
- this.structToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
- this.structToolStripMenuItem.Text = "S&truct...";
- this.structToolStripMenuItem.Click += new System.EventHandler(this.structSearchMenuItem_Click);
- //
- // ProcessWindow
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(507, 548);
+
this.Controls.Add(this.tabControl);
- this.KeyPreview = true;
- this.MinimumSize = new System.Drawing.Size(523, 586);
- this.Name = "ProcessWindow";
- this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- this.Text = "Process";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProcessWindow_FormClosing);
- this.Load += new System.EventHandler(this.ProcessWindow_Load);
- this.SizeChanged += new System.EventHandler(this.ProcessWindow_SizeChanged);
+
this.tabControl.ResumeLayout(false);
this.tabGeneral.ResumeLayout(false);
this.groupProcess.ResumeLayout(false);
@@ -1123,13 +1070,18 @@ namespace ProcessHacker
this.tabEnvironment.ResumeLayout(false);
this.tabHandles.ResumeLayout(false);
this.tabHandles.PerformLayout();
- this.contextMenuStripSearch.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
}
#endregion
+ private System.Windows.Forms.MainMenu mainMenu;
+ private wyDay.Controls.VistaMenu vistaMenu;
+ private System.Windows.Forms.MenuItem processMenuItem;
+ private System.Windows.Forms.MenuItem windowMenuItem;
+ private System.Windows.Forms.MenuItem inspectImageFileMenuItem;
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.TabPage tabToken;
private System.Windows.Forms.TabPage tabGeneral;
@@ -1153,12 +1105,19 @@ namespace ProcessHacker
private ProcessHacker.Components.ModuleList listModules;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textParent;
+ private ProcessHacker.Components.HandleList listHandles;
private ProcessHacker.Components.MemoryList listMemory;
private System.Windows.Forms.Button buttonTerminate;
private System.Windows.Forms.TextBox textDEP;
private System.Windows.Forms.Label labelDEP;
private System.Windows.Forms.Button buttonEditDEP;
private System.Windows.Forms.Button buttonInspectParent;
+ private System.Windows.Forms.ContextMenu menuSearch;
+ private System.Windows.Forms.MenuItem newWindowSearchMenuItem;
+ private System.Windows.Forms.MenuItem literalSearchMenuItem;
+ private System.Windows.Forms.MenuItem regexSearchMenuItem;
+ private System.Windows.Forms.MenuItem stringScanMenuItem;
+ private System.Windows.Forms.MenuItem heapScanMenuItem;
private System.Windows.Forms.CheckBox checkHideFreeRegions;
private System.Windows.Forms.CheckBox checkHideHandlesNoName;
private wyDay.Controls.SplitButton buttonSearch;
@@ -1179,12 +1138,13 @@ namespace ProcessHacker
private System.Windows.Forms.TextBox textStartTime;
private ProcessHacker.Components.FileNameBox fileCurrentDirectory;
private ProcessHacker.Components.FileNameBox fileImage;
+ private System.Windows.Forms.MenuItem structSearchMenuItem;
private System.Windows.Forms.TextBox textProtected;
private System.Windows.Forms.Label labelProtected;
private System.Windows.Forms.Button buttonEditProtected;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.TabPage tabEnvironment;
- private ExtendedListView listEnvironment;
+ private System.Windows.Forms.ListView listEnvironment;
private System.Windows.Forms.ColumnHeader columnVarName;
private System.Windows.Forms.ColumnHeader columnVarValue;
private System.Windows.Forms.TabPage tabJob;
@@ -1198,13 +1158,5 @@ namespace ProcessHacker
private System.Windows.Forms.Label labelProcessTypeValue;
private System.Windows.Forms.Button buttonPermissions;
private System.Windows.Forms.TabPage tabDotNet;
- private System.Windows.Forms.ContextMenuStrip contextMenuStripSearch;
- private System.Windows.Forms.ToolStripMenuItem newWindowToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem literalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem regexToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem stringScanToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem heapScanToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem structToolStripMenuItem;
- private HandleList listHandles;
}
}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessWindow.cs b/1.x/trunk/ProcessHacker/Forms/ProcessWindow.cs
index 85d39aabd..28ced5283 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessWindow.cs
@@ -41,8 +41,10 @@ namespace ProcessHacker
{
public partial class ProcessWindow : Form
{
- private readonly ProcessItem _processItem;
- private readonly int _pid;
+ private bool _isFirstPaint = true;
+
+ private ProcessItem _processItem;
+ private int _pid;
private ProcessHandle _processHandle;
private Bitmap _processImage;
@@ -56,12 +58,13 @@ namespace ProcessHacker
private JobProperties _jobProps;
private ServiceProperties _serviceProps;
private DotNetCounters _dotNetCounters;
- private bool _dotNetCountersInitialized;
+ private bool _dotNetCountersInitialized = false;
private ProcessHacker.Common.Threading.ActionSync _selectThreadRun;
public ProcessWindow(ProcessItem process)
{
+ this.SetPhParent();
InitializeComponent();
this.AddEscapeToClose();
this.SetTopMost();
@@ -74,15 +77,16 @@ namespace ProcessHacker
else
this.Icon = Program.HackerWindow.Icon;
- textFileDescription.Text = string.Empty;
- textFileCompany.Text = string.Empty;
- textFileVersion.Text = string.Empty;
+ textFileDescription.Text = "";
+ textFileCompany.Text = "";
+ textFileVersion.Text = "";
if (!Program.PWindows.ContainsKey(_pid))
Program.PWindows.Add(_pid, this);
this.FixTabs();
-
+
+ _dontCalculate = false;
_selectThreadRun = new ProcessHacker.Common.Threading.ActionSync(this.SelectThreadInternal, 2);
}
@@ -111,38 +115,66 @@ namespace ProcessHacker
Utils.FitRectangle(new Rectangle(location, this.Size), this).Location;
// Update the Window menu.
- //Program.UpdateWindowMenu(windowMenuItem, this);
+ Program.UpdateWindowMenu(windowMenuItem, this);
SymbolProviderExtensions.ShowWarning(this, false);
-
- this.LoadStage1();
}
- public ExtendedListView ThreadListView
+ public ListView ThreadListView
{
get { return listThreads.List; }
}
- public ExtendedListView ModuleListView
+ public ListView ModuleListView
{
get { return listModules.List; }
}
- public ExtendedListView MemoryListView
+ public ListView MemoryListView
{
get { return listMemory.List; }
}
- public ExtendedListView HandleListView
+ public ListView HandleListView
{
get { return listHandles.List; }
}
- public ExtendedListView ServiceListView
+ public ListView ServiceListView
{
get { return _serviceProps.List; }
}
+ // ==== Performance hacks ====
+ protected override void WndProc(ref Message m)
+ {
+ switch (m.Msg)
+ {
+ case (int)WindowMessage.Paint:
+ {
+ if (_isFirstPaint)
+ {
+ _isFirstPaint = false;
+ this.LoadStage1();
+ }
+ }
+ break;
+ }
+
+ if (!this.IsDisposed)
+ base.WndProc(ref m);
+ }
+
+ private bool _dontCalculate = true;
+
+ protected override void OnResize(EventArgs e)
+ {
+ if (_dontCalculate)
+ return;
+
+ base.OnResize(e);
+ }
+
private void FixTabs()
{
if (_pid <= 0)
@@ -153,7 +185,7 @@ namespace ProcessHacker
buttonInspectParent.Enabled = false;
buttonInspectPEB.Enabled = false;
- if (fileCurrentDirectory.Text != string.Empty)
+ if (fileCurrentDirectory.Text != "")
fileCurrentDirectory.Enabled = false;
if (_pid != 4)
@@ -242,7 +274,7 @@ namespace ProcessHacker
{
this.Text = _processItem.Name;
textFileDescription.Text = _processItem.Name;
- textFileCompany.Text = string.Empty;
+ textFileCompany.Text = "";
}
else
{
@@ -252,7 +284,8 @@ namespace ProcessHacker
Application.DoEvents();
// add our handler to the process provider
- Program.ProcessProvider.Updated += this.ProcessProvider_Updated;
+ Program.ProcessProvider.Updated +=
+ new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
// Check if window was closed before this began executing, bail out if true.
if (!this.IsHandleCreated)
@@ -376,7 +409,8 @@ namespace ProcessHacker
_processImage.Dispose();
}
- Program.ProcessProvider.Updated -= this.ProcessProvider_Updated;
+ Program.ProcessProvider.Updated -=
+ new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
Settings.Instance.EnvironmentListViewColumns = ColumnSettings.SaveSettings(listEnvironment);
Settings.Instance.ProcessWindowSelectedTab = tabControl.SelectedTab.Name;
@@ -439,7 +473,7 @@ namespace ProcessHacker
textFileCompany.Text = _processItem.VerifySignerName;
if (verifyResult == VerifyResult.Unknown)
- textFileCompany.Text += string.Empty;
+ textFileCompany.Text += "";
else if (verifyResult == VerifyResult.Trusted)
textFileCompany.Text += " (verified)";
else if (verifyResult == VerifyResult.NoSignature)
@@ -458,8 +492,8 @@ namespace ProcessHacker
catch
{
fileImage.Text = _processItem.FileName;
- textFileDescription.Text = string.Empty;
- textFileCompany.Text = string.Empty;
+ textFileDescription.Text = "";
+ textFileCompany.Text = "";
}
// Update WOW64 info.
@@ -479,7 +513,7 @@ namespace ProcessHacker
{
using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
{
- labelProcessTypeValue.Text = phandle.IsWow64 ? "32-bit" : "64-bit";
+ labelProcessTypeValue.Text = phandle.IsWow64() ? "32-bit" : "64-bit";
}
}
catch (Exception ex)
@@ -492,7 +526,7 @@ namespace ProcessHacker
return;
if (_processItem.CmdLine != null)
- textCmdLine.Text = _processItem.CmdLine.Replace("\0", string.Empty);
+ textCmdLine.Text = _processItem.CmdLine.Replace("\0", "");
try
{
@@ -649,6 +683,8 @@ namespace ProcessHacker
}
listEnvironment.ListViewItemSorter = new SortedListViewComparer(listEnvironment);
+ listEnvironment.SetDoubleBuffered(true);
+ listEnvironment.SetTheme("explorer");
listEnvironment.ContextMenu = listEnvironment.GetCopyMenu();
ColumnSettings.LoadSettings(Settings.Instance.EnvironmentListViewColumns, listEnvironment);
}
@@ -658,29 +694,34 @@ namespace ProcessHacker
listThreads.BeginUpdate();
_threadP = new ThreadProvider(_pid);
Program.SecondaryProviderThread.Add(_threadP);
- _threadP.Updated += this._threadP_Updated;
+ _threadP.Updated += new ThreadProvider.ProviderUpdateOnce(_threadP_Updated);
listThreads.Provider = _threadP;
listModules.BeginUpdate();
_moduleP = new ModuleProvider(_pid);
Program.SecondaryProviderThread.Add(_moduleP);
- _moduleP.Updated += this._moduleP_Updated;
+ _moduleP.Updated += new ModuleProvider.ProviderUpdateOnce(_moduleP_Updated);
listModules.Provider = _moduleP;
listMemory.BeginUpdate();
_memoryP = new MemoryProvider(_pid);
Program.SecondaryProviderThread.Add(_memoryP);
_memoryP.IgnoreFreeRegions = true;
- _memoryP.Updated += this._memoryP_Updated;
+ _memoryP.Updated += new MemoryProvider.ProviderUpdateOnce(_memoryP_Updated);
listMemory.Provider = _memoryP;
listHandles.BeginUpdate();
_handleP = new HandleProvider(_pid);
Program.SecondaryProviderThread.Add(_handleP);
_handleP.HideHandlesWithNoName = Settings.Instance.HideHandlesWithNoName;
- _handleP.Updated += this._handleP_Updated;
+ _handleP.Updated += new HandleProvider.ProviderUpdateOnce(_handleP_Updated);
listHandles.Provider = _handleP;
+ listThreads.List.SetTheme("explorer");
+ listModules.List.SetTheme("explorer");
+ listMemory.List.SetTheme("explorer");
+ listHandles.List.SetTheme("explorer");
+
this.InitializeShortcuts();
}
@@ -696,37 +737,43 @@ namespace ProcessHacker
private void UpdateEnvironmentVariables()
{
listEnvironment.Items.Clear();
+
listEnvironment.BeginUpdate();
- WorkQueue.GlobalQueueWorkItemTag(new MethodInvoker(() =>
- {
- try
+ WorkQueue.GlobalQueueWorkItemTag(new Action(() =>
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation | Program.MinProcessReadMemoryRights))
+ try
{
- foreach (KeyValuePair pair in phandle.GetEnvironmentVariables())
+ using (ProcessHandle phandle = new ProcessHandle(_pid,
+ ProcessAccess.QueryInformation | Program.MinProcessReadMemoryRights))
{
- if (!string.IsNullOrEmpty(pair.Key))
+ foreach (var pair in phandle.GetEnvironmentVariables())
{
- if (this.IsHandleCreated)
+ if (pair.Key != "")
{
- // Work around delegate variable capturing.
- var localPair = pair;
+ if (this.IsHandleCreated)
+ {
+ // Work around delegate variable capturing.
+ var localPair = pair;
- this.BeginInvoke(new MethodInvoker(() => this.listEnvironment.Items.Add(new ListViewItem(new[] { localPair.Key, localPair.Value }))));
+ this.BeginInvoke(new MethodInvoker(() =>
+ {
+ listEnvironment.Items.Add(
+ new ListViewItem(new string[] { localPair.Key, localPair.Value }));
+ }));
+ }
}
}
}
}
- }
- catch
- { }
+ catch
+ { }
- if (this.IsHandleCreated)
- {
- this.BeginInvoke(new MethodInvoker(() => listEnvironment.EndUpdate()));
- }
- }), "process-update-environment-variables");
+ if (this.IsHandleCreated)
+ {
+ this.BeginInvoke(new MethodInvoker(() => listEnvironment.EndUpdate()));
+ }
+ }), "process-update-environment-variables");
}
public void UpdateProtected()
@@ -735,24 +782,24 @@ namespace ProcessHacker
textProtected.Enabled = true;
buttonEditProtected.Enabled = true;
- //if (KProcessHacker.Instance != null && OSVersion.HasProtectedProcesses)
- //{
- // try
- // {
- // textProtected.Text = KProcessHacker.Instance.GetProcessProtected(_pid) ? "Protected" : "Not Protected";
- // }
- // catch (Exception ex)
- // {
- // textProtected.Text = "(" + ex.Message + ")";
- // buttonEditProtected.Enabled = false;
- // }
- //}
- //else
- //{
-
- labelProtected.Enabled = false;
- textProtected.Enabled = false;
- buttonEditProtected.Enabled = false;
+ if (KProcessHacker.Instance != null && OSVersion.HasProtectedProcesses)
+ {
+ try
+ {
+ textProtected.Text = KProcessHacker.Instance.GetProcessProtected(_pid) ? "Protected" : "Not Protected";
+ }
+ catch (Exception ex)
+ {
+ textProtected.Text = "(" + ex.Message + ")";
+ buttonEditProtected.Enabled = false;
+ }
+ }
+ else
+ {
+ labelProtected.Enabled = false;
+ textProtected.Enabled = false;
+ buttonEditProtected.Enabled = false;
+ }
}
public void UpdateDepStatus()
@@ -763,7 +810,7 @@ namespace ProcessHacker
{
using (var phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation))
{
- var depStatus = phandle.DepStatus;
+ var depStatus = phandle.GetDepStatus();
string str;
if ((depStatus & DepStatus.Enabled) != 0)
@@ -791,7 +838,7 @@ namespace ProcessHacker
{
labelDEP.Enabled = false;
textDEP.Enabled = false;
- textDEP.Text = string.Empty;
+ textDEP.Text = "";
//textDEP.Text = "(This feature is not supported on your version of Windows)";
buttonEditDEP.Enabled = false;
}
@@ -802,67 +849,74 @@ namespace ProcessHacker
}
// Can't set DEP status on processes in other sessions without KPH.
- //if (KProcessHacker.Instance == null && _processItem.SessionId != Program.CurrentSessionId)
+ if (
+ KProcessHacker.Instance == null &&
+ _processItem.SessionId != Program.CurrentSessionId
+ )
buttonEditDEP.Enabled = false;
}
private void PerformSearch(string text)
{
Point location = this.Location;
- Size size = this.Size;
+ System.Drawing.Size size = this.Size;
- Program.GetResultsWindow(_pid, f =>
+ ResultsWindow rw = Program.GetResultsWindow(_pid,
+ new Program.ResultsWindowInvokeAction(delegate(ResultsWindow f)
{
- switch (text)
+ if (text == "&New Results Window...")
{
- case "&New Results Window...":
- f.Show();
- break;
- case "&Literal...":
- if (f.EditSearch(SearchType.Literal, location, size) == DialogResult.OK)
- {
- f.Show();
- f.StartSearch();
- }
- else
- {
- f.Close();
- }
- break;
- case "&Regex...":
- if (f.EditSearch(SearchType.Regex, location, size) == DialogResult.OK)
- {
- f.Show();
- f.StartSearch();
- }
- else
- {
- f.Close();
- }
- break;
- case "&String Scan...":
- f.SearchOptions.Type = SearchType.String;
- f.Show();
- f.StartSearch();
- break;
- case "&Heap Scan...":
- f.SearchOptions.Type = SearchType.Heap;
- f.Show();
- f.StartSearch();
- break;
- case "S&truct...":
- if (f.EditSearch(SearchType.Struct, location, size) == DialogResult.OK)
- {
- f.Show();
- f.StartSearch();
- }
- else
- {
- f.Close();
- }
- break;
+ f.Show();
}
- });
+ else if (text == "&Literal...")
+ {
+ if (f.EditSearch(SearchType.Literal, location, size) == DialogResult.OK)
+ {
+ f.Show();
+ f.StartSearch();
+ }
+ else
+ {
+ f.Close();
+ }
+ }
+ else if (text == "&Regex...")
+ {
+ if (f.EditSearch(SearchType.Regex, location, size) == DialogResult.OK)
+ {
+ f.Show();
+ f.StartSearch();
+ }
+ else
+ {
+ f.Close();
+ }
+ }
+ else if (text == "&String Scan...")
+ {
+ f.SearchOptions.Type = SearchType.String;
+ f.Show();
+ f.StartSearch();
+ }
+ else if (text == "&Heap Scan...")
+ {
+ f.SearchOptions.Type = SearchType.Heap;
+ f.Show();
+ f.StartSearch();
+ }
+ else if (text == "S&truct...")
+ {
+ if (f.EditSearch(SearchType.Struct, location, size) == DialogResult.OK)
+ {
+ f.Show();
+ f.StartSearch();
+ }
+ else
+ {
+ f.Close();
+ }
+ }
+ }));
buttonSearch.Text = text;
}
@@ -987,18 +1041,15 @@ namespace ProcessHacker
private void buttonTerminate_Click(object sender, EventArgs e)
{
- ProcessActions.Terminate(this, new[] { _processItem.Pid }, new[] { _processItem.Name }, true);
+ ProcessActions.Terminate(this, new int[] { _processItem.Pid }, new string[] { _processItem.Name }, true);
}
private void buttonEditDEP_Click(object sender, EventArgs e)
{
- using (EditDEPWindow w = new EditDEPWindow(_pid)
- {
- TopMost = this.TopMost
- })
- {
- w.ShowDialog();
- }
+ EditDEPWindow w = new EditDEPWindow(_pid);
+
+ w.TopMost = this.TopMost;
+ w.ShowDialog();
this.UpdateDepStatus();
}
@@ -1007,16 +1058,15 @@ namespace ProcessHacker
{
try
{
- using (ComboBoxPickerWindow picker = new ComboBoxPickerWindow(new[] { "Protect", "Unprotect" }))
- {
- picker.Message = "Select an action below:";
- picker.SelectedItem = string.Equals(this.textProtected.Text, "Protected", StringComparison.OrdinalIgnoreCase) ? "Protect" : "Unprotect";
+ ComboBoxPickerWindow picker = new ComboBoxPickerWindow(new string[] { "Protect", "Unprotect" });
- if (picker.ShowDialog() == DialogResult.OK)
- {
- //KProcessHacker.Instance.SetProcessProtected(_pid, string.Equals(picker.SelectedItem, "Protect", StringComparison.OrdinalIgnoreCase));
- this.UpdateProtected();
- }
+ picker.Message = "Select an action below:";
+ picker.SelectedItem = (textProtected.Text == "Protected") ? "Protect" : "Unprotect";
+
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ KProcessHacker.Instance.SetProcessProtected(_pid, picker.SelectedItem == "Protect");
+ this.UpdateProtected();
}
}
catch (Exception ex)
@@ -1036,7 +1086,7 @@ namespace ProcessHacker
{
IntPtr baseAddress = phandle.GetBasicInformation().PebBaseAddress;
- Program.HackerWindow.BeginInvoke(new MethodInvoker(() =>
+ Program.HackerWindow.BeginInvoke(new MethodInvoker(delegate
{
StructWindow sw = new StructWindow(_pid, baseAddress, Program.Structs["PEB"]);
@@ -1087,7 +1137,7 @@ namespace ProcessHacker
{
SecurityEditor.EditSecurity(
this,
- SecurityEditor.GetSecurableWrapper(access => new ProcessHandle(_pid, (ProcessAccess)access)),
+ SecurityEditor.GetSecurableWrapper((access) => new ProcessHandle(_pid, (ProcessAccess)access)),
_processItem.Name,
NativeTypeFactory.GetAccessEntries(NativeTypeFactory.ObjectType.Process)
);
@@ -1202,60 +1252,56 @@ namespace ProcessHacker
{
if (_memoryP.RunCount > 1)
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.BeginInvoke(new MethodInvoker(delegate
{
- this.listMemory.EndUpdate();
- this.listMemory.Refresh();
- this.checkHideFreeRegions.Enabled = true;
+ listMemory.EndUpdate();
+ listMemory.Refresh();
+ checkHideFreeRegions.Enabled = true;
this.Cursor = Cursors.Default;
}));
-
- _memoryP.Updated -= this._memoryP_Updated;
+ _memoryP.Updated -= new MemoryProvider.ProviderUpdateOnce(_memoryP_Updated);
}
}
private void _handleP_Updated()
{
- if (this._handleP.RunCount <= 1)
- return;
-
- this.BeginInvoke(new MethodInvoker(() =>
+ if (_handleP.RunCount > 1)
{
- this.listHandles.EndUpdate();
- this.listHandles.Refresh();
- this.checkHideHandlesNoName.Enabled = true;
- this.Cursor = Cursors.Default;
- }));
-
- this._handleP.Updated -= this._handleP_Updated;
+ this.BeginInvoke(new MethodInvoker(delegate
+ {
+ listHandles.EndUpdate();
+ listHandles.Refresh();
+ checkHideHandlesNoName.Enabled = true;
+ this.Cursor = Cursors.Default;
+ }));
+ _handleP.Updated -= new HandleProvider.ProviderUpdateOnce(_handleP_Updated);
+ }
}
private void _moduleP_Updated()
{
- if (this._moduleP.RunCount <= 1)
- return;
-
- this.BeginInvoke(new MethodInvoker(() =>
+ if (_moduleP.RunCount > 1)
{
- this.listModules.EndUpdate();
- this.listModules.Refresh();
- }));
-
- this._moduleP.Updated -= this._moduleP_Updated;
+ this.BeginInvoke(new MethodInvoker(delegate
+ {
+ listModules.EndUpdate();
+ listModules.Refresh();
+ }));
+ _moduleP.Updated -= new ModuleProvider.ProviderUpdateOnce(_moduleP_Updated);
+ }
}
private void _threadP_Updated()
{
- if (this._threadP.RunCount <= 1)
- return;
-
- this.BeginInvoke(new MethodInvoker(() =>
+ if (_threadP.RunCount > 1)
{
- this.listThreads.EndUpdate();
- this.listThreads.Refresh();
- }));
-
- this._threadP.Updated -= this._threadP_Updated;
+ this.BeginInvoke(new MethodInvoker(delegate
+ {
+ listThreads.EndUpdate();
+ listThreads.Refresh();
+ }));
+ _threadP.Updated -= new ThreadProvider.ProviderUpdateOnce(_threadP_Updated);
+ }
}
#endregion
@@ -1264,32 +1310,32 @@ namespace ProcessHacker
private void newWindowSearchMenuItem_Click(object sender, EventArgs e)
{
- this.PerformSearch(this.newWindowToolStripMenuItem.Text);
+ PerformSearch(newWindowSearchMenuItem.Text);
}
private void literalSearchMenuItem_Click(object sender, EventArgs e)
{
- this.PerformSearch(this.literalToolStripMenuItem.Text);
+ PerformSearch(literalSearchMenuItem.Text);
}
private void regexSearchMenuItem_Click(object sender, EventArgs e)
{
- this.PerformSearch(this.regexToolStripMenuItem.Text);
+ PerformSearch(regexSearchMenuItem.Text);
}
private void stringScanMenuItem_Click(object sender, EventArgs e)
{
- this.PerformSearch(this.stringScanToolStripMenuItem.Text);
+ PerformSearch(stringScanMenuItem.Text);
}
private void heapScanMenuItem_Click(object sender, EventArgs e)
{
- this.PerformSearch(this.heapScanToolStripMenuItem.Text);
+ PerformSearch(heapScanMenuItem.Text);
}
private void structSearchMenuItem_Click(object sender, EventArgs e)
{
- this.PerformSearch(this.structToolStripMenuItem.Text);
+ PerformSearch(structSearchMenuItem.Text);
}
#endregion
@@ -1299,25 +1345,17 @@ namespace ProcessHacker
private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
{
if (_threadP != null)
- {
if (_threadP.Enabled = tabControl.SelectedTab == tabThreads)
_threadP.Boost();
- }
if (_moduleP != null)
- {
if (_moduleP.Enabled = tabControl.SelectedTab == tabModules)
_moduleP.Boost();
- }
if (_memoryP != null)
- {
if (_memoryP.Enabled = tabControl.SelectedTab == tabMemory)
_memoryP.Boost();
- }
if (_handleP != null)
- {
if (_handleP.Enabled = tabControl.SelectedTab == tabHandles)
_handleP.Boost();
- }
if (tabControl.SelectedTab == tabStatistics)
{
@@ -1366,26 +1404,26 @@ namespace ProcessHacker
if (this.IsHandleCreated)
{
this.BeginInvoke(new MethodInvoker(() =>
- {
- NtStatus exitStatus = _processHandle.GetExitStatus();
- string exitString = exitStatus.ToString();
- long exitLong;
-
- // We want "Success" instead of "Wait0" (both are 0x0).
- if (exitString == "Wait0")
- exitString = "Success";
-
- // If we have a NT status string, display it.
- // Otherwise, display the NT status value in hex.
- if (!long.TryParse(exitString, out exitLong))
{
- this.Text += " (exited with status " + exitString + ")";
- }
- else
- {
- this.Text += " (exited with status 0x" + exitLong.ToString("x8") + ")";
- }
- }));
+ NtStatus exitStatus = _processHandle.GetExitStatus();
+ string exitString = exitStatus.ToString();
+ long exitLong;
+
+ // We want "Success" instead of "Wait0" (both are 0x0).
+ if (exitString == "Wait0")
+ exitString = "Success";
+
+ // If we have a NT status string, display it.
+ // Otherwise, display the NT status value in hex.
+ if (!long.TryParse(exitString, out exitLong))
+ {
+ this.Text += " (exited with status " + exitString + ")";
+ }
+ else
+ {
+ this.Text += " (exited with status 0x" + exitLong.ToString("x8") + ")";
+ }
+ }));
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ProcessWindow.resx b/1.x/trunk/ProcessHacker/Forms/ProcessWindow.resx
index d69b86343..f07a5387f 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProcessWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ProcessWindow.resx
@@ -112,18 +112,21 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
-
- 17, 17
+
+ 354, 17
-
- 107, 17
+
+ 235, 17
+
+
+ 127, 17
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ProgressWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ProgressWindow.Designer.cs
index f95a83886..171fa748f 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProgressWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProgressWindow.Designer.cs
@@ -35,8 +35,8 @@
//
// labelProgressText
//
- this.labelProgressText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelProgressText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelProgressText.AutoEllipsis = true;
this.labelProgressText.Location = new System.Drawing.Point(12, 9);
this.labelProgressText.Name = "labelProgressText";
@@ -45,8 +45,8 @@
//
// progressBar
//
- this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.progressBar.Location = new System.Drawing.Point(12, 48);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(227, 16);
@@ -67,7 +67,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(339, 80);
this.ControlBox = false;
this.Controls.Add(this.buttonClose);
diff --git a/1.x/trunk/ProcessHacker/Forms/ProgressWindow.resx b/1.x/trunk/ProcessHacker/Forms/ProgressWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProgressWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ProgressWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/PromptBox.Designer.cs b/1.x/trunk/ProcessHacker/Forms/PromptBox.Designer.cs
index 711a8b021..5dfd277b8 100644
--- a/1.x/trunk/ProcessHacker/Forms/PromptBox.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/PromptBox.Designer.cs
@@ -39,18 +39,18 @@
this.labelValue.AutoSize = true;
this.labelValue.Location = new System.Drawing.Point(12, 15);
this.labelValue.Name = "labelValue";
- this.labelValue.Size = new System.Drawing.Size(39, 13);
+ this.labelValue.Size = new System.Drawing.Size(37, 13);
this.labelValue.TabIndex = 3;
this.labelValue.Text = "Value:";
//
// textValue
//
- this.textValue.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textValue.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textValue.Location = new System.Drawing.Point(55, 12);
this.textValue.Name = "textValue";
- this.textValue.Size = new System.Drawing.Size(319, 22);
+ this.textValue.Size = new System.Drawing.Size(319, 20);
this.textValue.TabIndex = 0;
//
// buttonOK
@@ -81,8 +81,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(386, 93);
+ this.ClientSize = new System.Drawing.Size(386, 73);
this.ControlBox = false;
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
diff --git a/1.x/trunk/ProcessHacker/Forms/PromptBox.cs b/1.x/trunk/ProcessHacker/Forms/PromptBox.cs
index e208c9824..da630878f 100644
--- a/1.x/trunk/ProcessHacker/Forms/PromptBox.cs
+++ b/1.x/trunk/ProcessHacker/Forms/PromptBox.cs
@@ -39,11 +39,11 @@ namespace ProcessHacker
get { return _value; }
}
- public PromptBox() : this(string.Empty, false) { }
+ public PromptBox() : this("", false) { }
public PromptBox(string value) : this(value, false) { }
- public PromptBox(bool multiline) : this(string.Empty, multiline) { }
+ public PromptBox(bool multiline) : this("", multiline) { }
public PromptBox(string value, bool multiline)
{
@@ -51,7 +51,7 @@ namespace ProcessHacker
this.AddEscapeToClose();
this.SetTopMost();
- if (value == string.Empty)
+ if (value == "")
{
textValue.Text = LastValue;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/PromptBox.resx b/1.x/trunk/ProcessHacker/Forms/PromptBox.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/PromptBox.resx
+++ b/1.x/trunk/ProcessHacker/Forms/PromptBox.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.Designer.cs
index c398fc935..b6371a1a9 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.Designer.cs
@@ -44,7 +44,7 @@
this.checkProtect.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkProtect.Location = new System.Drawing.Point(12, 12);
this.checkProtect.Name = "checkProtect";
- this.checkProtect.Size = new System.Drawing.Size(132, 18);
+ this.checkProtect.Size = new System.Drawing.Size(125, 18);
this.checkProtect.TabIndex = 0;
this.checkProtect.Text = "Protect this process";
this.checkProtect.UseVisualStyleBackColor = true;
@@ -52,30 +52,30 @@
//
// label1
//
- this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 62);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(129, 13);
+ this.label1.Size = new System.Drawing.Size(124, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Allowed process access:";
//
// label2
//
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 175);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(124, 13);
+ this.label2.Size = new System.Drawing.Size(117, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Allowed thread access:";
//
// listProcessAccess
//
- this.listProcessAccess.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listProcessAccess.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listProcessAccess.FormattingEnabled = true;
this.listProcessAccess.Location = new System.Drawing.Point(12, 78);
this.listProcessAccess.Name = "listProcessAccess";
@@ -84,8 +84,8 @@
//
// listThreadAccess
//
- this.listThreadAccess.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listThreadAccess.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listThreadAccess.FormattingEnabled = true;
this.listThreadAccess.Location = new System.Drawing.Point(12, 191);
this.listThreadAccess.Name = "listThreadAccess";
@@ -122,7 +122,7 @@
this.checkDontAllowKernelMode.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkDontAllowKernelMode.Location = new System.Drawing.Point(12, 36);
this.checkDontAllowKernelMode.Name = "checkDontAllowKernelMode";
- this.checkDontAllowKernelMode.Size = new System.Drawing.Size(297, 18);
+ this.checkDontAllowKernelMode.Size = new System.Drawing.Size(270, 18);
this.checkDontAllowKernelMode.TabIndex = 1;
this.checkDontAllowKernelMode.Text = "Don\'t allow kernel-mode code to bypass protection";
this.checkDontAllowKernelMode.UseVisualStyleBackColor = true;
@@ -132,7 +132,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(498, 326);
this.Controls.Add(this.checkDontAllowKernelMode);
this.Controls.Add(this.buttonOK);
diff --git a/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.cs b/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.cs
index 8b6b19f06..d28bb0c3b 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.cs
@@ -1,13 +1,20 @@
using System;
-using System.Windows.Forms;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using ProcessHacker.Native;
+using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
namespace ProcessHacker
{
public partial class ProtectProcessWindow : Form
{
- private readonly int _pid;
- //private readonly bool _isProtected;
+ private int _pid;
+ private bool _isProtected;
public ProtectProcessWindow(int pid)
{
@@ -17,23 +24,23 @@ namespace ProcessHacker
_pid = pid;
- //bool allowKernelMode;
- //ProcessAccess processAccess;
- //ThreadAccess threadAccess;
+ bool allowKernelMode;
+ ProcessAccess processAccess;
+ ThreadAccess threadAccess;
- //if (ProtectQuery(_pid, out allowKernelMode, out processAccess, out threadAccess))
- //{
- // checkProtect.Checked = _isProtected = true;
- // checkDontAllowKernelMode.Checked = !allowKernelMode;
- //}
+ if (ProtectQuery(_pid, out allowKernelMode, out processAccess, out threadAccess))
+ {
+ checkProtect.Checked = _isProtected = true;
+ checkDontAllowKernelMode.Checked = !allowKernelMode;
+ }
foreach (string value in Enum.GetNames(typeof(ProcessAccess)))
{
if (value == "All")
continue;
- //listProcessAccess.Items.Add(value,
- //(processAccess & (ProcessAccess)Enum.Parse(typeof(ProcessAccess), value)) != 0);
+ listProcessAccess.Items.Add(value,
+ (processAccess & (ProcessAccess)Enum.Parse(typeof(ProcessAccess), value)) != 0);
}
foreach (string value in Enum.GetNames(typeof(ThreadAccess)))
@@ -41,31 +48,31 @@ namespace ProcessHacker
if (value == "All")
continue;
- //listThreadAccess.Items.Add(value,
- //(threadAccess & (ThreadAccess)Enum.Parse(typeof(ThreadAccess), value)) != 0);
+ listThreadAccess.Items.Add(value,
+ (threadAccess & (ThreadAccess)Enum.Parse(typeof(ThreadAccess), value)) != 0);
}
checkProtect_CheckedChanged(null, null);
}
- //private bool ProtectQuery(int pid, out bool allowKernelMode, out ProcessAccess processAccess, out ThreadAccess threadAccess)
- //{
- // try
- // {
- //using (ProcessHandle phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
- //KProcessHacker.Instance.ProtectQuery(phandle, out allowKernelMode, out processAccess, out threadAccess);
+ private bool ProtectQuery(int pid, out bool allowKernelMode, out ProcessAccess processAccess, out ThreadAccess threadAccess)
+ {
+ try
+ {
+ using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
+ KProcessHacker.Instance.ProtectQuery(phandle, out allowKernelMode, out processAccess, out threadAccess);
- // return true;
- // }
- // catch
- // {
- // allowKernelMode = true;
- // processAccess = 0;
- // threadAccess = 0;
+ return true;
+ }
+ catch
+ {
+ allowKernelMode = true;
+ processAccess = 0;
+ threadAccess = 0;
- // return false;
- // }
- //}
+ return false;
+ }
+ }
private void buttonCancel_Click(object sender, EventArgs e)
{
@@ -75,16 +82,16 @@ namespace ProcessHacker
private void buttonOK_Click(object sender, EventArgs e)
{
// remove protection
- //if (_isProtected)
- //{
- // try
- // {
- // //using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- // //KProcessHacker.Instance.ProtectRemove(phandle);
- // }
- // catch
- // { }
- //}
+ if (_isProtected)
+ {
+ try
+ {
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ KProcessHacker.Instance.ProtectRemove(phandle);
+ }
+ catch
+ { }
+ }
// re-add protection (with new masks)
if (checkProtect.Checked)
@@ -99,13 +106,13 @@ namespace ProcessHacker
try
{
- //using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- //KProcessHacker.Instance.ProtectAdd(
- //phandle,
- //!checkDontAllowKernelMode.Checked,
- //processAccess,
- //threadAccess
- //);
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ KProcessHacker.Instance.ProtectAdd(
+ phandle,
+ !checkDontAllowKernelMode.Checked,
+ processAccess,
+ threadAccess
+ );
}
catch
{ }
diff --git a/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.resx b/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ProtectProcessWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ResultsWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ResultsWindow.Designer.cs
index c25d02f7d..b821be6c8 100644
--- a/1.x/trunk/ProcessHacker/Forms/ResultsWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ResultsWindow.Designer.cs
@@ -43,11 +43,11 @@ namespace ProcessHacker
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResultsWindow));
- this.listResults = new ProcessHacker.Components.ExtendedListView();
- this.columnAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnOffset = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnLength = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnString = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listResults = new System.Windows.Forms.ListView();
+ this.columnAddress = new System.Windows.Forms.ColumnHeader();
+ this.columnOffset = new System.Windows.Forms.ColumnHeader();
+ this.columnLength = new System.Windows.Forms.ColumnHeader();
+ this.columnString = new System.Windows.Forms.ColumnHeader();
this.labelText = new System.Windows.Forms.Label();
this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
this.windowMenuItem = new System.Windows.Forms.MenuItem();
@@ -56,21 +56,22 @@ namespace ProcessHacker
this.buttonEdit = new System.Windows.Forms.Button();
this.buttonFind = new System.Windows.Forms.Button();
this.buttonSave = new System.Windows.Forms.Button();
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
// listResults
//
this.listResults.AllowColumnReorder = true;
- this.listResults.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listResults.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listResults.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnAddress,
this.columnOffset,
this.columnLength,
this.columnString});
- this.listResults.DoubleClickChecks = true;
this.listResults.FullRowSelect = true;
this.listResults.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listResults.HideSelection = false;
@@ -83,8 +84,8 @@ namespace ProcessHacker
this.listResults.UseCompatibleStateImageBehavior = false;
this.listResults.View = System.Windows.Forms.View.Details;
this.listResults.VirtualMode = true;
- this.listResults.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listResults_RetrieveVirtualItem);
this.listResults.DoubleClick += new System.EventHandler(this.listResults_DoubleClick);
+ this.listResults.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.listResults_RetrieveVirtualItem);
//
// columnAddress
//
@@ -184,11 +185,15 @@ namespace ProcessHacker
this.buttonSave.UseVisualStyleBackColor = true;
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// ResultsWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(488, 343);
this.Controls.Add(this.buttonFilter);
this.Controls.Add(this.buttonIntersect);
@@ -201,8 +206,9 @@ namespace ProcessHacker
this.Menu = this.mainMenu;
this.Name = "ResultsWindow";
this.Text = "Results";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ResultsWindow_FormClosing);
this.Load += new System.EventHandler(this.ResultsWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ResultsWindow_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -210,7 +216,7 @@ namespace ProcessHacker
#endregion
- private ProcessHacker.Components.ExtendedListView listResults;
+ private System.Windows.Forms.ListView listResults;
private System.Windows.Forms.ColumnHeader columnAddress;
private System.Windows.Forms.ColumnHeader columnOffset;
private System.Windows.Forms.ColumnHeader columnLength;
@@ -220,6 +226,7 @@ namespace ProcessHacker
private System.Windows.Forms.Button buttonFind;
private System.Windows.Forms.Button buttonEdit;
private System.Windows.Forms.Button buttonIntersect;
+ private wyDay.Controls.VistaMenu vistaMenu;
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.MenuItem windowMenuItem;
private System.Windows.Forms.Button buttonFilter;
diff --git a/1.x/trunk/ProcessHacker/Forms/ResultsWindow.cs b/1.x/trunk/ProcessHacker/Forms/ResultsWindow.cs
index 4d1658ff3..b538d6db6 100644
--- a/1.x/trunk/ProcessHacker/Forms/ResultsWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ResultsWindow.cs
@@ -37,10 +37,10 @@ namespace ProcessHacker
{
private delegate bool Matcher(string s1, string s2);
- private readonly int _pid;
+ private int _pid;
private SearchOptions _so;
private Thread _searchThread;
- private readonly int _id;
+ private int _id;
public string Id
{
@@ -53,6 +53,9 @@ namespace ProcessHacker
this.AddEscapeToClose();
this.SetTopMost();
+ listResults.SetDoubleBuffered(true);
+ listResults.SetTheme("explorer");
+
Thread.CurrentThread.Priority = ThreadPriority.Highest;
_pid = pid;
@@ -80,13 +83,14 @@ namespace ProcessHacker
private void ResultsWindow_Load(object sender, EventArgs e)
{
- //Program.UpdateWindowMenu(windowMenuItem, this);
+ Program.UpdateWindowMenu(windowMenuItem, this);
listResults.ContextMenu = listResults.GetCopyMenu(listResults_RetrieveVirtualItem);
this.Size = Settings.Instance.ResultsWindowSize;
ColumnSettings.LoadSettings(Settings.Instance.ResultsListViewColumns, listResults);
+ this.SetPhParent(false);
}
private void ResultsWindow_FormClosing(object sender, FormClosingEventArgs e)
@@ -131,28 +135,27 @@ namespace ProcessHacker
return EditSearch(type, this.Location, this.Size);
}
- public DialogResult EditSearch(SearchType type, Point location, Size size)
+ public DialogResult EditSearch(SearchType type, System.Drawing.Point location, System.Drawing.Size size)
{
DialogResult dr = DialogResult.Cancel;
_so.Type = type;
- using (SearchWindow sw = new SearchWindow(_pid, _so))
+ SearchWindow sw = new SearchWindow(_pid, _so);
+
+ sw.StartPosition = FormStartPosition.Manual;
+ sw.Location = new System.Drawing.Point(
+ location.X + (size.Width - sw.Width) / 2,
+ location.Y + (size.Height - sw.Height) / 2);
+
+ Rectangle newRect = Utils.FitRectangle(new Rectangle(sw.Location, sw.Size), Screen.GetWorkingArea(sw));
+
+ sw.Location = newRect.Location;
+ sw.Size = newRect.Size;
+
+ if ((dr = sw.ShowDialog()) == DialogResult.OK)
{
- sw.StartPosition = FormStartPosition.Manual;
- sw.Location = new Point(
- location.X + (size.Width - sw.Width)/2,
- location.Y + (size.Height - sw.Height)/2);
-
- Rectangle newRect = Utils.FitRectangle(new Rectangle(sw.Location, sw.Size), Screen.GetWorkingArea(sw));
-
- sw.Location = newRect.Location;
- sw.Size = newRect.Size;
-
- if ((dr = sw.ShowDialog()) == DialogResult.OK)
- {
- _so = sw.SearchOptions;
- }
+ _so = sw.SearchOptions;
}
return dr;
@@ -172,7 +175,7 @@ namespace ProcessHacker
{
this.Cursor = Cursors.WaitCursor;
- buttonFind.Image = Properties.Resources.cross;
+ buttonFind.Image = global::ProcessHacker.Properties.Resources.cross;
toolTip.SetToolTip(buttonFind, "Cancel");
buttonEdit.Enabled = false;
buttonFilter.Enabled = false;
@@ -184,11 +187,11 @@ namespace ProcessHacker
// refresh
_so.Type = _so.Type;
- _so.Searcher.SearchFinished += this.Searcher_SearchFinished;
- _so.Searcher.SearchProgressChanged += this.Searcher_SearchProgressChanged;
- _so.Searcher.SearchError += this.SearchError;
+ _so.Searcher.SearchFinished += new SearchFinished(Searcher_SearchFinished);
+ _so.Searcher.SearchProgressChanged += new SearchProgressChanged(Searcher_SearchProgressChanged);
+ _so.Searcher.SearchError += new SearchError(SearchError);
- _searchThread = new Thread(this._so.Searcher.Search, Utils.SixteenthStackSize);
+ _searchThread = new Thread(new ThreadStart(_so.Searcher.Search), Utils.SixteenthStackSize);
_searchThread.Start();
}
@@ -196,35 +199,38 @@ namespace ProcessHacker
private void SearchError(string message)
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.Invoke(new MethodInvoker(delegate
{
PhUtils.ShowError("Unable to search memory: " + message);
- this._searchThread = null;
- this.Searcher_SearchFinished();
+ _searchThread = null;
+ Searcher_SearchFinished();
}));
}
private void Searcher_SearchProgressChanged(string progress)
{
- this.BeginInvoke(new MethodInvoker(() => this.labelText.Text = progress));
+ this.BeginInvoke(new MethodInvoker(delegate
+ {
+ labelText.Text = progress;
+ }));
}
private void Searcher_SearchFinished()
{
- this.BeginInvoke(new MethodInvoker(() =>
+ this.Invoke(new MethodInvoker(delegate
{
- this.listResults.VirtualListSize = this._so.Searcher.Results.Count;
+ listResults.VirtualListSize = _so.Searcher.Results.Count;
- this.labelText.Text = String.Format("{0} results.", this.listResults.Items.Count);
+ labelText.Text = String.Format("{0} results.", listResults.Items.Count);
- this.buttonFind.Image = Properties.Resources.arrow_refresh;
- this.toolTip.SetToolTip(this.buttonFind, "Search");
+ buttonFind.Image = global::ProcessHacker.Properties.Resources.arrow_refresh;
+ toolTip.SetToolTip(buttonFind, "Search");
this.Cursor = Cursors.Default;
- this.buttonEdit.Enabled = true;
- this.buttonFilter.Enabled = true;
- this.buttonIntersect.Enabled = true;
- this.buttonSave.Enabled = true;
- this.buttonFind.Enabled = true;
+ buttonEdit.Enabled = true;
+ buttonFilter.Enabled = true;
+ buttonIntersect.Enabled = true;
+ buttonSave.Enabled = true;
+ buttonFind.Enabled = true;
}));
_searchThread = null;
@@ -247,29 +253,29 @@ namespace ProcessHacker
private void buttonSave_Click(object sender, EventArgs e)
{
+ string filename = "";
DialogResult dr = DialogResult.Cancel;
ResultsWindow rw = this;
- using (SaveFileDialog sfd = new SaveFileDialog())
+ SaveFileDialog sfd = new SaveFileDialog();
+
+ sfd.Filter = "Text Document (*.txt)|*.txt|All Files (*.*)|*.*";
+ dr = sfd.ShowDialog();
+ filename = sfd.FileName;
+
+ if (dr == DialogResult.OK)
{
- sfd.Filter = "Text Document (*.txt)|*.txt|All Files (*.*)|*.*";
- dr = sfd.ShowDialog();
- string filename = sfd.FileName;
+ System.IO.StreamWriter sw = new System.IO.StreamWriter(filename);
- if (dr == DialogResult.OK)
+ foreach (string[] s in _so.Searcher.Results)
{
- using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filename))
- {
-
- foreach (string[] s in _so.Searcher.Results)
- {
- sw.Write("0x{0:x} ({1}){2}\r\n", int.Parse(s[0].Replace("0x", string.Empty),
- System.Globalization.NumberStyles.HexNumber) + int.Parse(s[1].Replace("0x", string.Empty),
- System.Globalization.NumberStyles.HexNumber), int.Parse(s[2]),
- s[3] != string.Empty ? (": " + s[3]) : string.Empty);
- }
- }
+ sw.Write("0x{0:x} ({1}){2}\r\n", Int32.Parse(s[0].Replace("0x", ""),
+ System.Globalization.NumberStyles.HexNumber) + Int32.Parse(s[1].Replace("0x", ""),
+ System.Globalization.NumberStyles.HexNumber), Int32.Parse(s[2]),
+ s[3] != "" ? (": " + s[3]) : "");
}
+
+ sw.Close();
}
}
@@ -305,32 +311,35 @@ namespace ProcessHacker
return;
}
- phandle.EnumMemory(info =>
- {
- if (info.BaseAddress.ToInt64() > s_a)
+ phandle.EnumMemory((info) =>
{
- long selectlength =
- (long)BaseConverter.ToNumberParse(_so.Searcher.Results[listResults.SelectedIndices[0]][2]);
-
- Program.GetMemoryEditor(_pid, lastInfo.BaseAddress, lastInfo.RegionSize.ToInt64(), f =>
+ if (info.BaseAddress.ToInt64() > s_a)
{
- try
- {
- f.ReadOnly = false;
- f.Activate();
- f.Select(s_a - lastInfo.BaseAddress.ToInt64(), selectlength);
- }
- catch
- { }
- });
+ long selectlength =
+ (long)BaseConverter.ToNumberParse(_so.Searcher.Results[listResults.SelectedIndices[0]][2]);
- return false;
- }
+ MemoryEditor ed = Program.GetMemoryEditor(_pid,
+ lastInfo.BaseAddress,
+ lastInfo.RegionSize.ToInt64(),
+ new Program.MemoryEditorInvokeAction(delegate(MemoryEditor f)
+ {
+ try
+ {
+ f.ReadOnly = false;
+ f.Activate();
+ f.Select(s_a - lastInfo.BaseAddress.ToInt64(), selectlength);
+ }
+ catch
+ { }
+ }));
- lastInfo = info;
+ return false;
+ }
- return true;
- });
+ lastInfo = info;
+
+ return true;
+ });
}
catch { }
@@ -401,7 +410,7 @@ namespace ProcessHacker
item.Click += new EventHandler(intersectItemClicked);
menu.MenuItems.Add(item);
- //vistaMenu.SetImage(item, global::ProcessHacker.Properties.Resources.table);
+ vistaMenu.SetImage(item, global::ProcessHacker.Properties.Resources.table);
}
menu.Show(buttonIntersect, new System.Drawing.Point(buttonIntersect.Size.Width, 0));
@@ -413,140 +422,116 @@ namespace ProcessHacker
foreach (ColumnHeader ch in listResults.Columns)
{
- MenuItem columnMenu = new MenuItem(ch.Text)
- {
- Tag = ch.Index
- };
+ MenuItem columnMenu = new MenuItem(ch.Text);
+ MenuItem item;
- MenuItem item = new MenuItem("Contains...", this.filterMenuItem_Clicked)
+ columnMenu.Tag = ch.Index;
+
+ item = new MenuItem("Contains...", new EventHandler(filterMenuItem_Clicked));
+ item.Tag = new Matcher(delegate(string s1, string s2)
{
- Tag = new Matcher((s1, s2) => s1.Contains(s2, StringComparison.OrdinalIgnoreCase))
- };
+ return s1.Contains(s2);
+ });
columnMenu.MenuItems.Add(item);
- item = new MenuItem("Contains (case-insensitive)...", this.filterMenuItem_Clicked)
+ item = new MenuItem("Contains (case-insensitive)...", new EventHandler(filterMenuItem_Clicked));
+ item.Tag = new Matcher(delegate(string s1, string s2)
{
- Tag = new Matcher((s1, s2) => s1.Contains(s2, StringComparison.OrdinalIgnoreCase))
- };
+ return s1.ToUpperInvariant().Contains(s2.ToUpperInvariant());
+ });
columnMenu.MenuItems.Add(item);
- item = new MenuItem("Regex...", this.filterMenuItem_Clicked)
+ item = new MenuItem("Regex...", new EventHandler(filterMenuItem_Clicked));
+ item.Tag = new Matcher(delegate(string s1, string s2)
{
- Tag = new Matcher((s1, s2) =>
+ try
{
- try
- {
- System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(s2);
+ System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(s2);
- return r.IsMatch(s1);
- }
- catch
- {
- return false;
- }
- })
- };
- columnMenu.MenuItems.Add(item);
-
- item = new MenuItem("Regex (case-insensitive)...", this.filterMenuItem_Clicked)
- {
- Tag = new Matcher((s1, s2) =>
+ return r.IsMatch(s1);
+ }
+ catch
{
- try
- {
- System.Text.RegularExpressions.Regex r =
- new System.Text.RegularExpressions.Regex(s2, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
-
- return r.IsMatch(s1);
- }
- catch
- {
- return false;
- }
- })
- };
- columnMenu.MenuItems.Add(item);
-
- columnMenu.MenuItems.Add(new MenuItem("-"));
- item = new MenuItem("Numerical relation...", this.filterMenuItem_Clicked)
- {
- Tag = new Matcher((s1, s2) =>
- {
- if (s2.Contains("!=", StringComparison.OrdinalIgnoreCase))
- {
- decimal n1 = BaseConverter.ToNumberParse(s1);
- decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[]
- {
- "!="
- }, StringSplitOptions.None)[1]);
-
- return n1 != n2;
- }
-
- if (s2.Contains("<=", StringComparison.OrdinalIgnoreCase))
- {
- decimal n1 = BaseConverter.ToNumberParse(s1);
- decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[]
- {
- "<="
- }, StringSplitOptions.None)[1]);
-
- return n1 <= n2;
- }
-
- if (s2.Contains(">=", StringComparison.OrdinalIgnoreCase))
- {
- decimal n1 = BaseConverter.ToNumberParse(s1);
- decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[]
- {
- ">="
- }, StringSplitOptions.None)[1]);
-
- return n1 >= n2;
- }
-
- if (s2.Contains("<", StringComparison.OrdinalIgnoreCase))
- {
- decimal n1 = BaseConverter.ToNumberParse(s1);
- decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[]
- {
- "<"
- }, StringSplitOptions.None)[1]);
-
- return n1 < n2;
- }
-
- if (s2.Contains(">", StringComparison.OrdinalIgnoreCase))
- {
- decimal n1 = BaseConverter.ToNumberParse(s1);
- decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[]
- {
- ">"
- }, StringSplitOptions.None)[1]);
-
- return n1 > n2;
- }
-
- if (s2.Contains("=", StringComparison.OrdinalIgnoreCase))
- {
- decimal n1 = BaseConverter.ToNumberParse(s1);
- decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[]
- {
- "="
- }, StringSplitOptions.None)[1]);
-
- return n1 == n2;
- }
-
return false;
- })
- };
+ }
+ });
+ columnMenu.MenuItems.Add(item);
+
+ item = new MenuItem("Regex (case-insensitive)...", new EventHandler(filterMenuItem_Clicked));
+ item.Tag = new Matcher(delegate(string s1, string s2)
+ {
+ try
+ {
+ System.Text.RegularExpressions.Regex r =
+ new System.Text.RegularExpressions.Regex(s2, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
+
+ return r.IsMatch(s1);
+ }
+ catch
+ {
+ return false;
+ }
+ });
+ columnMenu.MenuItems.Add(item);
+
+ columnMenu.MenuItems.Add(new MenuItem("-"));
+
+ item = new MenuItem("Numerical relation...", new EventHandler(filterMenuItem_Clicked));
+ item.Tag = new Matcher(delegate(string s1, string s2)
+ {
+ if (s2.Contains("!="))
+ {
+ decimal n1 = BaseConverter.ToNumberParse(s1);
+ decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[] { "!=" }, StringSplitOptions.None)[1]);
+
+ return n1 != n2;
+ }
+ else if (s2.Contains("<="))
+ {
+ decimal n1 = BaseConverter.ToNumberParse(s1);
+ decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[] { "<=" }, StringSplitOptions.None)[1]);
+
+ return n1 <= n2;
+ }
+ else if (s2.Contains(">="))
+ {
+ decimal n1 = BaseConverter.ToNumberParse(s1);
+ decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[] { ">=" }, StringSplitOptions.None)[1]);
+
+ return n1 >= n2;
+ }
+ else if (s2.Contains("<"))
+ {
+ decimal n1 = BaseConverter.ToNumberParse(s1);
+ decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[] { "<" }, StringSplitOptions.None)[1]);
+
+ return n1 < n2;
+ }
+ else if (s2.Contains(">"))
+ {
+ decimal n1 = BaseConverter.ToNumberParse(s1);
+ decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[] { ">" }, StringSplitOptions.None)[1]);
+
+ return n1 > n2;
+ }
+ else if (s2.Contains("="))
+ {
+ decimal n1 = BaseConverter.ToNumberParse(s1);
+ decimal n2 = BaseConverter.ToNumberParse(s2.Split(new string[] { "=" }, StringSplitOptions.None)[1]);
+
+ return n1 == n2;
+ }
+ else
+ {
+ return false;
+ }
+ });
columnMenu.MenuItems.Add(item);
menu.MenuItems.Add(columnMenu);
}
- menu.Show(buttonFilter, new Point(buttonFilter.Size.Width, 0));
+ menu.Show(buttonFilter, new System.Drawing.Point(buttonFilter.Size.Width, 0));
}
private void filterMenuItem_Clicked(object sender, EventArgs e)
@@ -566,32 +551,31 @@ namespace ProcessHacker
private void Filter(int index, Matcher m)
{
- using (PromptBox prompt = new PromptBox())
+ PromptBox prompt = new PromptBox();
+
+ if (prompt.ShowDialog() == DialogResult.OK)
{
- if (prompt.ShowDialog() == DialogResult.OK)
+ this.Cursor = Cursors.WaitCursor;
+
+ ResultsWindow rw = Program.GetResultsWindow(_pid, new Program.ResultsWindowInvokeAction(delegate(ResultsWindow f)
{
- this.Cursor = Cursors.WaitCursor;
+ f.ResultsList.VirtualListSize = 0;
- Program.GetResultsWindow(_pid, f =>
- {
- f.ResultsList.VirtualListSize = 0;
-
- foreach (string[] s in this.Results)
+ foreach (string[] s in Results)
+ {
+ if (m(s[index], prompt.Value))
{
- if (m(s[index], prompt.Value))
- {
- f.Results.Add(s);
- f.ResultsList.VirtualListSize++;
- }
+ f.Results.Add(s);
+ f.ResultsList.VirtualListSize++;
}
+ }
- f.Label = "Filter: " + f.Results.Count + " results.";
+ f.Label = "Filter: " + f.Results.Count + " results.";
+
+ f.Show();
+ }));
- f.Show();
- });
-
- this.Cursor = Cursors.Default;
- }
+ this.Cursor = Cursors.Default;
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ResultsWindow.resx b/1.x/trunk/ProcessHacker/Forms/ResultsWindow.resx
index ba26bb9fd..694764c12 100644
--- a/1.x/trunk/ProcessHacker/Forms/ResultsWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ResultsWindow.resx
@@ -112,18 +112,21 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
125, 17
-
+
235, 17
-
+
+ 17, 17
+
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/RunWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/RunWindow.Designer.cs
index 49c90cc10..c0363a7f3 100644
--- a/1.x/trunk/ProcessHacker/Forms/RunWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/RunWindow.Designer.cs
@@ -50,19 +50,19 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 49);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(53, 13);
+ this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 10;
this.label1.Text = "Program:";
//
// textCmdLine
//
- this.textCmdLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textCmdLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textCmdLine.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.textCmdLine.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.AllSystemSources;
this.textCmdLine.Location = new System.Drawing.Point(79, 46);
this.textCmdLine.Name = "textCmdLine";
- this.textCmdLine.Size = new System.Drawing.Size(230, 22);
+ this.textCmdLine.Size = new System.Drawing.Size(230, 20);
this.textCmdLine.TabIndex = 0;
//
// label2
@@ -70,7 +70,7 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 75);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(61, 13);
+ this.label2.Size = new System.Drawing.Size(58, 13);
this.label2.TabIndex = 11;
this.label2.Text = "Username:";
//
@@ -89,7 +89,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 128);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(63, 13);
+ this.label3.Size = new System.Drawing.Size(61, 13);
this.label3.TabIndex = 14;
this.label3.Text = "Session ID:";
//
@@ -97,7 +97,7 @@
//
this.textSessionID.Location = new System.Drawing.Point(79, 125);
this.textSessionID.Name = "textSessionID";
- this.textSessionID.Size = new System.Drawing.Size(100, 22);
+ this.textSessionID.Size = new System.Drawing.Size(100, 20);
this.textSessionID.TabIndex = 5;
//
// label4
@@ -105,7 +105,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 102);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(59, 13);
+ this.label4.Size = new System.Drawing.Size(56, 13);
this.label4.TabIndex = 13;
this.label4.Text = "Password:";
//
@@ -113,7 +113,7 @@
//
this.textPassword.Location = new System.Drawing.Point(79, 99);
this.textPassword.Name = "textPassword";
- this.textPassword.Size = new System.Drawing.Size(154, 22);
+ this.textPassword.Size = new System.Drawing.Size(154, 20);
this.textPassword.TabIndex = 4;
this.textPassword.UseSystemPasswordChar = true;
//
@@ -155,14 +155,14 @@
//
// label5
//
- this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.label5.Location = new System.Drawing.Point(12, 9);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(378, 30);
this.label5.TabIndex = 9;
this.label5.Text = "Enter the command to start as the specified user. Note that the program may take " +
- "a while to start as Windows loads the user\'s profile.";
+ "a while to start as Windows loads the user\'s profile.";
//
// buttonSessions
//
@@ -180,7 +180,7 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(239, 75);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(33, 13);
+ this.label6.Size = new System.Drawing.Size(34, 13);
this.label6.TabIndex = 12;
this.label6.Text = "Type:";
//
@@ -207,8 +207,6 @@
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(402, 190);
this.Controls.Add(this.comboType);
this.Controls.Add(this.label6);
@@ -231,8 +229,8 @@
this.Name = "RunWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Run As...";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RunWindow_FormClosing);
this.Load += new System.EventHandler(this.RunWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RunWindow_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();
diff --git a/1.x/trunk/ProcessHacker/Forms/RunWindow.cs b/1.x/trunk/ProcessHacker/Forms/RunWindow.cs
index 9c2feadf6..34231eaf6 100644
--- a/1.x/trunk/ProcessHacker/Forms/RunWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/RunWindow.cs
@@ -39,7 +39,7 @@ namespace ProcessHacker
public RunWindow()
{
InitializeComponent();
-
+ this.AddEscapeToClose();
this.SetTopMost();
textSessionID.Text = Program.CurrentSessionId.ToString();
@@ -48,22 +48,19 @@ namespace ProcessHacker
if (Program.ElevationType == TokenElevationType.Limited)
buttonOK.SetShieldIcon(true);
- List users = new List
- {
- "NT AUTHORITY\\SYSTEM",
- "NT AUTHORITY\\LOCAL SERVICE",
- "NT AUTHORITY\\NETWORK SERVICE"
- };
+ List users = new List();
+
+ users.Add("NT AUTHORITY\\SYSTEM");
+ users.Add("NT AUTHORITY\\LOCAL SERVICE");
+ users.Add("NT AUTHORITY\\NETWORK SERVICE");
try
{
- using (LsaPolicyHandle phandle = new LsaPolicyHandle(LsaPolicyAccess.ViewLocalInformation))
+ using (var phandle = new LsaPolicyHandle(LsaPolicyAccess.ViewLocalInformation))
{
- foreach (Sid sid in phandle.Accounts)
- {
+ foreach (var sid in phandle.GetAccounts())
if (sid.NameUse == SidNameUse.User)
users.Add(sid.GetFullName(true));
- }
}
}
catch
@@ -112,17 +109,21 @@ namespace ProcessHacker
private void buttonBrowse_Click(object sender, EventArgs e)
{
- using (OpenFileDialog ofd = new OpenFileDialog())
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ try
{
ofd.FileName = textCmdLine.Text;
-
- ofd.CheckFileExists = true;
- ofd.CheckPathExists = true;
- ofd.Multiselect = false;
-
- if (ofd.ShowDialog() == DialogResult.OK)
- textCmdLine.Text = ofd.FileName;
}
+ catch
+ { }
+
+ ofd.CheckFileExists = true;
+ ofd.CheckPathExists = true;
+ ofd.Multiselect = false;
+
+ if (ofd.ShowDialog() == DialogResult.OK)
+ textCmdLine.Text = ofd.FileName;
}
private void buttonCancel_Click(object sender, EventArgs e)
@@ -144,18 +145,20 @@ namespace ProcessHacker
try
{
+ string binPath;
+ string mailslotName;
bool omitUserAndType = false;
if (_pid != -1)
omitUserAndType = true;
- string mailslotName = "ProcessHackerAssistant" + Utils.CreateRandomString(8);
-
- string binPath = "\"" + Application.ExecutablePath + "\" -assistant " +
- (omitUserAndType ? string.Empty : ("-u \"" + this.comboUsername.Text + "\" -t " + this.comboType.SelectedItem.ToString().ToLowerInvariant() + " ")) +
- (this._pid != -1 ? ("-P " + this._pid.ToString() + " ") : string.Empty) + "-p \"" +
- this.textPassword.Text.Replace("\"", "\\\"") + "\" -s " + this.textSessionID.Text + " -c \"" +
- this.textCmdLine.Text.Replace("\"", "\\\"") + "\" -E " + mailslotName;
+ mailslotName = "ProcessHackerAssistant" + Utils.CreateRandomString(8);
+ binPath = "\"" + Application.ExecutablePath + "\" -assistant " +
+ (omitUserAndType ? "" :
+ ("-u \"" + comboUsername.Text + "\" -t " + comboType.SelectedItem.ToString().ToLowerInvariant() + " ")) +
+ (_pid != -1 ? ("-P " + _pid.ToString() + " ") : "") + "-p \"" +
+ textPassword.Text.Replace("\"", "\\\"") + "\" -s " + textSessionID.Text + " -c \"" +
+ textCmdLine.Text.Replace("\"", "\\\"") + "\" -E " + mailslotName;
if (Program.ElevationType == TokenElevationType.Limited)
{
@@ -171,38 +174,36 @@ namespace ProcessHacker
{
string serviceName = Utils.CreateRandomString(8);
- using (ServiceManagerHandle manager = new ServiceManagerHandle(ScManagerAccess.CreateService))
- using (ServiceHandle service = manager.CreateService(
- serviceName,
- serviceName + " (Process Hacker Assistant)",
- ServiceType.Win32OwnProcess,
- ServiceStartType.DemandStart,
- ServiceErrorControl.Ignore,
- binPath,
- string.Empty,
- "LocalSystem",
- null
- ))
+ using (var manager = new ServiceManagerHandle(ScManagerAccess.CreateService))
{
- // Create a mailslot so we can receive the error code for Assistant.
- using (MailslotHandle mhandle = MailslotHandle.Create(FileAccess.GenericRead, @"\Device\Mailslot\" + mailslotName, 0, 5000))
+ using (var service = manager.CreateService(
+ serviceName,
+ serviceName + " (Process Hacker Assistant)",
+ ServiceType.Win32OwnProcess,
+ ServiceStartType.DemandStart,
+ ServiceErrorControl.Ignore,
+ binPath,
+ "",
+ "LocalSystem",
+ null))
{
- try
+ // Create a mailslot so we can receive the error code for Assistant.
+ using (var mhandle = MailslotHandle.Create(
+ FileAccess.GenericRead, @"\Device\Mailslot\" + mailslotName, 0, 5000)
+ )
{
- service.Start();
+ try { service.Start(); }
+ catch { }
+ service.Delete();
+
+ Win32Error errorCode = (Win32Error)mhandle.Read(4).ToInt32();
+
+ if (errorCode != Win32Error.Success)
+ throw new WindowsException(errorCode);
}
- catch { }
-
- service.Delete();
-
- Win32Error errorCode = (Win32Error)mhandle.Read(4).ToInt32();
-
- if (errorCode != Win32Error.Success)
- throw new WindowsException(errorCode);
}
}
-
this.Close();
}
}
@@ -216,12 +217,12 @@ namespace ProcessHacker
private bool isServiceUser()
{
- if (comboUsername.Text.Equals("NT AUTHORITY\\SYSTEM", StringComparison.OrdinalIgnoreCase) ||
- comboUsername.Text.Equals("NT AUTHORITY\\LOCAL SERVICE", StringComparison.OrdinalIgnoreCase) ||
- comboUsername.Text.Equals("NT AUTHORITY\\NETWORK SERVICE", StringComparison.OrdinalIgnoreCase))
+ if (comboUsername.Text.ToUpper() == "NT AUTHORITY\\SYSTEM" ||
+ comboUsername.Text.ToUpper() == "NT AUTHORITY\\LOCAL SERVICE" ||
+ comboUsername.Text.ToUpper() == "NT AUTHORITY\\NETWORK SERVICE")
return true;
-
- return false;
+ else
+ return false;
}
private void comboUsername_TextChanged(object sender, EventArgs e)
@@ -250,7 +251,7 @@ namespace ProcessHacker
{
ContextMenu menu = new ContextMenu();
- foreach (TerminalServerSession session in TerminalServerHandle.GetCurrent().GetSessions())
+ foreach (var session in TerminalServerHandle.GetCurrent().GetSessions())
{
MenuItem item = new MenuItem();
@@ -258,17 +259,13 @@ namespace ProcessHacker
string displayName = session.SessionId.ToString();
if (!string.IsNullOrEmpty(session.Name))
- {
- displayName += ": " + session.Name + (userName != "\\" ? (" (" + userName + ")") : string.Empty);
- }
+ displayName += ": " + session.Name + (userName != "\\" ? (" (" + userName + ")") : "");
else if (userName != "\\")
- {
displayName += ": " + userName;
- }
item.Text = displayName;
item.Tag = session.SessionId;
- item.Click += this.item_Click;
+ item.Click += new EventHandler(item_Click);
menu.MenuItems.Add(item);
}
@@ -278,7 +275,7 @@ namespace ProcessHacker
private void item_Click(object sender, EventArgs e)
{
- textSessionID.Text = (sender as MenuItem).Tag.ToString();
+ textSessionID.Text = ((MenuItem)sender).Tag.ToString();
}
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/RunWindow.resx b/1.x/trunk/ProcessHacker/Forms/RunWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/RunWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/RunWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.Designer.cs
new file mode 100644
index 000000000..3cec867b0
--- /dev/null
+++ b/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.Designer.cs
@@ -0,0 +1,97 @@
+namespace ProcessHacker
+{
+ partial class ScratchpadWindow
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScratchpadWindow));
+ this.textText = new System.Windows.Forms.TextBox();
+ this.buttonCopy = new System.Windows.Forms.Button();
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // textText
+ //
+ this.textText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textText.Location = new System.Drawing.Point(12, 12);
+ this.textText.Multiline = true;
+ this.textText.Name = "textText";
+ this.textText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.textText.Size = new System.Drawing.Size(530, 305);
+ this.textText.TabIndex = 0;
+ //
+ // buttonCopy
+ //
+ this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonCopy.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.buttonCopy.Location = new System.Drawing.Point(467, 323);
+ this.buttonCopy.Name = "buttonCopy";
+ this.buttonCopy.Size = new System.Drawing.Size(75, 23);
+ this.buttonCopy.TabIndex = 2;
+ this.buttonCopy.Text = "Copy";
+ this.buttonCopy.UseVisualStyleBackColor = true;
+ this.buttonCopy.Click += new System.EventHandler(this.buttonCopy_Click);
+ //
+ // buttonSave
+ //
+ this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonSave.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.buttonSave.Location = new System.Drawing.Point(386, 323);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 1;
+ this.buttonSave.Text = "Save...";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
+ //
+ // ScratchpadWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(554, 358);
+ this.Controls.Add(this.buttonSave);
+ this.Controls.Add(this.buttonCopy);
+ this.Controls.Add(this.textText);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.KeyPreview = true;
+ this.Name = "ScratchpadWindow";
+ this.Text = "Scratchpad";
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ScratchpadWindow_KeyDown);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox textText;
+ private System.Windows.Forms.Button buttonCopy;
+ private System.Windows.Forms.Button buttonSave;
+ }
+}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.cs b/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.cs
new file mode 100644
index 000000000..572044eeb
--- /dev/null
+++ b/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace ProcessHacker
+{
+ public partial class ScratchpadWindow : Form
+ {
+ public static void Create(string text)
+ {
+ // Create the window on the main thread.
+ Program.HackerWindow.BeginInvoke(new MethodInvoker(delegate
+ {
+ (new ScratchpadWindow(text)).Show();
+ }));
+ }
+
+ public ScratchpadWindow()
+ {
+ InitializeComponent();
+ this.AddEscapeToClose();
+ this.SetTopMost();
+ }
+
+ public ScratchpadWindow(string text)
+ {
+ InitializeComponent();
+
+ textText.Text = text;
+ textText.Select(0, 0);
+ }
+
+ private void buttonCopy_Click(object sender, EventArgs e)
+ {
+ if (textText.Text.Length == 0)
+ return;
+
+ if (textText.SelectionLength == 0)
+ {
+ Clipboard.SetText(textText.Text);
+ textText.Select();
+ textText.SelectAll();
+ }
+ else
+ {
+ Clipboard.SetText(textText.SelectedText);
+ }
+ }
+
+ private void buttonSave_Click(object sender, EventArgs e)
+ {
+ SaveFileDialog sfd = new SaveFileDialog();
+
+ sfd.FileName = "scratchpad.txt";
+ sfd.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
+
+ if (sfd.ShowDialog() == DialogResult.OK)
+ System.IO.File.WriteAllText(sfd.FileName, textText.Text);
+ }
+
+ private void ScratchpadWindow_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Control && e.KeyCode == Keys.A)
+ {
+ textText.SelectAll();
+ e.Handled = true;
+ }
+ }
+ }
+}
diff --git a/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.resx b/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.resx
new file mode 100644
index 000000000..b1bcc39c8
--- /dev/null
+++ b/1.x/trunk/ProcessHacker/Forms/ScratchpadWindow.resx
@@ -0,0 +1,909 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+
+ AAABAA8AMDAQAAEABABoBgAA9gAAACAgEAABAAQA6AIAAF4HAAAQEBAAAQAEACgBAABGCgAAAAAAAAEA
+ CABqDQAAbgsAADAwAAABAAgAqA4AANgYAAAgIAAAAQAIAKgIAACAJwAAEBAAAAEACABoBQAAKDAAAAAA
+ AAABABgAOQ0AAJA1AAAwMAAAAQAYAKgcAADJQgAAICAAAAEAGACoDAAAcV8AABAQAAABABgAaAMAABls
+ AAAAAAAAAQAgAHANAACBbwAAMDAAAAEAIACoJQAA8XwAACAgAAABACAAqBAAAJmiAAAQEAAAAQAgAGgE
+ AABBswAAKAAAADAAAABgAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIAAAACA
+ gACAAAAAgACAAICAAACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAAwMDAAP///wDwAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFRGVGVlZGVkdGVlAAAA
+ AAAAAAAAAAAAAFZGtkZLa2Rka0a0AAAAAAAAAAAAAAAAAGtka2tka2trZkZHAAAAAAAAAAAAAAAAAGRr
+ a2tmtmtra2tkAAAAAAAAAAAAAAAAAFZrZma2a2a2a2tnAAAAAAAAAAAAAAAAAEa2a2tra2tra2ZkAAAA
+ AAAAAAAAAAAAAGa2trZra2a2a2tlAAAAAAAAAAAAAAAAAHa2bbZrZttmtmtmAAAAAAABODE4ExgxAFa2
+ tra2tra2tmtlAAAAAAABgxg4E4OBAEZrZrZr1rZr29tmAAAAAAADgTETgxMTAHvWvb22tmvba2tlAAAA
+ AAADE4ODgxg4AGRr272729tr29vUAAAAAAAIE4MTgTgxAF2729vb22bb29tnAAAAAAABODg4ODgxAEbb
+ 29vb29u2vb22AAAAAAADg4ODg4ODAEZmZmZmZm1mZmZlAAAAAAABODg4ODg4AHR2VlZWR1ZHRlZWAAAA
+ AAAIODg4ODg4AAAAAAAAAAAAAAAAAAAAAAADg4ODg4ODM4ODiDiDg4ODg4OIOIODg44BODiDioOBiuiu
+ p6euinqK6K6np66o6j4BioODg4ODOurqjq6nrq6urqeup3qK6h4Dg4OKg4ODjoruqK6o6o6o6uqOqurq
+ 6o4Bg4ODiDg4Oq6orqeup66np6iuqOqOqD4Dg4qIOKg4h6eup66Kenp6eurqeup66j4Biog4qDiDPqen
+ p66urq6np66K6np6eo4DiKg4OKiBiq6nrqiuqKeup6p6enp66j4Bg4OIODgzOup66nrqeup6eurqenrq
+ eo4BMRMTgTGBh66orqenp6rorop66np66j4AAAAAAAAAOup66np66nrqrqrqenrqeo4AAAAAAAAAinp6
+ eup6enrqeurqeup66j4AAAAAAAAAPqrq6qeq6up6euqK6q6uqh4AAAAAAAAAiup6eup6eqeup66urqiu
+ 6j4AAAAAAAAAOup66np66n6qeqeqenrqqo4AAAAAAAAAGq6q6q6q6qrq6urqrqrq6j4AAAAAAAAAPq6u
+ qurq6urq6uqurq6q6o4AAAAAAAAAiq6q6uqq6q6qququqq6q6j4AAAAAAAAAOuqurqrq6uqurq6urq6u
+ ro4AAAAAAAAAiurqqurq6q6urqrqrqquqj4AAAAAAAAAPq6q6urqququqq6q6q6uro4AAAAAAAAAOqrq
+ 6qqurq6q6urqrq6q6j4AAAAAAAAAOurqqurqrqququqq6uquqj4AAAAAAAAAiuqurqrqrq6q6q6uqq6q
+ 6o4AAAAAAAAAOuququrqrqrq6q6q6uquqn4AAAAAAAAAeq6uququrqrqrq6q6q6uqo4AAAAAAAAAOq6q
+ rqquqq6qrqquqq6qrj4AAAAAAAAAgzODM4MzgzODM4MzgzODMT8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AA9///////4AAP///////wAA//8AAAP/AAD//wAAA/8AAP//AAAD/wAA//8AAAP/AAD//wAAA/8AAP//
+ AAAD/wAA//8AAAP/AAD//wAAA/8AAIADAAAD/wAAgAMAAAP/AACAAwAAA/8AAIADAAAD/wAAgAMAAAP/
+ AACAAwAAA/8AAIADAAAD/wAAgAMAAAP/AACAA/////8AAIAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAA
+ AAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAA//wAAAAA
+ AAD//AAAAAAAAP/8AAAAAAAA//wAAAAAAAD//AAAAAAAAP/8AAAAAAAA//wAAAAAAAD//AAAAAAAAP/8
+ AAAAAAAA//wAAAAAAAD//AAAAAAAAP/8AAAAAAAA//wAAAAAAAD//AAAAAAAAP/8AAAAAAAA//wAAAAA
+ AAD//AAAAAAAAP/8AAAAAAAA///////+AAAoAAAAIAAAAEAAAAABAAQAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//
+ AADAwMAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVlZWVkZWVAAAAAAAAAAAAGRra2tGS2TgAAAAAA
+ AAAABWtrZrZrZl4AAAAAAAAAAAZrZra2trZHAAAAAAAAAAAFa2trZmtmTgAAAAAAAAAABrZra2tmtk4A
+ AADhOBMYMAVmtmZrbbZ+AAAA8Tg4MTcGtr2727a2RwAAAOGDE4OOBW1r29vb224AAADhODgxjgRrZmZm
+ ZmZOAAAA6Dg4OD4FZWVlZUZWdwAAAOODg4OOAAAAAAAAAAAAAADhg4OIMziIg4g4iDiIODg+44OKg4Gn
+ p66np6enp6jqPug4g4g4rqenqOp6enrqeo7xo4qIOHp6eurq6up6euo34YiDgxOup6enqK6K6np6h+MT
+ ETgYp66nqueqenp66j4AAAAAA66np656p+p66nqOAAAAAAGnrqeqfqp6enrqNwAAAAAD6uqurqqurq6q
+ 6ocAAAAACK6urqrq6q6q6uo+AAAAAAOuququ6urqrq6qjgAAAAAIququqqrq6uqq6jcAAAAAA+rq6q6u
+ rqqurq6OAAAAAAOq6q+uqqrq6q6qjgAAAAADrqrqqq6uququrj4AAAAAA66q6urqrqrq6qqHAAAAAAiu
+ quqq6q6q6qrqPgAAAAADODODgzg4M4ODOD4AAAAADu7u7u7u7u7u7u7v///////gAH//4AA//+AAP//g
+ AD//4AA//+AAPwBgAD8AIAA/ACAAPwAgAD8AIAA/AD///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP+A
+ AAD/gAAA/4AAAP+AAAD/gAAA/4AAAP+AAAD/gAAA/4AAAP+AAAD/gAAA/4AAAP+AAAAoAAAAEAAAACAA
+ AAABAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICA
+ gAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AADAwMAA////AAAAAAAAAAAAAAAHu2a2cAAAAAdmtrtwAOc3
+ B2a2ZnAAeDh+tr22cAB4OD5HZWVwAOg4Pn7qfn6ueIOKp6jqend6iIeup6enp+eOPqenrqenAAAK6qen
+ rqcAAArq6uqupwAADqrqrqrqAAAKrqrq6uoAAAqq6qqqpwAADu7q7u7u//8AAPgHAAD4BwAACAcAAAAH
+ AAAABwAAAAAAAAAAAAAAAAAAAAAAAPgAAAD4AAAA+AAAAPgAAAD4AAAA+AAAAIlQTkcNChoKAAAADUlI
+ RFIAAAEAAAABAAgGAAAAXHKoZgAADTFJREFUeNrt3QuoZVUZwPF9zrlN06SNltWYSoVMSFEUex5mvp2X
+ j6QiiEqskIysDIQeCBUVSA8QsjIypBIrgqgwdRrH16hNzovCKKRBKtTJzNTRaZoZz6Oz5t59717n7n1n
+ P9baa317/X+g39lnUPZ5/Wfts8+5txMBCFZH/WvnztHI9Y4AaNaKFZ3ObACWLnW9OwCasndvFKnXvBaA
+ 5cungwCg3dRrfvFiAgAESb3mp6YIABAkAgAEjAAAASMANfzqgxGnTSHSu38y95onABURAEhFAAwgAJCK
+ ABhAACAVATCAAEAqAmBAVgAu/u4a17sFzHPLJ+7UtgmAAQQAUhAACwgApCAAFhAASEEALCAAkIIAWEAA
+ IAUBsIAAQAoCYEFWAN553Zqo03O9Z4COAFiQtwIYDaLDEWAyfZm/uZIAGJe3AgB8QwAsIACQggBYQAAg
+ BQGwgABACgJgAQGAFATAgrwADPudqDs1YjK9mAoBsIAVACRQIbjtqs3adQTAgKwAXHjtWte7BcxDACzI
+ C8Dk8gto2uRhAIcAFiy0AkjufKBp6edecpkVgAUcAkAKAmABAYAUBMACAgApCIAFBABSEAALCACkIAAW
+ EABIQQAsyAvAsK9Ov0SHp8JlLru+vPGzBMC4hQKguH7QuczlBAGwICsA538j+SDQ+AE4NJ6LUjP1gGh/
+ zvVcb+l6ta1wCGDBQgHINBz/0+V6rm/o+hRWABaUDoAynFsVaA8a13O9jetn/mzj5wmAcZkB+FpOANSD
+ MnS9xwhSlxWAFZVWAIADBMACAgAROASwo9QhAOAQAbCAAEAKAmABAYAUBMACAgApCIAFWQFYf83aqNuN
+ oiGn/OCRTVcTAONYAUAC9ZcRAbAgbwUA+EStSDkEsIAAQApWABYQAEhBACzIC8CoP75Dx3cqk+nDVAiA
+ BawAIAUBsCArAOu+QgDgnzu+SACMWygAPiz9mMxkEgALWAFAAhUBDgEsIACQghWABQQAUhAACwgApCAA
+ FhAA+G406ESd3ogA2JAXAHWnAz7Z/OU7tG0CYEBWANZ+ad3h4iblZTJdT4UAWJAXACV95wOuJM9DAmDB
+ QgEAfEIALCAAkIIAWEAAIAUBsIAAQAoCYEFWAM77wrrZHwrKZPowlbu+SgCMWygAig8PPpOpJgGwIC8A
+ gG8IgAUEAFIQAAsIAKQgABYQAEhBACzIC8BooD6CGTGZXkyFAFiQFYBzr2YFAP/cfQ0BMI4AQAoCYAEB
+ gBQEwAICACkIgAUEAFIQAAuyAnDO5wgA/HPP1wmAcQsFwIfTP0xmMgmABawAIAUBsIAAQAoCYAEBgBQE
+ wAICACkIgAUEAFIQAAuyAnD2ZwgA/HPvNwmAcQQAUhAACwgApCAAFhAASEEALCAAkIIAWJAXgOEgirq9
+ iMn0YioEwAICwJQy77uWABiXFYAzr+IQAP4hABYQAEhBACzICsAZn17vereAWZ3e9FOUAFiw0ApAHXsN
+ DnWi3qIRk+l83v+tTdrzlAAYwAoAUhAACxYKgOviM5lGVgA/juc/yRFFH9oVdVgBQAL1PkDl9wAIQDYC
+ AElYARhGACAJATCMAEASAmAYAYAkRgNw1kmub07ztjyqbxMASGI2ACe6vjnN2/KYvp0XgNM/RQDgnwe+
+ TQBqIQCQzGgATj/B9c1p3gOP69sEAJIQgJq27omiYeqeIACQhADUVHQF8I4rCAD887vrCUAtZQPg+rfB
+ MpnpSQBqYgUAyYwG4NTjp+dUN4r6wzAmAYBkxlcA6oURkgf/qW8TAEhiZQWg+PC3cxNz+xPFzgIQAPjI
+ WAC64z9Ztcz1zWkeKwBIZnQFsOp4fXv8l2Q0bPlUAVDxS1YBBACSGF0BrAhwBbC9xApg2B/fT+M7lcn0
+ YSpWVwAhKBqAt1/OCgD++f0NBgOw4tXjsnRd36RmDGfOduz8l349hwCQQK0CFKMBUCuAYUCnAVXsthd8
+ D0CtAJLlF+AL4yuA0BRdAXAIAB8RgJoIACQjADURAEhmNABvfaXrm9O8P/5b3yYAkIQVQEXJdx6KBuDU
+ ywgA/JF8HfjBG1kB1PLQU8W+C5AEwPX3v5nM9DQWAHUq7E3HRVHP9SuyYWUOAXx4wJlMNRV1mfcAaiq7
+ AlBGw07U6Y6YTKdTMXoI8ObAAqBWO7wHAGnU3/zDF6YjQABq+nPBFcDqj2xwvavArGQlsO2Hv9WuJwAl
+ /angCiAJQLL0AlxQL/o0AlBT2QAAPjEaAHUWIDTqECCNAEASAlATAYBkBKAmAgDJCEBNBACSGQ3AKS93
+ fXOa9/DT+nbRAAwHUdTtMZluJwGoqWgAVl66YfaOT/jwBGCGPQlABYPxLe/N3BNlAqBMRgBwacdNBgOw
+ /FjXN6c5KgAqBLuf0a8/UgAAnxgLgPo24MnHzL0w2j4TBACSsQKo6ZFni30XYOUlGyIvfpURk5maBKCm
+ UisATx50ZuAzmrk8tuNmgwFQhwChUSuAIr8X4PAKAPAMAahJBSAtLwCABASgJAKANiEAJREAtImRAAyG
+ UdTrhjH//px+HxAASFYrAK97mevdb15WAFzvE1AXASiIAKCNCEBBBABtVCsA/fGfTHXCmHv2zf8koOsH
+ D6irUgBOPNr1bjfvsef1bQKANiAABbECQBsRgIJYAaCNKgXghKPG/0FgT38VgMnvAhT57+L4cj4r0EK7
+ dt3QildA5QCE5vF9+jYBCBsBCAwBQFrQAVj2Ute73bwn/qtvE4CwEYDAPLm/2lkAAtBOBCAwJlcAuy66
+ 0vXNQUnxrddp2wQgMCoAps4CEAB5CEBKqAFIIwBhIQApSQD6wyia6oYxn/qffh8YCcBw6PrxR0Hx7d/R
+ toMOwHEvcb3bzTMagAs+OffTRiACAUgJMQBPHzB3FmA2ABAj3nS9tk0AAmN0BbD+Ctc3B2WMV2qsAFJC
+ DYCxswAEQI6ZBzze/D3tagIQGKMrgLUfd31zUBIBSDnmxa53u3nPHtS3aweAMwCixHd9X9sOOgBqBeDD
+ qbmmpmI0AOd9zPXjjjK6XVYAaSGuAJ47ZPAsAAEQhxVASogBMLoCOOejrm8OylArAAIwJ9QAGDsLQADE
+ ie/5gbZNAALDCiBsBCDlqBe53u3m7XtB364VgDMvc31zUFJ8343adrABUMvgJVPT75CHIDkLQADCRgBS
+ 0isA9frotngm9vcNngVIAtAfjEvaYwqY8dYf6Y9hyAFYkgqADy9SGzNNXWd0BXDah6cvJE8y+G38OLEC
+ SFkS4HsAB0yuAJIAQAxWACkhBmC/jRUAxCAAKZMBUB9r77b8TUEVAGOfA1AB4OcBiBJvu0nbJgDR3PdZ
+ 1Iu/rd9tSW7bgYlD9VoBWH2p65uFkghAyuLe/P9RmyOgEICwEYCUrAC0ndEArLzE9c1BGeq7AARgThKA
+ /vhPplpxNxwZAQhbvONmbZsARHMBaPtUjAYg/oDrxx15kmPZiXe1CUBKKB8DTutPvL9BAAKhTvt0O1G8
+ 66fa1cEGQJ0K67bippdjNABve7/rm4MyCICOFQABCE38h59p2wQgIGoVOJy4FwhAyyW/uWlmEoCUEA8B
+ Zg4FzXwSUAWATwKKEj/0c2076ACgZgDe8j7Xu4+SCAA0tQOQfNc84cF33pn5kwBAYyQACQ+e4MyMmXp8
+ CAA0tQLwxve63n2UFP/lF9p2MAFAPUcMQPKpM6Zfc/JxJACoIjcAIXyXukXih3+pbRMAFJIZgFPe43q3
+ UIb6NiArAFRBANqBFQAqyQzAG97lerdQhloBEABUQQDaIf7rr7VtAoBCCEA7EABUkhmAky92vVsoKX7k
+ Fm2bAKCQzAC8/iI/znUzC38mgACgktwVAOf+RYn/dqu2TQBQSO4KAKIQAFSSG4AhX7GQJP7Hbdo2AUAh
+ mQF47YWudwslEQBUkhsA3gMQJX50o7ZNAFBIZgBOOt/1bqGMQSeK99yuXUUAUEhmAF5zwcwl9UMnekzv
+ Z0QAUE12ANa73i2U0iMAqCZ/BTCo8H+DK/GeTdo2AUAhmQFYts71bqEM9ZuBCACqIADCzZytiZ+8U7ua
+ AKCQzAC8ao3r3UJJBACVEIB2IACoJDcAE797jun3JACoJDMArzh37skFEeL/3K1tEwAUkhsA199xZx55
+ KsnPAyAAqGLBAECM+Jl7tW0CgEIyA3Ds2a53CyURAFSSGwB+HoAo8d4t2jYBQCGZAVh6luvdQkkEAJXk
+ BoD3AESJn79f2yYAKCQzAEef4Xq3UIb6zUCsAFAFAWgHVgCoJDMAS05zvVsoqjfzA0EIAKogAO0Q79+q
+ bRMAFEIA2oEAoBIC0A4EAJXkBqDPjwQTY6pHAFBNZgAWrXa9WygpPrRN2yYAKIQAtAMBQCW5AeC7AKLE
+ /e3aNgFAIZkBmFrlerdQEgFAJVkBgHwEAIUQgHYiACiEALQTAUAhBKCdCAAA8QgAEDACAASMAAABIwBA
+ wAgAEDACAASMAAABmxcA1zsEoFmzAVB27x6NDh6Mon7f9W4BaMr/AZCxqA55eVu6AAAAAElFTkSuQmCC
+ KAAAADAAAABgAAAAAQAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmMzMAmjkDAJ46AACePgMA
+ oj8AAKJCAwCmQwAApkcDAKpJAACpTAMArk4AAK1RAwCyUwAAsVYDALVZAAC5XQAAvmIAALxkAwDBaAAA
+ w24DAMZtAADHcwMAynIAAMt3AwDOdwAA0nwAAAAzoQAANKMAADSkAAA2qQAAOa4AADqyAAA8tQAAPbkA
+ AD+8AABbrwAAQL4AAEHBAABDxQAARMYAAEXJAABGzAAASM8AAEjQAABK1AAATNkASLnkAEi95gBHwugA
+ R8XqAEfI6wBHyuwARs3tAEbR7wBG0/AARtbyAEba9ABF3fUAReD3AEXj+ABF5vkAROn7AETt/ABE8P4A
+ rLzZALrH3wDl2eIA/uHhAACwNgAAz0AAAPBKABH/WwAx/3EAUf+HAHH/nQCR/7IAsf/JANH/3wD///8A
+ AAAAAAIvAAAEUAAABnAAAAiQAAAKsAAAC88AAA7wAAAg/xIAPf8xAFv/UQB5/3EAmP+RALX/sQDU/9EA
+ ////AAAAAAAULwAAIlAAADBwAAA9kAAATLAAAFnPAABn8AAAeP8RAIr/MQCc/1EArv9xAMD/kQDS/7EA
+ 5P/RAP///wAAAAAAJi8AAEBQAABacAAAdJAAAI6wAACpzwAAwvAAANH/EQDY/zEA3v9RAOP/cQDp/5EA
+ 7/+xAPb/0QD///8AAAAAAC8mAABQQQAAcFsAAJB0AACwjgAAz6kAAPDDAAD/0hEA/9gxAP/dUQD/5HEA
+ /+qRAP/wsQD/9tEA////AAAAAAAvFAAAUCIAAHAwAACQPgAAsE0AAM9bAADwaQAA/3kRAP+KMQD/nVEA
+ /69xAP/BkQD/0rEA/+XRAP///wAAAAAALwMAAFAEAABwBgAAkAkAALAKAADPDAAA8A4AAP8gEgD/PjEA
+ /1xRAP96cQD/l5EA/7axAP/U0QD///8AAAAAAC8ADgBQABcAcAAhAJAAKwCwADYAzwBAAPAASQD/EVoA
+ /zFwAP9RhgD/cZwA/5GyAP+xyAD/0d8A////AAAAAAAvACAAUAA2AHAATACQAGIAsAB4AM8AjgDwAKQA
+ /xGzAP8xvgD/UccA/3HRAP+R3AD/seUA/9HwAP///wAAAAAALAAvAEsAUABpAHAAhwCQAKUAsADEAM8A
+ 4QDwAPAR/wDyMf8A9FH/APZx/wD3kf8A+bH/APvR/wD///8AAAAAABsALwAtAFAAPwBwAFIAkABjALAA
+ dgDPAIgA8ACZEf8ApjH/ALRR/wDCcf8Az5H/ANyx/wDr0f8A////AAAAAAAIAC8ADgBQABUAcAAbAJAA
+ IQCwACYAzwAsAPAAPhH/AFgx/wBxUf8AjHH/AKaR/wC/sf8A2tH/AP///wBEAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQIDAwMDAwMDAwMDAwMDAwMDAwMDAQAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAQQFBQUFBQUFBQUFBQUFBQUFBQUFAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AQYHBwcHBwcHBwcHBwcHBwcHBwcHAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgJCQkJCQkJCQkJ
+ CQkJCQkJCQkJAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQoMlZWVlZWVlZWVlZWVlZWVlZWVAQAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQwNDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NAQAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAQ4PEA8PDw8PDw8PDw8PDw8PDw8PAQAAAAAAAAAAAAAAGxsbGxsbGxsbGxsbHAAA
+ AQ8QEBAQEBAQEBAQEBAQEBAQEBAQAQAAAAAAAAAAAAAAGxwdHR0dHR0dHR0dGwAAARASERERERERERER
+ ERERERERERERAQAAAAAAAAAAAAAAHB4eHh4eHh4eHh4eGwAAARITExMTExMTExMTExMTExMTExMTAQAA
+ AAAAAAAAAAAAGx4eHh8eHx4fHh8fGwAAARMVFRUVFRUVFRUVFRUVFRUVFRUVAQAAAAAAAAAAAAAAGx8f
+ Hx8fHx8fHx8fGwAAARQXFxcXFxcXFxcXFxcXFxcXFxcXAQAAAAAAAAAAAAAAGyAhISEhISEhISEgGwAA
+ ARYZGRkZGRkZGRkZGRkZGRkZGRkZAQAAAAAAAAAAAAAAGyEhISEhISEhISEhGwAAARgaGhoaGhoaGhoa
+ GhoaGhoaGhoaAQAAAAAAAAAAAAAAGyIiIyIjIyIjIyMiGwAAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAA
+ AAAAAAAAAAAAGyUlJSUlJSUlJSUlGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGyYm
+ JiYmJiYmJiYmGyQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJEIAGyYnJygnKCcoJycnHCQv
+ Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vJEEAGygpKSkpKSkpKSkpHCQwLzAwMDAwMDAwMDAw
+ MDAwMDAwMDAwMDAwMDAwMDAvJEEAGykrKiorKisqKyoqHCQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
+ MDAwMDAwJEEAGyosLCwsLCwsLCwsGyQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwJEEAGywt
+ LS0tLS0tLS0tHCQxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExJEEAGy0uLi4uLi4uLi4uHCQy
+ MjIxMjEyMTIxMjEyMTIxMjEyMTIxMjEyMTIxMjEyJEEAGy4uLi4uLi4uLi4uGyQyMjIyMjIyMjIyMjIy
+ MjIyMjIyMjIyMjIyMjIyMjIyJEEAGyorKysrKysrKysrGyQzMzQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0
+ NDQ0NDQzJEEAGxsbGxsbGxsbGxsbHCQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDU0JEEAAAAA
+ AAAAAAAAAAAAACQ1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1JEEAAAAAAAAAAAAAAAAAACQ1
+ NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1JEEAAAAAAAAAAAAAAAAAACQ2Njc3Nzc3Nzc3Nzc3
+ Nzc3Nzc3Nzc3Nzc3Nzc3NzY2JEEAAAAAAAAAAAAAAAAAACQ3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3
+ Nzc3Nzg3JEEAAAAAAAAAAAAAAAAAACQ4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4JEEAAAAA
+ AAAAAAAAAAAAACQ4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4JEEAAAAAAAAAAAAAAAAAACQ5
+ OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5JEEAAAAAAAAAAAAAAAAAACQ6Ojo6Ojo6Ojo6Ojo6
+ Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6JEEAAAAAAAAAAAAAAAAAACQ7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7
+ Ozs7Ozs7JEEAAAAAAAAAAAAAAAAAACQ7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7JEEAAAAA
+ AAAAAAAAAAAAACQ8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8JEEAAAAAAAAAAAAAAAAAACQ9
+ PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09JEEAAAAAAAAAAAAAAAAAACQ9PT09PT09PT09PT09
+ PT09PT09PT09PT09PT09PT09JEEAAAAAAAAAAAAAAAAAACQ+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+
+ Pj4+Pj4+JEEAAAAAAAAAAAAAAAAAACQ/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/JEEAAAAA
+ AAAAAAAAAAAAACQ/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/JEEAAAAAAAAAAAAAAAAAACRA
+ QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAJEEAAAAAAAAAAAAAAAAAACQkJCQkJCQkJCQkJCQk
+ JCQkJCQkJCQkJCQkJCQkJCQkJEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAER///////4O7v///////w7u//8AAAP/Du7//wAAA/8O7v//AAAD/w7u//8AAAP/Du7//wAA
+ A/8O7v//AAAD/w7u//8AAAP/Du7//wAAA/8O7oADAAAD/w7ugAMAAAP/Du6AAwAAA/8O7oADAAAD/w7u
+ gAMAAAP/Du6AAwAAA/8O7oADAAAD/w7ugAMAAAP/Du6AA/////8O7oAAAAAAAA7ugAAAAAAADu6AAAAA
+ AAAO7oAAAAAAAA7ugAAAAAAADu6AAAAAAAAO7oAAAAAAAA7ugAAAAAAADu6AAAAAAAAO7oAAAAAAAA7u
+ //wAAAAADu7//AAAAAAO7v/8AAAAAA7u//wAAAAADu7//AAAAAAO7v/8AAAAAA7u//wAAAAADu7//AAA
+ AAAO7v/8AAAAAA7u//wAAAAADu7//AAAAAAO7v/8AAAAAA7u//wAAAAADu7//AAAAAAO7v/8AAAAAA7u
+ //wAAAAADu7//AAAAAAO7v/8AAAAAA7u///////+Du4oAAAAIAAAAEAAAAABAAgAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAGYzMwCfOwAApEEAAKtKAACwUQAAt1oAALxgAADDaQAAyHAAAM94AAAAM6EA
+ ADapAAA4rQAAO7QAAD24AABbrwAAQL8AAELDAABFygAAR84AAErVAABM2gBVfMEAf5jPAHygzABIuuUA
+ SL7mAEfB6ABHxOkAR8jrAEfL7ABGz+4ARtLvAEbV8gBG2fMARd31AEXj+ABF5vkAROr7AETt/ACxmJgA
+ gaTOAJCqzwDHu9QAx7zUAMfE1gDf1d8A59beAAAvIQAAUDcAAHBMAACQYwAAsHkAAM+PAADwpgAR/7QA
+ Mf++AFH/yABx/9MAkf/cALH/5QDR//AA////AAAAAAAALw4AAFAYAABwIgAAkCwAALA2AADPQAAA8EoA
+ Ef9bADH/cQBR/4cAcf+dAJH/sgCx/8kA0f/fAP///wAAAAAAAi8AAARQAAAGcAAACJAAAAqwAAALzwAA
+ DvAAACD/EgA9/zEAW/9RAHn/cQCY/5EAtf+xANT/0QD///8AAAAAABQvAAAiUAAAMHAAAD2QAABMsAAA
+ Wc8AAGfwAAB4/xEAiv8xAJz/UQCu/3EAwP+RANL/sQDk/9EA////AAAAAAAmLwAAQFAAAFpwAAB0kAAA
+ jrAAAKnPAADC8AAA0f8RANj/MQDe/1EA4/9xAOn/kQDv/7EA9v/RAP///wAAAAAALyYAAFBBAABwWwAA
+ kHQAALCOAADPqQAA8MMAAP/SEQD/2DEA/91RAP/kcQD/6pEA//CxAP/20QD///8AAAAAAC8UAABQIgAA
+ cDAAAJA+AACwTQAAz1sAAPBpAAD/eREA/4oxAP+dUQD/r3EA/8GRAP/SsQD/5dEA////AAAAAAAvAwAA
+ UAQAAHAGAACQCQAAsAoAAM8MAADwDgAA/yASAP8+MQD/XFEA/3pxAP+XkQD/trEA/9TRAP///wAAAAAA
+ LwAOAFAAFwBwACEAkAArALAANgDPAEAA8ABJAP8RWgD/MXAA/1GGAP9xnAD/kbIA/7HIAP/R3wD///8A
+ AAAAAC8AIABQADYAcABMAJAAYgCwAHgAzwCOAPAApAD/EbMA/zG+AP9RxwD/cdEA/5HcAP+x5QD/0fAA
+ ////AAAAAAAsAC8ASwBQAGkAcACHAJAApQCwAMQAzwDhAPAA8BH/APIx/wD0Uf8A9nH/APeR/wD5sf8A
+ +9H/AP///wAAAAAAGwAvAC0AUAA/AHAAUgCQAGMAsAB2AM8AiADwAJkR/wCmMf8AtFH/AMJx/wDPkf8A
+ 3LH/AOvR/wD///8AAAAAAAgALwAOAFAAFQBwABsAkAAhALAAJgDPACwA8AA+Ef8AWDH/AHFR/wCMcf8A
+ ppH/AL+x/wDa0f8A////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB
+ AQEBAQEBAQEBAQEBAQAAAAAAAAAAAAAAAAAAAAAAAAECAgICAgICAgICAgIBKQAAAAAAAAAAAAAAAAAA
+ AAAAAQMDAwMDAwMDAwMDAwEpAAAAAAAAAAAAAAAAAAAAAAABBAQEBAQEBAQEBAQEASkAAAAAAAAAAAAA
+ AAAAAAAAAAEFBQUFBQUFBQUFBQUBKQAAAAAAAAAAAAAAAAAAAAAAAQYGBgYGBgYGBgYGBgEpAAAAAAAA
+ LAsLCwsLCwsLAAABBwcHBwcHBwcHBwcHASkAAAAAAAAsCwwMDAwMDAsYAAEICAgICAgICAgICAgBKQAA
+ AAAAACwLDQ0NDQ0NCxgAAQkJCQkJCQkJCQkJCQEpAAAAAAAALAsODg4ODg4LGAABCgoKCgoKCgoKCgoK
+ ASkAAAAAAAAsCw8PDw8PDwsYAAEBAQEBAQEBAQEBAQEBKQAAAAAAACwLERERERERCxcAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAALAsSEhISEhILEBAQEBAQEBAQEBAQEBAQEBAQEBAQECosCxMTExMTEwsQGhoaGhoa
+ GhoaGhoaGhoaGhoaGhoQGSwLFBQUFBQUCxAbGxsbGxsbGxsbGxsbGxsbGxsbGxAZLAsVFRUVFRULEBwc
+ HBwcHBwcHBwcHBwcHBwcHBwcEBktCxYWFhYWFgsQHR0dHR0dHR0dHR0dHR0dHR0dHR0QGS0LCwsLCwsL
+ CxAeHh4eHh4eHh4eHh4eHh4eHh4eHhAZAAAAAAAAAAAAEB8fHx8fHx8fHx8fHx8fHx8fHx8fEBkAAAAA
+ AAAAAAAQICAgICAgICAgICAgICAgICAgICAQGQAAAAAAAAAAABAhISEhISEhISEhISEhISEhISEhIRAZ
+ AAAAAAAAAAAAECIiIiIiIiIiIiIiIiIiIiIiIiIiEBkAAAAAAAAAAAAQIyMjIyMjIyMjIyMjIyMjIyMj
+ IyMQGQAAAAAAAAAAABAkJCQkJCQkJCQkJCQkJCQkJCQkJBAZAAAAAAAAAAAAECUkJSQlJCQkJCQkJCQk
+ JCQkJCQkEBkAAAAAAAAAAAAQJSUlJSUlJSUlJSUlJSUlJSUlJSUQGQAAAAAAAAAAABAmJiYmJiYmJiYm
+ JiYmJiYmJiYmJhAZAAAAAAAAAAAAECcnJycnJycnJycnJycnJycnJycnEBkAAAAAAAAAAAAQKCgoKCgo
+ KCgoKCgoKCgoKCgoKCgQGQAAAAAAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBArAAAAAAAAAAAALy4u
+ Li4uLi4uLi4uLi4uLi4uLi4uLjD//////+AAf//gAD//4AA//+AAP//gAD//4AA/AGAAPwAgAD8AIAA/
+ ACAAPwAgAD8AP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/4AAAP+AAAD/gAAA/4AAAP+AAAD/gAAA
+ /4AAAP+AAAD/gAAA/4AAAP+AAAD/gAAA/4AAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAoj8AAK5OAAC6XQAAr2MPAMZtAACqbEwAsHNMALZ7TACwflQAvINMALKDbwC2h28A
+ uYxvAL2RbwC2jnQAADerAAA8tgAQUL8AQGi9AABCwgAAR80AEFPEAABM2AAlW8AAQGrDAD6w3wA+tuEA
+ PrzkAHiGwgB4iMUAcIzKAHiJyQB4jM0AZI3QAHCT2QBftdwAX7neAGCt2ABgstoAR7zmAF+/4QA9wucA
+ PcjqADzO7QA81O8AO9ryAEfD6QBGyuwAXsLhAEbR7wBG2PIARd/1AEXl+ABE7PwAu7zZALu93ACBuuAA
+ g73iAJrA3wClw9sApsbcALfH3AD///8AAAAAAAAvDgAAUBgAAHAiAACQLAAAsDYAAM9AAADwSgAR/1sA
+ Mf9xAFH/hwBx/50Akf+yALH/yQDR/98A////AAAAAAACLwAABFAAAAZwAAAIkAAACrAAAAvPAAAO8AAA
+ IP8SAD3/MQBb/1EAef9xAJj/kQC1/7EA1P/RAP///wAAAAAAFC8AACJQAAAwcAAAPZAAAEywAABZzwAA
+ Z/AAAHj/EQCK/zEAnP9RAK7/cQDA/5EA0v+xAOT/0QD///8AAAAAACYvAABAUAAAWnAAAHSQAACOsAAA
+ qc8AAMLwAADR/xEA2P8xAN7/UQDj/3EA6f+RAO//sQD2/9EA////AAAAAAAvJgAAUEEAAHBbAACQdAAA
+ sI4AAM+pAADwwwAA/9IRAP/YMQD/3VEA/+RxAP/qkQD/8LEA//bRAP///wAAAAAALxQAAFAiAABwMAAA
+ kD4AALBNAADPWwAA8GkAAP95EQD/ijEA/51RAP+vcQD/wZEA/9KxAP/l0QD///8AAAAAAC8DAABQBAAA
+ cAYAAJAJAACwCgAAzwwAAPAOAAD/IBIA/z4xAP9cUQD/enEA/5eRAP+2sQD/1NEA////AAAAAAAvAA4A
+ UAAXAHAAIQCQACsAsAA2AM8AQADwAEkA/xFaAP8xcAD/UYYA/3GcAP+RsgD/scgA/9HfAP///wAAAAAA
+ LwAgAFAANgBwAEwAkABiALAAeADPAI4A8ACkAP8RswD/Mb4A/1HHAP9x0QD/kdwA/7HlAP/R8AD///8A
+ AAAAACwALwBLAFAAaQBwAIcAkAClALAAxADPAOEA8ADwEf8A8jH/APRR/wD2cf8A95H/APmx/wD70f8A
+ ////AAAAAAAbAC8ALQBQAD8AcABSAJAAYwCwAHYAzwCIAPAAmRH/AKYx/wC0Uf8AwnH/AM+R/wDcsf8A
+ 69H/AP///wAAAAAACAAvAA4AUAAVAHAAGwCQACEAsAAmAM8ALADwAD4R/wBYMf8AcVH/AIxx/wCmkf8A
+ v7H/ANrR/wD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAACwEBAQEBAQYAAAAAAAAAAAwCAgICAgIHAAAA
+ Nx8fHwANAwMDAwMDCAAAAB0QEBATDgUFBQUFBQoAAAAeERERGQ8EBAQEBAQJAAAAIBQUFBg5Ojo6Ojo6
+ Ojo6OyAVFRUSGigoKCgoKCgoKCYhFxcXFhsvLy8vLy8vLy8mOCMjIyIcMDAwMDAwMDAwJwAAAAAAKjIy
+ MjIyMjIyMiQAAAAAACszMzMzMzMzMzMlAAAAAAAsNDQ0NDQ0NDQ0JQAAAAAALTU1NTU1NTU1NSkAAAAA
+ AC42NjY2NjY2NjYxAAAAAAA8PT09PT09PT09Pv//AAD4BwAA+AcAAAgHAAAABwAAAAcAAAAAAAAAAAAA
+ AAAAAAAAAAD4AAAA+AAAAPgAAAD4AAAA+AAAAPgAAACJUE5HDQoaCgAAAA1JSERSAAABAAAAAQAIBgAA
+ AFxyqGYAAA0ASURBVHja7dp1tJdFHsfxi4KigihggB3YPXSrlL1u79rd2B3Y3Qp2YGzvuiLdl7i03dgF
+ SkiJICB7OHvOXWbv3HNmfs/3eWbmN+/XH/ecz3/f4fC8+YNbpwJAsuqs+TF9+urVvg8BUKyWLevUqQ5A
+ o0a+zwFQlIULKyrWfPNaAFq0+G8QAJS3Nd98/foEAEjSmm++Xj0CACRpzTdfty4BAJJEAICEEYAMXjqm
+ gv82RZSOfvF/3zwBKBEBQKwIgAACgFgRAAEEALEiAAIIAGJFAASYAnBUv26+zwJqePnskdomAAIIAGJB
+ AHJgDEBfAoDwvHwOARBHABALApADUwCOJAAI0AACIM8YgIcJAMIz4FwCII4AIBYEIAfGADxEABCeAecR
+ AHEEALEgADkwBeCIBwkAwvNKbwIgjgAgFgQgBwQAsSAAOTAG4AECgPC8cj4BEEcAEAsCkANTAA6/v7vv
+ s4AaBl4wQtsEQAABQCwIQA6MAbiPACA8Ay8kAOIIAGJBAHJAABALApADUwAOu5cAIDyDLiIA4ggAYkEA
+ cmAMwD0EAOEZdDEBEEcAEAsCkANjAO4mAAjPoEsIgDhTAA4lAAjQYAIgjwAgFgQgB8YA3EUAEJ7BlxIA
+ cQQAsSAAOTAG4E4CgPAMvowAiDMF4BACgAANIQDyjAG4gwAgPEMuJwDiCABiQQByQAAQCwKQA2MAbicA
+ CM+QKwiAOAKAWBCAHJgC0Os2AoDwDL2SAIgjAIgFAciBMQC3EgCEZ+hVBEAcAUAsCEAOCABiQQByYApA
+ z1sIAMIz7GoCII4AIBYEIAfGANxMABCeYdcQAHEEALEgADkwBuAmAoDwDLuWAIgzBaAHAUCAhhMAeQQA
+ sSAAOTAG4EYCgPAMv44AiCMAiAUByIExADcQAIRneB8CIM4UgO439PB9FlDDiD7DtU0ABBgDcD0BQHhG
+ XE8AxBEAxIIA5IAAIBYEIAfGAPQhAAjPiBsIgDhTALoRAARoJAGQZwzAdQQA4Rl5IwEQRwAQCwKQA2MA
+ riUACM/ImwiAOAKAWBCAHJgCcDABQIBGEQB5xgBcQwAQnlE3EwBxBACxIAA5MAbgagKA8Iy6hQCIIwCI
+ BQHIgSkAB11FABCe0bcSAHEEALEgADkgAIgFAciBMQBXEgCEZ/RtBEAcAUAsCEAOTAE48AoCgPCMuZ0A
+ iCMAiAUByIExAJcTAIRnzB0EQBwBQCwIQA6MAbiMACA8Y+4kAOJMAehKABCgsQRAHgFALAhADowBuJQA
+ IDxj7yIA4ggAYkEAcmAMwCUEAOEZezcBEGcKQBcCgABVEgB5xgBcTAAQnsp7CIA4AoBYEIAcEADEggDk
+ wBiAiwgAwlN5LwEQZwpA54t6+j4LqGHcvcO0TQAEGANwIQFAeMbdRwDEEQDEggDkwBiACwgAwjPufgIg
+ jgAgFiUHoL+q+ZccFRUnzKioYwpAJwKAAI0nALJqDcD5BADhGf8AARBFABATAiCs1gD0JgAIz/gHCYAo
+ AoCYiAagyza+n1O8yi/1XVsAOp5HABCeCQ9JBmBr388pXuVX+iYAiIloADonGIBxBAAREw1ApwQDMN42
+ AOcSAIRnwsOCAei4le/nFG/C1/omAIgJAcjINgAdziEACM/EvoIB6JBgACYSAERMNADtEwxAlW0AziYA
+ CM/EfpIBaO77OcWr+kbfBAAxEQ1AuwQDMIkAIGKiAWibYAAm2wbgLAKA8Ex8RDIAzXw/p3iTZ+m7tgC0
+ JwAIUJVkANokGIAptgE4kwAgPFWPCgagdYIBmEoAEDHRALTa0vdzijdttr5rDcAZBADhqXqMAGRCABAz
+ 0QC0TDAA0y0D0I4AIECTJAOgtvD9nOLN+FbftQbgdAKA8Ex6nABkQgAQM9EAHJBgAF61DcBpBADhmfSE
+ YAD239z3c4r32nf6JgCICQHIyDYAbU8lAAjP5CcFA7BfggF4nQAgYqIB2Hcz388p3htz9E0AEBMCkJF1
+ AE4hAAjP5KcEA7BPggF4kwAgYqIB2DvBALxlGYA2J/fyfSpQw5Snh2o7UwD2aur7OcV7e66+CQBiQgAy
+ sg7ASQQA4ZnyjGAA9kwwAO8QAERMNAB7NPH9nOK9O0/fBAAxIQAZ2Qag9YkEAOGZ+qxgAHZPMADvEQBE
+ TDQAuzX2/ZzivT9f37UG4AQCgPBM7U8AMiEAiJloAHZNMAAf2AbgeAKA8Ex9TjAAu2zq+znF+/B7fdcW
+ gFYEAAGaRgCyIQCImWgAWiQYgJm2ATiOACA8054XDMDOm/h+TvE+WqBvAoCYiAZgpwQD8LFtAI4lAAjP
+ tBcIQCa2AQBikCkAOzbyfX7xPlmobwKAmGUKwA4JBuBTAoAyQgAcEQCUk0wB2D7BAHxmCIDvm4CsSgrA
+ dhv7Prt4ny/SNwFAOSAAlggAylFJAdg2wQB8QQBQhkoKwDYNfZ9dvC8X65sAoByUFICtEwzAVwQAZYgA
+ WCIAKEclBWCrBr7PLt7XS/RtGwClTud3BcrQjBmPl8U/ACUFoHmCAfiGAGAtBCAxBABrSzoAzTbyfXbx
+ Zv2gbwKQtqQDsGWCAZhNALAWApAYyQDMOLy37+fAkRr4oLaTDsAWG/o+u3jfLtV3pgAcdp7v58CRGvSQ
+ tpMOwOYJBuA7yQAcSgBiowYTgGoEIGMADjnX93PgSA15WNtJB2CzDXyfXbw5P+o7UwB6neP7OXCkhvbV
+ dtIBaJpgAOZKBqDn2b6fA0dqWD9tJx2AJgkGYJ5kAHoQgNio4QSgGgHIGIDuZ/l+DhypEY9oO+kANK7v
+ ++zizV+m70wB6Ham7+fAkRr5qLaTDsCmCQbge8kAHHyG7+fAkRr1mLYJQGIIQNoIwFo2Wd/32cVbsFzf
+ mQJw0Om+nwNHavTj2k46AI0SDMBCyQAceJrv58CRGvOEtglAYkQD0PVU38+BIzX2SW0nHYCN1/N9dvEW
+ /aTvTAHoQgBioyoJQLWGCQZgsWQAOp/i+zlwpMY9pW0CkBjRAHQ62fdz4EiNf1rbSQegQT3fZxdvyQp9
+ ZwpAx5N8PweO1IRntJ10ADZKMAA/SAagAwGIjZpIAKptmGAAlkoGoP2Jvp8DR6rqWW2nHYC6vs8u3tKV
+ +s4UgHYn+H4OHKlJ/bWddAA2SDAAP0oGoO3xvp8DR2ryc9pOOgD1EwzAMskAtCEAsVFTCEC1+uv6Prt4
+ y1bpO1MAWh/n+zlwpKY+r+2kA7B+ggFYLhmAVsf6fg4cqWkvaDvpAKyXYAB+kgxAy2N8PweO1PQXtU0A
+ EiMaAEUAYqNmEIBq9dbxfXbxVvys70wBOOCPvp8DR+rVP2k76QDUTTAAKyUDsP8ffD8HjtRrf9Z20gFY
+ N8EArJIMwH6/9/0cOFKv/0XbaQegLJ7uZtX//SlkCsC+BCA26g0CUG2dsni6m58lA7DP73w/B47Um3/V
+ dtIBQMYA7P1b3+fDkXrrb9omAInLFIC9fuP7fDhSb/9d2wQgcZkCsCcBiI16hwBgLZkCsMevfZ8PR+rd
+ f2g7mQAgG2MAdv+V77PgSL33T20TAFgxBmC3X/o+C47U+//SNgGAFQJQHggASmIMwK5H+z4LjtQHL2mb
+ AMCKMQC7/ML3WXCkPvy3tgkArBgD0OIo32fBkZr5srYJAKwYA7AzAYiN+ogAoATGAOx0pO+z4Eh9PEDb
+ BABWjAHY8QjfZ8GR+uQVbRMAWDEGYIfDfZ8FR+rTgdomALBiDMD2BCA26jMCgBIYA7DdYb7PgiP1+SBt
+ EwBYMQZg20N9nwVH6ovB2iYAsGIMwDaH+D4LjtSXQ7RNAGDFGICtCUBs1FcEACUwBmCrXr7PgiP19VBt
+ EwBYMQageU/fZ8GR+maYtgkArBgD0KyH77PgSM0arm0CACvGAGxJAGKjZhMAlMAYgC26+z4LjtS3I7RN
+ AGDFGIDNu/k+C47UdyO1TQBgxRiAzQ72fRYcqTmjtE0AYMUYgKYEIDZqLgFACYwBaHKQ77PgSM0brW0C
+ ACvGADQ+0PdZcKTmj9E2AYAVYwA27er7LDhS34/VNgGAFWMANunq+yw4UgvGapsAwIoxAI26+D4LjtTC
+ Sm0TAFgxBmDjzr7PgiO1aJy2CQCsGAPQsJPvs+BILR6vbQIAKwSgPBAAlMQYgAYdfZ8FR2rJBG0TAFgx
+ BmCjDr7PgiP1w0RtEwBYMQZgw/a+z4IjtbRK2wQAVowB2IAAxEb9SABQAmMA6rfzfRYcqWWTtE0AYMUY
+ gPXb+j4LjtTyydomALBiDMB6bXyfBUfqpynaJgCwYgxAPQIQG7WCAKAExgDUbe37LDhSK6dqmwDAijEA
+ 67byfRYcqVXTtE0AYMUUAMSPAMAKAShPBABWCEB5IgCwQgDKEwEAED0CACSMAAAJIwBAwggAkDACACSM
+ AAAJIwBAwmoEwPdBAIpVHYA1Zs5cvXr58oqKVasqKsgBkIb/AA/38rf1PkgbAAAAAElFTkSuQmCCKAAA
+ ADAAAABgAAAAAQAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7i4gAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7g
+ 4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAGYzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2Yz
+ M2YzM2YzM2YzM2YzM2YzM2YzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM5o5A546AJ46AJ46AJ46AJ46AJ46
+ AJ46AJ46AJ46AJ46AJ46AJ46AJ46AJ46AJ46AJ46AJ46AJ46AJ46AGYzMwAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AGYzM54+A6I/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/AKI/
+ AKI/AGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM6JCA6ZDAKZDAKZDAKZDAKZDAKZDAKZDAKZDAKZDAKZD
+ AKZDAKZDAKZDAKZDAKZDAKZDAKZDAKZDAKZDAGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM6ZHA6pJAKpJ
+ AKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAKpJAGYzMwAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAGYzM6lMA65OAK5OAK5OAK5OAK5OAK5OAK5OAK5OAK5OAK5OAK5OAK5OAK5OAK5O
+ AK5OAK5OAK5OAK5OAK5OAGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM61RA7JTALJTALJTALJTALJTALJT
+ ALJTALJTALJTALJTALJTALJTALJTALJTALJTALJTALJTALJTALJTAGYzMwAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AGYzM7FWA7ZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZALZZ
+ ALZZAGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzoQAzoQAzoQAzoQAzoQAzoQAz
+ oQAzoQAzoQAzoQAzoQAzoQAzoQAAAAAAAGYzM7RaA7pdALpdALpdALpdALpdALpdALpdALpdALpdALpd
+ ALpdALpdALpdALpdALpdALpdALpdALpdALpdAGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAzoQA0owA0pAA0pAA0pAA0pAA0pAA0pAA0pAA0pAA0pAA0pAAzoQAAAAAAAGYzM7hfA75iAL5i
+ AL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAL5iAGYzMwAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzoQA2pwA2qAA2qAA2qAA2qAA2qAA2qAA2qAA2qAA2
+ qAA2qAAzoQAAAAAAAGYzM7xkA8JoAMJoAMJoAMJoAMJoAMJoAMJoAMJoAMJoAMJoAMJoAMJoAMJoAMJo
+ AMJoAMJoAMJoAMJoAMJoAGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzoQA3qwA3
+ qwA3qwA3qwA3qwA3qwA3qwA3qwA3qwA3qwA3qwAzoQAAAAAAAGYzM8BpA8ZtAMZtAMZtAMZtAMZtAMZt
+ AMZtAMZtAMZtAMZtAMZtAMZtAMZtAMZtAMZtAMZtAMZtAMZtAMZtAGYzMwAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAzoQA5rgA5rwA5rwA5rwA5rwA5rwA5rwA5rwA5rwA5rwA5rwAzoQAAAAAA
+ AGYzM8NuA8pyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpyAMpy
+ AMpyAGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzoQA6sQA7swA7swA7swA7swA7
+ swA7swA7swA7swA7swA7swAzoQAAAAAAAGYzM8dzA853AM53AM53AM53AM53AM53AM53AM53AM53AM53
+ AM53AM53AM53AM53AM53AM53AM53AM53AM53AGYzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAzoQA8tQA8tgA8tgA8tgA8tgA8tgA8tgA8tgA8tgA8tgA8tgAzoQAAAAAAAGYzM8t3A9J8ANJ8
+ ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8ANJ8AGYzMwAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzoQA9uAA+ugA+ugA+ugA+ugA+ugA+ugA+ugA+ugA+
+ ugA+ugAzoQAAAAAAAGYzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2YzM2Yz
+ M2YzM2YzM2YzM2YzM2YzM2YzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzoQA/vABA
+ vgBAvgBAvgBAvgBAvgBAvgBAvgBAvgBAvgBAvgAzoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAzoQBBvwBBwQBBwQBBwQBBwQBBwQBBwQBBwQBBwQBBwQBBwQAzoQBbrwBb
+ rwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBb
+ rwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbr7rH3wAAAAAzoQBCwwBDxQBDxQBDxQBDxQBD
+ xQBDxQBDxQBDxQBDxQBDxQAzoQBbr0i45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei4
+ 5Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45Ei45ABbr6y8
+ 2QAAAAAzoQBExgBFyQBFyQBFyQBFyQBFyQBFyQBFyQBFyQBFyQBFyQAzoQBbr0i65Ui65Ui65Ui65Ui6
+ 5Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui65Ui6
+ 5Ui65Ui65Ui65Ui65Ui65Ui65QBbr6y82QAAAAAzoQBFygBHzABHzABHzABHzABHzABHzABHzABHzABH
+ zABHzAAzoQBbr0i85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki8
+ 5ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85ki85gBbr6y82QAAAAAzoQBHzQBI
+ 0ABI0ABI0ABI0ABI0ABI0ABI0ABI0ABI0ABI0AAzoQBbr0i/50i/50i/50i/50i/50i/50i/50i/50i/
+ 50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/50i/
+ 50i/50i/5wBbr6y82QAAAAAzoQBI0QBK1ABK1ABK1ABK1ABK1ABK1ABK1ABK1ABK1ABK1AAzoQBbr0fB
+ 6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB
+ 6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6EfB6ABbr6y82QAAAAAzoQBK1ABM2ABM2ABM2ABM2ABM
+ 2ABM2ABM2ABM2ABM2ABM2AAzoQBbr0fD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD
+ 6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6UfD6QBbr6y8
+ 2QAAAAAzoQBM2ABN2wBN2wBN2wBN2wBN2wBN2wBN2wBN2wBN2wBN2wAzoQBbr0fF6kfF6kfF6kfF6kfF
+ 6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF6kfF
+ 6kfF6kfF6kfF6kfF6kfF6kfF6gBbr6y82QAAAAAzoQBGzABIzwBIzwBIzwBIzwBIzwBIzwBIzwBIzwBI
+ zwBIzwAzoQBbr0fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI
+ 60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI60fI6wBbr6y82QAAAAAzoQAzoQAz
+ oQAzoQAzoQAzoQAzoQAzoQAzoQAzoQAzoQAzoQAzoQBbr0fK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK
+ 7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK7EfK
+ 7EfK7EfK7ABbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0fM
+ 7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM
+ 7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7UfM7QBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAABbr0bO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO
+ 7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7kbO7gBbr6y8
+ 2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0bR70bR70bR70bR70bR
+ 70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR70bR
+ 70bR70bR70bR70bR70bR70bR7wBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAABbr0bT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT
+ 8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8EbT8ABbr6y82QAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0bV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV
+ 8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV8kbV
+ 8kbV8kbV8gBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0bX
+ 80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX
+ 80bX80bX80bX80bX80bX80bX80bX80bX80bX80bX8wBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAABbr0ba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba
+ 9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9Eba9ABbr6y8
+ 2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0Xc9UXc9UXc9UXc9UXc
+ 9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc9UXc
+ 9UXc9UXc9UXc9UXc9UXc9UXc9QBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAABbr0Xe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe
+ 9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9kXe9gBbr6y82QAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg
+ 90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg90Xg
+ 90Xg90Xg9wBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0Xj
+ +EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj
+ +EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+EXj+ABbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAABbr0Xl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl
+ +UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+UXl+QBbr6y8
+ 2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0Xn+kXn+kXn+kXn+kXn
+ +kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn+kXn
+ +kXn+kXn+kXn+kXn+kXn+kXn+gBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAABbr0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp
+ +0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+0Tp+wBbr6y82QAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0Ts/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs
+ /ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs/ETs
+ /ETs/ETs/ABbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr0Tu
+ /UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu
+ /UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/UTu/QBbr6y82QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAABbr0Tw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw
+ /kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/kTw/gBbr669
+ 2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbrwBbrwBbrwBbrwBbrwBb
+ rwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBbrwBb
+ rwBbrwBbrwBbrwBbrwBbrwBbrwBbr+XZ4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7i4n///////g7u////
+ ////Du7//wAAA/8O7v//AAAD/w7u//8AAAP/Du7//wAAA/8O7v//AAAD/w7u//8AAAP/Du7//wAAA/8O
+ 7v//AAAD/w7ugAMAAAP/Du6AAwAAA/8O7oADAAAD/w7ugAMAAAP/Du6AAwAAA/8O7oADAAAD/w7ugAMA
+ AAP/Du6AAwAAA/8O7oAD/////w7ugAAAAAAADu6AAAAAAAAO7oAAAAAAAA7ugAAAAAAADu6AAAAAAAAO
+ 7oAAAAAAAA7ugAAAAAAADu6AAAAAAAAO7oAAAAAAAA7ugAAAAAAADu7//AAAAAAO7v/8AAAAAA7u//wA
+ AAAADu7//AAAAAAO7v/8AAAAAA7u//wAAAAADu7//AAAAAAO7v/8AAAAAA7u//wAAAAADu7//AAAAAAO
+ 7v/8AAAAAA7u//wAAAAADu7//AAAAAAO7v/8AAAAAA7u//wAAAAADu7//AAAAAAO7v/8AAAAAA7u//wA
+ AAAADu7///////4O7igAAAAgAAAAQAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AABmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzMAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmMzOfOwCfOwCfOwCfOwCfOwCfOwCf
+ OwCfOwCfOwCfOwCfOwCfOwBmMzOxmJgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAABmMzOkQQCkQQCkQQCkQQCkQQCkQQCkQQCkQQCkQQCkQQCkQQCkQQBmMzOxmJgA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmMzOrSgCrSgCr
+ SgCrSgCrSgCrSgCrSgCrSgCrSgCrSgCrSgCrSgBmMzOxmJgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmMzOwUQCwUQCwUQCwUQCwUQCwUQCwUQCwUQCwUQCwUQCw
+ UQCwUQBmMzOxmJgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AABmMzO3WgC3WgC3WgC3WgC3WgC3WgC3WgC3WgC3WgC3WgC3WgC3WgBmMzOxmJgAAAAAAAAAAAAAAAAA
+ AAAAAADHu9QAM6EAM6EAM6EAM6EAM6EAM6EAM6EAM6EAAAAAAABmMzO8YAC8YAC8YAC8YAC8YAC8YAC8
+ YAC8YAC8YAC8YAC8YAC8YABmMzOxmJgAAAAAAAAAAAAAAAAAAAAAAADHu9QAM6EANqkANqkANqkANqkA
+ NqkANqkAM6F/mM8AAABmMzPDaQDDaQDDaQDDaQDDaQDDaQDDaQDDaQDDaQDDaQDDaQDDaQBmMzOxmJgA
+ AAAAAAAAAAAAAAAAAAAAAADHu9QAM6EAOK0AOK0AOK0AOK0AOK0AOK0AM6F/mM8AAABmMzPIcADIcADI
+ cADIcADIcADIcADIcADIcADIcADIcADIcADIcABmMzOxmJgAAAAAAAAAAAAAAAAAAAAAAADHu9QAM6EA
+ O7QAO7QAO7QAO7QAO7QAO7QAM6F/mM8AAABmMzPPeADPeADPeADPeADPeADPeADPeADPeADPeADPeADP
+ eADPeABmMzOxmJgAAAAAAAAAAAAAAAAAAAAAAADHu9QAM6EAPbgAPbgAPbgAPbgAPbgAPbgAM6F/mM8A
+ AABmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzNmMzOxmJgAAAAAAAAAAAAAAAAA
+ AAAAAADHu9QAM6EAQL8AQL8AQL8AQL8AQL8AQL8AM6FVfMEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADHu9QAM6EAQsMAQsMAQsMAQsMA
+ QsMAQsMAM6EAW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68A
+ W68AW68AW68AW68AW6+BpM7Hu9QAM6EARcoARcoARcoARcoARcoARcoAM6EAW69IuuVIuuVIuuVIuuVI
+ uuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuVIuuUAW698oMzHu9QAM6EA
+ R84AR84AR84AR84AR84AR84AM6EAW69IvuZIvuZIvuZIvuZIvuZIvuZIvuZIvuZIvuZIvuZIvuZIvuZI
+ vuZIvuZIvuZIvuZIvuZIvuZIvuZIvuYAW698oMzHu9QAM6EAStUAStUAStUAStUAStUAStUAM6EAW69H
+ wehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwehHwegA
+ W698oMzHvNQAM6EATNoATNoATNoATNoATNoATNoAM6EAW69HxOlHxOlHxOlHxOlHxOlHxOlHxOlHxOlH
+ xOlHxOlHxOlHxOlHxOlHxOlHxOlHxOlHxOlHxOlHxOlHxOkAW698oMzHvNQAM6EAM6EAM6EAM6EAM6EA
+ M6EAM6EAM6EAW69HyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtHyOtH
+ yOtHyOtHyOtHyOsAW698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69Hy+xHy+xHy+xHy+xH
+ y+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+xHy+wAW698oMwAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAW69Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5G
+ z+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+5Gz+4AW698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69G
+ 0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u9G0u8A
+ W698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69G1fJG1fJG1fJG1fJG1fJG1fJG1fJG1fJG
+ 1fJG1fJG1fJG1fJG1fJG1fJG1fJG1fJG1fJG1fJG1fJG1fIAW698oMwAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAW69G2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG2fNG
+ 2fNG2fNG2fNG2fMAW698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69F3PVF3PVF3PVF3PVF
+ 3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PVF3PUAW698oMwAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAW69F3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF
+ 3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/ZF3/YAW698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69F
+ 4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/hF4/gA
+ W698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69F5vlF5vlF5vlF5vlF5vlF5vlF5vlF5vlF
+ 5vlF5vlF5vlF5vlF5vlF5vlF5vlF5vlF5vlF5vlF5vlF5vkAW698oMwAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAW69E6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE6vtE
+ 6vtE6vtE6vtE6vsAW698oMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW69E7fxE7fxE7fxE7fxE
+ 7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fxE7fwAW698oMwAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68AW68A
+ W68AW68AW68AW68AW68AW68AW68AW68AW6+Qqs8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADf1d/H
+ xdfHxdfHxdfHxdfHxdfHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbHxNbH
+ xNbn1t7//////+AAf//gAD//4AA//+AAP//gAD//4AA/AGAAPwAgAD8AIAA/ACAAPwAgAD8AP///AAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAA/4AAAP+AAAD/gAAA/4AAAP+AAAD/gAAA/4AAAP+AAAD/gAAA/4AA
+ AP+AAAD/gAAA/4AAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACyg2+i
+ PwCiPwCiPwCiPwCiPwCiPwCqbEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC2h2+uTgCuTgCuTgCuTgCu
+ TgCuTgCwc0wAAAAAAAAAAAC7vNlwjMpwjMpwjMoAAAC5jG+6XQC6XQC6XQC6XQC6XQC6XQC2e0wAAAAA
+ AAAAAAB4hsIAN6sAN6sAN6tAaL29kW/GbQDGbQDGbQDGbQDGbQDGbQC8g0wAAAAAAAAAAAB4iMUAPLYA
+ PLYAPLZAasO2jnSvYw+vYw+vYw+vYw+vYw+vYw+wflQAAAAAAAAAAAB4icgAQsIAQsIAQsIlW8CBuuCD
+ veKDveKDveKDveKDveKDveKDveKDveKDveKawN94issAR80AR80AR80QUL8+sN9HvOZHvOZHvOZHvOZH
+ vOZHvOZHvOZHvOZHvOZgrNh4jM0ATNgATNgATNgQU8Q+tuFHw+lHw+lHw+lHw+lHw+lHw+lHw+lHw+lH
+ w+lgrtm7vdxwk9lwk9lwk9lkjdA+vORGyuxGyuxGyuxGyuxGyuxGyuxGyuxGyuxGyuxgstoAAAAAAAAA
+ AAAAAAAAAAA9wudG0e9G0e9G0e9G0e9G0e9G0e9G0e9G0e9G0e9ftdwAAAAAAAAAAAAAAAAAAAA9yOpG
+ 2PJG2PJG2PJG2PJG2PJG2PJG2PJG2PJG2PJfuN0AAAAAAAAAAAAAAAAAAAA8zu1F3/VF3/VF3/VF3/VF
+ 3/VF3/VF3/VF3/VF3/Vfu98AAAAAAAAAAAAAAAAAAAA81O9F5fhF5fhF5fhF5fhF5fhF5fhF5fhF5fhF
+ 5fhfv+EAAAAAAAAAAAAAAAAAAAA72vJE7PxE7PxE7PxE7PxE7PxE7PxE7PxE7PxE7PxewuEAAAAAAAAA
+ AAAAAAAAAAClw9umxtymxtymxtymxtymxtymxtymxtymxtymxty3x9z//6xB+AesQfgHrEEIB6xBAAes
+ QQAHrEEAAKxBAACsQQAArEEAAKxB+ACsQfgArEH4AKxB+ACsQfgArEH4AKxBiVBORw0KGgoAAAANSUhE
+ UgAAAQAAAAEACAYAAABccqhmAAANN0lEQVR42u3aV5BWRRqHcUdRMSFgwJzFgIraQ45KFNO6edecI+ac
+ M+acc9xdNylIzkMYhjBmxRxRQAygEgyos1VbU7T0WN3fec/p7q+fX9WB+ldx8fYFDxdMxQoAklXxv19m
+ zPjpJ9+HAChWZWVFxbIBGOj7IACF2b/uG/jLANT4vgpAIQbUfa+ZAvCu78sA5O6pum9WQwF4yfd1AHI1
+ s+6b82sBmO37QgC5mV/3zf3VAFRWVizwfSUAef//O08ASvH0gSvw36aI0gFPav/1TwBKQQAQKwIggAAg
+ VgRAAAFArAiAAAKAWLVqrVTLs2ufIwAZmAKw/109fZ8FLGfgCaO1TQAEEADEggDkwBiAOwkAwjPwRAIg
+ jgAgFgQgB6YA7EcAEKBBBECeMQB3EACEZ9BJBEAcAUAsCEAOjAG4nQAgPIP6EwBxBACxIAA5MAVg39sI
+ AMLz7MkEQBwBQCwIQA4IAGJBAHJgDMCtBADhefYUAiCOACAWBCAHpgDsc0sv32cByxl86ihtEwABBACx
+ IAA5MAbgZgKA8Aw+jQCIIwCIBQHIAQFALAhADkwB2PsmAoDwDDmdAIgjAIgFAciBMQA3EgCEZ8gZBEAc
+ AUAsCEAOjAG4gQAgPEPOJADiTAHoRwAQoKEEQB4BQCwIQA6MAbieACA8Q88iAOIIAGJBAHJgDMB1BADh
+ GXo2ARBnCsBeBAABGkYA5BkDcC0BQHiGnUMAxBEAxIIA5IAAIBYEIAfGAFxDABCeYecSAHEEALEgADkw
+ BaDvAAKA8Aw/jwCIIwCIBQHIgTEAVxMAhGf4+QRAHAFALAhADggAYkEAcmAKQJ+rCADCM+ICAiCOACAW
+ BCAHxgBcSQAQnhEXEgBxBACxIAA5MAbgCgKA8Iy4iACIMwWgNwFAgEYSAHkEALEgADkwBuByAoDwjLyY
+ AIgjAIgFAciBMQCXEQCEZ+QlBECcKQC9Luvt+yxgOaMuGaltAiDAGIBLCQDCM+pSAiCOACAWBCAHBACx
+ IAA5MAbgEgKA8Iy6jACIMwWgJwFAgEYTAHnGAFxMABCe0ZcTAHEEALEgADkwBuAiAoDwjL6CAIgjAIgF
+ AciBKQA9CAACNIYAyDMG4EICgPCMuZIAiCMAiAUByIExABcQAIRnzFUEQBwBQCwIQA5MAdjzfAKA8Iy9
+ mgCIIwCIBQHIAQFALAhADowBOI8AIDxjBxAAcQQAsSAAOTAFYI9zCQDCM+4aAiCOACAWBCAHxgCcQwAQ
+ nnHXEgBxBACxIAA5MAbgbAKA8Iy7jgCIMwWgOwFAgMYTAHkEALEgADkwBuAsAoDwjL+eAIgjAIgFAciB
+ MQBnEgCEZ/wNBECcKQDdCAACVEUA5BkDcAYBQHiqbiQA4ggAYkEAckAAEAsCkANjAE4nAAhP1U0EQJwp
+ AF1P7+P7LGA5E24aoW0CIMAYgNMIAMIz4WYCII4AIBYEIAfGAJxKABCeCbcQAHEEALEoOQCvHlsx0/fx
+ ITq0doUKUwC6EAAEaCIBkNVgAE4hAAjPxFsJgCgCgJgQAGENBuBkAoDwTLyNAIgiAIiJaAC6ber7OcWr
+ +kjfDQWgc38CgPBMul0yAJv4fk7xqmbpmwAgJqIB6JpgACYQAERMNABdEgzARNsAnEQAEJ5JdwgGoPPG
+ vp9TvEkf65sAICYEICPbAHQ6kQAgPJPvFAxApwQDMJkAIGKiAeiYYACqbQNwAgFAeCbfJRmAjXw/p3jV
+ n+ibACAmogHokGAAphAAREw0AO0TDECNbQCOJwAIz+S7JQOwoe/nFK9mtr4bCkBHAoAAVUsGoF2CAZhq
+ G4DjCADCU32PYADaJhiAaQQAERMNQJsNfD+neNPn6LvBABxLABCe6nsJQCYEADETDUBlggGYYRmADgQA
+ AZoiGQDVwvdzilc7V98NBuAYAoDwTLmPAGRCABAz0QDsnmAAnrMNwNEEAOGZcr9gAHZb3/dzivf8p/om
+ AIgJAcjINgDtjyIACE/NA4IB2DXBALxAABAx0QC0Xs/3c4r34jx9EwDEhABkZB2AIwkAwlPzoGAAdkkw
+ AC8RAERMNAA7JxiAly0D0O6Ivr5PBZYz9aHh2s4UgJ3W9f2c4r3ymb4JAGJCADKyDsDhBADhmfqwYABa
+ JRiAVwkAIiYagB3X8f2c4r32ub4JAGJCADKyDUDbwwgAwjPtEcEA7JBgAGYSAERMNADbN/f9nOK9/oW+
+ GwzAoQQA4Zn2KAHIhAAgZqIB2C7BALxhG4BDCADCM+0xwQC0bOb7OcV780t9NxSANgQAAZpOALIhAIiZ
+ aAC2TTAAb9kG4GACgPBMf1wwANs09f2c4r09X98EADERDcDWCQbgHdsAHEQAEJ7pTxCATGwDAMQgUwC2
+ Wtv3+cV7d4G+CQBilikAWyYYgPcIAMoIAXBEAFBOMgVgiwQD8L4hAL/8M29ep3b3fSdgq+QAbN7E9+nF
+ ++ArfZsCAMSGAFgiAChHJQVgswQD8CEBQBkqKQCbruX77OJ99LW+CQDKQUkB2CTBAMwiAChDBMASAUA5
+ KikAG6/p++ziffyNvm0DoNQx/KxAGaqtva8s/gEoKQAbJRiATwgAlkEAEkMAsKykA7DhGr7PLt7shfom
+ AGlLOgAbJBiAOQQAyyAAiZEMQO0+J/t+DhypwbdpO+kAtFjd99nFm7tI35kCsHd/38+BIzXkdm0nHYD1
+ EwzAp5IB6EcAYqOGEoB6BCBjAPY6yfdz4EgNu0PbSQdgvdV8n128eYv1nSkAfU/0/Rw4UsPv1HbSAVg3
+ wQB8JhmAPif4fg4cqRF3aTvpAKyTYAA+lwxAbwIQGzWSANQjABkD0Ot438+BIzXqbm0nHYDmjX2fXbwv
+ lug7UwB6Huf7OXCkRt+j7aQD0CzBAHwpGYAex/p+DhypMfdqmwAkhgCkjQAso+mqvs8u3vxv9Z0pAHse
+ 4/s5cKTG3qftpAOwdoIBWCAZgD2O9v0cOFLj7tc2AUiMaAC6H+X7OXCkxj+g7aQD0GQV32cX76vv9J0p
+ AN0IQGxUFQGot1aCAfhaMgBdj/T9HDhSEx7UNgFIjGgAuhzh+zlwpCY+pO2kA7Dmyr7PLt433+s7UwA6
+ H+77OXCkJj2s7aQDsEaCAVgoGYBOBCA2ajIBqLd6ggFYJBmAjof5fg4cqepHtJ12ABr5Prt4i37Qd6YA
+ dDjU93PgSE15VNtJB2C1BAOwWDIA7Q/x/Rw4UjWPaTvpADROMABLJAPQjgDERk0lAPUar+T77OItWarv
+ TAFoe7Dv58CRmva4tpMOwKoJBuBbyQC0Ocj3c+BITX9C20kHYJUEA/CdZAAqD/T9HDhSM57UNgFIjGgA
+ FAGIjaolAPVWXtH32cX7/kd9ZwrA7n/1/Rw4Us/9TdtJB6BRggH4QTIAu/3F93PgSD3/d20nHYCVEgzA
+ UskA7Ppn38+BI/XCP7SddgDK4ululv7ir3GmALQmALFRLxKAeiuWxdPd/CgZgF3+5Ps5cKReekrbSQcA
+ GQOw8x99nw9H6uV/apsAJC5TAHb6g+/z4Ui98i9tE4DEZQpAKwIQG/UqAcAyMgVgx9/7Ph+O1Gv/1nYy
+ Aaj7ZldWVizwfWisjAHY4Xe+z4IjNfM/2iYAsGIMwPa/9X0WHKnX/6ttAgArBKA8EACUxBiA7Q7wfRYc
+ qTee1jYBgBVjAFr+xvdZcKTefEbbBABWjAHYdn/fZ8GRemugtgkArBgDsA0BiI16mwCgBMYAbL2f77Pg
+ SL0zSNsEAFaMAdhqX99nwZF691ltEwBYMQZgy318nwVH6r3B2iYAsGIMwBYEIDbqfQKAEhgDsPnevs+C
+ I/XBEG0TAFgxBmCzfr7PgiP14VBtEwBYMQZg0718nwVH6qNh2iYAsGIMwCYEIDZqFgFACYwB2Liv77Pg
+ SH08XNsEAFaMAdioj++z4Eh9MkLbBABWjAHYsLfvs+BIzR6pbQIAK8YAbEAAYqPmEACUwBiAFr18nwVH
+ au4obRMAWDEGYP2evs+CI/XpaG0TAFgxBmC9Hr7PgiM1b4y2CQCsGAOwLgGIjfqMAKAExgCss6fvs+BI
+ fT5W2wQAVowBaL6H77PgSH0xTtsEAFaMAWjW3fdZcKS+HK9tAgArxgA07e77LDhS88drmwDAijEAa3fz
+ fRYcqQVV2iYAsGIMQJOuvs+CI/XVBG0TAFgxBmCtLr7PgiP19URtEwBYIQDlgQCgJMYArNnZ91lwpL6Z
+ pG0CACvGAKzRyfdZcKQWTtY2AYAVYwBW7+j7LDhSi6q1TQBgxRiA1QhAbNRiAoASGAPQuIPvs+BILZmi
+ bQIAK8YArNre91lwpL6t0TYBgBVjAFZp5/ssOFLfTdU2AYAVYwBWJgCxUd8TAJTAGIBGbX2fBUfqh2na
+ JgCwYgzASm18nwVHaul0bRMAWDEFAPEjALBCAMoTAYAVAlCeCACsEIDyRAAARI8AAAkjAEDCCACQMAIA
+ JIwAAAkjAEDCCACQMFMAAKRlbv1PNdVF4Jm637at+5rUfY3qvrL4iScADfsZgOX03tj+IOMAAAAASUVO
+ RK5CYIIoAAAAMAAAAGAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/svLi/7Ly2D+y8tb/svL
+ W/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svL
+ W/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svL
+ W/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8tb/svLW/7Ly1v+y8uU/svL
+ ev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AGUyMhxlMjIgZTIyIGUyMiBlMjIgZTIyIGUyMiBlMjIgZTIyIGUyMiBlMjIgZTIyIGUyMiBlMjIgZTIy
+ IGUyMiBlMjIgZTIyIGUyMiBlMjIgZTIyIGUyMiBlMjIIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAD+y8tb/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAGYzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz
+ /2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM/+aOQP/njoA/546AP+eOgD/njoA/546AP+eOgD/njoA
+ /546AP+eOgD/njoA/546AP+eOgD/njoA/546AP+eOgD/njoA/546AP+eOgD/njoA/2YzM/9lMjJAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM/+ePgP/oj8A/6I/AP+iPwD/oj8A
+ /6I/AP+iPwD/oj8A/6I/AP+iPwD/oj8A/6I/AP+iPwD/oj8A/6I/AP+iPwD/oj8A/6I/AP+iPwD/oj8A
+ /2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLev7LywgAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM/+iQgP/pkMA
+ /6ZDAP+mQwD/pkMA/6ZDAP+mQwD/pkMA/6ZDAP+mQwD/pkMA/6ZDAP+mQwD/pkMA/6ZDAP+mQwD/pkMA
+ /6ZDAP+mQwD/pkMA/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svL
+ ev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AGYzM/+mRwP/qkkA/6pJAP+qSQD/qkkA/6pJAP+qSQD/qkkA/6pJAP+qSQD/qkkA/6pJAP+qSQD/qkkA
+ /6pJAP+qSQD/qkkA/6pJAP+qSQD/qkkA/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAD+y8tb/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAGYzM/+pTAP/rk4A/65OAP+uTgD/rk4A/65OAP+uTgD/rk4A/65OAP+uTgD/rk4A
+ /65OAP+uTgD/rk4A/65OAP+uTgD/rk4A/65OAP+uTgD/rk4A/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM/+tUQP/slMA/7JTAP+yUwD/slMA/7JTAP+yUwD/slMA
+ /7JTAP+yUwD/slMA/7JTAP+yUwD/slMA/7JTAP+yUwD/slMA/7JTAP+yUwD/slMA/2YzM/9lMjJAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM/+xVgP/tlkA/7ZZAP+2WQD/tlkA
+ /7ZZAP+2WQD/tlkA/7ZZAP+2WQD/tlkA/7ZZAP+2WQD/tlkA/7ZZAP+2WQD/tlkA/7ZZAP+2WQD/tlkA
+ /2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLegAzof8AM6H/ADOh
+ /wAzof8AM6H/ADOh/wAzof8AM6H/ADOh/wAzof8AM6H/ADOh/wAzof8AMqAsAAAAAGYzM/+0WgP/ul0A
+ /7pdAP+6XQD/ul0A/7pdAP+6XQD/ul0A/7pdAP+6XQD/ul0A/7pdAP+6XQD/ul0A/7pdAP+6XQD/ul0A
+ /7pdAP+6XQD/ul0A/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svL
+ egAzof8ANKP/ADSk/wA0pP8ANKT/ADSk/wA0pP8ANKT/ADSk/wA0pP8ANKT/ADSk/wAzof8AMqBAAAAA
+ AGYzM/+4XwP/vmIA/75iAP++YgD/vmIA/75iAP++YgD/vmIA/75iAP++YgD/vmIA/75iAP++YgD/vmIA
+ /75iAP++YgD/vmIA/75iAP++YgD/vmIA/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAD+y8tb/svLegAzof8ANqf/ADao/wA2qP8ANqj/ADao/wA2qP8ANqj/ADao/wA2qP8ANqj/ADao
+ /wAzof8AMqBAAAAAAGYzM/+8ZAP/wmgA/8JoAP/CaAD/wmgA/8JoAP/CaAD/wmgA/8JoAP/CaAD/wmgA
+ /8JoAP/CaAD/wmgA/8JoAP/CaAD/wmgA/8JoAP/CaAD/wmgA/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLegAzof8AN6v/ADer/wA3q/8AN6v/ADer/wA3q/8AN6v/ADer
+ /wA3q/8AN6v/ADer/wAzof8AMqBAAAAAAGYzM//AaQP/xm0A/8ZtAP/GbQD/xm0A/8ZtAP/GbQD/xm0A
+ /8ZtAP/GbQD/xm0A/8ZtAP/GbQD/xm0A/8ZtAP/GbQD/xm0A/8ZtAP/GbQD/xm0A/2YzM/9lMjJAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLegAzof8AOa7/ADmv/wA5r/8AOa//ADmv
+ /wA5r/8AOa//ADmv/wA5r/8AOa//ADmv/wAzof8AMqBAAAAAAGYzM//DbgP/ynIA/8pyAP/KcgD/ynIA
+ /8pyAP/KcgD/ynIA/8pyAP/KcgD/ynIA/8pyAP/KcgD/ynIA/8pyAP/KcgD/ynIA/8pyAP/KcgD/ynIA
+ /2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLegAzof8AOrH/ADuz
+ /wA7s/8AO7P/ADuz/wA7s/8AO7P/ADuz/wA7s/8AO7P/ADuz/wAzof8AMqBAAAAAAGYzM//HcwP/zncA
+ /853AP/OdwD/zncA/853AP/OdwD/zncA/853AP/OdwD/zncA/853AP/OdwD/zncA/853AP/OdwD/zncA
+ /853AP/OdwD/zncA/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svL
+ egAzof8APLX/ADy2/wA8tv8APLb/ADy2/wA8tv8APLb/ADy2/wA8tv8APLb/ADy2/wAzof8AMqBAAAAA
+ AGYzM//LdwP/0nwA/9J8AP/SfAD/0nwA/9J8AP/SfAD/0nwA/9J8AP/SfAD/0nwA/9J8AP/SfAD/0nwA
+ /9J8AP/SfAD/0nwA/9J8AP/SfAD/0nwA/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAD+y8tb/svLegAzof8APbj/AD66/wA+uv8APrr/AD66/wA+uv8APrr/AD66/wA+uv8APrr/AD66
+ /wAzof8AMqBAAAAAAGYzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz
+ /2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9lMjJAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLegAzof8AP7z/AEC+/wBAvv8AQL7/AEC+/wBAvv8AQL7/AEC+
+ /wBAvv8AQL7/AEC+/wAzof8AMqBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tb/svLegAzof8AQb//AEHB/wBBwf8AQcH/AEHB
+ /wBBwf8AQcH/AEHB/wBBwf8AQcH/AEHB/wAzof8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/+InsiS/svLegAzof8AQsP/AEPF
+ /wBDxf8AQ8X/AEPF/wBDxf8AQ8X/AEPF/wBDxf8AQ8X/AEPF/wAzof8AW6//SLjk/0i45P9IuOT/SLjk
+ /0i45P9IuOT/SLjk/0i45P9IuOT/SLjk/0i45P9IuOT/SLjk/0i45P9IuOT/SLjk/0i45P9IuOT/SLjk
+ /0i45P9IuOT/SLjk/0i45P9IuOT/SLjk/0i45P9IuOT/SLjk/0i45P9IuOT/SLjk/wBbr/9+mMWk/svL
+ egAzof8ARMb/AEXJ/wBFyf8ARcn/AEXJ/wBFyf8ARcn/AEXJ/wBFyf8ARcn/AEXJ/wAzof8AW6//SLrl
+ /0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl
+ /0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl
+ /wBbr/9+mMWk/svLegAzof8ARcr/AEfM/wBHzP8AR8z/AEfM/wBHzP8AR8z/AEfM/wBHzP8AR8z/AEfM
+ /wAzof8AW6//SLzm/0i85v9IvOb/SLzm/0i85v9IvOb/SLzm/0i85v9IvOb/SLzm/0i85v9IvOb/SLzm
+ /0i85v9IvOb/SLzm/0i85v9IvOb/SLzm/0i85v9IvOb/SLzm/0i85v9IvOb/SLzm/0i85v9IvOb/SLzm
+ /0i85v9IvOb/SLzm/wBbr/9+mMWk/svLegAzof8AR83/AEjQ/wBI0P8ASND/AEjQ/wBI0P8ASND/AEjQ
+ /wBI0P8ASND/AEjQ/wAzof8AW6//SL/n/0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n
+ /0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n
+ /0i/5/9Iv+f/SL/n/0i/5/9Iv+f/SL/n/wBbr/9+mMWk/svLegAzof8ASNH/AErU/wBK1P8AStT/AErU
+ /wBK1P8AStT/AErU/wBK1P8AStT/AErU/wAzof8AW6//R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho
+ /0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho
+ /0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/wBbr/9+mMWk/8zMegAzof8AStT/AEzY
+ /wBM2P8ATNj/AEzY/wBM2P8ATNj/AEzY/wBM2P8ATNj/AEzY/wAzof8AW6//R8Pp/0fD6f9Hw+n/R8Pp
+ /0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp
+ /0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp/0fD6f9Hw+n/R8Pp/wBbr/9+mMWk/8zM
+ egAzof8ATNj/AE3b/wBN2/8ATdv/AE3b/wBN2/8ATdv/AE3b/wBN2/8ATdv/AE3b/wAzof8AW6//R8Xq
+ /0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq
+ /0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq/0fF6v9Hxer/R8Xq
+ /wBbr/9+mMWk/8zMegAzof8ARsz/AEjP/wBIz/8ASM//AEjP/wBIz/8ASM//AEjP/wBIz/8ASM//AEjP
+ /wAzof8AW6//R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr
+ /0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr
+ /0fI6/9HyOv/R8jr/wBbr/9+mMWk/8zMegAzof8AM6H/ADOh/wAzof8AM6H/ADOh/wAzof8AM6H/ADOh
+ /wAzof8AM6H/ADOh/wAzof8AW6//R8rs/0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs
+ /0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs
+ /0fK7P9Hyuz/R8rs/0fK7P9Hyuz/R8rs/wBbr/9+mMWk/8zMev/MzAgAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//R8zt/0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt
+ /0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt
+ /0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt/0fM7f9HzO3/R8zt/wBbr/9+mMWk/8zMev/MzAgAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//Rs7u/0bO7v9Gzu7/Rs7u
+ /0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u
+ /0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u/0bO7v9Gzu7/Rs7u/wBbr/9+mMWk/8zM
+ ev/MzAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//RtHv
+ /0bR7/9G0e//RtHv/0bR7/9G0e//RtHv/0bR7/9G0e//RtHv/0bR7/9G0e//RtHv/0bR7/9G0e//RtHv
+ /0bR7/9G0e//RtHv/0bR7/9G0e//RtHv/0bR7/9G0e//RtHv/0bR7/9G0e//RtHv/0bR7/9G0e//RtHv
+ /wBbr/9+mMWk/8zMev/MzAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAW6//RtPw/0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw
+ /0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw/0bT8P9G0/D/RtPw
+ /0bT8P9G0/D/RtPw/wBbr/9+mMWk/8zMev/MzAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAW6//RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy
+ /0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy
+ /0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/wBbr/9+mMWk/8zMev/MzAgAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//Rtfz/0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz
+ /0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz
+ /0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz/0bX8/9G1/P/Rtfz/wBbr/9+mMWk/8zMev/MzAgAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//Rtr0/0ba9P9G2vT/Rtr0
+ /0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0
+ /0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0/0ba9P9G2vT/Rtr0/wBbr/9+mMWk/svL
+ ev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//Rdz1
+ /0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1
+ /0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1
+ /wBbr/9+mMWk/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAW6//Rd72/0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72
+ /0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72/0Xe9v9F3vb/Rd72
+ /0Xe9v9F3vb/Rd72/wBbr/9+mMWk/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAW6//ReD3/0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3
+ /0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3
+ /0Xg9/9F4Pf/ReD3/0Xg9/9F4Pf/ReD3/wBbr/9+mMWk/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4
+ /0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4
+ /0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/wBbr/9+mMWk/svLev7LywgAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//ReX5/0Xl+f9F5fn/ReX5
+ /0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5
+ /0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5/0Xl+f9F5fn/ReX5/wBbr/9+mMWk/svL
+ ev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//Ref6
+ /0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6
+ /0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6/0Xn+v9F5/r/Ref6
+ /wBbr/9+mMWk/svLev7LywgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAW6//ROn7/0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7
+ /0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7/0Tp+/9E6fv/ROn7
+ /0Tp+/9E6fv/ROn7/wBbr/9+mMWk/8zMev/MzAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAW6//ROz8/0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8
+ /0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8
+ /0Ts/P9E7Pz/ROz8/0Ts/P9E7Pz/ROz8/wBbr/9+mMWk/svLev/LywgAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//RO79/0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79
+ /0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79
+ /0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79/0Tu/f9E7v3/RO79/wBbr/9+mMWk/svLev7LywgAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//RPD+/0Tw/v9E8P7/RPD+
+ /0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+
+ /0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+/0Tw/v9E8P7/RPD+/wBbr/+BmMSi/svL
+ ev7Lyw7+y8sI/8zMCP/MzAj+y8sI/svLCP7Lywj+y8sI/svLCP7Lywj+y8sI/8zMCP/MzAgAW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv
+ /wBbr//NtcaA/svLfP/Ly3r+y8t6/8zMev/MzHr+y8t6/svLev7Ly3r+y8t6/svLev7Ly3r+y8t6/8zM
+ ev/MzHr/zMx6/8zMev/MzHr/zMx6/8zMev/MzHr/zMx6/8zMev/MzHr+y8t6/svLev7Ly3r+y8t6/svL
+ ev7Ly3r+y8t6/svLev7Ly3r+y8t6/svLev7Ly3r+y8t6/svLev7Ly3r+y8t6/svLev7Ly3r+y8t6/svL
+ ev7Ly3r+y8t6/svLev7Ly3r+y8uLAAAAAAAADu4//wAAAf4O7j//AAAB/g7uP/8AAAH+Du4//wAAAf4O
+ 7j//AAAB/g7uP/8AAAH+Du4//wAAAf4O7j//AAAB/g7uP/8AAAH+Du4AAQAAAf4O7gABAAAB/g7uAAEA
+ AAH+Du4AAQAAAf4O7gABAAAB/g7uAAEAAAH+Du4AAQAAAf4O7gABAAAB/g7uAAH////+Du4AAAAAAAAO
+ 7gAAAAAAAA7uAAAAAAAADu4AAAAAAAAO7gAAAAAAAA7uAAAAAAAADu4AAAAAAAAO7gAAAAAAAA7uAAAA
+ AAAADu4AAAAAAAAO7j/8AAAAAA7uP/wAAAAADu4//AAAAAAO7j/8AAAAAA7uP/wAAAAADu4//AAAAAAO
+ 7j/8AAAAAA7uP/wAAAAADu4//AAAAAAO7j/8AAAAAA7uP/wAAAAADu4//AAAAAAO7j/8AAAAAA7uP/wA
+ AAAADu4//AAAAAAO7j/8AAAAAA7uP/wAAAAADu4AAAAAAAAO7gAAAAAAAA7uKAAAACAAAABAAAAAAQAg
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7Ly2/+y8s//svLPf7Lyz3+y8s9/svLPf7Lyz3+y8s9/svL
+ Pf7Lyz3hrq5Ay5iYR8uYmEfLmJhHy5iYR8uYmEfLmJhHy5iYR8uYmEfLmJhHy5iYR8uYmEfLmJhHy5iY
+ R8uYmEfLmJhC/svLPf7Lyz3+y8s9/svLPf7Lyz3+y8tq/svLVP7LywMAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAGUyMjxmMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz
+ /2YzM/9mMzP/ZjMz/2UyMloAAAAAAAAAAAAAAAAAAAAAAAAAAP7Lyz3+y8tU/svLAwAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAZjMzVWYzM/+fOwD/nzsA/587AP+fOwD/nzsA/587AP+fOwD/nzsA
+ /587AP+fOwD/nzsA/587AP9mMzP/ZTIygAAAAAAAAAAAAAAAAAAAAAAAAAAA/svLPf7Ly1T+y8sDAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmMzNVZjMz/6RBAP+kQQD/pEEA/6RBAP+kQQD/pEEA
+ /6RBAP+kQQD/pEEA/6RBAP+kQQD/pEEA/2YzM/9lMjKAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8s9/svL
+ VP7LywMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYzM1VmMzP/q0oA/6tKAP+rSgD/q0oA
+ /6tKAP+rSgD/q0oA/6tKAP+rSgD/q0oA/6tKAP+rSgD/ZjMz/2UyMoAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AP7Lyz3+y8tU/svLAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZjMzVWYzM/+wUQD/sFEA
+ /7BRAP+wUQD/sFEA/7BRAP+wUQD/sFEA/7BRAP+wUQD/sFEA/7BRAP9mMzP/ZTIygAAAAAAAAAAAAAAA
+ AAAAAAAAAAAA/svLPeG6xm9da7BXADOhVQAzoVUAM6FVADOhVQAzoVUAM6FVADOhVQAyoCZmMzNVZjMz
+ /7daAP+3WgD/t1oA/7daAP+3WgD/t1oA/7daAP+3WgD/t1oA/7daAP+3WgD/t1oA/2YzM/9lMjKAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAD+y8s9qZi9pgAzof8AM6H/ADOh/wAzof8AM6H/ADOh/wAzof8AM6H/ADKg
+ e2YzM1VmMzP/vGAA/7xgAP+8YAD/vGAA/7xgAP+8YAD/vGAA/7xgAP+8YAD/vGAA/7xgAP+8YAD/ZjMz
+ /2UyMoAAAAAAAAAAAAAAAAAAAAAAAAAAAP7Lyz2pmL2mADOh/wA2qf8ANqn/ADap/wA2qf8ANqn/ADap
+ /wAzof8AMqCAZjMzVWYzM//DaQD/w2kA/8NpAP/DaQD/w2kA/8NpAP/DaQD/w2kA/8NpAP/DaQD/w2kA
+ /8NpAP9mMzP/ZTIygAAAAAAAAAAAAAAAAAAAAAAAAAAA/svLPamYvaYAM6H/ADit/wA4rf8AOK3/ADit
+ /wA4rf8AOK3/ADOh/wAyoIBmMzNVZjMz/8hwAP/IcAD/yHAA/8hwAP/IcAD/yHAA/8hwAP/IcAD/yHAA
+ /8hwAP/IcAD/yHAA/2YzM/9lMjKAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8s9qZi9pgAzof8AO7T/ADu0
+ /wA7tP8AO7T/ADu0/wA7tP8AM6H/ADKggGYzM1VmMzP/z3gA/894AP/PeAD/z3gA/894AP/PeAD/z3gA
+ /894AP/PeAD/z3gA/894AP/PeAD/ZjMz/2UyMoAAAAAAAAAAAAAAAAAAAAAAAAAAAP7Lyz2pmL2mADOh
+ /wA9uP8APbj/AD24/wA9uP8APbj/AD24/wAzof8AMqCAZjMzVWYzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz
+ /2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZTIygAAAAAAAAAAAAAAAAAAAAAAAAAAA/svL
+ PamYvaYAM6H/AEC//wBAv/8AQL//AEC//wBAv/8AQL//ADOh/wA7o6oAW69VAFuvVQBbr1UAW69VAFuv
+ VQBbr1UAW69VAFuvVQBbr1UAW69VAFuvVQBbr1UAW69VAFuvVQBbr1UAW69VAFuvVQBbr1UAW69VAFuv
+ VQBbr1WsqMRlqZi9pgAzof8AQsP/AELD/wBCw/8AQsP/AELD/wBCw/8AM6H/AFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/1aFvr6pmL2mADOh/wBFyv8ARcr/AEXK/wBFyv8ARcr/AEXK/wAzof8AW6//SLrl
+ /0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl/0i65f9IuuX/SLrl
+ /0i65f9IuuX/SLrl/0i65f8AW6//VIO9wqmYvaYAM6H/AEfO/wBHzv8AR87/AEfO/wBHzv8AR87/ADOh
+ /wBbr/9Ivub/SL7m/0i+5v9Ivub/SL7m/0i+5v9Ivub/SL7m/0i+5v9Ivub/SL7m/0i+5v9Ivub/SL7m
+ /0i+5v9Ivub/SL7m/0i+5v9Ivub/SL7m/wBbr/9Ug73CqZi9pgAzof8AStX/AErV/wBK1f8AStX/AErV
+ /wBK1f8AM6H/AFuv/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho
+ /0fB6P9Hwej/R8Ho/0fB6P9Hwej/R8Ho/0fB6P9Hwej/AFuv/1SDvcKqmb2mADOh/wBM2v8ATNr/AEza
+ /wBM2v8ATNr/AEza/wAzof8AW6//R8Tp/0fE6f9HxOn/R8Tp/0fE6f9HxOn/R8Tp/0fE6f9HxOn/R8Tp
+ /0fE6f9HxOn/R8Tp/0fE6f9HxOn/R8Tp/0fE6f9HxOn/R8Tp/0fE6f8AW6//VIO9wqqZvaYAM6H/ADOh
+ /wAzof8AM6H/ADOh/wAzof8AM6H/ADOh/wBbr/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr
+ /0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/0fI6/9HyOv/R8jr/wBbr/9Ug73C4rvH
+ b15rsFcAM6FVADOhVQAzoVUAM6FVADOhVQAzoVUAM6FVAFuv/0fL7P9Hy+z/R8vs/0fL7P9Hy+z/R8vs
+ /0fL7P9Hy+z/R8vs/0fL7P9Hy+z/R8vs/0fL7P9Hy+z/R8vs/0fL7P9Hy+z/R8vs/0fL7P9Hy+z/AFuv
+ /1SDvcL/zMxU/8zMAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//Rs/u/0bP7v9Gz+7/Rs/u
+ /0bP7v9Gz+7/Rs/u/0bP7v9Gz+7/Rs/u/0bP7v9Gz+7/Rs/u/0bP7v9Gz+7/Rs/u/0bP7v9Gz+7/Rs/u
+ /0bP7v8AW6//VIO9wv/MzFT/zMwDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr/9G0u//RtLv
+ /0bS7/9G0u//RtLv/0bS7/9G0u//RtLv/0bS7/9G0u//RtLv/0bS7/9G0u//RtLv/0bS7/9G0u//RtLv
+ /0bS7/9G0u//RtLv/wBbr/9Ug73C/8zMVP/MzAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFuv
+ /0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy/0bV8v9G1fL/RtXy
+ /0bV8v9G1fL/RtXy/0bV8v9G1fL/AFuv/1SDvcL/zMxU/8zMAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAW6//Rtnz/0bZ8/9G2fP/Rtnz/0bZ8/9G2fP/Rtnz/0bZ8/9G2fP/Rtnz/0bZ8/9G2fP/Rtnz
+ /0bZ8/9G2fP/Rtnz/0bZ8/9G2fP/Rtnz/0bZ8/8AW6//VIO9wv7Ly1T+y8sDAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAABbr/9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1
+ /0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/0Xc9f9F3PX/Rdz1/wBbr/9Ug73C/svLVP7LywMAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAFuv/0Xf9v9F3/b/Rd/2/0Xf9v9F3/b/Rd/2/0Xf9v9F3/b/Rd/2
+ /0Xf9v9F3/b/Rd/2/0Xf9v9F3/b/Rd/2/0Xf9v9F3/b/Rd/2/0Xf9v9F3/b/AFuv/1SDvcL+y8tU/svL
+ AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4
+ /0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P9F4/j/ReP4/0Xj+P8AW6//VIO9
+ wv7Ly1T+y8sDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbr/9F5vn/Reb5/0Xm+f9F5vn/Reb5
+ /0Xm+f9F5vn/Reb5/0Xm+f9F5vn/Reb5/0Xm+f9F5vn/Reb5/0Xm+f9F5vn/Reb5/0Xm+f9F5vn/Reb5
+ /wBbr/9Ug73C/svLVP7LywMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFuv/0Tq+/9E6vv/ROr7
+ /0Tq+/9E6vv/ROr7/0Tq+/9E6vv/ROr7/0Tq+/9E6vv/ROr7/0Tq+/9E6vv/ROr7/0Tq+/9E6vv/ROr7
+ /0Tq+/9E6vv/AFuv/1SDvcL+y8tU/8vLAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW6//RO38
+ /0Tt/P9E7fz/RO38/0Tt/P9E7fz/RO38/0Tt/P9E7fz/RO38/0Tt/P9E7fz/RO38/0Tt/P9E7fz/RO38
+ /0Tt/P9E7fz/RO38/0Tt/P8AW6//VIO9wv7Ly1X+y8sF/8zMA/7LywP+y8sD/svLA/7LywP+y8sD/8zM
+ AwBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/9mir25/svLb/7Ly1X/zMxU/svLVP7Ly1T+y8tU/svL
+ VP7Ly1T/zMxUxrLFi6qmwqaqpsKmqqbCpqqmwqaqpsKmqaXBpqmlwaappcGmqaXBpqmlwaappcGmqaXB
+ pqmlwaappcGmqaXBpqmlwaappcGmqaXBpqmlwaappcGmqaXBpta5xpIAAAAAP8AAPj/AAD4/wAA+P8AA
+ Pj/AAD4AAAA+AAAAPgAAAD4AAAA+AAAAPgAAAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AD+AAAA/gAAAP4AAAD+AAAA/gAAAP4AAAD+AAAA/gAAAP4AAAD+AAAAAAAAAAAAAACgAAAAQAAAAIAAA
+ AAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+y8tB/svLHv7Lyx7+y8se/svLHp1qanCYZWWjmGVl
+ o5hlZaOYZWWjmGVlo5hlZaOYZWV4/svLHv7Lyx7+y8s5/svLLAAAAAAAAAAAAAAAAAAAAABmMzP/ZjMz
+ /2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/wAAAAAAAAAA/svLHv7LyywAAAAAAAAAAAAAAAAAAAAAZjMz
+ /61NAP+tTQD/rU0A/61NAP+tTQD/rU0A/2YzM/8AAAAAAAAAAP7Lyx4AM6H/ADOh/wAzof8AM6H/ADOh
+ /2YzM/+5XQD/uV0A/7ldAP+5XQD/uV0A/7ldAP9mMzP/AAAAAAAAAAD+y8seADOh/wA3q/8AN6v/ADer
+ /wAzof9mMzP/xWwA/8VsAP/FbAD/xWwA/8VsAP/FbAD/ZjMz/wAAAAAAAAAA/svLHgAzof8APLb/ADy2
+ /wA8tv8AM6H/ZjMz/2YzM/9mMzP/ZjMz/2YzM/9mMzP/ZjMz/2YzM/8AAAAAAAAAAP7Lyx4AM6H/AEHB
+ /wBBwf8AQcH/ADOh/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//ADOh
+ /wBGzP8ARsz/AEbM/wAzof9IvOX/SLzl/0i85f9IvOX/SLzl/0i85f9IvOX/SLzl/0i85f9IvOX/AFuv
+ /wAzof8AS9f/AEvX/wBL1/8AM6H/R8Lo/0fC6P9Hwuj/R8Lo/0fC6P9Hwuj/R8Lo/0fC6P9Hwuj/R8Lo
+ /wBbr/8AM6H/ADOh/wAzof8AM6H/ADOh/0fJ6/9Hyev/R8nr/0fJ6/9Hyev/R8nr/0fJ6/9Hyev/R8nr
+ /0fJ6/8AW6///8zMLAAAAAAAAAAAAAAAAABbr/9G0O7/RtDu/0bQ7v9G0O7/RtDu/0bQ7v9G0O7/RtDu
+ /0bQ7v9G0O7/AFuv///MzCwAAAAAAAAAAAAAAAAAW6//Rtfy/0bX8v9G1/L/Rtfy/0bX8v9G1/L/Rtfy
+ /0bX8v9G1/L/Rtfy/wBbr//+y8ssAAAAAAAAAAAAAAAAAFuv/0Xd9f9F3fX/Rd31/0Xd9f9F3fX/Rd31
+ /0Xd9f9F3fX/Rd31/0Xd9f8AW6///svLLAAAAAAAAAAAAAAAAABbr/9F5Pj/ReT4/0Xk+P9F5Pj/ReT4
+ /0Xk+P9F5Pj/ReT4/0Xk+P9F5Pj/AFuv//7LyywAAAAAAAAAAAAAAAAAW6//ROv7/0Tr+/9E6/v/ROv7
+ /0Tr+/9E6/v/ROv7/0Tr+/9E6/v/ROv7/wBbr//+y8tI/svLLP7Lyyz+y8ssAFuv/wBbr/8AW6//AFuv
+ /wBbr/8AW6//AFuv/wBbr/8AW6//AFuv/wBbr/8AW6//AACsQXgGrEF4BqxBAAasQQAGrEEABqxBAACs
+ QQAArEEAAKxBAACsQXAArEFwAKxBcACsQXAArEFwAKxBAACsQQ==
+
+
+
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/SearchWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/SearchWindow.Designer.cs
index 2d5cdcbab..8097dde5d 100644
--- a/1.x/trunk/ProcessHacker/Forms/SearchWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/SearchWindow.Designer.cs
@@ -64,9 +64,9 @@
//
// tabControl
//
- this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tabLiteral);
this.tabControl.Controls.Add(this.tabRegex);
this.tabControl.Controls.Add(this.tabString);
@@ -98,7 +98,7 @@
this.checkNoOverlap.AutoSize = true;
this.checkNoOverlap.Location = new System.Drawing.Point(6, 262);
this.checkNoOverlap.Name = "checkNoOverlap";
- this.checkNoOverlap.Size = new System.Drawing.Size(166, 17);
+ this.checkNoOverlap.Size = new System.Drawing.Size(154, 17);
this.checkNoOverlap.TabIndex = 1;
this.checkNoOverlap.Text = "Prevent overlapping results";
this.checkNoOverlap.UseVisualStyleBackColor = true;
@@ -114,9 +114,9 @@
//
// hexBoxSearch
//
- this.hexBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.hexBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.hexBoxSearch.BytesPerLine = 8;
this.hexBoxSearch.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hexBoxSearch.HexCasing = Be.Windows.Forms.HexCasing.Lower;
@@ -149,16 +149,16 @@
this.checkIgnoreCase.AutoSize = true;
this.checkIgnoreCase.Location = new System.Drawing.Point(6, 262);
this.checkIgnoreCase.Name = "checkIgnoreCase";
- this.checkIgnoreCase.Size = new System.Drawing.Size(87, 17);
+ this.checkIgnoreCase.Size = new System.Drawing.Size(83, 17);
this.checkIgnoreCase.TabIndex = 1;
this.checkIgnoreCase.Text = "Ignore Case";
this.checkIgnoreCase.UseVisualStyleBackColor = true;
//
// textRegex
//
- this.textRegex.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textRegex.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textRegex.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textRegex.Location = new System.Drawing.Point(6, 6);
this.textRegex.Multiline = true;
@@ -184,7 +184,7 @@
this.checkUnicode.AutoSize = true;
this.checkUnicode.Location = new System.Drawing.Point(8, 34);
this.checkUnicode.Name = "checkUnicode";
- this.checkUnicode.Size = new System.Drawing.Size(133, 17);
+ this.checkUnicode.Size = new System.Drawing.Size(122, 17);
this.checkUnicode.TabIndex = 1;
this.checkUnicode.Text = "Find Unicode strings";
this.checkUnicode.UseVisualStyleBackColor = true;
@@ -193,7 +193,7 @@
//
this.textStringMS.Location = new System.Drawing.Point(88, 8);
this.textStringMS.Name = "textStringMS";
- this.textStringMS.Size = new System.Drawing.Size(100, 22);
+ this.textStringMS.Size = new System.Drawing.Size(100, 20);
this.textStringMS.TabIndex = 0;
//
// label2
@@ -201,7 +201,7 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 11);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(81, 13);
+ this.label2.Size = new System.Drawing.Size(74, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Minimum Size:";
//
@@ -221,7 +221,7 @@
//
this.textHeapMS.Location = new System.Drawing.Point(88, 8);
this.textHeapMS.Name = "textHeapMS";
- this.textHeapMS.Size = new System.Drawing.Size(100, 22);
+ this.textHeapMS.Size = new System.Drawing.Size(100, 20);
this.textHeapMS.TabIndex = 0;
//
// label4
@@ -229,7 +229,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(8, 11);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(81, 13);
+ this.label4.Size = new System.Drawing.Size(74, 13);
this.label4.TabIndex = 1;
this.label4.Text = "Minimum Size:";
//
@@ -251,7 +251,7 @@
//
this.textStructAlign.Location = new System.Drawing.Point(68, 259);
this.textStructAlign.Name = "textStructAlign";
- this.textStructAlign.Size = new System.Drawing.Size(100, 22);
+ this.textStructAlign.Size = new System.Drawing.Size(100, 20);
this.textStructAlign.TabIndex = 1;
//
// label5
@@ -259,7 +259,7 @@
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 262);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(63, 13);
+ this.label5.Size = new System.Drawing.Size(56, 13);
this.label5.TabIndex = 3;
this.label5.Text = "Alignment:";
//
@@ -268,15 +268,15 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 6);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(40, 13);
+ this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Struct:";
//
// listStructName
//
- this.listStructName.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listStructName.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listStructName.FormattingEnabled = true;
this.listStructName.IntegralHeight = false;
this.listStructName.Location = new System.Drawing.Point(50, 6);
@@ -293,7 +293,7 @@
this.checkPrivate.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkPrivate.Location = new System.Drawing.Point(73, 328);
this.checkPrivate.Name = "checkPrivate";
- this.checkPrivate.Size = new System.Drawing.Size(66, 18);
+ this.checkPrivate.Size = new System.Drawing.Size(65, 18);
this.checkPrivate.TabIndex = 2;
this.checkPrivate.Text = "Private";
this.checkPrivate.UseVisualStyleBackColor = true;
@@ -305,7 +305,7 @@
this.checkImage.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkImage.Location = new System.Drawing.Point(138, 328);
this.checkImage.Name = "checkImage";
- this.checkImage.Size = new System.Drawing.Size(63, 18);
+ this.checkImage.Size = new System.Drawing.Size(61, 18);
this.checkImage.TabIndex = 3;
this.checkImage.Text = "Image";
this.checkImage.UseVisualStyleBackColor = true;
@@ -317,7 +317,7 @@
this.checkMapped.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkMapped.Location = new System.Drawing.Point(199, 328);
this.checkMapped.Name = "checkMapped";
- this.checkMapped.Size = new System.Drawing.Size(75, 18);
+ this.checkMapped.Size = new System.Drawing.Size(71, 18);
this.checkMapped.TabIndex = 4;
this.checkMapped.Text = "Mapped";
this.checkMapped.UseVisualStyleBackColor = true;
@@ -328,7 +328,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 330);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(57, 13);
+ this.label1.Size = new System.Drawing.Size(55, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Search in:";
//
@@ -360,7 +360,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(517, 377);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
diff --git a/1.x/trunk/ProcessHacker/Forms/SearchWindow.cs b/1.x/trunk/ProcessHacker/Forms/SearchWindow.cs
index 9d11dde74..d742edfba 100644
--- a/1.x/trunk/ProcessHacker/Forms/SearchWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/SearchWindow.cs
@@ -22,6 +22,9 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Text;
using System.Windows.Forms;
namespace ProcessHacker
@@ -29,13 +32,12 @@ namespace ProcessHacker
public partial class SearchWindow : Form
{
private SearchOptions _so;
- private readonly List _oldresults;
- private readonly int _pid;
+ private List _oldresults;
+ private int _pid;
public SearchWindow(int PID, SearchOptions so)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
diff --git a/1.x/trunk/ProcessHacker/Forms/SearchWindow.resx b/1.x/trunk/ProcessHacker/Forms/SearchWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/SearchWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/SearchWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/ServiceWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ServiceWindow.Designer.cs
index 170ccdc0f..0c7ec4cdb 100644
--- a/1.x/trunk/ProcessHacker/Forms/ServiceWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ServiceWindow.Designer.cs
@@ -1,6 +1,6 @@
namespace ProcessHacker
{
- sealed partial class ServiceWindow
+ partial class ServiceWindow
{
///
/// Required designer variable.
@@ -38,8 +38,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(412, 398);
+ this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
diff --git a/1.x/trunk/ProcessHacker/Forms/ServiceWindow.cs b/1.x/trunk/ProcessHacker/Forms/ServiceWindow.cs
index d1fb70698..e08460fdf 100644
--- a/1.x/trunk/ProcessHacker/Forms/ServiceWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ServiceWindow.cs
@@ -26,9 +26,9 @@ using ProcessHacker.Components;
namespace ProcessHacker
{
- public sealed partial class ServiceWindow : Form
+ public partial class ServiceWindow : Form
{
- private readonly ServiceProperties _serviceProps;
+ private ServiceProperties _serviceProps;
public ServiceWindow(string service)
: this(new string[] { service })
@@ -40,11 +40,9 @@ namespace ProcessHacker
this.AddEscapeToClose();
this.SetTopMost();
- _serviceProps = new ServiceProperties(services)
- {
- Dock = DockStyle.Fill
- };
- _serviceProps.NeedsClose += this._serviceProps_NeedsClose;
+ _serviceProps = new ServiceProperties(services);
+ _serviceProps.Dock = DockStyle.Fill;
+ _serviceProps.NeedsClose += new EventHandler(_serviceProps_NeedsClose);
this.Controls.Add(_serviceProps);
this.Text = _serviceProps.Text;
this.AcceptButton = _serviceProps.ApplyButton;
diff --git a/1.x/trunk/ProcessHacker/Forms/ServiceWindow.resx b/1.x/trunk/ProcessHacker/Forms/ServiceWindow.resx
index 8d60e5edb..8b9ee9a60 100644
--- a/1.x/trunk/ProcessHacker/Forms/ServiceWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ServiceWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.Designer.cs
index b845a259c..bede8aeb2 100644
--- a/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.Designer.cs
@@ -51,7 +51,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 4);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(64, 13);
+ this.label1.Size = new System.Drawing.Size(61, 13);
this.label1.TabIndex = 0;
this.label1.Text = "User name:";
//
@@ -59,9 +59,9 @@
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(3, 25);
+ this.label2.Location = new System.Drawing.Point(3, 26);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(63, 13);
+ this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.TabIndex = 0;
this.label2.Text = "Session ID:";
//
@@ -69,9 +69,9 @@
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(3, 46);
+ this.label3.Location = new System.Drawing.Point(3, 48);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(36, 13);
+ this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 0;
this.label3.Text = "State:";
//
@@ -79,9 +79,9 @@
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(3, 67);
+ this.label4.Location = new System.Drawing.Point(3, 70);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(71, 13);
+ this.label4.Size = new System.Drawing.Size(65, 13);
this.label4.TabIndex = 0;
this.label4.Text = "Client name:";
//
@@ -89,9 +89,9 @@
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(3, 88);
+ this.label5.Location = new System.Drawing.Point(3, 92);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(83, 13);
+ this.label5.Size = new System.Drawing.Size(76, 13);
this.label5.TabIndex = 0;
this.label5.Text = "Client address:";
//
@@ -99,9 +99,9 @@
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(3, 112);
+ this.label6.Location = new System.Drawing.Point(3, 114);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(135, 13);
+ this.label6.Size = new System.Drawing.Size(119, 13);
this.label6.TabIndex = 0;
this.label6.Text = "Client display resolution:";
//
@@ -109,7 +109,7 @@
//
this.labelUsername.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelUsername.AutoSize = true;
- this.labelUsername.Location = new System.Drawing.Point(144, 4);
+ this.labelUsername.Location = new System.Drawing.Point(128, 4);
this.labelUsername.Name = "labelUsername";
this.labelUsername.Size = new System.Drawing.Size(24, 13);
this.labelUsername.TabIndex = 1;
@@ -119,7 +119,7 @@
//
this.labelSessionId.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelSessionId.AutoSize = true;
- this.labelSessionId.Location = new System.Drawing.Point(144, 25);
+ this.labelSessionId.Location = new System.Drawing.Point(128, 26);
this.labelSessionId.Name = "labelSessionId";
this.labelSessionId.Size = new System.Drawing.Size(24, 13);
this.labelSessionId.TabIndex = 1;
@@ -127,9 +127,9 @@
//
// tableLayoutPanel1
//
- this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
@@ -161,7 +161,7 @@
//
this.labelState.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelState.AutoSize = true;
- this.labelState.Location = new System.Drawing.Point(144, 46);
+ this.labelState.Location = new System.Drawing.Point(128, 48);
this.labelState.Name = "labelState";
this.labelState.Size = new System.Drawing.Size(24, 13);
this.labelState.TabIndex = 1;
@@ -171,7 +171,7 @@
//
this.labelClientName.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelClientName.AutoSize = true;
- this.labelClientName.Location = new System.Drawing.Point(144, 67);
+ this.labelClientName.Location = new System.Drawing.Point(128, 70);
this.labelClientName.Name = "labelClientName";
this.labelClientName.Size = new System.Drawing.Size(24, 13);
this.labelClientName.TabIndex = 1;
@@ -181,7 +181,7 @@
//
this.labelClientAddress.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelClientAddress.AutoSize = true;
- this.labelClientAddress.Location = new System.Drawing.Point(144, 88);
+ this.labelClientAddress.Location = new System.Drawing.Point(128, 92);
this.labelClientAddress.Name = "labelClientAddress";
this.labelClientAddress.Size = new System.Drawing.Size(24, 13);
this.labelClientAddress.TabIndex = 1;
@@ -191,7 +191,7 @@
//
this.labelClientDisplayResolution.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelClientDisplayResolution.AutoSize = true;
- this.labelClientDisplayResolution.Location = new System.Drawing.Point(144, 112);
+ this.labelClientDisplayResolution.Location = new System.Drawing.Point(128, 114);
this.labelClientDisplayResolution.Name = "labelClientDisplayResolution";
this.labelClientDisplayResolution.Size = new System.Drawing.Size(24, 13);
this.labelClientDisplayResolution.TabIndex = 1;
@@ -214,7 +214,6 @@
this.AcceptButton = this.buttonClose;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(333, 187);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.tableLayoutPanel1);
diff --git a/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.resx b/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/SessionInformationWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/StructWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/StructWindow.Designer.cs
index 7e0b79284..574beb547 100644
--- a/1.x/trunk/ProcessHacker/Forms/StructWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/StructWindow.Designer.cs
@@ -47,9 +47,9 @@
//
// panel
//
- this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.panel.Location = new System.Drawing.Point(12, 12);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(548, 392);
diff --git a/1.x/trunk/ProcessHacker/Forms/StructWindow.cs b/1.x/trunk/ProcessHacker/Forms/StructWindow.cs
index 73f584562..5864a8fc3 100644
--- a/1.x/trunk/ProcessHacker/Forms/StructWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/StructWindow.cs
@@ -29,9 +29,9 @@ namespace ProcessHacker
{
public partial class StructWindow : Form
{
- private readonly int _pid;
- private readonly IntPtr _address;
- private readonly StructDef _struct;
+ private int _pid;
+ private IntPtr _address;
+ private StructDef _struct;
public StructWindow(int pid, IntPtr address, StructDef struc)
{
diff --git a/1.x/trunk/ProcessHacker/Forms/StructWindow.resx b/1.x/trunk/ProcessHacker/Forms/StructWindow.resx
index 9598de423..117a2c160 100644
--- a/1.x/trunk/ProcessHacker/Forms/StructWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/StructWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.Designer.cs
index 580c83058..aa45adb08 100644
--- a/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.Designer.cs
@@ -31,24 +31,30 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SysInfoWindow));
this.gboxCPUPlotter = new System.Windows.Forms.GroupBox();
this.tableCPUs = new System.Windows.Forms.TableLayoutPanel();
+ this.plotterCPU = new ProcessHacker.Components.Plotter();
this.tableGraphs = new System.Windows.Forms.TableLayoutPanel();
- this.groupBox15 = new System.Windows.Forms.GroupBox();
- this.groupBox14 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.plotterIO = new ProcessHacker.Components.Plotter();
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.plotterMemory = new ProcessHacker.Components.Plotter();
this.groupBox11 = new System.Windows.Forms.GroupBox();
+ this.indicatorPhysical = new ProcessHacker.Components.Indicator();
this.groupBox12 = new System.Windows.Forms.GroupBox();
+ this.indicatorIO = new ProcessHacker.Components.Indicator();
this.groupBox13 = new System.Windows.Forms.GroupBox();
+ this.indicatorCpu = new ProcessHacker.Components.Indicator();
this.checkShowOneGraphPerCPU = new System.Windows.Forms.CheckBox();
- this.groupBox16 = new System.Windows.Forms.GroupBox();
+ this.flowInfo = new System.Windows.Forms.FlowLayoutPanel();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.labelTotalsUptime = new System.Windows.Forms.Label();
- this.labelTotalsHandles = new System.Windows.Forms.Label();
- this.labelTotalsThreads = new System.Windows.Forms.Label();
- this.label42 = new System.Windows.Forms.Label();
- this.label40 = new System.Windows.Forms.Label();
- this.label46 = new System.Windows.Forms.Label();
- this.label39 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label9 = new System.Windows.Forms.Label();
this.labelTotalsProcesses = new System.Windows.Forms.Label();
+ this.labelTotalsThreads = new System.Windows.Forms.Label();
+ this.labelTotalsHandles = new System.Windows.Forms.Label();
+ this.label34 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
@@ -57,15 +63,6 @@
this.labelCCC = new System.Windows.Forms.Label();
this.labelCCP = new System.Windows.Forms.Label();
this.labelCCL = new System.Windows.Forms.Label();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.labelCachePeak = new System.Windows.Forms.Label();
- this.labelCacheCurrent = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.labelCacheMaximum = new System.Windows.Forms.Label();
- this.label10 = new System.Windows.Forms.Label();
- this.labelCacheMinimum = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.label15 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.label4 = new System.Windows.Forms.Label();
@@ -74,6 +71,16 @@
this.labelPMT = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.labelPSC = new System.Windows.Forms.Label();
+ this.groupBox6 = new System.Windows.Forms.GroupBox();
+ this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
+ this.label15 = new System.Windows.Forms.Label();
+ this.labelCacheMaximum = new System.Windows.Forms.Label();
+ this.label13 = new System.Windows.Forms.Label();
+ this.labelCacheMinimum = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label10 = new System.Windows.Forms.Label();
+ this.labelCacheCurrent = new System.Windows.Forms.Label();
+ this.labelCachePeak = new System.Windows.Forms.Label();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.label14 = new System.Windows.Forms.Label();
@@ -131,33 +138,22 @@
this.label41 = new System.Windows.Forms.Label();
this.labelCPUInterrupts = new System.Windows.Forms.Label();
this.checkAlwaysOnTop = new System.Windows.Forms.CheckBox();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.CloseButton = new System.Windows.Forms.Button();
- this.indicatorCommit = new ProcessHacker.Components.Indicator();
- this.trackerCommit = new ProcessHacker.Tracker();
- this.plotterCPU = new ProcessHacker.Components.Plotter();
- this.plotterIO = new ProcessHacker.Components.Plotter();
- this.trackerMemory = new ProcessHacker.Tracker();
- this.indicatorPhysical = new ProcessHacker.Components.Indicator();
- this.indicatorIO = new ProcessHacker.Components.Indicator();
- this.indicatorCpu = new ProcessHacker.Components.Indicator();
this.gboxCPUPlotter.SuspendLayout();
this.tableGraphs.SuspendLayout();
- this.groupBox15.SuspendLayout();
- this.groupBox14.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox11.SuspendLayout();
this.groupBox12.SuspendLayout();
this.groupBox13.SuspendLayout();
- this.groupBox16.SuspendLayout();
+ this.flowInfo.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.tableLayoutPanel1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
- this.groupBox6.SuspendLayout();
this.groupBox5.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
+ this.groupBox6.SuspendLayout();
+ this.tableLayoutPanel4.SuspendLayout();
this.groupBox7.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.groupBox8.SuspendLayout();
@@ -166,9 +162,6 @@
this.tableLayoutPanel7.SuspendLayout();
this.groupBox10.SuspendLayout();
this.tableLayoutPanel8.SuspendLayout();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// gboxCPUPlotter
@@ -178,7 +171,7 @@
this.gboxCPUPlotter.Dock = System.Windows.Forms.DockStyle.Fill;
this.gboxCPUPlotter.Location = new System.Drawing.Point(89, 3);
this.gboxCPUPlotter.Name = "gboxCPUPlotter";
- this.gboxCPUPlotter.Size = new System.Drawing.Size(604, 113);
+ this.gboxCPUPlotter.Size = new System.Drawing.Size(726, 62);
this.gboxCPUPlotter.TabIndex = 2;
this.gboxCPUPlotter.TabStop = false;
this.gboxCPUPlotter.Text = "CPU Usage (Kernel, User)";
@@ -195,116 +188,229 @@
this.tableCPUs.TabIndex = 3;
this.tableCPUs.Visible = false;
//
+ // plotterCPU
+ //
+ this.plotterCPU.BackColor = System.Drawing.Color.Black;
+ this.plotterCPU.Data1 = null;
+ this.plotterCPU.Data2 = null;
+ this.plotterCPU.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.plotterCPU.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(128)))), ((int)(((byte)(64)))));
+ this.plotterCPU.GridSize = new System.Drawing.Size(12, 12);
+ this.plotterCPU.LineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.plotterCPU.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.plotterCPU.Location = new System.Drawing.Point(3, 16);
+ this.plotterCPU.LongData1 = null;
+ this.plotterCPU.LongData2 = null;
+ this.plotterCPU.MinMaxValue = ((long)(0));
+ this.plotterCPU.MoveStep = -1;
+ this.plotterCPU.Name = "plotterCPU";
+ this.plotterCPU.OverlaySecondLine = false;
+ this.plotterCPU.ShowGrid = true;
+ this.plotterCPU.Size = new System.Drawing.Size(720, 43);
+ this.plotterCPU.TabIndex = 0;
+ this.plotterCPU.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.plotterCPU.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.plotterCPU.TextMargin = new System.Windows.Forms.Padding(3);
+ this.plotterCPU.TextPadding = new System.Windows.Forms.Padding(3);
+ this.plotterCPU.TextPosition = System.Drawing.ContentAlignment.TopLeft;
+ this.plotterCPU.UseLongData = false;
+ this.plotterCPU.UseSecondLine = true;
+ //
// tableGraphs
//
- this.tableGraphs.BackColor = System.Drawing.Color.White;
+ this.tableGraphs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.tableGraphs.ColumnCount = 2;
this.tableGraphs.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 86F));
this.tableGraphs.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableGraphs.Controls.Add(this.groupBox15, 0, 2);
- this.tableGraphs.Controls.Add(this.groupBox14, 1, 2);
this.tableGraphs.Controls.Add(this.gboxCPUPlotter, 1, 0);
- this.tableGraphs.Controls.Add(this.groupBox2, 1, 3);
- this.tableGraphs.Controls.Add(this.groupBox1, 1, 4);
- this.tableGraphs.Controls.Add(this.groupBox11, 0, 4);
- this.tableGraphs.Controls.Add(this.groupBox12, 0, 3);
+ this.tableGraphs.Controls.Add(this.groupBox2, 1, 2);
+ this.tableGraphs.Controls.Add(this.groupBox1, 1, 3);
+ this.tableGraphs.Controls.Add(this.groupBox11, 0, 3);
+ this.tableGraphs.Controls.Add(this.groupBox12, 0, 2);
this.tableGraphs.Controls.Add(this.groupBox13, 0, 0);
- this.tableGraphs.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableGraphs.Location = new System.Drawing.Point(3, 3);
+ this.tableGraphs.Controls.Add(this.checkShowOneGraphPerCPU, 1, 1);
+ this.tableGraphs.Location = new System.Drawing.Point(12, 12);
this.tableGraphs.Name = "tableGraphs";
- this.tableGraphs.RowCount = 5;
- this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.00062F));
+ this.tableGraphs.RowCount = 4;
+ this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.00062F));
- this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.00062F));
- this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 24.99813F));
- this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.tableGraphs.Size = new System.Drawing.Size(696, 478);
+ this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+ this.tableGraphs.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+ this.tableGraphs.Size = new System.Drawing.Size(818, 228);
this.tableGraphs.TabIndex = 3;
//
- // groupBox15
- //
- this.groupBox15.Controls.Add(this.indicatorCommit);
- this.groupBox15.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox15.Location = new System.Drawing.Point(3, 122);
- this.groupBox15.Name = "groupBox15";
- this.groupBox15.Size = new System.Drawing.Size(80, 113);
- this.groupBox15.TabIndex = 13;
- this.groupBox15.TabStop = false;
- this.groupBox15.Text = "Commit";
- //
- // groupBox14
- //
- this.groupBox14.Controls.Add(this.trackerCommit);
- this.groupBox14.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox14.Location = new System.Drawing.Point(89, 122);
- this.groupBox14.Name = "groupBox14";
- this.groupBox14.Size = new System.Drawing.Size(604, 113);
- this.groupBox14.TabIndex = 12;
- this.groupBox14.TabStop = false;
- this.groupBox14.Text = "Commit History";
- //
// groupBox2
//
this.groupBox2.Controls.Add(this.plotterIO);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox2.Location = new System.Drawing.Point(89, 241);
+ this.groupBox2.Location = new System.Drawing.Point(89, 95);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(604, 113);
+ this.groupBox2.Size = new System.Drawing.Size(726, 62);
this.groupBox2.TabIndex = 5;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "I/O (R+O, W)";
//
+ // plotterIO
+ //
+ this.plotterIO.BackColor = System.Drawing.Color.Black;
+ this.plotterIO.Data1 = null;
+ this.plotterIO.Data2 = null;
+ this.plotterIO.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.plotterIO.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(128)))), ((int)(((byte)(64)))));
+ this.plotterIO.GridSize = new System.Drawing.Size(12, 12);
+ this.plotterIO.LineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.plotterIO.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.plotterIO.Location = new System.Drawing.Point(3, 16);
+ this.plotterIO.LongData1 = null;
+ this.plotterIO.LongData2 = null;
+ this.plotterIO.MinMaxValue = ((long)(0));
+ this.plotterIO.MoveStep = -1;
+ this.plotterIO.Name = "plotterIO";
+ this.plotterIO.OverlaySecondLine = true;
+ this.plotterIO.ShowGrid = true;
+ this.plotterIO.Size = new System.Drawing.Size(720, 43);
+ this.plotterIO.TabIndex = 5;
+ this.plotterIO.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.plotterIO.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.plotterIO.TextMargin = new System.Windows.Forms.Padding(3);
+ this.plotterIO.TextPadding = new System.Windows.Forms.Padding(3);
+ this.plotterIO.TextPosition = System.Drawing.ContentAlignment.TopLeft;
+ this.plotterIO.UseLongData = true;
+ this.plotterIO.UseSecondLine = true;
+ //
// groupBox1
//
- this.groupBox1.Controls.Add(this.trackerMemory);
+ this.groupBox1.Controls.Add(this.plotterMemory);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(89, 360);
+ this.groupBox1.Location = new System.Drawing.Point(89, 163);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(604, 115);
+ this.groupBox1.Size = new System.Drawing.Size(726, 62);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Physical Memory";
+ this.groupBox1.Text = "Commit, Physical Memory";
+ //
+ // plotterMemory
+ //
+ this.plotterMemory.BackColor = System.Drawing.Color.Black;
+ this.plotterMemory.Data1 = null;
+ this.plotterMemory.Data2 = null;
+ this.plotterMemory.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.plotterMemory.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(128)))), ((int)(((byte)(64)))));
+ this.plotterMemory.GridSize = new System.Drawing.Size(12, 12);
+ this.plotterMemory.LineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.plotterMemory.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.plotterMemory.Location = new System.Drawing.Point(3, 16);
+ this.plotterMemory.LongData1 = null;
+ this.plotterMemory.LongData2 = null;
+ this.plotterMemory.MinMaxValue = ((long)(0));
+ this.plotterMemory.MoveStep = -1;
+ this.plotterMemory.Name = "plotterMemory";
+ this.plotterMemory.OverlaySecondLine = true;
+ this.plotterMemory.ShowGrid = true;
+ this.plotterMemory.Size = new System.Drawing.Size(720, 43);
+ this.plotterMemory.TabIndex = 5;
+ this.plotterMemory.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.plotterMemory.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.plotterMemory.TextMargin = new System.Windows.Forms.Padding(3);
+ this.plotterMemory.TextPadding = new System.Windows.Forms.Padding(3);
+ this.plotterMemory.TextPosition = System.Drawing.ContentAlignment.TopLeft;
+ this.plotterMemory.UseLongData = true;
+ this.plotterMemory.UseSecondLine = true;
//
// groupBox11
//
this.groupBox11.Controls.Add(this.indicatorPhysical);
this.groupBox11.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox11.Location = new System.Drawing.Point(3, 360);
+ this.groupBox11.Location = new System.Drawing.Point(3, 163);
this.groupBox11.Name = "groupBox11";
- this.groupBox11.Size = new System.Drawing.Size(80, 115);
+ this.groupBox11.Size = new System.Drawing.Size(80, 62);
this.groupBox11.TabIndex = 9;
this.groupBox11.TabStop = false;
this.groupBox11.Text = "Physical";
//
+ // indicatorPhysical
+ //
+ this.indicatorPhysical.BackColor = System.Drawing.Color.Black;
+ this.indicatorPhysical.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.indicatorPhysical.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.indicatorPhysical.Data1 = ((long)(0));
+ this.indicatorPhysical.Data2 = ((long)(0));
+ this.indicatorPhysical.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.indicatorPhysical.ForeColor = System.Drawing.Color.Lime;
+ this.indicatorPhysical.GraphWidth = 33;
+ this.indicatorPhysical.Location = new System.Drawing.Point(3, 16);
+ this.indicatorPhysical.Maximum = ((long)(2147483647));
+ this.indicatorPhysical.Minimum = ((long)(0));
+ this.indicatorPhysical.Name = "indicatorPhysical";
+ this.indicatorPhysical.Size = new System.Drawing.Size(74, 43);
+ this.indicatorPhysical.TabIndex = 8;
+ this.indicatorPhysical.TextValue = "";
+ //
// groupBox12
//
this.groupBox12.Controls.Add(this.indicatorIO);
this.groupBox12.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox12.Location = new System.Drawing.Point(3, 241);
+ this.groupBox12.Location = new System.Drawing.Point(3, 95);
this.groupBox12.Name = "groupBox12";
- this.groupBox12.Size = new System.Drawing.Size(80, 113);
+ this.groupBox12.Size = new System.Drawing.Size(80, 62);
this.groupBox12.TabIndex = 10;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "I/O (R+O)";
//
+ // indicatorIO
+ //
+ this.indicatorIO.BackColor = System.Drawing.Color.Black;
+ this.indicatorIO.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.indicatorIO.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.indicatorIO.Data1 = ((long)(0));
+ this.indicatorIO.Data2 = ((long)(0));
+ this.indicatorIO.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.indicatorIO.ForeColor = System.Drawing.Color.Lime;
+ this.indicatorIO.GraphWidth = 33;
+ this.indicatorIO.Location = new System.Drawing.Point(3, 16);
+ this.indicatorIO.Maximum = ((long)(2147483647));
+ this.indicatorIO.Minimum = ((long)(0));
+ this.indicatorIO.Name = "indicatorIO";
+ this.indicatorIO.Size = new System.Drawing.Size(74, 43);
+ this.indicatorIO.TabIndex = 8;
+ this.indicatorIO.TextValue = "";
+ //
// groupBox13
//
this.groupBox13.Controls.Add(this.indicatorCpu);
this.groupBox13.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox13.Location = new System.Drawing.Point(3, 3);
this.groupBox13.Name = "groupBox13";
- this.groupBox13.Size = new System.Drawing.Size(80, 113);
+ this.groupBox13.Size = new System.Drawing.Size(80, 62);
this.groupBox13.TabIndex = 11;
this.groupBox13.TabStop = false;
this.groupBox13.Text = "CPU Usage";
//
+ // indicatorCpu
+ //
+ this.indicatorCpu.BackColor = System.Drawing.Color.Black;
+ this.indicatorCpu.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ this.indicatorCpu.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
+ this.indicatorCpu.Data1 = ((long)(500000000));
+ this.indicatorCpu.Data2 = ((long)(500000000));
+ this.indicatorCpu.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.indicatorCpu.ForeColor = System.Drawing.Color.Lime;
+ this.indicatorCpu.GraphWidth = 33;
+ this.indicatorCpu.Location = new System.Drawing.Point(3, 16);
+ this.indicatorCpu.Maximum = ((long)(2147483647));
+ this.indicatorCpu.Minimum = ((long)(0));
+ this.indicatorCpu.Name = "indicatorCpu";
+ this.indicatorCpu.Size = new System.Drawing.Size(74, 43);
+ this.indicatorCpu.TabIndex = 8;
+ this.indicatorCpu.TextValue = "";
+ //
// checkShowOneGraphPerCPU
//
- this.checkShowOneGraphPerCPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkShowOneGraphPerCPU.AutoSize = true;
this.checkShowOneGraphPerCPU.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.checkShowOneGraphPerCPU.Location = new System.Drawing.Point(12, 532);
+ this.checkShowOneGraphPerCPU.Location = new System.Drawing.Point(89, 71);
this.checkShowOneGraphPerCPU.Name = "checkShowOneGraphPerCPU";
this.checkShowOneGraphPerCPU.Size = new System.Drawing.Size(153, 18);
this.checkShowOneGraphPerCPU.TabIndex = 3;
@@ -312,105 +418,149 @@
this.checkShowOneGraphPerCPU.UseVisualStyleBackColor = true;
this.checkShowOneGraphPerCPU.CheckedChanged += new System.EventHandler(this.checkShowOneGraphPerCPU_CheckedChanged);
//
- // groupBox16
+ // flowInfo
//
- this.groupBox16.Controls.Add(this.labelTotalsUptime);
- this.groupBox16.Controls.Add(this.labelTotalsHandles);
- this.groupBox16.Controls.Add(this.labelTotalsThreads);
- this.groupBox16.Controls.Add(this.label42);
- this.groupBox16.Controls.Add(this.label40);
- this.groupBox16.Controls.Add(this.label46);
- this.groupBox16.Controls.Add(this.label39);
- this.groupBox16.Controls.Add(this.labelTotalsProcesses);
- this.groupBox16.Location = new System.Drawing.Point(9, 6);
- this.groupBox16.Name = "groupBox16";
- this.groupBox16.Size = new System.Drawing.Size(193, 84);
- this.groupBox16.TabIndex = 6;
- this.groupBox16.TabStop = false;
- this.groupBox16.Text = "System";
+ this.flowInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.flowInfo.AutoScroll = true;
+ this.flowInfo.Controls.Add(this.groupBox3);
+ this.flowInfo.Controls.Add(this.groupBox4);
+ this.flowInfo.Controls.Add(this.groupBox5);
+ this.flowInfo.Controls.Add(this.groupBox6);
+ this.flowInfo.Controls.Add(this.groupBox7);
+ this.flowInfo.Controls.Add(this.groupBox8);
+ this.flowInfo.Controls.Add(this.groupBox9);
+ this.flowInfo.Controls.Add(this.groupBox10);
+ this.flowInfo.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flowInfo.Location = new System.Drawing.Point(12, 246);
+ this.flowInfo.Name = "flowInfo";
+ this.flowInfo.Size = new System.Drawing.Size(818, 256);
+ this.flowInfo.TabIndex = 4;
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.tableLayoutPanel1);
+ this.groupBox3.Location = new System.Drawing.Point(3, 3);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(195, 84);
+ this.groupBox3.TabIndex = 1;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "System";
+ //
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1.ColumnCount = 2;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel1.Controls.Add(this.labelTotalsUptime, 0, 3);
+ this.tableLayoutPanel1.Controls.Add(this.label6, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.label8, 0, 1);
+ this.tableLayoutPanel1.Controls.Add(this.label9, 0, 2);
+ this.tableLayoutPanel1.Controls.Add(this.labelTotalsProcesses, 1, 0);
+ this.tableLayoutPanel1.Controls.Add(this.labelTotalsThreads, 1, 1);
+ this.tableLayoutPanel1.Controls.Add(this.labelTotalsHandles, 1, 2);
+ this.tableLayoutPanel1.Controls.Add(this.label34, 0, 3);
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 4;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(189, 65);
+ this.tableLayoutPanel1.TabIndex = 1;
//
// labelTotalsUptime
//
this.labelTotalsUptime.AutoEllipsis = true;
- this.labelTotalsUptime.Location = new System.Drawing.Point(68, 62);
+ this.labelTotalsUptime.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelTotalsUptime.Location = new System.Drawing.Point(65, 48);
this.labelTotalsUptime.Name = "labelTotalsUptime";
- this.labelTotalsUptime.Size = new System.Drawing.Size(121, 15);
- this.labelTotalsUptime.TabIndex = 1;
+ this.labelTotalsUptime.Size = new System.Drawing.Size(121, 17);
+ this.labelTotalsUptime.TabIndex = 2;
this.labelTotalsUptime.Text = "value";
this.labelTotalsUptime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
- // labelTotalsHandles
+ // label6
//
- this.labelTotalsHandles.AutoEllipsis = true;
- this.labelTotalsHandles.Location = new System.Drawing.Point(68, 47);
- this.labelTotalsHandles.Name = "labelTotalsHandles";
- this.labelTotalsHandles.Size = new System.Drawing.Size(121, 15);
- this.labelTotalsHandles.TabIndex = 1;
- this.labelTotalsHandles.Text = "value";
- this.labelTotalsHandles.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(3, 1);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(56, 13);
+ this.label6.TabIndex = 1;
+ this.label6.Text = "Processes";
//
- // labelTotalsThreads
+ // label8
//
- this.labelTotalsThreads.AutoEllipsis = true;
- this.labelTotalsThreads.Location = new System.Drawing.Point(68, 32);
- this.labelTotalsThreads.Name = "labelTotalsThreads";
- this.labelTotalsThreads.Size = new System.Drawing.Size(121, 15);
- this.labelTotalsThreads.TabIndex = 2;
- this.labelTotalsThreads.Text = "value";
- this.labelTotalsThreads.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(3, 17);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(46, 13);
+ this.label8.TabIndex = 1;
+ this.label8.Text = "Threads";
//
- // label42
+ // label9
//
- this.label42.AutoSize = true;
- this.label42.Location = new System.Drawing.Point(6, 48);
- this.label42.Name = "label42";
- this.label42.Size = new System.Drawing.Size(46, 13);
- this.label42.TabIndex = 1;
- this.label42.Text = "Handles";
- //
- // label40
- //
- this.label40.AutoSize = true;
- this.label40.Location = new System.Drawing.Point(6, 33);
- this.label40.Name = "label40";
- this.label40.Size = new System.Drawing.Size(46, 13);
- this.label40.TabIndex = 1;
- this.label40.Text = "Threads";
- //
- // label46
- //
- this.label46.AutoSize = true;
- this.label46.Location = new System.Drawing.Point(6, 63);
- this.label46.Name = "label46";
- this.label46.Size = new System.Drawing.Size(40, 13);
- this.label46.TabIndex = 1;
- this.label46.Text = "Uptime";
- //
- // label39
- //
- this.label39.AutoSize = true;
- this.label39.Location = new System.Drawing.Point(6, 18);
- this.label39.Name = "label39";
- this.label39.Size = new System.Drawing.Size(56, 13);
- this.label39.TabIndex = 1;
- this.label39.Text = "Processes";
+ this.label9.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(3, 33);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(46, 13);
+ this.label9.TabIndex = 1;
+ this.label9.Text = "Handles";
//
// labelTotalsProcesses
//
this.labelTotalsProcesses.AutoEllipsis = true;
- this.labelTotalsProcesses.Location = new System.Drawing.Point(68, 18);
+ this.labelTotalsProcesses.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelTotalsProcesses.Location = new System.Drawing.Point(65, 0);
this.labelTotalsProcesses.Name = "labelTotalsProcesses";
- this.labelTotalsProcesses.Size = new System.Drawing.Size(121, 15);
+ this.labelTotalsProcesses.Size = new System.Drawing.Size(121, 16);
this.labelTotalsProcesses.TabIndex = 1;
this.labelTotalsProcesses.Text = "value";
this.labelTotalsProcesses.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
+ // labelTotalsThreads
+ //
+ this.labelTotalsThreads.AutoEllipsis = true;
+ this.labelTotalsThreads.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelTotalsThreads.Location = new System.Drawing.Point(65, 16);
+ this.labelTotalsThreads.Name = "labelTotalsThreads";
+ this.labelTotalsThreads.Size = new System.Drawing.Size(121, 16);
+ this.labelTotalsThreads.TabIndex = 1;
+ this.labelTotalsThreads.Text = "value";
+ this.labelTotalsThreads.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // labelTotalsHandles
+ //
+ this.labelTotalsHandles.AutoEllipsis = true;
+ this.labelTotalsHandles.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelTotalsHandles.Location = new System.Drawing.Point(65, 32);
+ this.labelTotalsHandles.Name = "labelTotalsHandles";
+ this.labelTotalsHandles.Size = new System.Drawing.Size(121, 16);
+ this.labelTotalsHandles.TabIndex = 1;
+ this.labelTotalsHandles.Text = "value";
+ this.labelTotalsHandles.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // label34
+ //
+ this.label34.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label34.AutoSize = true;
+ this.label34.Location = new System.Drawing.Point(3, 50);
+ this.label34.Name = "label34";
+ this.label34.Size = new System.Drawing.Size(40, 13);
+ this.label34.TabIndex = 1;
+ this.label34.Text = "Uptime";
+ //
// groupBox4
//
this.groupBox4.Controls.Add(this.tableLayoutPanel2);
- this.groupBox4.Location = new System.Drawing.Point(9, 96);
+ this.groupBox4.Location = new System.Drawing.Point(3, 93);
this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(193, 78);
+ this.groupBox4.Size = new System.Drawing.Size(195, 78);
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Commit Charge";
@@ -433,7 +583,7 @@
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
- this.tableLayoutPanel2.Size = new System.Drawing.Size(187, 59);
+ this.tableLayoutPanel2.Size = new System.Drawing.Size(189, 59);
this.tableLayoutPanel2.TabIndex = 1;
//
// label1
@@ -499,107 +649,10 @@
this.labelCCL.Text = "value";
this.labelCCL.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.labelCachePeak);
- this.groupBox6.Controls.Add(this.labelCacheCurrent);
- this.groupBox6.Controls.Add(this.label5);
- this.groupBox6.Controls.Add(this.labelCacheMaximum);
- this.groupBox6.Controls.Add(this.label10);
- this.groupBox6.Controls.Add(this.labelCacheMinimum);
- this.groupBox6.Controls.Add(this.label13);
- this.groupBox6.Controls.Add(this.label15);
- this.groupBox6.Location = new System.Drawing.Point(208, 6);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(190, 84);
- this.groupBox6.TabIndex = 4;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "File Cache";
- //
- // labelCachePeak
- //
- this.labelCachePeak.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.labelCachePeak.AutoEllipsis = true;
- this.labelCachePeak.Location = new System.Drawing.Point(63, 19);
- this.labelCachePeak.Name = "labelCachePeak";
- this.labelCachePeak.Size = new System.Drawing.Size(121, 13);
- this.labelCachePeak.TabIndex = 1;
- this.labelCachePeak.Text = "value";
- this.labelCachePeak.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // labelCacheCurrent
- //
- this.labelCacheCurrent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.labelCacheCurrent.AutoEllipsis = true;
- this.labelCacheCurrent.Location = new System.Drawing.Point(63, 48);
- this.labelCacheCurrent.Name = "labelCacheCurrent";
- this.labelCacheCurrent.Size = new System.Drawing.Size(121, 13);
- this.labelCacheCurrent.TabIndex = 1;
- this.labelCacheCurrent.Text = "value";
- this.labelCacheCurrent.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(6, 18);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(41, 13);
- this.label5.TabIndex = 1;
- this.label5.Text = "Current";
- //
- // labelCacheMaximum
- //
- this.labelCacheMaximum.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.labelCacheMaximum.AutoEllipsis = true;
- this.labelCacheMaximum.Location = new System.Drawing.Point(63, 33);
- this.labelCacheMaximum.Name = "labelCacheMaximum";
- this.labelCacheMaximum.Size = new System.Drawing.Size(121, 13);
- this.labelCacheMaximum.TabIndex = 4;
- this.labelCacheMaximum.Text = "value";
- this.labelCacheMaximum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(6, 33);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(32, 13);
- this.label10.TabIndex = 1;
- this.label10.Text = "Peak";
- //
- // labelCacheMinimum
- //
- this.labelCacheMinimum.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.labelCacheMinimum.AutoEllipsis = true;
- this.labelCacheMinimum.Location = new System.Drawing.Point(63, 63);
- this.labelCacheMinimum.Name = "labelCacheMinimum";
- this.labelCacheMinimum.Size = new System.Drawing.Size(121, 13);
- this.labelCacheMinimum.TabIndex = 2;
- this.labelCacheMinimum.Text = "value";
- this.labelCacheMinimum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(6, 63);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(48, 13);
- this.label13.TabIndex = 3;
- this.label13.Text = "Minimum";
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(6, 48);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(51, 13);
- this.label15.TabIndex = 5;
- this.label15.Text = "Maximum";
- //
// groupBox5
//
this.groupBox5.Controls.Add(this.tableLayoutPanel3);
- this.groupBox5.Location = new System.Drawing.Point(7, 180);
+ this.groupBox5.Location = new System.Drawing.Point(3, 177);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(195, 75);
this.groupBox5.TabIndex = 3;
@@ -690,10 +743,128 @@
this.labelPSC.Text = "value";
this.labelPSC.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
+ // groupBox6
+ //
+ this.groupBox6.Controls.Add(this.tableLayoutPanel4);
+ this.groupBox6.Location = new System.Drawing.Point(204, 3);
+ this.groupBox6.Name = "groupBox6";
+ this.groupBox6.Size = new System.Drawing.Size(195, 85);
+ this.groupBox6.TabIndex = 4;
+ this.groupBox6.TabStop = false;
+ this.groupBox6.Text = "File Cache";
+ //
+ // tableLayoutPanel4
+ //
+ this.tableLayoutPanel4.ColumnCount = 2;
+ this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel4.Controls.Add(this.label15, 0, 3);
+ this.tableLayoutPanel4.Controls.Add(this.labelCacheMaximum, 0, 3);
+ this.tableLayoutPanel4.Controls.Add(this.label13, 0, 2);
+ this.tableLayoutPanel4.Controls.Add(this.labelCacheMinimum, 0, 2);
+ this.tableLayoutPanel4.Controls.Add(this.label5, 0, 0);
+ this.tableLayoutPanel4.Controls.Add(this.label10, 0, 1);
+ this.tableLayoutPanel4.Controls.Add(this.labelCacheCurrent, 1, 0);
+ this.tableLayoutPanel4.Controls.Add(this.labelCachePeak, 1, 1);
+ this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16);
+ this.tableLayoutPanel4.Name = "tableLayoutPanel4";
+ this.tableLayoutPanel4.RowCount = 4;
+ this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tableLayoutPanel4.Size = new System.Drawing.Size(189, 66);
+ this.tableLayoutPanel4.TabIndex = 1;
+ //
+ // label15
+ //
+ this.label15.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label15.AutoSize = true;
+ this.label15.Location = new System.Drawing.Point(3, 50);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(51, 13);
+ this.label15.TabIndex = 5;
+ this.label15.Text = "Maximum";
+ //
+ // labelCacheMaximum
+ //
+ this.labelCacheMaximum.AutoEllipsis = true;
+ this.labelCacheMaximum.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelCacheMaximum.Location = new System.Drawing.Point(60, 48);
+ this.labelCacheMaximum.Name = "labelCacheMaximum";
+ this.labelCacheMaximum.Size = new System.Drawing.Size(130, 18);
+ this.labelCacheMaximum.TabIndex = 4;
+ this.labelCacheMaximum.Text = "value";
+ this.labelCacheMaximum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // label13
+ //
+ this.label13.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label13.AutoSize = true;
+ this.label13.Location = new System.Drawing.Point(3, 33);
+ this.label13.Name = "label13";
+ this.label13.Size = new System.Drawing.Size(48, 13);
+ this.label13.TabIndex = 3;
+ this.label13.Text = "Minimum";
+ //
+ // labelCacheMinimum
+ //
+ this.labelCacheMinimum.AutoEllipsis = true;
+ this.labelCacheMinimum.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelCacheMinimum.Location = new System.Drawing.Point(60, 32);
+ this.labelCacheMinimum.Name = "labelCacheMinimum";
+ this.labelCacheMinimum.Size = new System.Drawing.Size(130, 16);
+ this.labelCacheMinimum.TabIndex = 2;
+ this.labelCacheMinimum.Text = "value";
+ this.labelCacheMinimum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // label5
+ //
+ this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(3, 1);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(41, 13);
+ this.label5.TabIndex = 1;
+ this.label5.Text = "Current";
+ //
+ // label10
+ //
+ this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.label10.AutoSize = true;
+ this.label10.Location = new System.Drawing.Point(3, 17);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(32, 13);
+ this.label10.TabIndex = 1;
+ this.label10.Text = "Peak";
+ //
+ // labelCacheCurrent
+ //
+ this.labelCacheCurrent.AutoEllipsis = true;
+ this.labelCacheCurrent.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelCacheCurrent.Location = new System.Drawing.Point(60, 0);
+ this.labelCacheCurrent.Name = "labelCacheCurrent";
+ this.labelCacheCurrent.Size = new System.Drawing.Size(130, 16);
+ this.labelCacheCurrent.TabIndex = 1;
+ this.labelCacheCurrent.Text = "value";
+ this.labelCacheCurrent.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // labelCachePeak
+ //
+ this.labelCachePeak.AutoEllipsis = true;
+ this.labelCachePeak.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.labelCachePeak.Location = new System.Drawing.Point(60, 16);
+ this.labelCachePeak.Name = "labelCachePeak";
+ this.labelCachePeak.Size = new System.Drawing.Size(130, 16);
+ this.labelCachePeak.TabIndex = 1;
+ this.labelCachePeak.Text = "value";
+ this.labelCachePeak.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
// groupBox7
//
this.groupBox7.Controls.Add(this.tableLayoutPanel5);
- this.groupBox7.Location = new System.Drawing.Point(208, 96);
+ this.groupBox7.Location = new System.Drawing.Point(204, 94);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(195, 157);
this.groupBox7.TabIndex = 5;
@@ -932,7 +1103,7 @@
// groupBox8
//
this.groupBox8.Controls.Add(this.tableLayoutPanel6);
- this.groupBox8.Location = new System.Drawing.Point(409, 12);
+ this.groupBox8.Location = new System.Drawing.Point(405, 3);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(195, 121);
this.groupBox8.TabIndex = 6;
@@ -1098,9 +1269,9 @@
// groupBox9
//
this.groupBox9.Controls.Add(this.tableLayoutPanel7);
- this.groupBox9.Location = new System.Drawing.Point(409, 139);
+ this.groupBox9.Location = new System.Drawing.Point(405, 130);
this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(195, 113);
+ this.groupBox9.Size = new System.Drawing.Size(195, 121);
this.groupBox9.TabIndex = 7;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "I/O";
@@ -1132,14 +1303,14 @@
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
- this.tableLayoutPanel7.Size = new System.Drawing.Size(189, 94);
+ this.tableLayoutPanel7.Size = new System.Drawing.Size(189, 102);
this.tableLayoutPanel7.TabIndex = 1;
//
// label16
//
this.label16.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(3, 78);
+ this.label16.Location = new System.Drawing.Point(3, 84);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(62, 13);
this.label16.TabIndex = 7;
@@ -1149,9 +1320,9 @@
//
this.labelIOOB.AutoEllipsis = true;
this.labelIOOB.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelIOOB.Location = new System.Drawing.Point(71, 75);
+ this.labelIOOB.Location = new System.Drawing.Point(71, 80);
this.labelIOOB.Name = "labelIOOB";
- this.labelIOOB.Size = new System.Drawing.Size(115, 19);
+ this.labelIOOB.Size = new System.Drawing.Size(115, 22);
this.labelIOOB.TabIndex = 6;
this.labelIOOB.Text = "value";
this.labelIOOB.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -1160,7 +1331,7 @@
//
this.label22.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label22.AutoSize = true;
- this.label22.Location = new System.Drawing.Point(3, 61);
+ this.label22.Location = new System.Drawing.Point(3, 65);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(33, 13);
this.label22.TabIndex = 5;
@@ -1170,7 +1341,7 @@
//
this.label26.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label26.AutoSize = true;
- this.label26.Location = new System.Drawing.Point(3, 46);
+ this.label26.Location = new System.Drawing.Point(3, 49);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(61, 13);
this.label26.TabIndex = 3;
@@ -1180,9 +1351,9 @@
//
this.labelIOO.AutoEllipsis = true;
this.labelIOO.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelIOO.Location = new System.Drawing.Point(71, 60);
+ this.labelIOO.Location = new System.Drawing.Point(71, 64);
this.labelIOO.Name = "labelIOO";
- this.labelIOO.Size = new System.Drawing.Size(115, 15);
+ this.labelIOO.Size = new System.Drawing.Size(115, 16);
this.labelIOO.TabIndex = 4;
this.labelIOO.Text = "value";
this.labelIOO.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -1201,7 +1372,7 @@
//
this.label32.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label32.AutoSize = true;
- this.label32.Location = new System.Drawing.Point(3, 31);
+ this.label32.Location = new System.Drawing.Point(3, 33);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(37, 13);
this.label32.TabIndex = 1;
@@ -1213,7 +1384,7 @@
this.labelIOR.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelIOR.Location = new System.Drawing.Point(71, 0);
this.labelIOR.Name = "labelIOR";
- this.labelIOR.Size = new System.Drawing.Size(115, 15);
+ this.labelIOR.Size = new System.Drawing.Size(115, 16);
this.labelIOR.TabIndex = 1;
this.labelIOR.Text = "value";
this.labelIOR.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -1222,9 +1393,9 @@
//
this.labelIOW.AutoEllipsis = true;
this.labelIOW.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelIOW.Location = new System.Drawing.Point(71, 30);
+ this.labelIOW.Location = new System.Drawing.Point(71, 32);
this.labelIOW.Name = "labelIOW";
- this.labelIOW.Size = new System.Drawing.Size(115, 15);
+ this.labelIOW.Size = new System.Drawing.Size(115, 16);
this.labelIOW.TabIndex = 1;
this.labelIOW.Text = "value";
this.labelIOW.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -1233,7 +1404,7 @@
//
this.label35.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label35.AutoSize = true;
- this.label35.Location = new System.Drawing.Point(3, 16);
+ this.label35.Location = new System.Drawing.Point(3, 17);
this.label35.Name = "label35";
this.label35.Size = new System.Drawing.Size(62, 13);
this.label35.TabIndex = 1;
@@ -1243,9 +1414,9 @@
//
this.labelIORB.AutoEllipsis = true;
this.labelIORB.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelIORB.Location = new System.Drawing.Point(71, 15);
+ this.labelIORB.Location = new System.Drawing.Point(71, 16);
this.labelIORB.Name = "labelIORB";
- this.labelIORB.Size = new System.Drawing.Size(115, 15);
+ this.labelIORB.Size = new System.Drawing.Size(115, 16);
this.labelIORB.TabIndex = 1;
this.labelIORB.Text = "value";
this.labelIORB.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -1254,17 +1425,18 @@
//
this.labelIOWB.AutoEllipsis = true;
this.labelIOWB.Dock = System.Windows.Forms.DockStyle.Fill;
- this.labelIOWB.Location = new System.Drawing.Point(71, 45);
+ this.labelIOWB.Location = new System.Drawing.Point(71, 48);
this.labelIOWB.Name = "labelIOWB";
- this.labelIOWB.Size = new System.Drawing.Size(115, 15);
+ this.labelIOWB.Size = new System.Drawing.Size(115, 16);
this.labelIOWB.TabIndex = 2;
this.labelIOWB.Text = "value";
this.labelIOWB.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox10
//
+ this.groupBox10.AutoSize = true;
this.groupBox10.Controls.Add(this.tableLayoutPanel8);
- this.groupBox10.Location = new System.Drawing.Point(8, 261);
+ this.groupBox10.Location = new System.Drawing.Point(606, 3);
this.groupBox10.MinimumSize = new System.Drawing.Size(195, 76);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(195, 76);
@@ -1317,6 +1489,7 @@
// labelCPUContextSwitches
//
this.labelCPUContextSwitches.AutoEllipsis = true;
+ this.labelCPUContextSwitches.AutoSize = true;
this.labelCPUContextSwitches.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCPUContextSwitches.Location = new System.Drawing.Point(98, 0);
this.labelCPUContextSwitches.Name = "labelCPUContextSwitches";
@@ -1328,6 +1501,7 @@
// labelCPUSystemCalls
//
this.labelCPUSystemCalls.AutoEllipsis = true;
+ this.labelCPUSystemCalls.AutoSize = true;
this.labelCPUSystemCalls.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCPUSystemCalls.Location = new System.Drawing.Point(98, 38);
this.labelCPUSystemCalls.Name = "labelCPUSystemCalls";
@@ -1349,6 +1523,7 @@
// labelCPUInterrupts
//
this.labelCPUInterrupts.AutoEllipsis = true;
+ this.labelCPUInterrupts.AutoSize = true;
this.labelCPUInterrupts.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCPUInterrupts.Location = new System.Drawing.Point(98, 19);
this.labelCPUInterrupts.Name = "labelCPUInterrupts";
@@ -1359,10 +1534,10 @@
//
// checkAlwaysOnTop
//
- this.checkAlwaysOnTop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.checkAlwaysOnTop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.checkAlwaysOnTop.AutoSize = true;
this.checkAlwaysOnTop.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.checkAlwaysOnTop.Location = new System.Drawing.Point(180, 532);
+ this.checkAlwaysOnTop.Location = new System.Drawing.Point(728, 508);
this.checkAlwaysOnTop.Name = "checkAlwaysOnTop";
this.checkAlwaysOnTop.Size = new System.Drawing.Size(102, 18);
this.checkAlwaysOnTop.TabIndex = 5;
@@ -1370,260 +1545,43 @@
this.checkAlwaysOnTop.UseVisualStyleBackColor = true;
this.checkAlwaysOnTop.CheckedChanged += new System.EventHandler(this.checkAlwaysOnTop_CheckedChanged);
//
- // tabControl1
- //
- this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Location = new System.Drawing.Point(12, 12);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(710, 510);
- this.tabControl1.TabIndex = 6;
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.tableGraphs);
- this.tabPage1.Location = new System.Drawing.Point(4, 22);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(702, 484);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "Summary";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // tabPage2
- //
- this.tabPage2.Controls.Add(this.groupBox4);
- this.tabPage2.Controls.Add(this.groupBox16);
- this.tabPage2.Controls.Add(this.groupBox7);
- this.tabPage2.Controls.Add(this.groupBox5);
- this.tabPage2.Controls.Add(this.groupBox6);
- this.tabPage2.Controls.Add(this.groupBox10);
- this.tabPage2.Controls.Add(this.groupBox9);
- this.tabPage2.Controls.Add(this.groupBox8);
- this.tabPage2.Location = new System.Drawing.Point(4, 22);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(702, 484);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "Stats";
- this.tabPage2.UseVisualStyleBackColor = true;
- //
- // CloseButton
- //
- this.CloseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.CloseButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.CloseButton.Location = new System.Drawing.Point(647, 528);
- this.CloseButton.Name = "CloseButton";
- this.CloseButton.Size = new System.Drawing.Size(75, 23);
- this.CloseButton.TabIndex = 7;
- this.CloseButton.Text = "Close";
- this.CloseButton.UseVisualStyleBackColor = true;
- this.CloseButton.Click += new System.EventHandler(this.CloseButton_Click);
- //
- // indicatorCommit
- //
- this.indicatorCommit.BackColor = System.Drawing.Color.Black;
- this.indicatorCommit.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.indicatorCommit.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.indicatorCommit.Data1 = ((long)(0));
- this.indicatorCommit.Data2 = ((long)(0));
- this.indicatorCommit.Dock = System.Windows.Forms.DockStyle.Fill;
- this.indicatorCommit.ForeColor = System.Drawing.Color.Lime;
- this.indicatorCommit.GraphWidth = 33;
- this.indicatorCommit.Location = new System.Drawing.Point(3, 16);
- this.indicatorCommit.Maximum = ((long)(2147483647));
- this.indicatorCommit.Minimum = ((long)(0));
- this.indicatorCommit.Name = "indicatorCommit";
- this.indicatorCommit.Size = new System.Drawing.Size(74, 94);
- this.indicatorCommit.TabIndex = 8;
- this.indicatorCommit.TextValue = "value";
- //
- // trackerCommit
- //
- this.trackerCommit.BackColor = System.Drawing.Color.Black;
- this.trackerCommit.Dock = System.Windows.Forms.DockStyle.Fill;
- this.trackerCommit.Location = new System.Drawing.Point(3, 16);
- this.trackerCommit.LowerRange = 30;
- this.trackerCommit.Name = "trackerCommit";
- this.trackerCommit.Size = new System.Drawing.Size(598, 94);
- this.trackerCommit.TabIndex = 6;
- this.trackerCommit.Text = null;
- this.trackerCommit.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.trackerCommit.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.trackerCommit.TextMargin = new System.Windows.Forms.Padding(3);
- this.trackerCommit.TextPadding = new System.Windows.Forms.Padding(3);
- this.trackerCommit.TextPosition = System.Drawing.ContentAlignment.TopLeft;
- this.trackerCommit.UpperRange = 90;
- this.trackerCommit.UseSecondLine = false;
- //
- // plotterCPU
- //
- this.plotterCPU.BackColor = System.Drawing.Color.Black;
- this.plotterCPU.Data1 = null;
- this.plotterCPU.Data2 = null;
- this.plotterCPU.Dock = System.Windows.Forms.DockStyle.Fill;
- this.plotterCPU.GridColor = System.Drawing.Color.Green;
- this.plotterCPU.GridSize = new System.Drawing.Size(12, 12);
- this.plotterCPU.LineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.plotterCPU.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.plotterCPU.Location = new System.Drawing.Point(3, 16);
- this.plotterCPU.LongData1 = null;
- this.plotterCPU.LongData2 = null;
- this.plotterCPU.MinMaxValue = ((long)(0));
- this.plotterCPU.MoveStep = -1;
- this.plotterCPU.Name = "plotterCPU";
- this.plotterCPU.OverlaySecondLine = false;
- this.plotterCPU.ShowGrid = true;
- this.plotterCPU.Size = new System.Drawing.Size(598, 94);
- this.plotterCPU.TabIndex = 0;
- this.plotterCPU.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.plotterCPU.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.plotterCPU.TextMargin = new System.Windows.Forms.Padding(3);
- this.plotterCPU.TextPadding = new System.Windows.Forms.Padding(3);
- this.plotterCPU.TextPosition = System.Drawing.ContentAlignment.TopLeft;
- this.plotterCPU.UseLongData = false;
- this.plotterCPU.UseSecondLine = true;
- //
- // plotterIO
- //
- this.plotterIO.BackColor = System.Drawing.Color.Black;
- this.plotterIO.Data1 = null;
- this.plotterIO.Data2 = null;
- this.plotterIO.Dock = System.Windows.Forms.DockStyle.Fill;
- this.plotterIO.GridColor = System.Drawing.Color.Green;
- this.plotterIO.GridSize = new System.Drawing.Size(12, 12);
- this.plotterIO.LineColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.plotterIO.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.plotterIO.Location = new System.Drawing.Point(3, 16);
- this.plotterIO.LongData1 = null;
- this.plotterIO.LongData2 = null;
- this.plotterIO.MinMaxValue = ((long)(0));
- this.plotterIO.MoveStep = -1;
- this.plotterIO.Name = "plotterIO";
- this.plotterIO.OverlaySecondLine = true;
- this.plotterIO.ShowGrid = true;
- this.plotterIO.Size = new System.Drawing.Size(598, 94);
- this.plotterIO.TabIndex = 5;
- this.plotterIO.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.plotterIO.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.plotterIO.TextMargin = new System.Windows.Forms.Padding(3);
- this.plotterIO.TextPadding = new System.Windows.Forms.Padding(3);
- this.plotterIO.TextPosition = System.Drawing.ContentAlignment.TopLeft;
- this.plotterIO.UseLongData = true;
- this.plotterIO.UseSecondLine = true;
- //
- // trackerMemory
- //
- this.trackerMemory.BackColor = System.Drawing.Color.Black;
- this.trackerMemory.Dock = System.Windows.Forms.DockStyle.Fill;
- this.trackerMemory.Location = new System.Drawing.Point(3, 16);
- this.trackerMemory.LowerRange = 30;
- this.trackerMemory.Name = "trackerMemory";
- this.trackerMemory.Size = new System.Drawing.Size(598, 96);
- this.trackerMemory.TabIndex = 6;
- this.trackerMemory.Text = null;
- this.trackerMemory.TextBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.trackerMemory.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.trackerMemory.TextMargin = new System.Windows.Forms.Padding(3);
- this.trackerMemory.TextPadding = new System.Windows.Forms.Padding(3);
- this.trackerMemory.TextPosition = System.Drawing.ContentAlignment.TopLeft;
- this.trackerMemory.UpperRange = 90;
- this.trackerMemory.UseSecondLine = false;
- //
- // indicatorPhysical
- //
- this.indicatorPhysical.BackColor = System.Drawing.Color.Black;
- this.indicatorPhysical.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.indicatorPhysical.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.indicatorPhysical.Data1 = ((long)(0));
- this.indicatorPhysical.Data2 = ((long)(0));
- this.indicatorPhysical.Dock = System.Windows.Forms.DockStyle.Fill;
- this.indicatorPhysical.ForeColor = System.Drawing.Color.Lime;
- this.indicatorPhysical.GraphWidth = 33;
- this.indicatorPhysical.Location = new System.Drawing.Point(3, 16);
- this.indicatorPhysical.Maximum = ((long)(2147483647));
- this.indicatorPhysical.Minimum = ((long)(0));
- this.indicatorPhysical.Name = "indicatorPhysical";
- this.indicatorPhysical.Size = new System.Drawing.Size(74, 96);
- this.indicatorPhysical.TabIndex = 8;
- this.indicatorPhysical.TextValue = "value";
- //
- // indicatorIO
- //
- this.indicatorIO.BackColor = System.Drawing.Color.Black;
- this.indicatorIO.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.indicatorIO.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.indicatorIO.Data1 = ((long)(0));
- this.indicatorIO.Data2 = ((long)(0));
- this.indicatorIO.Dock = System.Windows.Forms.DockStyle.Fill;
- this.indicatorIO.ForeColor = System.Drawing.Color.Lime;
- this.indicatorIO.GraphWidth = 33;
- this.indicatorIO.Location = new System.Drawing.Point(3, 16);
- this.indicatorIO.Maximum = ((long)(2147483647));
- this.indicatorIO.Minimum = ((long)(0));
- this.indicatorIO.Name = "indicatorIO";
- this.indicatorIO.Size = new System.Drawing.Size(74, 94);
- this.indicatorIO.TabIndex = 8;
- this.indicatorIO.TextValue = "value";
- //
- // indicatorCpu
- //
- this.indicatorCpu.BackColor = System.Drawing.Color.Black;
- this.indicatorCpu.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- this.indicatorCpu.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
- this.indicatorCpu.Data1 = ((long)(500000000));
- this.indicatorCpu.Data2 = ((long)(500000000));
- this.indicatorCpu.Dock = System.Windows.Forms.DockStyle.Fill;
- this.indicatorCpu.ForeColor = System.Drawing.Color.Lime;
- this.indicatorCpu.GraphWidth = 33;
- this.indicatorCpu.Location = new System.Drawing.Point(3, 16);
- this.indicatorCpu.Maximum = ((long)(2147483647));
- this.indicatorCpu.Minimum = ((long)(0));
- this.indicatorCpu.Name = "indicatorCpu";
- this.indicatorCpu.Size = new System.Drawing.Size(74, 94);
- this.indicatorCpu.TabIndex = 8;
- this.indicatorCpu.TextValue = "value";
- //
// SysInfoWindow
//
- this.AcceptButton = this.CloseButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.CancelButton = this.CloseButton;
- this.ClientSize = new System.Drawing.Size(734, 562);
- this.Controls.Add(this.CloseButton);
+ this.ClientSize = new System.Drawing.Size(842, 538);
this.Controls.Add(this.checkAlwaysOnTop);
- this.Controls.Add(this.checkShowOneGraphPerCPU);
- this.Controls.Add(this.tabControl1);
+ this.Controls.Add(this.flowInfo);
+ this.Controls.Add(this.tableGraphs);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.MinimumSize = new System.Drawing.Size(750, 600);
+ this.MinimumSize = new System.Drawing.Size(200, 500);
this.Name = "SysInfoWindow";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "System Information";
+ this.Paint += new System.Windows.Forms.PaintEventHandler(this.SysInfoWindow_Paint);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SysInfoWindow_FormClosing);
this.gboxCPUPlotter.ResumeLayout(false);
this.tableGraphs.ResumeLayout(false);
- this.groupBox15.ResumeLayout(false);
- this.groupBox14.ResumeLayout(false);
+ this.tableGraphs.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox11.ResumeLayout(false);
this.groupBox12.ResumeLayout(false);
this.groupBox13.ResumeLayout(false);
- this.groupBox16.ResumeLayout(false);
- this.groupBox16.PerformLayout();
+ this.flowInfo.ResumeLayout(false);
+ this.flowInfo.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
+ this.groupBox6.ResumeLayout(false);
+ this.tableLayoutPanel4.ResumeLayout(false);
+ this.tableLayoutPanel4.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.tableLayoutPanel5.ResumeLayout(false);
this.tableLayoutPanel5.PerformLayout();
@@ -1637,9 +1595,6 @@
this.groupBox10.PerformLayout();
this.tableLayoutPanel8.ResumeLayout(false);
this.tableLayoutPanel8.PerformLayout();
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -1654,6 +1609,17 @@
private System.Windows.Forms.CheckBox checkShowOneGraphPerCPU;
private System.Windows.Forms.GroupBox groupBox2;
private ProcessHacker.Components.Plotter plotterIO;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private ProcessHacker.Components.Plotter plotterMemory;
+ private System.Windows.Forms.FlowLayoutPanel flowInfo;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label labelTotalsProcesses;
+ private System.Windows.Forms.Label labelTotalsThreads;
+ private System.Windows.Forms.Label labelTotalsHandles;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label label1;
@@ -1669,6 +1635,7 @@
private System.Windows.Forms.Label labelPMC;
private System.Windows.Forms.Label labelPMT;
private System.Windows.Forms.GroupBox groupBox6;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label labelCacheCurrent;
@@ -1734,32 +1701,15 @@
private System.Windows.Forms.Label labelPSC;
private ProcessHacker.Components.Indicator indicatorCpu;
private ProcessHacker.Components.Indicator indicatorIO;
+ private ProcessHacker.Components.Indicator indicatorPhysical;
+ private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.GroupBox groupBox12;
private System.Windows.Forms.GroupBox groupBox13;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label labelKPPL;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Label labelKPNPL;
- private System.Windows.Forms.GroupBox groupBox14;
- private Tracker trackerCommit;
- private System.Windows.Forms.GroupBox groupBox1;
- private Tracker trackerMemory;
- private System.Windows.Forms.GroupBox groupBox11;
- private ProcessHacker.Components.Indicator indicatorPhysical;
- private System.Windows.Forms.GroupBox groupBox15;
- private ProcessHacker.Components.Indicator indicatorCommit;
- private System.Windows.Forms.GroupBox groupBox16;
private System.Windows.Forms.Label labelTotalsUptime;
- private System.Windows.Forms.Label labelTotalsHandles;
- private System.Windows.Forms.Label labelTotalsThreads;
- private System.Windows.Forms.Label label42;
- private System.Windows.Forms.Label label40;
- private System.Windows.Forms.Label label46;
- private System.Windows.Forms.Label label39;
- private System.Windows.Forms.Label labelTotalsProcesses;
- private System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.TabPage tabPage1;
- private System.Windows.Forms.TabPage tabPage2;
- private System.Windows.Forms.Button CloseButton;
+ private System.Windows.Forms.Label label34;
}
}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.cs b/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.cs
index 1d208da98..350b9781f 100644
--- a/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.cs
@@ -23,12 +23,13 @@
using System;
using System.Drawing;
+using System.Runtime.InteropServices;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Components;
using ProcessHacker.Native;
-using ProcessHacker.Native.Symbols;
using ProcessHacker.Native.Api;
+using ProcessHacker.Native.Symbols;
namespace ProcessHacker
{
@@ -37,60 +38,66 @@ namespace ProcessHacker
private static IntPtr _mmSizeOfPagedPoolInBytes;
private static IntPtr _mmMaximumNonPagedPoolInBytes;
- private readonly Plotter[] _cpuPlotters;
- private readonly uint _noOfCPUs = Program.ProcessProvider.System.NumberOfProcessors;
- private readonly int _pages = Program.ProcessProvider.System.NumberOfPhysicalPages;
- private readonly int _pageSize = Program.ProcessProvider.System.PageSize;
+ private bool _isFirstPaint = true;
+ private Components.Plotter[] _cpuPlotters;
+ private uint _noOfCPUs = Program.ProcessProvider.System.NumberOfProcessors;
+ private uint _pages = (uint)Program.ProcessProvider.System.NumberOfPhysicalPages;
+ private uint _pageSize = (uint)Program.ProcessProvider.System.PageSize;
public SysInfoWindow()
- {
- this.InitializeComponent();
+ {
+ InitializeComponent();
+ this.AddEscapeToClose();
- //if (!Settings.Instance.SysInfoWindowBounds.IsEmpty)
- //this.DesktopBounds = Utils.FitRectangle(Settings.Instance.SysInfoWindowBounds, this);
+ this.Size = Settings.Instance.SysInfoWindowSize;
+ this.Location = Utils.FitRectangle(new Rectangle(
+ Settings.Instance.SysInfoWindowLocation, this.Size), this).Location;
// Load the pool limit addresses.
- if (_mmSizeOfPagedPoolInBytes == IntPtr.Zero)
+ if (
+ _mmSizeOfPagedPoolInBytes == IntPtr.Zero &&
+ KProcessHacker.Instance != null
+ )
{
WorkQueue.GlobalQueueWorkItemTag(new Action(() =>
- {
- try
{
- using (SymbolProvider symbols = new SymbolProvider())
+ try
{
+ SymbolProvider symbols = new SymbolProvider();
+
symbols.LoadModule(Windows.KernelFileName, Windows.KernelBase);
-
- _mmSizeOfPagedPoolInBytes = (IntPtr)symbols.GetSymbolFromName("MmSizeOfPagedPoolInBytes").Address;
- _mmMaximumNonPagedPoolInBytes = (IntPtr)symbols.GetSymbolFromName("MmMaximumNonPagedPoolInBytes").Address;
+ _mmSizeOfPagedPoolInBytes =
+ symbols.GetSymbolFromName("MmSizeOfPagedPoolInBytes").Address.ToIntPtr();
+ _mmMaximumNonPagedPoolInBytes =
+ symbols.GetSymbolFromName("MmMaximumNonPagedPoolInBytes").Address.ToIntPtr();
}
- }
- catch (Exception) { }
+ catch
+ { }
+ }), "load-mm-addresses");
+ }
+ }
- }), "load-mm-addresses");
+ private void SysInfoWindow_Paint(object sender, PaintEventArgs e)
+ {
+ if (_isFirstPaint)
+ {
+ this.LoadStage1();
}
- this.trackerMemory.values = Program.ProcessProvider.PhysicalMemoryHistory;
- this.trackerMemory.DrawColor = Settings.Instance.PlotterMemoryPrivateColor;
+ _isFirstPaint = false;
+ }
- this.trackerCommit.Maximum = (int)Program.ProcessProvider.Performance.CommitLimit;
- this.trackerCommit.values = Program.ProcessProvider.CommitHistory;
- this.trackerCommit.DrawColor = Settings.Instance.PlotterMemoryWSColor;
+ private void LoadStage1()
+ {
+ // Maximum physical memory.
+ indicatorPhysical.Maximum = (int)_pages;
// Set indicators color
- this.indicatorCpu.Color1 = Settings.Instance.PlotterCPUUserColor;
- this.indicatorCpu.Color2 = Settings.Instance.PlotterCPUKernelColor;
-
- this.indicatorIO.Color1 = Settings.Instance.PlotterIOROColor;
- this.indicatorPhysical.Color1 = Settings.Instance.PlotterMemoryPrivateColor;
+ indicatorCpu.Color1 = Settings.Instance.PlotterCPUKernelColor;
+ indicatorCpu.Color2 = Settings.Instance.PlotterCPUUserColor;
+ indicatorIO.Color1 = Settings.Instance.PlotterIOROColor;
+ indicatorPhysical.Color1 = Settings.Instance.PlotterMemoryWSColor;
- this.plotterCPU.LineColor2 = Settings.Instance.PlotterCPUKernelColor;
- this.plotterCPU.LineColor1 = Settings.Instance.PlotterCPUUserColor;
-
- this.plotterIO.LineColor1 = Settings.Instance.PlotterIOROColor;
- this.plotterIO.LineColor2 = Settings.Instance.PlotterIOWColor;
-
- // Maximum physical memory.
- this.indicatorPhysical.Maximum = _pages;
// Set up the plotter controls.
plotterCPU.Data1 = Program.ProcessProvider.CpuKernelHistory;
@@ -101,7 +108,6 @@ namespace ProcessHacker
"% (K " + (plotterCPU.Data1[i] * 100).ToString("N2") +
"%, U " + (plotterCPU.Data2[i] * 100).ToString("N2") + "%)" + "\n" +
Program.ProcessProvider.TimeHistory[i].ToString();
-
plotterIO.LongData1 = Program.ProcessProvider.IoReadOtherHistory;
plotterIO.LongData2 = Program.ProcessProvider.IoWriteHistory;
plotterIO.GetToolTip = i =>
@@ -109,11 +115,12 @@ namespace ProcessHacker
"R+O: " + Utils.FormatSize(plotterIO.LongData1[i]) + "\n" +
"W: " + Utils.FormatSize(plotterIO.LongData2[i]) + "\n" +
Program.ProcessProvider.TimeHistory[i].ToString();
-
- //plotterMemory.Data1 = Program.ProcessProvider.CommitHistory;
- //plotterMemory.Data2 = Program.ProcessProvider.PhysicalMemoryHistory;
- //plotterMemory.GetToolTip = i => "Commit: " + plotterMemory.Data1[i] + "\n" +
- // "Phys. Memory: " + plotterMemory.Data2[i] + "\n" + Program.ProcessProvider.TimeHistory[i].ToString();
+ plotterMemory.LongData1 = Program.ProcessProvider.CommitHistory;
+ plotterMemory.LongData2 = Program.ProcessProvider.PhysicalMemoryHistory;
+ plotterMemory.GetToolTip = i =>
+ "Commit: " + Utils.FormatSize(plotterMemory.LongData1[i]) + "\n" +
+ "Phys. Memory: " + Utils.FormatSize(plotterMemory.LongData2[i]) + "\n" +
+ Program.ProcessProvider.TimeHistory[i].ToString();
// Create a plotter per CPU.
_cpuPlotters = new Plotter[_noOfCPUs];
@@ -126,8 +133,7 @@ namespace ProcessHacker
Plotter plotter;
tableCPUs.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1.0f / _noOfCPUs));
- _cpuPlotters[i] = plotter = new Plotter();
-
+ _cpuPlotters[i] = plotter = new ProcessHacker.Components.Plotter();
plotter.BackColor = Color.Black;
plotter.Dock = DockStyle.Fill;
plotter.Margin = new Padding(i == 0 ? 0 : 3, 0, 0, 0); // nice spacing
@@ -140,223 +146,252 @@ namespace ProcessHacker
"% (K " + (plotter.Data1[j] * 100).ToString("N2") +
"%, U " + (plotter.Data2[j] * 100).ToString("N2") + "%)" + "\n" +
Program.ProcessProvider.TimeHistory[j].ToString();
-
- this.tableCPUs.Controls.Add(plotter, i, 0);
+ tableCPUs.Controls.Add(plotter, i, 0);
}
- this.checkShowOneGraphPerCPU.Checked = Settings.Instance.ShowOneGraphPerCPU;
+ tableCPUs.Visible = true;
+ tableCPUs.Visible = false;
+ checkShowOneGraphPerCPU.Checked = Settings.Instance.ShowOneGraphPerCPU;
if (_noOfCPUs == 1)
checkShowOneGraphPerCPU.Enabled = false;
- Program.ProcessProvider.Updated += ProcessProvider_Updated;
-
- //We need to do this here or TopMost property gets over-rided by AlwaysOnTopCheckbox
- this.TopMost = Settings.Instance.AlwaysOnTop;
-
this.UpdateGraphs();
this.UpdateInfo();
+
+ Program.ProcessProvider.Updated +=
+ new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
+
+ //We need todo this here or TopMost property gets over-rided
+ //by AlwaysOnTopCheckbox
+ this.SetTopMost();
+ }
+
+ private void SysInfoWindow_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (this.WindowState == FormWindowState.Normal)
+ {
+ Settings.Instance.SysInfoWindowLocation = this.Location;
+ Settings.Instance.SysInfoWindowSize = this.Size;
+ }
+
+ Program.ProcessProvider.Updated -=
+ new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
+ Settings.Instance.ShowOneGraphPerCPU = checkShowOneGraphPerCPU.Checked;
}
private void UpdateGraphs()
{
- switch (this.tabControl1.SelectedIndex)
+ // Update the CPU indicator.
+ indicatorCpu.Data1 = (int)(Program.ProcessProvider.CurrentCpuKernelUsage * indicatorCpu.Maximum);
+ indicatorCpu.Data2 = (int)(Program.ProcessProvider.CurrentCpuUserUsage * indicatorCpu.Maximum);
+ indicatorCpu.TextValue = (Program.ProcessProvider.CurrentCpuUsage * 100).ToString("F2") + "%";
+
+ // Update the I/O indicator.
+ int count = plotterIO.Width / plotterIO.EffectiveMoveStep;
+ long maxRO = Program.ProcessProvider.IoReadOtherHistory.Take(count).Max();
+ long maxW = Program.ProcessProvider.IoWriteHistory.Take(count).Max();
+ if(maxRO>maxW)
+ indicatorIO.Maximum = maxRO;
+ else
+ indicatorIO.Maximum = maxW;
+ indicatorIO.Data1 = Program.ProcessProvider.IoReadOtherHistory[0];
+ indicatorIO.TextValue = Utils.FormatSize(Program.ProcessProvider.IoReadOtherHistory[0]);
+
+ // Update the plotter settings.
+ plotterIO.LongData1 = Program.ProcessProvider.IoReadOtherHistory;
+ plotterIO.LongData2 = Program.ProcessProvider.IoWriteHistory;
+
+ plotterCPU.LineColor1 = Settings.Instance.PlotterCPUKernelColor;
+ plotterCPU.LineColor2 = Settings.Instance.PlotterCPUUserColor;
+ plotterIO.LineColor1 = Settings.Instance.PlotterIOROColor;
+ plotterIO.LineColor2 = Settings.Instance.PlotterIOWColor;
+ plotterMemory.LineColor1 = Settings.Instance.PlotterMemoryPrivateColor;
+ plotterMemory.LineColor2 = Settings.Instance.PlotterMemoryWSColor;
+
+ for (int i = 0; i < _cpuPlotters.Length; i++)
{
- case 0:
- {
- // Update the CPU indicator.
- this.indicatorCpu.Data1 = (int)(Program.ProcessProvider.CurrentCpuKernelUsage * this.indicatorCpu.Maximum);
- this.indicatorCpu.Data2 = (int)(Program.ProcessProvider.CurrentCpuUserUsage * this.indicatorCpu.Maximum);
- this.indicatorCpu.TextValue = (Program.ProcessProvider.CurrentCpuUsage * 100).ToString("F2") + "%";
-
- // Update the I/O indicator.
- int count = this.plotterIO.Width / this.plotterIO.EffectiveMoveStep;
- long maxRO = Program.ProcessProvider.IoReadOtherHistory.Take(count).Max();
- long maxW = Program.ProcessProvider.IoWriteHistory.Take(count).Max();
-
- if (maxRO > maxW)
- this.indicatorIO.Maximum = maxRO;
- else
- this.indicatorIO.Maximum = maxW;
-
- this.indicatorIO.Data1 = Program.ProcessProvider.IoReadOtherHistory[0];
- this.indicatorIO.TextValue = Utils.FormatSize(Program.ProcessProvider.IoReadOtherHistory[0]);
-
- // Update the plotter settings.
- this.plotterIO.LongData1 = Program.ProcessProvider.IoReadOtherHistory;
- this.plotterIO.LongData2 = Program.ProcessProvider.IoWriteHistory;
-
- if (this.checkShowOneGraphPerCPU.Checked)
- {
- for (int i = 0; i < _cpuPlotters.Length; i++)
- {
- _cpuPlotters[i].LineColor2 = Settings.Instance.PlotterCPUKernelColor;
- _cpuPlotters[i].LineColor1 = Settings.Instance.PlotterCPUUserColor;
- _cpuPlotters[i].Text = ((_cpuPlotters[i].Data1[0] + _cpuPlotters[i].Data2[0]) * 100).ToString("F2") + "% (K: " + (_cpuPlotters[i].Data1[0] * 100).ToString("F2") + "%, U: " + (_cpuPlotters[i].Data2[0] * 100).ToString("F2") + "%)";
- _cpuPlotters[i].MoveGrid();
- _cpuPlotters[i].Draw();
- }
- }
-
- this.plotterCPU.Text = ((plotterCPU.Data1[0] + plotterCPU.Data2[0]) * 100).ToString("F2") + "% (K: " + (plotterCPU.Data1[0] * 100).ToString("F2") + "%, U: " + (plotterCPU.Data2[0] * 100).ToString("F2") + "%)";
-
- // update the I/O graph text
- this.plotterIO.Text = "R+O: " + Utils.FormatSize(plotterIO.LongData1[0]) + ", W: " + Utils.FormatSize(plotterIO.LongData2[0]);
-
- this.plotterCPU.MoveGrid();
- this.plotterIO.MoveGrid();
-
- this.plotterCPU.Draw();
- this.plotterIO.Draw();
-
- this.trackerCommit.Draw();
- this.trackerMemory.Draw();
-
- break;
- }
+ _cpuPlotters[i].LineColor1 = Settings.Instance.PlotterCPUKernelColor;
+ _cpuPlotters[i].LineColor2 = Settings.Instance.PlotterCPUUserColor;
+ _cpuPlotters[i].Text = ((_cpuPlotters[i].Data1[0] + _cpuPlotters[i].Data2[0]) * 100).ToString("F2") +
+ "% (K: " + (_cpuPlotters[i].Data1[0] * 100).ToString("F2") +
+ "%, U: " + (_cpuPlotters[i].Data2[0] * 100).ToString("F2") + "%)";
+ _cpuPlotters[i].MoveGrid();
+ _cpuPlotters[i].Draw();
}
+
+ plotterCPU.Text = ((plotterCPU.Data1[0] + plotterCPU.Data2[0]) * 100).ToString("F2") +
+ "% (K: " + (plotterCPU.Data1[0] * 100).ToString("F2") +
+ "%, U: " + (plotterCPU.Data2[0] * 100).ToString("F2") + "%)";
+
+ // update the I/O graph text
+ plotterIO.Text = "R+O: " + Utils.FormatSize(plotterIO.LongData1[0]) +
+ ", W: " + Utils.FormatSize(plotterIO.LongData2[0]);
+
+ // update the memory graph text
+ plotterMemory.Text = "Commit: " + Utils.FormatSize(plotterMemory.LongData1[0]) +
+ ", Phys. Mem: " + Utils.FormatSize(plotterMemory.LongData2[0]);
+
+ plotterCPU.MoveGrid();
+ plotterCPU.Draw();
+ plotterIO.MoveGrid();
+ plotterIO.Draw();
+ plotterMemory.MoveGrid();
+ plotterMemory.Draw();
+ }
+
+ private unsafe void GetPoolLimits(out int paged, out int nonPaged)
+ {
+ int pagedLocal, nonPagedLocal;
+ int retLength;
+
+ // Read the two variables, stored in kernel-mode memory.
+ KProcessHacker.Instance.KphReadVirtualMemoryUnsafe(
+ ProcessHacker.Native.Objects.ProcessHandle.Current,
+ _mmSizeOfPagedPoolInBytes.ToInt32(),
+ &pagedLocal,
+ sizeof(int),
+ out retLength
+ );
+ KProcessHacker.Instance.KphReadVirtualMemoryUnsafe(
+ ProcessHacker.Native.Objects.ProcessHandle.Current,
+ _mmMaximumNonPagedPoolInBytes.ToInt32(),
+ &nonPagedLocal,
+ sizeof(int),
+ out retLength
+ );
+
+ paged = pagedLocal;
+ nonPaged = nonPagedLocal;
}
private void UpdateInfo()
{
- SystemPerformanceInformation perfInfo = Program.ProcessProvider.Performance;
+ var perfInfo = Program.ProcessProvider.Performance;
+ var info = new PerformanceInformation();
+
+ Win32.GetPerformanceInfo(out info, System.Runtime.InteropServices.Marshal.SizeOf(info));
+
+ SystemCacheInformation cacheInfo;
int retLen;
- PerformanceInformation info;
- SystemCacheInformation cacheInfo;
+ Win32.NtQuerySystemInformation(SystemInformationClass.SystemFileCacheInformation,
+ out cacheInfo, Marshal.SizeOf(typeof(SystemCacheInformation)), out retLen);
- Win32.GetPerformanceInfo(out info, PerformanceInformation.SizeOf);
- Win32.NtQuerySystemInformation(SystemInformationClass.SystemFileCacheInformation, out cacheInfo, SystemCacheInformation.SizeOf, out retLen);
+ // Totals
+ labelTotalsProcesses.Text = ((ulong)info.ProcessCount).ToString("N0");
+ labelTotalsThreads.Text = ((ulong)info.ThreadCount).ToString("N0");
+ labelTotalsHandles.Text = ((ulong)info.HandlesCount).ToString("N0");
+ labelTotalsUptime.Text = Utils.FormatLongTimeSpan(Windows.GetUptime());
- string physMemText = Utils.FormatSize((_pages - perfInfo.AvailablePages) * _pageSize);
+ // Commit
+ labelCCC.Text = Utils.FormatSize((ulong)perfInfo.CommittedPages * _pageSize);
+ labelCCP.Text = Utils.FormatSize((ulong)perfInfo.PeakCommitment * _pageSize);
+ labelCCL.Text = Utils.FormatSize((ulong)perfInfo.CommitLimit * _pageSize);
- string commitText = Utils.FormatSize(perfInfo.CommittedPages * _pageSize);
-
- switch (this.tabControl1.SelectedIndex)
+ // Physical Memory
+ string physMemText = Utils.FormatSize((ulong)(_pages - perfInfo.AvailablePages) * _pageSize);
+
+ labelPMC.Text = physMemText;
+ labelPSC.Text = Utils.FormatSize((ulong)info.SystemCache * _pageSize);
+ labelPMT.Text = Utils.FormatSize((ulong)_pages * _pageSize);
+
+ // Update the physical memory indicator here because we have perfInfo available.
+
+ indicatorPhysical.Data1 = _pages - perfInfo.AvailablePages;
+ indicatorPhysical.TextValue = physMemText;
+
+ // File cache
+ labelCacheCurrent.Text = Utils.FormatSize(cacheInfo.SystemCacheWsSize);
+ labelCachePeak.Text = Utils.FormatSize(cacheInfo.SystemCacheWsPeakSize);
+ labelCacheMinimum.Text = Utils.FormatSize((ulong)cacheInfo.SystemCacheWsMinimum * _pageSize);
+ labelCacheMaximum.Text = Utils.FormatSize((ulong)cacheInfo.SystemCacheWsMaximum * _pageSize);
+
+ // Paged/Non-paged pools
+ labelKPPPU.Text = Utils.FormatSize((ulong)perfInfo.ResidentPagedPoolPage * _pageSize);
+ labelKPPVU.Text = Utils.FormatSize((ulong)perfInfo.PagedPoolPages * _pageSize);
+ labelKPPA.Text = ((ulong)perfInfo.PagedPoolAllocs).ToString("N0");
+ labelKPPF.Text = ((ulong)perfInfo.PagedPoolFrees).ToString("N0");
+ labelKPNPU.Text = Utils.FormatSize((ulong)perfInfo.NonPagedPoolPages * _pageSize);
+ labelKPNPA.Text = ((ulong)perfInfo.NonPagedPoolAllocs).ToString("N0");
+ labelKPNPF.Text = ((ulong)perfInfo.NonPagedPoolFrees).ToString("N0");
+
+ // Get the pool limits
+ long pagedLimit = 0;
+ long nonPagedLimit = 0;
+
+ if (
+ _mmSizeOfPagedPoolInBytes != IntPtr.Zero &&
+ _mmMaximumNonPagedPoolInBytes != IntPtr.Zero &&
+ KProcessHacker.Instance != null
+ )
{
- case 0:
- {
- // Update the physical memory indicator here because we have perfInfo available.
- this.indicatorPhysical.Data1 = _pages - perfInfo.AvailablePages;
- this.indicatorPhysical.TextValue = physMemText;
+ try
+ {
+ int pl, npl;
- long memCount = (Program.ProcessProvider.System.NumberOfPhysicalPages - Program.ProcessProvider.Performance.AvailablePages) * Program.ProcessProvider.System.PageSize;
-
- this.trackerMemory.Text = "Phys. Mem: " + Utils.FormatSize(memCount) + " / " + Utils.FormatSize((long)info.PhysicalTotal * (long)info.PageSize);
- this.trackerCommit.Text =
- "Commit: " +
- Utils.FormatSize(Program.ProcessProvider.Performance.CommittedPages * Program.ProcessProvider.System.PageSize)
- + " / " + Utils.FormatSize(Program.ProcessProvider.Performance.CommitLimit * Program.ProcessProvider.System.PageSize);
- this.indicatorCommit.Color1 = Settings.Instance.PlotterMemoryWSColor;
- this.indicatorCommit.TextValue = commitText;
- this.indicatorCommit.Maximum = Program.ProcessProvider.Performance.CommitLimit * Program.ProcessProvider.System.PageSize;
- this.indicatorCommit.Data1 = Program.ProcessProvider.Performance.CommittedPages * Program.ProcessProvider.System.PageSize;
- break;
- }
- case 1:
- {
- // Totals
- this.labelTotalsProcesses.Text = info.ProcessCount.ToString("N0");
- this.labelTotalsThreads.Text = info.ThreadCount.ToString("N0");
- this.labelTotalsHandles.Text = info.HandlesCount.ToString("N0");
- this.labelTotalsUptime.Text = Utils.FormatLongTimeSpan(Windows.GetUptime());
-
- // Commit
- this.labelCCC.Text = commitText;
- this.labelCCP.Text = Utils.FormatSize(perfInfo.PeakCommitment * _pageSize);
- this.labelCCL.Text = Utils.FormatSize(perfInfo.CommitLimit * _pageSize);
-
- // Physical Memory
- this.labelPMC.Text = physMemText;
- this.labelPSC.Text = Utils.FormatSize(info.SystemCache.ToInt32() * _pageSize);
- this.labelPMT.Text = Utils.FormatSize(_pages * _pageSize);
-
- // File cache
- this.labelCacheCurrent.Text = Utils.FormatSize(cacheInfo.SystemCacheWsSize);
- this.labelCachePeak.Text = Utils.FormatSize(cacheInfo.SystemCacheWsPeakSize);
- this.labelCacheMinimum.Text = Utils.FormatSize(cacheInfo.SystemCacheWsMinimum.ToInt32() * _pageSize);
- this.labelCacheMaximum.Text = Utils.FormatSize(cacheInfo.SystemCacheWsMaximum.ToInt32() * _pageSize);
-
- // Paged/Non-paged pools
- this.labelKPPPU.Text = Utils.FormatSize(perfInfo.ResidentPagedPoolPage * _pageSize);
- this.labelKPPVU.Text = Utils.FormatSize(perfInfo.PagedPoolPages * _pageSize);
- this.labelKPPA.Text = ((ulong)perfInfo.PagedPoolAllocs).ToString("N0");
- this.labelKPPF.Text = ((ulong)perfInfo.PagedPoolFrees).ToString("N0");
- this.labelKPNPU.Text = Utils.FormatSize(perfInfo.NonPagedPoolPages * _pageSize);
- this.labelKPNPA.Text = ((ulong)perfInfo.NonPagedPoolAllocs).ToString("N0");
- this.labelKPNPF.Text = ((ulong)perfInfo.NonPagedPoolFrees).ToString("N0");
-
- // Get the pool limits
- // long pagedLimit = 0;
- // long nonPagedLimit = 0;
-
- //if (_mmSizeOfPagedPoolInBytes != IntPtr.Zero && _mmMaximumNonPagedPoolInBytes != IntPtr.Zero && KProcessHacker.Instance != null)
- //{
- // int pl, npl;
-
- // this.GetPoolLimits(out pl, out npl);
- // pagedLimit = pl;
- // nonPagedLimit = npl;
- //}
-
- //if (pagedLimit != 0)
- //labelKPPL.Text = Utils.FormatSize(pagedLimit);
- //else
- this.labelKPPL.Text = "no symbols";
-
- // if (nonPagedLimit != 0)
- // labelKPNPL.Text = Utils.FormatSize(nonPagedLimit);
- // else
- this.labelKPNPL.Text = "no symbols";
-
- // Page faults
- this.labelPFTotal.Text = ((ulong)perfInfo.PageFaultCount).ToString("N0");
- this.labelPFCOW.Text = ((ulong)perfInfo.CopyOnWriteCount).ToString("N0");
- this.labelPFTrans.Text = ((ulong)perfInfo.TransitionCount).ToString("N0");
- this.labelPFCacheTrans.Text = ((ulong)perfInfo.CacheTransitionCount).ToString("N0");
- this.labelPFDZ.Text = ((ulong)perfInfo.CacheTransitionCount).ToString("N0");
- this.labelPFCache.Text = ((ulong)cacheInfo.SystemCacheWsFaults).ToString("N0");
-
- // I/O
- this.labelIOR.Text = ((ulong)perfInfo.IoReadOperationCount).ToString("N0");
- this.labelIORB.Text = Utils.FormatSize(perfInfo.IoReadTransferCount);
- this.labelIOW.Text = ((ulong)perfInfo.IoWriteOperationCount).ToString("N0");
- this.labelIOWB.Text = Utils.FormatSize(perfInfo.IoWriteTransferCount);
- this.labelIOO.Text = ((ulong)perfInfo.IoOtherOperationCount).ToString("N0");
- this.labelIOOB.Text = Utils.FormatSize(perfInfo.IoOtherTransferCount);
-
- // CPU
- this.labelCPUContextSwitches.Text = ((ulong)perfInfo.ContextSwitches).ToString("N0");
- this.labelCPUInterrupts.Text = ((ulong)Program.ProcessProvider.ProcessorPerf.InterruptCount).ToString("N0");
- this.labelCPUSystemCalls.Text = ((ulong)perfInfo.SystemCalls).ToString("N0");
- break;
- }
+ this.GetPoolLimits(out pl, out npl);
+ pagedLimit = pl;
+ nonPagedLimit = npl;
+ }
+ catch
+ { }
}
+
+ if (pagedLimit != 0)
+ labelKPPL.Text = Utils.FormatSize(pagedLimit);
+ else if (KProcessHacker.Instance == null)
+ labelKPPL.Text = "no driver";
+ else
+ labelKPPL.Text = "no symbols";
+
+ if (nonPagedLimit != 0)
+ labelKPNPL.Text = Utils.FormatSize(nonPagedLimit);
+ else if (KProcessHacker.Instance == null)
+ labelKPNPL.Text = "no driver";
+ else
+ labelKPNPL.Text = "no symbols";
+
+ // Page faults
+ labelPFTotal.Text = ((ulong)perfInfo.PageFaultCount).ToString("N0");
+ labelPFCOW.Text = ((ulong)perfInfo.CopyOnWriteCount).ToString("N0");
+ labelPFTrans.Text = ((ulong)perfInfo.TransitionCount).ToString("N0");
+ labelPFCacheTrans.Text = ((ulong)perfInfo.CacheTransitionCount).ToString("N0");
+ labelPFDZ.Text = ((ulong)perfInfo.CacheTransitionCount).ToString("N0");
+ labelPFCache.Text = ((ulong)cacheInfo.SystemCacheWsFaults).ToString("N0");
+
+ // I/O
+ labelIOR.Text = ((ulong)perfInfo.IoReadOperationCount).ToString("N0");
+ labelIORB.Text = Utils.FormatSize(perfInfo.IoReadTransferCount);
+ labelIOW.Text = ((ulong)perfInfo.IoWriteOperationCount).ToString("N0");
+ labelIOWB.Text = Utils.FormatSize(perfInfo.IoWriteTransferCount);
+ labelIOO.Text = ((ulong)perfInfo.IoOtherOperationCount).ToString("N0");
+ labelIOOB.Text = Utils.FormatSize(perfInfo.IoOtherTransferCount);
+
+ // CPU
+ labelCPUContextSwitches.Text = ((ulong)perfInfo.ContextSwitches).ToString("N0");
+ labelCPUInterrupts.Text = ((ulong)Program.ProcessProvider.ProcessorPerf.InterruptCount).ToString("N0");
+ labelCPUSystemCalls.Text = ((ulong)perfInfo.SystemCalls).ToString("N0");
}
private void ProcessProvider_Updated()
{
- if (this.InvokeRequired)
- this.BeginInvoke(new Action(this.ProcessProvider_Updated));
- else
+ this.BeginInvoke(new MethodInvoker(delegate
{
this.UpdateGraphs();
this.UpdateInfo();
- }
+ }));
}
private void checkShowOneGraphPerCPU_CheckedChanged(object sender, EventArgs e)
{
- if (this.checkShowOneGraphPerCPU.Checked)
+ if (checkShowOneGraphPerCPU.Checked)
{
- this.tableCPUs.Visible = true;
-
- //force a redraw, TODO: only required once.
- this.UpdateGraphs();
+ tableCPUs.Visible = true;
}
else
{
- this.tableCPUs.Visible = false;
+ tableCPUs.Visible = false;
}
}
@@ -364,19 +399,5 @@ namespace ProcessHacker
{
this.TopMost = checkAlwaysOnTop.Checked;
}
-
- private void SysInfoWindow_FormClosing(object sender, FormClosingEventArgs e)
- {
- //if (this.WindowState == FormWindowState.Normal)
- //Settings.Instance.SysInfoWindowBounds = this.DesktopBounds;
-
- Program.ProcessProvider.Updated -= this.ProcessProvider_Updated;
- Settings.Instance.ShowOneGraphPerCPU = checkShowOneGraphPerCPU.Checked;
- }
-
- private void CloseButton_Click(object sender, EventArgs e)
- {
- this.Close();
- }
}
}
diff --git a/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.resx b/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.resx
index 0af958e10..4283d8b1c 100644
--- a/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/SysInfoWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
AAABAAwAMDAQAAEABABoBgAAxgAAACAgEAABAAQA6AIAAC4HAAAYGBAAAQAEAOgBAAAWCgAAEBAQAAEA
diff --git a/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.Designer.cs
index 32027a993..4706d16e3 100644
--- a/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.Designer.cs
@@ -1,6 +1,4 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
partial class TerminatorWindow
{
@@ -33,9 +31,9 @@ namespace ProcessHacker
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TerminatorWindow));
this.labelProgress = new System.Windows.Forms.Label();
- this.listTests = new ProcessHacker.Components.ExtendedListView();
- this.columnID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listTests = new System.Windows.Forms.ListView();
+ this.columnID = new System.Windows.Forms.ColumnHeader();
+ this.columnDescription = new System.Windows.Forms.ColumnHeader();
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.buttonRun = new System.Windows.Forms.Button();
this.SuspendLayout();
@@ -45,7 +43,7 @@ namespace ProcessHacker
this.labelProgress.AutoSize = true;
this.labelProgress.Location = new System.Drawing.Point(12, 9);
this.labelProgress.Name = "labelProgress";
- this.labelProgress.Size = new System.Drawing.Size(55, 13);
+ this.labelProgress.Size = new System.Drawing.Size(53, 13);
this.labelProgress.TabIndex = 0;
this.labelProgress.Text = "Message.";
//
@@ -54,7 +52,6 @@ namespace ProcessHacker
this.listTests.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnID,
this.columnDescription});
- this.listTests.DoubleClickChecks = true;
this.listTests.FullRowSelect = true;
this.listTests.Location = new System.Drawing.Point(12, 38);
this.listTests.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
@@ -100,7 +97,6 @@ namespace ProcessHacker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(466, 437);
this.Controls.Add(this.buttonRun);
this.Controls.Add(this.listTests);
@@ -122,7 +118,7 @@ namespace ProcessHacker
#endregion
private System.Windows.Forms.Label labelProgress;
- private ExtendedListView listTests;
+ private System.Windows.Forms.ListView listTests;
private System.Windows.Forms.Button buttonRun;
private System.Windows.Forms.ColumnHeader columnDescription;
private System.Windows.Forms.ImageList imageList;
diff --git a/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.cs b/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.cs
index 13a9aa32d..f80860b81 100644
--- a/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.cs
@@ -33,13 +33,12 @@ namespace ProcessHacker
{
public partial class TerminatorWindow : Form
{
- private readonly int _pid;
- private readonly List _tests = new List();
+ private int _pid;
+ private List _tests = new List();
public TerminatorWindow(int PID)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
@@ -63,7 +62,7 @@ namespace ProcessHacker
this.AddTest("TD1", "Debugs the process and closes the debug object");
this.AddTest("TP3", "Terminates the process in kernel-mode (if possible)");
this.AddTest("TT3", "Terminates the process' threads in kernel-mode (if possible)");
- if (KProcessHacker2.Instance != null)
+ if (KProcessHacker.Instance != null)
this.AddTest("TT4", "Terminates the process' threads using a dangerous kernel-mode method");
this.AddTest("M1", "Writes garbage to the process' memory regions");
this.AddTest("M2", "Sets the page protection of the process' memory regions to PAGE_NOACCESS");
@@ -162,13 +161,15 @@ namespace ProcessHacker
this.M1Internal();
}
- private void M1Internal()
+ private unsafe void M1Internal()
{
using (MemoryAlloc alloc = new MemoryAlloc(0x1000))
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation | Program.MinProcessWriteMemoryRights))
+ using (ProcessHandle phandle = new ProcessHandle(_pid,
+ ProcessAccess.QueryInformation |
+ Program.MinProcessWriteMemoryRights))
{
- phandle.EnumMemory(info =>
+ phandle.EnumMemory((info) =>
{
for (int i = 0; i < info.RegionSize.ToInt32(); i += 0x1000)
{
@@ -188,9 +189,10 @@ namespace ProcessHacker
private void M2()
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation | ProcessAccess.VmOperation))
+ using (ProcessHandle phandle = new ProcessHandle(_pid,
+ ProcessAccess.QueryInformation | ProcessAccess.VmOperation))
{
- phandle.EnumMemory(info =>
+ phandle.EnumMemory((info) =>
{
phandle.ProtectMemory(info.BaseAddress, info.RegionSize.ToInt32(), MemoryProtection.NoAccess);
return true;
@@ -200,38 +202,43 @@ namespace ProcessHacker
private void TD1()
{
- using (DebugObjectHandle dhandle = DebugObjectHandle.Create(DebugObjectAccess.ProcessAssign, DebugObjectFlags.KillOnClose))
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.SuspendResume))
+ using (var dhandle =
+ DebugObjectHandle.Create(DebugObjectAccess.ProcessAssign, DebugObjectFlags.KillOnClose))
{
- phandle.Debug(dhandle);
+ using (var phandle = new ProcessHandle(_pid, ProcessAccess.SuspendResume))
+ phandle.Debug(dhandle);
}
-
}
private void TJ1()
{
- //if (KProcessHacker.Instance != null)
- //{
- // try
- // {
- // using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- // {
- // JobObjectHandle jhandle = phandle.GetJobObject(JobObjectAccess.Query | JobObjectAccess.Terminate);
-
- // // Make sure we're not terminating more than one process
- // if (jhandle.ProcessIdList.Length == 1)
- // {
- // jhandle.Terminate();
- // }
- // }
- // }
- // catch
- // { }
- //}
-
- using (JobObjectHandle jhandle = JobObjectHandle.Create(JobObjectAccess.AssignProcess | JobObjectAccess.Terminate))
+ if (KProcessHacker.Instance != null)
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.SetQuota | ProcessAccess.Terminate))
+ try
+ {
+ using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
+ {
+ var jhandle = phandle.GetJobObject(JobObjectAccess.Query | JobObjectAccess.Terminate);
+
+ if (jhandle != null)
+ {
+ // Make sure we're not terminating more than one process
+ if (jhandle.GetProcessIdList().Length == 1)
+ {
+ jhandle.Terminate();
+ return;
+ }
+ }
+ }
+ }
+ catch
+ { }
+ }
+
+ using (var jhandle = JobObjectHandle.Create(JobObjectAccess.AssignProcess | JobObjectAccess.Terminate))
+ {
+ using (ProcessHandle phandle =
+ new ProcessHandle(_pid, ProcessAccess.SetQuota | ProcessAccess.Terminate))
{
phandle.AssignToJobObject(jhandle);
}
@@ -261,7 +268,7 @@ namespace ProcessHacker
{
phandle = phandle.GetNextProcess(Program.MinProcessQueryRights | ProcessAccess.Terminate);
- if (phandle.ProcessId == _pid)
+ if (phandle.GetProcessId() == _pid)
{
found = true;
break;
@@ -277,7 +284,8 @@ namespace ProcessHacker
private void TP2()
{
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.CreateThread | ProcessAccess.VmOperation | ProcessAccess.VmWrite))
+ using (ProcessHandle phandle = new ProcessHandle(_pid,
+ ProcessAccess.CreateThread | ProcessAccess.VmOperation | ProcessAccess.VmWrite))
{
if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
{
@@ -378,20 +386,20 @@ namespace ProcessHacker
private void W1()
{
- WindowHandle.Enumerate(window =>
- {
- if (window.ClientId.ProcessId == _pid)
- window.PostMessage(WindowMessage.Destroy, 0, 0);
+ WindowHandle.Enumerate((window) =>
+ {
+ if (window.GetClientId().ProcessId == _pid)
+ window.PostMessage(WindowMessage.Destroy, 0, 0);
- return true;
- });
+ return true;
+ });
}
private void W2()
{
- WindowHandle.Enumerate(window =>
+ WindowHandle.Enumerate((window) =>
{
- if (window.ClientId.ProcessId == _pid)
+ if (window.GetClientId().ProcessId == _pid)
window.PostMessage(WindowMessage.Quit, 0, 0);
return true;
diff --git a/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.resx b/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.resx
index b7fe4b4d4..009bf9b6f 100644
--- a/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/TerminatorWindow.resx
@@ -112,46 +112,46 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
- AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAi
- BwAAAk1TRnQBSQFMAgEBAgEAAQwBAAEMAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
- AwABEAMAAQEBAAEgBgABEP8AJwADBwEKAwUBBzAAAyoBQQMGAQgYAAMGAQgDKgFBnAADBwEKAS8BgwE1
- Af8BMgFkATIB+wMFAQcoAAMqAUEBRwFEAfIB/wJAAdYB/QMGAQgQAAMGAQgBKwEqAcUB/AEpAScB6gH/
- AyoBQZQAAwcBCgE4AY4BPwH/AUwBowFUAf8BRwGfAU8B/wEyAXwBOAH+AwYBCCAAAyoBQQFQAU4B9QH/
- AVsBWQH6Af8BUAFNAfYB/wE5ATgBywH8AwYBCAgAAwYBCAIrAccB/AE5ATcB8QH/AUQBQgH2Af8BKQEn
- AeoB/wMqAUGMAAMHAQoBQQGaAUkB/wFTAawBXAH/AW8BygGCAf8BbAHIAXYB/wFJAaABUQH/ATMBfQE5
- Af4DBgEIHAADHgErAVMBUAH2Af8BXQFaAfoB/wFpAWgC/wFRAU4B9gH/ATkBOAHLAfwDBgEIAwYBCAEu
- ASsByAH8AT8BPQHyAf8BWwFaAv8BQgFAAfQB/wEnASUB6QH/Ax4BK4gAAwcBCgFJAaYBUgH/AVsBtQFl
- Af8BdgHOAYkB/wFzAcwBhwH/AW4BygGBAf8BbgHJAYEB/wFKAaIBUgH/ATQBfgE6Af4DBgEIHAADHgEr
- AVMBUQH2Af8BXgFbAfoB/wFsAWkC/wFSAVAB9gH/AToBOQHLAfwCQAHVAf0BSAFFAfQB/wFgAV8C/wFI
- AUYB9QH/AS4BLAHrAf8DHgEriAADBwEJAVEBsAFbAf8BYwG9AW4B/wGEAdIBkAH/AXIByQGFAf8BWAGy
- AWIB/wFbAbQBZQH/AXAByQGDAf8BcAHLAYIB/wFLAaMBVAH/ATwBcQFAAf0DBgEIHAADHgErAVQBUgH2
- Af8BXwFcAfoB/wFsAWoC/wFrAWgC/wFoAWYC/wFmAWQC/wFPAU0B9wH/ATcBNQHuAf8DHgErjAADLQFG
- AVoBawFhAeQBcQHJAYYB/wGAAc4BjQH/AUIBjwFPAfwDQAFvA0oBiwFUAa0BXwH/AXQBzAGGAf8BcQHL
- AYUB/wFMAaQBVQH/AS4BdwE0AfwDBgEIHAADHgErAVUBUwH3Af8BcQFuAv8BUQFOAv8BTwFMAv8BagFo
- Av8BQAE+AfAB/wMeASuUAAMoATwBYQFzAWEB5gFlAcABcQH/A0ABbwgAAUwCTQGRAVYBrgFgAf8BdQHN
- AYkB/wF0Ac0BhwH/AU4BpQFXAf8BLwF4ATUB/AMGAQgYAAMGAQgBUQFQAd8B/QF1AXEC/wFWAVMC/wFT
- AVAC/wFuAWwC/wJAAdgB/QMGAQiYAAMsAUMDOwFlEAABTAJNAZEBVwGvAWEB/wF3Ac4BigH/AXYBzgGJ
- Af8BTwGmAVgB/wEwAXgBNgH8AwYBCBAAAwYBCAFeAVsB0gH8AWgBZQH7Af8BgAF2Av8BdgFzAv8BdAFx
- Av8BcQFvAv8BVgFUAfcB/wE8AToBzAH8AwYBCLAAAUwCTQGRAVgBsAFiAf8BgQHPAY0B/wF3Ac8BiwH/
- AVABpwFZAf8BMQGFATgB/wMGAQgIAAMGAQgBZgFjAdUB/AFvAWwB/QH/AYYBggL/AW4BawH8Af8BXAFa
- AfgB/wFYAVUB9wH/AWUBYgH6Af8BcwFxAv8BWAFVAfcB/wE8ATsBzAH8AwYBCLAAAUwCTQGRAVoBsgFk
- Af8BggHRAY8B/wFyAcgBhQH/AU8BpgFYAf8DRAF7BAADBgEIAWUBYgHnAf0BdQFyAf4B/wGKAYcC/wF0
- AXEB/QH/AWQBYQH7Af8DHgErAx4BKwFZAVYB+AH/AWYBZAH6Af8BdQFyAv8BWQFXAfcB/wE9ATsBzQH8
- AwQBBbAAA00BkQFbAbMBZQH/AVcBrwFhAf8DRAF5CAADFgEfAXIBbwL/AYEBdgL/AYEBdgH+Af8BbAFp
- Af0B/wMeASsIAAMeASsBWgFXAfgB/wFnAWUB+wH/AXYBdAL/AVoBVwH4Af8DQAFvAwEBArAAA00BkQNG
- AX8QAAMWAR8BcgFvAv8BcQFuAf4B/wMeASsQAAMeASsBXAFZAfgB/wFiAWAB+QH/AVMBUgFTAagDHQEp
+ BwAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
+ AwABEAMAAQEBAAEgBgABEP8AJwADBwEKAwUBBzAAAyoBQQMGAQgYAAMGAQgDKgFBnAADBwEKATABgwE2
+ Af8BMgFnATIB+wMFAQcoAAMqAUEBSAFFAfIB/wJAAdkB/QMGAQgQAAMGAQgBKwEpAcgB/AEqASgB6gH/
+ AyoBQZQAAwcBCgE5AY4BQAH/AU0BowFVAf8BSAGfAVAB/wEyAXwBOAH+AwYBCCAAAyoBQQFRAU8B9QH/
+ AVwBWgH6Af8BUQFOAfYB/wE6ATkBzgH8AwYBCAgAAwYBCAIrAcoB/AE6ATgB8QH/AUUBQwH2Af8BKgEo
+ AeoB/wMqAUGMAAMHAQoBQgGaAUoB/wFUAawBXQH/AXABygGCAf8BbQHIAXcB/wFKAaABUgH/ATMBfQE5
+ Af4DBgEIHAADHgErAVQBUQH2Af8BXgFbAfoB/wFqAWkC/wFSAU8B9gH/AToBOQHOAfwDBgEIAwYBCAEv
+ ASwBywH8AUABPgHyAf8BXAFbAv8BQwFBAfQB/wEoASYB6QH/Ax4BK4gAAwcBCgFKAaYBUwH/AVwBtQFm
+ Af8BdwHOAYkB/wF0AcwBhwH/AW8BygGBAf8BbwHJAYEB/wFLAaIBUwH/ATQBfgE6Af4DBgEIHAADHgEr
+ AVQBUgH2Af8BXwFcAfoB/wFtAWoC/wFTAVEB9gH/ATsBOgHOAfwCQAHYAf0BSQFGAfQB/wFhAWAC/wFJ
+ AUcB9QH/AS8BLQHrAf8DHgEriAADBwEJAVIBsAFcAf8BZAG9AW8B/wGEAdIBkAH/AXMByQGFAf8BWQGy
+ AWMB/wFcAbQBZgH/AXEByQGDAf8BcQHLAYIB/wFMAaMBVQH/ATsBcwFAAf0DBgEIHAADHgErAVUBUwH2
+ Af8BYAFdAfoB/wFtAWsC/wFsAWkC/wFpAWcC/wFnAWUC/wFQAU4B9wH/ATgBNgHuAf8DHgErjAADLQFG
+ AVoBcAFhAeQBcgHJAYYB/wGAAc4BjQH/AUQBkgFRAfwDQAFvA0oBiwFVAa0BYAH/AXUBzAGGAf8BcgHL
+ AYUB/wFNAaQBVgH/AS8BeAE1AfwDBgEIHAADHgErAVYBVAH3Af8BcgFvAv8BUgFPAv8BUAFNAv8BawFp
+ Av8BQQE/AfAB/wMeASuUAAMoATwBYQF4AWEB5gFmAcABcgH/A0ABbwgAAUwCTQGRAVcBrgFhAf8BdgHN
+ AYkB/wF1Ac0BhwH/AU8BpQFYAf8BMAF5ATYB/AMGAQgYAAMGAQgBUgFRAeIB/QF2AXIC/wFXAVQC/wFU
+ AVEC/wFvAW0C/wJAAdsB/QMGAQiYAAMsAUMDOwFlEAABTAJNAZEBWAGvAWIB/wF4Ac4BigH/AXcBzgGJ
+ Af8BUAGmAVkB/wExAXkBNwH8AwYBCBAAAwYBCAFfAVwB1wH8AWkBZgH7Af8BgAF3Av8BdwF0Av8BdQFy
+ Av8BcgFwAv8BVwFVAfcB/wE9ATsBzwH8AwYBCLAAAUwCTQGRAVkBsAFjAf8BgQHPAY0B/wF4Ac8BiwH/
+ AVEBpwFaAf8BMgGFATkB/wMGAQgIAAMGAQgBZwFkAdoB/AFwAW0B/QH/AYYBggL/AW8BbAH8Af8BXQFb
+ AfgB/wFZAVYB9wH/AWYBYwH6Af8BdAFyAv8BWQFWAfcB/wE9ATwBzwH8AwYBCLAAAUwCTQGRAVsBsgFl
+ Af8BggHRAY8B/wFzAcgBhQH/AVABpgFZAf8DRAF7BAADBgEIAWcBZAHqAf0BdgFzAf4B/wGKAYcC/wF1
+ AXIB/QH/AWUBYgH7Af8DHgErAx4BKwFaAVcB+AH/AWcBZQH6Af8BdgFzAv8BWgFYAfcB/wE+ATwB0AH8
+ AwQBBbAAA00BkQFcAbMBZgH/AVgBrwFiAf8DRAF5CAADFgEfAXMBcAL/AYEBdwL/AYEBdwH+Af8BbQFq
+ Af0B/wMeASsIAAMeASsBWwFYAfgB/wFoAWYB+wH/AXcBdQL/AVsBWAH4Af8DQAFvAwEBArAAA00BkQNG
+ AX8QAAMWAR8BcwFwAv8BcgFvAf4B/wMeASsQAAMeASsBXQFaAfgB/wFjAWEB+QH/AVMBUgFTAagDHQEp
0AADFgEfAx4BKxgAAx4BKwNAAW8DKQE++AADBwEKjAABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEA
AQEFAAGAFwAD/wEABP8EAAH5Af8C5wQAAfAB/wLDBAAB4AF/AoEEAAHAAT8BgAEBBAABgAEfAcABAwUA
AQ8B4AEHBQABBwHwAQ8EAAGGAQMB8AEPBAABzwEBAeABBwQAAf8BgAHAAQMEAAH/AcABgAEBBAAB/wHh
diff --git a/1.x/trunk/ProcessHacker/Forms/ThreadWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/ThreadWindow.Designer.cs
index e0b946241..a860bf26c 100644
--- a/1.x/trunk/ProcessHacker/Forms/ThreadWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ThreadWindow.Designer.cs
@@ -1,8 +1,6 @@
-using ProcessHacker.Components;
-
-namespace ProcessHacker
+namespace ProcessHacker
{
- sealed partial class ThreadWindow
+ partial class ThreadWindow
{
///
/// Required designer variable.
@@ -36,19 +34,27 @@ namespace ProcessHacker
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ThreadWindow));
+ this.vistaMenu = new wyDay.Controls.VistaMenu(this.components);
this.fileModule = new ProcessHacker.Components.FileNameBox();
this.label1 = new System.Windows.Forms.Label();
this.buttonWalk = new System.Windows.Forms.Button();
- this.listViewCallStack = new ProcessHacker.Components.ExtendedListView();
- this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.listViewCallStack = new System.Windows.Forms.ListView();
+ this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
+ this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).BeginInit();
this.SuspendLayout();
//
+ // vistaMenu
+ //
+ this.vistaMenu.ContainerControl = this;
+ this.vistaMenu.DelaySetImageCalls = false;
+ //
// fileModule
//
- this.fileModule.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.fileModule.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.fileModule.Location = new System.Drawing.Point(63, 347);
this.fileModule.Name = "fileModule";
this.fileModule.ReadOnly = true;
@@ -61,7 +67,7 @@ namespace ProcessHacker
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 353);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(50, 13);
+ this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 8;
this.label1.Text = "Module:";
//
@@ -79,13 +85,12 @@ namespace ProcessHacker
//
// listViewCallStack
//
- this.listViewCallStack.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.listViewCallStack.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.listViewCallStack.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader3,
this.columnHeader4});
- this.listViewCallStack.DoubleClickChecks = true;
this.listViewCallStack.FullRowSelect = true;
this.listViewCallStack.HideSelection = false;
this.listViewCallStack.Location = new System.Drawing.Point(12, 12);
@@ -111,7 +116,6 @@ namespace ProcessHacker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(399, 383);
this.Controls.Add(this.fileModule);
this.Controls.Add(this.label1);
@@ -123,8 +127,9 @@ namespace ProcessHacker
this.Name = "ThreadWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Thread";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ThreadWindow_FormClosing);
this.Load += new System.EventHandler(this.ThreadWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ThreadWindow_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -132,10 +137,11 @@ namespace ProcessHacker
#endregion
+ private wyDay.Controls.VistaMenu vistaMenu;
private ProcessHacker.Components.FileNameBox fileModule;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button buttonWalk;
- private ExtendedListView listViewCallStack;
+ private System.Windows.Forms.ListView listViewCallStack;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ThreadWindow.cs b/1.x/trunk/ProcessHacker/Forms/ThreadWindow.cs
index 9246866a7..c3f24ca5e 100644
--- a/1.x/trunk/ProcessHacker/Forms/ThreadWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/ThreadWindow.cs
@@ -21,6 +21,7 @@
*/
using System;
+using System.Reflection;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Native;
@@ -31,13 +32,13 @@ using ProcessHacker.UI;
namespace ProcessHacker
{
- public sealed partial class ThreadWindow : Form
+ public partial class ThreadWindow : Form
{
- private readonly int _pid;
- private readonly int _tid;
- private readonly ProcessHandle _phandle;
- private readonly bool _processHandleOwned = true;
- private readonly ThreadHandle _thandle;
+ private int _pid;
+ private int _tid;
+ private ProcessHandle _phandle;
+ private bool _processHandleOwned = true;
+ private ThreadHandle _thandle;
private SymbolProvider _symbols;
public const string DisplayFormat = "0x{0:x}";
@@ -62,6 +63,11 @@ namespace ProcessHacker
this.Text = Program.ProcessProvider.Dictionary[_pid].Name + " (PID " + _pid.ToString() +
") - Thread " + _tid.ToString();
+ PropertyInfo property = typeof(ListView).GetProperty("DoubleBuffered",
+ BindingFlags.NonPublic | BindingFlags.Instance);
+
+ property.SetValue(listViewCallStack, true, null);
+
listViewCallStack.ContextMenu = listViewCallStack.GetCopyMenu();
try
@@ -73,7 +79,23 @@ namespace ProcessHacker
}
else
{
- _phandle = new ProcessHandle(_pid, ProcessAccess.QueryInformation | ProcessAccess.VmRead);
+ try
+ {
+ _phandle = new ProcessHandle(_pid,
+ ProcessAccess.QueryInformation | ProcessAccess.VmRead
+ );
+ }
+ catch
+ {
+ if (KProcessHacker.Instance != null)
+ {
+ _phandle = new ProcessHandle(_pid, Program.MinProcessReadMemoryRights);
+ }
+ else
+ {
+ throw;
+ }
+ }
}
}
catch (Exception ex)
@@ -87,7 +109,23 @@ namespace ProcessHacker
try
{
- _thandle = new ThreadHandle(_tid, ThreadAccess.GetContext | ThreadAccess.SuspendResume);
+ try
+ {
+ _thandle = new ThreadHandle(_tid, ThreadAccess.GetContext | ThreadAccess.SuspendResume);
+ }
+ catch
+ {
+ if (KProcessHacker.Instance != null)
+ {
+ _thandle = new ThreadHandle(_tid,
+ Program.MinThreadQueryRights | ThreadAccess.SuspendResume
+ );
+ }
+ else
+ {
+ throw;
+ }
+ }
}
catch (Exception ex)
{
@@ -101,6 +139,7 @@ namespace ProcessHacker
private void ThreadWindow_Load(object sender, EventArgs e)
{
+ listViewCallStack.SetTheme("explorer");
listViewCallStack.AddShortcuts();
this.Size = Settings.Instance.ThreadWindowSize;
@@ -139,9 +178,9 @@ namespace ProcessHacker
try
{
// Process the kernel-mode stack (if KPH is present).
- //if (KProcessHacker.Instance != null)
+ if (KProcessHacker.Instance != null)
{
- //this.WalkKernelStack();
+ this.WalkKernelStack();
}
// Process the user-mode stack.
@@ -150,7 +189,7 @@ namespace ProcessHacker
_thandle.WalkStack(_phandle, this.WalkStackCallback);
- if (OSVersion.Architecture == OSArch.Amd64 && _phandle.IsWow64)
+ if (OSVersion.Architecture == OSArch.Amd64 && _phandle.IsWow64())
{
_thandle.WalkStack(_phandle, this.WalkStackCallback, OSArch.I386);
}
@@ -183,11 +222,12 @@ namespace ProcessHacker
try
{
- ListViewItem newItem = listViewCallStack.Items.Add(new ListViewItem(new[]
- {
- Utils.FormatAddress(address),
- _symbols.GetSymbolFromAddress(address)
- }));
+ ListViewItem newItem = listViewCallStack.Items.Add(new ListViewItem(
+ new string[]
+ {
+ Utils.FormatAddress(address),
+ _symbols.GetSymbolFromAddress(address)
+ }));
newItem.Tag = address;
}
@@ -216,11 +256,12 @@ namespace ProcessHacker
try
{
- ListViewItem newItem = listViewCallStack.Items.Add(new ListViewItem(new[]
- {
- Utils.FormatAddress(address),
- _symbols.GetSymbolFromAddress(address)
- }));
+ ListViewItem newItem = listViewCallStack.Items.Add(new ListViewItem(
+ new string[]
+ {
+ Utils.FormatAddress(address),
+ _symbols.GetSymbolFromAddress(address)
+ }));
newItem.Tag = address;
@@ -243,8 +284,7 @@ namespace ProcessHacker
newItem.ToolTipText += "\nFile: " + fileAndLine;
}
catch
- {
- }
+ { }
}
catch (Exception ex2)
{
@@ -255,11 +295,10 @@ namespace ProcessHacker
{
Logging.Log(ex);
- ListViewItem newItem = listViewCallStack.Items.Add(new ListViewItem(new string[]
- {
- Utils.FormatAddress(address),
- "???"
- }));
+ ListViewItem newItem = listViewCallStack.Items.Add(new ListViewItem(new string[] {
+ Utils.FormatAddress(address),
+ "???"
+ }));
newItem.Tag = address;
}
diff --git a/1.x/trunk/ProcessHacker/Forms/ThreadWindow.resx b/1.x/trunk/ProcessHacker/Forms/ThreadWindow.resx
index cad68d580..b98da9944 100644
--- a/1.x/trunk/ProcessHacker/Forms/ThreadWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/ThreadWindow.resx
@@ -112,12 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+ 17, 17
+
+
AAABAAMAEBAQAAEABAAoAQAANgAAABAQAAABAAgAaAUAAF4BAAAQEAAAAQAgAGgEAADGBgAAKAAAABAA
diff --git a/1.x/trunk/ProcessHacker/Forms/TokenWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/TokenWindow.Designer.cs
index fb018da9d..74f377046 100644
--- a/1.x/trunk/ProcessHacker/Forms/TokenWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/TokenWindow.Designer.cs
@@ -39,7 +39,7 @@
//
this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonClose.Location = new System.Drawing.Point(378, 377);
+ this.buttonClose.Location = new System.Drawing.Point(378, 397);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 23);
this.buttonClose.TabIndex = 1;
@@ -49,20 +49,19 @@
//
// panelToken
//
- this.panelToken.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.panelToken.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.panelToken.Location = new System.Drawing.Point(12, 12);
this.panelToken.Name = "panelToken";
- this.panelToken.Size = new System.Drawing.Size(441, 359);
+ this.panelToken.Size = new System.Drawing.Size(441, 379);
this.panelToken.TabIndex = 2;
//
// TokenWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.ClientSize = new System.Drawing.Size(465, 412);
+ this.ClientSize = new System.Drawing.Size(465, 432);
this.Controls.Add(this.panelToken);
this.Controls.Add(this.buttonClose);
this.MaximizeBox = false;
@@ -72,8 +71,8 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Token";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TokenWindow_FormClosing);
this.Load += new System.EventHandler(this.TokenWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TokenWindow_FormClosing);
this.ResumeLayout(false);
}
diff --git a/1.x/trunk/ProcessHacker/Forms/TokenWindow.cs b/1.x/trunk/ProcessHacker/Forms/TokenWindow.cs
index 38ffd903c..6ca7336c1 100644
--- a/1.x/trunk/ProcessHacker/Forms/TokenWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/TokenWindow.cs
@@ -29,7 +29,7 @@ namespace ProcessHacker
{
public partial class TokenWindow : Form
{
- readonly TokenProperties _tokenProps;
+ TokenProperties _tokenProps;
public TokenWindow(IWithToken obj)
{
diff --git a/1.x/trunk/ProcessHacker/Forms/TokenWindow.resx b/1.x/trunk/ProcessHacker/Forms/TokenWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/TokenWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/TokenWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.Designer.cs
deleted file mode 100644
index c7a0f8d93..000000000
--- a/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.Designer.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-namespace ProcessHacker.Native.Ui
-{
- partial class HandlePropertiesWindow
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.tabControl = new System.Windows.Forms.TabControl();
- this.tabDetails = new System.Windows.Forms.TabPage();
- this.handleDetails1 = new ProcessHacker.Components.HandleDetails();
- this.buttonClose = new System.Windows.Forms.Button();
- this.tabControl.SuspendLayout();
- this.tabDetails.SuspendLayout();
- this.SuspendLayout();
- //
- // tabControl
- //
- this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tabControl.Controls.Add(this.tabDetails);
- this.tabControl.Location = new System.Drawing.Point(12, 12);
- this.tabControl.Name = "tabControl";
- this.tabControl.SelectedIndex = 0;
- this.tabControl.Size = new System.Drawing.Size(370, 382);
- this.tabControl.TabIndex = 0;
- //
- // tabDetails
- //
- this.tabDetails.Controls.Add(this.handleDetails1);
- this.tabDetails.Location = new System.Drawing.Point(4, 22);
- this.tabDetails.Name = "tabDetails";
- this.tabDetails.Padding = new System.Windows.Forms.Padding(3);
- this.tabDetails.Size = new System.Drawing.Size(362, 356);
- this.tabDetails.TabIndex = 0;
- this.tabDetails.Text = "Details";
- this.tabDetails.UseVisualStyleBackColor = true;
- //
- // handleDetails1
- //
- this.handleDetails1.BackColor = System.Drawing.Color.White;
- this.handleDetails1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.handleDetails1.Location = new System.Drawing.Point(3, 3);
- this.handleDetails1.Name = "handleDetails1";
- this.handleDetails1.Padding = new System.Windows.Forms.Padding(3);
- this.handleDetails1.Size = new System.Drawing.Size(356, 350);
- this.handleDetails1.TabIndex = 0;
- //
- // buttonClose
- //
- this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonClose.Location = new System.Drawing.Point(307, 400);
- this.buttonClose.Name = "buttonClose";
- this.buttonClose.Size = new System.Drawing.Size(75, 23);
- this.buttonClose.TabIndex = 1;
- this.buttonClose.Text = "Close";
- this.buttonClose.UseVisualStyleBackColor = true;
- this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
- //
- // HandlePropertiesWindow
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(394, 435);
- this.Controls.Add(this.buttonClose);
- this.Controls.Add(this.tabControl);
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "HandlePropertiesWindow";
- this.ShowIcon = false;
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Handle Properties";
- this.tabControl.ResumeLayout(false);
- this.tabDetails.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TabControl tabControl;
- private System.Windows.Forms.TabPage tabDetails;
- private System.Windows.Forms.Button buttonClose;
- public Components.HandleDetails handleDetails1;
- }
-}
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.cs b/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.cs
deleted file mode 100644
index 67ca4abd7..000000000
--- a/1.x/trunk/ProcessHacker/Forms/Ui/HandlePropertiesWindow.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Process Hacker -
- * handle properties window
- *
- * Copyright (C) 2009 wj32
- *
- * This file is part of Process Hacker.
- *
- * Process Hacker is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Process Hacker is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Process Hacker. If not, see .
- */
-
-using System;
-using System.Windows.Forms;
-using ProcessHacker.Native.Api;
-
-namespace ProcessHacker.Native.Ui
-{
- public partial class HandlePropertiesWindow : Form
- {
- public HandlePropertiesWindow(SystemHandleEntry handle)
- {
- InitializeComponent();
-
- this.KeyPreview = true;
- this.KeyDown += (sender, e) =>
- {
- if (e.KeyCode == Keys.Escape)
- {
- this.Close();
- e.Handled = true;
- }
- };
-
- this.handleDetails1.ObjectHandle = handle;
- }
-
- public void Init()
- {
- this.handleDetails1.Init();
- }
-
- private void buttonClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- private void buttonPermissions_Click(object sender, EventArgs e)
- {
- //if (_objectHandle != null)
- //{
- // try
- // {
- // SecurityEditor.EditSecurity(
- // this,
- // SecurityEditor.GetSecurableWrapper(_objectHandle),
- // _name,
- // NativeTypeFactory.GetAccessEntries(NativeTypeFactory.GetObjectType(_typeName))
- // );
- // }
- // catch (Exception ex)
- // {
- // MessageBox.Show("Unable to edit security: " + ex.Message, "Security Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
- // }
- //}
- }
- }
-}
diff --git a/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.Designer.cs
index 4a8012e4c..21ef7a944 100644
--- a/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.Designer.cs
@@ -146,8 +146,8 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Process Hacker Update";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UpdaterDownloadWindow_FormClosing);
this.Load += new System.EventHandler(this.UpdaterDownload_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UpdaterDownloadWindow_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
diff --git a/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.cs b/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.cs
index f4622ccc1..a59752344 100644
--- a/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.cs
@@ -36,16 +36,15 @@ namespace ProcessHacker
{
public partial class UpdaterDownloadWindow : Form
{
- private readonly Updater.UpdateItem _updateItem;
+ private Updater.UpdateItem _updateItem;
private WebClient _webClient;
private string _fileName;
private ThreadTask _verifyTask;
- private bool _redirected;
+ private bool _redirected = false;
public UpdaterDownloadWindow(Updater.UpdateItem updateItem)
{
InitializeComponent();
-
this.AddEscapeToClose();
this.SetTopMost();
@@ -54,19 +53,21 @@ namespace ProcessHacker
private void UpdaterDownload_Load(object sender, EventArgs e)
{
- string currentVersion = Application.ProductVersion;
- string version = this._updateItem.Version.Major + "." + this._updateItem.Version.Minor;
-
+ string currentVersion;
+ string version;
+
+ currentVersion = Application.ProductVersion;
+ version = _updateItem.Version.Major + "." + _updateItem.Version.Minor;
_fileName = Path.GetTempPath() + "processhacker-" + version + "-setup.exe";
labelTitle.Text = "Downloading: Process Hacker " + version;
labelReleased.Text = "Released: " + _updateItem.Date.ToString();
_webClient = new WebClient();
- _webClient.DownloadProgressChanged += this.webClient_DownloadProgressChanged;
- _webClient.DownloadFileCompleted += this.webClient_DownloadFileCompleted;
+ _webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);
+ _webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(webClient_DownloadFileCompleted);
_webClient.Headers.Add("User-Agent", "PH/" + currentVersion + " (compatible; PH " +
- currentVersion + "; PH " + currentVersion + "; .NET CLR " + Environment.Version + ";)");
+ currentVersion + "; PH " + currentVersion + "; .NET CLR " + Environment.Version.ToString() + ";)");
try
{
@@ -218,17 +219,15 @@ namespace ProcessHacker
if (this.IsHandleCreated)
{
- long read = totalBytesRead;
-
this.BeginInvoke(new MethodInvoker(() =>
- {
- int value = (int)((double)read * 100 / size);
-
- if (value >= this.progressDownload.Minimum && value <= this.progressDownload.Maximum)
{
- this.progressDownload.Value = value;
- }
- }));
+ int value = (int)((double)totalBytesRead * 100 / size);
+
+ if (value >= this.progressDownload.Minimum && value <= this.progressDownload.Maximum)
+ {
+ this.progressDownload.Value = value;
+ }
+ }));
}
} while (bytesRead != 0);
@@ -289,8 +288,8 @@ namespace ProcessHacker
{
Program.StartProgramAdmin(
_fileName,
- string.Empty,
- () => success = true,
+ "",
+ new MethodInvoker(() => success = true),
ShowWindowType.Normal,
this.Handle
);
@@ -317,7 +316,7 @@ namespace ProcessHacker
// User canceled. Re-open the mutex.
try
{
- Program.GlobalMutex = new Native.Threading.Mutant(Program.GlobalMutexName);
+ Program.GlobalMutex = new ProcessHacker.Native.Threading.Mutant(Program.GlobalMutexName);
}
catch (Exception ex)
{
diff --git a/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.resx b/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.resx
index 769f0e996..21f86819c 100644
--- a/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/UpdaterDownloadWindow.resx
@@ -112,12 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
iVBORw0KGgoAAAANSUhEUgAAAHgAAAAeCAMAAADQFyqnAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
diff --git a/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.Designer.cs
index df6c5cdb7..066fc2e07 100644
--- a/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.Designer.cs
@@ -74,10 +74,10 @@
this.textNewProtection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.textNewProtection.Location = new System.Drawing.Point(167, 186);
this.textNewProtection.Name = "textNewProtection";
- this.textNewProtection.Size = new System.Drawing.Size(82, 22);
+ this.textNewProtection.Size = new System.Drawing.Size(82, 20);
this.textNewProtection.TabIndex = 7;
- this.textNewProtection.Enter += new System.EventHandler(this.textNewProtection_Enter);
this.textNewProtection.Leave += new System.EventHandler(this.textNewProtection_Leave);
+ this.textNewProtection.Enter += new System.EventHandler(this.textNewProtection_Enter);
//
// labelNewValue
//
@@ -85,17 +85,14 @@
this.labelNewValue.AutoSize = true;
this.labelNewValue.Location = new System.Drawing.Point(100, 189);
this.labelNewValue.Name = "labelNewValue";
- this.labelNewValue.Size = new System.Drawing.Size(63, 13);
+ this.labelNewValue.Size = new System.Drawing.Size(61, 13);
this.labelNewValue.TabIndex = 6;
this.labelNewValue.Text = "New value:";
//
// VirtualProtectWindow
//
- this.AcceptButton = this.buttonVirtualProtect;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
- this.CancelButton = this.buttonCloseVirtualProtect;
this.ClientSize = new System.Drawing.Size(423, 219);
this.Controls.Add(this.buttonCloseVirtualProtect);
this.Controls.Add(this.buttonVirtualProtect);
diff --git a/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.cs b/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.cs
index 432e9d37f..874b11675 100644
--- a/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.cs
@@ -31,14 +31,14 @@ namespace ProcessHacker
{
public partial class VirtualProtectWindow : Form
{
- private readonly int _pid;
- private readonly long _size;
- private readonly IntPtr _address;
+ private int _pid;
+ private long _size;
+ private IntPtr _address;
public VirtualProtectWindow(int pid, IntPtr address, long size)
{
InitializeComponent();
-
+ this.AddEscapeToClose();
this.SetTopMost();
_pid = pid;
@@ -71,7 +71,8 @@ namespace ProcessHacker
return;
}
- using (ProcessHandle phandle = new ProcessHandle(_pid, ProcessAccess.VmOperation))
+ using (ProcessHandle phandle =
+ new ProcessHandle(_pid, ProcessAccess.VmOperation))
{
try
{
diff --git a/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.resx b/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.resx
index e411c0496..481674719 100644
--- a/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/VirtualProtectWindow.resx
@@ -112,10 +112,10 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Possible values:
diff --git a/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.Designer.cs
index c20c4b77b..6408048fe 100644
--- a/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.Designer.cs
@@ -53,7 +53,7 @@
this.labelFile.AutoSize = true;
this.labelFile.Location = new System.Drawing.Point(12, 9);
this.labelFile.Name = "labelFile";
- this.labelFile.Size = new System.Drawing.Size(65, 13);
+ this.labelFile.Size = new System.Drawing.Size(58, 13);
this.labelFile.TabIndex = 2;
this.labelFile.Text = "Uploading:";
//
@@ -62,7 +62,7 @@
this.uploadedLabel.AutoSize = true;
this.uploadedLabel.Location = new System.Drawing.Point(12, 54);
this.uploadedLabel.Name = "uploadedLabel";
- this.uploadedLabel.Size = new System.Drawing.Size(61, 13);
+ this.uploadedLabel.Size = new System.Drawing.Size(56, 13);
this.uploadedLabel.TabIndex = 3;
this.uploadedLabel.Text = "Uploaded:";
//
@@ -83,7 +83,7 @@
this.speedLabel.AutoSize = true;
this.speedLabel.Location = new System.Drawing.Point(213, 54);
this.speedLabel.Name = "speedLabel";
- this.speedLabel.Size = new System.Drawing.Size(42, 13);
+ this.speedLabel.Size = new System.Drawing.Size(41, 13);
this.speedLabel.TabIndex = 6;
this.speedLabel.Text = "Speed:";
//
@@ -92,14 +92,14 @@
this.totalSizeLabel.AutoSize = true;
this.totalSizeLabel.Location = new System.Drawing.Point(12, 32);
this.totalSizeLabel.Name = "totalSizeLabel";
- this.totalSizeLabel.Size = new System.Drawing.Size(58, 13);
+ this.totalSizeLabel.Size = new System.Drawing.Size(57, 13);
this.totalSizeLabel.TabIndex = 7;
this.totalSizeLabel.Text = "Total Size:";
//
// progressUpload
//
- this.progressUpload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.progressUpload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.progressUpload.Location = new System.Drawing.Point(12, 75);
this.progressUpload.Name = "progressUpload";
this.progressUpload.Size = new System.Drawing.Size(325, 23);
@@ -109,7 +109,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(430, 110);
this.Controls.Add(this.progressUpload);
this.Controls.Add(this.totalSizeLabel);
@@ -125,8 +124,8 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "VirusTotal Uploader";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VirusTotalUploaderWindow_FormClosing);
this.Load += new System.EventHandler(this.VirusTotalUploaderWindow_Load);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VirusTotalUploaderWindow_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.LogoImg)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
diff --git a/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.cs b/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.cs
index 75bc7c751..4f369b7e9 100644
--- a/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.cs
@@ -42,8 +42,8 @@ namespace ProcessHacker
{
public partial class VirusTotalUploaderWindow : Form
{
- readonly string fileName;
- readonly string processName;
+ string fileName;
+ string processName;
long totalFileSize;
long bytesPerSecond;
@@ -54,6 +54,7 @@ namespace ProcessHacker
public VirusTotalUploaderWindow(string procName, string procPath)
{
+ this.SetPhParent();
InitializeComponent();
this.AddEscapeToClose();
this.SetTopMost();
@@ -73,16 +74,13 @@ namespace ProcessHacker
{
if (OSVersion.HasTaskDialogs)
{
- TaskDialog td = new TaskDialog
- {
- PositionRelativeToWindow = true,
- Content = "The selected file doesn't exist or couldnt be found!",
- MainInstruction = "File Location not Available!",
- WindowTitle = "System Error",
- MainIcon = TaskDialogIcon.CircleX,
- CommonButtons = TaskDialogCommonButtons.Ok
- };
-
+ TaskDialog td = new TaskDialog();
+ td.PositionRelativeToWindow = true;
+ td.Content = "The selected file doesn't exist or couldnt be found!";
+ td.MainInstruction = "File Location not Available!";
+ td.WindowTitle = "System Error";
+ td.MainIcon = TaskDialogIcon.CircleX;
+ td.CommonButtons = TaskDialogCommonButtons.Ok;
td.Show(Program.HackerWindow.Handle);
}
else
@@ -99,15 +97,13 @@ namespace ProcessHacker
{
if (OSVersion.HasTaskDialogs)
{
- TaskDialog td = new TaskDialog
- {
- PositionRelativeToWindow = true,
- Content = "This file is larger than 20MB, above the VirusTotal limit!",
- MainInstruction = "File is too large",
- WindowTitle = "VirusTotal Error",
- MainIcon = TaskDialogIcon.CircleX,
- CommonButtons = TaskDialogCommonButtons.Ok
- };
+ TaskDialog td = new TaskDialog();
+ td.PositionRelativeToWindow = true;
+ td.Content = "This file is larger than 20MB, above the VirusTotal limit!";
+ td.MainInstruction = "File is too large";
+ td.WindowTitle = "VirusTotal Error";
+ td.MainIcon = TaskDialogIcon.CircleX;
+ td.CommonButtons = TaskDialogCommonButtons.Ok;
td.Show(Program.HackerWindow.Handle);
}
else
@@ -130,8 +126,8 @@ namespace ProcessHacker
ThreadTask getSessionTokenTask = new ThreadTask();
- getSessionTokenTask.RunTask += this.getSessionTokenTask_RunTask;
- getSessionTokenTask.Completed += this.getSessionTokenTask_Completed;
+ getSessionTokenTask.RunTask += new ThreadTaskRunTaskDelegate(getSessionTokenTask_RunTask);
+ getSessionTokenTask.Completed += new ThreadTaskCompletedDelegate(getSessionTokenTask_Completed);
getSessionTokenTask.Start();
}
@@ -153,7 +149,7 @@ namespace ProcessHacker
{
try
{
- HttpWebRequest sessionRequest = (HttpWebRequest)WebRequest.Create("http://www.virustotal.com/vt/en/identificador");
+ HttpWebRequest sessionRequest = (HttpWebRequest)HttpWebRequest.Create("http://www.virustotal.com/vt/en/identificador");
sessionRequest.ServicePoint.ConnectionLimit = 20;
sessionRequest.UserAgent = "Process Hacker " + Application.ProductVersion;
sessionRequest.Timeout = System.Threading.Timeout.Infinite;
@@ -279,13 +275,16 @@ namespace ProcessHacker
{
// RequestCanceled will occour when we cancel the WebRequest.
// Filter out that exception but log all others.
- if (ex.Status != WebExceptionStatus.RequestCanceled)
+ if (ex != null)
{
- PhUtils.ShowException("Unable to upload the file", ex);
- Logging.Log(ex);
+ if (ex.Status != WebExceptionStatus.RequestCanceled)
+ {
+ PhUtils.ShowException("Unable to upload the file", ex);
+ Logging.Log(ex);
- if (this.IsHandleCreated)
- this.BeginInvoke(new MethodInvoker(this.Close));
+ if (this.IsHandleCreated)
+ this.BeginInvoke(new MethodInvoker(this.Close));
+ }
}
}
@@ -314,7 +313,7 @@ namespace ProcessHacker
progressUpload.Value = progress;
if (OSVersion.HasExtendedTaskbar)
- Program.HackerWindow.SetTaskbarProgress(this.progressUpload);
+ Windows7Taskbar.SetTaskbarProgress(Program.HackerWindow, this.progressUpload);
}
private void uploadTask_Completed(object result)
diff --git a/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.resx b/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/VirusTotalUploaderWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.Designer.cs b/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.Designer.cs
index aa37b4374..5951b2aa9 100644
--- a/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.Designer.cs
+++ b/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.Designer.cs
@@ -39,25 +39,25 @@
//
// textDescription
//
- this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.textDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.textDescription.BackColor = System.Drawing.SystemColors.Control;
this.textDescription.Location = new System.Drawing.Point(12, 12);
this.textDescription.Name = "textDescription";
- this.textDescription.Size = new System.Drawing.Size(361, 22);
+ this.textDescription.Size = new System.Drawing.Size(361, 20);
this.textDescription.TabIndex = 1;
//
// labelIntro
//
- this.labelIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.labelIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.labelIntro.Location = new System.Drawing.Point(12, 253);
this.labelIntro.Name = "labelIntro";
this.labelIntro.Size = new System.Drawing.Size(390, 41);
this.labelIntro.TabIndex = 2;
this.labelIntro.Text = "Analyzing the Wait Chain for a process helps diagnose application hangs and deadl" +
- "ocks caused by a process using or waiting to use a resource that is being used b" +
- "y another process.";
+ "ocks caused by a process using or waiting to use a resource that is being used b" +
+ "y another process.";
this.labelIntro.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// buttonCancel
@@ -90,7 +90,7 @@
this.moreInfoLink.AutoSize = true;
this.moreInfoLink.Location = new System.Drawing.Point(9, 304);
this.moreInfoLink.Name = "moreInfoLink";
- this.moreInfoLink.Size = new System.Drawing.Size(133, 13);
+ this.moreInfoLink.Size = new System.Drawing.Size(121, 13);
this.moreInfoLink.TabIndex = 5;
this.moreInfoLink.TabStop = true;
this.moreInfoLink.Text = "More about Wait Chains";
@@ -98,8 +98,8 @@
//
// buttonProperties
//
- this.buttonProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.buttonProperties.Image = global::ProcessHacker.Properties.Resources.application_form_magnify;
this.buttonProperties.Location = new System.Drawing.Point(379, 9);
this.buttonProperties.Name = "buttonProperties";
@@ -120,7 +120,6 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(415, 329);
this.Controls.Add(this.threadTree);
this.Controls.Add(this.buttonProperties);
diff --git a/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.cs b/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.cs
index 7eeb0a5df..c670039d4 100644
--- a/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.cs
+++ b/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.cs
@@ -1,22 +1,28 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProcessHacker.Common;
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;
+using System.Diagnostics;
using ProcessHacker.Native;
+using ProcessHacker.Native.Api;
namespace ProcessHacker
{
public partial class WaitChainWindow : Form
{
- private readonly int processPid;
- private readonly string processName;
+ private int processPid;
+ private string processName;
public WaitChainWindow(string procName, int procPid)
{
InitializeComponent();
-
+ this.SetPhParent();
this.AddEscapeToClose();
this.SetTopMost();
@@ -113,7 +119,7 @@ namespace ProcessHacker
{
sb.Append(string.Format(" {0} Status: {1}", node.ObjectType, node.ObjectStatus));
- String name = node.ObjectName;
+ String name = node.ObjectName();
if (!String.IsNullOrEmpty(name))
{
sb.Append(string.Format(" Name: {0}", name));
@@ -132,12 +138,13 @@ namespace ProcessHacker
{
try
{
- Program.GetProcessWindow(Program.ProcessProvider.Dictionary[processPid], f =>
- {
- Settings.Instance.ProcessWindowSelectedTab = "tabThreads";
- f.Show();
- f.Activate();
- });
+ ProcessWindow pForm = Program.GetProcessWindow(Program.ProcessProvider.Dictionary[processPid],
+ new Program.PWindowInvokeAction(delegate(ProcessWindow f)
+ {
+ Settings.Instance.ProcessWindowSelectedTab = "tabThreads";
+ f.Show();
+ f.Activate();
+ }));
}
catch (Exception ex)
{
@@ -149,7 +156,7 @@ namespace ProcessHacker
///
/// Wraps all the native Wait Chain Traversal code.
///
- public static class WaitChainNativeMethods
+ public static partial class WaitChainNativeMethods
{
// Keep the module handle around for the life of the application as the WCT code has pointers into it.
private static SafeModuleHandle oleModule;
@@ -213,7 +220,7 @@ namespace ProcessHacker
// The name union.
[FieldOffset(0x8)]
- public fixed ushort RealObjectName[WCT_OBJNAME_LENGTH];
+ private fixed ushort RealObjectName[WCT_OBJNAME_LENGTH];
[FieldOffset(0x108)]
public int TimeOutLowPart;
[FieldOffset(0x10C)]
@@ -233,14 +240,11 @@ namespace ProcessHacker
//TODO: fix this... fixes old VS05 bug thats now non-existent
//Does the work to get the ObjectName field.
- public string ObjectName
+ public String ObjectName()
{
- get
+ fixed (WAITCHAIN_NODE_INFO* p = &this)
{
- fixed (WAITCHAIN_NODE_INFO* p = &this)
- {
- return (p->RealObjectName[0] != '\0') ? new string((char*)p->RealObjectName) : string.Empty;
- }
+ return (p->RealObjectName[0] != '\0') ? new string((char*)p->RealObjectName) : string.Empty;
}
}
}
@@ -337,9 +341,9 @@ namespace ProcessHacker
public sealed class WaitData
{
- private readonly WaitChainNativeMethods.WAITCHAIN_NODE_INFO[] data;
- private readonly bool isDeadlock;
- private readonly int nodeCount;
+ private WaitChainNativeMethods.WAITCHAIN_NODE_INFO[] data;
+ private bool isDeadlock;
+ private int nodeCount;
public WaitData(WaitChainNativeMethods.WAITCHAIN_NODE_INFO[] data, int nodeCount, bool isDeadlock)
{
@@ -350,23 +354,32 @@ namespace ProcessHacker
public WaitChainNativeMethods.WAITCHAIN_NODE_INFO[] Nodes
{
- get { return (data); }
+ get
+ {
+ return (data);
+ }
}
public int NodeCount
{
- get { return (nodeCount); }
+ get
+ {
+ return (nodeCount);
+ }
}
public bool IsDeadlock
{
- get { return (isDeadlock); }
+ get
+ {
+ return (isDeadlock);
+ }
}
}
public sealed class WaitChainTraversal : IDisposable
{
- private readonly SafeWaitChainHandle waitChainHandle;
+ private SafeWaitChainHandle waitChainHandle;
public WaitChainTraversal()
{
@@ -376,14 +389,14 @@ namespace ProcessHacker
public WaitData GetThreadWaitChain(int threadId)
{
WaitChainNativeMethods.WAITCHAIN_NODE_INFO[] data = new WaitChainNativeMethods.WAITCHAIN_NODE_INFO[WaitChainNativeMethods.WCT_MAX_NODE_COUNT];
- int isDeadlock;
+ int isDeadlock = 0;
int nodeCount = WaitChainNativeMethods.WCT_MAX_NODE_COUNT;
WaitData retData = null;
if (WaitChainNativeMethods.GetThreadWaitChain(waitChainHandle, threadId, ref nodeCount, data, out isDeadlock))
{
- retData = new WaitData(data, nodeCount, isDeadlock == 1);
+ retData = new WaitData(data, (int)nodeCount, isDeadlock == 1);
}
return (retData);
diff --git a/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.resx b/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.resx
index c7e0d4bdf..ff31a6db5 100644
--- a/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.resx
+++ b/1.x/trunk/ProcessHacker/Forms/WaitChainWindow.resx
@@ -112,9 +112,9 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
\ No newline at end of file
diff --git a/1.x/trunk/ProcessHacker/Help.htm b/1.x/trunk/ProcessHacker/Help.htm
index 513807d5f..986210822 100644
--- a/1.x/trunk/ProcessHacker/Help.htm
+++ b/1.x/trunk/ProcessHacker/Help.htm
@@ -419,6 +419,7 @@ pre {
M2
Uses VirtualProtectEx to prevent the process' pages from being used, crashing the process.
+
Process Properties
diff --git a/1.x/trunk/ProcessHacker/ProcessHacker.csproj b/1.x/trunk/ProcessHacker/ProcessHacker.csproj
index 2004fc2f8..53c5abcd7 100644
--- a/1.x/trunk/ProcessHacker/ProcessHacker.csproj
+++ b/1.x/trunk/ProcessHacker/ProcessHacker.csproj
@@ -10,7 +10,7 @@
Properties
ProcessHacker
ProcessHacker
- v4.5
+ v4.0
512
ProcessHacker.ico
ProcessHacker.Program
@@ -48,7 +48,6 @@
true
AnyCPU
AllRules.ruleset
- false
pdbonly
@@ -62,7 +61,6 @@
false
AnyCPU
AllRules.ruleset
- false
@@ -76,7 +74,6 @@
-
@@ -91,116 +88,6 @@
-
- UserControl
-
-
- HandleDetails.cs
-
-
- Component
-
-
- Component
-
-
- Component
-
-
-
-
- Component
-
-
- Component
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Component
-
-
- Component
-
-
-
- Component
-
-
- Component
-
-
- Component
-
-
-
-
-
- Component
-
-
- Component
-
-
- Component
-
-
- Component
-
-
-
- Component
-
-
-
-
-
-
-
-
-
-
-
-
- Component
-
-
- TreeViewAdv.cs
-
-
- Component
-
-
- Component
-
-
- Component
-
-
Form
@@ -213,18 +100,6 @@
HackerWindow.cs
-
- Form
-
-
- ChooseProcessDialog.cs
-
-
- Form
-
-
- HandlePropertiesWindow.cs
-
Form
@@ -233,25 +108,10 @@
PromptBox.cs
-
- HandleDetails.cs
-
-
- Tracker.cs
-
-
- TreeViewAdv.cs
-
HackerWindow.cs
Designer
-
- ChooseProcessDialog.cs
-
-
- HandlePropertiesWindow.cs
-
ResXFileCodeGenerator
Resources.Designer.cs
@@ -262,10 +122,14 @@
Resources.resx
True
-
- SysInfoWindow.cs
-
+
+
+ Component
+
+
+ Component
+
@@ -448,12 +312,18 @@
ProtectProcessWindow.cs
+
+ ScratchpadWindow.cs
+
SessionInformationWindow.cs
StructWindow.cs
+
+ SysInfoWindow.cs
+
TerminatorWindow.cs
@@ -537,7 +407,6 @@
WaitChainWindow.cs
-
@@ -710,6 +579,12 @@
ProtectProcessWindow.cs
+
+ Form
+
+
+ ScratchpadWindow.cs
+
Form
@@ -741,16 +616,8 @@
-
- Form
-
-
- SysInfoWindow.cs
-
-
-
@@ -759,6 +626,7 @@
+
UserControl
@@ -802,6 +670,9 @@
HandleList.cs
+
+ Component
+
@@ -945,6 +816,12 @@
StructWindow.cs
+
+ Form
+
+
+ SysInfoWindow.cs
+
Form
@@ -1153,15 +1030,6 @@
-
-
-
-
-
-
-
-
-
@@ -1193,6 +1061,10 @@
{8A448157-E1A7-4DDF-954E-287F1117832B}
ProcessHacker.Native
+
+ {E73BB233-D88B-44A7-A98F-D71EE158381D}
+ Aga.Controls
+
diff --git a/1.x/trunk/ProcessHacker/Program/Assistant.cs b/1.x/trunk/ProcessHacker/Program/Assistant.cs
index ef9320918..a5f1ce7b6 100644
--- a/1.x/trunk/ProcessHacker/Program/Assistant.cs
+++ b/1.x/trunk/ProcessHacker/Program/Assistant.cs
@@ -172,18 +172,18 @@ namespace ProcessHacker
TokenHandle token = null;
string domain = null;
- string username;
+ string username = "";
if (args.ContainsKey("-u"))
{
string user = args["-u"];
- if (user.Contains("\\", StringComparison.OrdinalIgnoreCase))
+ if (user.Contains("\\"))
{
domain = user.Split('\\')[0];
username = user.Split('\\')[1];
}
- else if (user.Contains("@", StringComparison.OrdinalIgnoreCase))
+ else if (user.Contains("@"))
{
username = user.Split('@')[0];
domain = user.Split('@')[1];
@@ -288,7 +288,7 @@ namespace ProcessHacker
try
{
- token.SessionId = sessionId;
+ token.SetSessionId(sessionId);
}
catch (Exception ex)
{
diff --git a/1.x/trunk/ProcessHacker/Program/Dump.cs b/1.x/trunk/ProcessHacker/Program/Dump.cs
index a8fe33753..e1da848a7 100644
--- a/1.x/trunk/ProcessHacker/Program/Dump.cs
+++ b/1.x/trunk/ProcessHacker/Program/Dump.cs
@@ -73,17 +73,18 @@ namespace ProcessHacker
public static void WriteListEntry(this BinaryWriter bw, string value)
{
- if (string.IsNullOrEmpty(value))
- value = string.Empty;
+ if (value == null)
+ value = "";
bw.Write(Encoding.Unicode.GetBytes(value.Replace("\0", "") + "\0"));
}
- public static void AppendStruct(MemoryObject mo, int size, T s) where T : struct
+ public static void AppendStruct(MemoryObject mo, T s)
+ where T : struct
{
- using (MemoryAlloc data = new MemoryAlloc(size))
+ using (var data = new MemoryAlloc(Marshal.SizeOf(typeof(T))))
{
- data.WriteStruct(s);
+ data.WriteStruct(s);
mo.AppendData(data.ReadBytes(data.Size));
}
}
@@ -94,7 +95,7 @@ namespace ProcessHacker
string str = Encoding.Unicode.GetString(mo.ReadData());
int i = 0;
- if (string.IsNullOrEmpty(str))
+ if (str == "")
return dict;
while (true)
@@ -123,7 +124,7 @@ namespace ProcessHacker
public static Icon GetIcon(MemoryObject mo)
{
byte[] data = mo.ReadData();
- ByteStreamReader reader = new ByteStreamReader(data);
+ ProcessHacker.Common.ByteStreamReader reader = new ProcessHacker.Common.ByteStreamReader(data);
using (Bitmap b = new Bitmap(reader))
{
@@ -186,7 +187,7 @@ namespace ProcessHacker
{
MemoryFileSystem mfs = new MemoryFileSystem(fileName, mode);
- using (MemoryObject sysinfo = mfs.RootObject.CreateChild("SystemInformation"))
+ using (var sysinfo = mfs.RootObject.CreateChild("SystemInformation"))
{
BinaryWriter bw = new BinaryWriter(sysinfo.GetWriteStream());
@@ -208,7 +209,7 @@ namespace ProcessHacker
public static void DumpProcesses(MemoryFileSystem mfs, ProcessSystemProvider provider)
{
- using (MemoryObject processes = mfs.RootObject.GetChild("Processes"))
+ using (var processes = mfs.RootObject.GetChild("Processes"))
{
var p = Windows.GetProcesses();
@@ -308,8 +309,8 @@ namespace ProcessHacker
if (pid != 4)
{
- using (ProcessHandle phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
- fileName = phandle.ImageFileName;
+ using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
+ fileName = FileUtils.GetFileName(phandle.GetImageFileName());
}
else
{
@@ -370,9 +371,9 @@ namespace ProcessHacker
{
using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights | ProcessAccess.VmRead))
{
- bw.Write("CommandLine", phandle.CommandLine);
+ bw.Write("CommandLine", phandle.GetCommandLine());
bw.Write("CurrentDirectory", phandle.GetPebString(PebOffset.CurrentDirectoryPath));
- bw.Write("IsPosix", phandle.IsPosix);
+ bw.Write("IsPosix", phandle.IsPosix());
}
}
catch
@@ -383,14 +384,14 @@ namespace ProcessHacker
using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
{
if (OSVersion.Architecture == OSArch.Amd64)
- bw.Write("IsWow64", phandle.IsWow64);
+ bw.Write("IsWow64", phandle.IsWow64());
}
using (var phandle = new ProcessHandle(pid, ProcessAccess.QueryInformation))
{
- bw.Write("IsBeingDebugged", phandle.IsBeingDebugged);
- bw.Write("IsCritical", phandle.IsCritical);
- bw.Write("DepStatus", (int)phandle.DepStatus);
+ bw.Write("IsBeingDebugged", phandle.IsBeingDebugged());
+ bw.Write("IsCritical", phandle.IsCritical());
+ bw.Write("DepStatus", (int)phandle.GetDepStatus());
}
}
catch
@@ -404,11 +405,11 @@ namespace ProcessHacker
{
using (var thandle = phandle.GetToken(TokenAccess.Query))
{
- bw.Write("UserName", thandle.User.GetFullName(true));
+ bw.Write("UserName", thandle.GetUser().GetFullName(true));
userNameWritten = true;
if (OSVersion.HasUac)
- bw.Write("ElevationType", (int)thandle.ElevationType);
+ bw.Write("ElevationType", (int)thandle.GetElevationType());
}
}
}
@@ -438,9 +439,9 @@ namespace ProcessHacker
}
using (var vmCounters = processMo.CreateChild("VmCounters"))
- AppendStruct(vmCounters, VmCountersEx64.SizeOf, new VmCountersEx64(process.Process.VirtualMemoryCounters));
+ AppendStruct(vmCounters, new VmCountersEx64(process.Process.VirtualMemoryCounters));
using (var ioCounters = processMo.CreateChild("IoCounters"))
- AppendStruct(ioCounters, IoCounters.SizeOf, process.Process.IoCounters);
+ AppendStruct(ioCounters, process.Process.IoCounters);
try
{
@@ -488,62 +489,62 @@ namespace ProcessHacker
if (pid <= 0)
return;
- using (MemoryObject modules = processMo.CreateChild("Modules"))
+ using (var modules = processMo.CreateChild("Modules"))
{
if (pid != 4)
{
var baseAddressList = new Dictionary();
bool isWow64 = false;
- using (ProcessHandle phandle = new ProcessHandle(pid, Program.MinProcessQueryRights | ProcessAccess.VmRead))
+ using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights | ProcessAccess.VmRead))
{
if (OSVersion.Architecture == OSArch.Amd64)
- isWow64 = phandle.IsWow64;
+ isWow64 = phandle.IsWow64();
- phandle.EnumModules(module =>
- {
- if (!baseAddressList.ContainsKey(module.BaseAddress))
+ phandle.EnumModules((module) =>
{
- DumpProcessModule(modules, module);
- baseAddressList.Add(module.BaseAddress, null);
- }
-
- return true;
- });
- }
-
- try
- {
- using (ProcessHandle phandle = new ProcessHandle(pid, ProcessAccess.QueryInformation | ProcessAccess.VmRead))
- {
- phandle.EnumMemory(memory =>
- {
- if (memory.Type == MemoryType.Mapped)
+ if (!baseAddressList.ContainsKey(module.BaseAddress))
{
- if (!baseAddressList.ContainsKey(memory.BaseAddress))
- {
- string fileName = phandle.GetMappedFileName(memory.BaseAddress);
-
- if (!string.IsNullOrEmpty(fileName))
- {
- fileName = FileUtils.GetFileName(fileName);
-
- DumpProcessModule(modules, new ProcessModule(
- memory.BaseAddress,
- memory.RegionSize.ToInt32(),
- IntPtr.Zero,
- 0,
- Path.GetFileName(fileName),
- fileName
- ));
-
- baseAddressList.Add(memory.BaseAddress, null);
- }
- }
+ DumpProcessModule(modules, module);
+ baseAddressList.Add(module.BaseAddress, null);
}
return true;
});
+ }
+
+ try
+ {
+ using (var phandle = new ProcessHandle(pid, ProcessAccess.QueryInformation | ProcessAccess.VmRead))
+ {
+ phandle.EnumMemory((memory) =>
+ {
+ if (memory.Type == MemoryType.Mapped)
+ {
+ if (!baseAddressList.ContainsKey(memory.BaseAddress))
+ {
+ string fileName = phandle.GetMappedFileName(memory.BaseAddress);
+
+ if (fileName != null)
+ {
+ fileName = FileUtils.GetFileName(fileName);
+
+ DumpProcessModule(modules, new ProcessModule(
+ memory.BaseAddress,
+ memory.RegionSize.ToInt32(),
+ IntPtr.Zero,
+ 0,
+ Path.GetFileName(fileName),
+ fileName
+ ));
+
+ baseAddressList.Add(memory.BaseAddress, null);
+ }
+ }
+ }
+
+ return true;
+ });
}
}
catch
@@ -561,16 +562,16 @@ namespace ProcessHacker
RtlQueryProcessDebugFlags.NonInvasive
);
- buffer.EnumModules(module =>
- {
- if (!baseAddressList.ContainsKey(module.BaseAddress))
+ buffer.EnumModules((module) =>
{
- DumpProcessModule(modules, module);
- baseAddressList.Add(module.BaseAddress, null);
- }
+ if (!baseAddressList.ContainsKey(module.BaseAddress))
+ {
+ DumpProcessModule(modules, module);
+ baseAddressList.Add(module.BaseAddress, null);
+ }
- return true;
- });
+ return true;
+ });
}
}
catch
@@ -622,22 +623,22 @@ namespace ProcessHacker
using (var thandle = phandle.GetToken(TokenAccess.Query))
{
- Sid user = thandle.User;
+ Sid user = thandle.GetUser();
bw.Write("UserName", user.GetFullName(true));
bw.Write("UserStringSid", user.StringSid);
- bw.Write("OwnerName", thandle.Owner.GetFullName(true));
- bw.Write("PrimaryGroupName", thandle.PrimaryGroup.GetFullName(true));
- bw.Write("SessionId", thandle.SessionId);
+ bw.Write("OwnerName", thandle.GetOwner().GetFullName(true));
+ bw.Write("PrimaryGroupName", thandle.GetPrimaryGroup().GetFullName(true));
+ bw.Write("SessionId", thandle.GetSessionId());
if (OSVersion.HasUac)
{
- bw.Write("Elevated", thandle.IsElevated);
- bw.Write("VirtualizationAllowed", thandle.IsVirtualizationAllowed);
- bw.Write("VirtualizationEnabled", thandle.IsVirtualizationEnabled);
+ bw.Write("Elevated", thandle.IsElevated());
+ bw.Write("VirtualizationAllowed", thandle.IsVirtualizationAllowed());
+ bw.Write("VirtualizationEnabled", thandle.IsVirtualizationEnabled());
}
- var statistics = thandle.Statistics;
+ var statistics = thandle.GetStatistics();
bw.Write("Type", (int)statistics.TokenType);
bw.Write("ImpersonationLevel", (int)statistics.ImpersonationLevel);
@@ -646,7 +647,7 @@ namespace ProcessHacker
bw.Write("MemoryUsed", statistics.DynamicCharged);
bw.Write("MemoryAvailable", statistics.DynamicAvailable);
- var groups = thandle.Groups;
+ var groups = thandle.GetGroups();
using (var groupsMo = tokenMo.CreateChild("Groups"))
{
@@ -662,18 +663,18 @@ namespace ProcessHacker
bw2.Close();
}
- var privileges = thandle.Privileges;
+ var privileges = thandle.GetPrivileges();
using (var privilegesMo = tokenMo.CreateChild("Privileges"))
{
BinaryWriter bw2 = new BinaryWriter(privilegesMo.GetWriteStream());
- foreach (Privilege t in privileges)
+ for (int i = 0; i < privileges.Length; i++)
{
bw2.WriteListEntry(
- t.Name + ";" +
- t.DisplayName + ";" +
- ((int)t.Attributes).ToString("x")
+ privileges[i].Name + ";" +
+ privileges[i].DisplayName + ";" +
+ ((int)privileges[i].Attributes).ToString("x")
);
}
@@ -685,7 +686,7 @@ namespace ProcessHacker
{
using (var thandle = phandle.GetToken(TokenAccess.QuerySource))
{
- var source = thandle.Source;
+ var source = thandle.GetSource();
bw.Write("SourceName", source.SourceName.TrimEnd('\0', '\r', '\n', ' '));
bw.Write("SourceLuid", source.SourceIdentifier.QuadPart);
diff --git a/1.x/trunk/ProcessHacker/Program/ExtendedCmd.cs b/1.x/trunk/ProcessHacker/Program/ExtendedCmd.cs
index 94d416705..2bea572d7 100644
--- a/1.x/trunk/ProcessHacker/Program/ExtendedCmd.cs
+++ b/1.x/trunk/ProcessHacker/Program/ExtendedCmd.cs
@@ -37,6 +37,13 @@ namespace ProcessHacker
{
public static void Run(IDictionary args)
{
+ try
+ {
+ ThemingScope.Activate();
+ }
+ catch
+ { }
+
if (!args.ContainsKey("-type"))
throw new Exception("-type switch required.");
diff --git a/1.x/trunk/ProcessHacker/Program/Program.cs b/1.x/trunk/ProcessHacker/Program/Program.cs
index b98af76f7..b3cd6fe3e 100644
--- a/1.x/trunk/ProcessHacker/Program/Program.cs
+++ b/1.x/trunk/ProcessHacker/Program/Program.cs
@@ -60,10 +60,7 @@ namespace ProcessHacker
///
/// The Results Window ID Generator
///
- public static IdGenerator ResultsIds = new IdGenerator
- {
- Sort = true
- };
+ public static IdGenerator ResultsIds = new IdGenerator() { Sort = true };
public static Dictionary Structs = new Dictionary();
@@ -75,7 +72,7 @@ namespace ProcessHacker
public static Dictionary ResultsWindows = new Dictionary();
public static Dictionary ResultsThreads = new Dictionary