From d5514528393e53aade0b77c6934f85f66e2afd69 Mon Sep 17 00:00:00 2001 From: wj32 Date: Sun, 9 Aug 2009 11:02:45 +0000 Subject: [PATCH] * moved back to AnyCPU * fixed several native API struct definitions; process enumeration is working on native x64 git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1681 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- trunk/Assistant/Assistant.csproj | 10 +- trunk/ExtraTools/ExtraTools.sln | 52 ++-- trunk/ExtraTools/NtObjects/NtObjects.csproj | 10 +- trunk/ExtraTools/NtProfiler/NtProfiler.csproj | 14 +- .../ProcessAnalyzer/ProcessAnalyzer.csproj | 10 +- .../SysCallHacker/SysCallHacker.csproj | 10 +- .../ProcessHacker.Common.csproj | 10 +- trunk/ProcessHacker.Common/Utils.cs | 12 + .../ProcessHacker.Native/Api/NativeStructs.cs | 265 +++--------------- trunk/ProcessHacker.Native/Lpc/Port.cs | 23 ++ trunk/ProcessHacker.Native/Lpc/PortMessage.cs | 35 ++- .../ProcessHacker.Native.csproj | 11 +- trunk/ProcessHacker.sln | 44 +-- .../Components/ProcessStatistics.cs | 2 +- .../Components/ProcessTree/ProcessNode.cs | 2 +- .../ProcessTree/ProcessTreeModel.cs | 5 +- trunk/ProcessHacker/Forms/ProcessWindow.cs | 4 +- trunk/ProcessHacker/ProcessHacker.csproj | 10 +- .../Providers/ProcessSystemProvider.cs | 4 +- trunk/TreeViewAdv/Aga.Controls.csproj | 14 +- 20 files changed, 211 insertions(+), 336 deletions(-) create mode 100644 trunk/ProcessHacker.Native/Lpc/Port.cs diff --git a/trunk/Assistant/Assistant.csproj b/trunk/Assistant/Assistant.csproj index 71b8871e6..1692069b3 100644 --- a/trunk/Assistant/Assistant.csproj +++ b/trunk/Assistant/Assistant.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {0710ADEF-F89E-4CBC-8150-B340460BC9D6} @@ -14,7 +14,7 @@ 512 Assistant.Program - + true full false @@ -22,16 +22,16 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU - + pdbonly true bin\Release\ TRACE prompt 4 - x86 + AnyCPU diff --git a/trunk/ExtraTools/ExtraTools.sln b/trunk/ExtraTools/ExtraTools.sln index eba19a780..69d24dbcd 100644 --- a/trunk/ExtraTools/ExtraTools.sln +++ b/trunk/ExtraTools/ExtraTools.sln @@ -15,34 +15,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysCallHacker", "SysCallHac EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 + Debug|AnyCPU = Debug|Any CPU + Release|AnyCPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|x86.ActiveCfg = Debug|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|x86.Build.0 = Debug|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Release|x86.ActiveCfg = Release|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Release|x86.Build.0 = Release|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|x86.ActiveCfg = Debug|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|x86.Build.0 = Debug|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|x86.ActiveCfg = Release|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|x86.Build.0 = Release|x86 - {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Debug|x86.ActiveCfg = Debug|x86 - {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Debug|x86.Build.0 = Debug|x86 - {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Release|x86.ActiveCfg = Release|x86 - {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Release|x86.Build.0 = Release|x86 - {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Debug|x86.ActiveCfg = Debug|x86 - {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Debug|x86.Build.0 = Debug|x86 - {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Release|x86.ActiveCfg = Release|x86 - {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Release|x86.Build.0 = Release|x86 - {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Debug|x86.ActiveCfg = Debug|x86 - {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Debug|x86.Build.0 = Debug|x86 - {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Release|x86.ActiveCfg = Release|x86 - {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Release|x86.Build.0 = Release|x86 - {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Debug|x86.ActiveCfg = Debug|x86 - {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Debug|x86.Build.0 = Debug|x86 - {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Release|x86.ActiveCfg = Release|x86 - {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Release|x86.Build.0 = Release|x86 + {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {8A448157-E1A7-4DDF-954E-287F1117832B}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {8A448157-E1A7-4DDF-954E-287F1117832B}.Release|AnyCPU.Build.0 = Release|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|AnyCPU.Build.0 = Release|Any CPU + {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {06AC6477-D3DA-4997-9A4A-4F809F7C9396}.Release|AnyCPU.Build.0 = Release|Any CPU + {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {E3CEB6D7-7080-4089-B54E-41025E30CE46}.Release|AnyCPU.Build.0 = Release|Any CPU + {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C}.Release|AnyCPU.Build.0 = Release|Any CPU + {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715}.Release|AnyCPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/trunk/ExtraTools/NtObjects/NtObjects.csproj b/trunk/ExtraTools/NtObjects/NtObjects.csproj index a9b295543..80fb1ef7a 100644 --- a/trunk/ExtraTools/NtObjects/NtObjects.csproj +++ b/trunk/ExtraTools/NtObjects/NtObjects.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {06AC6477-D3DA-4997-9A4A-4F809F7C9396} @@ -15,7 +15,7 @@ - + true full false @@ -23,16 +23,16 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU - + pdbonly true bin\Release\ TRACE prompt 4 - x86 + AnyCPU diff --git a/trunk/ExtraTools/NtProfiler/NtProfiler.csproj b/trunk/ExtraTools/NtProfiler/NtProfiler.csproj index 0ad6b90c9..f156eeca4 100644 --- a/trunk/ExtraTools/NtProfiler/NtProfiler.csproj +++ b/trunk/ExtraTools/NtProfiler/NtProfiler.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {E3CEB6D7-7080-4089-B54E-41025E30CE46} @@ -32,7 +32,7 @@ true app.manifest - + true full false @@ -40,16 +40,16 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU - + pdbonly true bin\Release\ TRACE prompt 4 - x86 + AnyCPU @@ -95,12 +95,12 @@ False - .NET Framework 2.0 %28x86%29 + .NET Framework 2.0 %28AnyCPU%29 true False - .NET Framework 3.0 %28x86%29 + .NET Framework 3.0 %28AnyCPU%29 false diff --git a/trunk/ExtraTools/ProcessAnalyzer/ProcessAnalyzer.csproj b/trunk/ExtraTools/ProcessAnalyzer/ProcessAnalyzer.csproj index 911310e2e..eeba5aae8 100644 --- a/trunk/ExtraTools/ProcessAnalyzer/ProcessAnalyzer.csproj +++ b/trunk/ExtraTools/ProcessAnalyzer/ProcessAnalyzer.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {A6709B97-F7B5-40AD-AB6E-F23019BA0A3C} @@ -14,7 +14,7 @@ 512 fake_base.ico - + true full false @@ -23,9 +23,9 @@ prompt 4 true - x86 + AnyCPU - + pdbonly true bin\Release\ @@ -33,7 +33,7 @@ prompt 4 true - x86 + AnyCPU diff --git a/trunk/ExtraTools/SysCallHacker/SysCallHacker.csproj b/trunk/ExtraTools/SysCallHacker/SysCallHacker.csproj index 6e8ba8018..3da8365d5 100644 --- a/trunk/ExtraTools/SysCallHacker/SysCallHacker.csproj +++ b/trunk/ExtraTools/SysCallHacker/SysCallHacker.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {39B5CDC9-0AB3-4E1F-862C-EA95BC5A0715} @@ -13,7 +13,7 @@ v2.0 512 - + true full false @@ -21,16 +21,16 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU - + pdbonly true bin\Release\ TRACE prompt 4 - x86 + AnyCPU diff --git a/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj b/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj index a408d2257..1cef04a00 100644 --- a/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj +++ b/trunk/ProcessHacker.Common/ProcessHacker.Common.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E} @@ -15,7 +15,7 @@ - + true full false @@ -28,9 +28,9 @@ true - x86 + AnyCPU - + pdbonly true bin\Release\ @@ -40,7 +40,7 @@ bin\Release\ProcessHacker.Common.xml 1591 true - x86 + AnyCPU diff --git a/trunk/ProcessHacker.Common/Utils.cs b/trunk/ProcessHacker.Common/Utils.cs index 729ef1f4b..3904e0d5f 100644 --- a/trunk/ProcessHacker.Common/Utils.cs +++ b/trunk/ProcessHacker.Common/Utils.cs @@ -477,6 +477,18 @@ namespace ProcessHacker.Common return (s == 0 ? "0" : s.ToString("#,#.##")) + " " + SizeUnitNames[i]; } + /// + /// Formats a size into a string representation, postfixing it with the correct unit. + /// + /// The size to format. + public static string FormatSize(IntPtr size) + { + unchecked + { + return FormatSize((ulong)size.ToInt64()); + } + } + /// /// Formats a size into a string representation, postfixing it with the correct unit. /// diff --git a/trunk/ProcessHacker.Native/Api/NativeStructs.cs b/trunk/ProcessHacker.Native/Api/NativeStructs.cs index 6ba5bd8e9..6e3fee72a 100644 --- a/trunk/ProcessHacker.Native/Api/NativeStructs.cs +++ b/trunk/ProcessHacker.Native/Api/NativeStructs.cs @@ -1693,9 +1693,9 @@ namespace ProcessHacker.Native.Api public int LowestPhysicalPageNumber; public int HighestPhysicalPageNumber; public int AllocationGranularity; - public int MinimumUserModeAddress; - public int MaximumUserModeAddress; - public int ActiveProcessorsAffinityMask; + public IntPtr MinimumUserModeAddress; + public IntPtr MaximumUserModeAddress; + public IntPtr ActiveProcessorsAffinityMask; public byte NumberOfProcessors; } @@ -1802,392 +1802,200 @@ namespace ProcessHacker.Native.Api /// The total idle time of all processors in units of 100-nanoseconds. /// public long IdleTime; - /// /// Total bytes read by calls to NtReadFile. /// public long IoReadTransferCount; - /// /// Total bytes written by calls to NtWriteFile. /// public long IoWriteTransferCount; - /// /// Total bytes transferred by other I/O operations. /// public long IoOtherTransferCount; - /// /// Number of calls to NtReadFile. /// public int IoReadOperationCount; - /// /// Number of calls to NtWriteFile. /// public int IoWriteOperationCount; - /// /// Number of calls to other I/O functions. /// public int IoOtherOperationCount; - /// /// The number of pages of physical memory available. /// public int AvailablePages; - /// /// The number of pages of committed virtual memory. /// public int CommittedPages; - /// /// The number of pages of virtual memory that could be committed /// without extending the system's pagefiles. /// public int CommitLimit; - /// /// The peak number of pages of committed virtual memory. /// public int PeakCommitment; - /// /// The total number of soft and hard page faults. /// public int PageFaults; - /// /// The number of copy-on-write page faults. /// public int CopyOnWriteFaults; - /// /// The number of soft page faults. /// public int TransitionFaults; - /// /// Something that the Native API reference book doesn't have. /// public int CacheTransitionFaults; - /// /// The number of demand zero faults. /// public int DemandZeroFaults; - /// /// The number of pages read from disk to resolve page faults. /// public int PagesRead; - /// /// The number of read operations initiated to resolve page faults. /// public int PagesReadIos; - public int CacheRead; public int CacheReadIos; - /// /// The number of pages written to the system's pagefiles. /// public int PagefilePagesWritten; - /// /// The number of write operations performed on the system's pagefiles. /// public int PagefilePagesWriteIos; - /// /// The number of pages written to mapped files. /// public int MappedFilePagesWritten; - /// /// The number of write operations performed on mapped files. /// public int MappedFilePageWriteIos; - /// /// The number of pages used by the paged pool. /// public int PagedPoolUsage; - /// /// The number of pages used by the non-paged pool. /// public int NonPagedPoolUsage; - /// /// The number of allocations made from the paged pool. /// public int PagedPoolAllocs; - /// /// The number of allocations returned to the paged pool. /// public int PagedPoolFrees; - /// /// The number of allocations made from the non-paged pool. /// public int NonPagedPoolAllocs; - /// /// The number of allocations returned to the non-paged pool. /// public int NonPagedPoolFrees; - /// /// The number of available System Page Table Entries. /// public int FreeSystemPtes; - /// /// The number of pages of pageable OS code and data in physical /// memory. /// public int SystemCodePages; - /// /// The number of pages of pageable driver code and data. /// public int TotalSystemDriverPages; - /// /// The number of pages of OS driver code and data. /// public int TotalSystemCodePages; - /// /// The number of times an allocation could be statisfied by one of the /// small non-paged lookaside lists. /// public int SmallNonPagedPoolLookasideListAllocateHits; - /// /// The number of times an allocation could be statisfied by one of the /// small paged lookaside lists. /// public int SmallPagedPoolLookasideAllocateHits; - public int Reserved3; - /// /// The number of pages of the system cache in physical memory. /// public int SystemCachePages; - /// /// The number of pages of the paged pool in physical memory. /// public int PagedPoolPages; - /// /// The number of pages of pageable driver code and data in physical memory. /// public int SystemDriverPages; - /// /// The number of asynchronous fast read operations. /// public int FastReadNoWait; - /// /// The number of synchronous fast read operations. /// public int FastReadWait; - /// /// The number of fast read operations not possible because of resource /// conflicts. /// public int FastReadResourceMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int FastReadNotPossible; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int FastMdlReadNoWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int FastMdlReadWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int FastMdlReadResourceMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int FastMdlReadNotPossible; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MapDataNoWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MapDataWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MapDataNoWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MapDataWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int PinMappedDataCount; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int PinReadNoWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int PinReadWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int PinReadNoWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int PinReadWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int CopyReadNoWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int CopyReadWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int CopyReadNoWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int CopyReadWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MdlReadNoWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MdlReadWait; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MdlReadNoWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int MdlReadWaitMiss; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int ReadAheadIos; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int LazyWriteIos; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int LazyWritePages; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int DataFlushes; - - /// - /// Google Books won't let me read the page containing the description - /// for this field! - /// public int DataPages; - - /// - /// The total number of context switches. - /// public int ContextSwitches; - - /// - /// The number of first level translation buffer fills. - /// public int FirstLevelTbFills; - - /// - /// The number of second level translation buffer fills. - /// public int SecondLevelTbFills; - - /// - /// The number of system calls executed. - /// public int SystemCalls; } @@ -2196,22 +2004,33 @@ namespace ProcessHacker.Native.Api { public int NextEntryOffset; public int NumberOfThreads; - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public long[] Spare; - + public long SpareLi1; + public long SpareLi2; + public long SpareLi3; public long CreateTime; // 8 public long UserTime; public long KernelTime; public UnicodeString ImageName; public int BasePriority; - public int ProcessId; // should be IntPtr - public int InheritedFromProcessId; // should be IntPtr + private IntPtr _processId; + private IntPtr _inheritedFromProcessId; public int HandleCount; public int SessionId; public IntPtr PageDirectoryBase; public VmCountersEx VirtualMemoryCounters; public IoCounters IoCounters; + + public int ProcessId + { + get { return _processId.ToInt32(); } + set { _processId = value.ToIntPtr(); } + } + + public int InheritedFromProcessId + { + get { return _inheritedFromProcessId.ToInt32(); } + set { _inheritedFromProcessId = value.ToIntPtr(); } + } } [StructLayout(LayoutKind.Sequential)] @@ -2634,35 +2453,33 @@ namespace ProcessHacker.Native.Api [StructLayout(LayoutKind.Sequential)] public struct VmCounters { - // These all should be IntPtrs... - public int PeakVirtualSize; - public int VirtualSize; + public IntPtr PeakVirtualSize; + public IntPtr VirtualSize; public int PageFaultCount; - public int PeakWorkingSetSize; - public int WorkingSetSize; - public int QuotaPeakPagedPoolUsage; - public int QuotaPagedPoolUsage; - public int QuotaPeakNonPagedPoolUsage; - public int QuotaNonPagedPoolUsage; - public int PagefileUsage; - public int PeakPagefileUsage; + public IntPtr PeakWorkingSetSize; + public IntPtr WorkingSetSize; + public IntPtr QuotaPeakPagedPoolUsage; + public IntPtr QuotaPagedPoolUsage; + public IntPtr QuotaPeakNonPagedPoolUsage; + public IntPtr QuotaNonPagedPoolUsage; + public IntPtr PagefileUsage; + public IntPtr PeakPagefileUsage; } [StructLayout(LayoutKind.Sequential)] public struct VmCountersEx { - // These all should be IntPtrs... - public int PeakVirtualSize; - public int VirtualSize; + public IntPtr PeakVirtualSize; + public IntPtr VirtualSize; public int PageFaultCount; - public int PeakWorkingSetSize; - public int WorkingSetSize; - public int QuotaPeakPagedPoolUsage; - public int QuotaPagedPoolUsage; - public int QuotaPeakNonPagedPoolUsage; - public int QuotaNonPagedPoolUsage; - public int PagefileUsage; - public int PeakPagefileUsage; - public int PrivateBytes; + public IntPtr PeakWorkingSetSize; + public IntPtr WorkingSetSize; + public IntPtr QuotaPeakPagedPoolUsage; + public IntPtr QuotaPagedPoolUsage; + public IntPtr QuotaPeakNonPagedPoolUsage; + public IntPtr QuotaNonPagedPoolUsage; + public IntPtr PagefileUsage; + public IntPtr PeakPagefileUsage; + public IntPtr PrivatePageCount; } } diff --git a/trunk/ProcessHacker.Native/Lpc/Port.cs b/trunk/ProcessHacker.Native/Lpc/Port.cs new file mode 100644 index 000000000..2bbde2d9e --- /dev/null +++ b/trunk/ProcessHacker.Native/Lpc/Port.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ProcessHacker.Native.Api; +using ProcessHacker.Native.Objects; + +namespace ProcessHacker.Native.Lpc +{ + public class Port : NativeObject + { + public Port(string name) + { + this.Handle = PortHandle.Create( + name, + ObjectFlags.OpenIf, + null, + Win32.PortMessageMaxDataLength, + Win32.PortMessageMaxLength, + 0 + ); + } + } +} diff --git a/trunk/ProcessHacker.Native/Lpc/PortMessage.cs b/trunk/ProcessHacker.Native/Lpc/PortMessage.cs index 017f9d55c..19b15d62e 100644 --- a/trunk/ProcessHacker.Native/Lpc/PortMessage.cs +++ b/trunk/ProcessHacker.Native/Lpc/PortMessage.cs @@ -19,17 +19,25 @@ namespace ProcessHacker.Native.Lpc private MemoryRegion _referencedData; public PortMessage(byte[] data) + : this(null, data) + { } + + public PortMessage(PortMessage existingMessage, byte[] data) { using (var alloc = new MemoryAlloc(data.Length)) { alloc.WriteBytes(0, data); - this.InitializeMessage(alloc, (short)alloc.Size); + this.InitializeMessage(existingMessage, alloc, (short)alloc.Size); } } public PortMessage(MemoryRegion data, short dataLength) + : this(null, data, dataLength) + { } + + public PortMessage(PortMessage existingMessage, MemoryRegion data, short dataLength) { - this.InitializeMessage(data, dataLength); + this.InitializeMessage(existingMessage, data, dataLength); } internal PortMessage(MemoryRegion headerAndData) @@ -62,6 +70,11 @@ namespace ProcessHacker.Native.Lpc get { return _message.DataLength; } } + internal PortMessageStruct Header + { + get { return _message; } + } + public int MessageId { get { return _message.MessageId; } @@ -72,17 +85,25 @@ namespace ProcessHacker.Native.Lpc get { return _message.Type; } } - private void InitializeMessage(MemoryRegion data, short dataLength) + private void InitializeMessage(PortMessage existingMessage, MemoryRegion data, short dataLength) { if (dataLength > Win32.PortMessageMaxDataLength) throw new ArgumentOutOfRangeException("Data length is too large."); if (dataLength < 0) throw new ArgumentOutOfRangeException("Data length cannot be negative."); - _message = new PortMessageStruct(); - _message.DataLength = dataLength; - _message.TotalLength = (short)(_portMessageSize + dataLength); - _message.DataInfoOffset = 0; + if (existingMessage != null) + { + _message = existingMessage.Header; + } + else + { + _message = new PortMessageStruct(); + _message.DataLength = dataLength; + _message.TotalLength = (short)(_portMessageSize + dataLength); + _message.DataInfoOffset = 0; + } + _data = data; _referencedData = data; diff --git a/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj b/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj index 5f13d21bf..365ced6a8 100644 --- a/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj +++ b/trunk/ProcessHacker.Native/ProcessHacker.Native.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {8A448157-E1A7-4DDF-954E-287F1117832B} @@ -15,7 +15,7 @@ - + true full false @@ -28,9 +28,9 @@ - x86 + AnyCPU - + pdbonly true bin\Release\ @@ -40,7 +40,7 @@ true bin\Release\ProcessHacker.Native.xml 1591 - x86 + AnyCPU @@ -62,6 +62,7 @@ + diff --git a/trunk/ProcessHacker.sln b/trunk/ProcessHacker.sln index a1dd6dcbd..c93bbacd6 100644 --- a/trunk/ProcessHacker.sln +++ b/trunk/ProcessHacker.sln @@ -16,30 +16,30 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aga.Controls", "TreeViewAdv EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Debug|x86.ActiveCfg = Debug|x86 - {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Debug|x86.Build.0 = Debug|x86 - {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Release|x86.ActiveCfg = Release|x86 - {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Release|x86.Build.0 = Release|x86 - {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Debug|x86.ActiveCfg = Debug|x86 - {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Debug|x86.Build.0 = Debug|x86 - {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Release|x86.ActiveCfg = Release|x86 - {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Release|x86.Build.0 = Release|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|x86.ActiveCfg = Debug|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|x86.Build.0 = Debug|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|x86.ActiveCfg = Release|x86 - {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|x86.Build.0 = Release|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|x86.ActiveCfg = Debug|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|x86.Build.0 = Debug|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Release|x86.ActiveCfg = Release|x86 - {8A448157-E1A7-4DDF-954E-287F1117832B}.Release|x86.Build.0 = Release|x86 - {E73BB233-D88B-44A7-A98F-D71EE158381D}.Debug|x86.ActiveCfg = Debug|x86 - {E73BB233-D88B-44A7-A98F-D71EE158381D}.Debug|x86.Build.0 = Debug|x86 - {E73BB233-D88B-44A7-A98F-D71EE158381D}.Release|x86.ActiveCfg = Release|x86 - {E73BB233-D88B-44A7-A98F-D71EE158381D}.Release|x86.Build.0 = Release|x86 + {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEEA1778-1702-4964-8793-A98FE37E4D2B}.Release|Any CPU.Build.0 = Release|Any CPU + {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0710ADEF-F89E-4CBC-8150-B340460BC9D6}.Release|Any CPU.Build.0 = Release|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E10F5E8-D4FA-4980-BB23-2EDD134AC15E}.Release|Any CPU.Build.0 = Release|Any CPU + {8A448157-E1A7-4DDF-954E-287F1117832B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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/trunk/ProcessHacker/Components/ProcessStatistics.cs b/trunk/ProcessHacker/Components/ProcessStatistics.cs index 4d98f0577..9472f10e6 100644 --- a/trunk/ProcessHacker/Components/ProcessStatistics.cs +++ b/trunk/ProcessHacker/Components/ProcessStatistics.cs @@ -103,7 +103,7 @@ namespace ProcessHacker.Components labelCPUUserTime.Text = Utils.FormatTimeSpan(new TimeSpan(item.Process.UserTime)); labelCPUTotalTime.Text = Utils.FormatTimeSpan(new TimeSpan(item.Process.KernelTime + item.Process.UserTime)); - labelMemoryPB.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PrivateBytes); + labelMemoryPB.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PrivatePageCount); labelMemoryWS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.WorkingSetSize); labelMemoryPWS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakWorkingSetSize); labelMemoryVS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.VirtualSize); diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs index 76620689e..98c614a08 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs @@ -175,7 +175,7 @@ namespace ProcessHacker public string PvtMemory { - get { return Utils.FormatSize(_pitem.Process.VirtualMemoryCounters.PrivateBytes); } + get { return Utils.FormatSize(_pitem.Process.VirtualMemoryCounters.PrivatePageCount); } } public string WorkingSet diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs index 25c784404..7ff7cbadc 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using System.Windows.Forms; using Aga.Controls.Tree; using ProcessHacker.Common; +using ProcessHacker.Native; namespace ProcessHacker { @@ -246,8 +247,8 @@ namespace ProcessHacker case "pid": return ModifySort(n1.Pid.CompareTo(n2.Pid), sortO); case "pvt. memory": - return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PrivateBytes.CompareTo( - n2.ProcessItem.Process.VirtualMemoryCounters.PrivateBytes), sortO); + 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); diff --git a/trunk/ProcessHacker/Forms/ProcessWindow.cs b/trunk/ProcessHacker/Forms/ProcessWindow.cs index 7a916b86a..56b1a12b9 100644 --- a/trunk/ProcessHacker/Forms/ProcessWindow.cs +++ b/trunk/ProcessHacker/Forms/ProcessWindow.cs @@ -887,7 +887,7 @@ namespace ProcessHacker " (K: " + (procKernel * 100).ToString("F2") + "%, U: " + (procUser * 100).ToString("F2") + "%)"; - string pvtString = Utils.FormatSize(item.Process.VirtualMemoryCounters.PrivateBytes); + string pvtString = Utils.FormatSize(item.Process.VirtualMemoryCounters.PrivatePageCount); plotterMemory.Text = "Pvt: " + pvtString + ", WS: " + Utils.FormatSize(item.Process.VirtualMemoryCounters.WorkingSetSize); @@ -915,7 +915,7 @@ namespace ProcessHacker indicatorPvt.Maximum = (int)maxPvt; else indicatorPvt.Maximum = (int)maxWS; - indicatorPvt.Data1 = item.Process.VirtualMemoryCounters.PrivateBytes; + indicatorPvt.Data1 = item.Process.VirtualMemoryCounters.PrivatePageCount.ToInt32(); indicatorPvt.TextValue = pvtString; // Update the I/O Bytes indicator. diff --git a/trunk/ProcessHacker/ProcessHacker.csproj b/trunk/ProcessHacker/ProcessHacker.csproj index 0af0c86e8..407ceb625 100644 --- a/trunk/ProcessHacker/ProcessHacker.csproj +++ b/trunk/ProcessHacker/ProcessHacker.csproj @@ -2,7 +2,7 @@ Debug - x86 + AnyCPU 9.0.30729 2.0 {EEEA1778-1702-4964-8793-A98FE37E4D2B} @@ -17,7 +17,7 @@ app.manifest OnBuildSuccess - + true full false @@ -26,9 +26,9 @@ prompt 4 true - x86 + AnyCPU - + pdbonly true bin\Release\ @@ -38,7 +38,7 @@ 4 true false - x86 + AnyCPU diff --git a/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs b/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs index c0d233ed9..4f351526e 100644 --- a/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs +++ b/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs @@ -1094,8 +1094,8 @@ namespace ProcessHacker item.LongHistoryManager.Update(ProcessStats.IoOther, item.DeltaManager[ProcessStats.IoOther]); item.LongHistoryManager.Update(ProcessStats.IoReadOther, item.DeltaManager[ProcessStats.IoRead] + item.DeltaManager[ProcessStats.IoOther]); - item.LongHistoryManager.Update(ProcessStats.PrivateMemory, processInfo.VirtualMemoryCounters.PrivateBytes); - item.LongHistoryManager.Update(ProcessStats.WorkingSet, processInfo.VirtualMemoryCounters.WorkingSetSize); + item.LongHistoryManager.Update(ProcessStats.PrivateMemory, processInfo.VirtualMemoryCounters.PrivatePageCount.ToInt64()); + item.LongHistoryManager.Update(ProcessStats.WorkingSet, processInfo.VirtualMemoryCounters.WorkingSetSize.ToInt64()); item.Process = processInfo; diff --git a/trunk/TreeViewAdv/Aga.Controls.csproj b/trunk/TreeViewAdv/Aga.Controls.csproj index 09b383387..eb4a139f9 100644 --- a/trunk/TreeViewAdv/Aga.Controls.csproj +++ b/trunk/TreeViewAdv/Aga.Controls.csproj @@ -1,7 +1,7 @@  Debug - x86 + AnyCPU 9.0.30729 2.0 {E73BB233-D88B-44A7-A98F-D71EE158381D} @@ -43,7 +43,7 @@ - + true full false @@ -53,9 +53,9 @@ 4 -Microsoft.Design#CA1020;-Microsoft.Design#CA1060;-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1303;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA1304;-Microsoft.Globalization#CA1305;-Microsoft.Globalization#CA1300;-Microsoft.Maintainability#CA1501;-Microsoft.Mobility#CA1601;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1819;-Microsoft.Usage#CA2208 true - x86 + AnyCPU - + pdbonly true bin\Release\ @@ -63,7 +63,7 @@ prompt 4 true - x86 + AnyCPU @@ -228,12 +228,12 @@ False - .NET Framework 2.0 %28x86%29 + .NET Framework 2.0 %28AnyCPU%29 false False - .NET Framework 3.0 %28x86%29 + .NET Framework 3.0 %28AnyCPU%29 false