diff --git a/Debug/PCMgr32.dll b/Debug/PCMgr32.dll index 98abbcd..3c481a7 100644 Binary files a/Debug/PCMgr32.dll and b/Debug/PCMgr32.dll differ diff --git a/Debug/PCMgr32.exe b/Debug/PCMgr32.exe index 6cb5528..acd351d 100644 Binary files a/Debug/PCMgr32.exe and b/Debug/PCMgr32.exe differ diff --git a/Debug/PCMgr32.ini b/Debug/PCMgr32.ini index 73cd2cd..88d6ca5 100644 --- a/Debug/PCMgr32.ini +++ b/Debug/PCMgr32.ini @@ -6,19 +6,19 @@ X32Warning=FALSE MainGrouping=TRUE ListSortIndex=0 ListSortDk=TRUE -OldSize=906-589 -OldPos=258-125 +OldSize=923-632 +OldPos=127-137 OldIsMax=FALSE MainHeaders=#TitleStatus-80#TitlePID-55#TitleProcName-170#TitleCPU-75#TitleRam-75#TitleDisk-75#TitleNet-75 MainHeaders1=239 -ListStartsWidths=#200#225#200#100#200 -ListUWPsWidths=#291#287#283 -ListUsersWidths=#450#50#50#60 +ListStartsWidths= +ListUWPsWidths=#300#260#260 +ListUsersWidths= ListDriversWidths=#154#100#87#81#190#90#46#128 ListServiceWidths=#113#52#173#65#99#67#62#180#85 OldSizeSimple=380-334 SimpleView=FALSE -OldSizeGraphic=640-320 +OldSizeGraphic=0-0 DetalHeaders=TitleProcName-190#TitlePID-55#TitleStatus-55#TitleUserName-70#TitleCPU-60#TitleWorkingSetPrivate-70#TitleDescription-400# DetalSort=0#Descending [TopMost] diff --git a/Debug/PCMgrApp32.dll b/Debug/PCMgrApp32.dll index e05f631..e856040 100644 Binary files a/Debug/PCMgrApp32.dll and b/Debug/PCMgrApp32.dll differ diff --git a/Debug/PCMgrCmd32.dll b/Debug/PCMgrCmd32.dll index 44ca42f..2f77181 100644 Binary files a/Debug/PCMgrCmd32.dll and b/Debug/PCMgrCmd32.dll differ diff --git a/Debug/PCMgrKernel32.dll b/Debug/PCMgrKernel32.dll index 4c90176..2f846f8 100644 Binary files a/Debug/PCMgrKernel32.dll and b/Debug/PCMgrKernel32.dll differ diff --git a/Debug/en/PCMgrApp32.resource2.dll b/Debug/en/PCMgrApp32.resource2.dll index cce9d6b..0453cbb 100644 Binary files a/Debug/en/PCMgrApp32.resource2.dll and b/Debug/en/PCMgrApp32.resource2.dll differ diff --git a/Debug/en/PCMgrApp32.resources.dll b/Debug/en/PCMgrApp32.resources.dll index f55086c..6f389ce 100644 Binary files a/Debug/en/PCMgrApp32.resources.dll and b/Debug/en/PCMgrApp32.resources.dll differ diff --git a/PCMgrCmdRunner/PCMgrCmdRunner.cpp b/PCMgrCmdRunner/PCMgrCmdRunner.cpp index ddea3b5..8889e01 100644 Binary files a/PCMgrCmdRunner/PCMgrCmdRunner.cpp and b/PCMgrCmdRunner/PCMgrCmdRunner.cpp differ diff --git a/PCMgrCmdRunner/PCMgrCmdRunnerEntry.h b/PCMgrCmdRunner/PCMgrCmdRunnerEntry.h index 4b9a518..a5d5e56 100644 --- a/PCMgrCmdRunner/PCMgrCmdRunnerEntry.h +++ b/PCMgrCmdRunner/PCMgrCmdRunnerEntry.h @@ -14,6 +14,7 @@ CMD_CAPI(BOOL) MStartRunCmdThread(); CMD_CAPI(BOOL) MStopRunCmdThread(); CMD_CAPI(int) MAppCmdStart(); +M_CMD_HANDLER(MRunCmd_Fix); M_CMD_HANDLER(MRunCmd_TaskList); M_CMD_HANDLER(MRunCmd_ScList); M_CMD_HANDLER(MRunCmd_ScStop); diff --git a/PCMgrLoader/PCMgrLoader.vcxproj.user b/PCMgrLoader/PCMgrLoader.vcxproj.user index 0746f69..a6fdb30 100644 --- a/PCMgrLoader/PCMgrLoader.vcxproj.user +++ b/PCMgrLoader/PCMgrLoader.vcxproj.user @@ -13,7 +13,7 @@ NativeOnly - WindowsRemoteDebugger + WindowsLocalDebugger 192.168.116.130 diff --git a/Release/PCMgr32.ini b/Release/PCMgr32.ini new file mode 100644 index 0000000..49dfb3c --- /dev/null +++ b/Release/PCMgr32.ini @@ -0,0 +1,34 @@ +[AppSetting] +Lanuage=zh +LastWindowTitle=ÈÎÎñ¹ÜÀíÆ÷ +RefeshTime=Slow +MainGrouping=TRUE +ListSortIndex=0 +ListSortDk=TRUE +OldSize=780-500 +OldPos=327-199 +OldIsMax=FALSE +MainHeaders=#TitleStatus-80#TitlePID-55#TitleProcName-170#TitleCPU-75#TitleRam-75#TitleDisk-75#TitleNet-75 +MainHeaders1=200 +ListStartsWidths=#200#200#200#100#200 +ListUWPsWidths=#300#260#260 +ListUsersWidths=#450#50#50#60 +ListDriversWidths=#154#100#87#81#190#90#46#128 +ListServiceWidths=#113#43#173#65#99#67#62#180#85 +OldSizeSimple=380-334 +SimpleView=FALSE +OldSizeGraphic=640-320 +[TopMost] +AppSetting=FALSE +[CloseHideToNotfication] +AppSetting=FALSE +[MinHide] +AppSetting=FALSE +[MainGrouping] +AppSetting=FALSE +[AlwaysOnTop] +AppSetting=FALSE +[Configure] +RamPercentage=FALSE +DiskPercentage=FALSE +NetPercentage=FALSE diff --git a/TaskMgr/Ctls/PerformanceList.cs b/TaskMgr/Ctls/PerformanceList.cs index fda1468..3510619 100644 --- a/TaskMgr/Ctls/PerformanceList.cs +++ b/TaskMgr/Ctls/PerformanceList.cs @@ -412,9 +412,12 @@ public class PerformanceListItem { public PerformanceListItem() { + dataIem2 = new List(); dataIem = new List(); for (int i = 0; i < 30; i++) Data.Add(0); + for (int i = 0; i < 30; i++) + Data2.Add(0); Gray = false; } @@ -441,6 +444,7 @@ public Pen BasePen2 } public string Name { get; set; } public List Data { get { return dataIem; } } + public List Data2 { get { return dataIem2; } } public object Tag { get; set; } diff --git a/TaskMgr/Ctls/PerformancePageCpu.cs b/TaskMgr/Ctls/PerformancePageCpu.cs index 07850f0..e7e89fc 100644 --- a/TaskMgr/Ctls/PerformancePageCpu.cs +++ b/TaskMgr/Ctls/PerformancePageCpu.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; using System.Drawing; using System.Text; using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Diagnostics; using PCMgr.Lanuages; using static PCMgr.NativeMethods; @@ -155,32 +152,32 @@ private void GetStaticInfos() notDrawGrid = true; } - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("MaxSpeed"), MCpuInfoMonitor.GetCpuFrequency().ToString() + " MHz")); - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("CpuCpunt"), cpuCount.ToString())); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("MaxSpeed", false), MCpuInfoMonitor.GetCpuFrequency().ToString() + " MHz")); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("CpuCpunt", false), cpuCount.ToString())); if (MCpuInfoMonitor.GetCpuInfos()) { - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("CpuPackageCount"), MCpuInfoMonitor.GetCpuPackage().ToString())); - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem("L" + 1 + LanuageMgr.GetStr("Cache"), FormatFileSize1(Convert.ToInt32(MCpuInfoMonitor.GetCpuL1Cache())))); - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem("L" + 2 + LanuageMgr.GetStr("Cache"), FormatFileSize1(Convert.ToInt32(MCpuInfoMonitor.GetCpuL2Cache())))); - if (MCpuInfoMonitor.GetCpuL3Cache() != 0) performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem("L" + 3 + LanuageMgr.GetStr("Cache"), FormatFileSize1(Convert.ToInt32(MCpuInfoMonitor.GetCpuL3Cache())))); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("CpuPackageCount", false), MCpuInfoMonitor.GetCpuPackage().ToString())); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem("L" + 1 + LanuageMgr.GetStr("Cache", false), FormatFileSize1(Convert.ToInt32(MCpuInfoMonitor.GetCpuL1Cache())))); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem("L" + 2 + LanuageMgr.GetStr("Cache", false), FormatFileSize1(Convert.ToInt32(MCpuInfoMonitor.GetCpuL2Cache())))); + if (MCpuInfoMonitor.GetCpuL3Cache() != 0) performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem("L" + 3 + LanuageMgr.GetStr("Cache", false), FormatFileSize1(Convert.ToInt32(MCpuInfoMonitor.GetCpuL3Cache())))); } } private void InitRuntimeInfo() { item_cpuuseage = new PerformanceInfos.PerformanceInfoSpeicalItem(); - item_cpuuseage.Name = LanuageMgr.GetStr("Useage"); + item_cpuuseage.Name = LanuageMgr.GetStr("Useage", false); item_cpuuseage_freq = new PerformanceInfos.PerformanceInfoSpeicalItem(); item_cpuuseage_freq.Name = ""; item_cpuuseage_freq.Value = " "; item_process_count = new PerformanceInfos.PerformanceInfoSpeicalItem(); - item_process_count.Name = FormMain.str_proc_count; + item_process_count.Name = LanuageMgr.GetStr("ProcessCount"); item_thread_count = new PerformanceInfos.PerformanceInfoSpeicalItem(); - item_thread_count.Name = LanuageMgr.GetStr("ThreadCount"); + item_thread_count.Name = LanuageMgr.GetStr("ThreadCount", false); item_handle_count = new PerformanceInfos.PerformanceInfoSpeicalItem(); - item_handle_count.Name = LanuageMgr.GetStr("HandleCount"); + item_handle_count.Name = LanuageMgr.GetStr("HandleCount", false); item_run_time = new PerformanceInfos.PerformanceInfoSpeicalItem(); - item_run_time.Name = LanuageMgr.GetStr("RunTime"); + item_run_time.Name = LanuageMgr.GetStr("RunTime", false); performanceInfos.SpeicalItems.Add(item_cpuuseage); performanceInfos.SpeicalItems.Add(item_cpuuseage_freq); performanceInfos.SpeicalItems.Add(item_process_count); diff --git a/TaskMgr/Ctls/PerformancePageDisk.cs b/TaskMgr/Ctls/PerformancePageDisk.cs index b6c48e5..293dafd 100644 --- a/TaskMgr/Ctls/PerformancePageDisk.cs +++ b/TaskMgr/Ctls/PerformancePageDisk.cs @@ -65,8 +65,8 @@ public void PageUpdate() ref read, ref write, ref avgque); //下é¢çš„æ¡ç›® - item_readSpeed.Value = NativeMethods.FormatFileSize(Convert.ToInt64(readbytes)) + "/" + FormMain.str_sec; - item_writeSpeed.Value = NativeMethods.FormatFileSize(Convert.ToInt64(writebytes)) + "/" + FormMain.str_sec; + item_readSpeed.Value = NativeMethods.FormatFileSize(Convert.ToInt64(readbytes)) + "/" + LanuageFBuffers.Str_Second; + item_writeSpeed.Value = NativeMethods.FormatFileSize(Convert.ToInt64(writebytes)) + "/" + LanuageFBuffers.Str_Second; item_responseTime.Value = avgque.ToString("0.0") + "%"; @@ -84,7 +84,7 @@ public void PageUpdate() if (lastMaxSpeed > performanceGridSpeed.MaxValue) { performanceGridSpeed.MaxValue = GetSpeedMaxUnit(); - performanceGridSpeed.RightText = NativeMethods.FormatFileSizeKBUnit(performanceGridSpeed.MaxValue) + "/" + FormMain.str_sec; + performanceGridSpeed.RightText = NativeMethods.FormatFileSizeKBUnit(performanceGridSpeed.MaxValue) + "/" + LanuageFBuffers.Str_Second; } else if (lastMaxSpeed < performanceGridSpeed.MaxValue) { @@ -92,7 +92,7 @@ public void PageUpdate() if (performanceGridSpeed.MaxValue > maxValue) { performanceGridSpeed.MaxValue = maxValue; - performanceGridSpeed.RightText = NativeMethods.FormatFileSizeKBUnit(maxValue) + "/" + FormMain.str_sec; + performanceGridSpeed.RightText = NativeMethods.FormatFileSizeKBUnit(maxValue) + "/" + LanuageFBuffers.Str_Second; } } //刷新最大速度标尺 @@ -101,7 +101,7 @@ public void PageUpdate() && lastMaxSpeed <= performanceGridSpeed.MaxValue * 0.95) { performanceGridSpeed.MaxScaleValue = lastMaxSpeed; - performanceGridSpeed.MaxScaleText = NativeMethods.FormatFileSizeKBUnit(lastMaxSpeed) + "/" + FormMain.str_sec; + performanceGridSpeed.MaxScaleText = NativeMethods.FormatFileSizeKBUnit(lastMaxSpeed) + "/" + LanuageFBuffers.Str_Second; } else performanceGridSpeed.MaxScaleValue = 0; @@ -176,9 +176,9 @@ private void InitValues() item_writeSpeed.Name = LanuageMgr.GetStr("WriteSpeed"); item_readSpeed.DrawFrontLine = true; item_readSpeed.FrontLineIsDotted = true; - item_readSpeed.FrontLineColor = FormMain.DiskDrawColor; + item_readSpeed.FrontLineColor = Main.MainPagePerf.DiskDrawColor; item_writeSpeed.DrawFrontLine = true; - item_writeSpeed.FrontLineColor = FormMain.DiskDrawColor; + item_writeSpeed.FrontLineColor = Main.MainPagePerf.DiskDrawColor; performanceInfos.FontTitle = new Font("Microsoft YaHei UI", 9); performanceInfos.SpeicalItems.Add(item_diskTime); @@ -186,7 +186,7 @@ private void InitValues() performanceInfos.SpeicalItems.Add(item_readSpeed); performanceInfos.SpeicalItems.Add(item_writeSpeed); - performanceGridSpeed.RightText = NativeMethods.FormatFileSizeKBUnit(lastMaxSpeed) + "/" + FormMain.str_sec; + performanceGridSpeed.RightText = NativeMethods.FormatFileSizeKBUnit(lastMaxSpeed) + "/" + LanuageFBuffers.Str_Second; performanceGridSpeed.MaxValue = 100; performanceGridSpeed.DrawData2 = true; } @@ -204,8 +204,8 @@ private void InitStaticValues() size = UInt64.Parse(stringBuilderSize.ToString()); performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("Capacity"), NativeMethods.FormatFileSizeKBUnit(Convert.ToInt64(size / 1024)))); performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("Formatted"), NativeMethods.FormatFileSizeKBUnit(Convert.ToInt64(size / 1024)))); - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("IsSystemDir"), MDEVICE_GetIsSystemDisk(currDiskName) ? FormMain.str_Yes : FormMain.str_No)); - performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("PageFile"), MDEVICE_GetIsPageFileDisk(currDiskName) ? FormMain.str_Yes : FormMain.str_No)); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("IsSystemDir"), MDEVICE_GetIsSystemDisk(currDiskName) ? LanuageMgr.GetStr("Yes") : LanuageMgr.GetStr("No"))); + performanceInfos.StaticItems.Add(new PerformanceInfos.PerformanceInfoStaticItem(LanuageMgr.GetStr("PageFile"), MDEVICE_GetIsPageFileDisk(currDiskName) ? LanuageMgr.GetStr("Yes") : LanuageMgr.GetStr("No"))); performanceTitle1.SmallTitle = stringBuilderName.ToString(); } diff --git a/TaskMgr/Ctls/PerformancePageNet.cs b/TaskMgr/Ctls/PerformancePageNet.cs index 9e2343f..6190768 100644 --- a/TaskMgr/Ctls/PerformancePageNet.cs +++ b/TaskMgr/Ctls/PerformancePageNet.cs @@ -104,8 +104,8 @@ public bool PageUpdateSimple(out string customString, out int outdata1, out int performanceGrid.AddData((int)(lastReceive / 1024 * 8)); } - customString = FormMain.str_Sent + " : " + (lastSent / 1024 * 8).ToString("0.0") + " " - + FormMain.str_Receive + " : " + (lastReceive / 1024 * 8).ToString("0.0") + " Kbps"; + customString = LanuageMgr.GetStr("Send") + " " + (lastSent / 1024 * 8).ToString("0.0") + " " + + LanuageMgr.GetStr("Receive") + " " + (lastReceive / 1024 * 8).ToString("0.0") + " Kbps"; outdata1 = (int)(lastSent * 0.0001); outdata2 = (int)(lastReceive * 0.0001); return true; @@ -118,17 +118,17 @@ public void PageInit() item_readSpeed = new PerformanceInfos.PerformanceInfoSpeicalItem(); item_writeSpeed = new PerformanceInfos.PerformanceInfoSpeicalItem(); item_writeSpeed.LineSp = true; - item_readSpeed.Name = FormMain.str_Sent; - item_writeSpeed.Name = FormMain.str_Receive; + item_readSpeed.Name = LanuageMgr.GetStr("Send"); + item_writeSpeed.Name = LanuageMgr.GetStr("Receive"); item_readSpeed.DrawFrontLine = true; - item_readSpeed.FrontLineColor = FormMain.NetDrawColor; + item_readSpeed.FrontLineColor = Main.MainPagePerf.NetDrawColor; item_readSpeed.FrontLineIsDotted = true; item_writeSpeed.DrawFrontLine = true; - item_writeSpeed.FrontLineColor = FormMain.NetDrawColor; + item_writeSpeed.FrontLineColor = Main.MainPagePerf.NetDrawColor; performanceGrid.MaxValue = 100; performanceGrid.DrawData2 = true; - performanceGrid.MaxUnitPen = new Pen(FormMain.NetDrawColor); + performanceGrid.MaxUnitPen = new Pen(Main.MainPagePerf.NetDrawColor); performanceInfos.FontTitle = new Font("Microsoft YaHei UI", 9); performanceInfos.SpeicalItems.Add(item_readSpeed); @@ -163,9 +163,13 @@ private int GetSpeedMaxUnit() return 5120;//5m if (lastMaxSpeed < 10300) return 10240;//10m - if (lastMaxSpeed < 103000) + if (lastMaxSpeed < 20500) + return 20480;//20m + if (lastMaxSpeed < 51000) + return 51200;//50m + if (lastMaxSpeed < 103400) return 102400;//100m - if (lastMaxSpeed < 513000) + if (lastMaxSpeed < 520000) return 512000;//500m else return 1048576;//1g } diff --git a/TaskMgr/Ctls/PerformanceRamPoolGrid.cs b/TaskMgr/Ctls/PerformanceRamPoolGrid.cs index ba5c16c..93f8d08 100644 --- a/TaskMgr/Ctls/PerformanceRamPoolGrid.cs +++ b/TaskMgr/Ctls/PerformanceRamPoolGrid.cs @@ -11,8 +11,8 @@ public PerformanceRamPoolGrid() { SetStyle(ControlStyles.Selectable, false); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); - BgBrush = new SolidBrush(FormMain.RamBgColor); - DrawPen = new Pen(FormMain.RamDrawColor); + BgBrush = new SolidBrush(Main.MainPagePerf.RamBgColor); + DrawPen = new Pen(Main.MainPagePerf.RamDrawColor); GridPen = new Pen(Color.FromArgb(206, 176, 215)); TextBrush = new SolidBrush(Color.Gray); stringFormatRight = new StringFormat(); @@ -157,7 +157,7 @@ protected override void OnPaint(PaintEventArgs e) g.DrawLine(DrawPen, w, r.Top, w, r.Bottom); if (w > 100) { - g.DrawString(FormMain.str_MemUsingS, Font, TextBrush, 0, Height - TopTextHeight + BottomTextOffestY); + g.DrawString(Lanuages.LanuageMgr.GetStr("MemUsingS"), Font, TextBrush, 0, Height - TopTextHeight + BottomTextOffestY); g.DrawString(StrVauleUsing, Font, TextBrush, rectInUse, stringFormatCenter); } } @@ -174,7 +174,7 @@ protected override void OnPaint(PaintEventArgs e) g.DrawLine(DrawPen, w, r.Top, w, r.Bottom); if (rectInUse.Width > 100)//å³ - g.DrawString(FormMain.str_MemModifed, Font, TextBrush, new Rectangle(rectInUse.X, Height - TopTextHeight + BottomTextOffestY, rectInUse.Width + rectModified.Width, TopTextHeight), stringFormatRight); + g.DrawString(Lanuages.LanuageMgr.GetStr("MemModifed"), Font, TextBrush, new Rectangle(rectInUse.X, Height - TopTextHeight + BottomTextOffestY, rectInUse.Width + rectModified.Width, TopTextHeight), stringFormatRight); if (w - oldw > 50) g.DrawString(StrVauleModified, Font, TextBrush, rectModified, stringFormatCenter); } @@ -191,7 +191,7 @@ protected override void OnPaint(PaintEventArgs e) g.DrawLine(DrawPen, w, r.Top, w, r.Bottom); if (w - oldw > 50) - g.DrawString(FormMain.str_MemStandby, Font, TextBrush, oldw, Height - TopTextHeight + BottomTextOffestY); + g.DrawString(Lanuages.LanuageMgr.GetStr("MemStandby"), Font, TextBrush, oldw, Height - TopTextHeight + BottomTextOffestY); if (w - oldw > 50) g.DrawString(StrVauleStandby, Font, TextBrush, rectStandby, stringFormatCenter); @@ -204,7 +204,7 @@ protected override void OnPaint(PaintEventArgs e) w += (int)(VauleFree * Width); rectFree = new Rectangle(oldw, r.Top, w - oldw, r.Height); if (rectStandby.Width > 50)//å³ - g.DrawString(FormMain.str_MemFree, Font, TextBrush, new Rectangle(rectStandby.X, Height - TopTextHeight + BottomTextOffestY, rectStandby.Width + rectFree.Width, TopTextHeight), stringFormatRight); + g.DrawString(Lanuages.LanuageMgr.GetStr("MemFree"), Font, TextBrush, new Rectangle(rectStandby.X, Height - TopTextHeight + BottomTextOffestY, rectStandby.Width + rectFree.Width, TopTextHeight), stringFormatRight); if (w - oldw > 50) g.DrawString(StrVauleFree, Font, TextBrush, rectFree, stringFormatCenter); diff --git a/TaskMgr/Ctls/TaskMgrList.cs b/TaskMgr/Ctls/TaskMgrList.cs index 133f291..65c5bd6 100644 --- a/TaskMgr/Ctls/TaskMgrList.cs +++ b/TaskMgr/Ctls/TaskMgrList.cs @@ -13,6 +13,8 @@ public class TaskMgrList : Control { internal const int itemHeight = 28, groupHeaderHeight = 38, smallItemHeight = 22; + public delegate int GetIndexCallback(); + public TaskMgrList() { SetStyle(ControlStyles.AllPaintingInWmPaint, true); @@ -192,8 +194,19 @@ private TaskMgrListItem mouseenteredItem private Image PauseUwpIco = null; private bool noHeader = false; - public bool isvs = false; - public bool ishs = false; + public GetIndexCallback DrawUWPPausedIconIndexGetCallback { get; set; } + public int DrawUWPPausedIconIndex + { + get + { + if (DrawUWPPausedIconIndexGetCallback != null) + return DrawUWPPausedIconIndexGetCallback.Invoke(); + return 0; + } + } + + internal bool isvs = false; + internal bool ishs = false; /// /// 获å–一个值,用以指示 System.ComponentModel.Component 当å‰æ˜¯å¦å¤„于设计模å¼ã€‚ @@ -548,7 +561,7 @@ private void DrawItem(Graphics g, TaskMgrListItem item, int index, Rectangle rec else g.DrawString(item.Text, fnormalText2, item.SubItems[0].ForeColorSolidBrush, new Rectangle(x + (DrawIcon ? 63 : 25) + (isChildItem ? 5 : 0), item.YPos - yOffest + 2, headerItem.Width - (DrawIcon ? 60 : 25) - (isChildItem ? 5 : 0), currItemHeight - 4), ChildStringFormat); } - if (drawAsPausedIcon && iReal == item.DrawUWPPausedIconIndex) + if (drawAsPausedIcon && iReal == DrawUWPPausedIconIndex) g.DrawImage(PauseUwpIco, new Rectangle(x + headerItem.Width - PauseUwpIco.Width - 2, item.YPos - yOffest + (isChildItem ? -2 : 2), PauseUwpIco.Width, PauseUwpIco.Height)); } else if (x > rect.Right) break; @@ -1326,9 +1339,6 @@ public Icon Icon public bool DrawUWPPaused { get; set; } public bool DrawUWPPausedGray { get; set; } - public int DrawUWPPausedIconIndex { get { - return FormMain.Instance.stateindex; - } } public int DisplayChildValue { get; set; } public bool DisplayChildCount { get; set; } diff --git a/TaskMgr/FormMain.Designer.cs b/TaskMgr/FormMain.Designer.cs index 70e7927..4949f40 100644 --- a/TaskMgr/FormMain.Designer.cs +++ b/TaskMgr/FormMain.Designer.cs @@ -181,28 +181,32 @@ private void InitializeComponent() // // splitContainerPerfCtls.Panel1 // + resources.ApplyResources(this.splitContainerPerfCtls.Panel1, "splitContainerPerfCtls.Panel1"); this.splitContainerPerfCtls.Panel1.Controls.Add(this.sp3); this.splitContainerPerfCtls.Panel1.Controls.Add(this.performanceLeftList); + this.toolTip.SetToolTip(this.splitContainerPerfCtls.Panel1, resources.GetString("splitContainerPerfCtls.Panel1.ToolTip")); // // splitContainerPerfCtls.Panel2 // resources.ApplyResources(this.splitContainerPerfCtls.Panel2, "splitContainerPerfCtls.Panel2"); - this.splitContainerPerfCtls.Panel2.SizeChanged += new System.EventHandler(this.splitContainerPerfCtls_Panel2_SizeChanged); + this.toolTip.SetToolTip(this.splitContainerPerfCtls.Panel2, resources.GetString("splitContainerPerfCtls.Panel2.ToolTip")); + this.toolTip.SetToolTip(this.splitContainerPerfCtls, resources.GetString("splitContainerPerfCtls.ToolTip")); // // sp3 // + resources.ApplyResources(this.sp3, "sp3"); this.sp3.BackColor = System.Drawing.Color.Silver; this.sp3.Cursor = System.Windows.Forms.Cursors.SizeWE; - resources.ApplyResources(this.sp3, "sp3"); this.sp3.Name = "sp3"; + this.toolTip.SetToolTip(this.sp3, resources.GetString("sp3.ToolTip")); // // performanceLeftList // - this.performanceLeftList.BackColor = System.Drawing.Color.White; resources.ApplyResources(this.performanceLeftList, "performanceLeftList"); + this.performanceLeftList.BackColor = System.Drawing.Color.White; this.performanceLeftList.Name = "performanceLeftList"; this.performanceLeftList.Selectedtem = null; - this.performanceLeftList.SelectedtndexChanged += new System.EventHandler(this.performanceLeftList_SelectedtndexChanged); + this.toolTip.SetToolTip(this.performanceLeftList, resources.GetString("performanceLeftList.ToolTip")); // // splitContainerFm // @@ -211,11 +215,16 @@ private void InitializeComponent() // // splitContainerFm.Panel1 // + resources.ApplyResources(this.splitContainerFm.Panel1, "splitContainerFm.Panel1"); this.splitContainerFm.Panel1.Controls.Add(this.treeFmLeft); + this.toolTip.SetToolTip(this.splitContainerFm.Panel1, resources.GetString("splitContainerFm.Panel1.ToolTip")); // // splitContainerFm.Panel2 // + resources.ApplyResources(this.splitContainerFm.Panel2, "splitContainerFm.Panel2"); this.splitContainerFm.Panel2.Controls.Add(this.listFm); + this.toolTip.SetToolTip(this.splitContainerFm.Panel2, resources.GetString("splitContainerFm.Panel2.ToolTip")); + this.toolTip.SetToolTip(this.splitContainerFm, resources.GetString("splitContainerFm.ToolTip")); // // treeFmLeft // @@ -223,11 +232,8 @@ private void InitializeComponent() this.treeFmLeft.FullRowSelect = true; this.treeFmLeft.ImageList = this.imageListFileMgrLeft; this.treeFmLeft.Name = "treeFmLeft"; - this.treeFmLeft.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeFmLeft_BeforeExpand); - this.treeFmLeft.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeFmLeft_AfterSelect); - this.treeFmLeft.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeFmLeft_NodeMouseClick); - this.treeFmLeft.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeFmLeft_KeyDown); - this.treeFmLeft.MouseClick += new System.Windows.Forms.MouseEventHandler(this.treeFmLeft_MouseClick); + this.toolTip.SetToolTip(this.treeFmLeft, resources.GetString("treeFmLeft.ToolTip")); + // // imageListFileMgrLeft // @@ -239,6 +245,7 @@ private void InitializeComponent() // // listFm // + resources.ApplyResources(this.listFm, "listFm"); this.listFm.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader3, @@ -246,17 +253,14 @@ private void InitializeComponent() this.columnHeader4, this.columnHeader5, this.columnHeader6}); - resources.ApplyResources(this.listFm, "listFm"); this.listFm.FullRowSelect = true; this.listFm.Name = "listFm"; this.listFm.ShowItemToolTips = true; this.listFm.SmallImageList = this.imageListFileTypeList; + this.toolTip.SetToolTip(this.listFm, resources.GetString("listFm.ToolTip")); this.listFm.UseCompatibleStateImageBehavior = false; this.listFm.View = System.Windows.Forms.View.Details; - this.listFm.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listFm_AfterLabelEdit); - this.listFm.SelectedIndexChanged += new System.EventHandler(this.listFm_SelectedIndexChanged); - this.listFm.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listFm_MouseClick); - this.listFm.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listFm_MouseDoubleClick); + // // columnHeader1 // @@ -303,10 +307,12 @@ private void InitializeComponent() this.tabControlMain.Cursor = System.Windows.Forms.Cursors.Default; this.tabControlMain.Name = "tabControlMain"; this.tabControlMain.SelectedIndex = 0; + this.toolTip.SetToolTip(this.tabControlMain, resources.GetString("tabControlMain.ToolTip")); this.tabControlMain.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabControlMain_Selected); // // tabPageProcCtl // + resources.ApplyResources(this.tabPageProcCtl, "tabPageProcCtl"); this.tabPageProcCtl.Controls.Add(this.sp4); this.tabPageProcCtl.Controls.Add(this.check_showAllProcess); this.tabPageProcCtl.Controls.Add(this.spl1); @@ -314,8 +320,8 @@ private void InitializeComponent() this.tabPageProcCtl.Controls.Add(this.listProcess); this.tabPageProcCtl.Controls.Add(this.lbProcessCount); this.tabPageProcCtl.Controls.Add(this.expandFewerDetals); - resources.ApplyResources(this.tabPageProcCtl, "tabPageProcCtl"); this.tabPageProcCtl.Name = "tabPageProcCtl"; + this.toolTip.SetToolTip(this.tabPageProcCtl, resources.GetString("tabPageProcCtl.ToolTip")); this.tabPageProcCtl.UseVisualStyleBackColor = true; // // sp4 @@ -324,13 +330,14 @@ private void InitializeComponent() this.sp4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(207)))), ((int)(((byte)(207))))); this.sp4.Name = "sp4"; this.sp4.TabStop = false; + this.toolTip.SetToolTip(this.sp4, resources.GetString("sp4.ToolTip")); // // check_showAllProcess // resources.ApplyResources(this.check_showAllProcess, "check_showAllProcess"); this.check_showAllProcess.Name = "check_showAllProcess"; + this.toolTip.SetToolTip(this.check_showAllProcess, resources.GetString("check_showAllProcess.ToolTip")); this.check_showAllProcess.UseVisualStyleBackColor = true; - this.check_showAllProcess.CheckedChanged += new System.EventHandler(this.check_showAllProcess_CheckedChanged); // // spl1 // @@ -338,13 +345,14 @@ private void InitializeComponent() this.spl1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(207)))), ((int)(((byte)(207))))); this.spl1.Name = "spl1"; this.spl1.TabStop = false; + this.toolTip.SetToolTip(this.spl1, resources.GetString("spl1.ToolTip")); // // btnEndProcess // resources.ApplyResources(this.btnEndProcess, "btnEndProcess"); this.btnEndProcess.Name = "btnEndProcess"; + this.toolTip.SetToolTip(this.btnEndProcess, resources.GetString("btnEndProcess.ToolTip")); this.btnEndProcess.UseVisualStyleBackColor = true; - this.btnEndProcess.Click += new System.EventHandler(this.btnEndProcess_Click); // // listProcess // @@ -358,18 +366,15 @@ private void InitializeComponent() this.listProcess.NoHeader = false; this.listProcess.SelectedItem = null; this.listProcess.ShowGroup = false; + this.toolTip.SetToolTip(this.listProcess, resources.GetString("listProcess.ToolTip")); this.listProcess.Value = 0D; this.listProcess.XOffest = 0; - this.listProcess.SelectItemChanged += new System.EventHandler(this.listProcess_SelectItemChanged); - this.listProcess.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listProcess_KeyDown); - this.listProcess.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listProcess_MouseClick); - this.listProcess.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listProcess_MouseDoubleClick); - this.listProcess.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listProcess_MouseDown); // // lbProcessCount // resources.ApplyResources(this.lbProcessCount, "lbProcessCount"); this.lbProcessCount.Name = "lbProcessCount"; + this.toolTip.SetToolTip(this.lbProcessCount, resources.GetString("lbProcessCount.ToolTip")); // // expandFewerDetals // @@ -377,18 +382,19 @@ private void InitializeComponent() this.expandFewerDetals.BackColor = System.Drawing.Color.White; this.expandFewerDetals.Expanded = false; this.expandFewerDetals.Name = "expandFewerDetals"; + this.toolTip.SetToolTip(this.expandFewerDetals, resources.GetString("expandFewerDetals.ToolTip")); this.expandFewerDetals.UseVisualStyleBackColor = false; - this.expandFewerDetals.Click += new System.EventHandler(this.expandFewerDetals_Click); // // tabPageKernelCtl // + resources.ApplyResources(this.tabPageKernelCtl, "tabPageKernelCtl"); this.tabPageKernelCtl.Controls.Add(this.sp5); this.tabPageKernelCtl.Controls.Add(this.linkLabelShowKernelTools); this.tabPageKernelCtl.Controls.Add(this.pl_driverNotLoadTip); this.tabPageKernelCtl.Controls.Add(this.lbDriversCount); this.tabPageKernelCtl.Controls.Add(this.listDrivers); - resources.ApplyResources(this.tabPageKernelCtl, "tabPageKernelCtl"); this.tabPageKernelCtl.Name = "tabPageKernelCtl"; + this.toolTip.SetToolTip(this.tabPageKernelCtl, resources.GetString("tabPageKernelCtl.ToolTip")); this.tabPageKernelCtl.UseVisualStyleBackColor = true; // // sp5 @@ -397,6 +403,7 @@ private void InitializeComponent() this.sp5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(207)))), ((int)(((byte)(207))))); this.sp5.Name = "sp5"; this.sp5.TabStop = false; + this.toolTip.SetToolTip(this.sp5, resources.GetString("sp5.ToolTip")); // // linkLabelShowKernelTools // @@ -405,7 +412,7 @@ private void InitializeComponent() this.linkLabelShowKernelTools.LinkColor = System.Drawing.Color.DodgerBlue; this.linkLabelShowKernelTools.Name = "linkLabelShowKernelTools"; this.linkLabelShowKernelTools.TabStop = true; - this.linkLabelShowKernelTools.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelShowKernelTools_LinkClicked); + this.toolTip.SetToolTip(this.linkLabelShowKernelTools, resources.GetString("linkLabelShowKernelTools.ToolTip")); // // pl_driverNotLoadTip // @@ -413,26 +420,29 @@ private void InitializeComponent() this.pl_driverNotLoadTip.Controls.Add(this.linkRestartAsAdminDriver); this.pl_driverNotLoadTip.Controls.Add(this.lbRestartAsAdminDriver); this.pl_driverNotLoadTip.Name = "pl_driverNotLoadTip"; + this.toolTip.SetToolTip(this.pl_driverNotLoadTip, resources.GetString("pl_driverNotLoadTip.ToolTip")); // // linkRestartAsAdminDriver // - this.linkRestartAsAdminDriver.DisabledLinkColor = System.Drawing.SystemColors.MenuHighlight; resources.ApplyResources(this.linkRestartAsAdminDriver, "linkRestartAsAdminDriver"); + this.linkRestartAsAdminDriver.DisabledLinkColor = System.Drawing.SystemColors.MenuHighlight; this.linkRestartAsAdminDriver.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkRestartAsAdminDriver.LinkColor = System.Drawing.SystemColors.MenuHighlight; this.linkRestartAsAdminDriver.Name = "linkRestartAsAdminDriver"; this.linkRestartAsAdminDriver.TabStop = true; - this.linkRestartAsAdminDriver.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkRestartAsAdminDriver_LinkClicked); + this.toolTip.SetToolTip(this.linkRestartAsAdminDriver, resources.GetString("linkRestartAsAdminDriver.ToolTip")); // // lbRestartAsAdminDriver // resources.ApplyResources(this.lbRestartAsAdminDriver, "lbRestartAsAdminDriver"); this.lbRestartAsAdminDriver.Name = "lbRestartAsAdminDriver"; + this.toolTip.SetToolTip(this.lbRestartAsAdminDriver, resources.GetString("lbRestartAsAdminDriver.ToolTip")); // // lbDriversCount // resources.ApplyResources(this.lbDriversCount, "lbDriversCount"); this.lbDriversCount.Name = "lbDriversCount"; + this.toolTip.SetToolTip(this.lbDriversCount, resources.GetString("lbDriversCount.ToolTip")); // // listDrivers // @@ -449,11 +459,10 @@ private void InitializeComponent() this.columnHeader23}); this.listDrivers.FullRowSelect = true; this.listDrivers.Name = "listDrivers"; + this.toolTip.SetToolTip(this.listDrivers, resources.GetString("listDrivers.ToolTip")); this.listDrivers.UseCompatibleStateImageBehavior = false; this.listDrivers.View = System.Windows.Forms.View.Details; - this.listDrivers.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listDrivers_ColumnClick); - this.listDrivers.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listDrivers_KeyDown); - this.listDrivers.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listDrivers_MouseUp); + // // columnHeader15 // @@ -489,10 +498,11 @@ private void InitializeComponent() // // tabPagePerfCtl // + resources.ApplyResources(this.tabPagePerfCtl, "tabPagePerfCtl"); this.tabPagePerfCtl.Controls.Add(this.linkLabelOpenPerfMon); this.tabPagePerfCtl.Controls.Add(this.splitContainerPerfCtls); - resources.ApplyResources(this.tabPagePerfCtl, "tabPagePerfCtl"); this.tabPagePerfCtl.Name = "tabPagePerfCtl"; + this.toolTip.SetToolTip(this.tabPagePerfCtl, resources.GetString("tabPagePerfCtl.ToolTip")); this.tabPagePerfCtl.UseVisualStyleBackColor = true; // // linkLabelOpenPerfMon @@ -504,14 +514,15 @@ private void InitializeComponent() this.linkLabelOpenPerfMon.LinkColor = System.Drawing.SystemColors.MenuHighlight; this.linkLabelOpenPerfMon.Name = "linkLabelOpenPerfMon"; this.linkLabelOpenPerfMon.TabStop = true; - this.linkLabelOpenPerfMon.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelOpenPerfMon_LinkClicked); + this.toolTip.SetToolTip(this.linkLabelOpenPerfMon, resources.GetString("linkLabelOpenPerfMon.ToolTip")); // // tabPageUWPCtl // + resources.ApplyResources(this.tabPageUWPCtl, "tabPageUWPCtl"); this.tabPageUWPCtl.Controls.Add(this.pl_UWPEnumFailTip); this.tabPageUWPCtl.Controls.Add(this.listUwpApps); - resources.ApplyResources(this.tabPageUWPCtl, "tabPageUWPCtl"); this.tabPageUWPCtl.Name = "tabPageUWPCtl"; + this.toolTip.SetToolTip(this.tabPageUWPCtl, resources.GetString("tabPageUWPCtl.ToolTip")); this.tabPageUWPCtl.UseVisualStyleBackColor = true; // // pl_UWPEnumFailTip @@ -519,11 +530,13 @@ private void InitializeComponent() resources.ApplyResources(this.pl_UWPEnumFailTip, "pl_UWPEnumFailTip"); this.pl_UWPEnumFailTip.Controls.Add(this.lbUWPEnumFailText); this.pl_UWPEnumFailTip.Name = "pl_UWPEnumFailTip"; + this.toolTip.SetToolTip(this.pl_UWPEnumFailTip, resources.GetString("pl_UWPEnumFailTip.ToolTip")); // // lbUWPEnumFailText // resources.ApplyResources(this.lbUWPEnumFailText, "lbUWPEnumFailText"); this.lbUWPEnumFailText.Name = "lbUWPEnumFailText"; + this.toolTip.SetToolTip(this.lbUWPEnumFailText, resources.GetString("lbUWPEnumFailText.ToolTip")); // // listUwpApps // @@ -536,16 +549,16 @@ private void InitializeComponent() this.listUwpApps.NoHeader = false; this.listUwpApps.SelectedItem = null; this.listUwpApps.ShowGroup = false; + this.toolTip.SetToolTip(this.listUwpApps, resources.GetString("listUwpApps.ToolTip")); this.listUwpApps.Value = 0D; this.listUwpApps.XOffest = 0; - this.listUwpApps.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listUwpApps_KeyDown); - this.listUwpApps.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listUwpApps_MouseClick); // // tabPageUsers // - this.tabPageUsers.Controls.Add(this.listUsers); resources.ApplyResources(this.tabPageUsers, "tabPageUsers"); + this.tabPageUsers.Controls.Add(this.listUsers); this.tabPageUsers.Name = "tabPageUsers"; + this.toolTip.SetToolTip(this.tabPageUsers, resources.GetString("tabPageUsers.ToolTip")); this.tabPageUsers.UseVisualStyleBackColor = true; // // listUsers @@ -559,20 +572,20 @@ private void InitializeComponent() this.listUsers.NoHeader = false; this.listUsers.SelectedItem = null; this.listUsers.ShowGroup = false; + this.toolTip.SetToolTip(this.listUsers, resources.GetString("listUsers.ToolTip")); this.listUsers.Value = 0D; this.listUsers.XOffest = 0; - this.listUsers.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listUsers_KeyDown); - this.listUsers.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listUsers_MouseClick); // // tabPageScCtl // + resources.ApplyResources(this.tabPageScCtl, "tabPageScCtl"); this.tabPageScCtl.Controls.Add(this.pl_ScNeedAdminTip); this.tabPageScCtl.Controls.Add(this.sp2); this.tabPageScCtl.Controls.Add(this.linkOpenScMsc); this.tabPageScCtl.Controls.Add(this.listService); this.tabPageScCtl.Controls.Add(this.lbServicesCount); - resources.ApplyResources(this.tabPageScCtl, "tabPageScCtl"); this.tabPageScCtl.Name = "tabPageScCtl"; + this.toolTip.SetToolTip(this.tabPageScCtl, resources.GetString("tabPageScCtl.ToolTip")); this.tabPageScCtl.UseVisualStyleBackColor = true; // // pl_ScNeedAdminTip @@ -581,21 +594,23 @@ private void InitializeComponent() this.pl_ScNeedAdminTip.Controls.Add(this.linkRebootAsAdmin); this.pl_ScNeedAdminTip.Controls.Add(this.lbScNeedAdminTip); this.pl_ScNeedAdminTip.Name = "pl_ScNeedAdminTip"; + this.toolTip.SetToolTip(this.pl_ScNeedAdminTip, resources.GetString("pl_ScNeedAdminTip.ToolTip")); // // linkRebootAsAdmin // - this.linkRebootAsAdmin.DisabledLinkColor = System.Drawing.SystemColors.MenuHighlight; resources.ApplyResources(this.linkRebootAsAdmin, "linkRebootAsAdmin"); + this.linkRebootAsAdmin.DisabledLinkColor = System.Drawing.SystemColors.MenuHighlight; this.linkRebootAsAdmin.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.linkRebootAsAdmin.LinkColor = System.Drawing.SystemColors.MenuHighlight; this.linkRebootAsAdmin.Name = "linkRebootAsAdmin"; this.linkRebootAsAdmin.TabStop = true; - this.linkRebootAsAdmin.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkRebootAsAdmin_LinkClicked); + this.toolTip.SetToolTip(this.linkRebootAsAdmin, resources.GetString("linkRebootAsAdmin.ToolTip")); // // lbScNeedAdminTip // resources.ApplyResources(this.lbScNeedAdminTip, "lbScNeedAdminTip"); this.lbScNeedAdminTip.Name = "lbScNeedAdminTip"; + this.toolTip.SetToolTip(this.lbScNeedAdminTip, resources.GetString("lbScNeedAdminTip.ToolTip")); // // sp2 // @@ -603,6 +618,7 @@ private void InitializeComponent() this.sp2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(207)))), ((int)(((byte)(207))))); this.sp2.Name = "sp2"; this.sp2.TabStop = false; + this.toolTip.SetToolTip(this.sp2, resources.GetString("sp2.ToolTip")); // // linkOpenScMsc // @@ -612,7 +628,7 @@ private void InitializeComponent() this.linkOpenScMsc.LinkColor = System.Drawing.SystemColors.MenuHighlight; this.linkOpenScMsc.Name = "linkOpenScMsc"; this.linkOpenScMsc.TabStop = true; - this.linkOpenScMsc.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkOpenScMsc_LinkClicked); + this.toolTip.SetToolTip(this.linkOpenScMsc, resources.GetString("linkOpenScMsc.ToolTip")); // // listService // @@ -631,11 +647,10 @@ private void InitializeComponent() this.listService.FullRowSelect = true; this.listService.MultiSelect = false; this.listService.Name = "listService"; + this.toolTip.SetToolTip(this.listService, resources.GetString("listService.ToolTip")); this.listService.UseCompatibleStateImageBehavior = false; this.listService.View = System.Windows.Forms.View.Details; - this.listService.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listService_ColumnClick); - this.listService.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listService_KeyDown); - this.listService.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listService_MouseClick); + // // columnHeader7 // @@ -677,38 +692,38 @@ private void InitializeComponent() // resources.ApplyResources(this.lbServicesCount, "lbServicesCount"); this.lbServicesCount.Name = "lbServicesCount"; + this.toolTip.SetToolTip(this.lbServicesCount, resources.GetString("lbServicesCount.ToolTip")); // // tabPageDetals // + resources.ApplyResources(this.tabPageDetals, "tabPageDetals"); this.tabPageDetals.Controls.Add(this.btnEndProcessDetals); this.tabPageDetals.Controls.Add(this.listProcessDetals); - resources.ApplyResources(this.tabPageDetals, "tabPageDetals"); this.tabPageDetals.Name = "tabPageDetals"; + this.toolTip.SetToolTip(this.tabPageDetals, resources.GetString("tabPageDetals.ToolTip")); this.tabPageDetals.UseVisualStyleBackColor = true; // // btnEndProcessDetals // resources.ApplyResources(this.btnEndProcessDetals, "btnEndProcessDetals"); this.btnEndProcessDetals.Name = "btnEndProcessDetals"; + this.toolTip.SetToolTip(this.btnEndProcessDetals, resources.GetString("btnEndProcessDetals.ToolTip")); this.btnEndProcessDetals.UseVisualStyleBackColor = true; - this.btnEndProcessDetals.Click += new System.EventHandler(this.btnEndProcessDetals_Click); + // // listProcessDetals // - this.listProcessDetals.AllowColumnReorder = true; resources.ApplyResources(this.listProcessDetals, "listProcessDetals"); + this.listProcessDetals.AllowColumnReorder = true; this.listProcessDetals.FullRowSelect = true; this.listProcessDetals.MultiSelect = false; this.listProcessDetals.Name = "listProcessDetals"; this.listProcessDetals.ShowItemToolTips = true; this.listProcessDetals.SmallImageList = this.imageListProcessDetalsIcons; + this.toolTip.SetToolTip(this.listProcessDetals, resources.GetString("listProcessDetals.ToolTip")); this.listProcessDetals.UseCompatibleStateImageBehavior = false; this.listProcessDetals.View = System.Windows.Forms.View.Details; - this.listProcessDetals.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listProcessDetals_ColumnClick); - this.listProcessDetals.ColumnReordered += new System.Windows.Forms.ColumnReorderedEventHandler(this.listProcessDetals_ColumnReordered); - this.listProcessDetals.SelectedIndexChanged += new System.EventHandler(this.listProcessDetals_SelectedIndexChanged); - this.listProcessDetals.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listProcessDetals_KeyDown); - this.listProcessDetals.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listProcessDetals_MouseClick); + // // imageListProcessDetalsIcons // @@ -718,9 +733,10 @@ private void InitializeComponent() // // tabPageStartCtl // - this.tabPageStartCtl.Controls.Add(this.listStartup); resources.ApplyResources(this.tabPageStartCtl, "tabPageStartCtl"); + this.tabPageStartCtl.Controls.Add(this.listStartup); this.tabPageStartCtl.Name = "tabPageStartCtl"; + this.toolTip.SetToolTip(this.tabPageStartCtl, resources.GetString("tabPageStartCtl.ToolTip")); this.tabPageStartCtl.UseVisualStyleBackColor = true; // // listStartup @@ -734,25 +750,26 @@ private void InitializeComponent() this.listStartup.NoHeader = false; this.listStartup.SelectedItem = null; this.listStartup.ShowGroup = false; + this.toolTip.SetToolTip(this.listStartup, resources.GetString("listStartup.ToolTip")); this.listStartup.Value = 0D; this.listStartup.XOffest = 0; - this.listStartup.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listStartup_KeyDown); - this.listStartup.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listStartup_MouseClick); // // tabPageFileCtl // + resources.ApplyResources(this.tabPageFileCtl, "tabPageFileCtl"); this.tabPageFileCtl.Controls.Add(this.lbFileMgrStatus); this.tabPageFileCtl.Controls.Add(this.btnFmAddGoto); this.tabPageFileCtl.Controls.Add(this.textBoxFmCurrent); this.tabPageFileCtl.Controls.Add(this.splitContainerFm); - resources.ApplyResources(this.tabPageFileCtl, "tabPageFileCtl"); this.tabPageFileCtl.Name = "tabPageFileCtl"; + this.toolTip.SetToolTip(this.tabPageFileCtl, resources.GetString("tabPageFileCtl.ToolTip")); this.tabPageFileCtl.UseVisualStyleBackColor = true; // // lbFileMgrStatus // resources.ApplyResources(this.lbFileMgrStatus, "lbFileMgrStatus"); this.lbFileMgrStatus.Name = "lbFileMgrStatus"; + this.toolTip.SetToolTip(this.lbFileMgrStatus, resources.GetString("lbFileMgrStatus.ToolTip")); // // btnFmAddGoto // @@ -760,20 +777,22 @@ private void InitializeComponent() this.btnFmAddGoto.Name = "btnFmAddGoto"; this.toolTip.SetToolTip(this.btnFmAddGoto, resources.GetString("btnFmAddGoto.ToolTip")); this.btnFmAddGoto.UseVisualStyleBackColor = true; - this.btnFmAddGoto.Click += new System.EventHandler(this.btnFmAddGoto_Click); + // // textBoxFmCurrent // resources.ApplyResources(this.textBoxFmCurrent, "textBoxFmCurrent"); this.textBoxFmCurrent.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBoxFmCurrent.Name = "textBoxFmCurrent"; - this.textBoxFmCurrent.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxFmCurrent_KeyDown); + this.toolTip.SetToolTip(this.textBoxFmCurrent, resources.GetString("textBoxFmCurrent.ToolTip")); + // // lbStartingStatus // resources.ApplyResources(this.lbStartingStatus, "lbStartingStatus"); this.lbStartingStatus.AutoEllipsis = true; this.lbStartingStatus.Name = "lbStartingStatus"; + this.toolTip.SetToolTip(this.lbStartingStatus, resources.GetString("lbStartingStatus.ToolTip")); // // spBottom // @@ -781,9 +800,12 @@ private void InitializeComponent() this.spBottom.BackColor = System.Drawing.Color.DarkGray; this.spBottom.Name = "spBottom"; this.spBottom.TabStop = false; + this.toolTip.SetToolTip(this.spBottom, resources.GetString("spBottom.ToolTip")); // // contextMenuStripUWP // + resources.ApplyResources(this.contextMenuStripUWP, "contextMenuStripUWP"); + this.contextMenuStripUWP.ImageScalingSize = new System.Drawing.Size(32, 32); this.contextMenuStripUWP.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.打开应用ToolStripMenuItem, this.å¸è½½åº”用ToolStripMenuItem, @@ -793,43 +815,36 @@ private void InitializeComponent() this.å¤åˆ¶å‘布者ToolStripMenuItem}); this.contextMenuStripUWP.Name = "contextMenuStripUWP"; this.contextMenuStripUWP.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - resources.ApplyResources(this.contextMenuStripUWP, "contextMenuStripUWP"); + this.toolTip.SetToolTip(this.contextMenuStripUWP, resources.GetString("contextMenuStripUWP.ToolTip")); // // 打开应用ToolStripMenuItem // - this.打开应用ToolStripMenuItem.Name = "打开应用ToolStripMenuItem"; resources.ApplyResources(this.打开应用ToolStripMenuItem, "打开应用ToolStripMenuItem"); - this.打开应用ToolStripMenuItem.Click += new System.EventHandler(this.打开应用ToolStripMenuItem_Click); + this.打开应用ToolStripMenuItem.Name = "打开应用ToolStripMenuItem"; // // å¸è½½åº”用ToolStripMenuItem // - this.å¸è½½åº”用ToolStripMenuItem.Name = "å¸è½½åº”用ToolStripMenuItem"; resources.ApplyResources(this.å¸è½½åº”用ToolStripMenuItem, "å¸è½½åº”用ToolStripMenuItem"); - this.å¸è½½åº”用ToolStripMenuItem.Click += new System.EventHandler(this.å¸è½½åº”用ToolStripMenuItem_Click); // // 打开安装ä½ç½®ToolStripMenuItem // - this.打开安装ä½ç½®ToolStripMenuItem.Name = "打开安装ä½ç½®ToolStripMenuItem"; resources.ApplyResources(this.打开安装ä½ç½®ToolStripMenuItem, "打开安装ä½ç½®ToolStripMenuItem"); - this.打开安装ä½ç½®ToolStripMenuItem.Click += new System.EventHandler(this.打开安装ä½ç½®ToolStripMenuItem_Click); + this.打开安装ä½ç½®ToolStripMenuItem.Name = "打开安装ä½ç½®ToolStripMenuItem"; // // å¤åˆ¶å称ToolStripMenuItem // - this.å¤åˆ¶å称ToolStripMenuItem.Name = "å¤åˆ¶å称ToolStripMenuItem"; resources.ApplyResources(this.å¤åˆ¶å称ToolStripMenuItem, "å¤åˆ¶å称ToolStripMenuItem"); - this.å¤åˆ¶å称ToolStripMenuItem.Click += new System.EventHandler(this.å¤åˆ¶å称ToolStripMenuItem_Click); + this.å¤åˆ¶å称ToolStripMenuItem.Name = "å¤åˆ¶å称ToolStripMenuItem"; // // å¤åˆ¶å®Œæ•´å称ToolStripMenuItem // - this.å¤åˆ¶å®Œæ•´å称ToolStripMenuItem.Name = "å¤åˆ¶å®Œæ•´å称ToolStripMenuItem"; resources.ApplyResources(this.å¤åˆ¶å®Œæ•´å称ToolStripMenuItem, "å¤åˆ¶å®Œæ•´å称ToolStripMenuItem"); - this.å¤åˆ¶å®Œæ•´å称ToolStripMenuItem.Click += new System.EventHandler(this.å¤åˆ¶å®Œæ•´å称ToolStripMenuItem_Click); + this.å¤åˆ¶å®Œæ•´å称ToolStripMenuItem.Name = "å¤åˆ¶å®Œæ•´å称ToolStripMenuItem"; // // å¤åˆ¶å‘布者ToolStripMenuItem // - this.å¤åˆ¶å‘布者ToolStripMenuItem.Name = "å¤åˆ¶å‘布者ToolStripMenuItem"; resources.ApplyResources(this.å¤åˆ¶å‘布者ToolStripMenuItem, "å¤åˆ¶å‘布者ToolStripMenuItem"); - this.å¤åˆ¶å‘布者ToolStripMenuItem.Click += new System.EventHandler(this.å¤åˆ¶å‘布者ToolStripMenuItem_Click); + this.å¤åˆ¶å‘布者ToolStripMenuItem.Name = "å¤åˆ¶å‘布者ToolStripMenuItem"; // // listApps // @@ -841,20 +856,18 @@ private void InitializeComponent() this.listApps.NoHeader = false; this.listApps.SelectedItem = null; this.listApps.ShowGroup = false; + this.toolTip.SetToolTip(this.listApps, resources.GetString("listApps.ToolTip")); this.listApps.Value = 0D; this.listApps.XOffest = 0; - this.listApps.SelectItemChanged += new System.EventHandler(this.listApps_SelectItemChanged); - this.listApps.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listApps_KeyDown); - this.listApps.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listApps_MouseClick); - this.listApps.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listApps_MouseDoubleClick); // // pl_simple // + resources.ApplyResources(this.pl_simple, "pl_simple"); this.pl_simple.Controls.Add(this.expandMoreDetals); this.pl_simple.Controls.Add(this.btnEndTaskSimple); this.pl_simple.Controls.Add(this.listApps); - resources.ApplyResources(this.pl_simple, "pl_simple"); this.pl_simple.Name = "pl_simple"; + this.toolTip.SetToolTip(this.pl_simple, resources.GetString("pl_simple.ToolTip")); // // expandMoreDetals // @@ -862,18 +875,20 @@ private void InitializeComponent() this.expandMoreDetals.BackColor = System.Drawing.Color.White; this.expandMoreDetals.Expanded = false; this.expandMoreDetals.Name = "expandMoreDetals"; + this.toolTip.SetToolTip(this.expandMoreDetals, resources.GetString("expandMoreDetals.ToolTip")); this.expandMoreDetals.UseVisualStyleBackColor = false; - this.expandMoreDetals.Click += new System.EventHandler(this.expandMoreDetals_Click); // // btnEndTaskSimple // resources.ApplyResources(this.btnEndTaskSimple, "btnEndTaskSimple"); this.btnEndTaskSimple.Name = "btnEndTaskSimple"; + this.toolTip.SetToolTip(this.btnEndTaskSimple, resources.GetString("btnEndTaskSimple.ToolTip")); this.btnEndTaskSimple.UseVisualStyleBackColor = true; - this.btnEndTaskSimple.Click += new System.EventHandler(this.btnEndTaskSimple_Click); // // contextMenuStripProcDetalsCol // + resources.ApplyResources(this.contextMenuStripProcDetalsCol, "contextMenuStripProcDetalsCol"); + this.contextMenuStripProcDetalsCol.ImageScalingSize = new System.Drawing.Size(32, 32); this.contextMenuStripProcDetalsCol.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.éšè—列ToolStripMenuItem, this.选择列ToolStripMenuItem, @@ -881,51 +896,50 @@ private void InitializeComponent() this.将此列调整为åˆé€‚大å°ToolStripMenuItem}); this.contextMenuStripProcDetalsCol.Name = "contextMenuStripProcDetalsCol"; this.contextMenuStripProcDetalsCol.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - resources.ApplyResources(this.contextMenuStripProcDetalsCol, "contextMenuStripProcDetalsCol"); + this.toolTip.SetToolTip(this.contextMenuStripProcDetalsCol, resources.GetString("contextMenuStripProcDetalsCol.ToolTip")); // // éšè—列ToolStripMenuItem // - this.éšè—列ToolStripMenuItem.Name = "éšè—列ToolStripMenuItem"; resources.ApplyResources(this.éšè—列ToolStripMenuItem, "éšè—列ToolStripMenuItem"); - this.éšè—列ToolStripMenuItem.Click += new System.EventHandler(this.éšè—列ToolStripMenuItem_Click); + this.éšè—列ToolStripMenuItem.Name = "éšè—列ToolStripMenuItem"; // // 选择列ToolStripMenuItem // - this.选择列ToolStripMenuItem.Name = "选择列ToolStripMenuItem"; resources.ApplyResources(this.选择列ToolStripMenuItem, "选择列ToolStripMenuItem"); - this.选择列ToolStripMenuItem.Click += new System.EventHandler(this.选择列ToolStripMenuItem_Click); + this.选择列ToolStripMenuItem.Name = "选择列ToolStripMenuItem"; // // toolStripSeparator1 // - this.toolStripSeparator1.Name = "toolStripSeparator1"; resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); + this.toolStripSeparator1.Name = "toolStripSeparator1"; // // 将此列调整为åˆé€‚大å°ToolStripMenuItem // - this.将此列调整为åˆé€‚大å°ToolStripMenuItem.Name = "将此列调整为åˆé€‚大å°ToolStripMenuItem"; resources.ApplyResources(this.将此列调整为åˆé€‚大å°ToolStripMenuItem, "将此列调整为åˆé€‚大å°ToolStripMenuItem"); - this.将此列调整为åˆé€‚大å°ToolStripMenuItem.Click += new System.EventHandler(this.将此列调整为åˆé€‚大å°ToolStripMenuItem_Click); + this.将此列调整为åˆé€‚大å°ToolStripMenuItem.Name = "将此列调整为åˆé€‚大å°ToolStripMenuItem"; // // contextMenuStripTray // + resources.ApplyResources(this.contextMenuStripTray, "contextMenuStripTray"); + this.contextMenuStripTray.ImageScalingSize = new System.Drawing.Size(32, 32); this.contextMenuStripTray.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.显示éšè—主界é¢ToolStripMenuItem, this.退出程åºToolStripMenuItem}); this.contextMenuStripTray.Name = "contextMenuStripTray"; this.contextMenuStripTray.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - resources.ApplyResources(this.contextMenuStripTray, "contextMenuStripTray"); + this.toolTip.SetToolTip(this.contextMenuStripTray, resources.GetString("contextMenuStripTray.ToolTip")); this.contextMenuStripTray.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripTray_Opening); // // 显示éšè—主界é¢ToolStripMenuItem // - this.显示éšè—主界é¢ToolStripMenuItem.Name = "显示éšè—主界é¢ToolStripMenuItem"; resources.ApplyResources(this.显示éšè—主界é¢ToolStripMenuItem, "显示éšè—主界é¢ToolStripMenuItem"); + this.显示éšè—主界é¢ToolStripMenuItem.Name = "显示éšè—主界é¢ToolStripMenuItem"; this.显示éšè—主界é¢ToolStripMenuItem.Click += new System.EventHandler(this.显示éšè—主界é¢ToolStripMenuItem_Click); // // 退出程åºToolStripMenuItem // - this.退出程åºToolStripMenuItem.Name = "退出程åºToolStripMenuItem"; resources.ApplyResources(this.退出程åºToolStripMenuItem, "退出程åºToolStripMenuItem"); + this.退出程åºToolStripMenuItem.Name = "退出程åºToolStripMenuItem"; this.退出程åºToolStripMenuItem.Click += new System.EventHandler(this.退出程åºToolStripMenuItem_Click); // // pl_perfGridHost @@ -933,103 +947,103 @@ private void InitializeComponent() resources.ApplyResources(this.pl_perfGridHost, "pl_perfGridHost"); this.pl_perfGridHost.Cursor = System.Windows.Forms.Cursors.Arrow; this.pl_perfGridHost.Name = "pl_perfGridHost"; + this.toolTip.SetToolTip(this.pl_perfGridHost, resources.GetString("pl_perfGridHost.ToolTip")); // // contextMenuStripMainHeader // + resources.ApplyResources(this.contextMenuStripMainHeader, "contextMenuStripMainHeader"); + this.contextMenuStripMainHeader.ImageScalingSize = new System.Drawing.Size(32, 32); this.contextMenuStripMainHeader.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator2, this.资æºå€¼ToolStripMenuItem}); this.contextMenuStripMainHeader.Name = "contextMenuStripMainHeader"; this.contextMenuStripMainHeader.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - resources.ApplyResources(this.contextMenuStripMainHeader, "contextMenuStripMainHeader"); + this.toolTip.SetToolTip(this.contextMenuStripMainHeader, resources.GetString("contextMenuStripMainHeader.ToolTip")); // // toolStripSeparator2 // - this.toolStripSeparator2.Name = "toolStripSeparator2"; resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2"); + this.toolStripSeparator2.Name = "toolStripSeparator2"; // // 资æºå€¼ToolStripMenuItem // + resources.ApplyResources(this.资æºå€¼ToolStripMenuItem, "资æºå€¼ToolStripMenuItem"); this.资æºå€¼ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.内存ToolStripMenuItem, this.ç£ç›˜ToolStripMenuItem, this.网络ToolStripMenuItem}); - resources.ApplyResources(this.资æºå€¼ToolStripMenuItem, "资æºå€¼ToolStripMenuItem"); this.资æºå€¼ToolStripMenuItem.Name = "资æºå€¼ToolStripMenuItem"; // // 内存ToolStripMenuItem // + resources.ApplyResources(this.内存ToolStripMenuItem, "内存ToolStripMenuItem"); this.内存ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.百分比ToolStripMenuItemRam, this.值ToolStripMenuItemRam}); this.内存ToolStripMenuItem.Name = "内存ToolStripMenuItem"; - resources.ApplyResources(this.内存ToolStripMenuItem, "内存ToolStripMenuItem"); // // 百分比ToolStripMenuItemRam // - this.百分比ToolStripMenuItemRam.Name = "百分比ToolStripMenuItemRam"; resources.ApplyResources(this.百分比ToolStripMenuItemRam, "百分比ToolStripMenuItemRam"); - this.百分比ToolStripMenuItemRam.Click += new System.EventHandler(this.百分比ToolStripMenuItemRam_Click); + this.百分比ToolStripMenuItemRam.Name = "百分比ToolStripMenuItemRam"; + // // 值ToolStripMenuItemRam // - this.值ToolStripMenuItemRam.Name = "值ToolStripMenuItemRam"; resources.ApplyResources(this.值ToolStripMenuItemRam, "值ToolStripMenuItemRam"); - this.值ToolStripMenuItemRam.Click += new System.EventHandler(this.值ToolStripMenuItemRam_Click); + this.值ToolStripMenuItemRam.Name = "值ToolStripMenuItemRam"; + // // ç£ç›˜ToolStripMenuItem // + resources.ApplyResources(this.ç£ç›˜ToolStripMenuItem, "ç£ç›˜ToolStripMenuItem"); this.ç£ç›˜ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.百分比ToolStripMenuItemDisk, this.值ToolStripMenuItemDisk}); this.ç£ç›˜ToolStripMenuItem.Name = "ç£ç›˜ToolStripMenuItem"; - resources.ApplyResources(this.ç£ç›˜ToolStripMenuItem, "ç£ç›˜ToolStripMenuItem"); // // 百分比ToolStripMenuItemDisk // - this.百分比ToolStripMenuItemDisk.Name = "百分比ToolStripMenuItemDisk"; resources.ApplyResources(this.百分比ToolStripMenuItemDisk, "百分比ToolStripMenuItemDisk"); - this.百分比ToolStripMenuItemDisk.Click += new System.EventHandler(this.百分比ToolStripMenuItemDisk_Click); + this.百分比ToolStripMenuItemDisk.Name = "百分比ToolStripMenuItemDisk"; + // // 值ToolStripMenuItemDisk // - this.值ToolStripMenuItemDisk.Name = "值ToolStripMenuItemDisk"; resources.ApplyResources(this.值ToolStripMenuItemDisk, "值ToolStripMenuItemDisk"); - this.值ToolStripMenuItemDisk.Click += new System.EventHandler(this.值ToolStripMenuItemDisk_Click); + this.值ToolStripMenuItemDisk.Name = "值ToolStripMenuItemDisk"; + // // 网络ToolStripMenuItem // + resources.ApplyResources(this.网络ToolStripMenuItem, "网络ToolStripMenuItem"); this.网络ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.百分比ToolStripMenuItemNet, this.值ToolStripMenuItemNet}); this.网络ToolStripMenuItem.Name = "网络ToolStripMenuItem"; - resources.ApplyResources(this.网络ToolStripMenuItem, "网络ToolStripMenuItem"); // // 百分比ToolStripMenuItemNet // - this.百分比ToolStripMenuItemNet.Name = "百分比ToolStripMenuItemNet"; resources.ApplyResources(this.百分比ToolStripMenuItemNet, "百分比ToolStripMenuItemNet"); - this.百分比ToolStripMenuItemNet.Click += new System.EventHandler(this.百分比ToolStripMenuItemNet_Click); + this.百分比ToolStripMenuItemNet.Name = "百分比ToolStripMenuItemNet"; + // // 值ToolStripMenuItemNet // - this.值ToolStripMenuItemNet.Name = "值ToolStripMenuItemNet"; resources.ApplyResources(this.值ToolStripMenuItemNet, "值ToolStripMenuItemNet"); - this.值ToolStripMenuItemNet.Click += new System.EventHandler(this.值ToolStripMenuItemNet_Click); + this.值ToolStripMenuItemNet.Name = "值ToolStripMenuItemNet"; + // // fileSystemWatcher // this.fileSystemWatcher.EnableRaisingEvents = true; this.fileSystemWatcher.SynchronizingObject = this; - this.fileSystemWatcher.Changed += new System.IO.FileSystemEventHandler(this.fileSystemWatcher_Changed); - this.fileSystemWatcher.Created += new System.IO.FileSystemEventHandler(this.fileSystemWatcher_Created); - this.fileSystemWatcher.Deleted += new System.IO.FileSystemEventHandler(this.fileSystemWatcher_Deleted); - this.fileSystemWatcher.Renamed += new System.IO.RenamedEventHandler(this.fileSystemWatcher_Renamed); + // // notifyIcon // - this.notifyIcon.ContextMenuStrip = this.contextMenuStripTray; resources.ApplyResources(this.notifyIcon, "notifyIcon"); + this.notifyIcon.ContextMenuStrip = this.contextMenuStripTray; this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseDoubleClick); this.notifyIcon.MouseMove += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseMove); // @@ -1045,6 +1059,7 @@ private void InitializeComponent() this.Controls.Add(this.pl_perfGridHost); this.Cursor = System.Windows.Forms.Cursors.AppStarting; this.Name = "FormMain"; + this.toolTip.SetToolTip(this, resources.GetString("$this.ToolTip")); this.Activated += new System.EventHandler(this.FormMain_Activated); this.Deactivate += new System.EventHandler(this.FormMain_Deactivate); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing); @@ -1091,117 +1106,117 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.TabControl tabControlMain; - private System.Windows.Forms.TabPage tabPageProcCtl; - private System.Windows.Forms.TabPage tabPageKernelCtl; - private System.Windows.Forms.PictureBox spBottom; - private System.Windows.Forms.Button btnEndProcess; - private Ctls.TaskMgrList listProcess; - private System.Windows.Forms.Label lbProcessCount; - private System.Windows.Forms.PictureBox spl1; - private System.Windows.Forms.Label lbDriversCount; - private System.Windows.Forms.TabPage tabPageScCtl; - private System.Windows.Forms.TabPage tabPageStartCtl; - private System.Windows.Forms.TabPage tabPageFileCtl; - private System.Windows.Forms.SplitContainer splitContainerFm; - private System.Windows.Forms.TreeView treeFmLeft; - private System.Windows.Forms.ListView listFm; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.ColumnHeader columnHeader3; - private System.Windows.Forms.ColumnHeader columnHeader4; - private System.Windows.Forms.ColumnHeader columnHeader5; - private System.Windows.Forms.ColumnHeader columnHeader6; - private System.Windows.Forms.ImageList imageListFileMgrLeft; - private System.Windows.Forms.TextBox textBoxFmCurrent; - private System.Windows.Forms.ImageList imageListFileTypeList; - private System.Windows.Forms.Button btnFmAddGoto; - private System.Windows.Forms.ToolTip toolTip; - private System.Windows.Forms.Label lbFileMgrStatus; - private System.IO.FileSystemWatcher fileSystemWatcher; - private System.Windows.Forms.ListView listService; - private System.Windows.Forms.ColumnHeader columnHeader7; - private System.Windows.Forms.ColumnHeader columnHeader8; - private System.Windows.Forms.ColumnHeader columnHeader9; - private System.Windows.Forms.ColumnHeader columnHeader10; - private System.Windows.Forms.ColumnHeader columnHeader11; - private System.Windows.Forms.ColumnHeader columnHeader12; - private System.Windows.Forms.PictureBox sp2; - private System.Windows.Forms.LinkLabel linkOpenScMsc; - private System.Windows.Forms.Label lbServicesCount; - private System.Windows.Forms.Panel pl_ScNeedAdminTip; - private System.Windows.Forms.LinkLabel linkRebootAsAdmin; - private System.Windows.Forms.Label lbScNeedAdminTip; - private System.Windows.Forms.ColumnHeader columnHeader13; - private System.Windows.Forms.ColumnHeader columnHeader14; - private System.Windows.Forms.CheckBox check_showAllProcess; - private System.Windows.Forms.TabPage tabPageUWPCtl; - private Ctls.TaskMgrList listUwpApps; - private System.Windows.Forms.Panel pl_UWPEnumFailTip; - private System.Windows.Forms.Label lbUWPEnumFailText; - private System.Windows.Forms.TabPage tabPagePerfCtl; - private System.Windows.Forms.SplitContainer splitContainerPerfCtls; - private Ctls.PerformanceList performanceLeftList; - private System.Windows.Forms.Panel sp3; - private System.Windows.Forms.NotifyIcon notifyIcon; - private System.Windows.Forms.Panel pl_driverNotLoadTip; - private System.Windows.Forms.LinkLabel linkRestartAsAdminDriver; - private System.Windows.Forms.Label lbRestartAsAdminDriver; - private System.Windows.Forms.ColumnHeader columnHeader21; - private System.Windows.Forms.ListView listDrivers; - private Ctls.TaskMgrList listStartup; - private System.Windows.Forms.ColumnHeader columnHeader15; - private System.Windows.Forms.ColumnHeader columnHeader16; - private System.Windows.Forms.ColumnHeader columnHeader17; - private System.Windows.Forms.ColumnHeader columnHeader18; - private System.Windows.Forms.ColumnHeader columnHeader19; - private System.Windows.Forms.ColumnHeader columnHeader20; - private System.Windows.Forms.ColumnHeader columnHeader22; - private System.Windows.Forms.ColumnHeader columnHeader23; - private System.Windows.Forms.ContextMenuStrip contextMenuStripUWP; - private System.Windows.Forms.ToolStripMenuItem 打开应用ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem å¸è½½åº”用ToolStripMenuItem; - private System.Windows.Forms.LinkLabel linkLabelOpenPerfMon; - private System.Windows.Forms.ToolStripMenuItem 打开安装ä½ç½®ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem å¤åˆ¶å称ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem å¤åˆ¶å®Œæ•´å称ToolStripMenuItem; - private System.Windows.Forms.Label lbStartingStatus; - private System.Windows.Forms.PictureBox sp5; - private System.Windows.Forms.LinkLabel linkLabelShowKernelTools; - private System.Windows.Forms.PictureBox sp4; - private Aero.ExpandButton expandFewerDetals; - private System.Windows.Forms.Panel pl_simple; - private Aero.ExpandButton expandMoreDetals; - private System.Windows.Forms.Button btnEndTaskSimple; - private Ctls.TaskMgrList listApps; - private System.Windows.Forms.ToolStripMenuItem å¤åˆ¶å‘布者ToolStripMenuItem; - private System.Windows.Forms.TabPage tabPageDetals; - private System.Windows.Forms.ListView listProcessDetals; - private System.Windows.Forms.Button btnEndProcessDetals; - private System.Windows.Forms.ImageList imageListProcessDetalsIcons; - private System.Windows.Forms.ContextMenuStrip contextMenuStripProcDetalsCol; - private System.Windows.Forms.ToolStripMenuItem éšè—列ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 选择列ToolStripMenuItem; - private System.Windows.Forms.TabPage tabPageUsers; - private Ctls.TaskMgrList listUsers; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem 将此列调整为åˆé€‚大å°ToolStripMenuItem; - private System.Windows.Forms.ContextMenuStrip contextMenuStripTray; - private System.Windows.Forms.ToolStripMenuItem 显示éšè—主界é¢ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 退出程åºToolStripMenuItem; - private System.Windows.Forms.Panel pl_perfGridHost; - private System.Windows.Forms.ContextMenuStrip contextMenuStripMainHeader; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem 资æºå€¼ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 内存ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 百分比ToolStripMenuItemRam; - private System.Windows.Forms.ToolStripMenuItem 值ToolStripMenuItemRam; - private System.Windows.Forms.ToolStripMenuItem ç£ç›˜ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 百分比ToolStripMenuItemDisk; - private System.Windows.Forms.ToolStripMenuItem 值ToolStripMenuItemDisk; - private System.Windows.Forms.ToolStripMenuItem 网络ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 百分比ToolStripMenuItemNet; - private System.Windows.Forms.ToolStripMenuItem 值ToolStripMenuItemNet; + public System.Windows.Forms.TabControl tabControlMain; + public System.Windows.Forms.TabPage tabPageProcCtl; + public System.Windows.Forms.TabPage tabPageKernelCtl; + public System.Windows.Forms.PictureBox spBottom; + public System.Windows.Forms.Button btnEndProcess; + public Ctls.TaskMgrList listProcess; + public System.Windows.Forms.Label lbProcessCount; + public System.Windows.Forms.PictureBox spl1; + public System.Windows.Forms.Label lbDriversCount; + public System.Windows.Forms.TabPage tabPageScCtl; + public System.Windows.Forms.TabPage tabPageStartCtl; + public System.Windows.Forms.TabPage tabPageFileCtl; + public System.Windows.Forms.SplitContainer splitContainerFm; + public System.Windows.Forms.TreeView treeFmLeft; + public System.Windows.Forms.ListView listFm; + public System.Windows.Forms.ColumnHeader columnHeader1; + public System.Windows.Forms.ColumnHeader columnHeader2; + public System.Windows.Forms.ColumnHeader columnHeader3; + public System.Windows.Forms.ColumnHeader columnHeader4; + public System.Windows.Forms.ColumnHeader columnHeader5; + public System.Windows.Forms.ColumnHeader columnHeader6; + public System.Windows.Forms.ImageList imageListFileMgrLeft; + public System.Windows.Forms.TextBox textBoxFmCurrent; + public System.Windows.Forms.ImageList imageListFileTypeList; + public System.Windows.Forms.Button btnFmAddGoto; + public System.Windows.Forms.ToolTip toolTip; + public System.Windows.Forms.Label lbFileMgrStatus; + public System.IO.FileSystemWatcher fileSystemWatcher; + public System.Windows.Forms.ListView listService; + public System.Windows.Forms.ColumnHeader columnHeader7; + public System.Windows.Forms.ColumnHeader columnHeader8; + public System.Windows.Forms.ColumnHeader columnHeader9; + public System.Windows.Forms.ColumnHeader columnHeader10; + public System.Windows.Forms.ColumnHeader columnHeader11; + public System.Windows.Forms.ColumnHeader columnHeader12; + public System.Windows.Forms.PictureBox sp2; + public System.Windows.Forms.LinkLabel linkOpenScMsc; + public System.Windows.Forms.Label lbServicesCount; + public System.Windows.Forms.Panel pl_ScNeedAdminTip; + public System.Windows.Forms.LinkLabel linkRebootAsAdmin; + public System.Windows.Forms.Label lbScNeedAdminTip; + public System.Windows.Forms.ColumnHeader columnHeader13; + public System.Windows.Forms.ColumnHeader columnHeader14; + public System.Windows.Forms.CheckBox check_showAllProcess; + public System.Windows.Forms.TabPage tabPageUWPCtl; + public Ctls.TaskMgrList listUwpApps; + public System.Windows.Forms.Panel pl_UWPEnumFailTip; + public System.Windows.Forms.Label lbUWPEnumFailText; + public System.Windows.Forms.TabPage tabPagePerfCtl; + public System.Windows.Forms.SplitContainer splitContainerPerfCtls; + public Ctls.PerformanceList performanceLeftList; + public System.Windows.Forms.Panel sp3; + public System.Windows.Forms.NotifyIcon notifyIcon; + public System.Windows.Forms.Panel pl_driverNotLoadTip; + public System.Windows.Forms.LinkLabel linkRestartAsAdminDriver; + public System.Windows.Forms.Label lbRestartAsAdminDriver; + public System.Windows.Forms.ColumnHeader columnHeader21; + public System.Windows.Forms.ListView listDrivers; + public Ctls.TaskMgrList listStartup; + public System.Windows.Forms.ColumnHeader columnHeader15; + public System.Windows.Forms.ColumnHeader columnHeader16; + public System.Windows.Forms.ColumnHeader columnHeader17; + public System.Windows.Forms.ColumnHeader columnHeader18; + public System.Windows.Forms.ColumnHeader columnHeader19; + public System.Windows.Forms.ColumnHeader columnHeader20; + public System.Windows.Forms.ColumnHeader columnHeader22; + public System.Windows.Forms.ColumnHeader columnHeader23; + public System.Windows.Forms.ContextMenuStrip contextMenuStripUWP; + public System.Windows.Forms.ToolStripMenuItem 打开应用ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem å¸è½½åº”用ToolStripMenuItem; + public System.Windows.Forms.LinkLabel linkLabelOpenPerfMon; + public System.Windows.Forms.ToolStripMenuItem 打开安装ä½ç½®ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem å¤åˆ¶å称ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem å¤åˆ¶å®Œæ•´å称ToolStripMenuItem; + public System.Windows.Forms.Label lbStartingStatus; + public System.Windows.Forms.PictureBox sp5; + public System.Windows.Forms.LinkLabel linkLabelShowKernelTools; + public System.Windows.Forms.PictureBox sp4; + public Aero.ExpandButton expandFewerDetals; + public System.Windows.Forms.Panel pl_simple; + public Aero.ExpandButton expandMoreDetals; + public System.Windows.Forms.Button btnEndTaskSimple; + public Ctls.TaskMgrList listApps; + public System.Windows.Forms.ToolStripMenuItem å¤åˆ¶å‘布者ToolStripMenuItem; + public System.Windows.Forms.TabPage tabPageDetals; + public System.Windows.Forms.ListView listProcessDetals; + public System.Windows.Forms.Button btnEndProcessDetals; + public System.Windows.Forms.ImageList imageListProcessDetalsIcons; + public System.Windows.Forms.ContextMenuStrip contextMenuStripProcDetalsCol; + public System.Windows.Forms.ToolStripMenuItem éšè—列ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem 选择列ToolStripMenuItem; + public System.Windows.Forms.TabPage tabPageUsers; + public Ctls.TaskMgrList listUsers; + public System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + public System.Windows.Forms.ToolStripMenuItem 将此列调整为åˆé€‚大å°ToolStripMenuItem; + public System.Windows.Forms.ContextMenuStrip contextMenuStripTray; + public System.Windows.Forms.ToolStripMenuItem 显示éšè—主界é¢ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem 退出程åºToolStripMenuItem; + public System.Windows.Forms.Panel pl_perfGridHost; + public System.Windows.Forms.ContextMenuStrip contextMenuStripMainHeader; + public System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + public System.Windows.Forms.ToolStripMenuItem 资æºå€¼ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem 内存ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem 百分比ToolStripMenuItemRam; + public System.Windows.Forms.ToolStripMenuItem 值ToolStripMenuItemRam; + public System.Windows.Forms.ToolStripMenuItem ç£ç›˜ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem 百分比ToolStripMenuItemDisk; + public System.Windows.Forms.ToolStripMenuItem 值ToolStripMenuItemDisk; + public System.Windows.Forms.ToolStripMenuItem 网络ToolStripMenuItem; + public System.Windows.Forms.ToolStripMenuItem 百分比ToolStripMenuItemNet; + public System.Windows.Forms.ToolStripMenuItem 值ToolStripMenuItemNet; } } diff --git a/TaskMgr/FormMain.cs b/TaskMgr/FormMain.cs index c005344..d36d932 100644 --- a/TaskMgr/FormMain.cs +++ b/TaskMgr/FormMain.cs @@ -14,7 +14,8 @@ using static PCMgr.NativeMethods; using static PCMgr.NativeMethods.Win32; using static PCMgr.NativeMethods.DeviceApi; -using static PCMgr.NativeMethods.CSCall; + +using PCMgr.Main; // // 说明 ï¼šè¿™é‡Œæ˜¯ä¸»çª—å£ ä¸Šå±‚çš„é€»è¾‘ä»£ç  @@ -28,6 +29,17 @@ // 这是一个垃圾的软件 // 2019 // +// +// â– â– â– â– â– â– â– â– â– â– â– â–  â–  +// â–  â–  â–  +// â– â– â– â– â– â– â– â– â– â– â– â–  â–  +// â–  â–  â–  â–  â–  +// â–  â–  â–  â–  â–  +// â–  â– â– â– â– â– â– â– â– â–  â–  â–  â–  +// â–  â–  â–  â–  â–  â–  â–  +// â–  â–  â–  â–  â– â– â– â– â– â– â– â– â– â– â–  +// +//屎山 namespace PCMgr { @@ -38,147 +50,59 @@ public partial class FormMain : Form { public FormMain(string[] agrs) { - Instance = this; + this.agrs = agrs; InitializeComponent(); - InitializeCtlText(); baseProcessRefeshTimer.Interval = 1000; baseProcessRefeshTimer.Tick += BaseProcessRefeshTimer_Tick; - listProcess.Header.CloumClick += Header_CloumClick; - baseProcessRefeshTimerLow.Interval = 10000; - baseProcessRefeshTimerLow.Tick += BaseProcessRefeshTimerLow_Tick; - baseProcessRefeshTimerLowSc.Interval = 120000; - baseProcessRefeshTimerLowSc.Tick += BaseProcessRefeshTimerLowSc_Tick; - baseProcessRefeshTimerLowUWP.Interval = 5000; - baseProcessRefeshTimerLowUWP.Tick += BaseProcessRefeshTimerLowUWP_Tick; - this.agrs = agrs; - - LoadAllFonts(); - - } - public static string cfgFilePath = ""; private string[] agrs = null; + private bool _isSimpleView = false; + private bool _isNativeBridgeLoaded = false; - //private bool showSystemProcess = false; - private bool showHiddenFiles = false; - - //全局æŸä¸ªåŠŸèƒ½æ˜¯å¦åŠ è½½ - private bool processListInited = false; - private bool driverListInited = false; - private bool scListInited = false; - private bool fileListInited = false; - private bool startListInited = false; - private bool uwpListInited = false; - private bool perfInited = false; - private bool perfMainInited = false; - private bool perfTrayInited = false; - private bool perfMainInitFailed = false; - private bool processListDetailsInited = false; - private bool usersListInited = false; - - public static FormMain Instance { private set; get; } - public const string MICROSOFT = "Microsoft Corporation"; - - #region ProcessListWork - - //主页进程页é¢ä»£ç  - - private const double PERF_LIMIT_MIN_DATA_DISK = 0.005; - private const double PERF_LIMIT_MIN_DATA_NETWORK = 0.001; - - private bool forceRefeshLowLock = false; - private bool refeshLowLock = false; - private Size lastSimpleSize = new Size(); - private Size lastSize = new Size(); - private int nextSecType = -1; - private int sortitem = -1; - private bool sorta = false; - private bool isFirstLoad = true; - private bool mergeApps = true; - private Timer baseProcessRefeshTimer = new Timer(); - private Timer baseProcessRefeshTimerLow = new Timer(); - private Timer baseProcessRefeshTimerLowUWP = new Timer(); - private Timer baseProcessRefeshTimerLowSc = new Timer(); - private TaskListViewColumnSorter lvwColumnSorter = null; - - private bool isGlobalRefeshing = false; - private bool isGlobalRefeshingAll = false; - - private bool isRamPercentage = false; - private bool isDiskPercentage = false; - private bool isNetPercentage = false; - - private class PsItem - { - public IntPtr processItem = IntPtr.Zero; - public IntPtr handle; - public uint pid; - public uint ppid; - public string exename; - public string exepath; - public TaskMgrListItem item = null; - public bool isSvchost = false; - public bool isUWP = false; - public bool isWindowShow = false; - public bool isWindowsProcess = false; - public bool isPaused = false; - public bool isHung = false; - - public IntPtr firstHwnd; - - public UwpItem uwpItem = null; - public string uwpFullName; - public bool uwpRealApp = false; - - public bool updateLock = false; - - public override string ToString() - { - return "(" + pid + ") " + exename + " " + exepath; - } - - public PsItem parent = null; - public List childs = new List(); - public List svcs = new List(); - } - private class UwpItem - { - public string uwpInstallDir = ""; - public TaskMgrListItemGroup uwpItem = null; - public string uwpFullName = ""; - public string uwpMainAppDebText = ""; - public IntPtr firstHwnd; + //Timers + internal Timer baseProcessRefeshTimer = new Timer(); + internal Timer baseProcessRefeshTimerLow = new Timer(); + internal Timer baseProcessRefeshTimerLowUWP = new Timer(); + internal Timer baseProcessRefeshTimerLowSc = new Timer(); - public override string ToString() - { - return uwpMainAppDebText + " (" + uwpFullName + ")"; - } - } - private class UwpWinItem + internal void SetMainRefeshTimerInterval(int c) { - public IntPtr hWnd = IntPtr.Zero; - public uint ownerPid = 0; - } - private class UwpHostItem - { - public UwpHostItem(UwpItem item, uint pid) + if (c == 2) { - this.pid = pid; - this.item = item; + baseProcessRefeshTimer.Enabled = false; + baseProcessRefeshTimer.Stop(); + baseProcessRefeshTimerLowUWP.Stop(); + SetConfig("RefeshTime", "AppSetting", "Stop"); + baseProcessRefeshTimerLow.Stop(); + baseProcessRefeshTimerLowSc.Stop(); + mainPagePerf.PerfUpdateGridUnit(); } - - public UwpItem item; - public uint pid; - - public override string ToString() + else { - return "(" + pid + ")" + item.ToString(); + baseProcessRefeshTimer.Enabled = true; + if (c == 1) + { + baseProcessRefeshTimer.Interval = 2000; + baseProcessRefeshTimerLow.Interval = 10000; + SetConfig("RefeshTime", "AppSetting", "Slow"); + } + else if (c == 0) + { + baseProcessRefeshTimer.Interval = 1000; + baseProcessRefeshTimerLow.Interval = 5000; + SetConfig("RefeshTime", "AppSetting", "Fast"); + } + baseProcessRefeshTimer.Start(); + baseProcessRefeshTimerLowUWP.Start(); + baseProcessRefeshTimerLow.Start(); + baseProcessRefeshTimerLowSc.Start(); + mainPagePerf.PerfUpdateGridUnit(); } } - private bool isSimpleView + internal bool IsSimpleView { get { return _isSimpleView; } set @@ -202,6183 +126,38 @@ private bool isSimpleView MAppWorkCall3(216, Handle, IntPtr.Zero); listApps.Items.Clear(); pl_simple.Hide(); - tabControlMain.Show(); - MAppWorkCall3(163, IntPtr.Zero, IntPtr.Zero); - listProcess.Locked = false; - ProcessListForceRefeshAll(); - } - } - } - - private bool _isSimpleView = false; - private bool is64OS = false; - private bool isSelectExplorer = false; - private uint currentProcessPid = 0; - - private List uwpHostPid = new List(); - private List loadedPs = new List(); - private List uwps = new List(); - private List uwpwins = new List(); - private List windowsProcess = new List(); - private List veryimporantProcess = new List(); - private Color dataGridZeroColor = Color.FromArgb(255, 244, 196); - - private string csrssPath = ""; - private string ntoskrnlPath = ""; - private string systemRootPath = ""; - private string svchostPath = ""; - private string svchostPathwow = ""; - - private TaskMgrListItem nextKillItem = null; - private bool isRunAsAdmin = false; - private Font smallListFont = null; - private TaskMgrListItem thisLoadItem = null; - - private int maxMem = 1024; - - private void MainGetWinsCallBack(IntPtr hWnd, IntPtr data, int i) - { - if (i == 1) - { - if (IsWindowVisible(hWnd)) - { - UwpWinItem item = new UwpWinItem(); - item.hWnd = hWnd; - item.ownerPid = (uint)data.ToInt32(); - uwpwins.Add(item); - } - } - else - { - if (thisLoadItem != null) - { - if (((PsItem)thisLoadItem.Tag).exepath.ToLower() != @"c:\windows\system32\dwm.exe") - { - if (!thisLoadItem.HasWindowChild(hWnd)) - { - if (IsWindowVisible(hWnd)) - { - IntPtr icon = MGetWindowIcon(hWnd); - TaskMgrListItemChild c = new TaskMgrListItemChild(Marshal.PtrToStringAuto(data), icon != IntPtr.Zero ? Icon.FromHandle(icon) : PCMgr.Properties.Resources.icoShowedWindow); - c.Tag = hWnd; - c.Type = TaskMgrListItemType.ItemWindow; - thisLoadItem.Childs.Add(c); - } - } - } - } - } - } - private void MainEnumWinsCallBack(IntPtr hWnd, IntPtr hWndParent) - { - WorkWindow.FormSpyWindow f = new WorkWindow.FormSpyWindow(hWnd); - Control fp = FromHandle(hWndParent); - f.ShowDialog(fp); - } - - private bool IsVeryImporant(ProcessDetalItem p) - { - if (p.exepath != null) - { - string str = p.exepath.ToLower(); - foreach (string s in veryimporantProcess) - if (s == str) return true; - } - return false; - } - private bool IsImporant(ProcessDetalItem p) - { - if (p.exepath != null) - { - if (p.exepath.ToLower() == @"c:\windows\system32\svchost.exe") return true; - return IsWindowsProcess(p.exepath); - } - return false; - } - private bool IsVeryImporant(PsItem p) - { - if (p.exepath != null) - { - string str = p.exepath.ToLower(); - foreach (string s in veryimporantProcess) - if (s == str) return true; - } - return false; - } - private bool IsImporant(PsItem p) - { - /*if (p.exepath != null) - { - if (p.exepath.ToLower() == @"c:\windows\system32\svchost.exe") return true; - if (p.exepath.ToLower() == @"c:\windows\system32\cssrs.exe") return true; - if (p.exepath.ToLower() == @"c:\windows\system32\smss.exe") return true; - if (p.exepath.ToLower() == @"c:\windows\system32\lsass.exe") return true; - if (p.exepath.ToLower() == @"c:\windows\system32\sihost.exe") return true; - if (p.exepath.ToLower() == @"c:\windows\system32\cssrs.exe") return true; - - }*/ - if (p.exepath != null) - { - if (p.exepath.ToLower() == @"c:\windows\system32\svchost.exe") return true; - return IsWindowsProcess(p.exepath); - } - return false; - } - private bool IsExplorer(PsItem p) - { - if (p.exename != null && p.exename.ToLower() == "explorer.exe") return true; - if (p.exepath != null && p.exepath.ToLower() == @"c:\windows\explorer.exe") return true; - return false; - } - private bool IsWindowsProcess(string str) - { - //检测是ä¸æ˜¯Windows进程 - if (str != null) - { - str = str.ToLower(); - foreach (string s in windowsProcess) - if (s == str) return true; - } - return false; - } - - private bool ProcessListGetUwpIsRunning(TaskMgrListItem uwpHostItem, out IntPtr itsHwnd) - { - bool rs = false; - foreach (UwpWinItem u in uwpwins) - { - foreach (TaskMgrListItem uwpprocess in uwpHostItem.Childs) - { - if (uwpprocess.Type == TaskMgrListItemType.ItemUWPProcess) - { - if (uwpprocess.PID == u.ownerPid) - { - itsHwnd = u.hWnd; - rs = true; - return rs; - } - } - } - } - itsHwnd = IntPtr.Zero; - return rs; - } - private Color ProcessListGetColorFormValue(double v, double maxv) - { - //数值百分百转为颜色 - double d = v / maxv; - if (d <= 0) - return Color.FromArgb(255, 244, 196); - else if (d > 0 && d <= 0.1) - return Color.FromArgb(249, 236, 168); - else if (d > 0.1 && d <= 0.3) - return Color.FromArgb(255, 228, 135); - else if (d > 0.3 && d <= 0.6) - return Color.FromArgb(252, 207, 23); - else if (d > 0.6 && d <= 0.8) - return Color.FromArgb(252, 184, 22); - else if (d > 0.8 && d <= 0.9) - return Color.FromArgb(255, 167, 29); - else if (d > 0.9) - return Color.FromArgb(255, 160, 19); - return Color.FromArgb(255, 249, 228); - } - - //查找æ¡ç›® - private UwpHostItem ProcessListFindUWPItemWithHostId(uint pid) - { - UwpHostItem rs = null; - foreach (UwpHostItem i in uwpHostPid) - { - if (i.pid == pid) - { - rs = i; - break; - } - } - return rs; - } - private UwpItem ProcessListFindUWPItem(string fullName) - { - UwpItem rs = null; - foreach (UwpItem i in uwps) - { - if (i.uwpFullName == fullName) - { - rs = i; - break; - } - } - return rs; - } - private PsItem ProcessListFindPsItem(uint pid) - { - PsItem rs = null; - foreach (PsItem i in loadedPs) - { - if (i.pid == pid) - { - rs = i; - return rs; - } - } - return rs; - } - private TaskMgrListItem ProcessListFindItem(uint pid) - { - TaskMgrListItem rs = null; - foreach (TaskMgrListItem i in listProcess.Items) - { - if (i.PID == pid) - { - rs = i; - return rs; - } - if (i.Type == TaskMgrListItemType.ItemProcessHost - || i.Type == TaskMgrListItemType.ItemUWPProcess) - { - foreach (TaskMgrListItem ix in i.Childs) - { - if (ix.PID == pid) - { - rs = ix; - return rs; - } - } - } - } - return rs; - } - private bool ProcessListIsProcessLoaded(uint pid, out PsItem item) - { - bool rs = false; - foreach (PsItem f in loadedPs) - { - if (f.pid == pid) - { - item = f; - rs = true; - return rs; - } - } - item = null; - return rs; - } - - private IntPtr processMonitor = IntPtr.Zero; - - private void ProcessListInitPerfs() - { - if (!perfMainInitFailed) - { - //åˆå§‹åŒ–整体性能计数器 - MPERF_Init3PerformanceCounters(); - ProcessListForceRefeshAll(); - perfMainInited = true; - } - } - private void ProcessListUnInitPerfs() - { - if (perfMainInited) - { - //释放计数器 - MPERF_Destroy3PerformanceCounters(); - } - } - private void ProcessListInit() - { - //åˆå§‹åŒ– - if (!processListInited) - { - currentProcessPid = (uint)MAppWorkCall3(180, IntPtr.Zero, IntPtr.Zero); - - ProcessNewItemCallBack = ProcessListNewItemCallBack; - ProcessRemoveItemCallBack = ProcessListRemoveItemCallBack; - - ptrProcessNewItemCallBack = Marshal.GetFunctionPointerForDelegate(ProcessNewItemCallBack); - ptrProcessRemoveItemCallBack = Marshal.GetFunctionPointerForDelegate(ProcessRemoveItemCallBack); - - processMonitor = MProcessMonitor.CreateProcessMonitor(ptrProcessRemoveItemCallBack, ptrProcessNewItemCallBack, Nullptr); - isRunAsAdmin = MIsRunasAdmin(); - - if (!isRunAsAdmin) - { - spl1.Visible = true; - check_showAllProcess.Visible = true; - } - - smallListFont = new Font(tabControlMain.Font.FontFamily, 9f); - - if (systemRootPath == "") systemRootPath = Marshal.PtrToStringUni(MAppWorkCall4(95, Nullptr, Nullptr)); - if (csrssPath == "") csrssPath = Marshal.PtrToStringUni(MAppWorkCall4(96, Nullptr, Nullptr)); - if (ntoskrnlPath == "") ntoskrnlPath = Marshal.PtrToStringUni(MAppWorkCall4(97, Nullptr, Nullptr)); - if (svchostPath == "") - { - svchostPath = (systemRootPath + @"\System32\svchost.exe").ToLower(); - svchostPathwow = (systemRootPath + @"\syswow64\svchost.exe").ToLower(); - } - - windowsProcess.Add(@"C:\Program Files\Windows Defender\NisSrv.exe".ToLower()); - windowsProcess.Add(@"C:\Program Files\Windows Defender\MsMpEng.exe".ToLower()); - windowsProcess.Add(svchostPath); - windowsProcess.Add((systemRootPath + @"\System32\csrss.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\conhost.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"‪\System32\sihost.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\winlogon.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\wininit.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\smss.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\services.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\dwm.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\System32\lsass.exe").ToLower()); - windowsProcess.Add((systemRootPath + @"\explorer.exe").ToLower()); - - veryimporantProcess.Add((systemRootPath + @"\System32\wininit.exe").ToLower()); - veryimporantProcess.Add((systemRootPath + @"\System32\csrss.exe").ToLower()); - veryimporantProcess.Add((systemRootPath + @"\System32\lsass.exe").ToLower()); - veryimporantProcess.Add((systemRootPath + @"\System32\smss.exe").ToLower()); - - //计算å•ä¸ªç¨‹åºæœ€å¤§ç†æƒ³å†…å­˜mb,项目颜色需è¦ç”¨ - ulong allMem = MSystemMemoryPerformanctMonitor.GetAllMemory(); - if (allMem > 34359738368) maxMem = 16384; - else if (allMem > 17179869184) maxMem = 8192; - else if (allMem > 8589934592) maxMem = 4096; - else if (allMem > 4294967296) maxMem = 2048; - - processListInited = true; - - if (MIsRunasAdmin()) - ScMgrInit(); - if (SysVer.IsWin8Upper()) - UWPListInit(); - - ProcessListRefesh(); - ProcessListSimpleInit(); - ProcessListInitPerfs(); - - if (isFirstLoad) - { - if (sortitem < listProcess.Header.Items.Count && sortitem >= 0) - { - lvwColumnSorter.Order = sorta ? SortOrder.Ascending : SortOrder.Descending; - lvwColumnSorter.SortColumn = sortitem; - listProcess.Header.Items[sortitem].ArrowType = sorta ? TaskMgrListHeaderSortArrow.Ascending : TaskMgrListHeaderSortArrow.Descending; - listProcess.Header.Invalidate(); - listProcess.ListViewItemSorter = lvwColumnSorter; - if (sortitem == 0) listProcess.ShowGroup = true; - else listProcess.ShowGroup = false; - } - - ProcessListLoadFinished(); - isFirstLoad = false; - } - - baseProcessRefeshTimer.Start(); - baseProcessRefeshTimerLowUWP.Start(); - baseProcessRefeshTimerLow.Start(); - baseProcessRefeshTimerLowSc.Start(); - - StartingProgressShowHide(false); - } - - } - private void ProcessListLoadFinished() - { - //firstLoad - listProcess.Show(); - Cursor = Cursors.Arrow; - } - - private void ProcessListRefesh() - { - //清空整个列表并加载 - - uwps.Clear(); - uwpHostPid.Clear(); - uwpwins.Clear(); - - if (SysVer.IsWin8Upper()) MAppVProcessAllWindowsUWP(); - - listProcess.Locked = true; - - MProcessMonitor.EnumAllProcess(processMonitor); - - ProcessListRefeshPidTree(); - - bool refeshAColumData = lvwColumnSorter.SortColumn == cpuindex - || lvwColumnSorter.SortColumn == ramindex - || lvwColumnSorter.SortColumn == diskindex - || lvwColumnSorter.SortColumn == netindex - || lvwColumnSorter.SortColumn == stateindex; - - lbProcessCount.Text = str_proc_count + " : " + listProcess.Items.Count; - - refeshLowLock = true; - ProcessListForceRefeshAll(); - refeshLowLock = false; - - listProcess.Locked = false; - if (refeshAColumData) - listProcess.Sort(false);//æŽ’åº - listProcess.Locked = false; - //刷新列表 - listProcess.SyncItems(true); - } - private void ProcessListRefesh2() - { - isGlobalRefeshing = true; - - if (netindex != -1) MPERF_NET_UpdateAllProcessNetInfo(); - uwpwins.Clear(); - - //åˆ·æ–°æ‰€æœ‰æ•°æ® - listProcess.Locked = true; - - //åˆ·æ–°çª—å£ - MAppWorkCall3(222); - - MProcessMonitor.RefeshAllProcess(processMonitor); - - //枚举一些UWP应用 - if (SysVer.IsWin8Upper()) MAppVProcessAllWindowsUWP(); - - //åˆ·æ–°æ€§èƒ½æ•°æ® - bool refeshAColumData = lvwColumnSorter.SortColumn == cpuindex - || lvwColumnSorter.SortColumn == ramindex - || lvwColumnSorter.SortColumn == diskindex - || lvwColumnSorter.SortColumn == netindex - || lvwColumnSorter.SortColumn == stateindex; - ProcessListUpdateValues(refeshAColumData ? lvwColumnSorter.SortColumn : -1); - ProcessListRefeshPidTree(); - - if (!isSimpleView) - { - listProcess.Sort(false);//æŽ’åº - listProcess.Locked = false; - //刷新列表 - listProcess.SyncItems(true); - - lbProcessCount.Text = str_proc_count + " : " + listProcess.Items.Count; - } - else - { - listProcess.Locked = false; - ProcessListSimpleRefesh(); - } - - isGlobalRefeshing = false; - if (isGlobalRefeshingAll) - { - isGlobalRefeshingAll = false; - ProcessListForceRefeshAll(); - } - - ProcessListKillLastEndItem(); - } - private void ProcessListRefeshPidTree() - { - //Refesh Pid tree - foreach (PsItem p in loadedPs) - { - p.parent = null; - p.childs.Clear(); - } - foreach (PsItem p in loadedPs) - { - PsItem parent = ProcessListFindPsItem(p.ppid); - if (parent != null) - { - p.parent = parent; - parent.childs.Add(p); - } - else if (p.parent != null) - { - if (p.parent.childs.Contains(p)) - p.parent.childs.Remove(p); - p.parent = null; - } - } - } - private void ProcessListForceRefeshAll(bool refeshStaticValues = false) - { - if(isGlobalRefeshing) - { - isGlobalRefeshingAll = true; - return; - } - //强制刷新所有的æ¡ç›® - foreach (PsItem p in loadedPs) - { - TaskMgrListItem li = p.item; - if (li.Type == TaskMgrListItemType.ItemUWPHost) - { - ProcessListUpdate(p.pid, false, li, -1); - if(refeshStaticValues) - { - foreach (TaskMgrListItem ix in li.Childs) - if (ix.Type == TaskMgrListItemType.ItemProcess) - ProcessListLoadStaticValues(ix.PID, ix, ((PsItem)ix.Tag)); - } - } - else - { - if (refeshStaticValues && li.Type == TaskMgrListItemType.ItemProcess) - ProcessListLoadStaticValues(p.pid, li, p); - else if (refeshStaticValues && li.Type == TaskMgrListItemType.ItemProcessHost) - { - foreach (TaskMgrListItem ix in li.Childs) - if(ix.Type == TaskMgrListItemType.ItemProcess) - ProcessListLoadStaticValues(ix.PID, ix, ((PsItem)ix.Tag)); - } - ProcessListUpdate(p.pid, false, li, -1); - } - } - } - private void ProcessListForceRefeshAllUWP() - { - for (int i = 0; i < listProcess.Items.Count; i++) - { - if (listProcess.Items[i].Type == TaskMgrListItemType.ItemUWPHost) - ProcessListUpdate(listProcess.Items[i].PID, false, listProcess.Items[i], -1); - } - } - - private void ProcessListLoad(uint pid, uint ppid, string exename, string exefullpath, IntPtr hprocess, IntPtr processItem) - { - //PsItem oldps = ProcessListFindPsItem(pid); - //if (oldps != null) - // Log("ProcessListLoad for a alreday contains item : " + oldps); - - bool need_add_tolist = true; - //base - PsItem p = new PsItem(); - p.processItem = processItem; - p.pid = pid; - p.ppid = ppid; - loadedPs.Add(p); - - PsItem parentpsItem = null; - if (ProcessListIsProcessLoaded(p.ppid, out parentpsItem)) - { - p.parent = parentpsItem; - parentpsItem.childs.Add(p); - } - - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.Append(exefullpath); - - bool isw = false; - PEOCESSKINFO infoStruct = new PEOCESSKINFO(); - if (canUseKernel) - { - if (MGetProcessEprocess(pid, ref infoStruct)) - { - if (string.IsNullOrEmpty(exefullpath)) - { - exefullpath = infoStruct.ImageFullName; - stringBuilder.Append(exefullpath); - } - } - } - - TaskMgrListItem taskMgrListItem; - if (pid == 0) - { - isw = true; - taskMgrListItem = new TaskMgrListItem(str_idle_process); - stringBuilder.Append(str_IdleProcessDsb); - } - else if (pid == 2) - { - isw = true; - exename = str_system_interrupts; - taskMgrListItem = new TaskMgrListItem(str_system_interrupts); - stringBuilder.Append(str_InterruptsProcessDsb); - } - else if (pid == 4) - { - isw = true; - taskMgrListItem = new TaskMgrListItem("System"); - stringBuilder.Append(ntoskrnlPath); - } - else if (pid == 88 && exename == "Registry") { isw = true; taskMgrListItem = new TaskMgrListItem("Registry"); stringBuilder.Append(ntoskrnlPath); } - else if (pid < 1024 && hprocess == Nullptr && exename == "csrss.exe") - { - isw = true; - taskMgrListItem = new TaskMgrListItem("Client Server Runtime Process"); - stringBuilder.Append(csrssPath); - } - else if (exename == "Memory Compression") { isw = true; taskMgrListItem = new TaskMgrListItem("Memory Compression"); stringBuilder.Append(ntoskrnlPath); } - else if (stringBuilder.ToString() != "") - { - StringBuilder exeDescribe = new StringBuilder(256); - - if (MGetExeDescribe(stringBuilder.ToString(), exeDescribe, 256)) - { - string exeDescribeStr = exeDescribe.ToString(); - exeDescribeStr = exeDescribeStr.Trim(); - if (exeDescribeStr != "") - taskMgrListItem = new TaskMgrListItem(exeDescribeStr); - else taskMgrListItem = new TaskMgrListItem(exename); - } - else taskMgrListItem = new TaskMgrListItem(exename); - } - else taskMgrListItem = new TaskMgrListItem(exename); - //test is 32 bit app in 64os - if (is64OS) - { - if (hprocess != IntPtr.Zero) - { - if (MGetProcessIs32Bit(hprocess)) - taskMgrListItem.Text = taskMgrListItem.Text + " (" + str_proc_32 + ")"; - } - } - - p.item = taskMgrListItem; - p.handle = hprocess; - p.exename = exename; - p.pid = pid; - p.exepath = stringBuilder.ToString(); - p.isWindowsProcess = isw|| IsWindowsProcess(exefullpath); - - taskMgrListItem.Type = TaskMgrListItemType.ItemProcess; - taskMgrListItem.IsFullData = true; - - //Test service - bool isSvcHoct = false; - if (exefullpath != null && (exefullpath.ToLower() == svchostPath || exefullpath.ToLower() == svchostPathwow) || exename == "svchost.exe") - { - //svchost.exe add a icon - taskMgrListItem.Icon = PCMgr.Properties.Resources.icoServiceHost; - isSvcHoct = true; - } - else - { - //get pe icon - IntPtr intPtr = MGetExeIcon(stringBuilder.ToString()); - if (intPtr != IntPtr.Zero) taskMgrListItem.Icon = Icon.FromHandle(intPtr); - } - - //try get service info - if (scCanUse && scValidPid.Contains(pid)) - { - //find sc item - if (ScMgrFindRunSc(p)) - { - if (isSvcHoct) - { - if (p.svcs.Count == 1) - { - if (!string.IsNullOrEmpty(p.svcs[0].groupName)) - taskMgrListItem.Text = str_service_host + " : " + p.svcs[0].scName + " (" + ScGroupNameToFriendlyName(p.svcs[0].groupName) + ")"; - else taskMgrListItem.Text = str_service_host + " : " + p.svcs[0].scName; - } - else - { - if (!string.IsNullOrEmpty(p.svcs[0].groupName)) - taskMgrListItem.Text = str_service_host + " : " + ScGroupNameToFriendlyName(p.svcs[0].groupName) + "(" + p.svcs.Count + ")"; - else taskMgrListItem.Text = str_service_host + " (" + p.svcs.Count + ")"; - } - } - TaskMgrListItemChild tx = null; - for (int i = 0; i < p.svcs.Count; i++) - { - tx = new TaskMgrListItemChild(p.svcs[i].scDsb, icoSc); - tx.Tag = p.svcs[i].scName; - tx.Type = TaskMgrListItemType.ItemService; - taskMgrListItem.Childs.Add(tx); - } - p.isSvchost = true; - } - } - - // if (pid == 6064) - // ; - //if ((exefullpath != null && exefullpath.ToLower() == @"‪c:\windows\explorer.exe") - // || (exename != null && exename.ToLower() == @"‪explorer.exe")) - // explorerPid = pid; - - //ps data item - if (SysVer.IsWin8Upper()) - p.isUWP = hprocess == IntPtr.Zero ? false : MGetProcessIsUWP(hprocess); - - taskMgrListItem.Tag = p; - - //13 empty item - for (int i = 0; i < 13; i++) taskMgrListItem.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - - //UWP app - - UwpHostItem hostitem = null; - if (p.isUWP) - { - taskMgrListItem.IsUWP = true; - if (stateindex != -1) - { - taskMgrListItem.DrawUWPPausedGray = true; - taskMgrListItem.SubItems[stateindex].DrawUWPPausedIcon = true; - } - if (uwpListInited) - { - //get fullname - int len = 0; - if (!MGetUWPPackageFullName(hprocess, ref len, null)) - goto OUT; - StringBuilder b = new StringBuilder(len); - if (!MGetUWPPackageFullName(hprocess, ref len, b)) - goto OUT; - p.uwpFullName = b.ToString(); - if (p.uwpFullName == "") - goto OUT; - TaskMgrListItem uapp = UWPListFindItem(p.uwpFullName); - if (uapp == null) - goto OUT; - //copy data form uwp app list - - - - if (companyindex != -1) - taskMgrListItem.SubItems[companyindex].Text = taskMgrListItem.SubItems[1].Text; - taskMgrListItem.IsUWPICO = true; - taskMgrListItem.IsFullData = true; - taskMgrListItem.Type = TaskMgrListItemType.ItemUWPProcess; - taskMgrListItem.IsChildItem = true; - - UwpItem parentItem = ProcessListFindUWPItem(p.uwpFullName); - if (parentItem != null) - { - //Fill this item to parent item - TaskMgrListItemGroup g = parentItem.uwpItem; - g.Icon = uapp.Icon; - g.Image = uapp.Image; - g.Type = TaskMgrListItemType.ItemUWPHost; - g.Childs.Add(taskMgrListItem); - g.Text = uapp.Text; - g.DisplayChildCount = g.Childs.Count > 1; - p.uwpItem = parentItem; - - if (ProcessListFindUWPItemWithHostId(p.pid) == null) - uwpHostPid.Add(new UwpHostItem(parentItem, p.pid)); - - need_add_tolist = false; - } - else - { - //create new uwp item and add this to parent item - parentItem = new UwpItem(); - - TaskMgrListItemGroup g = new TaskMgrListItemGroup(uapp.Text); - UWP_PACKAGE_INFO pkg = (UWP_PACKAGE_INFO)uapp.Tag; - - g.Icon = uapp.Icon; - g.Image = uapp.Image; - g.Childs.Add(taskMgrListItem); - g.Type = TaskMgrListItemType.ItemUWPHost; - g.Group = listProcess.Groups[1]; - g.IsUWPICO = true; - - g.PID = (uint)1; - //10 empty item - for (int i = 0; i < 13; i++) g.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem() { Font = listProcess.Font }); - if (stateindex != -1) - { - g.SubItems[stateindex].DrawUWPPausedIcon = true; - } - if (nameindex != -1) g.SubItems[nameindex].Text = p.uwpFullName; - if (pathindex != -1) g.SubItems[pathindex].Text = uapp.SubItems[3].Text; - - g.Tag = parentItem; - - parentItem.uwpMainAppDebText = pkg.DisplayName; - parentItem.uwpInstallDir = pkg.InstallPath; - parentItem.uwpFullName = p.uwpFullName; - parentItem.uwpItem = g; - p.uwpItem = parentItem; - - if (ProcessListFindUWPItemWithHostId(p.pid) == null) uwpHostPid.Add(new UwpHostItem(parentItem, p.pid)); - - uwps.Add(parentItem); - listProcess.Items.Add(g); - need_add_tolist = false; - } - - p.uwpRealApp = p.exepath.Contains(parentItem.uwpInstallDir); - - //For Icon - if (p.exepath != "" && p.uwpRealApp) - taskMgrListItem.Icon = uapp.Icon; - else taskMgrListItem.IsUWPICO = false; - - if (p.uwpRealApp) - taskMgrListItem.Text = uapp.Text; - } - } - OUT: - if (need_add_tolist) - { - hostitem = ProcessListFindUWPItemWithHostId(ppid); - //UWP app childs - if (hostitem != null) - { - hostitem.item.uwpItem.Childs.Add(taskMgrListItem); - need_add_tolist = false; - } - } - - //data items - ProcessListLoadStaticValues(pid, taskMgrListItem, p); - - //Init performance - - for (int i = 1; i < taskMgrListItem.SubItems.Count; i++) - taskMgrListItem.SubItems[i].Font = smallListFont; - - thisLoadItem = taskMgrListItem; - MAppVProcessAllWindowsGetProcessWindow(pid); - thisLoadItem = null; - - if (taskMgrListItem.Childs.Count > 0) - taskMgrListItem.Group = listProcess.Groups[0]; - else if (p.isWindowsProcess) - taskMgrListItem.Group = listProcess.Groups[2]; - else taskMgrListItem.Group = listProcess.Groups[1]; - - taskMgrListItem.PID = pid; - if (need_add_tolist) listProcess.Items.Add(taskMgrListItem); - - ProcessListUpdate(pid, true, taskMgrListItem); - } - private void ProcessListLoadStaticValues(uint pid, TaskMgrListItem it, PsItem p) - { - if (nameindex != -1) - { - if (pid == 0) it.SubItems[nameindex].Text = str_idle_process; - else if (pid == 4) it.SubItems[nameindex].Text = "ntoskrnl.exe"; - else it.SubItems[nameindex].Text = p.exename; - } - if (pidindex != -1) - { - if (pid == 2) - it.SubItems[pidindex].Text = "-"; - else it.SubItems[pidindex].Text = pid.ToString(); - } - if (pathindex != -1) if (p.exepath != "") it.SubItems[pathindex].Text = p.exepath; - if (cmdindex != -1 && p.handle != Nullptr) - { - StringBuilder s = new StringBuilder(1024); - if (MGetProcessCommandLine(p.handle, s, 1024, pid)) - it.SubItems[cmdindex].Text = s.ToString(); - } - if (companyindex != -1) - { - if (p.exepath != "") - { - StringBuilder exeCompany = new StringBuilder(256); - if (MGetExeCompany(p.exepath, exeCompany, 256)) - it.SubItems[companyindex].Text = exeCompany.ToString(); - } - } - } - private void ProcessListUpdate(uint pid, bool isload, TaskMgrListItem it, int ipdateOneDataCloum = -1, bool forceProcessHost = false) - { - if (!forceProcessHost && (it.Type == TaskMgrListItemType.ItemUWPHost || it.Type == TaskMgrListItemType.ItemProcessHost)) - { - //Group uppdate - ProcessListUpdate_GroupChilds(isload, it, ipdateOneDataCloum); - - if (it.Type == TaskMgrListItemType.ItemUWPHost) - { - bool ispause = false; - bool running = ProcessListGetUwpIsRunning(it, out ((UwpItem)it.Tag).firstHwnd); - if (it.Childs.Count > 0) - { - foreach (TaskMgrListItem ix in it.Childs) - if (ix.Type == TaskMgrListItemType.ItemProcess) - { - if (((PsItem)ix.Tag).isPaused) - { - ispause = true; - break; - } - } - if (stateindex != -1 && stateindex != ipdateOneDataCloum) - it.SubItems[stateindex].Text = ispause ? str_status_paused : ""; - it.DrawUWPPaused = ispause; - if (ispause && running) - running = MAppWorkCall3(161, ((UwpItem)it.Tag).firstHwnd) == 1; - } - it.Group = running ? listProcess.Groups[0] : listProcess.Groups[1]; - } - else if (it.Type == TaskMgrListItemType.ItemProcessHost) - { - ProcessListUpdate_State(pid, it, (PsItem)it.Tag); - ProcessListUpdate_WindowsAndGroup(pid, it, ((PsItem)it.Tag), isload); - } - - //Performance - - if (cpuindex != -1 && ipdateOneDataCloum != cpuindex) - { - double d = 0; int datacount = 0; - foreach (TaskMgrListItem ix in it.Childs) - { - if (ix.Type == TaskMgrListItemType.ItemProcess) - { - d += ix.SubItems[cpuindex].CustomData; - datacount++; - } - } - double ii2 = d; - it.SubItems[cpuindex].Text = ii2.ToString("0.0") + "%"; - it.SubItems[cpuindex].BackColor = ProcessListGetColorFormValue(ii2, 100); - it.SubItems[cpuindex].CustomData = ii2; - } - if (ramindex != -1 && ipdateOneDataCloum != ramindex) - { - double d = 0; - foreach (TaskMgrListItem ix in it.Childs) - if (ix.Type == TaskMgrListItemType.ItemProcess) - d += ix.SubItems[ramindex].CustomData; - it.SubItems[ramindex].Text = FormatFileSizeMen(Convert.ToInt64(d * 1024)); - it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(d / 1024, maxMem); - it.SubItems[ramindex].CustomData = d; - } - if (diskindex != -1 && ipdateOneDataCloum != diskindex) - { - double d = 0; - foreach (TaskMgrListItem ix in it.Childs) - if (ix.Type == TaskMgrListItemType.ItemProcess) - d += ix.SubItems[diskindex].CustomData; - if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_DISK) d = 0.1; - else if (d < PERF_LIMIT_MIN_DATA_DISK) d = 0; - if (d != 0) - { - it.SubItems[diskindex].Text = d.ToString("0.0") + " MB/" + str_sec; - it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(d, 1024); - it.SubItems[diskindex].CustomData = d; - } - else - { - it.SubItems[diskindex].Text = "0 MB/" + str_sec; - it.SubItems[diskindex].BackColor = dataGridZeroColor; - it.SubItems[diskindex].CustomData = 0; - } - } - if (netindex != -1 && ipdateOneDataCloum != netindex) - { - double d = 0; - foreach (TaskMgrListItem ix in it.Childs) - if (ix.Type == TaskMgrListItemType.ItemProcess) - d += ix.SubItems[netindex].CustomData; - if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_NETWORK) d = 0.1; else if (d < PERF_LIMIT_MIN_DATA_NETWORK) d = 0; - if (d != 0) - { - it.SubItems[netindex].Text = d.ToString("0.0") + " Mbps"; - it.SubItems[netindex].CustomData = d; - it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(d, 16); - } - else - { - it.SubItems[netindex].Text = "0 Mbps"; - it.SubItems[netindex].CustomData = 0; - it.SubItems[netindex].BackColor = dataGridZeroColor; - } - } - } - else - { - PsItem p = ((PsItem)it.Tag); - - ProcessListUpdate_WindowsAndGroup(pid, it, p, isload); - - if (stateindex != -1) - { - if (ipdateOneDataCloum != stateindex) - ProcessListUpdate_State(pid, it, p); - } - else ProcessListUpdate_State(pid, it, p); - if (cpuindex != -1 && ipdateOneDataCloum != cpuindex) ProcessListUpdatePerf_Cpu(pid, it, p); - if (ramindex != -1 && ipdateOneDataCloum != ramindex) ProcessListUpdatePerf_Ram(pid, it, p); - if (diskindex != -1 && ipdateOneDataCloum != diskindex) ProcessListUpdatePerf_Disk(pid, it, p); - if (netindex != -1 && ipdateOneDataCloum != netindex) ProcessListUpdatePerf_Net(pid, it, p); - } - } - private void ProcessListUpdateOnePerfCloum(uint pid, TaskMgrListItem it, int ipdateOneDataCloum, bool forceProcessHost = false) - { - if (!forceProcessHost && (it.Type == TaskMgrListItemType.ItemUWPHost || it.Type == TaskMgrListItemType.ItemProcessHost)) - { - TaskMgrListItem ii = it as TaskMgrListItem; - if (stateindex != -1 && ipdateOneDataCloum == stateindex) - { - bool ispause = false; - - if (stateindex != -1 && ipdateOneDataCloum == stateindex && it.Childs.Count > 0) - { - foreach (TaskMgrListItem ix in it.Childs) - if (ix.Type == TaskMgrListItemType.ItemProcess) - { - PsItem p = ((PsItem)ix.Tag); - ProcessListUpdate_State(ix.PID, ix, p); - if (ix.SubItems[stateindex].Text == str_status_paused) - { - ispause = true; - break; - } - } - it.SubItems[stateindex].Text = ispause ? str_status_paused : ""; - } - if (it.Type == TaskMgrListItemType.ItemUWPHost) - { - bool running = ProcessListGetUwpIsRunning(it, out ((UwpItem)it.Tag).firstHwnd); - if (ispause && running) - running = MAppWorkCall3(161, ((UwpItem)it.Tag).firstHwnd) == 1; - it.Group = running ? listProcess.Groups[0] : listProcess.Groups[1]; - } - } - if (ipdateOneDataCloum > -1) - { - double d = 0; int datacount = 0; - foreach (TaskMgrListItem ix in ii.Childs) - { - if (ix.Type == TaskMgrListItemType.ItemProcess) - { - ProcessListUpdateOnePerfCloum(ix.PID, ix, ipdateOneDataCloum); - d += ix.SubItems[ipdateOneDataCloum].CustomData; - datacount++; - } - } - - //Performance - if (cpuindex != -1 && ipdateOneDataCloum == cpuindex) - { - double ii2 = d;// (d / datacount); - it.SubItems[cpuindex].Text = ii2.ToString("0.0") + "%"; - it.SubItems[cpuindex].BackColor = ProcessListGetColorFormValue(ii2, 100); - it.SubItems[cpuindex].CustomData = ii2; - } - else if (ramindex != -1 && ipdateOneDataCloum == ramindex) - { - it.SubItems[ramindex].Text = FormatFileSizeMen(Convert.ToInt64(d * 1024)); - it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(d / 1024, maxMem); - it.SubItems[ramindex].CustomData = d; - } - else if (diskindex != -1 && ipdateOneDataCloum == diskindex) - { - if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_DISK) d = 0.1; - else if (d < PERF_LIMIT_MIN_DATA_DISK) d = 0; - if (d != 0) - { - it.SubItems[diskindex].Text = d.ToString("0.0") + " MB/" + str_sec; - it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(d, 1024); - it.SubItems[diskindex].CustomData = d; - return; - } - it.SubItems[netindex].Text = "0 MB/" + str_sec; - it.SubItems[netindex].CustomData = 0; - it.SubItems[netindex].BackColor = dataGridZeroColor; - } - else if (netindex != -1 && ipdateOneDataCloum == netindex) - { - if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_NETWORK) d = 0.1; else if (d < PERF_LIMIT_MIN_DATA_NETWORK) d = 0; - if (d != 0) - { - it.SubItems[netindex].Text = d.ToString("0.0") + " Mbps"; - it.SubItems[netindex].CustomData = d; - it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(d, 16); - return; - } - it.SubItems[netindex].Text = "0 Mbps"; - it.SubItems[netindex].CustomData = 0; - it.SubItems[netindex].BackColor = dataGridZeroColor; - } - } - } - else - { - PsItem p = ((PsItem)it.Tag); - if (stateindex != -1 && ipdateOneDataCloum == stateindex) ProcessListUpdate_State(pid, it, p); - - if (cpuindex != -1 && ipdateOneDataCloum == cpuindex) ProcessListUpdatePerf_Cpu(pid, it, p); - if (ramindex != -1 && ipdateOneDataCloum == ramindex) ProcessListUpdatePerf_Ram(pid, it, p); - if (diskindex != -1 && ipdateOneDataCloum == diskindex) ProcessListUpdatePerf_Disk(pid, it, p); - if (netindex != -1 && ipdateOneDataCloum == netindex) ProcessListUpdatePerf_Net(pid, it, p); - } - } - - private void ProcessListUpdateValues(int refeshAllDataColum) - { - //update process perf data - - if (!isSimpleView) - { - if (refeshAllDataColum != -1) - foreach (PsItem p in loadedPs) - ProcessListUpdateOnePerfCloum(p.pid, p.item, refeshAllDataColum); - - for (int i = listProcess.ShowedItems.Count - 1; i < listProcess.ShowedItems.Count && i >= 0; i--) - { - if (listProcess.ShowedItems[i].Parent != null) continue; - //åªåˆ·æ–°æ˜¾ç¤ºçš„æ¡ç›® - if (listProcess.ShowedItems[i].Type == TaskMgrListItemType.ItemUWPHost) - ProcessListUpdate(listProcess.ShowedItems[i].PID, false, listProcess.ShowedItems[i], refeshAllDataColum); - else ProcessListUpdate(listProcess.ShowedItems[i].PID, false, listProcess.ShowedItems[i], refeshAllDataColum); - } - } - } - - //Child & Group - private int ProcessListUpdate_ChildItemsAdd(TaskMgrListItem it, PsItem p) - { - int allCount = 0; - //递归添加所有å­è¿›ç¨‹ - foreach (PsItem child in p.childs) - { - if (!child.isWindowShow) - { - allCount++; - - if (listProcess.Items.Contains(child.item)) - listProcess.Items.Remove(child.item); - else if (child.item.Parent != null) - child.item.Parent.Childs.Remove(child.item); - - if (!it.Childs.Contains(child.item)) - it.Childs.Add(child.item); - - if (child.childs.Count > 0) - allCount += ProcessListUpdate_ChildItemsAdd(it, child); - } - else - { - if (it.Childs.Contains(child.item)) - it.Childs.Remove(child.item); - else if (child.item.Parent != null) - child.item.Parent.Childs.Remove(child.item); - - if (!listProcess.Items.Contains(child.item)) - listProcess.Items.Add(child.item); - } - } - return allCount; - } - private void ProcessListUpdate_ChildItems(uint pid, TaskMgrListItem it, PsItem p) - { - if (p.isWindowShow && p.childs.Count > 0 && !IsExplorer(p) && !it.IsCloneItem) - { - if (it.Type != TaskMgrListItemType.ItemProcessHost) - { - it.Type = TaskMgrListItemType.ItemProcessHost; - - //Clone a child item - TaskMgrListItem cloneItem = new TaskMgrListItem(); - cloneItem.Text = it.Text; - cloneItem.PID = it.PID; - cloneItem.Type = TaskMgrListItemType.ItemProcess; - cloneItem.Tag = p; - cloneItem.DisplayChildCount = false; - cloneItem.DisplayChildValue = 0; - cloneItem.IsCloneItem = true; cloneItem.IsFullData = true; - cloneItem.Icon = it.Icon; cloneItem.Image = it.Image; - //Copy 13 empty item - for (int i = 0; i < 13; i++) - { - cloneItem.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - cloneItem.SubItems[i].Text = it.SubItems[i].Text; - cloneItem.SubItems[i].Font = it.SubItems[i].Font; - } - //Make it hight light - cloneItem.SubItems[0].ForeColor = Color.FromArgb(0x11, 0x66, 0x00); - if (pidindex != -1) - it.SubItems[pidindex].Text = ""; - it.Childs.Add(cloneItem); - } - - it.DisplayChildCount = true; - it.DisplayChildValue = ProcessListUpdate_ChildItemsAdd(it, p) + 1; - - if (it.DisplayChildValue == 1) - { - if (!ProcessListUpdate_GroupChildsIsValid(it)) - { - it.Type = TaskMgrListItemType.ItemProcess; - it.DisplayChildCount = false; - ProcessListUpdate_BreakProcHost(it, true); - } - } - } - else - { - if (it.Type != TaskMgrListItemType.ItemProcess) - it.Type = TaskMgrListItemType.ItemProcess; - - it.DisplayChildCount = false; - - if (it.Childs.Count > 0) - ProcessListUpdate_BreakProcHost(it, true); - } - } - private void ProcessListUpdate_GroupChilds(bool isload, TaskMgrListItem ii, int ipdateOneDataCloum = -1) - { - for (int i = ii.Childs.Count - 1; i >= 0; i--) - { - TaskMgrListItem li = ii.Childs[i]; - if (li.Type == TaskMgrListItemType.ItemProcess) - ProcessListUpdate(li.PID, isload, li, ipdateOneDataCloum); - } - } - private bool ProcessListUpdate_GroupChildsIsValid(TaskMgrListItem it) - { - bool findCloneItem = false, findRealItem = false; - if (it.Childs.Count > 0) - { - - for (int i = it.Childs.Count - 1; i >= 0; i--) - { - TaskMgrListItem lics = it.Childs[i]; - if (lics.Type == TaskMgrListItemType.ItemProcess) - { - if (lics.IsCloneItem) findCloneItem = true; - else findRealItem = true; - if(findCloneItem && findRealItem) - return true; - } - } - } - return findCloneItem && findRealItem; - } - - //All runtime data - private void ProcessListUpdate_WindowsAndGroup(uint pid, TaskMgrListItem it, PsItem p, bool isload) - { - if (pid > 4) - { - //Child and group - if (!p.isSvchost) - { - //remove invalid windows - for (int i = it.Childs.Count - 1; i >= 0; i--) - { - if (it.Childs[i].Type == TaskMgrListItemType.ItemWindow) - { - IntPtr h = (IntPtr)it.Childs[i].Tag; - if (!IsWindow(h) || !IsWindowVisible(h)) - it.Childs.Remove(it.Childs[i]); - } - } - if (!isload) - { - //update window - thisLoadItem = it; - MAppVProcessAllWindowsGetProcessWindow(pid); - thisLoadItem = null; - - IntPtr firstWindow = IntPtr.Zero; - int windowCount = 0; - for (int i = it.Childs.Count - 1; i >= 0; i--) - { - if (it.Childs[i].Type == TaskMgrListItemType.ItemWindow) - { - if (firstWindow == IntPtr.Zero) firstWindow = (IntPtr)it.Childs[i].Tag; - windowCount++; - } - } - //group - if (windowCount > 0) - { - p.isWindowShow = true; - if (it.Group != listProcess.Groups[0]) - it.Group = listProcess.Groups[0]; - ProcessListUpdate_ChildItems(pid, it, p); - if (windowCount == 1) - p.firstHwnd = firstWindow; - else p.firstHwnd = IntPtr.Zero; - } - else - { - p.firstHwnd = IntPtr.Zero; - - bool needBreak = false; - - if (p.isWindowsProcess) - { - if (it.Group != listProcess.Groups[2]) - { - if (typeindex != -1) - it.SubItems[typeindex].Text = listProcess.Groups[2].Header; - it.Group = listProcess.Groups[2]; - needBreak = true; - } - p.isWindowShow = false; - } - else - { - if (it.Group != listProcess.Groups[1]) - { - if (typeindex != -1) - it.SubItems[typeindex].Text = listProcess.Groups[1].Header; - it.Group = listProcess.Groups[1]; - needBreak = true; - } - p.isWindowShow = false; - } - - if (needBreak && it.Childs.Count > 0) - ProcessListUpdate_BreakProcHost(it); - } - } - } - else - { - if (isload) - { - p.isWindowShow = false; - it.Group = listProcess.Groups[p.isWindowsProcess ? 2 : 1]; - if (typeindex != -1) - it.SubItems[typeindex].Text = it.Group.Header; - } - } - } - } - private void ProcessListUpdate_State(uint pid, TaskMgrListItem it, PsItem p) - { - int i = MGetProcessState(p.processItem, IntPtr.Zero); - if (i == 1) - { - p.isPaused = false; - if (stateindex != -1) it.SubItems[stateindex].Text = ""; - if (p.isSvchost == false && it.Childs.Count > 0) - { - bool hung = false; - foreach (TaskMgrListItem c in it.Childs) - if (c.Type == TaskMgrListItemType.ItemWindow) - if (IsHungAppWindow((IntPtr)c.Tag)) - { - hung = true; - break; - } - p.isHung = hung; - if (hung) - { - if (stateindex != -1) - { - it.SubItems[stateindex].Text = str_status_hung; - it.SubItems[stateindex].ForeColor = Color.FromArgb(219, 107, 58); - } - } - } - else p.isHung = false; - } - else if (i == 2) - { - p.isPaused = true; - if (stateindex != -1) - { - it.SubItems[stateindex].Text = str_status_paused; - it.SubItems[stateindex].ForeColor = Color.FromArgb(22, 158, 250); - } - } - else p.isPaused = false; - - if (p.isUWP && it.Parent != null) - it.DrawUWPPaused = p.isPaused; - else it.DrawUWPPaused = false; - } - private void ProcessListUpdatePerf_Cpu(uint pid, TaskMgrListItem it, PsItem p) - { - if (pid != 0 && p.processItem != IntPtr.Zero) - { - - double ii = MProcessPerformanctMonitor.GetProcessCpuUseAge(p.processItem); - it.SubItems[cpuindex].Text = ii.ToString("0.0") + "%"; - it.SubItems[cpuindex].BackColor = ProcessListGetColorFormValue(ii, 100); - it.SubItems[cpuindex].CustomData = ii; - } - else - { - it.SubItems[cpuindex].Text = "0.0%"; - it.SubItems[cpuindex].BackColor = dataGridZeroColor; - it.SubItems[cpuindex].CustomData = 0; - } - } - private void ProcessListUpdatePerf_Ram(uint pid, TaskMgrListItem it, PsItem p) - { - if (p.isUWP && p.isPaused) - { - it.SubItems[ramindex].Text = "0.1 MB"; - it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(0.1, 1024); - it.SubItems[ramindex].CustomData = 1; - } - else if (pid == 2) - { - it.SubItems[ramindex].Text = "0.0 MB"; - it.SubItems[ramindex].BackColor = dataGridZeroColor; - it.SubItems[ramindex].CustomData = 1; - } - else if (pid == 4 || pid == 0) - { - it.SubItems[ramindex].Text = "0.1 MB"; - it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(0.1, 1024); - it.SubItems[ramindex].CustomData = 1; - } - else if (p.processItem != IntPtr.Zero) - { - uint ii = MProcessPerformanctMonitor.GetProcessPrivateWoringSet(p.processItem); - it.SubItems[ramindex].Text = FormatFileSizeMen(Convert.ToInt64(ii)); - it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(ii / 1048576, maxMem); - it.SubItems[ramindex].CustomData = ii / 1024d; - } - } - private void ProcessListUpdatePerf_Disk(uint pid, TaskMgrListItem it, PsItem p) - { - if (p.processItem != IntPtr.Zero && p.pid != 2) - { - ulong disk = MProcessPerformanctMonitor.GetProcessIOSpeed(p.processItem); - double val = (disk / 1048576d); - if (val < 0.1 && val >= PERF_LIMIT_MIN_DATA_DISK) - { - it.SubItems[diskindex].Text = "0.1 MB/" + str_sec; - it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(val, 128); - it.SubItems[diskindex].CustomData = val; - } - else if (val < PERF_LIMIT_MIN_DATA_DISK) val = 0; - else if (val != 0) - { - it.SubItems[diskindex].Text = val.ToString("0.0") + " MB/" + str_sec; - it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(val, 128); - it.SubItems[diskindex].CustomData = val; - return; - } - } - - it.SubItems[diskindex].Text = "0 MB/" + str_sec; - it.SubItems[diskindex].BackColor = dataGridZeroColor; - it.SubItems[diskindex].CustomData = 0; - } - private void ProcessListUpdatePerf_Net(uint pid, TaskMgrListItem it, PsItem p) - { - //if (p.updateLock) { p.updateLock = false; return; } - if (pid > 4 && MPERF_NET_IsProcessInNet(pid)) - { - double allMBytesPerSec = MProcessPerformanctMonitor.GetProcessNetworkSpeed(p.processItem) / 1048576d; - - if (allMBytesPerSec < 0.1 && allMBytesPerSec >= PERF_LIMIT_MIN_DATA_NETWORK) allMBytesPerSec = 0.1; - else if (allMBytesPerSec < PERF_LIMIT_MIN_DATA_NETWORK) - { - it.SubItems[netindex].Text = "0.1 Mbps"; - it.SubItems[netindex].CustomData = allMBytesPerSec; - it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(allMBytesPerSec, 16); - } - else if (allMBytesPerSec != 0) - { - it.SubItems[netindex].Text = allMBytesPerSec.ToString("0.0") + " Mbps"; - it.SubItems[netindex].CustomData = allMBytesPerSec; - it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(allMBytesPerSec, 16); - return; - } - } - - it.SubItems[netindex].Text = "0 Mbps"; - it.SubItems[netindex].CustomData = 0; - it.SubItems[netindex].BackColor = dataGridZeroColor; - } - private void ProcessListUpdate_BreakProcHost(TaskMgrListItem it, bool doNotClearall = false) - { - if (it.Childs.Count > 0) - { - for (int i = it.Childs.Count - 1; i >= 0; i--) - { - TaskMgrListItem lics = it.Childs[i]; - if (lics.Type == TaskMgrListItemType.ItemProcess) - { - if (lics.IsCloneItem == false) listProcess.Items.Add(lics); - if (doNotClearall) it.Childs.Remove(lics); - } - } - if(!doNotClearall) it.Childs.Clear(); - } - if (pidindex != -1) it.SubItems[pidindex].Text = it.PID.ToString(); - } - - //Delete - private void ProcessListFree(PsItem it) - { - //remove invalid item - //MAppWorkCall3(174, IntPtr.Zero, new IntPtr(it.pid)); - - UwpHostItem hostitem = ProcessListFindUWPItemWithHostId(it.pid); - if (hostitem != null) uwpHostPid.Remove(hostitem); - if (it.uwpItem != null) - it.uwpItem = null; - - it.svcs.Clear(); - - foreach (PsItem pchid in it.childs) - pchid.parent = null; - it.childs.Clear(); - - if (it.parent != null) - { - it.parent.childs.Remove(it); - it.parent = null; - } - - TaskMgrListItem li = it.item; - if (li == null) li = ProcessListFindItem(it.pid); - if (li != null) - ProcessListRemoveItem(li); - else Log("ProcessListFree for a no host item : " + it); - - loadedPs.Remove(it); - } - private void ProcessListFreeAll() - { - //the exit clear - uwps.Clear(); - uwpHostPid.Clear(); - for (int i = 0; i < loadedPs.Count; i++) - ProcessListFree(loadedPs[i]); - loadedPs.Clear(); - listProcess.Items.Clear(); - - MProcessMonitor.DestroyProcessMonitor(processMonitor); - } - private void ProcessListRemoveItem(TaskMgrListItem li) - { - //is a group item - if (li.Type == TaskMgrListItemType.ItemUWPHost || li.Type == TaskMgrListItemType.ItemProcessHost) - { - li.Group = listProcess.Groups[1]; - ProcessListUpdate_BreakProcHost(li); - listProcess.Items.Remove(li); - } - else - { - if (li.Parent != null)//is a child item - { - TaskMgrListItem iii = li.Parent; - iii.Childs.Remove(li); - listProcess.Items.Remove(li); - //uwp host item - if (iii.Type == TaskMgrListItemType.ItemUWPHost) - { - if (iii.Childs.Count == 0)//o to remove - { - listProcess.Items.Remove(iii); - UwpItem parentItem = ProcessListFindUWPItem(iii.Tag.ToString()); - if (parentItem != null) - uwps.Remove(parentItem); - } - } - } - else - { - listProcess.Items.Remove(li); - } - } - } - - //CallBacks - private void ProcessListRemoveItemCallBack(uint pid) - { - PsItem oldps = ProcessListFindPsItem(pid); - if (oldps != null) - { - ProcessListFree(oldps); - } - else - { - TaskMgrListItem li = ProcessListFindItem(pid); - if (li != null) ProcessListRemoveItem(li); - else Log("ProcessListRemoveItemCallBack for a not found item : pid " + pid); - } - } - private void ProcessListNewItemCallBack(uint pid, uint parentid, string exename, string exefullpath, IntPtr hProcess, IntPtr processItem) - { - if (!isRunAsAdmin && string.IsNullOrEmpty(exefullpath) && pid != 0 && pid != 2 && pid != 4 && pid != 88) - return; - - ProcessListLoad(pid, parentid, exename, exefullpath, hProcess, processItem); - } - - //Operation - private void ProcessListEndTask(uint pid, TaskMgrListItem taskMgrListItem) - { - //结æŸä»»åŠ¡ - if (taskMgrListItem == null) taskMgrListItem = ProcessListFindItem(pid); - if (taskMgrListItem != null) - { - if (taskMgrListItem.Type == TaskMgrListItemType.ItemProcessHost) - { - bool ananyrs = false; - PsItem p = taskMgrListItem.Tag as PsItem; - if (p.isWindowShow && !p.isSvchost) - { - if (taskMgrListItem.Childs.Count > 0) - { - IntPtr target = IntPtr.Zero; - for (int i = taskMgrListItem.Childs.Count - 1; i >= 0; i--) - if (taskMgrListItem.Childs[i].Type == TaskMgrListItemType.ItemWindow) - { - target = (IntPtr)taskMgrListItem.Childs[i].Tag; - if (target != IntPtr.Zero) - if (MAppWorkCall3(192, IntPtr.Zero, target) == 1) - ananyrs = true; - } - } - else ananyrs = true; - } - - if (!ananyrs) - nextKillItem = taskMgrListItem; - else - { - foreach (TaskMgrListItem lichild in taskMgrListItem.Childs) - { - if (lichild.Type == TaskMgrListItemType.ItemProcess) - if (!MKillProcessUser2(lichild.PID, false, true)) - break; - } - MKillProcessUser2(taskMgrListItem.PID, true, true); - } - } - else if (taskMgrListItem.Type == TaskMgrListItemType.ItemUWPHost) - { - bool ananyrs = false; - IntPtr target = ((UwpItem)taskMgrListItem.Tag).firstHwnd; - if (target != Nullptr) - { - if (MAppWorkCall3(192, IntPtr.Zero, target) == 1) - ananyrs = true; - } - if (ananyrs) - { - foreach (TaskMgrListItem lichild in taskMgrListItem.Childs) - { - if (lichild.Type == TaskMgrListItemType.ItemProcess) - MKillProcessUser2(lichild.PID, true, true); - } - } - else nextKillItem = taskMgrListItem; - } - else if (taskMgrListItem.Type == TaskMgrListItemType.ItemProcess) - { - bool ananyrs = false; - PsItem p = taskMgrListItem.Tag as PsItem; - if (p.isWindowShow && !p.isSvchost) - { - if (taskMgrListItem.Childs.Count > 0) - { - IntPtr target = IntPtr.Zero; - for (int i = taskMgrListItem.Childs.Count - 1; i >= 0; i--) - if (taskMgrListItem.Childs[i].Tag != null) - { - target = (IntPtr)taskMgrListItem.Childs[i].Tag; - if (target != IntPtr.Zero) - if (MAppWorkCall3(192, IntPtr.Zero, target) == 1) - ananyrs = true; - } - } - else ananyrs = true; - } - if (ananyrs) MKillProcessUser2(taskMgrListItem.PID, true, false); - } - } - } - private void ProcessListSetTo(TaskMgrListItem taskMgrListItem) - { - //设置到 - if (taskMgrListItem != null) - { - if (taskMgrListItem.Type == TaskMgrListItemType.ItemProcessHost || taskMgrListItem.Type == TaskMgrListItemType.ItemProcess) - { - PsItem p = taskMgrListItem.Tag as PsItem; - if (p.firstHwnd != IntPtr.Zero) MAppWorkCall3(213, p.firstHwnd, p.firstHwnd); - } - else if (taskMgrListItem.Type == TaskMgrListItemType.ItemUWPHost) - { - UwpItem p = taskMgrListItem.Tag as UwpItem; - if (p.firstHwnd != IntPtr.Zero) MAppWorkCall3(213, p.firstHwnd, p.firstHwnd); - } - } - } - private void ProcessListKillProcTree(PsItem p, bool showerr) - { - for (int i = p.childs.Count - 1; i >= 0; i--) - { - PsItem child = ProcessListFindPsItem(p.childs[i].pid); - if (child.childs.Count > 0) - ProcessListKillProcTree(child, false); - MKillProcessUser2(child.pid, showerr, true); - } - } - private void ProcessListKillLastEndItem() - { - if (nextKillItem != null) - { - if (listProcess.Items.Contains(nextKillItem)) - { - if (nextKillItem.Type == TaskMgrListItemType.ItemProcessHost) - { - foreach (TaskMgrListItem lichild in nextKillItem.Childs) - { - if (lichild.Type == TaskMgrListItemType.ItemProcess) - if (!MKillProcessUser2(lichild.PID, false, true)) - break; - } - MKillProcessUser2(nextKillItem.PID, true, true); - } - else if (nextKillItem.Type == TaskMgrListItemType.ItemUWPHost) - { - if(!M_UWP_KillUWPApplication(((UwpItem)nextKillItem.Tag).uwpFullName)) - { - foreach (TaskMgrListItem lichild in nextKillItem.Childs) - { - if (lichild.Type == TaskMgrListItemType.ItemProcess) - if (!MKillProcessUser2(lichild.PID, false, true)) - break; - } - MKillProcessUser2(nextKillItem.PID, true, true); - } - } - } - nextKillItem = null; - } - } - - //Simple List - private void ProcessListSimpleInit() - { - listApps.NoHeader = true; - expandFewerDetals.Show(); - expandFewerDetals.Expanded = true; - - isSimpleView = GetConfigBool("SimpleView", "AppSetting", true); - } - private void ProcessListSimpleExit() - { - if (isSimpleView) - { - lastSimpleSize = Size; - } - SetConfig("OldSizeSimple", "AppSetting", lastSimpleSize.Width + "-" + lastSimpleSize.Height); - SetConfigBool("SimpleView", "AppSetting", isSimpleView); - } - private void ProcessListSimpleRefesh() - { - listApps.Locked = true; - listApps.Items.Clear(); - foreach (TaskMgrListItem li in listProcess.Items) - { - if (li.Group == listProcess.Groups[0]) - { - if (li.Type == TaskMgrListItemType.ItemProcess) - if (IsExplorer((PsItem)li.Tag)) - continue; - if (li.PID != currentProcessPid) - listApps.Items.Add(li); - } - } - listApps.Locked = false; - listApps.SyncItems(true); - listApps_SelectItemChanged(null, null); - } - - //Expand & Collapse - private void ProcessListExpandAll() - { - listProcess.Locked = true; - foreach (TaskMgrListItem li in listProcess.Items) - { - if (li.Childs.Count > 0 && !li.ChildsOpened) - li.ChildsOpened = true; - } - listProcess.Locked = false; - listProcess.SyncItems(true); - } - private void ProcessListCollapseAll() - { - listProcess.Locked = true; - foreach (TaskMgrListItem li in listProcess.Items) - { - if (li.Childs.Count > 0 && li.ChildsOpened) - li.ChildsOpened = false; - } - listProcess.Locked = false; - listProcess.SyncItems(true); - } - - //Events - private void check_showAllProcess_CheckedChanged(object sender, EventArgs e) - { - //switch to admin - //显示所有进程(切æ¢åˆ°ç®¡ç†å‘˜æ¨¡å¼ï¼‰ - if (!MIsRunasAdmin()) - { - if (check_showAllProcess.Checked) - { - MAppRebotAdmin(); - check_showAllProcess.Checked = false; - } - else check_showAllProcess.Checked = false; - } - else check_showAllProcess.Hide(); - } - private void lbShowDetals_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - //if (!MAppVProcess(Handle)) TaskDialog.Show("无法打开详细信æ¯çª—å£", str_AppTitle, "未知错误。", TaskDialogButton.OK, TaskDialogIcon.Stop); - } - private void expandFewerDetals_Click(object sender, EventArgs e) - { - if (!isSimpleView) - { - lastSize = Size; - isSimpleView = true; - if (Size.Width > lastSimpleSize.Width || Size.Height > lastSimpleSize.Height) - Size = lastSimpleSize; - } - } - private void expandMoreDetals_Click(object sender, EventArgs e) - { - if (isSimpleView) - { - lastSimpleSize = Size; - isSimpleView = false; - if (Size.Width < lastSize.Width || Size.Height < lastSize.Height) - Size = lastSize; - } - } - - //Buttons - private void btnEndTaskSimple_Click(object sender, EventArgs e) - { - TaskMgrListItem taskMgrListItem = listApps.SelectedItem; - if (taskMgrListItem != null) - ProcessListEndTask(0, taskMgrListItem); - } - private void btnEndProcess_Click(object sender, EventArgs e) - { - TaskMgrListItem taskMgrListItem = listProcess.SelectedItem; - if (taskMgrListItem != null) - { - if (taskMgrListItem.Group == listProcess.Groups[0]) - ProcessListEndTask(0, taskMgrListItem); - else MAppWorkCall3(178, Handle, IntPtr.Zero); - } - } - - //Timers - private void BaseProcessRefeshTimerLowSc_Tick(object sender, EventArgs e) - { - if (tabControlMain.SelectedTab == tabPageProcCtl) - ScMgrRefeshList(); - } - private void BaseProcessRefeshTimerLow_Tick(object sender, EventArgs e) - { - refeshLowLock = true; - if (tabControlMain.SelectedTab == tabPageProcCtl) - ProcessListForceRefeshAll(); - refeshLowLock = false; - } - private void BaseProcessRefeshTimerLowUWP_Tick(object sender, EventArgs e) - { - if (tabControlMain.SelectedTab == tabPageProcCtl) - ProcessListForceRefeshAllUWP(); - } - - #region ListEvents - - private void listApps_SelectItemChanged(object sender, EventArgs e) - { - btnEndTaskSimple.Enabled = listApps.SelectedItem != null; - } - private void listApps_KeyDown(object sender, KeyEventArgs e) - { - TaskMgrListItem li = listApps.SelectedItem; - if (li == null) return; - if (e.KeyCode == Keys.Delete) - ProcessListEndTask(0, li); - else if (e.KeyCode == Keys.Apps) - { - Point p = listApps.GetiItemPoint(li); - p = listApps.PointToScreen(p); - MAppWorkCall3(212, new IntPtr(p.X), new IntPtr(p.Y)); - MAppWorkCall3(214, Handle, IntPtr.Zero); - } - } - private void listApps_MouseClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (listApps.SelectedItem != null) - { - MAppWorkCall3(212, new IntPtr(MousePosition.X), new IntPtr(MousePosition.Y)); - MAppWorkCall3(214, Handle, IntPtr.Zero); - } - } - } - private void listApps_MouseDoubleClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - TaskMgrListItem li = listApps.SelectedItem; - if (li == null) return; - ProcessListSetTo(li); - } - } - - private void listProcess_MouseDoubleClick(object sender, MouseEventArgs e) - { - TaskMgrListItem li = listProcess.SelectedItem; - if (li == null) return; - if (e.Button == MouseButtons.Left) - { - if (li.OldSelectedItem != null) - { - if (li.OldSelectedItem.Type == TaskMgrListItemType.ItemWindow && li.OldSelectedItem.Tag != null) - { - IntPtr data = (IntPtr)li.OldSelectedItem.Tag; - MAppWorkCall3(213, data, IntPtr.Zero); - WindowState = FormWindowState.Minimized; - } - } - else if (li.Type == TaskMgrListItemType.ItemWindow) - { - if (li.Tag != null) - { - IntPtr data = (IntPtr)li.Tag; - MAppWorkCall3(213, data, IntPtr.Zero); - WindowState = FormWindowState.Minimized; - } - } - else if (li.Childs.Count > 0) - { - li.ChildsOpened = !li.ChildsOpened; - listProcess.SyncItems(true); - } - } - } - private void listProcess_ShowMenuSelectItem(Point pos = default(Point)) - { - if (listProcess.SelectedItem != null) - { - TaskMgrListItem selectedItem = listProcess.SelectedItem.OldSelectedItem == null ? - listProcess.SelectedItem : listProcess.SelectedItem.OldSelectedItem; - if (selectedItem.Type == TaskMgrListItemType.ItemProcess - || selectedItem.Type == TaskMgrListItemType.ItemUWPProcess - || selectedItem.Type == TaskMgrListItemType.ItemProcessHost) - { - PsItem t = (PsItem)selectedItem.Tag; - int rs = MAppWorkShowMenuProcess(t.exepath, selectedItem.Text, t.pid, Handle, t.firstHwnd != Handle ? t.firstHwnd : IntPtr.Zero, isSelectExplorer ? 1 : 0, nextSecType, pos.X, pos.Y); - } - else if (selectedItem.Type == TaskMgrListItemType.ItemUWPHost) - { - UwpItem t = (UwpItem)selectedItem.Tag; - MAppWorkShowMenuProcess(t.uwpInstallDir, t.uwpFullName, 1, Handle, t.firstHwnd, 0, nextSecType, pos.X, pos.Y); - } - else if (selectedItem.Type == TaskMgrListItemType.ItemWindow) - { - MAppWorkCall3(212, new IntPtr(pos.X), new IntPtr(pos.Y)); - MAppWorkCall3(189, Handle, (IntPtr)selectedItem.Tag); - } - else if (selectedItem.Type == TaskMgrListItemType.ItemService) - { - IntPtr scname = Marshal.StringToHGlobalUni((string)selectedItem.Tag); - MAppWorkCall3(212, new IntPtr(pos.X), new IntPtr(pos.Y)); - MAppWorkCall3(184, Handle, scname); - Marshal.FreeHGlobal(scname); - } - } - } - private void listProcess_PrepareShowMenuSelectItem() - { - if (listProcess.SelectedItem != null) - { - TaskMgrListItem selectedItem = listProcess.SelectedItem.OldSelectedItem == null ? - listProcess.SelectedItem : listProcess.SelectedItem.OldSelectedItem; - if (selectedItem.Type == TaskMgrListItemType.ItemProcess - || selectedItem.Type == TaskMgrListItemType.ItemUWPProcess - || selectedItem.Type == TaskMgrListItemType.ItemProcessHost) - { - PsItem t = (PsItem)selectedItem.Tag; - if (t.pid > 4) - { - btnEndProcess.Enabled = true; - MAppWorkShowMenuProcessPrepare(t.exepath, t.exename, t.pid, IsImporant(t), IsVeryImporant(t)); - - if (IsExplorer(t)) - { - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_REBOOT; - btnEndProcess.Text = str_resrat; - isSelectExplorer = true; - } - else - { - if (t.isWindowShow) - { - if (stateindex != -1) - { - string s = listProcess.SelectedItem.SubItems[stateindex].Text; - if (s == str_status_paused || s == str_status_hung) - { - btnEndProcess.Text = str_endproc; - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; - goto OUT; - } - } - - btnEndProcess.Text = str_endtask; - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_RESENT_BACK; - - } - else - { - btnEndProcess.Text = str_endproc; - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; - } - OUT: - isSelectExplorer = false; - } - } - else btnEndProcess.Enabled = false; - } - else if (selectedItem.Type == TaskMgrListItemType.ItemUWPHost) - { - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_UWP_RESENT_BACK; - string exepath = selectedItem.Tag.ToString(); - MAppWorkShowMenuProcessPrepare(exepath, null, 0, false, false); - btnEndProcess.Text = str_endtask; - btnEndProcess.Enabled = true; - } - else if (selectedItem.Type == TaskMgrListItemType.ItemWindow) - { - MAppWorkCall3(198, IntPtr.Zero, (IntPtr)selectedItem.Tag); - } - else if (selectedItem.Type == TaskMgrListItemType.ItemService) - { - IntPtr scname = Marshal.StringToHGlobalUni((string)selectedItem.Tag); - MAppWorkCall3(197, IntPtr.Zero, scname); - Marshal.FreeHGlobal(scname); - } - } - } - private void listProcess_MouseClick(object sender, MouseEventArgs e) - { - if (listProcess.SelectedItem == null) return; - if (e.Button == MouseButtons.Right) - { - listProcess_PrepareShowMenuSelectItem(); - listProcess_ShowMenuSelectItem(); - } - } - private void listProcess_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Right) - listProcess_PrepareShowMenuSelectItem(); - } - private void listProcess_SelectItemChanged(object sender, EventArgs e) - { - if (listProcess.SelectedItem == null) - btnEndProcess.Enabled = false; - } - private void listProcess_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Delete) - { - btnEndProcess_Click(sender, e); - } - else if (e.KeyCode == Keys.Apps) - { - if (listProcess.SelectedItem != null) - { - Point p = listProcess.GetiItemPoint(listProcess.SelectedItem); - - listProcess_PrepareShowMenuSelectItem(); - listProcess_ShowMenuSelectItem(listProcess.PointToScreen(p)); - } - } - } - - private void Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) - { - if (e.MouseEventArgs.Button == MouseButtons.Left) - { - listProcess.Locked = true; - if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) - { - lvwColumnSorter.Order = SortOrder.Ascending; - sortitem = e.Index; - sorta = true; - } - else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) - { - lvwColumnSorter.Order = SortOrder.Ascending; - sortitem = e.Index; - sorta = true; - } - else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) - { - lvwColumnSorter.Order = SortOrder.Descending; - sortitem = e.Index; - sorta = false; - } - lvwColumnSorter.SortColumn = e.Index; - listProcess.ListViewItemSorter = lvwColumnSorter; - if (0 == lvwColumnSorter.SortColumn) - listProcess.ShowGroup = true; - else listProcess.ShowGroup = false; - listProcess.Sort(); - listProcess.Locked = false; - listProcess.Invalidate(); - } - else if (e.MouseEventArgs.Button == MouseButtons.Right) - { - contextMenuStripMainHeader.Show(MousePosition); - } - } - - private class TaskListViewColumnSorter : ListViewColumnSorter - { - private FormMain m; - - public TaskListViewColumnSorter(FormMain m) - { - this.m = m; - } - public override int Compare(TaskMgrListItem x, TaskMgrListItem y) - { - int compareResult = 0; - - if (SortColumn == 0) compareResult = string.Compare(x.Text, y.Text); - else if (SortColumn == m.cpuindex - || SortColumn == m.ramindex - || SortColumn == m.diskindex - || SortColumn == m.netindex) - compareResult = ObjectCompare.Compare(x.SubItems[SortColumn].CustomData, y.SubItems[SortColumn].CustomData); - else if (SortColumn == m.pidindex) - compareResult = ObjectCompare.Compare(x.PID, y.PID); - else compareResult = string.Compare(x.SubItems[SortColumn].Text, y.SubItems[SortColumn].Text); - - if (compareResult == 0) - compareResult = ObjectCompare.Compare(x.PID, y.PID); - if (Order == SortOrder.Ascending) - return compareResult; - else if (Order == SortOrder.Descending) - return (-compareResult); - return compareResult; - } - } - - private void 百分比ToolStripMenuItemRam_Click(object sender, EventArgs e) - { - if(!isRamPercentage) - { - isRamPercentage = true; - 百分比ToolStripMenuItemRam.Checked = true; - 值ToolStripMenuItemRam.Checked = false; - } - } - private void 值ToolStripMenuItemRam_Click(object sender, EventArgs e) - { - if (isRamPercentage) - { - isRamPercentage = false; - 百分比ToolStripMenuItemRam.Checked = false; - 值ToolStripMenuItemRam.Checked = true; - } - } - private void 百分比ToolStripMenuItemDisk_Click(object sender, EventArgs e) - { - if (!isDiskPercentage) - { - isDiskPercentage = true; - 百分比ToolStripMenuItemDisk.Checked = true; - 值ToolStripMenuItemDisk.Checked = false; - } - } - private void 值ToolStripMenuItemDisk_Click(object sender, EventArgs e) - { - if (isDiskPercentage) - { - isDiskPercentage = false; - 百分比ToolStripMenuItemDisk.Checked = false; - 值ToolStripMenuItemDisk.Checked = true; - } - } - private void 百分比ToolStripMenuItemNet_Click(object sender, EventArgs e) - { - if (!isNetPercentage) - { - isNetPercentage = true; - 百分比ToolStripMenuItemNet.Checked = true; - 值ToolStripMenuItemNet.Checked = false; - } - } - private void 值ToolStripMenuItemNet_Click(object sender, EventArgs e) - { - if (isNetPercentage) - { - isNetPercentage = false; - 百分比ToolStripMenuItemNet.Checked = false; - 值ToolStripMenuItemNet.Checked = true; - } - } - - #endregion - - #region Headers - - public class itemheader - { - public itemheader(int index, string name, int wi) - { - this.index = index; - this.name = name; - width = wi; - show = true; - } - - public int width = 0; - public bool show = false; - public int index = 0; - public string name = ""; - } - public struct itemheaderTip - { - public itemheaderTip(string hn, string n) - { - herdername = hn; - name = n; - } - public string herdername; - public string name; - } - public struct itemheaderDef - { - public itemheaderDef(string hn, int width) - { - herdername = hn; - this.width = width; - } - public string herdername; - public int width; - } - public bool saveheader = true; - private List headers = new List(); - private itemheaderTip[] headerTips = new itemheaderTip[]{ - new itemheaderTip("TitleCPU", "TipCPU"), - new itemheaderTip("TitleRam", "TipRam"), - new itemheaderTip("TitleDisk", "TipDisk"), - new itemheaderTip("TitleNet", "TipNet"), - }; - private itemheaderDef[] headerDefs = new itemheaderDef[]{ - new itemheaderDef("TitleProcName", 170), - new itemheaderDef("TitleType", 100), - new itemheaderDef("TitlePublisher", 100), - new itemheaderDef("TitleStatus", 80), - new itemheaderDef("TitlePID", 55), - new itemheaderDef("TitleCPU", 75), - new itemheaderDef("TitleRam", 75), - new itemheaderDef("TitleDisk", 75), - new itemheaderDef("TitleNet", 75), - new itemheaderDef("TitleProcPath", 240), - new itemheaderDef("TitleCmdLine", 200), - new itemheaderDef("TitleEProcess", 100), - - }; - private int currHeaderI = 0; - private int listProcessTryGetHeaderDefaultWidth(string name) - { - foreach (itemheaderDef d in headerDefs) - { - if (d.herdername == name) - return d.width; - } - return 100; - } - private string listProcessTryGetHeaderTip(string name) - { - foreach (itemheaderTip t in headerTips) - { - if (t.herdername == name) - return LanuageMgr.GetStr(t.name); - } - return null; - } - private void listProcessAddHeader(string name, int width) - { - if (listProcessGetListHeaderItem(name) != null) return; - headers.Add(new itemheader(currHeaderI, name, width)); - currHeaderI++; - TaskMgrListHeaderItem li = new TaskMgrListHeaderItem(); - string tip = listProcessTryGetHeaderTip(name); - if (name != null) - li.ToolTip = tip; - li.TextSmall = LanuageMgr.GetStr(name); - li.Identifier = name; - li.Width = width; - listProcess.Colunms.Add(li); - } - private int listProcessGetListIndex(string name) - { - int rs = -1; - foreach (TaskMgrListHeaderItem li in listProcess.Colunms) - { - if (li.Identifier == name) - { - rs = li.Index; - break; - } - } - return rs; - } - public itemheader listProcessGetListHeaderItem(string name) - { - itemheader rs = null; - for (int i = 0; i < headers.Count; i++) - { - if (headers[i].name == name) - { - rs = headers[i]; - break; - } - } - return rs; - } - private void listProcessAddHeaderMenu(string name) - { - ToolStripItem item = new ToolStripMenuItem(LanuageMgr.GetStr(name)); - - item.Name = name; - item.Click += MainHeadeMenuItem_Click; - - contextMenuStripMainHeader.Items.Insert(contextMenuStripMainHeader.Items.Count - 2, item); - } - private void listProcessCheckHeaderMenu(string name, bool show) - { - foreach (ToolStripItem item in contextMenuStripMainHeader.Items) - { - if ((item is ToolStripMenuItem) && item.Name == name) - { - ((ToolStripMenuItem)item).Checked = show; - break; - } - } - } - private int listProcessGetHeaderMenuDefIndex(string name) - { - int index = 1; - for (int i = 1; i < contextMenuStripMainHeader.Items.Count; i++) - { - ToolStripItem item = contextMenuStripMainHeader.Items[i]; - if ((item is ToolStripMenuItem)) - { - if (((ToolStripMenuItem)item).Checked) - index++; - } - if (item.Name == name) - break; - } - return index; - } - private void listProcessGetAllHeaderIndexs(string name = "") - { - if (name == "") - { - nameindex = listProcessGetListIndex("TitleProcName"); - companyindex = listProcessGetListIndex("TitlePublisher"); - stateindex = listProcessGetListIndex("TitleStatus"); - pidindex = listProcessGetListIndex("TitlePID"); - cpuindex = listProcessGetListIndex("TitleCPU"); - ramindex = listProcessGetListIndex("TitleRam"); - diskindex = listProcessGetListIndex("TitleDisk"); - netindex = listProcessGetListIndex("TitleNet"); - pathindex = listProcessGetListIndex("TitleProcPath"); - cmdindex = listProcessGetListIndex("TitleCmdLine"); - eprocessindex = listProcessGetListIndex("TitleEProcess"); - typeindex = listProcessGetListIndex("TitleType"); - } - else - { - if (name == "TitleProcName") nameindex = listProcessGetListIndex("TitleProcName"); - else if (name == "TitlePublisher") companyindex = listProcessGetListIndex("TitlePublisher"); - else if (name == "TitleStatus") stateindex = listProcessGetListIndex("TitleStatus"); - else if (name == "TitlePID") pidindex = listProcessGetListIndex("TitlePID"); - else if (name == "TitleCPU") cpuindex = listProcessGetListIndex("TitleCPU"); - else if (name == "TitleRam") ramindex = listProcessGetListIndex("TitleRam"); - else if (name == "TitleDisk") diskindex = listProcessGetListIndex("TitleDisk"); - else if (name == "TitleNet") netindex = listProcessGetListIndex("TitleNet"); - else if (name == "TitleProcPath") pathindex = listProcessGetListIndex("TitleProcPath"); - else if (name == "TitleCmdLine") cmdindex = listProcessGetListIndex("TitleCmdLine"); - else if (name == "TitleEProcess") eprocessindex = listProcessGetListIndex("TitleEProcess"); - else if (name == "TitleType") typeindex = listProcessGetListIndex("TitleType"); - } - } - private void listProcessInsertHeader(string name, int width, int index) - { - if (listProcessGetListHeaderItem(name) != null) return; - headers.Add(new itemheader(index, name, width)); - currHeaderI++; - TaskMgrListHeaderItem li = new TaskMgrListHeaderItem(); - string tip = listProcessTryGetHeaderTip(name); - if (name != null) - li.ToolTip = tip; - li.TextSmall = LanuageMgr.GetStr(name); - li.Identifier = name; - li.Width = width; - listProcess.Colunms.Add(li); - - li.DisplayIndex = index; - - listProcessGetAllHeaderIndexs(""); - listProcess.Header.Invalidate(); - ProcessListForceRefeshAll(true); - - } - private void listProcessRemoveHeader(string name) - { - itemheader h = listProcessGetListHeaderItem(name); - if (h != null) - { - headers.Remove(h); - - foreach (TaskMgrListHeaderItem li in listProcess.Colunms) - { - if (li.Identifier == name) - { - listProcess.Colunms.Remove(li); - break; - } - } - - listProcessGetAllHeaderIndexs(""); - listProcess.Header.Invalidate(); - ProcessListForceRefeshAll(); - } - } - - private void MainHeadeMenuItem_Click(object sender, EventArgs e) - { - ToolStripMenuItem item = sender as ToolStripMenuItem; - if (item.Checked) - { - item.Checked = false; - listProcessRemoveHeader(item.Name); - } - else - { - item.Checked = true; - int index = listProcessGetHeaderMenuDefIndex(item.Name); - if (index < 1) index = 1; - listProcessInsertHeader(item.Name, listProcessTryGetHeaderDefaultWidth(item.Name), index); - } - listProcessGetAllHeaderIndexs(item.Name); - } - - int nameindex = 0; - int companyindex = 0; - public int stateindex = 0; - int pidindex = 0; - int cpuindex = 0; - int ramindex = 0; - int diskindex = 0; - int netindex = 0; - int pathindex = 0; - int cmdindex = 0; - int eprocessindex = 0; - int typeindex = 0; - #endregion - - #endregion - - #region ProcessDetalsListWork - - //è¯¦ç»†ä¿¡æ¯ é¡µé¢ä»£ç  - - private IntPtr processMonitorDetals = IntPtr.Zero; - - private List loadedDetalProcess = new List(); - private class ProcessDetalItem - { - public ProcessDetalItem() - { - - } - public IntPtr handle; - public uint pid; - public uint ppid; - public string exename; - public string eprocess; - public string exepath; - public IntPtr processItem = IntPtr.Zero; - public ProcessDetalItem parent = null; - public ListViewItem item = null; - public List childs = new List(); - } - - public bool nextUpdateStaticVals = false; - - //Find iten - private bool ProcessListDetailsIsProcessLoaded(uint pid, out ProcessDetalItem item) - { - bool rs = false; - foreach (ProcessDetalItem f in loadedDetalProcess) - { - if (f.pid == pid) - { - item = f; - rs = true; - return rs; - } - } - item = null; - return rs; - } - private ProcessDetalItem ProcessListDetailsFindPsItem(uint pid) - { - ProcessDetalItem rs = null; - foreach (ProcessDetalItem i in loadedDetalProcess) - { - if (i.pid == pid) - { - rs = i; - return rs; - } - } - return rs; - } - - private void ProcessListDetailsInit() - { - if (!processListDetailsInited) - { - //if (!processListInited) ProcessListInit(); - - listViewItemComparerProcDetals = new ListViewItemComparerProcDetals(); - - ProcessNewItemCallBackDetails = ProcessListDetailsNewItemCallBack; - ProcessRemoveItemCallBackDetails = ProcessListDetailsRemoveItemCallBack; - - ptrProcessNewItemCallBackDetails = Marshal.GetFunctionPointerForDelegate(ProcessNewItemCallBackDetails); - ptrProcessRemoveItemCallBackDetails = Marshal.GetFunctionPointerForDelegate(ProcessRemoveItemCallBackDetails); - - processMonitorDetals = MProcessMonitor.CreateProcessMonitor(ptrProcessRemoveItemCallBackDetails, ptrProcessNewItemCallBackDetails, Nullptr); - - MAppWorkCall3(160, listProcessDetals.Handle); - MAppWorkCall3(182, listProcessDetals.Handle); - listProcessDetals.ListViewItemSorter = listViewItemComparerProcDetals; - ComCtlApi.MListViewProcListWndProc(listProcessDetals.Handle); - - if (systemRootPath == "") systemRootPath = Marshal.PtrToStringUni(MAppWorkCall4(95, Nullptr, Nullptr)); - if (csrssPath == "") csrssPath = Marshal.PtrToStringUni(MAppWorkCall4(96, Nullptr, Nullptr)); - if (ntoskrnlPath == "") ntoskrnlPath = Marshal.PtrToStringUni(MAppWorkCall4(97, Nullptr, Nullptr)); - - ProcessListDetailsLoadColumns(); - ProcessListDetailsILoadAllItem(); - - processListDetailsInited = true; - } - } - private void ProcessListDetailsUnInit() - { - if (processListDetailsInited) - { - ProcessListDetailsSaveColumns(); - ProcessDetalsListFreeAll(); - - MProcessMonitor.DestroyProcessMonitor(processMonitorDetals); - processListDetailsInited = false; - } - } - - //CallBacks - private void ProcessListDetailsRemoveItemCallBack(uint pid) - { - ProcessDetalItem oldps = ProcessListDetailsFindPsItem(pid); - if (oldps != null) ProcessListDetailsFree(oldps); - else Log("ProcessListDetailsRemoveItemCallBack for a not found item : pid " + pid); - } - private void ProcessListDetailsNewItemCallBack(uint pid, uint parentid, string exename, string exefullpath, IntPtr hProcess, IntPtr processItem) - { - if (!isRunAsAdmin && string.IsNullOrEmpty(exefullpath) && pid != 0 && pid != 2 && pid != 4 && pid != 88) - return; - ProcessListDetailsLoad(pid, parentid, exename, exefullpath, hProcess, processItem); - } - - - //Add item - private void ProcessListDetailsLoad(uint pid, uint ppid, string exename, string exefullpath, IntPtr hprocess, IntPtr processItem) - { - //base - ProcessDetalItem p = new ProcessDetalItem(); - - p.pid = pid; - p.ppid = ppid; - loadedDetalProcess.Add(p); - - ProcessDetalItem parentpsItem = null; - if (ProcessListDetailsIsProcessLoaded(p.ppid, out parentpsItem)) - { - p.parent = parentpsItem; - parentpsItem.childs.Add(p); - } - - if (pid == 0) - exename = str_idle_process; - else if (pid == 2) - exename = str_system_interrupts; - else if (pid == 4 || exename == "Registry" || exename == "Memory Compression") - exefullpath = ntoskrnlPath; - else if (pid < 800 && ppid < 500 && exename == "csrss.exe") - exefullpath = csrssPath; - - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.Append(exefullpath); - - PEOCESSKINFO infoStruct = new PEOCESSKINFO(); - if (canUseKernel) - { - if (MGetProcessEprocess(pid, ref infoStruct)) - { - p.eprocess = infoStruct.Eprocess; - - if (string.IsNullOrEmpty(exefullpath)) - { - exefullpath = infoStruct.ImageFullName; - stringBuilder.Append(exefullpath); - } - } - } - - ListViewItem li = new ListViewItem(); - - p.item = li; - p.processItem = processItem; - p.handle = hprocess; - p.exename = exename; - p.exepath = stringBuilder.ToString(); - - //icon - li.ImageKey = ProcessListDetailsGetIcon(p.exepath); - li.Tag = p; - - //16 empty item - for (int i = 0; i < 16; i++) li.SubItems.Add(new ListViewItem.ListViewSubItem()); - - - - //static items - ProcessListDetailsUpdateStaticItems(pid, li, p); - - ProcessListDetailsUpdate(pid, true, li); - - listProcessDetals.Items.Add(li); - } - - //Update dyamic data - private void ProcessListDetailsUpdateStaticItems(uint pid, ListViewItem li, ProcessDetalItem p) - { - //static items - if (colNameIndex != -1 && string.IsNullOrEmpty(li.SubItems[colNameIndex].Text)) li.SubItems[colNameIndex].Text = p.exename; - if (colPathIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPathIndex].Text)) li.SubItems[colPathIndex].Text = p.exepath; - if (colPIDIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPIDIndex].Text)) - { - if (pid == 2) - li.SubItems[colPIDIndex].Text = "-"; - else li.SubItems[colPIDIndex].Text = pid.ToString(); - } - if (colPPIDIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPPIDIndex].Text)) li.SubItems[colPPIDIndex].Text = p.ppid.ToString(); - if (colDescriptionIndex != -1 && string.IsNullOrEmpty(li.SubItems[colDescriptionIndex].Text)) - { - if (pid == 0) - li.SubItems[colDescriptionIndex].Text = str_IdleProcessDsb; - else if (pid == 2) - li.SubItems[colDescriptionIndex].Text = str_InterruptsProcessDsb; - else if (p.exepath != "") - { - StringBuilder stringBuilderDescription = new StringBuilder(260); - if (MGetExeDescribe(p.exepath, stringBuilderDescription, 260)) - li.SubItems[colDescriptionIndex].Text = stringBuilderDescription.ToString(); - } - } - - if (pid == 2) - goto JUMPADD; - - if (colEprocessIndex != -1 && string.IsNullOrEmpty(li.SubItems[colEprocessIndex].Text)) - li.SubItems[colEprocessIndex].Text = p.eprocess; - if (colCommandLineIndex != -1 && string.IsNullOrEmpty(li.SubItems[colCommandLineIndex].Text)) - { - StringBuilder stringBuilderCommandLine = new StringBuilder(512); - if (p.handle != IntPtr.Zero && MGetProcessCommandLine(p.handle, stringBuilderCommandLine, 512, pid)) - li.SubItems[colCommandLineIndex].Text = stringBuilderCommandLine.ToString(); - } - if (is64OS && colPlatformIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPlatformIndex].Text)) - { - if (MGetProcessIs32Bit(p.handle)) - li.SubItems[colCommandLineIndex].Text = str_proc_32; - else li.SubItems[colCommandLineIndex].Text = str_proc_64; - } - - if (colUserNameIndex != -1 && p.handle != IntPtr.Zero && string.IsNullOrEmpty(li.SubItems[colUserNameIndex].Text)) - { - StringBuilder stringBuilderUserName = new StringBuilder(260); - if (MGetProcessUserName(p.handle, stringBuilderUserName, 260)) - li.SubItems[colUserNameIndex].Text = stringBuilderUserName.ToString(); - } - if (colSessionIDIndex != -1 && string.IsNullOrEmpty(li.SubItems[colSessionIDIndex].Text)) - li.SubItems[colSessionIDIndex].Text = MGetProcessSessionID(p.processItem).ToString(); - JUMPADD: - return; - } - private void ProcessListDetailsUpdate(uint pid, bool isload, ListViewItem it, int ipdateOneDataCloum = -1, bool forceProcessHost = false) - { - ProcessDetalItem p = it.Tag as ProcessDetalItem; - if (colCPUIndex != -1 && colCPUIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CPU(it, p); - if (colCycleIndex != -1 && colCycleIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_Cycle(it, p); - if (p.pid == 2) return; - if (colWorkingSetPrivateIndex != -1 && colWorkingSetPrivateIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSetPrivate(it, p); - if (colWorkingSetIndex != -1 && colWorkingSetIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSet(it, p); - if (colWorkingSetShareIndex != -1 && colWorkingSetShareIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSetShare(it, p); - if (colPeakWorkingSetIndex != -1 && colPeakWorkingSetIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PeakWorkingSet(it, p); - if (colNonPagedPoolIndex != -1 && colNonPagedPoolIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_NonPagedPool(it, p); - if (colPagedPoolIndex != -1 && colPagedPoolIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PagedPool(it, p); - if (colCommitedSizeIndex != -1 && colCommitedSizeIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CommitedSize(it, p); - if (colPageErrorIndex != -1 && colPageErrorIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PageFault(it, p); - if (colHandleCountIndex != -1 && colHandleCountIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_HandleCount(it, p); - if (colThreadCountIndex != -1 && colThreadCountIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_ThreadsCount(it, p); - if (colIOReadIndex != -1 && colIOReadIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IORead(it, p); - if (colIOWriteIndex != -1 && colIOWriteIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOWrite(it, p); - if (colIOOtherIndex != -1 && colIOOtherIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOOther(it, p); - if (colIOReadBytesIndex != -1 && colIOReadBytesIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOReadBytes(it, p); - if (colIOWriteBytesIndex != -1 && colIOWriteBytesIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOWriteBytes(it, p); - if (colIOOtherBytesIndex != -1 && colIOOtherBytesIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOOtherBytes(it, p); - if (colCPUTimeIndex != -1 && colCPUTimeIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CPUTime(it, p); - if (colStateIndex != -1 && colStateIndex != ipdateOneDataCloum) - ProcessListDetails_Update_State(it, p); - if (colGDIObjectIndex != -1 && colGDIObjectIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_GdiHandleCount(it, p); - if (colUserObjectIndex != -1 && colUserObjectIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_UserHandleCount(it, p); - if (colWorkingSetIncreasementIndex != -1 && colWorkingSetIncreasementIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSetIncreasement(it, p); - if (colPageErrorIncreasementIndex != -1 && colPageErrorIncreasementIndex != ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PageFaultIncreasement(it, p); - } - //update a column be use to sort - private void ProcessListDetailsUpdateOnePerfCloum(uint pid, ListViewItem it, int ipdateOneDataCloum, bool forceProcessHost = false) - { - ProcessDetalItem p = it.Tag as ProcessDetalItem; - if (p.pid == 2) - { - if (colCPUIndex != -1 && colCPUIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CPU(it, p); - else if (colCycleIndex != -1 && colCycleIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_Cycle(it, p); - return; - } - if (colCPUIndex != -1 && colCPUIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CPU(it, p); - else if (colWorkingSetPrivateIndex != -1 && colWorkingSetPrivateIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSetPrivate(it, p); - else if (colWorkingSetIndex != -1 && colWorkingSetIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSet(it, p); - else if (colWorkingSetShareIndex != -1 && colWorkingSetShareIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSetShare(it, p); - else if (colPeakWorkingSetIndex != -1 && colPeakWorkingSetIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PeakWorkingSet(it, p); - else if (colNonPagedPoolIndex != -1 && colNonPagedPoolIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_NonPagedPool(it, p); - else if (colPagedPoolIndex != -1 && colPagedPoolIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PagedPool(it, p); - else if (colCommitedSizeIndex != -1 && colCommitedSizeIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CommitedSize(it, p); - else if (colPageErrorIndex != -1 && colPageErrorIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PageFault(it, p); - else if (colHandleCountIndex != -1 && colHandleCountIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_HandleCount(it, p); - else if (colThreadCountIndex != -1 && colThreadCountIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_ThreadsCount(it, p); - else if (colIOReadIndex != -1 && colIOReadIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IORead(it, p); - else if (colIOWriteIndex != -1 && colIOWriteIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOWrite(it, p); - else if (colIOOtherIndex != -1 && colIOOtherIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOOther(it, p); - else if (colIOReadBytesIndex != -1 && colIOReadBytesIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOReadBytes(it, p); - else if (colIOWriteBytesIndex != -1 && colIOWriteBytesIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOWriteBytes(it, p); - else if (colIOOtherBytesIndex != -1 && colIOOtherBytesIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_IOOtherBytes(it, p); - else if (colCPUTimeIndex != -1 && colCPUTimeIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_CPUTime(it, p); - else if (colCycleIndex != -1 && colCycleIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_Cycle(it, p); - else if (colStateIndex != -1 && colStateIndex == ipdateOneDataCloum) - ProcessListDetails_Update_State(it, p); - else if (colGDIObjectIndex != -1 && colGDIObjectIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_GdiHandleCount(it, p); - else if (colUserObjectIndex != -1 && colUserObjectIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_UserHandleCount(it, p); - else if (colWorkingSetIncreasementIndex != -1 && colWorkingSetIncreasementIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_WorkingSetIncreasement(it, p); - else if (colPageErrorIncreasementIndex != -1 && colPageErrorIncreasementIndex == ipdateOneDataCloum) - ProcessListDetails_Perf_Update_PageFaultIncreasement(it, p); - } - private void ProcessListDetailsUpdateValues(int refeshAllDataColum, bool updateStaticItems=false) - { - //update process perf data - foreach (ListViewItem it in listProcessDetals.Items) - { - if (updateStaticItems) - ProcessListDetailsUpdateStaticItems(((ProcessDetalItem)it.Tag).pid, it, (ProcessDetalItem)it.Tag); - if (refeshAllDataColum != -1) - ProcessListDetailsUpdateOnePerfCloum(((ProcessDetalItem)it.Tag).pid, it, refeshAllDataColum); - } - if (updateStaticItems) - { - - foreach (ColumnHeader c in listProcessDetals.Columns) - { - itemheaderTag t = ((itemheaderTag)c.Tag); - if (t.needAutoSize) - { - listProcessDetals.AutoResizeColumn(c.Index, ColumnHeaderAutoResizeStyle.ColumnContent); - t.needAutoSize = false; - } - } - } - if (listProcessDetals.Items.Count == 0) return; - int start = listProcessDetals.Items.IndexOf(listProcessDetals.TopItem), end = listProcessDetals.Items.Count; - ListViewItem liThis = null; - for (int i = start; i < end; i++) - { - liThis = listProcessDetals.Items[i]; - if (liThis.Position.Y < listProcessDetals.Height) - ProcessListDetailsUpdate(((ProcessDetalItem)liThis.Tag).pid, false, liThis, refeshAllDataColum); - else break; - } - } - - //All perf data - private void ProcessListDetails_Perf_Update_CPU(ListViewItem it, ProcessDetalItem p) - { - double data = MProcessPerformanctMonitor.GetProcessCpuUseAge(p.processItem); - it.SubItems[colCPUIndex].Text = data.ToString("00.0"); - it.SubItems[colCPUIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_CPUTime(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessCpuTime(p.processItem); - TimeSpan time = TimeSpan.FromMilliseconds(Convert.ToDouble(data)); - it.SubItems[colCPUTimeIndex].Text = time.Hours + ":" + time.Minutes + ":" + time.Seconds; - it.SubItems[colCPUTimeIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_Cycle(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessCycle(p.processItem); - it.SubItems[colCycleIndex].Text = data.ToString(); - it.SubItems[colCycleIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_WorkingSetPrivate(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSETPRIVATE); - it.SubItems[colWorkingSetPrivateIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colWorkingSetPrivateIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_WorkingSetShare(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSETSHARE); - it.SubItems[colWorkingSetShareIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colWorkingSetShareIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_WorkingSet(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSET); - it.SubItems[colWorkingSetIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colWorkingSetIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_WorkingSetIncreasement(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSET_INC); - it.SubItems[colWorkingSetIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colWorkingSetIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_PeakWorkingSet(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PEAKWORKINGSET); - it.SubItems[colPeakWorkingSetIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colPeakWorkingSetIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_NonPagedPool(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_NONPAGEDPOOL); - it.SubItems[colNonPagedPoolIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colNonPagedPoolIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_PagedPool(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PAGEDPOOL); - it.SubItems[colPagedPoolIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colPagedPoolIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_CommitedSize(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_COMMITEDSIZE); - it.SubItems[colCommitedSizeIndex].Text = FormatFileSizeMenSingal(data); - it.SubItems[colCommitedSizeIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_PageFault(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PAGEDFAULT); - it.SubItems[colPageErrorIndex].Text = data.ToString(); - it.SubItems[colPageErrorIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_PageFaultIncreasement(ListViewItem it, ProcessDetalItem p) - { - uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PAGEDFAULT_INC); - it.SubItems[colPageErrorIndex].Text = data.ToString(); - it.SubItems[colPageErrorIndex].Tag = data; - } - - private void ProcessListDetails_Perf_Update_HandleCount(ListViewItem it, ProcessDetalItem p) - { - uint data = MGetProcessHandlesCount(p.processItem); - it.SubItems[colHandleCountIndex].Text = data.ToString(); - it.SubItems[colHandleCountIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_ThreadsCount(ListViewItem it, ProcessDetalItem p) - { - uint data = MGetProcessThreadsCount(p.processItem); - it.SubItems[colThreadCountIndex].Text = data.ToString(); - it.SubItems[colThreadCountIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_GdiHandleCount(ListViewItem it, ProcessDetalItem p) - { - uint data = MGetProcessGdiHandleCount(p.handle); - it.SubItems[colGDIObjectIndex].Text = data.ToString(); - it.SubItems[colGDIObjectIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_UserHandleCount(ListViewItem it, ProcessDetalItem p) - { - uint data = MGetProcessUserHandleCount(p.handle); - it.SubItems[colUserObjectIndex].Text = data.ToString(); - it.SubItems[colUserObjectIndex].Tag = data; - } - - private void ProcessListDetails_Perf_Update_IORead(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_READ); - it.SubItems[colIOReadIndex].Text = data.ToString(); - it.SubItems[colIOReadIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_IOWrite(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_WRITE); - it.SubItems[colIOWriteIndex].Text = data.ToString(); - it.SubItems[colIOWriteIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_IOOther(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_OTHER); - it.SubItems[colIOOtherIndex].Text = data.ToString(); - it.SubItems[colIOOtherIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_IOReadBytes(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_READ_BYTES); - it.SubItems[colIOReadBytesIndex].Text = data.ToString(); - it.SubItems[colIOReadBytesIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_IOWriteBytes(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_WRITE_BYTES); - it.SubItems[colIOWriteBytesIndex].Text = data.ToString(); - it.SubItems[colIOWriteBytesIndex].Tag = data; - } - private void ProcessListDetails_Perf_Update_IOOtherBytes(ListViewItem it, ProcessDetalItem p) - { - UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_OTHER_BYTES); - it.SubItems[colIOOtherBytesIndex].Text = data.ToString(); - it.SubItems[colIOOtherBytesIndex].Tag = data; - } - - private void ProcessListDetails_Update_State(ListViewItem it, ProcessDetalItem p) - { - int i = MGetProcessState(p.processItem, IntPtr.Zero); - if (i == 1) - { - it.SubItems[colStateIndex].Text = ""; - /*if (p.isSvchost == false && it.Childs.Count > 0) - { - bool hung = false; - foreach (TaskMgrListItem c in it.Childs) - if (c.Type == TaskMgrListItemType.ItemWindow) - if (IsHungAppWindow((IntPtr)c.Tag)) - { - hung = true; - break; - } - if (hung) - { - it.SubItems[colStateIndex].Text = str_status_hung; - it.SubItems[colStateIndex].ForeColor = Color.FromArgb(219, 107, 58); - } - }*/ - } - else if (i == 2) - { - it.SubItems[colStateIndex].Text = str_status_paused; - it.SubItems[colStateIndex].ForeColor = Color.FromArgb(22, 158, 250); - } - } - - - //Full load - private void ProcessListDetailsILoadAllItem() - { - ComCtlApi.MListViewProcListLock(true); - MProcessMonitor.EnumAllProcess(processMonitorDetals); - ComCtlApi.MListViewProcListLock(false); - listProcessDetals.Invalidate(); - } - - //Refesh - private void ProcessListDetailsRefesh() - { - ComCtlApi.MListViewProcListLock(true); - - //åˆ·æ–°æ‰€æœ‰æ•°æ® - MProcessMonitor.RefeshAllProcess(processMonitorDetals); - //åˆ·æ–°æ€§èƒ½æ•°æ® - bool refeshAColumData = ProcessListDetailsIsDyamicDataColumn(listViewItemComparerProcDetals.SortColumn); - ProcessListDetailsUpdateValues(refeshAColumData ? listViewItemComparerProcDetals.SortColumn : -1, nextUpdateStaticVals); - ProcessListRefeshPidTree(); - - nextUpdateStaticVals = false; - - listProcessDetals.Sort(); - ComCtlApi.MListViewProcListLock(false); - listProcessDetals.Invalidate(); - } - private void ProcessListDetailsFree(ProcessDetalItem it, bool delitem = true) - { - //remove invalid item - //MAppWorkCall3(174, IntPtr.Zero, new IntPtr(it.pid)); - - it.childs.Clear(); - if (it.parent != null && it.parent.childs.Contains(it)) - it.parent.childs.Remove(it); - it.parent = null; - loadedDetalProcess.Remove(it); - if (delitem) listProcessDetals.Items.Remove(it.item); - } - private void ProcessDetalsListFreeAll() - { - listProcessDetals.Items.Clear(); - //the exit clear - for (int i = 0; i < loadedDetalProcess.Count; i++) - ProcessListDetailsFree(loadedDetalProcess[i], false); - loadedDetalProcess.Clear(); - } - - //Ico - private string ProcessListDetailsGetIcon(string exepath) - { - if (exepath == "") exepath = "Default"; - if (!imageListProcessDetalsIcons.Images.ContainsKey(exepath)) - { - IntPtr intPtr = MGetExeIcon(exepath == "Default" ? null : exepath); - if (intPtr != IntPtr.Zero) - imageListProcessDetalsIcons.Images.Add(exepath, Icon.FromHandle(intPtr)); - } - return exepath; - } - - //Events - private void listProcessDetals_MouseClick(object sender, MouseEventArgs e) - { - if (listProcessDetals.SelectedItems.Count == 0) return; - ProcessDetalItem ps = listProcessDetals.SelectedItems[0].Tag as ProcessDetalItem; - if (e.Button == MouseButtons.Left) - { - if (ps.pid > 4) - { - btnEndProcess.Enabled = true; - MAppWorkShowMenuProcessPrepare(ps.exepath, ps.exename, ps.pid, IsImporant(ps), IsVeryImporant(ps)); - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; - } - else btnEndProcessDetals.Enabled = false; - } - else if (e.Button == MouseButtons.Right) - { - nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; - MAppWorkShowMenuProcessPrepare(ps.exepath, ps.exename, ps.pid, IsImporant(ps), IsVeryImporant(ps)); - MAppWorkShowMenuProcess(ps.exepath, ps.exename, ps.pid, Handle, IntPtr.Zero, 0, nextSecType, MousePosition.X, MousePosition.Y); - } - } - private void listProcessDetals_SelectedIndexChanged(object sender, EventArgs e) - { - btnEndProcessDetals.Enabled = listProcessDetals.SelectedItems.Count != 0; - } - private void listProcessDetals_KeyDown(object sender, KeyEventArgs e) - { - if (listProcessDetals.SelectedItems.Count > 0) - { - if (e.KeyCode == Keys.Apps) - { - ListViewItem item = listProcessDetals.SelectedItems[0]; - Point p = item.Position; p.X = 0; - p = listProcessDetals.PointToScreen(p); - ProcessDetalItem ps = item.Tag as ProcessDetalItem; - MAppWorkShowMenuProcess(ps.exepath, ps.exename, ps.pid, Handle, IntPtr.Zero, 0, nextSecType, p.X, p.Y); - } - else if (e.KeyCode == Keys.Delete) - { - ListViewItem item = listProcessDetals.SelectedItems[0]; - ProcessDetalItem ps = item.Tag as ProcessDetalItem; - MAppWorkShowMenuProcessPrepare(ps.exepath, ps.exename, ps.pid, IsImporant(ps), IsVeryImporant(ps)); - MAppWorkCall3(178, Handle, IntPtr.Zero); - } - } - } - - private void btnEndProcessDetals_Click(object sender, EventArgs e) - { - if (listProcessDetals.SelectedItems.Count == 0) return; - MAppWorkCall3(178, Handle, IntPtr.Zero); - } - - #region Columns - - private int colLastDown = -1; - - private int colEprocessIndex = -1;//ok - private int colUserNameIndex = -1;//ok - private int colNameIndex = -1;//ok - private int colPackageNameIndex = -1;//n - private int colPIDIndex = -1;//ok - private int colPPIDIndex = -1;//ok - private int colStateIndex = -1;//ok - private int colSessionIDIndex = -1;//ok - private int colJobIDIndex = -1; - private int colCPUIndex = -1;//ok - private int colCPUTimeIndex = -1;//ok - private int colCycleIndex = -1;//ok - private int colPeakWorkingSetIndex = -1;//ok - private int colWorkingSetIncreasementIndex = -1;//ok - private int colWorkingSetIndex = -1;//ok - private int colWorkingSetPrivateIndex = -1;//ok - private int colWorkingSetShareIndex = -1;//ok - private int colCommitedSizeIndex = -1;//ok - private int colPagedPoolIndex = -1;//ok - private int colNonPagedPoolIndex = -1;//ok - private int colPageErrorIndex = -1;//ok - private int colPageErrorIncreasementIndex = -1;//ok - private int colHandleCountIndex = -1;//ok - private int colThreadCountIndex = -1;//ok - private int colUserObjectIndex = -1;//ok - private int colGDIObjectIndex = -1;//ok - private int colIOReadIndex = -1;//ok - private int colIOWriteIndex = -1;//ok - private int colIOOtherIndex = -1;//ok - private int colIOReadBytesIndex = -1;//ok - private int colIOWriteBytesIndex = -1;//ok - private int colIOOtherBytesIndex = -1;//ok - private int colPathIndex = -1;//ok - private int colCommandLineIndex = -1;//ok - private int colPlatformIndex = -1;//ok - private int colOSContextIndex = -1; - private int colDescriptionIndex = -1;//ok - private int colDepIndex = -1; - private int colUACVIndex = -1; - - private IntPtr hListHeader = IntPtr.Zero; - private ToolTip colsTip = new ToolTip(); - - public string[] allCols = new string[] - { - "TitlePID","TitlePackageName","TitleStatus","TitleSessionID","TitleJobID","TitleParentPID","TitleCycle", - "TitleCPU","TitleCPUTime","TitlePeakWorkingSet","TitleWorkingSetCrease", - "TitleWorkingSet","TitleWorkingSetPrivate","TitleWorkingSetShare","TitleCommited", - "TitlePagedPool","TitleNonPagedPool","TitlePagedError","TitlePagedErrorCrease","TitleHandleCount", - "TitleThreadCount","TitleUserObject","TitleGdiObject","TitleIORead","TitleIOWrite","TitleIOOther", - "TitleIOReadBytes","TitleIOWriteBytes","TitleIOOtherBytes","TitleProcPath","TitleCmdLine","TitleEProcess", - "TitlePlatform","TitleOperationSystemContext","TitleDescription","TitleDEP","TitleUACVirtualization","TitleProcName" - }; - public string[] numberCols = new string[] - { - "TitlePID","TitleSessionID","TitleJobID","TitleParentPID","TitleCycle", - "TitleCPU","TitlePeakWorkingSet","TitleWorkingSetCrease", - "TitleWorkingSet","TitleWorkingSetPrivate","TitleWorkingSetShare","TitleCommited", - "TitlePagedPool","TitleNonPagedPool","TitlePagedError","TitlePagedErrorCrease","TitleHandleCount", - "TitleThreadCount","TitleUserObject","TitleGdiObject","TitleIORead","TitleIOWrite","TitleIOOther", - "TitleIOReadBytes","TitleIOWriteBytes","TitleIOOtherBytes" - }; - - private itemheaderTip[] detailsHeaderTips = new itemheaderTip[]{ - new itemheaderTip("TitleCPU", "TipCPU"), - new itemheaderTip("TitlePID", "TipPID"), - new itemheaderTip("TitleStatus", "TipStatus"), - new itemheaderTip("TitleJobID", "TipJobID"), - new itemheaderTip("TitleWorkingSetPrivate", "TipPrivateWorkingSet"), - new itemheaderTip("TitleCPUTime", "TipCPUTime"), - new itemheaderTip("TitleCycle", "TipCycle"), - new itemheaderTip("TitleCommited", "TipCommitedSize"), - new itemheaderTip("TitlePagedPool", "TipPagedSize"), - new itemheaderTip("TitleNonPagedPool", "TipNonPagedSize"), - new itemheaderTip("TitlePagedError", "TipPageErr"), - new itemheaderTip("TitleHandleCount", "TipHandleCount"), - new itemheaderTip("TitleThreadCount", "TipThredCount"), - new itemheaderTip("TitleCmdLine", "TipCmdLine"), - new itemheaderTip("TitleUserObject", "TipUserObject"), - new itemheaderTip("TitleGdiObject", "TipGDIObject"), - new itemheaderTip("TitlePlatform", "TipPlatform"), - new itemheaderTip("TitleWorkingSet", "TipWorkingSet"), - new itemheaderTip("TitleWorkingSetShare", "TipShareWorkingSet"), - new itemheaderTip("TitleIOOther", "TipIOOther"), - new itemheaderTip("TitleIOOtherBytes", "TipIOOtherBytes"), - new itemheaderTip("TitleIORead", "TipIORead"), - new itemheaderTip("TitleIOReadBytes", "TipIOReadBytes"), - new itemheaderTip("TitleIOWrite", "TipIOWrite"), - new itemheaderTip("TitleIOWriteBytes", "TipIOWriteBytes"), - }; - private class itemheaderTag - { - public string tip; - public bool needAutoSize; - } - - public string ProcessListDetailsGetHeaderTip(string name) - { - foreach (itemheaderTip t in detailsHeaderTips) - { - if (t.herdername == name) - return LanuageMgr.GetStr(t.name); - } - return null; - } - public void ProcessListDetailsAddHeader(string name, int width = -1) - { - itemheaderTag t = new itemheaderTag(); - ColumnHeader li = new ColumnHeader(); - li.Name = name; - li.Text = LanuageMgr.GetStr(name); - if (width == -1) - { - t.needAutoSize = true; - width = 100; - } - else t.needAutoSize = false; - li.Width = width; - string tip = ProcessListDetailsGetHeaderTip(name); - if (ProcessListDetailsIsMumberColumn(name)) - li.TextAlign = HorizontalAlignment.Right; - listProcessDetals.Columns.Add(li); - - if (tip != null) t.tip = tip; - - li.Tag = t; - } - public int ProcessListDetailsGetListIndex(string name) - { - int rs = -1; - ColumnHeader c = ProcessListDetailsFindHeader(name); - if (c != null) - rs = listProcessDetals.Columns.IndexOf(c); - return rs; - } - public ColumnHeader ProcessListDetailsFindHeader(string name) - { - ColumnHeader rs = null; - foreach (ColumnHeader c in listProcessDetals.Columns) - if (c.Name == name) - { - rs = c; - break; - } - return rs; - } - public void ProcessListDetailsRemoveHeader(string name) - { - ColumnHeader li = ProcessListDetailsFindHeader(name); - if (li != null) listProcessDetals.Columns.Remove(li); - } - - private bool ProcessListDetailsIsDyamicDataColumn(int index) - { - if (index != -1) - { - if (index == colCPUIndex || index == colCPUTimeIndex || index == colCycleIndex - || index == colPeakWorkingSetIndex || index == colWorkingSetIncreasementIndex || index == colWorkingSetIndex - || index == colWorkingSetPrivateIndex || index == colWorkingSetShareIndex || index == colCommitedSizeIndex - || index == colPagedPoolIndex || index == colHandleCountIndex - || index == colNonPagedPoolIndex || index == colPageErrorIndex || index == colPageErrorIncreasementIndex - || index == colThreadCountIndex || index == colGDIObjectIndex || index == colUserObjectIndex - || index == colIOOtherBytesIndex || index == colIOWriteBytesIndex || index == colIOReadBytesIndex - || index == colIOOtherIndex || index == colIOWriteIndex || index == colIOReadIndex) - return true; - } - return false; - } - private bool ProcessListDetailsIsMumberColumn(string name) - { - if (name != "") - { - foreach (string i in numberCols) - if (i == name) - return true; - } - return false; - } - public bool ProcessListDetailsIsStringColumn(int index) - { - if (index != -1) - { - if (index == colNameIndex || index == colPackageNameIndex || index == colStateIndex - || index == colCPUTimeIndex || index == colPathIndex || index == colCommandLineIndex - || index == colPlatformIndex || index == colOSContextIndex || index == colDescriptionIndex - || index == colDepIndex || index == colUACVIndex || index == colUserNameIndex) - return true; - } - return false; - } - public void ProcessListDetailsGetColumnsIndex() - { - //加载所有列表头的åºå· - colPPIDIndex = ProcessListDetailsGetListIndex("TitleParentPID"); - colPIDIndex = ProcessListDetailsGetListIndex("TitlePID"); - colPackageNameIndex = ProcessListDetailsGetListIndex("TitlePackageName"); - colStateIndex = ProcessListDetailsGetListIndex("TitleStatus"); - colSessionIDIndex = ProcessListDetailsGetListIndex("TitleSessionID"); - colJobIDIndex = ProcessListDetailsGetListIndex("TitleJobID"); - colCPUIndex = ProcessListDetailsGetListIndex("TitleCPU"); - colCPUTimeIndex = ProcessListDetailsGetListIndex("TitleCPUTime"); - colCycleIndex = ProcessListDetailsGetListIndex("TitleCycle"); - colPeakWorkingSetIndex = ProcessListDetailsGetListIndex("TitlePeakWorkingSet"); - colWorkingSetIncreasementIndex = ProcessListDetailsGetListIndex("TitleWorkingSetCrease"); - colWorkingSetIndex = ProcessListDetailsGetListIndex("TitleWorkingSet"); - colWorkingSetPrivateIndex = ProcessListDetailsGetListIndex("TitleWorkingSetPrivate"); - colWorkingSetShareIndex = ProcessListDetailsGetListIndex("TitleWorkingSetShare"); - colCommitedSizeIndex = ProcessListDetailsGetListIndex("TitleCommited"); - colPagedPoolIndex = ProcessListDetailsGetListIndex("TitlePagedPool"); - colNonPagedPoolIndex = ProcessListDetailsGetListIndex("TitleNonPagedPool"); - colPageErrorIndex = ProcessListDetailsGetListIndex("TitlePagedError"); - colPageErrorIncreasementIndex = ProcessListDetailsGetListIndex("TitlePagedErrorCrease"); - colHandleCountIndex = ProcessListDetailsGetListIndex("TitleHandleCount"); - colThreadCountIndex = ProcessListDetailsGetListIndex("TitleThreadCount"); - colUserObjectIndex = ProcessListDetailsGetListIndex("TitleUserObject"); - colGDIObjectIndex = ProcessListDetailsGetListIndex("TitleGdiObject"); - colIOReadIndex = ProcessListDetailsGetListIndex("TitleIORead"); - colIOWriteIndex = ProcessListDetailsGetListIndex("TitleIOWrite"); - colIOOtherIndex = ProcessListDetailsGetListIndex("TitleIOOther"); - colIOReadBytesIndex = ProcessListDetailsGetListIndex("TitleIOReadBytes"); - colIOWriteBytesIndex = ProcessListDetailsGetListIndex("TitleIOWriteBytes"); - colIOOtherBytesIndex = ProcessListDetailsGetListIndex("TitleIOOtherBytes"); - colPathIndex = ProcessListDetailsGetListIndex("TitleProcPath"); - colCommandLineIndex = ProcessListDetailsGetListIndex("TitleCmdLine"); - colPlatformIndex = ProcessListDetailsGetListIndex("TitlePlatform"); - colOSContextIndex = ProcessListDetailsGetListIndex("TitleOperationSystemContext"); - colDescriptionIndex = ProcessListDetailsGetListIndex("TitleDescription"); - colDepIndex = ProcessListDetailsGetListIndex("TitleDEP"); - colUACVIndex = ProcessListDetailsGetListIndex("TitleUACVirtualization"); - colNameIndex = ProcessListDetailsGetListIndex("TitleProcName"); - colUserNameIndex = ProcessListDetailsGetListIndex("TitleUserName"); - colEprocessIndex = ProcessListDetailsGetListIndex("TitleEProcess"); - - } - private void ProcessListDetailsSaveColumns() - { - if (listProcessDetals.Columns.Count > 0) - { - string finalString = ""; - ColumnHeader currentColumn = null; - for (int i = listProcessDetals.Columns.Count - 1; i >= 0; i--) - { - currentColumn = null; - foreach (ColumnHeader li in listProcessDetals.Columns) - if (li.DisplayIndex == i) - { - currentColumn = li; - break; - } - if (currentColumn != null) - finalString = currentColumn.Name + "-" + currentColumn.Width + "#" + finalString; - } - SetConfig("DetalHeaders", "AppSetting", finalString); - SetConfig("DetalSort", "AppSetting", listViewItemComparerProcDetals.SortColumn + "#" + (listViewItemComparerProcDetals.Asdening ? "Asdening" : "Descending")); - } - } - private void ProcessListDetailsLoadColumns() - { - hListHeader = ComCtlApi.MListViewGetHeaderControl(listProcessDetals.Handle); - //加载列表头 - if (listProcessDetals.Columns.Count > 0) listProcessDetals.Columns.Clear(); - string headersStr = GetConfig("DetalHeaders", "AppSetting"); - if (headersStr == "") headersStr = "TitleProcName-190#TitlePID-55#TitleStatus-55#TitleUserName-70#TitleCPU-60#TitleWorkingSetPrivate-70#TitleDescription-400#"; - string[] headers = headersStr.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < headers.Length && i < 16; i++) - ProcessListDetailsAddColumns(headers[i]); - - ProcessListDetailsGetColumnsIndex(); - if (colNameIndex == -1) - { - ProcessListDetailsAddColumns("TitleProcName-130"); - colNameIndex = ProcessListDetailsGetListIndex("TitleProcName"); - } - - string sortInfo = GetConfig("DetalSort", "AppSetting"); - if (sortInfo.Contains("#")) - { - string[] sortInfo2 = sortInfo.Split('#'); - if (sortInfo.Length >= 2) - { - int col = 0; - int.TryParse(sortInfo2[0], out col); - if (col >= 0 && col < listProcessDetals.Columns.Count) - listViewItemComparerProcDetals.SortColumn = col; - if (sortInfo2[1] == "Asdening") listViewItemComparerProcDetals.Asdening = true; - else if (sortInfo2[1] == "Descending") listViewItemComparerProcDetals.Asdening = false; - ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, listViewItemComparerProcDetals.Asdening, false); - } - } - } - private void ProcessListDetailsAddColumns(string s) - { - string sname = s; int width = 70; - if (s.Contains("-")) - { - string[] ss = s.Split('-'); - sname = ss[0]; - if (ss.Length >= 2) - int.TryParse(ss[1], out width); - } - if (width > 1024 || width <= 0) width = 70; - if (s.Trim() != "") ProcessListDetailsAddHeader(sname, width); - } - - private void éšè—列ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (colLastDown != -1) - { - listProcessDetals.Columns.Remove(listProcessDetals.Columns[colLastDown]); - colLastDown = -1; - ProcessListDetailsGetColumnsIndex(); - } - } - private void 选择列ToolStripMenuItem_Click(object sender, EventArgs e) - { - new FormDetalsistHeaders().ShowDialog(); - } - private void 将此列调整为åˆé€‚大å°ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (colLastDown != -1) - listProcessDetals.AutoResizeColumn(colLastDown, ColumnHeaderAutoResizeStyle.ColumnContent); - } - - private int listProcessDetals_lastEnterColumn = -1; - private void listProcessDetals_ColumnClick(object sender, ColumnClickEventArgs e) - { - colLastDown = e.Column; - if (listViewItemComparerProcDetals.SortColumn != e.Column) - { - ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, false, true); - listViewItemComparerProcDetals.SortColumn = e.Column; - listViewItemComparerProcDetals.Asdening = true; - ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, - listViewItemComparerProcDetals.Asdening, false); - } - else - { - listViewItemComparerProcDetals.Asdening = !listViewItemComparerProcDetals.Asdening; - ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, - listViewItemComparerProcDetals.Asdening, false); - } - listProcessDetals.Sort(); - } - private void listProcessDetals_ColumnMouseMove(object sender, int index, Point p) - { - if (index > 0 && index < listProcessDetals.Columns.Count) - { - if (index != listProcessDetals_lastEnterColumn) - { - listProcessDetals_lastEnterColumn = index; - ColumnHeader col = listProcessDetals.Columns[index]; - if (col.Tag != null) - { - colsTip.Show(((itemheaderTag)col.Tag).tip, listProcessDetals, p.X, p.Y + 3, 5000); - } - else - { - listProcessDetals_lastEnterColumn = -1; - colsTip.Hide(listProcessDetals); - } - } - } - else - { - listProcessDetals_lastEnterColumn = -1; - colsTip.Hide(listProcessDetals); - } - } - private void listProcessDetals_ColumnReordered(object sender, ColumnReorderedEventArgs e) - { - nextUpdateStaticVals = true; - } - - private ListViewItemComparerProcDetals listViewItemComparerProcDetals = null; - private class ListViewItemComparerProcDetals : IComparer - { - public ListViewItemComparerProcDetals() - { - formMain = FormMain.Instance; - } - - private FormMain formMain; - private int col; - private bool asdening = false; - - public int SortColumn { get { return col; } set { col = value; } } - public bool Asdening { get { return asdening; } set { asdening = value; } } - - public int Compare(object o1, object o2) - { - ListViewItem x = o1 as ListViewItem, y = o2 as ListViewItem; - int returnVal = -1; - if (x.SubItems[col].Text == y.SubItems[col].Text) return -1; - if (formMain.ProcessListDetailsIsStringColumn(col)) - { - returnVal = String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); - } - else - { - UInt64 xi, yi; - if (UInt64.TryParse(x.SubItems[col].Text, out xi) && UInt64.TryParse(y.SubItems[col].Text, out yi)) - { - if (x.SubItems[col].Text == y.SubItems[col].Text) returnVal = 0; - else if (xi > yi) returnVal = 1; - else if (xi < yi) returnVal = -1; - } - } - if (asdening) returnVal = -returnVal; - return returnVal; - } - } - - - #endregion - - #endregion - - #region FileMgrWork - - //文件管ç†å™¨é¡µä»£ç  - - private Dictionary fileTypeNames = new Dictionary(); - private TreeNode lastClickTreeNode = null; - private string lastShowDir = ""; - private bool lastRightClicked = false; - - private void FileMgrInit() - { - if (!fileListInited) - { - fileListInited = true; - - DelingDialogInit(); - - fileMgrCallBack = FileMgrCallBack; - MFM_SetCallBack(Marshal.GetFunctionPointerForDelegate(fileMgrCallBack)); - - imageListFileMgrLeft.Images.Add("folder", Icon.FromHandle(MFM_GetFolderIcon())); - imageListFileMgrLeft.Images.Add("mycp", Icon.FromHandle(MFM_GetMyComputerIcon())); - - imageListFileTypeList.Images.Add("folder", Icon.FromHandle(MFM_GetFolderIcon())); - - MAppWorkCall3(182, treeFmLeft.Handle, IntPtr.Zero); - MAppWorkCall3(182, listFm.Handle, IntPtr.Zero); - - string smycp = Marshal.PtrToStringAuto(MFM_GetMyComputerName()); - treeFmLeft.Nodes.Add("mycp", smycp, "mycp", "mycp").Tag = "mycp"; - MFM_GetRoots(); - } - } - private IntPtr FileMgrCallBack(int msg, IntPtr lParam, IntPtr wParam) - { - switch (msg) - { - case 2: - { - string s = Marshal.PtrToStringAuto(lParam); - string path = Marshal.PtrToStringAuto(wParam); - Icon icon = Icon.FromHandle(MFM_GetFileIcon(path, null, 0)); - imageListFileMgrLeft.Images.Add(path, icon); - imageListFileTypeList.Images.Add(path, icon); - TreeNode n = treeFmLeft.Nodes[0].Nodes.Add(path, s, path, path); - n.Tag = path; - n.Nodes.Add("loading", str_loading, "loading", "loading"); - break; - } - case 3: - { - if (wParam.ToInt32() == -1) - { - lastClickTreeNode.Nodes[0].Text = str_VisitFolderFailed; - lastClickTreeNode.Nodes[0].ImageKey = "err"; - } - else - { - string s = Marshal.PtrToStringAuto(lParam); - string path = Marshal.PtrToStringAuto(wParam); - TreeNode n = lastClickTreeNode.Nodes.Add(s, s, "folder", "folder"); - if (path.EndsWith("\\")) - n.Tag = path + s; - else n.Tag = path + "\\" + s; - n.Nodes.Add("loading", str_loading, "loading", "loading"); - } - break; - } - case 5: - { - string s = Marshal.PtrToStringAuto(lParam); - string path = Marshal.PtrToStringAuto(wParam); - listFm.Items.Add(new ListViewItem(s, "folder") { Tag = path.EndsWith("\\") ? path + s : path + "\\" + s }); - break; - } - case 6: - case 26: - { - if (wParam.ToInt32() == -1) - { - listFm.Items.Clear(); - string path = Marshal.PtrToStringAuto(lParam); - listFm.Items.Add(new ListViewItem("..", "folder") { Tag = "..\\back\\" + path }); - ListViewItem lvi = listFm.Items.Add(str_VisitFolderFailed, "err"); - } - else - { - ListViewItem it = null; - WIN32_FIND_DATA data = default(WIN32_FIND_DATA); - data = (WIN32_FIND_DATA)Marshal.PtrToStructure(lParam, data.GetType()); - string s = data.cFileName; - string path = Marshal.PtrToStringAuto(wParam); - string fpath = path + "\\" + s; - fpath = fpath.Replace("\\\\", "\\"); - string fext = "*" + Path.GetExtension(fpath); - if (fext == "") fext = "*.*"; - if (fext == "*.exe") - { - if (!imageListFileTypeList.Images.ContainsKey(fpath) && MFM_FileExist(fpath)) - { - StringBuilder sb0 = new StringBuilder(260); - IntPtr h = MGetExeIcon(fpath); - if (h != IntPtr.Zero) - imageListFileTypeList.Images.Add(fpath, Icon.FromHandle(h)); - if (!fileTypeNames.ContainsKey(fpath)) - { - MGetExeDescribe(fpath, sb0, 260); - fileTypeNames.Add(fpath, sb0.ToString()); - } - sb0 = null; - } - if (msg == 26) - { - foreach (ListViewItem i in listFm.Items) - { - if (i.Tag.ToString() == fpath) - { - it = i; - break; - } - } - } - else - { - it = listFm.Items.Add(new ListViewItem(s, fpath) { Tag = fpath }); - } - string typeName = ""; - if (fileTypeNames.TryGetValue(fpath, out typeName)) - it.SubItems.Add(typeName); - else it.SubItems.Add(""); - } - else - { - if (!imageListFileTypeList.Images.ContainsKey(fext)) - { - StringBuilder sb0 = new StringBuilder(80); - imageListFileTypeList.Images.Add(fext, Icon.FromHandle(MFM_GetFileIcon(fext, sb0, 80))); - if (!fileTypeNames.ContainsKey(fext)) - fileTypeNames.Add(fext, sb0.ToString()); - else imageListFileTypeList.Images.Add(fext, Icon.FromHandle(MFM_GetFileIcon(fext, null, 0))); - sb0 = null; - } - if (msg == 26) - { - foreach (ListViewItem i in listFm.Items) - { - if (i.Tag.ToString() == fpath) - { - it = i; - break; - } - } - } - else - { - it = listFm.Items.Add(new ListViewItem(s, fext) { Tag = fpath }); - } - - string typeName = ""; - if (fileTypeNames.TryGetValue(fext, out typeName)) - it.SubItems.Add(typeName); - else it.SubItems.Add(""); - } - - long size = (data.nFileSizeHigh * 0xffffffff + 1) + data.nFileSizeLow; - it.SubItems.Add(FormatFileSize(size)); - - StringBuilder sb = new StringBuilder(26); - if (MFM_GetFileTime(ref data.ftCreationTime, sb, 26)) - it.SubItems.Add(sb.ToString()); - else it.SubItems.Add("Unknow"); - - StringBuilder sb2 = new StringBuilder(26); - if (MFM_GetFileTime(ref data.ftLastWriteTime, sb2, 26)) - it.SubItems.Add(sb2.ToString()); - else it.SubItems.Add("Unknow"); - - StringBuilder sb3 = new StringBuilder(32); - bool hidden = false; - if (MFM_GetFileAttr(data.dwFileAttributes, sb3, 32, ref hidden)) - { - if (hidden) - { - it.ForeColor = Color.Gray; - it.SubItems[0].ForeColor = Color.Gray; - it.SubItems[1].ForeColor = Color.Gray; - it.SubItems[2].ForeColor = Color.Gray; - it.SubItems[3].ForeColor = Color.Gray; - } - it.SubItems.Add(sb3.ToString()); - } - else it.SubItems.Add(""); - - } - break; - } - case 7: - { - string path = Marshal.PtrToStringAuto(wParam); - listFm.Items.Add(new ListViewItem("..", "folder") { Tag = "..\\back\\" + path }); - break; - } - case 8: - FileMgrShowFiles(null); - break; - case 9: - { - if (listFm.SelectedItems.Count > 0) - { - ListViewItem listViewItem = listFm.SelectedItems[0]; - string path = listViewItem.Tag.ToString(); - listViewItem.BeginEdit(); - currEditingItem = listViewItem; - } - break; - } - case 10: - { - ListViewItem listViewItem = listFm.Items.Add(LanuageMgr.GetStr("NewFolder"), "folder"); - listViewItem.Tag = "newfolder"; - listViewItem.BeginEdit(); - currEditingItem = listViewItem; - break; - } - case 11: - { - foreach (ListViewItem i in listFm.Items) - i.Selected = true; - break; - } - case 12: - { - foreach (ListViewItem i in listFm.Items) - i.Selected = false; - break; - } - case 13: - { - foreach (ListViewItem i in listFm.Items) - i.Selected = !i.Selected; - break; - } - case 14: - lbFileMgrStatus.Text = Marshal.PtrToStringAuto(lParam); - break; - case 15: - switch (lParam.ToInt32()) - { - case 0: lbFileMgrStatus.Text = str_Ready; break; - case 1: - { - if (listFm.SelectedItems.Count > 0) - lbFileMgrStatus.Text = str_ReadyStatus + listFm.Items.Count + str_ReadyStatusEnd2 + listFm.SelectedItems.Count + str_ReadyStatusEnd; - else lbFileMgrStatus.Text = str_ReadyStatus + listFm.Items.Count + str_ReadyStatusEnd; - break; - } - case 2: lbFileMgrStatus.Text = ""; break; - case 3: lbFileMgrStatus.Text = ""; break; - case 4: lbFileMgrStatus.Text = ""; break; - case 5: lbFileMgrStatus.Text = str_FileCuted; break; - case 6: lbFileMgrStatus.Text = str_FileCopyed; break; - case 7: lbFileMgrStatus.Text = str_NewFolderFailed; break; - case 8: lbFileMgrStatus.Text = str_NewFolderSuccess; break; - case 9: lbFileMgrStatus.Text = str_PathCopyed; break; - case 10: lbFileMgrStatus.Text = str_FolderCuted; break; - case 11: lbFileMgrStatus.Text = str_FolderCopyed; break; - } - - break; - case 16: - int index = lParam.ToInt32(); - if (index > 0 && index < listFm.SelectedItems.Count) - return Marshal.StringToHGlobalAuto(listFm.SelectedItems[index].Tag.ToString()); - break; - case 17: - if (lParam != IntPtr.Zero) - Marshal.FreeHGlobal(wParam); - break; - case 18: - return showHiddenFiles ? new IntPtr(1) : new IntPtr(0); - case 19: - FileMgrShowFiles(Marshal.PtrToStringAuto(lParam)); - break; - case 20: - { - new FormCheckFileUse(Marshal.PtrToStringAuto(lParam)).ShowDialog(); - break; - } - } - return IntPtr.Zero; - } - private void FileMgrShowFiles(string path) - { - if (path == null) - { - path = lastShowDir; - lastShowDir = null; - } - if (lastShowDir != path) - { - lastShowDir = path; - listFm.Items.Clear(); - if (lastShowDir == "mycp" || lastShowDir == "\\\\") - { - for (int i = 0; i < treeFmLeft.Nodes[0].Nodes.Count; i++) - listFm.Items.Add(new ListViewItem(treeFmLeft.Nodes[0].Nodes[i].Text, treeFmLeft.Nodes[0].Nodes[i].ImageKey) { Tag = "..\\ROOT\\" + treeFmLeft.Nodes[0].Nodes[i].Tag }); - textBoxFmCurrent.Text = treeFmLeft.Nodes[0].Text; - } - else - { - MFM_GetFiles(lastShowDir); - textBoxFmCurrent.Text = lastShowDir; - } - if (path == "mycp") fileSystemWatcher.Path = ""; - else fileSystemWatcher.Path = path; - fileSystemWatcher.EnableRaisingEvents = true; - - - FileMgrUpdateStatus(1); - } - } - private void FileMgrUpdateStatus(int i) - { - FileMgrCallBack(15, new IntPtr(i), IntPtr.Zero); - } - private void FileMgrTreeOpenItem(TreeNode n) - { - if (n.Nodes.Count == 0 || n.Nodes[0].Text == str_loading && n.Tag != null) - { - lastClickTreeNode = n; - string s = n.Tag.ToString(); - if (MFM_GetFolders(s)) - lastClickTreeNode.Nodes.Remove(lastClickTreeNode.Nodes[0]); - } - } - - private void textBoxFmCurrent_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - btnFmAddGoto_Click(sender, e); - } - private void btnFmAddGoto_Click(object sender, EventArgs e) - { - - if (textBoxFmCurrent.Text == "") - TaskDialog.Show(str_PleaseEnterPath, str_TipTitle); - else - { - if (textBoxFmCurrent.Text.StartsWith("\"") && textBoxFmCurrent.Text.EndsWith("\"")) - { - textBoxFmCurrent.Text = textBoxFmCurrent.Text.Remove(textBoxFmCurrent.Text.Length - 1, 1); - textBoxFmCurrent.Text = textBoxFmCurrent.Text.Remove(0, 1); - } - if (Directory.Exists(textBoxFmCurrent.Text)) - FileMgrShowFiles(textBoxFmCurrent.Text); - else if (MFM_FileExist(textBoxFmCurrent.Text)) - { - string d = Path.GetDirectoryName(textBoxFmCurrent.Text); - string f = Path.GetFileName(textBoxFmCurrent.Text); - FileMgrShowFiles(d); - ListViewItem[] lis = listFm.Items.Find(f, false); - if (lis.Length > 0) lis[0].Selected = true; - } - else TaskDialog.Show(str_PathUnExists, str_TipTitle); - } - } - private void treeFmLeft_BeforeExpand(object sender, TreeViewCancelEventArgs e) - { - FileMgrTreeOpenItem(e.Node); - } - private void treeFmLeft_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - - } - private void treeFmLeft_MouseClick(object sender, MouseEventArgs e) - { - TreeNode n = treeFmLeft.SelectedNode; - if (n != null && n.Tag != null) - { - if (e.Button == MouseButtons.Left) - lastRightClicked = false; - else if (e.Button == MouseButtons.Right) - { - lastRightClicked = true; - MAppWorkShowMenuFMF(n.Tag.ToString()); - } - } - } - private void treeFmLeft_AfterSelect(object sender, TreeViewEventArgs e) - { - if (e.Action == TreeViewAction.ByMouse) - { - if (!lastRightClicked) - { - lastClickTreeNode = e.Node; - FileMgrShowFiles(lastClickTreeNode.Tag.ToString()); - } - } - } - private void treeFmLeft_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - FileMgrTreeOpenItem(treeFmLeft.SelectedNode); - } - - private ListViewItem currEditingItem = null; - private void listFm_AfterLabelEdit(object sender, LabelEditEventArgs e) - { - if (currEditingItem != null && e.Item == 0) - { - string path = currEditingItem.Tag.ToString(); - string targetName = e.Label; - //Folder - if (path == "newfolder") - { - if (targetName == "") - { - targetName = LanuageMgr.GetStr("NewFolder"); - int ix = 1; - string spt = lastShowDir + "\\" + targetName + (ix == 1 ? "" : (" (" + ix + ")")); - bool finded = false; - while (!finded) - { - if (Directory.Exists(spt)) - ix++; - else - { - finded = true; - break; - } - } - if (!MFM_CreateDir(spt)) - { - e.CancelEdit = true; - listFm.Items.Remove(currEditingItem); - FileMgrUpdateStatus(7); - } - else FileMgrUpdateStatus(8); - } - else if (MFM_IsValidateFolderFileName(targetName)) - { - string spt = lastShowDir + "\\" + targetName; - if (Directory.Exists(spt)) - { - e.CancelEdit = true; - listFm.Items.Remove(currEditingItem); - TaskDialog.Show(str_FolderHasExist); - } - else - { - if (!MFM_CreateDir(spt)) - { - e.CancelEdit = true; - listFm.Items.Remove(currEditingItem); - FileMgrUpdateStatus(7); - } - else FileMgrUpdateStatus(8); - } - } - else - { - e.CancelEdit = true; - listFm.Items.Remove(currEditingItem); - TaskDialog.Show(str_InvalidFileName); - } - } - else - { - - } - } - else e.CancelEdit = true; - } - private void listFm_SelectedIndexChanged(object sender, EventArgs e) - { - FileMgrUpdateStatus(1); - } - private void listFm_MouseDoubleClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - if (listFm.SelectedItems.Count > 0) - { - ListViewItem listViewItem = listFm.SelectedItems[0]; - string path = listViewItem.Tag.ToString(); - if (path.StartsWith("..\\back\\")) - { - path = path.Remove(0, 8); - int ix = path.LastIndexOf('\\'); - if (ix > 0 && ix < path.Length) - { - path = path.Remove(ix); - FileMgrShowFiles(path); - } - } - else - { - if (listViewItem.ImageKey == "folder" && Directory.Exists(path)) - FileMgrShowFiles(path); - else if (path.StartsWith("..\\ROOT\\")) - { - path = path.Remove(0, 8); - FileMgrShowFiles(path); - } - else if (MFM_FileExist(path)) - { - if (path.EndsWith(".exe")) - { - if (TaskDialog.Show(str_OpenAsk, str_AskTitle, str_PathStart + path, TaskDialogButton.Yes | TaskDialogButton.No) == Result.Yes) - MFM_OpenFile(path, Handle); - } - else MFM_OpenFile(path, Handle); - } - } - } - } - } - private void listFm_MouseClick(object sender, MouseEventArgs e) - { - if (listFm.SelectedItems.Count > 0) - { - ListViewItem listViewItem = listFm.SelectedItems[0]; - string path = listViewItem.Tag.ToString(); - if (e.Button == MouseButtons.Right) - MAppWorkShowMenuFM(path, listFm.SelectedItems.Count > 1, listFm.SelectedItems.Count); - } - } - - - private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) - { - string fullpath = e.FullPath; - MFM_UpdateFile(fullpath, Path.GetDirectoryName(fullpath)); - } - private void fileSystemWatcher_Created(object sender, FileSystemEventArgs e) - { - string fullpath = e.FullPath; - MFM_ReUpdateFile(fullpath, Path.GetDirectoryName(fullpath)); - FileMgrUpdateStatus(1); - } - private void fileSystemWatcher_Deleted(object sender, FileSystemEventArgs e) - { - //Remove - string fullpath = e.FullPath; - ListViewItem ii = null; - foreach (ListViewItem i in listFm.Items) - { - if (i.Tag.ToString() == fullpath) - { - ii = i; - break; - } - } - listFm.Items.Remove(ii); - FileMgrUpdateStatus(1); - } - private void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) - { - string oldfullpath = e.OldFullPath; - string fullpath = e.FullPath; - //Rename - ListViewItem ii = null; - foreach (ListViewItem i in listFm.Items) - { - if (i.Tag.ToString() == oldfullpath) - { - ii = i; - break; - } - } - ii.Tag = fullpath; - ii.Text = e.Name; - ii.ImageKey = "*" + Path.GetExtension(fullpath); - } - - #endregion - - #region ScMgrWork - - //æœåŠ¡ç®¡ç† - - private class ListViewItemComparer : IComparer - { - private int col; - private bool asdening = false; - - public int SortColum { get { return col; } set { col = value; } } - public bool Asdening { get { return asdening; } set { asdening = value; } } - - public int Compare(object x, object y) - { - int returnVal = -1; - if (((ListViewItem)x).SubItems[col].Text == ((ListViewItem)y).SubItems[col].Text) return -1; - returnVal = String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); - if (asdening) returnVal = -returnVal; - return returnVal; - } - } - - private ListViewItemComparer listViewItemComparerSc = new ListViewItemComparer(); - private List scValidPid = new List(); - private List runningSc = new List(); - private Icon icoSc = null; - private Dictionary scGroupFriendlyName = new Dictionary(); - private bool scCanUse = false; - private IntPtr hListHeaderSc = IntPtr.Zero; - - private class ScTag - { - public uint startType = 0; - public uint runningState = 0; - public string name = ""; - public string binaryPathName = ""; - } - private class ScItem - { - public ScItem(int pid, string groupName, string scName, string scDsb) - { - this.scDsb = scDsb; - this.scName = scName; - this.groupName = groupName; - this.pid = pid; - } - public string groupName = ""; - public string scName = ""; - public string scDsb = ""; - public int pid; - } - - private string ScGroupNameToFriendlyName(string s) - { - string rs = s; - if (LanuageMgr.IsChinese) - { - if (s != null) - if (!scGroupFriendlyName.TryGetValue(s, out rs)) - rs = s; - } - return rs; - } - private bool ScMgrFindRunSc(PsItem p) - { - bool rs = false; - if (p != null) - { - foreach (ScItem r in runningSc) - { - if (r.pid == p.pid) - { - p.svcs.Add(r); - rs = true; - } - } - } - return rs; - } - private string ScMgrFindDriverSc(string driverOrgPath) - { - string rs = ""; - foreach (ListViewItem li in listService.Items) - { - if (li.SubItems[7].Text == driverOrgPath) - { - rs = li.Text; - break; - } - } - return rs; - } - private void ScMgrInit() - { - if (!scListInited) - { - if (!MIsRunasAdmin()) - { - listService.Hide(); - pl_ScNeedAdminTip.Show(); - } - else - { - scGroupFriendlyName.Add("localService", LanuageMgr.GetStr("LocalService")); - scGroupFriendlyName.Add("LocalService", LanuageMgr.GetStr("LocalService")); - scGroupFriendlyName.Add("LocalSystem", LanuageMgr.GetStr("LocalSystem")); - scGroupFriendlyName.Add("LocalSystemNetworkRestricted", LanuageMgr.GetStr("LocalSystemNetworkRestricted")); - scGroupFriendlyName.Add("LocalServiceNetworkRestricted", LanuageMgr.GetStr("LocalServiceNetworkRestricted")); - scGroupFriendlyName.Add("LocalServiceNoNetwork", LanuageMgr.GetStr("LocalServiceNoNetwork")); - scGroupFriendlyName.Add("LocalServiceAndNoImpersonation", LanuageMgr.GetStr("LocalServiceAndNoImpersonation")); - scGroupFriendlyName.Add("NetworkServiceAndNoImpersonation", LanuageMgr.GetStr("NetworkServiceAndNoImpersonation")); - scGroupFriendlyName.Add("NetworkService", LanuageMgr.GetStr("NetworkService")); - scGroupFriendlyName.Add("NetworkServiceNetworkRestricted", LanuageMgr.GetStr("NetworkServiceNetworkRestricted")); - scGroupFriendlyName.Add("UnistackSvcGroup", LanuageMgr.GetStr("UnistackSvcGroup")); - scGroupFriendlyName.Add("NetSvcs", LanuageMgr.GetStr("NetworkService")); - scGroupFriendlyName.Add("netsvcs", LanuageMgr.GetStr("NetworkService")); - - MAppWorkCall3(182, listService.Handle, IntPtr.Zero); - - if (!MSCM_Init()) - TaskDialog.Show(LanuageMgr.GetStr("StartSCMFailed"), str_ErrTitle, "", TaskDialogButton.OK, TaskDialogIcon.Stop); - - scMgrEnumServicesCallBack = ScMgrIEnumServicesCallBack; - scMgrEnumServicesCallBackPtr = Marshal.GetFunctionPointerForDelegate(scMgrEnumServicesCallBack); - - scCanUse = true; - ScMgrRefeshList(); - - } - - icoSc = new Icon(Properties.Resources.icoService, 16, 16); - - listService.ListViewItemSorter = listViewItemComparerSc; - hListHeaderSc = ComCtlApi.MListViewGetHeaderControl(listService.Handle, false); - - scListInited = true; - } - } - private void ScMgrRefeshList() - { - if (scCanUse) - { - scValidPid.Clear(); - runningSc.Clear(); - listService.Items.Clear(); - MEnumServices(scMgrEnumServicesCallBackPtr); - lbServicesCount.Text = LanuageMgr.GetStr("ServiceCount") + " : " + (listService.Items.Count == 0 ? "--" : listService.Items.Count.ToString()); - } - } - private void ScMgrIEnumServicesCallBack(IntPtr dspName, IntPtr scName, uint scType, uint currentState, uint dwProcessId, bool syssc, - uint dwStartType, IntPtr lpBinaryPathName, IntPtr lpLoadOrderGroup) - { - ListViewItem li = new ListViewItem(Marshal.PtrToStringUni(scName)); - ScTag t = new ScTag(); - t.name = li.Text; - t.runningState = currentState; - t.startType = scType; - t.binaryPathName = Marshal.PtrToStringUni(lpBinaryPathName); - li.SubItems.Add(dwProcessId == 0 ? "" : dwProcessId.ToString()); - li.Tag = t; - if (dwProcessId != 0) - { - scValidPid.Add(dwProcessId); - runningSc.Add(new ScItem(Convert.ToInt32(dwProcessId), Marshal.PtrToStringUni(lpLoadOrderGroup), Marshal.PtrToStringUni(scName), Marshal.PtrToStringUni(dspName))); - } - li.SubItems.Add(Marshal.PtrToStringUni(dspName)); - switch (currentState) - { - case 0x0001: - case 0x0003: li.SubItems.Add(str_status_stopped); break; - case 0x0002: - case 0x0004: li.SubItems.Add(str_status_running); break; - case 0x0006: - case 0x0007: li.SubItems.Add(str_status_paused); break; - default: li.SubItems.Add(""); break; - } - li.SubItems.Add(Marshal.PtrToStringUni(lpLoadOrderGroup)); - switch (dwStartType) - { - case 0x0000: li.SubItems.Add(str_DriverLoad); break; - case 0x0001: li.SubItems.Add(str_DriverLoad); break; - case 0x0002: li.SubItems.Add(str_AutoStart); break; - case 0x0003: li.SubItems.Add(str_DemandStart); break; - case 0x0004: li.SubItems.Add(str_Disabled); break; - case 0x0080: li.SubItems.Add(""); break; - default: li.SubItems.Add(""); break; - } - switch (scType) - { - case 0x0002: li.SubItems.Add(str_FileSystem); break; - case 0x0001: li.SubItems.Add(str_KernelDriver); break; - case 0x0010: li.SubItems.Add(str_UserService); break; - case 0x0020: li.SubItems.Add(str_SystemService); break; - default: li.SubItems.Add(""); break; - } - - string path = Marshal.PtrToStringUni(lpBinaryPathName); - if (!MFM_FileExist(path)) - { - StringBuilder spath = new StringBuilder(260); - if (MCommandLineToFilePath(path, spath, 260)) - path = spath.ToString(); - } - - bool hightlight = false; - if (!string.IsNullOrEmpty(path) && MFM_FileExist(path)) - { - li.SubItems.Add(path); - StringBuilder exeCompany = new StringBuilder(256); - if (MGetExeCompany(path, exeCompany, 256)) - { - li.SubItems.Add(exeCompany.ToString()); - if (highlight_nosystem && exeCompany.ToString() != MICROSOFT) - hightlight = true; - } - else if (highlight_nosystem) hightlight = true; - } - else - { - li.SubItems.Add(path); - li.SubItems.Add(str_FileNotExist); - if (highlight_nosystem) hightlight = true; - } - if (hightlight) - { - li.ForeColor = Color.Blue; - foreach (ListViewItem.ListViewSubItem s in li.SubItems) - s.ForeColor = Color.Blue; - } - listService.Items.Add(li); - } - - private void listService_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Apps) - { - if (listService.SelectedItems.Count > 0) - { - ListViewItem item = listService.SelectedItems[0]; - Point p = item.Position; p.X = 0; - p = listService.PointToScreen(p); - ScTag t = item.Tag as ScTag; - MSCM_ShowMenu(Handle, t.name, t.runningState, t.startType, t.binaryPathName, p.X, p.Y); - } - } - } - private void listService_MouseClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (listService.SelectedItems.Count > 0) - { - ListViewItem item = listService.SelectedItems[0]; - ScTag t = item.Tag as ScTag; - MSCM_ShowMenu(Handle, t.name, t.runningState, t.startType, t.binaryPathName, 0, 0); - } - } - } - private void listService_ColumnClick(object sender, ColumnClickEventArgs e) - { - ((ListViewItemComparer)listService.ListViewItemSorter).Asdening = !((ListViewItemComparer)listService.ListViewItemSorter).Asdening; - ((ListViewItemComparer)listService.ListViewItemSorter).SortColum = e.Column; - ComCtlApi.MListViewSetColumnSortArrow(hListHeaderSc, ((ListViewItemComparer)listService.ListViewItemSorter).SortColum, - ((ListViewItemComparer)listService.ListViewItemSorter).Asdening, false); - listService.Sort(); - } - - private void linkRebootAsAdmin_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - MAppRebotAdmin2("select services"); - } - private void linkOpenScMsc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - MFM_OpenFile("services.msc", Handle); - } - - #endregion - - #region UWPMWork - - //枚举通用应用 - - private class TaskListViewUWPColumnSorter : ListViewColumnSorter - { - public TaskListViewUWPColumnSorter() - { - } - public override int Compare(TaskMgrListItem x, TaskMgrListItem y) - { - int compareResult = 0; - compareResult = string.Compare(x.SubItems[SortColumn].Text, y.SubItems[SortColumn].Text); - if (compareResult == 0) - compareResult = ObjectCompare.Compare(x.PID, y.PID); - if (Order == SortOrder.Ascending) - return compareResult; - else if (Order == SortOrder.Descending) - return (-compareResult); - return compareResult; - } - } - - private TaskListViewUWPColumnSorter uWPColumnSorter = new TaskListViewUWPColumnSorter(); - private void UWPListRefesh() - { - if (uwpListInited) - { - listUwpApps.Show(); - pl_UWPEnumFailTip.Hide(); - listUwpApps.Items.Clear(); - - if (!M_UWP_EnumUWPApplications()) - { - listUwpApps.Hide(); - pl_UWPEnumFailTip.Show(); - lbUWPEnumFailText.Text = LanuageMgr.GetStr("UWPEnumFail"); - return; - } - - - int count = M_UWP_GetUWPApplicationsCount(); - for (int i = 0; i < count; i++) - { - UWP_PACKAGE_INFO info = M_UWP_GetUWPApplicationAt((uint)i); - - TaskMgrListItem li = new TaskMgrListItem(info.DisplayName); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems[0].Font = listUwpApps.Font; - li.SubItems[1].Font = listUwpApps.Font; - li.SubItems[2].Font = listUwpApps.Font; - li.SubItems[0].Text = info.DisplayName; - li.SubItems[1].Text = info.AppPackageFullName; - li.SubItems[2].Text = info.InstallPath; - li.SubItems[3].Text = info.AppUserModelId; - li.Tag = info; - li.IsUWPICO = true; - - string iconpath = UWPSearchIcon(info.InstallPath, info.IconPath); - if (iconpath != "" && MFM_FileExist(iconpath)) - { - using (Image img = Image.FromFile(iconpath)) - li.Icon = IconUtils.ConvertToIcon(img); - // li.Image = IconUtils.GetThumbnail(new Bitmap(iconpath), 16, 16); - } - listUwpApps.Items.Add(li); - } - } - } - private void UWPListInit() - { - if (!uwpListInited) - { - uwpListInited = true; - UWPListRefesh(); - - listUwpApps.ListViewItemSorter = uWPColumnSorter; - listUwpApps.Header.CloumClick += UWPList_Header_CloumClick; - } - } - private void UWPListUnInit() - { - listUwpApps.Items.Clear(); - } - private string UWPSearchIcon(string dir, string logoPath) - { - //Force search - var imageFile = Path.Combine(dir, logoPath); - var name = Path.GetFileName(imageFile); - - if (MFM_FileExist(imageFile)) return imageFile; - var - scaleImage = Path.ChangeExtension(imageFile, "scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "targetsize-16.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "targetsize-24.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "targetsize-44.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "contrast-black.targetsize-44.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "scale-200_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "scale-100_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - imageFile = dir + "\\" + logoPath.Replace(name, "") + "contrast-black\\" + name; - scaleImage = Path.ChangeExtension(imageFile, "scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "scale-200_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "scale-100_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; - - imageFile = Path.Combine(dir, "en-us", logoPath); - if (MFM_FileExist(imageFile)) return imageFile; - return ""; - } - - private void UWPList_Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) - { - if (e.MouseEventArgs.Button == MouseButtons.Left) - { - listUwpApps.Locked = true; - if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) - uWPColumnSorter.Order = SortOrder.Ascending; - else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) - uWPColumnSorter.Order = SortOrder.Ascending; - else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) - uWPColumnSorter.Order = SortOrder.Descending; - - uWPColumnSorter.SortColumn = e.Index; - listUwpApps.Locked = false; - listUwpApps.Sort(); - } - } - - private TaskMgrListItem UWPListFindItem(string fullName) - { - TaskMgrListItem rs = null; - foreach (TaskMgrListItem r in listUwpApps.Items) - if (((UWP_PACKAGE_INFO)r.Tag).AppPackageFullName == fullName) - { - rs = r; - break; - } - return rs; - } - - private void 打开应用ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (listUwpApps.SelectedItem != null) - { - UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); - if (pkg.AppUserModelId != "") - { - uint processid = 0; - M_UWP_RunUWPApp(pkg.AppUserModelId, ref processid); - } - } - } - private void å¸è½½åº”用ToolStripMenuItem_Click(object sender, EventArgs e) - { - MRunExe("ms-settings:appsfeatures", null); - } - private void 打开安装ä½ç½®ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (listUwpApps.SelectedItem != null) - { - UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); - MFM_OpenFile(pkg.InstallPath, Handle); - } - } - private void å¤åˆ¶å称ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (listUwpApps.SelectedItem != null) - { - UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); - MCopyToClipboard2(pkg.DisplayName); - } - } - private void å¤åˆ¶å®Œæ•´å称ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (listUwpApps.SelectedItem != null) - { - UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); - MCopyToClipboard2(pkg.AppPackageFullName); - } - } - private void å¤åˆ¶å‘布者ToolStripMenuItem_Click(object sender, EventArgs e) - { - if (listUwpApps.SelectedItem != null) - { - string s = ""; - for (int i = 0; i < listUwpApps.Colunms.Count; i++) - { - s += " " + listUwpApps.Colunms[i].TextSmall + " : "; - s += listUwpApps.SelectedItem.SubItems[i].Text; - } - NativeMethods.MCopyToClipboard2(s); - } - } - - private void listUwpApps_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Apps) - { - if (listUwpApps.SelectedItem != null) - { - Point p = listUwpApps.GetiItemPoint(listUwpApps.SelectedItem); - contextMenuStripUWP.Show(listUwpApps.PointToScreen(p)); - } - } - } - private void listUwpApps_MouseClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Right && listUwpApps.SelectedItem != null) - contextMenuStripUWP.Show(MousePosition); - } - - #endregion - - #region PerfWork - - //性能页é¢ä»£ç  - - public static Color CpuDrawColor = Color.FromArgb(17, 125, 187); - public static Color CpuBgColor = Color.FromArgb(241, 246, 250); - public static Color RamDrawColor = Color.FromArgb(139, 18, 174); - public static Color RamBgColor = Color.FromArgb(244, 242, 244); - public static Color DiskDrawColor = Color.FromArgb(77, 166, 12); - public static Color DiskBgColor = Color.FromArgb(239, 247, 223); - public static Color NetDrawColor = Color.FromArgb(167, 79, 1); - public static Color NetBgColor = Color.FromArgb(252, 243, 235); - - public static Color CpuDrawColor2 = Color.FromArgb(100, 17, 125, 187); - public static Color RamDrawColor2 = Color.FromArgb(100, 139, 18, 174); - public static Color DiskDrawColor2 = Color.FromArgb(100, 77, 166, 12); - public static Color NetDrawColor2 = Color.FromArgb(100, 167, 79, 1); - - public static Color CpuBgColor2 = Color.FromArgb(100, 85, 193, 255); - public static Color RamBgColor2 = Color.FromArgb(180, 220, 98, 244); - public static Color DiskBgColor2 = Color.FromArgb(100, 239, 247, 223); - public static Color NetBgColor2 = Color.FromArgb(100, 255, 157, 89); - - PerfItemHeader perfItemHeaderCpu; - PerfItemHeader perfItemHeaderRam; - - PerformanceListItem perf_cpu = new PerformanceListItem(); - PerformanceListItem perf_ram = new PerformanceListItem(); - - private class PerfItemHeader - { - public IntPtr performanceCounterNative = IntPtr.Zero; - public PerformanceListItem item = null; - public IPerformancePage performancePage = null; - - public bool Inited { get; set; } - - public override string ToString() - { - if (item != null) - return item.ToString(); - return base.ToString(); - } - } - - private List perfItems = new List(); - private List perfPages = new List(); - - private IPerformancePage currSelectedPerformancePage = null; - - private FormSpeedBall.SpeedItem itemCpu; - private FormSpeedBall.SpeedItem itemRam; - private FormSpeedBall.SpeedItem itemDisk; - private FormSpeedBall.SpeedItem itemNet; - private IntPtr netCounterMain = IntPtr.Zero; - - private Size lastGraphicSize = new Size(); - private Control lastGridParent = null; - private Size lastGridSize = new Size(); - - private void splitContainerPerfCtls_Panel2_SizeChanged(object sender, EventArgs e) - { - PerfPagesResize(new Size(splitContainerPerfCtls.Panel2.Width - - (splitContainerPerfCtls.Panel2.VerticalScroll.Visible ? 40 : 30), splitContainerPerfCtls.Panel2.Height - 30)); - } - private void performanceLeftList_SelectedtndexChanged(object sender, EventArgs e) - { - if (performanceLeftList.Selectedtem == perf_cpu) - PerfPagesTo(0, perfItemHeaderCpu); - else if (performanceLeftList.Selectedtem == perf_ram) - PerfPagesTo(1, perfItemHeaderRam); - else if (performanceLeftList.Selectedtem.PageIndex != 0) - PerfPagesTo(performanceLeftList.Selectedtem.PageIndex, (PerfItemHeader)performanceLeftList.Selectedtem.Tag); - else PerfPagesToNull(); - } - private void OpeningPageMenuEventHandler(IPerformancePage sender, ToolStripMenuItem menuItemView) - { - if (menuItemView.DropDownItems.Count == 0) - { - /*ToolStripItem tcpu = menuItemView.DropDownItems.Add("CPU"); - tcpu.Tag = perfItemHeaderCpu.performancePage; - tcpu.Click += Tcpu_Click; - ToolStripItem tram = menuItemView.DropDownItems.Add(perfItemHeaderRam.item.Name); - tram.Tag = perfItemHeaderRam.performancePage; - tram.Click += Tram_Click;*/ - foreach (PerfItemHeader h in perfItems) - { - ToolStripItem tx = menuItemView.DropDownItems.Add(h.item.Name); - tx.Tag = h; - tx.Click += Tx_Click; - } - } - - foreach (ToolStripMenuItem i in menuItemView.DropDownItems) - { - if (i.Tag != null && ((PerfItemHeader)i.Tag).performancePage == sender) - i.Checked = true; - else if (i.Checked) i.Checked = false; - } - } - - private void Tx_Click(object sender, EventArgs e) - { - PerfItemHeader tag = null; - ToolStripItem item = sender as ToolStripItem; - if (item.Tag != null) - { - tag = (PerfItemHeader)item.Tag; - PerfPagesTo(tag.performancePage, tag); - } - } - private void Tcpu_Click(object sender, EventArgs e) - { - PerfPagesTo(0, perfItemHeaderCpu); - } - private void Tram_Click(object sender, EventArgs e) - { - PerfPagesTo(1, perfItemHeaderRam); - } - - private void SwithGraphicViewEventHandler(IPerformancePage sender) - { - Panel gridPanel = sender.GridPanel; - if (!sender.PageIsGraphicMode) - { - spBottom.Visible = false; - tabControlMain.Visible = false; - lastSize = Size; - - lastGridSize = gridPanel.Size; - - lastGridParent = gridPanel.Parent; - lastGridParent.Controls.Remove(gridPanel); - pl_perfGridHost.Controls.Add(gridPanel); - - gridPanel.Size = new Size(pl_perfGridHost.Width - 30, pl_perfGridHost.Height - 30); - gridPanel.Location = new Point(15, 15); - - sender.PageIsGraphicMode = true; - - pl_perfGridHost.BringToFront(); - - MAppWorkCall3(167, Handle, IntPtr.Zero); - - Size = lastGraphicSize; - } - else - { - pl_perfGridHost.SendToBack(); - - pl_perfGridHost.Controls.Remove(gridPanel); - lastGridParent.Controls.Add(gridPanel); - - MAppWorkCall3(173, Handle, IntPtr.Zero); - - gridPanel.Size = lastGridSize; - gridPanel.Location = Point.Empty; - - sender.PageIsGraphicMode = false; - - spBottom.Visible = true; - tabControlMain.Visible = true; - lastGraphicSize = Size; - Size = lastSize; - } - } - - private void PerfPagesToNull() - { - if (currSelectedPerformancePage != null) - { - currSelectedPerformancePage.PageHide(); - currSelectedPerformancePage.PageIsActive = false; - } - currSelectedPerformancePage = null; - } - private void PerfPagesTo(int index, PerfItemHeader header) - { - PerfPagesTo(perfPages[index], header); - } - private void PerfPagesTo(IPerformancePage page, PerfItemHeader header) - { - bool isGrMode = false; - - if (currSelectedPerformancePage != null) - { - if (currSelectedPerformancePage.PageIsGraphicMode) - { - isGrMode = true; - - pl_perfGridHost.SendToBack(); - - pl_perfGridHost.Controls.Remove(currSelectedPerformancePage.GridPanel); - lastGridParent.Controls.Add(currSelectedPerformancePage.GridPanel); - - currSelectedPerformancePage.GridPanel.Size = lastGridSize; - currSelectedPerformancePage.GridPanel.Location = Point.Empty; - - currSelectedPerformancePage.PageIsGraphicMode = false; - } - - currSelectedPerformancePage.PageHide(); - currSelectedPerformancePage.PageIsActive = false; - } - - currSelectedPerformancePage = null; - currSelectedPerformancePage = page; - - if (!header.Inited) - { - currSelectedPerformancePage.PageInit(); - header.Inited = true; - } - - currSelectedPerformancePage.PageShow(); - currSelectedPerformancePage.PageIsActive = true; - - performanceLeftList.Selectedtem = performanceLeftList.Items[perfPages.IndexOf(currSelectedPerformancePage)]; - - if (isGrMode) - { - lastGridSize = currSelectedPerformancePage.GridPanel.Size; - - lastGridParent = currSelectedPerformancePage.GridPanel.Parent; - lastGridParent.Controls.Remove(currSelectedPerformancePage.GridPanel); - pl_perfGridHost.Controls.Add(currSelectedPerformancePage.GridPanel); - - currSelectedPerformancePage.GridPanel.Size = new Size(pl_perfGridHost.Width - 30, pl_perfGridHost.Height - 30); - currSelectedPerformancePage.GridPanel.Location = new Point(15, 15); - - currSelectedPerformancePage.PageIsGraphicMode = true; - - pl_perfGridHost.BringToFront(); - } - } - private void PerfPagesAddToCtl(Control c, string name) - { - splitContainerPerfCtls.Panel2.Controls.Add(c); - - c.Visible = false; - c.Anchor = AnchorStyles.Left | AnchorStyles.Top;//| AnchorStyles.Right | AnchorStyles.Bottom; - //c.Size = new Size(splitContainerPerfCtls.Panel2.Width - 30, splitContainerPerfCtls.Panel2.Height - 30); - c.Location = new Point(15, 15); - c.Text = "资æºä¿¡æ¯é¡µ " + name; - c.Font = tabControlMain.Font; - } - private void PerfPagesResize(Size targetSize) - { - foreach (PerfItemHeader h in perfItems) - if (h.performancePage != null) - if (!h.performancePage.PageIsGraphicMode) - h.performancePage.Size = targetSize; - } - private void PerfPagesInit() - { - PerformancePageCpu performanceCpu = new PerformancePageCpu(); - performanceCpu.OpeningPageMenu += OpeningPageMenuEventHandler; - performanceCpu.SwithGraphicView += SwithGraphicViewEventHandler; - PerfPagesAddToCtl(performanceCpu, perf_cpu.Name); - perfPages.Add(performanceCpu); - - perfItemHeaderCpu = new PerfItemHeader(); - perfItemHeaderCpu.item = perf_cpu; - perfItemHeaderCpu.performancePage = performanceCpu; - perfItems.Add(perfItemHeaderCpu); - - PerformancePageRam performanceRam = new PerformancePageRam(); - performanceRam.OpeningPageMenu += OpeningPageMenuEventHandler; - performanceRam.SwithGraphicView += SwithGraphicViewEventHandler; - PerfPagesAddToCtl(performanceRam, perf_ram.Name); - perfPages.Add(performanceRam); - - perfItemHeaderRam = new PerfItemHeader(); - perfItemHeaderRam.item = perf_ram; - perfItemHeaderRam.performancePage = performanceRam; - perfItems.Add(perfItemHeaderRam); - } - private void PerfInit() - { - //åˆå§‹åŒ–perfé¡µé¢ - if (!perfInited) - { - MDEVICE_Init(); - - perf_cpu.Name = "CPU"; - perf_cpu.SmallText = "-- %"; - perf_cpu.BasePen = new Pen(CpuDrawColor, 2); - perf_cpu.BgBrush = new SolidBrush(CpuBgColor); - performanceLeftList.Items.Add(perf_cpu); - - perf_ram.Name = LanuageMgr.GetStr("TitleRam"); - perf_ram.SmallText = "-- %"; - perf_ram.BasePen = new Pen(RamDrawColor, 2); - perf_ram.BgBrush = new SolidBrush(RamBgColor); - performanceLeftList.Items.Add(perf_ram); - - PerfPagesInit(); - - //ç£ç›˜é¡µé¢ - MDEVICE_GetLogicalDiskInfo(); - uint count = MPERF_InitDisksPerformanceCounters(); - for (int i = 0; i < count; i++) - { - PerfItemHeader perfItemHeader = new PerfItemHeader(); - perfItemHeader.performanceCounterNative = MPERF_GetDisksPerformanceCounters(i); - perfItemHeader.item = new PerformanceListItem(); - - StringBuilder sb = new StringBuilder(32); - MPERF_GetDisksPerformanceCountersInstanceName(perfItemHeader.performanceCounterNative, sb, 32); - uint diskIndex = (uint)i ;// MDEVICE_GetPhysicalDriveFromPartitionLetter(sb.ToString()[2]); - - perfItemHeader.item.Name = LanuageMgr.GetStr("TitleDisk") + sb.ToString(); - perfItemHeader.item.BasePen = new Pen(DiskDrawColor); - perfItemHeader.item.BgBrush = new SolidBrush(DiskBgColor); - perfItemHeader.item.Tag = perfItemHeader; - perfItems.Add(perfItemHeader); - - PerformancePageDisk performancedisk = new PerformancePageDisk(perfItemHeader.performanceCounterNative, diskIndex); - performancedisk.OpeningPageMenu += OpeningPageMenuEventHandler; - performancedisk.SwithGraphicView += SwithGraphicViewEventHandler; - PerfPagesAddToCtl(performancedisk, perfItemHeader.item.Name); - perfPages.Add(performancedisk); - - perfItemHeader.performancePage = performancedisk; - - perfItemHeader.item.PageIndex = perfPages.Count - 1; - performanceLeftList.Items.Add(perfItemHeader.item); - } - - //网å¡é¡µé¢ - count = MDEVICE_GetNetworkAdaptersInfo(); - for (int i = 0; i < count; i++) - { - StringBuilder sbName = new StringBuilder(128); - if (MDEVICE_GetNetworkAdapterInfoItem(i, sbName, 128)) - { - PerfItemHeader perfItemHeader = new PerfItemHeader(); - perfItemHeader.performanceCounterNative = MPERF_GetNetworksPerformanceCounterWithName(sbName.ToString()); - perfItemHeader.item = new PerformanceListItem(); - - bool isWifi = MDEVICE_GetNetworkAdapterIsWIFI(sbName.ToString()); - - perfItemHeader.item.Name = isWifi ? "Wi-Fi" : LanuageMgr.GetStr("Ethernet"); - perfItemHeader.item.BasePen = new Pen(NetDrawColor); - perfItemHeader.item.BgBrush = new SolidBrush(NetBgColor); - perfItemHeader.item.Tag = perfItemHeader; - perfItems.Add(perfItemHeader); - - StringBuilder sbIPV4 = new StringBuilder(32); - StringBuilder sbIPV6 = new StringBuilder(64); - bool enabled = MDEVICE_GetNetworkAdapterInfoFormName(sbName.ToString(), - sbIPV4, 32, sbIPV6, 64); - perfItemHeader.item.Gray = !enabled; - if (!enabled) - perfItemHeader.item.SmallText = LanuageMgr.GetStr("NotConnect"); - - PerformancePageNet performancenet = new PerformancePageNet(perfItemHeader.performanceCounterNative, isWifi, sbName.ToString()); - performancenet.OpeningPageMenu += OpeningPageMenuEventHandler; - performancenet.SwithGraphicView += SwithGraphicViewEventHandler; - performancenet.v4 = sbIPV4.ToString(); - performancenet.v6 = sbIPV6.ToString(); - - PerfPagesAddToCtl(performancenet, perfItemHeader.item.Name); - perfPages.Add(performancenet); - - perfItemHeader.performancePage = performancenet; - - perfItemHeader.item.PageIndex = perfPages.Count - 1; - performanceLeftList.Items.Add(perfItemHeader.item); - } - } - - performanceLeftList.UpdateAll(); - performanceLeftList.Invalidate(); - - PerfPagesTo(0, perfItemHeaderCpu); - PerfPagesResize(new Size(splitContainerPerfCtls.Panel2.Width - (splitContainerPerfCtls.Panel2.VerticalScroll.Visible ? 40 : 30), splitContainerPerfCtls.Panel2.Height - 30)); - - perfInited = true; - } - } - private void PerfInitTray() - { - if (!perfTrayInited) - { - if (MPERF_InitNetworksPerformanceCounters2() > 0) - netCounterMain = MPERF_GetNetworksPerformanceCounters(0); - - formSpeedBall = new FormSpeedBall(); - formSpeedBall.Show(); - ShowWindow(formSpeedBall.Handle, 0); - - Font itemHugeFont = new Font(Font.FontFamily, 10.5f); - Font itemValueFont = new Font(Font.FontFamily, 10.5f); - - itemCpu = new FormSpeedBall.SpeedItem("CPU", CpuBgColor2, CpuDrawColor); - itemRam = new FormSpeedBall.SpeedItem(LanuageMgr.GetStr("TitleRam"), RamBgColor2, RamDrawColor2); - itemDisk = new FormSpeedBall.SpeedItem(LanuageMgr.GetStr("TitleDisk"), DiskBgColor2, DiskDrawColor2); - itemNet = new FormSpeedBall.SpeedItem(LanuageMgr.GetStr("TitleNet"), NetBgColor2, NetDrawColor2); - - itemCpu.TextFont = itemHugeFont; - itemCpu.ValueFont = itemValueFont; - itemRam.TextFont = itemHugeFont; - itemRam.ValueFont = itemValueFont; - itemDisk.TextFont = itemHugeFont; - itemDisk.ValueFont = itemValueFont; - itemNet.TextFont = itemHugeFont; - itemNet.ValueFont = itemValueFont; - - itemCpu.GridType = FormSpeedBall.SpeedItemGridType.OneGrid; - itemRam.GridType = FormSpeedBall.SpeedItemGridType.NoGrid; - itemNet.GridType = FormSpeedBall.SpeedItemGridType.NoValue; - itemDisk.GridType = FormSpeedBall.SpeedItemGridType.OneGrid; - - formSpeedBall.Items.Add(itemCpu); - formSpeedBall.Items.Add(itemRam); - formSpeedBall.Items.Add(itemDisk); - formSpeedBall.Items.Add(itemNet); - - perfTrayInited = true; - } - } - private void PerfUpdate() - { - foreach (PerfItemHeader h in perfItems) - { - if (h.item.Gray) continue; - - string outCustomStr = null; - int outdata1 = -1; - int outdata2 = -1; - if (h.performancePage.PageUpdateSimple(out outCustomStr, out outdata1, out outdata2)) - { - if (outCustomStr != null) - h.item.SmallText = outCustomStr; - } - else - { - if (outCustomStr == null) - h.item.SmallText = outdata1.ToString("0.0") + "%"; - } - - if (outdata2 != -1 && outdata2 != -1) - h.item.AddData((outdata1 + outdata2) / 2); - else if (outdata1 != -1) - h.item.AddData(outdata1); - } - - if (currSelectedPerformancePage != null) - currSelectedPerformancePage.PageUpdate(); - } - private void PerfClear() - { - foreach (IPerformancePage h in perfPages) - h.PageDelete(); - perfPages.Clear(); - - MPERF_DestroyNetworksPerformanceCounters(); - MPERF_DestroyDisksPerformanceCounters(); - perfItems.Clear(); - - MDEVICE_DestroyLogicalDiskInfo(); - MDEVICE_DestroyNetworkAdaptersInfo(); - MDEVICE_UnInit(); - - SetConfig("OldSizeGraphic", "AppSetting", lastGraphicSize.Width + "-" + lastGraphicSize.Height); - - formSpeedBall.Close(); - } - private void PerfUpdateGridUnit() - { - string unistr = ""; - if (baseProcessRefeshTimer.Enabled) - unistr = (baseProcessRefeshTimer.Interval / 1000 * 60).ToString() + str_sec; - else unistr = str_status_paused; - foreach (IPerformancePage p in perfPages) - p.PageSetGridUnit(unistr); - } - private void PerfSetTrayPos() - { - Point p = MousePosition; - p.X -= 15; p.Y -= 15; - Point t = new Point(); - if (p.Y < 50) - t.Y = 45; - else if (p.Y > Screen.PrimaryScreen.Bounds.Height - 50) - t.Y = Screen.PrimaryScreen.Bounds.Height - formSpeedBall.Height - 45; - else t.Y = p.Y - formSpeedBall.Height; - - if (p.X < 50) - t.X = 45; - else if (p.X > Screen.PrimaryScreen.Bounds.Width - 50) - t.X = Screen.PrimaryScreen.Bounds.Width - formSpeedBall.Width - 45; - else t.X = p.X - formSpeedBall.Width; - - if (t.X < 0) t.X = 2; - if (t.X > Screen.PrimaryScreen.Bounds.Width - formSpeedBall.Width) t.X = Screen.PrimaryScreen.Bounds.Width - formSpeedBall.Width - 2; - if (t.Y < 0) t.Y = 2; - if (t.Y > Screen.PrimaryScreen.Bounds.Height - formSpeedBall.Height) t.X = Screen.PrimaryScreen.Bounds.Height - formSpeedBall.Height - 2; - - formSpeedBall.Location = t; - } - - private FormSpeedBall formSpeedBall = null; - - private void linkLabelOpenPerfMon_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - MRunExe("perfmon.exe", "/res"); - } - - #endregion - - #region LanuageWork - - //语言(说真的,这是我è§è¿‡æœ€çƒ‚的代ç ï¼ˆå¥½åƒä¸æ˜¯æˆ‘写的),超级想改掉,但是ä¸æ•¢æ”¹ï¼‰ - - public static string str_system_interrupts = ""; - public static string str_idle_process = ""; - public static string str_service_host = ""; - public static string str_status_paused = ""; - public static string str_status_hung = ""; - public static string str_status_running = ""; - public static string str_status_stopped = ""; - - public static string str_proc_count = ""; - public static string str_proc_32 = ""; - public static string str_proc_64 = ""; - public static string str_get_failed = ""; - public static string str_sec = ""; - public static string str_loading = ""; - public static string str_frocedelsuccess = ""; - public static string str_filldatasuccess = ""; - public static string str_filldatafailed = ""; - public static string str_getfileinfofailed = ""; - public static string str_filenotexist = ""; - public static string str_failed = ""; - - public static string str_endproc = ""; - public static string str_endtask = ""; - public static string str_resrat = ""; - - public static string str_VisitFolderFailed = ""; - public static string str_TipTitle = ""; - public static string str_ErrTitle = ""; - public static string str_AskTitle = ""; - public static string str_PathUnExists = ""; - public static string str_PleaseEnterPath = ""; - public static string str_Ready = ""; - public static string str_ReadyStatus = ""; - public static string str_ReadyStatusEnd = ""; - public static string str_ReadyStatusEnd2 = ""; - public static string str_FileCuted = ""; - public static string str_FileCopyed = ""; - public static string str_NewFolderFailed = ""; - public static string str_NewFolderSuccess = ""; - public static string str_PathCopyed = ""; - public static string str_FolderCuted = ""; - public static string str_FolderCopyed = ""; - public static string str_FolderHasExist = ""; - public static string str_OpenAsk = ""; - public static string str_PathStart = ""; - public static string str_DriverLoad = ""; - public static string str_AutoStart = ""; - public static string str_DemandStart = ""; - public static string str_Disabled = ""; - public static string str_FileSystem = ""; - public static string str_KernelDriver = ""; - public static string str_UserService = ""; - public static string str_SystemService = ""; - public static string str_InvalidFileName = ""; - public static string str_RefeshSuccess = ""; - public static string str_InvalidHwnd = ""; - public static string str_ChangeWindowTextAsk = ""; - public static string str_UnlockFileSuccess = ""; - public static string str_UnlockFileFailed = ""; - public static string str_CollectingFiles = ""; - public static string str_DeleteFiles = ""; - public static string str_PleaseChooseDriver = ""; - public static string str_DriverLoadSuccessFull = ""; - public static string str_DriverLoadFailed = ""; - public static string str_DriverUnLoadSuccessFull = ""; - public static string str_DriverUnLoadFailed = ""; - public static string str_PleaseEnterDriverServiceName = ""; - public static string str_DriverCount = ""; - public static string str_FileNotExist = ""; - public static string str_DriverCountLoaded = ""; - public static string str_AppTitle = ""; - public static string str_FileTrust = ""; - public static string str_FileTrustViewCrt = ""; - public static string str_FunCreateing = ""; - public static string str_PleaseEnterTargetAddress = ""; - public static string str_PleaseEnterDaSize = ""; - public static string str_DblClickToDa = ""; - public static string str_KillAskStart = ""; - public static string str_KillAskEnd = ""; - public static string str_KillAskImporantGiveup = ""; - public static string str_KillAskContentImporant = ""; - public static string str_Close = ""; - public static string str_Cancel = ""; - public static string str_KillAskContentVeryImporant = ""; - public static string str_TitleVeryWarn = ""; - public static string str_SuspendStart = ""; - public static string str_SuspendEnd = ""; - public static string str_SuspendWarnContent = ""; - public static string str_SuspendVeryImporantWarnContent = ""; - public static string str_DblCklShow_EPROCESS = ""; - public static string str_DblCklShow_KPROCESS = ""; - public static string str_DblCklShow_PEB = ""; - public static string str_DblCklShow_RTL_USER_PROCESS_PARAMETERS = ""; - public static string str_CantFind = ""; - public static string str_No = ""; - public static string str_Yes = ""; - public static string str_SetTo = ""; - public static string str_KillTreeAskEnd = ""; - public static string str_KillTreeContent = ""; - public static string str_Sent = ""; - public static string str_Receive = ""; - public static string str_MemFree = "Free"; - public static string str_MemModifed = "Modifed"; - public static string str_MemStandby = "Standby"; - public static string str_MemUsingS = "Using"; - public static string str_IdleProcessDsb = "IdleProcessDsb"; - public static string str_InterruptsProcessDsb = ""; - public static string str_WarnTitle = ""; - public static string str_DriverNotLoad = ""; - public static string str_SuspendThisTitle = ""; - public static string str_SuspendThisText = ""; - public static string str_SuspendCheckText = ""; - public static string str_ShowMain = ""; - public static string str_HideMain = ""; - - /* - - * DblCklShow_EPROCESS Double Click this item to show _EPROCESS of process -DblCklShow_KPROCESS Double Click this item to show _KPROCESS of process -DblCklShow_PEB Double Click this item to show _PEB of process -DblCklShow_RTL_USER_PROCESS_PARAMETERS Double Click this item to show RTL_USER_PROCESS_PARAMETERS of process - - */ - - public static void InitLanuage() - { - string lanuage = GetConfig("Lanuage", "AppSetting"); - if (lanuage != "") - { - try - { - Log("Load Lanuage Resource : " + lanuage); - LanuageMgr.LoadLanuageResource(lanuage); - } - catch (Exception e) - { - LogErr("Lanuage resource load failed !\n" + e.ToString()); - MessageBox.Show(e.ToString(), "ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else - { - LanuageMgr.LoadLanuageResource("zh"); - SetConfig("Lanuage", "AppSetting", "zh"); - LogWarn("Not found Lanuage settings , use default zh-CN ."); - } - - InitLanuageItems(); - if (lanuage != "" && lanuage != "zh" && lanuage != "zh-CN") - System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lanuage); - } - private static void InitLanuageItems() - { - try - { - MLG_SetLanuageItems_CanRealloc(); - - str_InterruptsProcessDsb = LanuageMgr.GetStr("InterruptsProcessDsb"); - str_system_interrupts = LanuageMgr.GetStr("SystemInterrupts"); - str_DriverLoadFailed = LanuageMgr.GetStr("DriverLoadFailed"); - str_ShowMain = LanuageMgr.GetStr("ShowMain"); - str_HideMain = LanuageMgr.GetStr("HideMain"); - str_WarnTitle = LanuageMgr.GetStr("WarnTitle"); - str_IdleProcessDsb = LanuageMgr.GetStr("IdleProcessDsb"); - str_MemFree = LanuageMgr.GetStr("MemFree"); - str_MemModifed = LanuageMgr.GetStr("MemModifed"); - str_MemStandby = LanuageMgr.GetStr("MemStandby"); - str_MemUsingS = LanuageMgr.GetStr("MemUsingS"); - str_Receive = LanuageMgr.GetStr("Receive"); - str_Sent = LanuageMgr.GetStr("Send"); - str_KillTreeAskEnd = LanuageMgr.GetStr("KillTreeAskEnd"); - str_KillTreeContent = LanuageMgr.GetStr("KillTreeContent"); - str_No = LanuageMgr.GetStr("No"); - str_Yes = LanuageMgr.GetStr("Yes"); - str_DblClickToDa = LanuageMgr.GetStr("DblClickToDa"); - str_FunCreateing = LanuageMgr.GetStr("FunCreateing"); - str_FileTrustViewCrt = LanuageMgr.GetStr("FileTrustViewCrt"); - str_AppTitle = LanuageMgr.GetStr("AppTitle"); - str_DriverCountLoaded = LanuageMgr.GetStr("DriverCountLoaded"); - str_FileNotExist = LanuageMgr.GetStr("FileNotExist"); - str_PleaseEnterDriverServiceName = LanuageMgr.GetStr("PleaseEnterDriverServiceName"); - str_DriverUnLoadFailed = LanuageMgr.GetStr("DriverUnLoadFailed"); - str_DriverUnLoadSuccessFull = LanuageMgr.GetStr("DriverUnLoadSuccessFull"); - str_DriverLoadSuccessFull = LanuageMgr.GetStr("DriverLoadSuccessFull"); - str_DriverLoadSuccessFull = LanuageMgr.GetStr("DriverLoadSuccessFull"); - str_DeleteFiles = LanuageMgr.GetStr("DeleteFiles"); - str_CollectingFiles = LanuageMgr.GetStr("CollectingFiles"); - str_UnlockFileSuccess = LanuageMgr.GetStr("UnlockFileSuccess"); - str_UnlockFileFailed = LanuageMgr.GetStr("UnlockFileFailed"); - str_filenotexist = LanuageMgr.GetStr("PathUnExists"); - str_failed = LanuageMgr.GetStr("OpFailed"); - str_getfileinfofailed = LanuageMgr.GetStr("GetFileInfoFailed"); - str_filldatasuccess = LanuageMgr.GetStr("FillFileSuccess"); - str_filldatafailed = LanuageMgr.GetStr("FillFileFailed"); - str_frocedelsuccess = LanuageMgr.GetStr("FroceDelSuccess"); - str_idle_process = LanuageMgr.GetStr("SystemIdleProcess"); - str_service_host = LanuageMgr.GetStr("ServiceHost"); - str_status_paused = LanuageMgr.GetStr("StatusPaused"); - str_status_hung = LanuageMgr.GetStr("StatusHang"); - str_proc_count = LanuageMgr.GetStr("ProcessCount"); - str_proc_32 = LanuageMgr.GetStr("Process32Bit"); - str_proc_64 = LanuageMgr.GetStr("Process64Bit"); - str_get_failed = LanuageMgr.GetStr("GetFailed"); - str_sec = LanuageMgr.GetStr("Second"); - str_status_running = LanuageMgr.GetStr("StatusRunning"); - str_status_stopped = LanuageMgr.GetStr("StatusStopped"); - str_endproc = LanuageMgr.GetStr("BtnEndProcess"); - str_endtask = LanuageMgr.GetStr("BtnEndTask"); - str_resrat = LanuageMgr.GetStr("BtnRestartText"); - str_loading = LanuageMgr.GetStr("Loading"); - str_VisitFolderFailed = LanuageMgr.GetStr("VisitFolderFailed"); - str_TipTitle = LanuageMgr.GetStr("TipTitle"); - str_ErrTitle = LanuageMgr.GetStr("ErrTitle"); - str_AskTitle = LanuageMgr.GetStr("AskTitle "); - str_PathUnExists = LanuageMgr.GetStr("PathUnExists"); - str_PleaseEnterPath = LanuageMgr.GetStr("PleaseEnterPath"); - str_Ready = LanuageMgr.GetStr("Ready"); - str_ReadyStatus = LanuageMgr.GetStr("ReadyStatus"); - str_ReadyStatusEnd = LanuageMgr.GetStr("ReadyStatusEnd"); - str_ReadyStatusEnd2 = LanuageMgr.GetStr("ReadyStatusEnd2"); - str_FileCuted = LanuageMgr.GetStr("FileCuted"); - str_FileCopyed = LanuageMgr.GetStr("FileCopyed"); - str_NewFolderFailed = LanuageMgr.GetStr("NewFolderFailed"); - str_NewFolderSuccess = LanuageMgr.GetStr("NewFolderSuccess "); - str_PathCopyed = LanuageMgr.GetStr("PathCopyed"); - str_FolderCuted = LanuageMgr.GetStr("FolderCuted"); - str_FolderCopyed = LanuageMgr.GetStr("FolderCopyed"); - str_FolderHasExist = LanuageMgr.GetStr("FolderHasExist"); - str_OpenAsk = LanuageMgr.GetStr("OpenAsk"); - str_PathStart = LanuageMgr.GetStr("PathStart"); - str_DriverLoad = LanuageMgr.GetStr("DriverLoad"); - str_AutoStart = LanuageMgr.GetStr("AutoStart"); - str_DemandStart = LanuageMgr.GetStr("DemandStart"); - str_Disabled = LanuageMgr.GetStr("Disabled"); - str_FileSystem = LanuageMgr.GetStr("FileSystem"); - str_KernelDriver = LanuageMgr.GetStr("KernelDriver"); - str_UserService = LanuageMgr.GetStr("UserService"); - str_SystemService = LanuageMgr.GetStr("SystemService"); - str_InvalidFileName = LanuageMgr.GetStr("InvalidFileName"); - str_InvalidHwnd = LanuageMgr.GetStr("InvalidHwnd"); - str_RefeshSuccess = LanuageMgr.GetStr("RefeshSuccess"); - str_PleaseChooseDriver = LanuageMgr.GetStr("PleaseChooseDriver"); - str_DriverCount = LanuageMgr.GetStr("DriverCount"); - str_FileTrust = LanuageMgr.GetStr("FileTrust"); - str_PleaseEnterTargetAddress = LanuageMgr.GetStr("PleaseEnterTargetAddress"); - str_PleaseEnterDaSize = LanuageMgr.GetStr("PleaseEnterDaSize"); - str_KillAskStart = LanuageMgr.GetStr("KillAskStart"); - str_KillAskEnd = LanuageMgr.GetStr("KillAskEnd"); - str_KillAskImporantGiveup = LanuageMgr.GetStr("KillAskImporantGiveup"); - str_KillAskContentImporant = LanuageMgr.GetStr("KillAskContentImporant"); - str_Close = LanuageMgr.GetStr("Close"); - str_Cancel = LanuageMgr.GetStr("Cancel"); - str_KillAskContentVeryImporant = LanuageMgr.GetStr("KillAskContentVeryImporant"); - str_TitleVeryWarn = LanuageMgr.GetStr("TitleVeryWarn"); - str_SuspendStart = LanuageMgr.GetStr("SuspendStart"); - str_SuspendEnd = LanuageMgr.GetStr("SuspendEnd"); - str_SuspendWarnContent = LanuageMgr.GetStr("SuspendWarnContent"); - str_SuspendVeryImporantWarnContent = LanuageMgr.GetStr("SuspendVeryImporantWarnContent"); - str_DblCklShow_EPROCESS = LanuageMgr.GetStr("DblCklShow_EPROCESS"); - str_DblCklShow_KPROCESS = LanuageMgr.GetStr("DblCklShow_KPROCESS"); - str_DblCklShow_PEB = LanuageMgr.GetStr("DblCklShow_PEB"); - str_DblCklShow_RTL_USER_PROCESS_PARAMETERS = LanuageMgr.GetStr("DblCklShow_RTL_USER_PROCESS_PARAMETERS"); - str_CantFind = LanuageMgr.GetStr("CantFind"); - str_SetTo = LanuageMgr.GetStr("SetTo"); - str_DriverNotLoad = LanuageMgr.GetStr("DriverNotLoad"); - str_SuspendThisTitle = LanuageMgr.GetStr("SuspendThisTitle"); - str_SuspendThisText = LanuageMgr.GetStr("SuspendThisText"); - str_SuspendCheckText = LanuageMgr.GetStr("SuspendCheckText"); - - MAppSetLanuageItems(0, 0, str_KillAskStart, 0); - MAppSetLanuageItems(0, 1, str_KillAskEnd, 0); - MAppSetLanuageItems(0, 2, LanuageMgr.GetStr("KillAskContent"), 0); - MAppSetLanuageItems(0, 3, LanuageMgr.GetStr("KillFailed"), 0); - MAppSetLanuageItems(0, 4, LanuageMgr.GetStr("AccessDenied"), 0); - MAppSetLanuageItems(0, 5, LanuageMgr.GetStr("OpFailed"), 0); - MAppSetLanuageItems(0, 6, LanuageMgr.GetStr("InvalidProcess"), 0); - MAppSetLanuageItems(0, 7, LanuageMgr.GetStr("CantCopyFile"), 0); - MAppSetLanuageItems(0, 8, LanuageMgr.GetStr("CantMoveFile"), 0); - MAppSetLanuageItems(0, 9, LanuageMgr.GetStr("ChooseTargetDir"), 0); - - int size = 0; - MAppSetLanuageItems(1, 0, LanuageMgr.GetStr2("Moveing", out size), size); - MAppSetLanuageItems(1, 1, LanuageMgr.GetStr2("Copying", out size), size); - MAppSetLanuageItems(1, 2, LanuageMgr.GetStr2("FileExist", out size), size); - MAppSetLanuageItems(1, 3, LanuageMgr.GetStr2("FileExist2", out size), size); - MAppSetLanuageItems(1, 4, LanuageMgr.GetStr2("TitleQuestion", out size), size); - MAppSetLanuageItems(1, 5, LanuageMgr.GetStr2("TipTitle", out size), size); - MAppSetLanuageItems(1, 6, LanuageMgr.GetStr2("DelSure", out size), size); - MAppSetLanuageItems(1, 7, LanuageMgr.GetStr2("DelAsk1", out size), size); - MAppSetLanuageItems(1, 8, LanuageMgr.GetStr2("DelAsk2", out size), size); - MAppSetLanuageItems(1, 9, LanuageMgr.GetStr2("DelAsk3", out size), size); - MAppSetLanuageItems(1, 10, LanuageMgr.GetStr2("DeleteIng", out size), size); - MAppSetLanuageItems(1, 11, LanuageMgr.GetStr2("NoAdminTipText", out size), size); - MAppSetLanuageItems(1, 12, LanuageMgr.GetStr2("NoAdminTipTitle", out size), size); - MAppSetLanuageItems(1, 13, LanuageMgr.GetStr2("DelFailed", out size), size); - MAppSetLanuageItems(1, 14, str_idle_process, str_idle_process.Length + 1); - MAppSetLanuageItems(1, 15, LanuageMgr.GetStr2("EndProcFailed", out size), size); - MAppSetLanuageItems(1, 16, LanuageMgr.GetStr2("OpenProcFailed", out size), size); - MAppSetLanuageItems(1, 17, LanuageMgr.GetStr2("SusProcFailed", out size), size); - MAppSetLanuageItems(1, 18, LanuageMgr.GetStr2("ResProcFailed", out size), size); - MAppSetLanuageItems(1, 19, LanuageMgr.GetStr2("MenuRebootAsAdmin", out size), size); - MAppSetLanuageItems(1, 20, LanuageMgr.GetStr2("Visible", out size), size); - MAppSetLanuageItems(1, 21, LanuageMgr.GetStr2("CantGetPath", out size), size); - MAppSetLanuageItems(1, 22, LanuageMgr.GetStr2("FreeLibSuccess", out size), size); - MAppSetLanuageItems(1, 23, LanuageMgr.GetStr2("Priority", out size), size); - MAppSetLanuageItems(1, 24, LanuageMgr.GetStr2("EntryPoint", out size), size); - MAppSetLanuageItems(1, 25, LanuageMgr.GetStr2("ModuleName", out size), size); - MAppSetLanuageItems(1, 26, LanuageMgr.GetStr2("State", out size), size); - MAppSetLanuageItems(1, 27, LanuageMgr.GetStr2("ContextSwitch", out size), size); - MAppSetLanuageItems(1, 28, LanuageMgr.GetStr2("ModulePath", out size), size); - MAppSetLanuageItems(1, 29, LanuageMgr.GetStr2("Address", out size), size); - MAppSetLanuageItems(1, 30, LanuageMgr.GetStr2("Size", out size), size); - MAppSetLanuageItems(1, 31, LanuageMgr.GetStr2("TitlePublisher", out size), size); - MAppSetLanuageItems(1, 32, LanuageMgr.GetStr2("WindowText", out size), size); - MAppSetLanuageItems(1, 33, LanuageMgr.GetStr2("WindowHandle", out size), size); - MAppSetLanuageItems(1, 34, LanuageMgr.GetStr2("WindowClassName", out size), size); - MAppSetLanuageItems(1, 35, LanuageMgr.GetStr2("BelongThread", out size), size); - MAppSetLanuageItems(1, 36, LanuageMgr.GetStr2("VWinTitle", out size), size); - MAppSetLanuageItems(1, 37, LanuageMgr.GetStr2("VModulTitle", out size), size); - MAppSetLanuageItems(1, 38, LanuageMgr.GetStr2("VThreadTitle", out size), size); - MAppSetLanuageItems(1, 39, LanuageMgr.GetStr2("EnumModuleFailed", out size), size); - MAppSetLanuageItems(1, 40, LanuageMgr.GetStr2("EnumThreadFailed", out size), size); - MAppSetLanuageItems(1, 41, LanuageMgr.GetStr2("FreeInvalidProc", out size), size); - MAppSetLanuageItems(1, 42, LanuageMgr.GetStr2("FreeFailed", out size), size); - MAppSetLanuageItems(1, 43, LanuageMgr.GetStr2("KillThreadError", out size), size); - MAppSetLanuageItems(1, 44, LanuageMgr.GetStr2("KillThreadInvThread", out size), size); - MAppSetLanuageItems(1, 45, LanuageMgr.GetStr2("OpenThreadFailed", out size), size); - MAppSetLanuageItems(1, 46, LanuageMgr.GetStr2("SuThreadErr", out size), size); - MAppSetLanuageItems(1, 47, LanuageMgr.GetStr2("ReThreadErr", out size), size); - MAppSetLanuageItems(1, 48, LanuageMgr.GetStr2("InvThread", out size), size); - MAppSetLanuageItems(1, 49, LanuageMgr.GetStr2("SuThreadWarn", out size), size); - MAppSetLanuageItems(1, 50, LanuageMgr.GetStr2("KernelNotLoad", out size), size); - - MAppSetLanuageItems(2, 0, LanuageMgr.GetStr2("DelStartupItemAsk", out size), size); - MAppSetLanuageItems(2, 1, LanuageMgr.GetStr2("DelStartupItemAsk2", out size), size); - MAppSetLanuageItems(2, 2, str_endtask, str_endtask.Length + 1); - MAppSetLanuageItems(2, 3, str_resrat, str_resrat.Length + 1); - MAppSetLanuageItems(2, 4, LanuageMgr.GetStr2("LoadDriver", out size), size); - MAppSetLanuageItems(2, 5, LanuageMgr.GetStr2("UnLoadDriver", out size), size); - MAppSetLanuageItems(2, 6, str_FileNotExist, str_FileNotExist.Length + 1); - MAppSetLanuageItems(2, 7, LanuageMgr.GetStr2("FileTrust", out size), size); - MAppSetLanuageItems(2, 8, LanuageMgr.GetStr2("FileNotTrust", out size), size); - MAppSetLanuageItems(2, 9, LanuageMgr.GetStr2("OpenServiceError", out size), size); - MAppSetLanuageItems(2, 10, LanuageMgr.GetStr2("DelScError", out size), size); - MAppSetLanuageItems(2, 11, LanuageMgr.GetStr2("ChangeScStartTypeFailed", out size), size); - MAppSetLanuageItems(2, 12, str_SetTo, str_SetTo.Length + 1); - MAppSetLanuageItems(2, 13, str_KillTreeAskEnd, str_KillTreeAskEnd.Length + 1); - MAppSetLanuageItems(2, 14, str_KillTreeContent, str_KillTreeContent.Length + 1); - MAppSetLanuageItems(2, 15, LanuageMgr.GetStr2("WantDisconnectUser", out size), size); - MAppSetLanuageItems(2, 16, LanuageMgr.GetStr2("WantLogooffUser", out size), size); - MAppSetLanuageItems(2, 17, LanuageMgr.GetStr2("PleaseEnterPassword", out size), size); - MAppSetLanuageItems(2, 18, LanuageMgr.GetStr2("ConnectSessionFailed", out size), size); - MAppSetLanuageItems(2, 19, LanuageMgr.GetStr2("ConnectSession", out size), size); - MAppSetLanuageItems(2, 20, LanuageMgr.GetStr2("DisConnectSession", out size), size); - MAppSetLanuageItems(2, 21, LanuageMgr.GetStr2("DisConnectSessionFailed", out size), size); - MAppSetLanuageItems(2, 22, LanuageMgr.GetStr2("LogoffSession", out size), size); - MAppSetLanuageItems(2, 23, LanuageMgr.GetStr2("DisConnectSessionFailed1", out size), size); - MAppSetLanuageItems(2, 24, LanuageMgr.GetStr2("SetProcPriorityClassFailed", out size), size); - MAppSetLanuageItems(2, 25, LanuageMgr.GetStr2("SetProcAffinityFailed", out size), size); - MAppSetLanuageItems(2, 26, str_WarnTitle, str_WarnTitle.Length + 1); - MAppSetLanuageItems(2, 27, LanuageMgr.GetStr2("LoadDriverWarn", out size), size); - MAppSetLanuageItems(2, 28, LanuageMgr.GetStr2("LoadDriverWarnTitle", out size), size); - MAppSetLanuageItems(2, 29, LanuageMgr.GetStr2("DetachDebuggerTitle", out size), size); - MAppSetLanuageItems(2, 30, LanuageMgr.GetStr2("DetachDebuggerError", out size), size); - MAppSetLanuageItems(2, 31, LanuageMgr.GetStr2("DetachDebuggerNotDebugger", out size), size); - MAppSetLanuageItems(2, 32, LanuageMgr.GetStr2("ChangePriorityAsk", out size), size); - MAppSetLanuageItems(2, 33, LanuageMgr.GetStr2("ChangePriorityContent", out size), size); - MAppSetLanuageItems(2, 34, LanuageMgr.GetStr2("OpenFileError", out size), size); - MAppSetLanuageItems(2, 35, LanuageMgr.GetStr2("CreateDumpFailed", out size), size); - MAppSetLanuageItems(2, 36, LanuageMgr.GetStr2("CreateDumpSuccess", out size), size); - MAppSetLanuageItems(2, 37, LanuageMgr.GetStr2("PleaseEnumIn64", out size), size); - - - } - catch (Exception e) - { - MessageBox.Show(e.ToString(), "ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - private string Native_LanuageItems_CallBack(string s) - { - return LanuageMgr.GetStr(s); - } - - #endregion - - #region StartMWork - - //å¯åŠ¨é¡¹ 页é¢ï¼ˆå€Ÿé‰´äº†PCHunter) - - private TaskMgrListItemGroup knowDlls = null; - private TaskMgrListItemGroup rightMenu1 = null; - private TaskMgrListItemGroup rightMenu2 = null; - private TaskMgrListItemGroup rightMenu3 = null; - private TaskMgrListItemGroup printMonitors = null; - private TaskMgrListItemGroup printProviders = null; - - private TaskListViewUWPColumnSorter startColumnSorter = new TaskListViewUWPColumnSorter(); - private static uint startId = 0; - - private struct startitem - { - public uint id; - public startitem(string s, IntPtr rootregpath, string path, string valuename) - { - this.filepath = s; this.rootregpath = rootregpath; - this.path = path; - this.valuename = valuename; - id = startId++; - } - public string valuename; - public string path; - public string filepath; - public IntPtr rootregpath; - } - private void StartMListInit() - { - if (!startListInited) - { - listStartup.ListViewItemSorter = startColumnSorter; - listStartup.Header.CloumClick += StartList_Header_CloumClick; - - enumStartupsCallBack = StartMList_CallBack; - enumStartupsCallBackPtr = Marshal.GetFunctionPointerForDelegate(enumStartupsCallBack); - knowDlls = new TaskMgrListItemGroup("Know Dlls"); - knowDlls.Text = "Know Dlls"; - knowDlls.Icon = Properties.Resources.icoFiles; - for (int i = 0; i < 5; i++) - knowDlls.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - knowDlls.Type = TaskMgrListItemType.ItemGroup; - knowDlls.DisplayChildCount = true; - rightMenu1 = new TaskMgrListItemGroup("RightMenu 1"); - rightMenu1.Text = "RightMenu 1"; - for (int i = 0; i < 5; i++) - rightMenu1.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - rightMenu1.Type = TaskMgrListItemType.ItemGroup; - rightMenu1.DisplayChildCount = true; - rightMenu1.Image = Properties.Resources.iconContextMenu; - rightMenu2 = new TaskMgrListItemGroup("RightMenu 2"); - rightMenu2.Text = "RightMenu 2"; - for (int i = 0; i < 5; i++) - rightMenu2.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - rightMenu2.Type = TaskMgrListItemType.ItemGroup; - rightMenu2.DisplayChildCount = true; - rightMenu2.Image = Properties.Resources.iconContextMenu; - rightMenu3 = new TaskMgrListItemGroup("RightMenu 3"); - rightMenu3.Text = "RightMenu 3"; - for (int i = 0; i < 5; i++) - rightMenu3.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - rightMenu3.Type = TaskMgrListItemType.ItemGroup; - rightMenu3.DisplayChildCount = true; - rightMenu3.Image = Properties.Resources.iconContextMenu; - - printMonitors = new TaskMgrListItemGroup("PrintMonitors"); - printMonitors.Text = "PrintMonitors"; - for (int i = 0; i < 5; i++) - printMonitors.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - printMonitors.Type = TaskMgrListItemType.ItemGroup; - printMonitors.DisplayChildCount = true; - printMonitors.Icon = Properties.Resources.icoWins; - - printProviders = new TaskMgrListItemGroup("PrintProviders"); - printProviders.Text = "PrintProviders"; - for (int i = 0; i < 5; i++) - printProviders.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - printProviders.Type = TaskMgrListItemType.ItemGroup; - printProviders.DisplayChildCount = true; - printProviders.Icon = Properties.Resources.icoWins; - - StartMListRefesh(); - startListInited = true; - } - } - private void StartMListRefesh() - { - knowDlls.Childs.Clear(); - rightMenu2.Childs.Clear(); - rightMenu1.Childs.Clear(); - listStartup.Items.Clear(); - startId = 0; - - MEnumStartups(enumStartupsCallBackPtr); - - if (knowDlls.Childs.Count > 0) listStartup.Items.Add(knowDlls); - if (rightMenu1.Childs.Count > 0) listStartup.Items.Add(rightMenu1); - if (rightMenu2.Childs.Count > 0) listStartup.Items.Add(rightMenu2); - if (rightMenu3.Childs.Count > 0) listStartup.Items.Add(rightMenu3); - if (printMonitors.Childs.Count > 0) listStartup.Items.Add(printMonitors); - if (printProviders.Childs.Count > 0) listStartup.Items.Add(printProviders); - } - private void StartMList_CallBack(IntPtr name, IntPtr type, IntPtr path, IntPtr rootregpath, IntPtr regpath, IntPtr regvalue) - { - bool settoblue = false; - TaskMgrListItem li = new TaskMgrListItem(Marshal.PtrToStringUni(name)); - for (int i = 0; i < 5; i++) li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem() { Font = listStartup.Font }); - li.IsFullData = true; - li.SubItems[0].Text = li.Text; - // li.SubItems[1].Text = Marshal.PtrToStringUni(type); - li.Type = TaskMgrListItemType.ItemMain; - StringBuilder filePath = null; - if (path != IntPtr.Zero) - { - string pathstr = Marshal.PtrToStringUni(path); - if (!pathstr.StartsWith("\"")) { pathstr = "\"" + pathstr + "\""; } - li.SubItems[1].Text = (pathstr); - filePath = new StringBuilder(260); - if (MCommandLineToFilePath(pathstr, filePath, 260)) - { - li.SubItems[2].Text = filePath.ToString(); - pathstr = filePath.ToString(); - if (MFM_FileExist(pathstr)) - { - li.Icon = Icon.FromHandle(MGetExeIcon(pathstr)); - StringBuilder exeCompany = new StringBuilder(256); - if (MGetExeCompany(pathstr, exeCompany, 256)) - { - li.SubItems[3].Text = exeCompany.ToString(); - if (highlight_nosystem && li.SubItems[3].Text != MICROSOFT) - settoblue = true; - } - else if (highlight_nosystem) - settoblue = true; - } - else if (MFM_FileExist("C:\\WINDOWS\\system32\\" + pathstr)) - { - if (pathstr.EndsWith(".exe")) - li.Icon = Icon.FromHandle(MGetExeIcon(@"C:\Windows\System32\" + pathstr)); - StringBuilder exeCompany = new StringBuilder(256); - if (MGetExeCompany(@"C:\Windows\System32\" + pathstr, exeCompany, 256)) - { - li.SubItems[3].Text = exeCompany.ToString(); - if (highlight_nosystem && li.SubItems[3].Text != MICROSOFT) - settoblue = true; - } - else if (highlight_nosystem) - settoblue = true; - } - else if (MFM_FileExist("C:\\WINDOWS\\SysWOW64\\" + pathstr)) - { - if (pathstr.EndsWith(".exe")) - li.Icon = Icon.FromHandle(MGetExeIcon(@"C:\Windows\SysWOW64\" + pathstr)); - StringBuilder exeCompany = new StringBuilder(256); - if (MGetExeCompany(@"C:\Windows\SysWOW64\" + pathstr, exeCompany, 256)) - { - li.SubItems[3].Text = exeCompany.ToString(); - if (highlight_nosystem && li.SubItems[3].Text != MICROSOFT) - settoblue = true; - } - else if (highlight_nosystem) - settoblue = true; - } - else if (pathstr.StartsWith("wow64") && pathstr.EndsWith(".dll")) - { -#if !_X64_ - if (!MIs64BitOS()) - { - if (highlight_nosystem) - settoblue = true; - li.SubItems[3].Text = str_FileNotExist; - } -#endif - if (pathstr != "wow64.dll" && pathstr != "wow64cpu.dll" && pathstr != "wow64win.dll") - { - if (highlight_nosystem) - settoblue = true; - li.SubItems[3].Text = str_FileNotExist; - } - } - else - { - if (highlight_nosystem) - settoblue = true; - li.SubItems[3].Text = str_FileNotExist; - } - } - } - - string rootkey = Marshal.PtrToStringUni(MREG_ROOTKEYToStr(rootregpath)); - string regkey = rootkey + "\\" + Marshal.PtrToStringUni(regpath); - string regvalues = Marshal.PtrToStringUni(regvalue); - li.SubItems[4].Text = regkey + "\\" + regvalues; - li.Tag = new startitem(filePath == null ? null : filePath.ToString(), rootregpath, Marshal.PtrToStringUni(regpath), regvalues); - - string typestr = Marshal.PtrToStringUni(type); - if (typestr == "KnownDLLs") - { - li.Image = imageListFileTypeList.Images[".dll"]; - knowDlls.Childs.Add(li); - } - else if (typestr == "RightMenu1") - rightMenu1.Childs.Add(li); - else if (typestr == "RightMenu2") - rightMenu2.Childs.Add(li); - else if (typestr == "RightMenu3") - rightMenu3.Childs.Add(li); - else if (typestr == "PrintMonitors") - printMonitors.Childs.Add(li); - else if (typestr == "PrintProviders") - printProviders.Childs.Add(li); - - else listStartup.Items.Add(li); - if (settoblue) - for (int i = 0; i < 5; i++) - li.SubItems[i].ForeColor = Color.Blue; - } - private void StartMListRemoveItem(uint id) - { - TaskMgrListItem target = null; - foreach (TaskMgrListItem li in listStartup.Items) - { - if (li.Tag != null) - { - startitem item = (startitem)li.Tag; - if (item.id == id) - { - target = li; - break; - } - } - } - if (target != null) - { - listStartup.Items.Remove(target); - listStartup.SyncItems(true); - } - } - - private void StartMListExpandAll() - { - listStartup.Locked = true; - foreach (TaskMgrListItem li in listStartup.Items) - { - if (li.Childs.Count > 0 && !li.ChildsOpened) - li.ChildsOpened = true; - } - listStartup.Locked = false; - listStartup.SyncItems(true); - } - private void StartMListCollapseAll() - { - listStartup.Locked = true; - foreach (TaskMgrListItem li in listStartup.Items) - { - if (li.Childs.Count > 0 && li.ChildsOpened) - li.ChildsOpened = false; - } - listStartup.Locked = false; - listStartup.SyncItems(true); - } - - private void listStartup_MouseClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (listStartup.SelectedItem != null) - { - TaskMgrListItem selectedItem = listStartup.SelectedItem.OldSelectedItem == null ? - listStartup.SelectedItem : listStartup.SelectedItem.OldSelectedItem; - if (selectedItem.Type == TaskMgrListItemType.ItemMain) - { - startitem item = (startitem)selectedItem.Tag; - MStartupsMgr_ShowMenu(item.rootregpath, item.path, item.filepath, item.valuename, item.id, 0, 0); - } - } - } - } - private void listStartup_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Apps) - { - if (listStartup.SelectedItem != null) - { - Point p = listStartup.GetiItemPoint(listStartup.SelectedItem); - p = listStartup.PointToScreen(p); - startitem item = (startitem)listStartup.SelectedItem.Tag; - MStartupsMgr_ShowMenu(item.rootregpath, item.path, item.filepath, item.valuename, item.id, p.X, p.Y); - } - } - } - - private void StartList_Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) - { - if (e.MouseEventArgs.Button == MouseButtons.Left) - { - listStartup.Locked = true; - if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) - startColumnSorter.Order = SortOrder.Ascending; - else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) - startColumnSorter.Order = SortOrder.Ascending; - else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) - startColumnSorter.Order = SortOrder.Descending; - startColumnSorter.SortColumn = e.Index; - listStartup.Locked = false; - listStartup.Sort(); - } - } - - #endregion - - #region KernelMWork - - //å†…æ ¸é©±åŠ¨æžšä¸¾ä»£ç  - - private class ListViewItemComparerKr : IComparer - { - private int col; - private bool asdening = false; - - public int SortColum { get { return col; } set { col = value; } } - public bool Asdening { get { return asdening; } set { asdening = value; } } - - public int Compare(object o1, object o2) - { - ListViewItem x = o1 as ListViewItem, y = o2 as ListViewItem; - int returnVal = -1; - if (x.SubItems[col].Text == y.SubItems[col].Text) return -1; - if (col == 6) - { - int xi, yi; - if (int.TryParse(x.SubItems[col].Text, out xi) && int.TryParse(y.SubItems[col].Text, out yi)) - { - if (x.SubItems[col].Text == y.SubItems[col].Text) returnVal = 0; - else if (xi > yi) returnVal = 1; - else if (xi < yi) returnVal = -1; - } - } - else returnVal = String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); - if (asdening) returnVal = -returnVal; - return returnVal; - } - } - - private IntPtr hListHeaderDrv = IntPtr.Zero; - - private ListViewItemComparerKr listViewItemComparerKr = new ListViewItemComparerKr(); - private bool showAllDriver = false; - private bool canUseKernel = false; - - private void KernelListInit() - { - if (!driverListInited) - { - if (canUseKernel) - { - enumKernelModulsCallBack = KernelEnumCallBack; - enumKernelModulsCallBackPtr = Marshal.GetFunctionPointerForDelegate(enumKernelModulsCallBack); - - listViewItemComparerKr.SortColum = 6; - listDrivers.ListViewItemSorter = listViewItemComparerKr; - MAppWorkCall3(182, listDrivers.Handle, IntPtr.Zero); - hListHeaderDrv = ComCtlApi.MListViewGetHeaderControl(listDrivers.Handle, false); - - KernelLisRefesh(); - } - else - { - listDrivers.Hide(); - pl_driverNotLoadTip.Show(); - linkRestartAsAdminDriver.Visible = !MIsRunasAdmin(); - } - driverListInited = true; - } - } - private void KernelEnumCallBack(IntPtr kmi, IntPtr BaseDllName, IntPtr FullDllPath, IntPtr FullDllPathOrginal, IntPtr szEntryPoint, IntPtr SizeOfImage, IntPtr szDriverObject, IntPtr szBase, IntPtr szServiceName, uint Order) - { - if (Order == 9999) - { - if (showAllDriver) lbDriversCount.Text = str_DriverCountLoaded + kmi.ToInt32() + " " + str_DriverCount + BaseDllName.ToInt32(); - else -#if _X64_ - lbDriversCount.Text = str_DriverCount + kmi.ToInt64(); -#else - lbDriversCount.Text = str_DriverCount + kmi.ToInt32(); -#endif - - return; - } - - string baseDllName = Marshal.PtrToStringUni(BaseDllName); - string fullDllPath = Marshal.PtrToStringUni(FullDllPath); - - ListViewItem li = new ListViewItem(baseDllName); - li.Tag = kmi; - //7 emepty items - for (int i = 0; i < 8; i++) li.SubItems.Add(new ListViewItem.ListViewSubItem() { Font = listDrivers.Font }); - - if (Order != 10000) - { - li.SubItems[0].Text = baseDllName; - li.SubItems[1].Text = Marshal.PtrToStringUni(szBase); - li.SubItems[2].Text = Marshal.PtrToStringUni(SizeOfImage); - li.SubItems[3].Text = Marshal.PtrToStringUni(szDriverObject); - li.SubItems[4].Text = fullDllPath; - li.SubItems[5].Text = Marshal.PtrToStringUni(szServiceName); - li.SubItems[6].Text = Order.ToString(); - } - else - { - li.SubItems[0].Text = baseDllName; - li.SubItems[1].Text = "-"; - li.SubItems[2].Text = "-"; - li.SubItems[3].Text = "-"; - li.SubItems[4].Text = fullDllPath; - li.SubItems[5].Text = Marshal.PtrToStringUni(szServiceName); - li.SubItems[6].Text = "-"; - } - - bool hightlight = false; - if (MFM_FileExist(fullDllPath)) - { - StringBuilder exeCompany = new StringBuilder(256); - if (MGetExeCompany(fullDllPath, exeCompany, 256)) - { - li.SubItems[7].Text = exeCompany.ToString(); - if (highlight_nosystem && exeCompany.ToString() != MICROSOFT) - hightlight = true; - } - else if (highlight_nosystem) hightlight = true; - if (hightlight) - { - li.ForeColor = Color.Blue; - foreach (ListViewItem.ListViewSubItem s in li.SubItems) - s.ForeColor = Color.Blue; - } - } - else - { - li.SubItems[7].Text = str_FileNotExist; - if (highlight_nosystem) hightlight = true; - } - if (hightlight) - { - li.ForeColor = Color.Blue; - foreach (ListViewItem.ListViewSubItem s in li.SubItems) - s.ForeColor = Color.Blue; - } - - listDrivers.Items.Add(li); - } - private void KernelLisRefesh() - { - if (canUseKernel) - { - foreach (ListViewItem li in listDrivers.Items) - { - IntPtr kmi = (IntPtr)li.Tag; - if (kmi != IntPtr.Zero) - M_SU_EnumKernelModulsItemDestroy(kmi); - } - listDrivers.Items.Clear(); - M_SU_EnumKernelModuls(enumKernelModulsCallBackPtr, showAllDriver); - } - } - private void KernelListUnInit() - { - foreach (ListViewItem li in listDrivers.Items) - { - IntPtr kmi = (IntPtr)li.Tag; - if (kmi != IntPtr.Zero) - M_SU_EnumKernelModulsItemDestroy(kmi); - } - listDrivers.Items.Clear(); - } - - private void linkRestartAsAdminDriver_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - SetConfig("LoadKernelDriver", "Configure", "TRUE"); - MAppRebotAdmin2("select kernel"); - } - private void linkLabelShowKernelTools_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - MessageBox.Show("The function aren't complete. "); - } - - private void listDrivers_MouseUp(object sender, MouseEventArgs e) - { - if (listDrivers.SelectedItems.Count > 0) - { - if (e.Button == MouseButtons.Right) M_SU_EnumKernelModuls_ShowMenu((IntPtr)listDrivers.SelectedItems[0].Tag, showAllDriver, 0, 0); - } - } - private void listDrivers_ColumnClick(object sender, ColumnClickEventArgs e) - { - ((ListViewItemComparerKr)listDrivers.ListViewItemSorter).Asdening = !((ListViewItemComparerKr)listDrivers.ListViewItemSorter).Asdening; - ((ListViewItemComparerKr)listDrivers.ListViewItemSorter).SortColum = e.Column; - ComCtlApi.MListViewSetColumnSortArrow(hListHeaderSc, ((ListViewItemComparer)listService.ListViewItemSorter).SortColum, - ((ListViewItemComparer)listService.ListViewItemSorter).Asdening, false); - listDrivers.Sort(); - } - private void listDrivers_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Apps) - { - if (listDrivers.SelectedItems.Count > 0) - { - ListViewItem item = listDrivers.SelectedItems[0]; - Point p = item.Position; p.X = 0; - p = listService.PointToScreen(p); - M_SU_EnumKernelModuls_ShowMenu((IntPtr)item.Tag, showAllDriver, p.X, p.Y); - } - } - } - - public void ShowFormHooks() - { - MessageBox.Show("The function aren't complete. "); - } - - #endregion - - #region UsersWork - - //ç”¨æˆ·é¡µä»£ç  - - private void UsersListInit() - { - if (!usersListInited) - { - enumUsersCallBack = UsersListEnumUsersCallBack; - enumUsersCallBackCallBack_ptr = Marshal.GetFunctionPointerForDelegate(enumUsersCallBack); - - UsersListLoad(); - usersListInited = true; - } - } - private void UsersListUnInit() - { - if (usersListInited) - { - listUsers.Items.Clear(); - } - } - private void UsersListLoad() - { - listUsers.Items.Clear(); - MEnumUsers(enumUsersCallBackCallBack_ptr, IntPtr.Zero); - } - - private void listUsers_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Apps) - { - if (listUsers.SelectedItem != null) - { - Point p = listStartup.GetiItemPoint(listUsers.SelectedItem); - p = listUsers.PointToScreen(p); - - MAppWorkCall3(212, new IntPtr(p.X), new IntPtr(p.Y)); - IntPtr str = Marshal.StringToHGlobalUni(listUsers.SelectedItem.SubItems[0].Text); - MAppWorkCall3(170, Handle, str); - Marshal.FreeHGlobal(str); - MAppWorkCall3(175, Handle, new IntPtr((int)(uint)listUsers.SelectedItem.Tag)); - } - } - } - private void listUsers_MouseClick(object sender, MouseEventArgs e) - { - if (listUsers.SelectedItem != null) - { - if (e.Button == MouseButtons.Right) - { - MAppWorkCall3(212, new IntPtr(MousePosition.X), new IntPtr(MousePosition.Y)); - IntPtr str = Marshal.StringToHGlobalUni(listUsers.SelectedItem.SubItems[0].Text); - MAppWorkCall3(170, Handle, str); - Marshal.FreeHGlobal(str); - MAppWorkCall3(175, Handle, new IntPtr((int)(uint)listUsers.SelectedItem.Tag)); - } - } - } - - private bool UsersListEnumUsersCallBack(IntPtr userName, uint sessionId, uint userId, IntPtr domain, IntPtr customData) - { - string name = Marshal.PtrToStringUni(userName); - string domainStr = Marshal.PtrToStringUni(domain); - TaskMgrListItem li = new TaskMgrListItem(name); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); - li.SubItems[0].Text = name; - li.SubItems[1].Text = userId.ToString(); - li.SubItems[2].Text = sessionId.ToString(); - li.SubItems[3].Text = domainStr; - li.SubItems[0].Font = listUsers.Font; - li.SubItems[1].Font = listUsers.Font; - li.SubItems[2].Font = listUsers.Font; - li.SubItems[3].Font = listUsers.Font; - li.Tag = sessionId; - listUsers.Items.Add(li); - return true; - } - - #endregion + tabControlMain.Show(); + MAppWorkCall3(163, IntPtr.Zero, IntPtr.Zero); + listProcess.Locked = false; + mainPageProcess.ProcessListForceRefeshAll(); + } + } + } + internal bool Is64OS { get; private set; } + internal bool IsAdmin { get; private set; } + internal bool IsKernelLoaded { get; private set; } + + internal Size LastSimpleSize { get; set; } + internal Size LastSize { get; set; } + internal MainNativeBridge MainNativeBridge { get { return mainNativeBridge; } } + internal MainPageScMgr MainPageScMgr { get { return mainPageScMgr; } } + internal MainPageUwpMgr MainPageUwpMgr { get { return mainPageUwpMgr; } } + internal MainPageProcess MainPageProcess { get { return mainPageProcess; } } + internal MainPageProcessDetails MainPageProcessDetails { get { return mainPageProcessDetails; } } + internal MainPageKernelDrvMgr MainPageKernelDrvMgr { get { return mainPageKernelDrvMgr; } } + internal MainPageStartMgr MainPageStartMgr { get { return mainPageStartMgr; } } + internal MainSettings MainSettings { get; private set; } + + private MainNativeBridge mainNativeBridge = null; + private MainPageProcess mainPageProcess = null; + private MainPageProcessDetails mainPageProcessDetails = null; + private MainPageKernelDrvMgr mainPageKernelDrvMgr = null; + private MainPageFileMgr mainPageFileMgr = null; + private MainPagePerf mainPagePerf = null; + private MainPageScMgr mainPageScMgr = null; + private MainPageStartMgr mainPageStartMgr = null; + private MainPageUserMgr mainPageUserMgr = null; + private MainPageUwpMgr mainPageUwpMgr = null; #region NotifyWork @@ -6386,17 +165,17 @@ private bool UsersListEnumUsersCallBack(IntPtr userName, uint sessionId, uint us private FormDelFileProgress delingdialog = null; - private void DelingDialogInitHide() + public void DelingDialogInitHide() { MAppWorkCall3(200, delingdialog.Handle, IntPtr.Zero); } - private void DelingDialogInit() + public void DelingDialogInit() { delingdialog = new FormDelFileProgress(); delingdialog.Show(this); MAppWorkCall3(200, delingdialog.Handle, IntPtr.Zero); } - private void DelingDialogClose() + public void DelingDialogClose() { if (delingdialog != null) { @@ -6404,7 +183,7 @@ private void DelingDialogClose() delingdialog = null; } } - private void ShowHideDelingDialog(bool show) + public void DelingDialogShowHide(bool show) { delingdialog.Invoke(new Action(delegate { @@ -6412,11 +191,11 @@ private void ShowHideDelingDialog(bool show) if (show) { delingdialog.Location = new Point(Left + Width / 2 - delingdialog.Width / 2, Top + Height / 2 - delingdialog.Height / 2); - delingdialog.Text = str_DeleteFiles; + delingdialog.Text = LanuageMgr.GetStr("DeleteFiles"); } })); } - private void DelingDialogUpdate(string path, int value) + public void DelingDialogUpdate(string path, int value) { delingdialog.label.Invoke(new Action(delegate { delingdialog.label.Text = path; })); if (value == -1) @@ -6424,7 +203,7 @@ private void DelingDialogUpdate(string path, int value) delingdialog.progressBar.Invoke(new Action(delegate { delingdialog.progressBar.Style = ProgressBarStyle.Marquee; })); delingdialog.Invoke(new Action(delegate { - delingdialog.Text = str_CollectingFiles; + delingdialog.Text = LanuageMgr.GetStr("CollectingFiles"); })); } else @@ -6443,90 +222,98 @@ private void FileTrustedLink_HyperlinkClick(object sender, HyperlinkEventArgs e) if (!string.IsNullOrEmpty(lastVeryExe)) MShowExeFileSignatureInfo(lastVeryExe); } + public void VeryTrust(string path) + { + lastVeryExe = path; + TaskDialog d = new TaskDialog(LanuageMgr.GetStr("FileTrust"), LanuageFBuffers.Str_TipTitle, (path == null ? "" : path) + "\n\n" + LanuageMgr.GetStr("FileTrustViewCrt")); + d.EnableHyperlinks = true; + d.HyperlinkClick += FileTrustedLink_HyperlinkClick; + d.Show(this); + } - private void StartingProgressShowHide(bool show) + public void StartingProgressShowHide(bool show) { lbStartingStatus.Invoke(new Action(delegate { lbStartingStatus.Visible = show; })); listProcess.Invoke(new Action(delegate { listProcess.Visible = !show; })); } - private void StartingProgressUpdate(string text) + public void StartingProgressUpdate(string text) { lbStartingStatus.Invoke(new Action(delegate { lbStartingStatus.Text = text; })); } - private void ShowNoPdbWarn(string moduleName) + public void ShowNoPdbWarn(string moduleName) { Invoke(new Action(delegate { - TaskDialog noPdbWarnDialog = new TaskDialog(string.Format(LanuageMgr.GetStr("NoPDBWarn"), moduleName), str_TipTitle, string.Format(LanuageMgr.GetStr("NoPDBWarnText"), moduleName, moduleName)); + TaskDialog noPdbWarnDialog = new TaskDialog(string.Format(LanuageMgr.GetStr("NoPDBWarn", false), moduleName), LanuageFBuffers.Str_TipTitle, string.Format(LanuageMgr.GetStr("NoPDBWarnText", false), moduleName, moduleName)); noPdbWarnDialog.EnableHyperlinks = true; noPdbWarnDialog.Show(this); })); } - private bool TermintateImporantProcess(IntPtr name, int id) + public bool TermintateImporantProcess(IntPtr name, int id) { TaskDialog taskDialog = null; if (id == 1)//强制结æŸè­¦å‘Š { - taskDialog = new TaskDialog(str_KillAskStart + " \"" + Marshal.PtrToStringUni(name) + "\" " + str_KillAskEnd, str_AppTitle, str_KillAskContentImporant); - taskDialog.VerificationText = str_KillAskImporantGiveup; + taskDialog = new TaskDialog(LanuageMgr.GetStr("KillAskStart") + " \"" + Marshal.PtrToStringUni(name) + "\" " + LanuageMgr.GetStr("KillAskEnd"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("KillAskContentImporant")); + taskDialog.VerificationText = LanuageMgr.GetStr("KillAskImporantGiveup"); taskDialog.VerificationClick += TermintateImporantProcess_TaskDialog_VerificationClick; taskDialog.CustomButtons = new CustomButton[] { - new CustomButton(1, str_Close), - new CustomButton(2, str_Cancel), + new CustomButton(1, LanuageFBuffers.Str_Close), + new CustomButton(2, LanuageFBuffers.Str_Cancel), }; taskDialog.EnableButton(1, false); } if (id == 2)//强制暂åœè­¦å‘Š { - taskDialog = new TaskDialog(str_SuspendStart + " \"" + Marshal.PtrToStringUni(name) + "\" " + str_SuspendEnd, - str_AppTitle, str_SuspendWarnContent); - taskDialog.VerificationText = str_KillAskImporantGiveup; + taskDialog = new TaskDialog(LanuageMgr.GetStr("SuspendStart") + " \"" + Marshal.PtrToStringUni(name) + "\" " + LanuageMgr.GetStr("SuspendEnd"), + LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("SuspendWarnContent")); + taskDialog.VerificationText = LanuageMgr.GetStr("KillAskImporantGiveup"); taskDialog.VerificationClick += TermintateImporantProcess_TaskDialog_VerificationClick; taskDialog.CustomButtons = new CustomButton[] { - new CustomButton(1, str_Close), - new CustomButton(2, str_Cancel), + new CustomButton(1, LanuageFBuffers.Str_Close), + new CustomButton(2, LanuageFBuffers.Str_Cancel), }; taskDialog.EnableButton(1, false); } if (id == 3)//强制结æŸé‡è¦è­¦å‘Š { - taskDialog = new TaskDialog(str_KillAskStart + " \"" + Marshal.PtrToStringUni(name) + "\" " + str_KillAskEnd, - str_TitleVeryWarn, str_KillAskContentVeryImporant); - taskDialog.VerificationText = str_KillAskImporantGiveup; + taskDialog = new TaskDialog(LanuageMgr.GetStr("KillAskStart") + " \"" + Marshal.PtrToStringUni(name) + "\" " + LanuageMgr.GetStr("KillAskEnd"), + LanuageMgr.GetStr("TitleVeryWarn"), LanuageMgr.GetStr("KillAskContentVeryImporant")); + taskDialog.VerificationText = LanuageMgr.GetStr("KillAskImporantGiveup"); taskDialog.VerificationClick += TermintateImporantProcess_TaskDialog_VerificationClick; taskDialog.CustomButtons = new CustomButton[] { - new CustomButton(1, str_Close), - new CustomButton(2, str_Cancel), + new CustomButton(1, LanuageFBuffers.Str_Close), + new CustomButton(2, LanuageFBuffers.Str_Cancel), }; taskDialog.EnableButton(1, false); } if (id == 4)//强制暂åœé‡è¦é‡è¦è­¦å‘Š { - taskDialog = new TaskDialog(str_SuspendStart + " \"" + Marshal.PtrToStringUni(name) + "\" " + str_SuspendEnd, - str_TitleVeryWarn, str_SuspendVeryImporantWarnContent); - taskDialog.VerificationText = str_KillAskImporantGiveup; + taskDialog = new TaskDialog(LanuageMgr.GetStr("SuspendStart") + " \"" + Marshal.PtrToStringUni(name) + "\" " + LanuageMgr.GetStr("SuspendEnd"), + LanuageMgr.GetStr("TitleVeryWarn"), LanuageMgr.GetStr("SuspendVeryImporantWarnContent")); + taskDialog.VerificationText = LanuageMgr.GetStr("KillAskImporantGiveup"); taskDialog.VerificationClick += TermintateImporantProcess_TaskDialog_VerificationClick; taskDialog.CustomButtons = new CustomButton[] { - new CustomButton(1, str_Close), - new CustomButton(2, str_Cancel), + new CustomButton(1, LanuageFBuffers.Str_Close), + new CustomButton(2, LanuageFBuffers.Str_Cancel), }; taskDialog.EnableButton(1, false); } if (id == 5)//æš‚åœå½“å‰è¿›ç¨‹è­¦å‘Š { - taskDialog = new TaskDialog(str_SuspendThisTitle, str_AppTitle, str_SuspendThisText); - taskDialog.VerificationText = str_SuspendCheckText; + taskDialog = new TaskDialog(LanuageMgr.GetStr("SuspendThisTitle"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("SuspendThisText")); + taskDialog.VerificationText = LanuageMgr.GetStr("SuspendCheckText"); taskDialog.VerificationClick += TermintateImporantProcess_TaskDialog_VerificationClick; taskDialog.CustomButtons = new CustomButton[] { - new CustomButton(1, str_Yes), - new CustomButton(2, str_No), + new CustomButton(1, LanuageFBuffers.Str_Yes), + new CustomButton(2, LanuageFBuffers.Str_No), }; taskDialog.EnableButton(1, false); } @@ -6534,7 +321,7 @@ private bool TermintateImporantProcess(IntPtr name, int id) Results rs = taskDialog.Show(this); return rs.ButtonID == 1; } - private void TermintateImporantProcess_TaskDialog_VerificationClick(object sender, CheckEventArgs e) + public void TermintateImporantProcess_TaskDialog_VerificationClick(object sender, CheckEventArgs e) { TaskDialog taskDialog = sender as TaskDialog; taskDialog.EnableButton(1, e.IsChecked); @@ -6542,45 +329,6 @@ private void TermintateImporantProcess_TaskDialog_VerificationClick(object sende #endregion - #region Callbacks - - //所有 Native 回调 - - private static LanuageItems_CallBack lanuageItems_CallBack; - - private EnumUsersCallBack enumUsersCallBack; - - private MProcessMonitor.ProcessMonitorNewItemCallBack ProcessNewItemCallBackDetails; - private MProcessMonitor.ProcessMonitorRemoveItemCallBack ProcessRemoveItemCallBackDetails; - - private MProcessMonitor.ProcessMonitorNewItemCallBack ProcessNewItemCallBack; - private MProcessMonitor.ProcessMonitorRemoveItemCallBack ProcessRemoveItemCallBack; - - private EnumWinsCallBack enumWinsCallBack; - private GetWinsCallBack getWinsCallBack; - - private IntPtr enumUsersCallBackCallBack_ptr; - private IntPtr ptrProcessNewItemCallBack; - private IntPtr ptrProcessRemoveItemCallBack; - private IntPtr ptrProcessNewItemCallBackDetails; - private IntPtr ptrProcessRemoveItemCallBackDetails; - private WNDPROC coreWndProc = null; - private EXITCALLBACK exitCallBack; - private WORKERCALLBACK workerCallBack; - private TerminateImporantWarnCallBack terminateImporantWarnCallBack; - private MFCALLBACK fileMgrCallBack; - - private EnumServicesCallBack scMgrEnumServicesCallBack; - private IntPtr scMgrEnumServicesCallBackPtr = IntPtr.Zero; - - private EnumStartupsCallBack enumStartupsCallBack; - private IntPtr enumStartupsCallBackPtr = IntPtr.Zero; - - private EnumKernelModulsCallBack enumKernelModulsCallBack; - private IntPtr enumKernelModulsCallBackPtr = IntPtr.Zero; - - #endregion - private void BaseProcessRefeshTimer_Tick(object sender, EventArgs e) { //整体刷新定时器 @@ -6592,96 +340,10 @@ private void BaseProcessRefeshTimer_Tick(object sender, EventArgs e) bool perfsimpleGeted = false; - if (perfMainInited && IsWindowVisible(formSpeedBall.Handle)) - { - MPERF_GlobalUpdatePerformanceCounters(); - - cpu = MPERF_GetCpuUseAge(); - ram = MPERF_GetRamUseAge2() * 100; - disk = MPERF_GetDiskUseage() * 100; - net = MPERF_GetNetWorkUseage() * 100; - - perfsimpleGeted = true; - - itemCpu.Value = cpu.ToString("0.0") + " %"; - itemCpu.NumValue = cpu / 100; - itemCpu.AddData1((int)cpu); - - ulong all = MSystemMemoryPerformanctMonitor.GetAllMemory(); - ulong used = MSystemMemoryPerformanctMonitor.GetMemoryUsed(); - - ulong divor = 0; - string unit = GetBestFilesizeUnit(all, out divor); - - itemRam.Value = (used / (double)divor).ToString("0.0") + " " + unit + "/" + (all / (double)divor).ToString("0.0") + " " + unit + " (" + ram.ToString("0.0") + "%)"; - itemRam.NumValue = ram / 100; - - itemDisk.Value = disk.ToString("0.0") + " %"; - itemDisk.NumValue = disk / 100; - itemDisk.AddData1((int)disk); - - double netsent = 0, netreceive = 0; - if (MPERF_GetNetworksPerformanceCountersValues(netCounterMain, ref netsent, ref netreceive)) - itemNet.Value = str_Sent + " : " + (netsent / 1024 * 8).ToString("0.0") + " Kbps " - + str_Receive + " : " + (netreceive / 1024 * 8).ToString("0.0") + " Kbps"; - else itemNet.Value = net.ToString("0.0") + " %"; - - - formSpeedBall.Invalidate(); - } - + if (mainPagePerf.Inited) mainPagePerf.PerfDayUpdate(out cpu, out ram, out disk, out net, out perfsimpleGeted); if (!Visible || (WindowState == FormWindowState.Minimized)) return; - if (forceRefeshLowLock) return; //base RefeshTimer - if (tabControlMain.SelectedTab == tabPageProcCtl && processListInited) - { - listProcess.Locked = true; - - if (perfMainInited) - { - //Refesh perfs - if (!perfsimpleGeted && (cpuindex != -1 || ramindex != -1 || diskindex != -1 || netindex != -1)) - MPERF_GlobalUpdatePerformanceCounters(); - if (cpuindex != -1) - { - if (!perfsimpleGeted) cpu = MPERF_GetCpuUseAge(); - listProcess.Colunms[cpuindex].TextBig = (int)cpu + "%"; - if (cpu >= 95) - listProcess.Colunms[cpuindex].IsHot = true; - else listProcess.Colunms[cpuindex].IsHot = false; - } - if (ramindex != -1) - { - if (!perfsimpleGeted) ram = MPERF_GetRamUseAge2() * 100; - listProcess.Colunms[ramindex].TextBig = (int)ram + "%"; - if (ram >= 95) - listProcess.Colunms[ramindex].IsHot = true; - else listProcess.Colunms[ramindex].IsHot = false; - } - if (diskindex != -1) - { - if (!perfsimpleGeted) disk = MPERF_GetDiskUseage() * 100; - listProcess.Colunms[diskindex].TextBig = (int)disk + "%"; - if (disk >= 95) - listProcess.Colunms[diskindex].IsHot = true; - else listProcess.Colunms[diskindex].IsHot = false; - } - if (netindex != -1) - { - if (!perfsimpleGeted) net = MPERF_GetNetWorkUseage() * 100; - listProcess.Colunms[netindex].TextBig = (int)net + "%"; - if (net >= 95) - listProcess.Colunms[netindex].IsHot = true; - else listProcess.Colunms[netindex].IsHot = false; - } - } - - //Refesh Process List - ProcessListRefesh2(); - - listProcess.Locked = false; - listProcess.Header.Invalidate(); - } + if (tabControlMain.SelectedTab == tabPageProcCtl && mainPageProcess.Inited) mainPageProcess.ProcessListDayUpdate(cpu, ram, disk, net, perfsimpleGeted); else if (tabControlMain.SelectedTab == tabPagePerfCtl) { if (!perfsimpleGeted) @@ -6690,438 +352,63 @@ private void BaseProcessRefeshTimer_Tick(object sender, EventArgs e) MPERF_GlobalUpdateCpu(); } - PerfUpdate(); + mainPagePerf.PerfUpdate(); performanceLeftList.Invalidate(); } - else if (tabControlMain.SelectedTab == tabPageDetals && processListDetailsInited) - { - ProcessListDetailsRefesh(); - } + else if (tabControlMain.SelectedTab == tabPageDetals && mainPageProcessDetails.Inited) mainPageProcessDetails.ProcessListDetailsRefesh(); + } - //Worker Callback - private void AppWorkerCallBack(int msg, IntPtr wParam, IntPtr lParam) + //Load and exit + private void AppLoad() { - //这是从 c++ native 调用回æ¥çš„函数 - switch (msg) - { - case M_CALLBACK_SW_AOP_WND: - { - if (wParam.ToInt32() == 1) - { - if (aopWnd == null) - { - aopWnd = new FormAlwaysOnTop(); - aopWnd.Show(); - } - } - else if (wParam.ToInt32() == 0) - { - if (aopWnd != null) - { - aopWnd.Close(); - aopWnd = null; - } - } - else if (wParam.ToInt32() == 2) - { - if (aopWnd != null) - { - aopWnd.UpdateText(Marshal.PtrToStringUni(lParam)); - MAppWorkCall3(213, aopWnd.Handle); - } - } - break; - } - case M_CALLBACK_CLEAR_ILLEGAL_TOP_WND: - { - StringBuilder sb = new StringBuilder(260); - GetWindowText(wParam, sb, 260); - FormWindowKillAsk fa = new FormWindowKillAsk("窗å£å称 :" + sb.ToString(), wParam); - fa.Show(); - MAppWorkCall3(213, fa.Handle); - break; - } - case M_CALLBACK_SWITCH_IDM_ALWAYSTOP_SET: - { - break; - } - case M_CALLBACK_SWITCH_MAINGROUP_SET: - { - if (tabControlMain.SelectedTab == tabPageProcCtl) - { - listProcess.ShowGroup = wParam.ToInt32() == 1; - listProcess.SyncItems(true); - } - break; - } - case M_CALLBACK_SWITCH_REFESHRATE_SET: - { - int c = wParam.ToInt32(); - if (c == 2) - { - baseProcessRefeshTimer.Enabled = false; - baseProcessRefeshTimer.Stop(); - baseProcessRefeshTimerLowUWP.Stop(); - SetConfig("RefeshTime", "AppSetting", "Stop"); - baseProcessRefeshTimerLow.Stop(); - baseProcessRefeshTimerLowSc.Stop(); - PerfUpdateGridUnit(); - } - else - { - baseProcessRefeshTimer.Enabled = true; - if (c == 1) { - baseProcessRefeshTimer.Interval = 2000; - baseProcessRefeshTimerLow.Interval = 10000; - SetConfig("RefeshTime", "AppSetting", "Slow"); - } - else if (c == 0) { - baseProcessRefeshTimer.Interval = 1000; - baseProcessRefeshTimerLow.Interval = 5000; - SetConfig("RefeshTime", "AppSetting", "Fast"); - } - baseProcessRefeshTimer.Start(); - baseProcessRefeshTimerLowUWP.Start(); - baseProcessRefeshTimerLow.Start(); - baseProcessRefeshTimerLowSc.Start(); - PerfUpdateGridUnit(); - } - break; - } - case M_CALLBACK_SWITCH_TOPMOST_SET: - { - TopMost = wParam.ToInt32() == 1; - break; - } - case M_CALLBACK_SWITCH_CLOSEHIDE_SET: - { - close_hide = wParam.ToInt32() == 1; - break; - } - case M_CALLBACK_SWITCH_MINHIDE_SET: - { - min_hide = wParam.ToInt32() == 1; - break; - } - case M_CALLBACK_GOTO_SERVICE: - { - string scname = Marshal.PtrToStringUni(wParam); - tabControlMain.SelectedTab = tabPageScCtl; - foreach (ListViewItem it in listService.Items) - { - if (it.Text == scname) - { - int i = listService.Items.IndexOf(it); - listService.EnsureVisible(i); - it.Selected = true; - } - else it.Selected = false; - } - break; - } - case M_CALLBACK_REFESH_SCLIST: - { - ScMgrRefeshList(); - break; - } - case M_CALLBACK_KILLPROCTREE: - { - PsItem p = ProcessListFindPsItem((uint)wParam.ToInt32()); - if (p != null) ProcessListKillProcTree(p, true); - break; - } - case M_CALLBACK_SPY_TOOL: - { - new FormSpyWindow(wParam).ShowDialog(); - break; - } - case M_CALLBACK_FILE_TOOL: - { - new FormFileTool().ShowDialog(); - break; - } - case M_CALLBACK_ABOUT: - { - new FormAbout().ShowDialog(); - break; - } - case M_CALLBACK_ENDTASK: - { - uint pid = Convert.ToUInt32(wParam.ToInt32()); - ProcessListEndTask(pid, null); - break; - } - case M_CALLBACK_LOADDRIVER_TOOL: - { - new FormLoadDriver().Show(); - break; - } - case M_CALLBACK_SCITEM_REMOVED: - { - if (scListInited) - { - string targetName = Marshal.PtrToStringUni(wParam); - ListViewItem target = null; - foreach (ListViewItem li in listService.Items) - { - if (li.Text == targetName) - { - target = li; - break; - } - } - if (target != null) - listService.Items.Remove(target); - } - break; - } - case M_CALLBACK_SHOW_PROGRESS_DLG: - { - ShowHideDelingDialog(true); - break; - } - case M_CALLBACK_UPDATE_PROGRESS_DLG_TO_DELETEING: - { - ShowHideDelingDialog(false); - DelingDialogUpdate(str_DeleteFiles, 0); - break; - } - case M_CALLBACK_UPDATE_PROGRESS_DLG_ALL: - { - DelingDialogUpdate(Marshal.PtrToStringUni(wParam), lParam.ToInt32()); - break; - } - case M_CALLBACK_UPDATE_PROGRESS_DLG_TO_COLLECTING: - { - DelingDialogUpdate(str_CollectingFiles, -1); - break; - } - case M_CALLBACK_KERNEL_INIT: - { - AppWorkerCallBack(41, IntPtr.Zero, IntPtr.Zero); - if (MInitKernel(null)) - if (GetConfigBool("SelfProtect", "AppSetting")) - MAppWorkCall3(203, IntPtr.Zero, IntPtr.Zero); - break; - } - case M_CALLBACK_VIEW_HANDLES: - { - new FormVHandles(Convert.ToUInt32(wParam.ToInt32()), Marshal.PtrToStringUni(lParam)).ShowDialog(); - break; - } - case M_CALLBACK_KERNEL_INIT_LIST: - { - KernelListInit(); - break; - } - case M_CALLBACK_KERNEL_SWITCH_SHOWALLDRV: - { - showAllDriver = !showAllDriver; - KernelLisRefesh(); - break; - } - case M_CALLBACK_START_ITEM_REMVED: - { - StartMListRemoveItem(Convert.ToUInt32(wParam.ToInt32())); - break; - } - case M_CALLBACK_VIEW_KSTRUCTS: - { - new FormVKrnInfo(Convert.ToUInt32(wParam.ToInt32()), Marshal.PtrToStringUni(lParam)).ShowDialog(); - break; - } - case M_CALLBACK_VIEW_TIMER: - { - //timer - if (MCanUseKernel()) - new FormVTimers(Convert.ToUInt32(wParam.ToInt32())).ShowDialog(); - else MessageBox.Show(str_DriverNotLoad); - break; - } - case M_CALLBACK_VIEW_HOTKEY: - { - //hotkey - if (MCanUseKernel()) - new FormVHotKeys(Convert.ToUInt32(wParam.ToInt32())).ShowDialog(); - else MessageBox.Show(str_DriverNotLoad); - break; - } - case M_CALLBACK_SHOW_TRUSTED_DLG: - { - string path = Marshal.PtrToStringUni(wParam); - lastVeryExe = path; - TaskDialog d = new TaskDialog(str_FileTrust, str_TipTitle, (path == null ? "" : path) + "\n\n" + str_FileTrustViewCrt); - d.EnableHyperlinks = true; - d.HyperlinkClick += FileTrustedLink_HyperlinkClick; - d.Show(this); - break; - } - case M_CALLBACK_MDETALS_LIST_HEADER_RIGHTCLICK: - { - colLastDown = wParam.ToInt32(); - éšè—列ToolStripMenuItem.Enabled = colLastDown != colNameIndex; - contextMenuStripProcDetalsCol.Show(MousePosition); - break; - } - case M_CALLBACK_KDA: - { - new FormKDA().ShowDialog(this); - break; - } - case M_CALLBACK_SETAFFINITY: - { - new FormSetAffinity((uint)wParam.ToInt32(), lParam).ShowDialog(); - break; - } - case M_CALLBACK_UPDATE_LOAD_STATUS: - { - StartingProgressUpdate(Marshal.PtrToStringUni(wParam)); - break; - } - case M_CALLBACK_SHOW_NOPDB_WARN: - { - ShowNoPdbWarn(Marshal.PtrToStringAnsi(wParam)); - break; - } - case M_CALLBACK_INVOKE_LASTLOAD_STEP: - { - Invoke(new Action(AppLastLoadStep)); - break; - } - case M_CALLBACK_DBGPRINT_SHOW: - { - if (kDbgPrint == null) - { - kDbgPrint = new FormKDbgPrint(); - kDbgPrint.FormClosed += KDbgPrint_FormClosed; - } - kDbgPrint.Show(); - break; - } - case M_CALLBACK_DBGPRINT_CLOSE: - { - if (kDbgPrint != null && !exitkDbgPrintCalled) - { - exitkDbgPrintCalled = true; - kDbgPrint.Close(); - kDbgPrint = null; - exitkDbgPrintCalled = false; - } - break; - } - case M_CALLBACK_DBGPRINT_DATA: - { - if (kDbgPrint != null) - kDbgPrint.Add(Marshal.PtrToStringUni(wParam)); - break; - } - case M_CALLBACK_DBGPRINT_EMEPTY: - { - if (kDbgPrint != null) - kDbgPrint.Add(""); - break; - } - case M_CALLBACK_SHOW_LOAD_STATUS: - { - if (listProcess.Visible) listProcess.Invoke(new Action(listProcess.Hide)); - StartingProgressShowHide(true); - break; - } - case M_CALLBACK_HLDE_LOAD_STATUS: - { - if (!listProcess.Visible) listProcess.Invoke(new Action(listProcess.Show)); - StartingProgressShowHide(false); - break; - } - case M_CALLBACK_MDETALS_LIST_HEADER_MOUSEMOVE: - { - listProcessDetals_ColumnMouseMove(listProcessDetals, wParam.ToInt32(), - new Point(LOWORD(lParam), HIWORD(lParam))); - break; - } - case M_CALLBACK_KERNEL_VIELL_PRGV: - { - new FormVPrivilege(Convert.ToUInt32(wParam.ToInt32()), Marshal.PtrToStringUni(lParam)).ShowDialog(); - break; - } - case M_CALLBACK_KERNEL_TOOL: - { - linkLabelShowKernelTools_LinkClicked(this, null); - break; - } - case M_CALLBACK_HOOKS: - { - ShowFormHooks(); - break; - } - case M_CALLBACK_NETMON: - { - //netmon - break; - } - case M_CALLBACK_REGEDIT: - { - //regedit - break; - } - case M_CALLBACK_FILEMGR: - { - tabControlMain.SelectedTab = tabPageFileCtl; - break; - } - case M_CALLBACK_COLLAPSE_ALL: - { - if (tabControlMain.SelectedTab == tabPageProcCtl) - ProcessListCollapseAll(); - else if (tabControlMain.SelectedTab == tabPageStartCtl) - StartMListCollapseAll(); - break; - } - case M_CALLBACK_SIMPLEVIEW_ACT: - { - if (wParam.ToInt32() == 1) - { - TaskMgrListItem li = listApps.SelectedItem; - if (li == null) return; - ProcessListEndTask(0, li); - } - else if (wParam.ToInt32() == 0) - { - TaskMgrListItem li = listApps.SelectedItem; - if (li == null) return; - ProcessListSetTo(li); - } - break; - } - case M_CALLBACK_UWPKILL: - { - TaskMgrListItem li = listProcess.SelectedItem; - if (li != null) ProcessListEndTask(0, li); - break; - } - case M_CALLBACK_EXPAND_ALL: - { - if (tabControlMain.SelectedTab == tabPageProcCtl) - ProcessListExpandAll(); - else if (tabControlMain.SelectedTab == tabPageStartCtl) - StartMListExpandAll(); - break; - } - case M_CALLBACK_SHOW_HELP: - { - new FormHelp().ShowDialog(); - break; - } + AppOnLoad(); + } + private void AppExit() + { + //退出函数 + Log("App exit..."); + AppOnExit(); + Application.Exit(); + } + + private int AppRunAgrs() + { + if (agrs.Length > 0) + { + Log("App Agrs 0 : " + agrs[0]); + if (agrs[0] == "select" && agrs.Length > 1) + { + Log("App Agrs 1 : " + agrs[1]); + if (agrs[1] == "kernel") + return 1; + if (agrs[1] == "perf") + return 3; + if (agrs[1] == "uwpapps") + return 4; + if (agrs[1] == "services") + return 5; + if (agrs[1] == "startmgr") + return 6; + if (agrs[1] == "filemgr") + return 7; + if (agrs[1] == "details") + return 8; + if (agrs[1] == "users") + return 9; + } + else if (agrs[0] == "spy") + new FormSpyWindow(GetDesktopWindow()).ShowDialog(); + else if (agrs[0] == "filetool") + new FormFileTool().ShowDialog(); + else if (agrs[0] == "loaddriver") + new FormLoadDriver().ShowDialog(); } + return 0; } - #region FormEvent - - //窗å£çš„一些事件 - - private void AppLastLoadStep() + public void AppLastLoadStep() { int id = AppRunAgrs(); if (id != 0 && GetConfigBool("SimpleView", "AppSetting", true)) id = 0; @@ -7177,7 +464,7 @@ private void AppLastLoadStep() return; case 0: default: - ProcessListInit(); + mainPageProcess.ProcessListInit(); break; } MAppWorkCall3(188, IntPtr.Zero, IntPtr.Zero); @@ -7191,11 +478,7 @@ private void AppLoadKernel() Log("Loading Kernel..."); if (!MInitKernel(null)) { - if (eprocessindex != -1) - { - listProcess.Colunms.Remove(listProcess.Colunms[eprocessindex]); - eprocessindex = -1; - } + mainPageProcess.ProcessListRemoveEprocessCol(); if (MIsKernelNeed64()) TaskDialog.Show(LanuageMgr.GetStr("LoadDriverErrNeed64"), LanuageMgr.GetStr("ErrTitle"), LanuageMgr.GetStr("LoadDriverErrNeed64Text"), TaskDialogButton.OK, TaskDialogIcon.None); @@ -7207,81 +490,104 @@ private void AppLoadKernel() if (GetConfigBool("SelfProtect", "AppSetting")) MAppWorkCall3(203, IntPtr.Zero, IntPtr.Zero); } - canUseKernel = MCanUseKernel(); + IsKernelLoaded = MCanUseKernel(); } else { AppLastLoadStep(); - if (eprocessindex != -1) - { - listProcess.Colunms.Remove(listProcess.Colunms[eprocessindex]); - eprocessindex = -1; - } - } - } - //Load and exit - private void AppLoad() - { - AppOnLoad(); - } - private void AppExit() - { - //退出函数 - Log("App exit..."); - AppOnExit(); - Application.Exit(); - } - - private void AppOnLoad() + mainPageProcess.ProcessListRemoveEprocessCol(); + } + } + private void AppLoadPages() + { + mainPageProcess = new MainPageProcess(this); + mainPageProcessDetails = new MainPageProcessDetails(this); + mainPageKernelDrvMgr = new MainPageKernelDrvMgr(this); + mainPageFileMgr = new MainPageFileMgr(this); + mainPagePerf = new MainPagePerf(this); + mainPageScMgr = new MainPageScMgr(this); + mainPageStartMgr = new MainPageStartMgr(this); + mainPageUserMgr = new MainPageUserMgr(this); + mainPageUwpMgr = new MainPageUwpMgr(this); + + mainPageProcess.Load(); + mainPageProcessDetails.Load(); + mainPageKernelDrvMgr.Load(); + mainPageFileMgr.Load(); + mainPagePerf.Load(); + mainPageScMgr.Load(); + mainPageStartMgr.Load(); + mainPageUserMgr.Load(); + mainPageUwpMgr.Load(); + } + private void AppUnLoadPages() + { + //mainNativeBridge = new MainNativeBridge(); + mainPageProcess.UnLoad(); + mainPageProcessDetails.UnLoad(); + mainPageKernelDrvMgr.UnLoad(); + mainPageFileMgr.UnLoad(); + mainPagePerf.UnLoad(); + mainPageScMgr.UnLoad(); + mainPageStartMgr.UnLoad(); + mainPageUserMgr.UnLoad(); + mainPageUwpMgr.UnLoad(); + } + + private void AppOnPreLoad() { //åˆå§‹åŒ–函数 - - Log("Loading callbacks..."); - exitCallBack = AppExit; - terminateImporantWarnCallBack = TermintateImporantProcess; - enumWinsCallBack = MainEnumWinsCallBack; - getWinsCallBack = MainGetWinsCallBack; - workerCallBack = AppWorkerCallBack; - lanuageItems_CallBack = Native_LanuageItems_CallBack; + //åˆå§‹åŒ–æ¡¥ + mainNativeBridge = new MainNativeBridge(this); + mainNativeBridge.exitCallBack = AppExit; + mainNativeBridge.terminateImporantWarnCallBack = TermintateImporantProcess; + mainNativeBridge.coreWndProc = (WNDPROC)Marshal.GetDelegateForFunctionPointer(MAppSetCallBack(IntPtr.Zero, 0), typeof(WNDPROC)); + mainNativeBridge.InitCallbacks(); + + _isNativeBridgeLoaded = true; + + MainSettings = new MainSettings(this); - MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(exitCallBack), 1); - MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(terminateImporantWarnCallBack), 2); - MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(enumWinsCallBack), 3); - MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(getWinsCallBack), 4); - MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(workerCallBack), 5); - MLG_SetLanuageItems_CallBack(Marshal.GetFunctionPointerForDelegate(lanuageItems_CallBack)); + //åŠ è½½è®¾ç½®å’Œæ‰€æœ‰é¡µçš„ä»£ç  + AppLoadPages(); + AppLoadSettings(); + //åˆå§‹åŒ– MAppWorkCall3(181, IntPtr.Zero, IntPtr.Zero); MAppWorkCall3(183, Handle, IntPtr.Zero); - coreWndProc = (WNDPROC)Marshal.GetDelegateForFunctionPointer(MAppSetCallBack(IntPtr.Zero, 0), typeof(WNDPROC)); - - SetConfig("LastWindowTitle", "AppSetting", Text); - Log("Loading Settings..."); + //åˆå§‹åŒ–语言 + LanuageMgr.InitLanuage(); - LoadSettings(); + //标题 + SetConfig("LastWindowTitle", "AppSetting", Text); + Text = GetConfig("Title", "AppSetting", "任务管ç†å™¨"); + if (Text == "") Text = LanuageFBuffers.Str_AppTitle; - SysVer.Get(); - if (!SysVer.IsWin8Upper()) - tabControlMain.TabPages.Remove(tabPageUWPCtl); - else M_UWP_Init(); + mainPagePerf.PerfInitTray(); - if (!MGetPrivileges()) TaskDialog.Show(LanuageMgr.GetStr("FailedGetPrivileges"), str_AppTitle, "", TaskDialogButton.OK, TaskDialogIcon.Warning); + //系统ä½æ•° #if _X64_ Log("64 Bit OS "); - is64OS = true; + Is64OS = true; #else - is64OS = MIs64BitOS(); - Log(is64OS ? "64 Bit OS but 32 bit app " : "32 Bit OS"); + Is64OS = MIs64BitOS(); + Log(Is64OS ? "64 Bit OS but 32 bit app " : "32 Bit OS"); #endif + IsAdmin = MIsRunasAdmin(); - Log("Loading..."); - - LoadList(); + //判断是å¦æ”¯æŒé€šç”¨åº”用(win8 以上) + SysVer.Get(); + if (!SysVer.IsWin8Upper()) tabControlMain.TabPages.Remove(tabPageUWPCtl); + else M_UWP_Init(); - if (MIsRunasAdmin()) - AppLoadKernel(); + //æå‡æƒé™ + if (!MGetPrivileges()) TaskDialog.Show(LanuageMgr.GetStr("FailedGetPrivileges"), LanuageFBuffers.Str_AppTitle, "", TaskDialogButton.OK, TaskDialogIcon.Warning); + } + private void AppOnLoad() + { + if (MIsRunasAdmin()) AppLoadKernel(); else AppLastLoadStep(); } private void AppOnExit() @@ -7290,23 +596,25 @@ private void AppOnExit() { baseProcessRefeshTimer.Stop(); + AppSaveSettings(); + AppUnLoadPages(); + fileSystemWatcher.EnableRaisingEvents = false; - SaveListColumnsWidth(); - ProcessListSimpleExit(); - AppWorkerCallBack(38, IntPtr.Zero, IntPtr.Zero); + + mainNativeBridge.AppWorkerCallBack(38, IntPtr.Zero, IntPtr.Zero); DelingDialogClose(); MPERF_NET_FreeAllProcessNetInfo(); - UsersListUnInit(); - PerfClear(); - ProcessListUnInitPerfs(); - ProcessListFreeAll(); - ProcessListDetailsUnInit(); + mainPageUserMgr.UsersListUnInit(); + mainPagePerf.PerfClear(); + + mainPageProcess.ProcessListFreeAll(); + mainPageProcessDetails.ProcessListDetailsUnInit(); MSCM_Exit(); - KernelListUnInit(); + mainPageKernelDrvMgr.KernelListUnInit(); M_LOG_Close(); if (SysVer.IsWin8Upper()) { - UWPListUnInit(); + mainPageUwpMgr.UWPListUnInit(); M_UWP_UnInit(); } MAppWorkCall3(204, IntPtr.Zero, IntPtr.Zero); @@ -7315,42 +623,19 @@ private void AppOnExit() } } - private int AppRunAgrs() + private void AppLoadSettings() { - if (agrs.Length > 0) - { - Log("App Agrs 0 : " + agrs[0]); - if (agrs[0] == "select" && agrs.Length > 1) - { - Log("App Agrs 1 : " + agrs[1]); - if (agrs[1] == "kernel") - return 1; - if (agrs[1] == "perf") - return 3; - if (agrs[1] == "uwpapps") - return 4; - if (agrs[1] == "services") - return 5; - if (agrs[1] == "startmgr") - return 6; - if (agrs[1] == "filemgr") - return 7; - if (agrs[1] == "details") - return 8; - if (agrs[1] == "users") - return 9; - } - else if (agrs[0] == "spy") - new FormSpyWindow(GetDesktopWindow()).ShowDialog(); - else if (agrs[0] == "filetool") - new FormFileTool().ShowDialog(); - else if (agrs[0] == "loaddriver") - new FormLoadDriver().ShowDialog(); - } - return 0; + MainSettings.LoadSettings(); + MainSettings.LoadListColumnsWidth(); + } + private void AppSaveSettings() + { + MainSettings.SaveListColumnsWidth(); + MainSettings.SaveSettings(); } - private FormAlwaysOnTop aopWnd = null; + #region KDbgPrint + private FormKDbgPrint kDbgPrint = null; private bool exitkDbgPrintCalled = false; private void KDbgPrint_FormClosed(object sender, FormClosedEventArgs e) @@ -7358,424 +643,46 @@ private void KDbgPrint_FormClosed(object sender, FormClosedEventArgs e) kDbgPrint = null; } - private bool exitCalled = false; - private int showHideHotKetId = 0; - - private bool close_hide = false; - private bool min_hide = false; - private bool highlight_nosystem = false; - - //加载 - private void LoadAllFonts() - { - FormSettings.LoadFontSettingForUI(tabControlMain); - pl_simple.Font = tabControlMain.Font; - pl_perfGridHost.Font = tabControlMain.Font; - lbStartingStatus.Font = tabControlMain.Font; - } - private void LoadList() - { - lvwColumnSorter = new TaskListViewColumnSorter(this); - - TaskMgrListGroup lg = new TaskMgrListGroup(LanuageMgr.GetStr("TitleApp")); - listProcess.Groups.Add(lg); - TaskMgrListGroup lg2 = new TaskMgrListGroup(LanuageMgr.GetStr("TitleBackGround")); - listProcess.Groups.Add(lg2); - TaskMgrListGroup lg3 = new TaskMgrListGroup(LanuageMgr.GetStr("TitleWinApp")); - listProcess.Groups.Add(lg3); - listProcess.Header.CanMoveCloum = true; - - listUwpApps.Header.Height = 36; - listUwpApps.ReposVscroll(); - listStartup.Header.Height = 36; - listStartup.ReposVscroll(); - //listStartup.DrawIcon = false; - TaskMgrListHeaderItem li = new TaskMgrListHeaderItem(); - li.TextSmall = LanuageMgr.GetStr("TitleName"); - li.Width = 200; - listStartup.Colunms.Add(li); - TaskMgrListHeaderItem li2 = new TaskMgrListHeaderItem(); - li2.TextSmall = LanuageMgr.GetStr("TitleCmdLine"); - li2.Width = 200; - listStartup.Colunms.Add(li2); - TaskMgrListHeaderItem li3 = new TaskMgrListHeaderItem(); - li3.TextSmall = LanuageMgr.GetStr("TitleFilePath"); - li3.Width = 200; - listStartup.Colunms.Add(li3); - TaskMgrListHeaderItem li4 = new TaskMgrListHeaderItem(); - li4.TextSmall = LanuageMgr.GetStr("TitlePublisher"); - li4.Width = 100; - listStartup.Colunms.Add(li4); - TaskMgrListHeaderItem li5 = new TaskMgrListHeaderItem(); - li5.TextSmall = LanuageMgr.GetStr("TitleRegPath"); - li5.Width = 200; - listStartup.Colunms.Add(li5); - - TaskMgrListHeaderItem li8 = new TaskMgrListHeaderItem(); - li8.TextSmall = LanuageMgr.GetStr("TitleName"); - li8.Width = 300; - listUwpApps.Colunms.Add(li8); - TaskMgrListHeaderItem li10 = new TaskMgrListHeaderItem(); - li10.TextSmall = LanuageMgr.GetStr("TitleFullName"); - li10.Width = 260; - listUwpApps.Colunms.Add(li10); - TaskMgrListHeaderItem li11 = new TaskMgrListHeaderItem(); - li11.TextSmall = LanuageMgr.GetStr("TitleInstallDir"); - li11.Width = 260; - listUwpApps.Colunms.Add(li11); - - listUsers.Header.Height = 36; - listUsers.ReposVscroll(); - listUsers.DrawIcon = false; - TaskMgrListHeaderItem li13 = new TaskMgrListHeaderItem(); - li13.TextSmall = LanuageMgr.GetStr("TitleName"); - li13.Width = 450; - listUsers.Colunms.Add(li13); - TaskMgrListHeaderItem li14 = new TaskMgrListHeaderItem(); - li14.TextSmall = "ID"; - li14.Width = 50; - listUsers.Colunms.Add(li14); - TaskMgrListHeaderItem li15 = new TaskMgrListHeaderItem(); - li15.TextSmall = LanuageMgr.GetStr("TitleSessionID"); - li15.Width = 50; - listUsers.Colunms.Add(li15); - TaskMgrListHeaderItem li16 = new TaskMgrListHeaderItem(); - li16.TextSmall = LanuageMgr.GetStr("TitleDomainName"); - li16.Width = 60; - listUsers.Colunms.Add(li16); - - listProcessAddHeaderMenu("TitleProcName"); - listProcessAddHeaderMenu("TitleType"); - listProcessAddHeaderMenu("TitlePublisher"); - listProcessAddHeaderMenu("TitleStatus"); - listProcessAddHeaderMenu("TitlePID"); - listProcessAddHeaderMenu("TitleCPU"); - listProcessAddHeaderMenu("TitleRam"); - listProcessAddHeaderMenu("TitleDisk"); - listProcessAddHeaderMenu("TitleNet"); - listProcessAddHeaderMenu("TitleProcPath"); - listProcessAddHeaderMenu("TitleCmdLine"); - - string s1 = GetConfig("MainHeaders1", "AppSetting"); - if (s1 != "") listProcessAddHeader("TitleName", int.Parse(s1)); - else listProcessAddHeader("TitleName", 200); - string headers = GetConfig("MainHeaders", "AppSetting"); - if (headers.Contains("#")) - { - string[] headersv = headers.Split('#'); - for (int i = 0; i < headersv.Length; i++) - { - if (headersv[i].Contains("-")) - { - int width = 0; - string[] headersvx = headersv[i].Split('-'); - if (headersv.Length >= 2) - { - if (!int.TryParse(headersvx[1], out width) || width < 0 || width > 512) - width = listProcessTryGetHeaderDefaultWidth(headersvx[0]); - listProcessAddHeader(headersvx[0], width); - listProcessCheckHeaderMenu(headersvx[0], true); - } - } - } - } - else if (headers == "") - { - listProcessAddHeader("TitleStatus", listProcessTryGetHeaderDefaultWidth("TitleStatus")); - listProcessAddHeader("TitlePID", listProcessTryGetHeaderDefaultWidth("TitlePID")); - listProcessAddHeader("TitleProcName", listProcessTryGetHeaderDefaultWidth("TitleProcName")); - listProcessAddHeader("TitleCPU", listProcessTryGetHeaderDefaultWidth("TitleCPU")); - listProcessAddHeader("TitleRam", listProcessTryGetHeaderDefaultWidth("TitleRam")); - listProcessAddHeader("TitleDisk", listProcessTryGetHeaderDefaultWidth("TitleDisk")); - listProcessAddHeader("TitleNet", listProcessTryGetHeaderDefaultWidth("TitleNet")); - } - - listProcessGetAllHeaderIndexs(); - - if (pidindex != -1) listProcess.Header.Items[pidindex].Alignment = StringAlignment.Far; - if (cpuindex != -1) - { - listProcess.Header.Items[cpuindex].IsNum = true; - listProcess.Header.Items[cpuindex].Alignment = StringAlignment.Far; - } - if (ramindex != -1) - { - listProcess.Header.Items[ramindex].IsNum = true; - listProcess.Header.Items[ramindex].Alignment = StringAlignment.Far; - } - if (diskindex != -1) - { - listProcess.Header.Items[diskindex].IsNum = true; - listProcess.Header.Items[diskindex].Alignment = StringAlignment.Far; - } - if (netindex != -1) - { - listProcess.Header.Items[netindex].IsNum = true; - listProcess.Header.Items[netindex].Alignment = StringAlignment.Far; - } - - LoadListColumnsWidth(); - - sorta = GetConfigBool("ListSortDk", "AppSetting", true); - string sortitemxx = GetConfig("ListSortIndex", "AppSetting", "0"); - if (sortitemxx != "" && sortitemxx != "-1") - int.TryParse(sortitemxx, out sortitem); - showHiddenFiles = GetConfigBool("ShowHiddenFiles", "AppSetting"); - MFM_SetShowHiddenFiles(showHiddenFiles); - } - private void LoadSettings() - { - MAppWorkCall3(206, IntPtr.Zero, new IntPtr(GetConfig("TerProcFun", "Configure", "PspTerProc") == "ApcPspTerProc" ? 1 : 0)); - highlight_nosystem = GetConfigBool("HighLightNoSystetm", "Configure", false); - mergeApps = GetConfigBool("MergeApps", "Configure", true); - - int iSplitterDistanceperf = 0; - if (int.TryParse(GetConfig("SplitterDistancePerf", "AppSetting", "0"), out iSplitterDistanceperf) && iSplitterDistanceperf > 0) - splitContainerPerfCtls.SplitterDistance = iSplitterDistanceperf; - - isRamPercentage = GetConfigBool("RamPercentage", "Configure", false); - isDiskPercentage = GetConfigBool("DiskPercentage", "Configure", false); - isNetPercentage = GetConfigBool("NetPercentage", "Configure", false); - - if (isRamPercentage) 百分比ToolStripMenuItemRam.Checked = true; - else 值ToolStripMenuItemRam.Checked = true; - - if (isDiskPercentage) 百分比ToolStripMenuItemDisk.Checked = true; - else 值ToolStripMenuItemDisk.Checked = true; - - if (isNetPercentage) 百分比ToolStripMenuItemNet.Checked = true; - else 值ToolStripMenuItemNet.Checked = true; - - MAppWorkCall3(194, IntPtr.Zero, GetConfigBool("TopMost", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); - MAppWorkCall3(195, IntPtr.Zero, GetConfigBool("CloseHideToNotfication", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); - MAppWorkCall3(196, IntPtr.Zero, GetConfigBool("MinHide", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); - MAppWorkCall3(162, IntPtr.Zero, GetConfigBool("MainGrouping", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); - MAppWorkCall3(156, IntPtr.Zero, GetConfigBool("AlwaysOnTop", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); - MAppWorkCall3(164, IntPtr.Zero, IntPtr.Zero); - MAppWorkCall3(163, IntPtr.Zero, IntPtr.Zero); - } - private void LoadLastPos() + public void KDbgPrintShow() { - if (GetConfigBool("OldIsMax", "AppSetting")) - WindowState = FormWindowState.Maximized; - else + if (kDbgPrint == null) { - bool s_isSimpleView = GetConfigBool("SimpleView", "AppSetting", true); - - string p = GetConfig("OldPos", "AppSetting"); - if (p.Contains("-")) - { - string[] pp = p.Split('-'); - try - { - Left = int.Parse(pp[0]); - Top = int.Parse(pp[1]); - if (Left > Screen.PrimaryScreen.Bounds.Width) - Left = 100; - if (Top > Screen.PrimaryScreen.Bounds.Height) - Top = 200; - } - catch { } - } - - string sg = GetConfig("OldSizeGraphic", "AppSetting", "640-320"); - if (sg.Contains("-")) - { - string[] ss = sg.Split('-'); - try - { - int w = int.Parse(ss[0]); if (w + Left > Screen.PrimaryScreen.WorkingArea.Width) w = Screen.PrimaryScreen.WorkingArea.Width - Left; - int h = int.Parse(ss[1]); if (h + Top > Screen.PrimaryScreen.WorkingArea.Height) h = Screen.PrimaryScreen.WorkingArea.Height - Top; - lastGraphicSize = new Size(w, h); - - if (s_isSimpleView) - { - Width = w; - Height = h; - } - } - catch { } - } - string sl = GetConfig("OldSizeSimple", "AppSetting", "380-334"); - if (sl.Contains("-")) - { - string[] ss = sl.Split('-'); - try - { - int w = int.Parse(ss[0]); if (w + Left > Screen.PrimaryScreen.WorkingArea.Width) w = Screen.PrimaryScreen.WorkingArea.Width - Left; - int h = int.Parse(ss[1]); if (h + Top > Screen.PrimaryScreen.WorkingArea.Height) h = Screen.PrimaryScreen.WorkingArea.Height - Top; - lastSimpleSize = new Size(w, h); - - if (s_isSimpleView) - { - Width = w; - Height = h; - } - } - catch { } - } - string s = GetConfig("OldSize", "AppSetting", "780-500"); - if (s.Contains("-")) - { - string[] ss = s.Split('-'); - try - { - int w = int.Parse(ss[0]); if (w + Left > Screen.PrimaryScreen.WorkingArea.Width) w = Screen.PrimaryScreen.WorkingArea.Width - Left; - int h = int.Parse(ss[1]); if (h + Top > Screen.PrimaryScreen.WorkingArea.Height) h = Screen.PrimaryScreen.WorkingArea.Height - Top; - lastSize = new Size(w, h); - if (!s_isSimpleView) - { - Width = w; - Height = h; - } - } - catch { } - } + kDbgPrint = new FormKDbgPrint(); + kDbgPrint.FormClosed += KDbgPrint_FormClosed; } + kDbgPrint.Show(); } - private void LoadHotKey() + public void KDbgPrintClose() { - if (GetConfigBool("HotKey", "AppSetting", true)) + if (kDbgPrint != null && !exitkDbgPrintCalled) { - string k1 = GetConfig("HotKey1", "AppSetting", "(None)"); - string k2 = GetConfig("HotKey2", "AppSetting", "T"); - if (k1 == "(None)") k1 = "None"; - Keys kv1, kv2; - try - { - if (k1 != "(None)") kv1 = (Keys)Enum.Parse(typeof(Keys), k1); - else kv1 = Keys.None; - kv2 = (Keys)Enum.Parse(typeof(Keys), k2); - } - catch (Exception e) - { - LogErr("Invalid hotkey settings : " + e.Message); - kv2 = Keys.T; - kv1 = Keys.Shift; - } - - showHideHotKetId = MAppRegShowHotKey(Handle, (uint)(int)kv1, (uint)(int)kv2); - MAppWorkCall3(209, Handle, IntPtr.Zero); + exitkDbgPrintCalled = true; + kDbgPrint.Close(); + kDbgPrint = null; + exitkDbgPrintCalled = false; } } - - //ä¿å­˜å’Œè¯»å–视图列的宽度 - private void LoadListColumnsWidth() + public void KDbgPrintData(string data) { - string s = GetConfig("ListStartsWidths", "AppSetting", ""); - if (s.Contains("#")) - { - string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < ss.Length && i < listStartup.Colunms.Count; i++) - { - int width = 0; - if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) - listStartup.Colunms[i].Width = width; - } - } - s = GetConfig("ListUWPsWidths", "AppSetting", ""); - if (s.Contains("#")) - { - string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < ss.Length && i < listUwpApps.Colunms.Count; i++) - { - int width = 0; - if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) - listUwpApps.Colunms[i].Width = width; - } - } - s = GetConfig("ListUsersWidths", "AppSetting", ""); - if (s.Contains("#")) - { - string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < ss.Length && i < listUsers.Colunms.Count; i++) - { - int width = 0; - if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) - listUsers.Colunms[i].Width = width; - } - } - s = GetConfig("ListDriversWidths", "AppSetting", ""); - if (s.Contains("#")) - { - string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < ss.Length && i < listDrivers.Columns.Count; i++) - { - int width = 0; - if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) - listDrivers.Columns[i].Width = width; - } - } - s = GetConfig("ListServiceWidths", "AppSetting", ""); - if (s.Contains("#")) - { - string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < ss.Length && i < listService.Columns.Count; i++) - { - int width = 0; - if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) - listService.Columns[i].Width = width; - } - } + if(kDbgPrint != null) kDbgPrint.Add(data); } - private void SaveListColumnsWidth() + public void KDbgPrintData() { - string s = ""; - foreach (TaskMgrListHeaderItem he in listStartup.Colunms) - s += "#" + he.Width; - SetConfig("ListStartsWidths", "AppSetting", s); - s = ""; - foreach (TaskMgrListHeaderItem he in listUwpApps.Colunms) - s += "#" + he.Width; - SetConfig("ListUWPsWidths", "AppSetting", s); - s = ""; - foreach (TaskMgrListHeaderItem he in listUsers.Colunms) - s += "#" + he.Width; - SetConfig("ListUsersWidths", "AppSetting", s); - s = ""; - foreach (ColumnHeader he in listDrivers.Columns) - s += "#" + he.Width; - SetConfig("ListDriversWidths", "AppSetting", s); - s = ""; - foreach (ColumnHeader he in listService.Columns) - s += "#" + he.Width; - SetConfig("ListServiceWidths", "AppSetting", s); + if (kDbgPrint != null) kDbgPrint.Add(""); } - private void InitializeCtlText() - { - //自定义控件文字??? - - spBottom.Text = "底部分隔符"; - spl1.Text = "分隔符"; - sp5.Text = "分隔符"; - sp2.Text = "分隔符"; - sp3.Text = "分隔符"; - sp4.Text = "分隔符"; - pl_simple.Text = "应用简略信æ¯è§†å›¾"; - pl_perfGridHost.Text = "图形摘è¦è§†å›¾æŽ§åˆ¶é¡¹"; - listProcessDetals.Text = "进程详细信æ¯åˆ—表"; - listService.Text = "æœåŠ¡åˆ—表视图"; - listDrivers.Text = "驱动列表视图"; - listFm.Text = "文件列表视图"; - treeFmLeft.Text = "文件夹树视图"; - splitContainerFm.Text = "文件管ç†è§†å›¾"; - splitContainerFm.Panel1.Text = "文件夹树列表控制项"; - splitContainerFm.Panel2.Text = "文件列表控制项"; - splitContainerPerfCtls.Text = "资æºç›‘视控制项"; - splitContainerPerfCtls.Panel1.Text = "资æºç›‘视列表控制项"; - splitContainerPerfCtls.Panel2.Text = "资æºç›‘视页控制项"; - tabControlMain.Text = "主页é¢é€‰é¡¹å¡æŽ§åˆ¶"; + #endregion + #region FormEvent + //窗å£çš„一些事件 - } + private bool exitCalled = false; //notifyIcon 托盘图标事件 private bool notifyIcon_mouseEntered = false; private void notifyIcon_MouseEnter(object sender, EventArgs e) { - PerfSetTrayPos(); - ShowWindow(formSpeedBall.Handle, 5); + mainPagePerf.PerfShowSpeedBall(); } public void notifyIcon_MouseLeave(object sender, EventArgs e) { @@ -7801,17 +708,13 @@ private void 退出程åºToolStripMenuItem_Click(object sender, EventArgs e) } private void 显示éšè—主界é¢ToolStripMenuItem_Click(object sender, EventArgs e) { - if (IsWindowVisible(Handle)) - ShowWindow(Handle, 0); - else - ShowWindow(Handle, 5); + if (IsWindowVisible(Handle)) ShowWindow(Handle, 0); + else ShowWindow(Handle, 5); } private void contextMenuStripTray_Opening(object sender, System.ComponentModel.CancelEventArgs e) { - if (IsWindowVisible(Handle)) - 显示éšè—主界é¢ToolStripMenuItem.Text = str_HideMain; - else - 显示éšè—主界é¢ToolStripMenuItem.Text = str_ShowMain; + if (IsWindowVisible(Handle)) 显示éšè—主界é¢ToolStripMenuItem.Text = LanuageMgr.GetStr("HideMain"); + else 显示éšè—主界é¢ToolStripMenuItem.Text = LanuageMgr.GetStr("ShowMain"); } //窗å£äº‹ä»¶ @@ -7821,15 +724,7 @@ private void FormMain_Shown(object sender, EventArgs e) } private void FormMain_Load(object sender, EventArgs e) { - - Text = GetConfig("Title", "AppSetting", "任务管ç†å™¨"); - - if (Text == "") Text = str_AppTitle; - - LoadHotKey(); - LoadLastPos(); - - PerfInitTray(); + AppOnPreLoad(); } private void FormMain_Activated(object sender, EventArgs e) { @@ -7857,14 +752,11 @@ private void FormMain_OnWmCommand(int id) { if (tabControlMain.SelectedTab == tabPageProcCtl) { - WorkWindow.FormMainListHeaders f = new WorkWindow.FormMainListHeaders(this); - if (f.ShowDialog() == DialogResult.OK) - MAppWorkCall3(191, IntPtr.Zero, IntPtr.Zero); + FormMainListHeaders f = new FormMainListHeaders(this); + if (f.ShowDialog() == DialogResult.OK) MAppWorkCall3(191, IntPtr.Zero, IntPtr.Zero); } else if (tabControlMain.SelectedTab == tabPageDetals) - { - new FormDetalsistHeaders().ShowDialog(); - } + new FormDetalsistHeaders(this).ShowDialog(); break; } case 40017: //Sleep system @@ -7882,58 +774,66 @@ private void FormMain_OnWmCommand(int id) case 41012://Refesh { if (tabControlMain.SelectedTab == tabPageProcCtl) - ProcessListRefesh(); + mainPageProcess.ProcessListRefesh(); else if (tabControlMain.SelectedTab == tabPageKernelCtl) - KernelLisRefesh(); + mainPageKernelDrvMgr.KernelLisRefesh(); else if (tabControlMain.SelectedTab == tabPageStartCtl) - StartMListRefesh(); + mainPageStartMgr.StartMListRefesh(); else if (tabControlMain.SelectedTab == tabPageScCtl) - ScMgrRefeshList(); + mainPageScMgr.ScMgrRefeshList(); else if (tabControlMain.SelectedTab == tabPageFileCtl) - FileMgrShowFiles(null); + mainPageFileMgr.FileMgrShowFiles(null); else if (tabControlMain.SelectedTab == tabPageUWPCtl) - UWPListRefesh(); + mainPageUwpMgr.UWPListRefesh(); else if (tabControlMain.SelectedTab == tabPagePerfCtl) BaseProcessRefeshTimer_Tick(null, null); else if (tabControlMain.SelectedTab == tabPageDetals) BaseProcessRefeshTimer_Tick(null, null); else if (tabControlMain.SelectedTab == tabPageUsers) - UsersListLoad(); + mainPageUserMgr.UsersListLoad(); break; } case 40019://Reboot { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleReboot"), str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleReboot"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); if (t.Show(this).CommonButton == Result.Yes) MAppWorkCall3(185, IntPtr.Zero, IntPtr.Zero); break; } case 41020://Logoff { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleLogoOff"), str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleLogoOff"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); if (t.Show(this).CommonButton == Result.Yes) MAppWorkCall3(186, IntPtr.Zero, IntPtr.Zero); break; } case 40018://Shutdown { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleShutdown"), str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleShutdown"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); if (t.Show(this).CommonButton == Result.Yes) MAppWorkCall3(187, IntPtr.Zero, IntPtr.Zero); break; } case 41151://FShutdown { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleFShutdown"), str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); - if (t.Show(this).CommonButton == Result.Yes) - MAppWorkCall3(201, IntPtr.Zero, IntPtr.Zero); + if (IsKernelLoaded) + { + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleFShutdown"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + if (t.Show(this).CommonButton == Result.Yes) + MAppWorkCall3(201, IntPtr.Zero, IntPtr.Zero); + } + else TaskDialog.Show(LanuageFBuffers.Str_DriverNotLoad, LanuageFBuffers.Str_AppTitle); break; } case 41152://FRebbot { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleFRebbot"), str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); - if (t.Show(this).CommonButton == Result.Yes) - MAppWorkCall3(202, IntPtr.Zero, IntPtr.Zero); + if (IsKernelLoaded) + { + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleFRebbot"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + if (t.Show(this).CommonButton == Result.Yes) + MAppWorkCall3(202, IntPtr.Zero, IntPtr.Zero); + } + else TaskDialog.Show(LanuageFBuffers.Str_DriverNotLoad, LanuageFBuffers.Str_AppTitle); break; } case 41153://Test2 @@ -7946,43 +846,18 @@ private void FormMain_OnWmCommand(int id) } private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { - if (close_hide) + if (MainSettings.CloseHide) { e.Cancel = true; Hide(); return; } - - GetConfig("SplitterDistancePerf", "AppSetting", splitContainerPerfCtls.SplitterDistance.ToString()); - SetConfigBool("MainGrouping", "AppSetting", listProcess.ShowGroup); - SetConfig("ListSortIndex", "AppSetting", sortitem.ToString()); - if (sorta) SetConfig("ListSortDk", "AppSetting", "TRUE"); - else SetConfig("ListSortDk", "AppSetting", "FALSE"); - if (!isSimpleView) - SetConfig("OldSize", "AppSetting", Width.ToString() + "-" + Height.ToString()); - else SetConfig("OldSize", "AppSetting", lastSize.Width.ToString() + "-" + lastSize.Height.ToString()); - SetConfig("OldPos", "AppSetting", Left.ToString() + "-" + Top.ToString()); - SetConfigBool("OldIsMax", "AppSetting", WindowState == FormWindowState.Maximized); - SetConfigBool("RamPercentage", "Configure", isRamPercentage); - SetConfigBool("DiskPercentage", "Configure", isDiskPercentage); - SetConfigBool("NetPercentage", "Configure", isNetPercentage); - - if (saveheader) - { - string headers = ""; - for (int i = 1; i < listProcess.Header.SortedItems.Count; i++) - headers = headers + "#" + listProcess.Header.SortedItems[i].Identifier + "-" + listProcess.Header.SortedItems[i].Width; - SetConfig("MainHeaders", "AppSetting", headers); - } - SetConfig("MainHeaders1", "AppSetting", listProcess.Colunms[0].Width.ToString()); - notifyIcon.Visible = false; - AppOnExit(); } private void FormMain_OnWmHotKey(int id) { - if (id == showHideHotKetId) + if (id == MainSettings.GetShowHideHotKetId()) { if (!IsWindowVisible(Handle)) MAppWorkCall3(208, Handle, IntPtr.Zero); @@ -7993,13 +868,10 @@ private void FormMain_VisibleChanged(object sender, EventArgs e) if (Visible) { listProcess.Locked = false; - if (processListInited) - BaseProcessRefeshTimer_Tick(sender, e); - } - else - { - listProcess.Locked = true; + if (mainPageProcess.Inited) BaseProcessRefeshTimer_Tick(sender, e); } + else listProcess.Locked = true; + } protected override void WndProc(ref System.Windows.Forms.Message m) @@ -8011,11 +883,11 @@ protected override void WndProc(ref System.Windows.Forms.Message m) FormMain_OnWmHotKey(m.WParam.ToInt32()); else if (m.Msg == WM_SYSCOMMAND) { - if (min_hide && m.WParam.ToInt32() == 0xF20)//SC_MINIMIZE + if (MainSettings.MinHide && m.WParam.ToInt32() == 0xF20)//SC_MINIMIZE Hide(); } //WndProc部分交予 Native 控制 - coreWndProc?.Invoke(m.HWnd, Convert.ToUInt32(m.Msg), m.WParam, m.LParam); + if(_isNativeBridgeLoaded) MainNativeBridge.WndProc(ref m); } public static void AppHWNDSendMessage(uint message, IntPtr wParam, IntPtr lParam) @@ -8023,6 +895,41 @@ public static void AppHWNDSendMessage(uint message, IntPtr wParam, IntPtr lParam MAppWorkCall2(message, wParam, lParam); } + public void GroupSwitch(bool b) + { + if (tabControlMain.SelectedTab == tabPageProcCtl) + { + listProcess.ShowGroup = b; + listProcess.SyncItems(true); + } + } + public void ShowKernelTools() + { + MessageBox.Show("The function aren't complete. "); + } + public void ShowFormHooks() + { + MessageBox.Show("The function aren't complete. "); + } + public void SetToFileMgr() + { + tabControlMain.SelectedTab = tabPageFileCtl; + } + public void CollapseAll() + { + if (tabControlMain.SelectedTab == tabPageProcCtl) + mainPageProcess.ProcessListCollapseAll(); + else if (tabControlMain.SelectedTab == tabPageStartCtl) + mainPageStartMgr.StartMListCollapseAll(); + } + public void ExpandAll() + { + if (tabControlMain.SelectedTab == tabPageProcCtl) + mainPageProcess.ProcessListExpandAll(); + else if (tabControlMain.SelectedTab == tabPageStartCtl) + mainPageStartMgr.StartMListExpandAll(); + } + #endregion //标签点击事件 @@ -8030,39 +937,39 @@ private void tabControlMain_Selected(object sender, TabControlEventArgs e) { if (e.TabPage == tabPageProcCtl) { - ProcessListInit(); + mainPageProcess.ProcessListInit(); } else if (e.TabPage == tabPageScCtl) { - ScMgrInit(); + mainPageScMgr.ScMgrInit(); } else if (e.TabPage == tabPageFileCtl) { - FileMgrInit(); + mainPageFileMgr.FileMgrInit(); } else if (e.TabPage == tabPageUWPCtl) { - UWPListInit(); + mainPageUwpMgr.UWPListInit(); } else if (e.TabPage == tabPagePerfCtl) { - PerfInit(); + mainPagePerf.PerfInit(); } else if (e.TabPage == tabPageStartCtl) { - StartMListInit(); + mainPageStartMgr.StartMListInit(); } else if (e.TabPage == tabPageKernelCtl) { - KernelListInit(); + mainPageKernelDrvMgr.KernelListInit(); } else if (e.TabPage == tabPageDetals) { - ProcessListDetailsInit(); + mainPageProcessDetails.ProcessListDetailsInit(); } else if (e.TabPage == tabPageUsers) { - UsersListInit(); + mainPageUserMgr.UsersListInit(); } } diff --git a/TaskMgr/FormMain.en.resx b/TaskMgr/FormMain.en.resx index de3fdf6..9c4449d 100644 --- a/TaskMgr/FormMain.en.resx +++ b/TaskMgr/FormMain.en.resx @@ -117,12 +117,63 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 6, 6, 6, 6 + + + + 466, 0 + + + 6, 6, 6, 6 + + + 2, 1052 + + + + + + 6, 6, 6, 6 + + + 468, 1052 + + + + + + + + + + + + 1802, 1052 + + + + 468 + + + 8 + + + + + + 2, 56 + + + 6, 6, 6, 6 + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw - CAAAAk1TRnQBSQFMAgEBAwEAASwBBAEsAQQBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA + CAAAAk1TRnQBSQFMAgEBAwEAATQBBAE0AQQBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABEAMAAQEBAAEgBgABELYAAlgBYgHvAlgBYgHvDAACWAFiAe8CWAFiAe+EAAGyAgAB/wwAAmIBWAHv AdwBjwEAAf8B6AGXAQAB/wHoAZcBAAH/AegBlwEAAf8BwwIAAf8CRwFGAYAcAAGOAeQC/wGNAeMC/wGL AeMC/wGKAeIC/wGIAeIC/wGHAeEC/wIAAb4B/wIAAeYB/wIAAbwB/wEAAdYB/AH/AgABuQH/AgAB3gH/ @@ -163,6 +214,18 @@ AR4B4AEHAgAG/wIACw== + + 6, 6, 6, 6 + + + 452, 986 + + + + + + + File Name @@ -181,12 +244,18 @@ Attribute + + 6, 6, 6, 6 + + + 1340, 986 + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw - BAAAAk1TRnQBSQFMAwEBAAH0AQMB9AEDARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA + BAAAAk1TRnQBSQFMAwEBAAH8AQMB/AEDARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA ARADAAEBAQABIAYAARA8AAHNAf8MAAJQAVEBnwJQAVEBn8wAAvsB+gH/AvsB+gH/AvsB+gH/AvsB+gH/ AvsB+gH/AvsB+gH/A/0B/wIAAdsB/wIAAdkB/wP9Af8CUAFRAZ8CAAHeAf8CUAFRAZ/MAAP7Af8B9wL2 Af8B9wH2AfUB/wH3AfYB9QH/AfcB9gH1Af8B9wH2AfUB/wH3AfYB9QH/AvsB+gH/AgAB2wH/AgAB2QH/ @@ -209,13 +278,180 @@ Av8GAAs= - + + + + + + + + 1800, 986 + + + 452 + + + 8 + + + + + + 250, 1080 + + + 6, 6, 6, 6 + + + 2, 28 + + + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK + ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P + B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO + vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 + HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo + xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK + nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC + qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv + EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 + vqgqAAAAAElFTkSuQmCC + + + + 550, 1072 + + + 6, 6, 6, 6 + + + 418, 46 + + + Show process of all users + + + + + + 524, 1082 + + + 6, 6, 6, 6 + + + 2, 28 + + + + + + 1588, 1062 + + + 6, 6, 6, 6 + + + 194, 48 + + + &End Process + + + + + + 6, 6, 6, 6 + + + No show? Try refreshing it. + + + 1802, 1050 + + + + + + 290, 1086 + + + 6, 0, 6, 0 + + + 214, 24 + + + Process Count:-- + + + + + + 22, 1070 + + + 6, 6, 6, 6 + + + 214, 42 + + + Fewer &Detals + + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + + + Process + + + + + + 186, 1078 + + + 6, 6, 6, 6 + + + 2, 28 + + + + - 136, 541 + 272, 1082 + + + 6, 0, 6, 0 + + + 208, 31 Open kernel tool + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -232,39 +468,65 @@ - 322, 48 + 644, 96 + + + 6, 0, 6, 0 - 263, 21 + 526, 42 Restart as administrator and load driver + + + - 3, 25 + 6, 50 + + + 6, 0, 6, 0 - 899, 23 + 1798, 46 Kernel driver not load + + + - -4, 198 + -8, 396 + + + 6, 6, 6, 6 - 905, 103 + 1810, 206 + + + + + + 32, 1074 + + + 6, 0, 6, 0 - 101, 12 + 204, 31 Driver Count:-- + + + Name - 153 @@ -292,30 +554,150 @@ Publisher + + 6, 6, 6, 6 + + + 1802, 1038 + + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + Kernel + + + + + 26, 1072 + + + 6, 0, 6, 0 + - 165, 17 + 330, 34 Open resource monitor + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + Performance + + + + + 6, 0, 6, 0 + + + 966, 456 + Unkow error + + + + + 420, 320 + + + 6, 6, 6, 6 + + + 966, 456 + + + + + + 6, 6, 6, 6 + No data to display + + 1796, 1050 + + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + Universal apps + + + + + -2, 0 + + + 6, 6, 6, 6 + + + 1802, 1050 + + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + Users + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -332,31 +714,58 @@ - 360, 40 + 720, 80 + + + 6, 0, 6, 0 - 167, 21 + 334, 42 Restart as administrator + + + - 248, 23 + 496, 46 + + + 6, 0, 6, 0 - 383, 12 + 731, 31 I need to run as administrator to enumlate service information. + + + - 0, 209 + 0, 418 + + + 6, 6, 6, 6 - 898, 103 + 1796, 206 + + + - 130, 540 + 260, 1080 + + + 6, 6, 6, 6 + + + 2, 28 + + + @@ -372,14 +781,20 @@ - 137, 534 + 274, 1068 + + + 6, 0, 6, 0 - 155, 25 + 310, 50 Open Service Manager + + + Name @@ -416,33 +831,78 @@ Publisher - - False + + 6, 6, 6, 6 + + + 1802, 1050 + + + - 15, 534 + 30, 1068 + + + 6, 0, 6, 0 - 107, 26 + 214, 52 Service Count:-- - - MiddleCenter + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 Services + + + + + 1610, 1062 + + + 6, 6, 6, 6 + + + 170, 48 + &End Task + + + + + -2, 14 + + + 6, 6, 6, 6 + + + 1802, 1032 + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw - BAAAAk1TRnQBSQFMAwEBAAG4AQcBuAEHARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA + BAAAAk1TRnQBSQFMAwEBAAHAAQcBwAEHARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA ARADAAEBAQABIAYAARA8AAHNAf8MAAJQAVEBnwJQAVEBn8wAAvsB+gH/AvsB+gH/AvsB+gH/AvsB+gH/ AvsB+gH/AvsB+gH/A/0B/wIAAdsB/wIAAdkB/wP9Af8CUAFRAZ8CAAHeAf8CUAFRAZ/MAAP7Af8B9wL2 Af8B9wH2AfUB/wH3AfYB9QH/AfcB9gH1Af8B9wH2AfUB/wH3AfYB9QH/AvsB+gH/AgAB2wH/AgAB2QH/ @@ -465,21 +925,72 @@ Av8GAAs= + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + Details + + + + + 6, 6, 6, 6 + No startup applications + + 1802, 1050 + + + + + + 8, 45 + + + 6, 6, 6, 6 + + + 6, 6, 6, 6 + + + 1802, 1135 + Start apps + + + + + 32, 1070 + + + 6, 0, 6, 0 + - 35, 12 + 85, 31 Ready + + + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -496,159 +1007,273 @@ RK5CYII= - - File Manager + + 1750, 8 - - 125, 540 + + 6, 6, 6, 6 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK - ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P - B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO - vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 - HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo - xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK - nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC - qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv - EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 - vqgqAAAAAElFTkSuQmCC - + + 40, 40 - - 275, 536 + + 6, 12 - - 209, 23 + + 6, 6, 6, 6 - - Show process of all users + + 1732, 32 - - 262, 541 + + - - 794, 531 + + 8, 45 - - 97, 24 + + 6, 6, 6, 6 - - &End Process + + 6, 6, 6, 6 - - No show? Try refreshing it. + + 1802, 1135 - - 145, 543 + + File Manager - - 107, 12 + + - - Process Count:-- + + 6, 6, 6, 6 - - 107, 21 + + 1818, 1188 - - Fewer &Detals + + - - Process + + 4, 450 + + + 6, 0, 6, 0 + + + 1800, 168 Initializing... + + + + + 0, 1100 + + + 6, 6, 6, 6 + + + 1814, 2 + + + + - 203, 22 + 338, 36 Open app - 203, 22 + 338, 36 Uinstall app - 203, 22 + 338, 36 Open Install Directory - 203, 22 + 338, 36 Copy name - 203, 22 + 338, 36 Copy full name - 203, 22 + 338, 36 &Copy info - 204, 136 + 339, 220 + + + + + + 6, 6, 6, 6 No application currently running. You can click "More details" to view more background application information. + + 1814, 1088 + + + + + + 32, 1120 + + + 6, 6, 6, 6 + + + 204, 42 + More &Detals + + + + + 1618, 1116 + + + 6, 6, 6, 6 + + + 170, 48 + &End Task + + + + + 6, 6, 6, 6 + + + 1814, 1186 + + + + - 182, 22 + 299, 36 &Hide column - 182, 22 + 299, 36 &Choose columns - 179, 6 + 296, 6 - 182, 22 + 299, 36 Size column to &Fit - 183, 76 + 300, 118 + + + - 96, 22 + 128, 36 s/h - 96, 22 + 128, 36 &Exit - 97, 48 + 129, 76 + + + + + + 6, 6, 6, 6 + + + 1814, 1186 + + + + + + 157, 6 + + + 184, 38 + + + 184, 38 + + + 160, 38 + + + 184, 38 + + + 184, 38 + + + 160, 38 + + + 184, 38 + + + 184, 38 + + + 160, 38 + + + 160, 36 + + + 161, 46 + + + + + + 12, 24 + + + 1814, 1186 @@ -1274,9 +1899,18 @@ You can click "More details" to view more background application information. + + 6, 6, 6, 6 + + + 374, 229 + PCManager + + + AAABAAQADQ0AAAAAAA1M+wAARgAAABAQAAAAACAAaAQAAJL7AAAgIAAAAAAgAKgQAAD6/wAAMDAAAAAA diff --git a/TaskMgr/FormMain.resx b/TaskMgr/FormMain.resx index db89189..654e3c8 100644 --- a/TaskMgr/FormMain.resx +++ b/TaskMgr/FormMain.resx @@ -117,385 +117,279 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Top, Bottom, Left, Right + + - - 0, 0 - - - Right - - - 233, 0 - - - 1, 526 + + 104, 17 - - 1 + + 2 - - sp3 + + splitContainerFm - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - splitContainerPerfCtls.Panel1 + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Fill + + PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null - + 0, 0 - - 234, 526 + + + 3, 3, 3, 3 - - 2 + + 1 - - å³ä¾§èµ„æºç®€æ˜“图表 + + 9 performanceLeftList - - PCMgr.Ctls.PerformanceList, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null + + Top, Bottom, Left, Right - - splitContainerPerfCtls.Panel1 + + 2 - - 1 + + tabPageKernelCtl - - splitContainerPerfCtls.Panel1 + + 5 - - System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + - - splitContainerPerfCtls + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + 99 - - True + + columnHeader18 - - splitContainerPerfCtls.Panel2 + + 9 - - System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - splitContainerPerfCtls + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1 + + 6 - - 901, 526 + + 900, 84 - - 234 + + 7 - - 0 + + - - splitContainerPerfCtls + + 微软雅黑, 9pt - - System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 需è¦ç®¡ç†å‘˜æƒé™æ‰èƒ½å¯åŠ¨æœåŠ¡ç®¡ç†å™¨ - - tabPagePerfCtl + + False - - 1 + + tabPageKernelCtl - - Top, Bottom, Left, Right + + tabPageScCtl - - 1, 28 + + 3 - - Fill + + columnHeader16 - + 0 - - 17, 17 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw - CAAAAk1TRnQBSQFMAgEBAwEAAVABCQFQAQkBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA - AwABEAMAAQEBAAEgBgABELYAAlgBYgHvAlgBYgHvDAACWAFiAe8CWAFiAe+EAAGyAgAB/wwAAmIBWAHv - AdwBjwEAAf8B6AGXAQAB/wHoAZcBAAH/AegBlwEAAf8BwwIAAf8CRwFGAYAcAAGOAeQC/wGNAeMC/wGL - AeMC/wGKAeIC/wGIAeIC/wGHAeEC/wIAAb4B/wIAAeYB/wIAAbwB/wEAAdYB/AH/AgABuQH/AgAB3gH/ - AlgBYgHvSAAs/wM6AWAMAAHHAYUBAAH/Ac8BiQEAAf8COgE5AWAB3AGQAQAB/wHoAZgBAAH/AegBmAEA - Af8B6AGYAQAB/wHoAZgBAAH/AegBmAEAAf8B6AGYAQAB/wHoAZgBAAH/AbICAAH/GAABkAHkAv8BtQHt - Av8BjQHjAv8BiwHjAv8BigHiAv8BiAHiAv8BhwHhAv8CAAG+Af8CAAHmAf8CAAHBAf8CAAHiAf8CWAFi - Ae9IAAMMARAw/wwAAccBhQEAAf8B6AGZAQAB/wHoAZkBAAH/AegBmQEAAf8B5AGWAQAB/wJcAVcB3wMq - AUADKgFAAkwBSwGPAcMCAAH/AegBmQEAAf8B6AGZAQAB/wGyAgAB/xQAAZEB5QL/AbcB7QL/AY4B5AL/ - AY0B4wL/AYsB4wL/AYoB4gL/AYgB4gL/AYcB4QL/AgABxAH/AgAB5gH/AgABwQH/TAADXAHfAzIBUCz/ - AwwBEAgAAccBhQEAAf8B6AGaAQAB/wHoAZoBAAH/AeQBlwEAAf8DIQEwFAACYgFYAe8B6AGaAQAB/wHo - AZoBAAH/AkcBRgGAEAABkwHlAv8BtwHuAv8BkAHkAv8BjgHkAv8BjQHjAv8BiwHjAv8BigHiAv8CAAHA - Af8CAAHqAf8CAAHEAf8CAAHmAf8CWAFiAe9IAAT/BAAs/wNcAd8IAAHHAYYBAAH/AegBmgEAAf8B6AGa - AQAB/wHoAZoBAAH/Ac8BiQEAAf8YAAHHAgAB/wHoAZoBAAH/AcMCAAH/EAABlAHmAv8BuQHuAv8BkQHl - Av8BkAHkAv8BjgHkAv8BjQHjAv8CAAHDAf8CAAHuAf8CAAHAAf8BAAHSAfcB/wIAAb4B/wIAAeYB/wJY - AWIB70QABP8DTAGPA1EBnyz/CAABtwIAAf8BxwGFAQAB/wHHAYUBAAH/AccBhAEAAf8BxwGEAQAB/wGy - AgAB/xQAAkwBSwGPAccCAAH/AccCAAH/EAABlgHmAv8BuQHvAv8BkwHlAv8BkQHlAv8BkAHkAv8BjgHk - Av8CAAG8Af8CAAHDAf8BjAHjAv8BjAHeAfgB/wFZAlwBzwJYAWIB7wJYAWIB70QACP8EACz/A0wBj0wA - AZcB5wL/AbsB7wL/AZQB5gL/AZMB5QL/AZEB5QL/AZAB5AL/AY4B5AL/AY0B4wL/AYsB4wL/AbMB7AL/ - UAAI/wMqAUADXAHPLP9MAAGXAecC/wG7Ae8C/wGWAeYC/wGUAeYC/wGTAeUC/wGRAeUC/wGQAeQC/wGO - AeQC/wGNAeMC/wGzAe0C/1AADP8DDAEQMAACUQFQAZ8B6AGXAQAB/wHkAZQBAAH/GAABzwGFAQAB/wHo - AZcBAAH/AegBlwEAAf8B6AGXAQAB/wHoAZcBAAH/AyoBQAwAAZcB5wL/AbsB7wL/AZcB5wL/AZYB5gL/ - AZQB5gL/AZMB5QL/AZEB5QL/AZAB5AL/AY4B5AL/AbUB7QL/TAADDAEQNP8QAAHkAZYBAAH/AegBmAEA - Af8CYgFYAe8YAAHPAYUBAAH/AegBmAEAAf8B6AGYAQAB/wHoAZgBAAH/AyoBQAwAAZcB5wL/AbsB7wL/ - AZcB5wL/AZcB5wL/AZYB5gL/AZQB5gL/AZMB5QL/AZEB5QL/AZAB5AL/AbUB7QL/UAA0/xAAAlwBVwHf - AegBmQEAAf8B6AGZAQAB/wJiAVgB7xAAA0ABcAHcAY8BAAH/AegBmQEAAf8B6AGZAQAB/wHoAZkBAAH/ - AyoBQAwAAZcB5wL/AbsB7wL/AZcB5wL/AZcB5wL/AZcB5wL/AZYB5gL/AZQB5gL/AZMB5QL/AZEB5QL/ - AbcB7QL/ZAADDAEQGP8YAAGyAgAB/wHoAZoBAAH/AegBmgEAAf8B5AGXAQAB/wHHAYIBAAH/AccBggEA - Af8B0wGKAQAB/wHoAZoBAAH/AegBmgEAAf8B5AGWAQAB/wHPAYUBAAH/AegBmgEAAf8DKgFADAABlwHn - Av8BuwHvAv8BlwHnAv8BlwHnAv8BlwHnAv8BlwHnAv8BlgHmAv8BlAHmAv8BkwHlAv8BtwHuAv9sABD/ - IAACXAFXAd8B5AGXAQAB/wHoAZoBAAH/AegBmgEAAf8B6AGaAQAB/wHoAZoBAAH/AegBmgEAAf8BxwGA - AQAB/wMhATAEAAHPAYUBAAH/AyoBQAwAAZcB5wL/AbsB7wL/AZcB5wL/AZcB5wL/AZcB5wL/AZcB5wL/ - AZcB5wL/AZYB5gL/AZQB5gL/AbkB7gL/pAACUQFQAZ8BsgIAAf8BtwIAAf8CXAFZAc8DMgFQEAADKgFA - DQAB0AHyAf8BAAHQAfEB/wEAAc8B8QH/AQABzgHwAf8BAAHOAfAB/wEAAc0B7wH/AQABzAHvAf8BAAHM - Ae4B/wEAAcsB7gH/AQABygHtAf//AE0AAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcA - A/8BAAX/AZwCAAL/AbgBDwHgAwABwAEDAYABBwHgAQECAAGAAQMBgAEDAeABAwIAAYABAQGDAeEB4AEB - AgABoAEBAYMB8QHgAwABgAEBAYEB8QHgAwABkAEAAv8B4AEHAgABgAEAAv8B4AEHAgABhwH/AY8BwAHg - AQcDAAEDAccC4AEHAgABgAEDAcMBwAHgAQcCAAH8AQcB4AEAAeABBwIAAf8BDwHwAQQB4AEHAgAC/wH8 - AR4B4AEHAgAG/wIACw== - + + - - 0, 0 + + æœåŠ¡æ•°ï¼š-- - - 0 + + 898, 525 - - 226, 493 + + 3, 3, 3, 3 - - 0 + + 0, 0 - - treeFmLeft + + pl_simple - - System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + - - splitContainerFm.Panel1 + + 93, 539 - - 0 + + 901, 525 - - splitContainerFm.Panel1 + + 8 - - System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 173 - - splitContainerFm + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw + BAAAAk1TRnQBSQFMAwEBAAEgAQkBJAEJARABAAEQAQAE/wEhARAI/wFCAU0BNgcAATYDAAEoAwABQAMA + ARADAAEBAQABIAYAARA8AAHNAf8MAAJQAVEBnwJQAVEBn8wAAvsB+gH/AvsB+gH/AvsB+gH/AvsB+gH/ + AvsB+gH/AvsB+gH/A/0B/wIAAdsB/wIAAdkB/wP9Af8CUAFRAZ8CAAHeAf8CUAFRAZ/MAAP7Af8B9wL2 + Af8B9wH2AfUB/wH3AfYB9QH/AfcB9gH1Af8B9wH2AfUB/wH3AfYB9QH/AvsB+gH/AgAB2wH/AgAB2QH/ + AgAB4gH/AlABUQGf0AAB/AL7Af8B+AH3AfYB/wH4AfcB9gH/AfgB9wH2Af8B+AH3AfYB/wH3AfYB9QH/ + AfcB9gH1Af8B+AH3AfYB/wIAAcoB/wIAAecB/wIAAdkB/9QAAfwC+wH/AfgC9wH/AfgC9wH/AfgB9wH2 + Af8B+AH3AfYB/wH4AfcB9gH/AvgB9wH/AgABzAH/AgAB6wH/AgABzAH/AgAB2wH/AgAB2QH/0AAC/AH7 + Af8B+QH4AfcB/wH5AfgB9wH/AfkB+AH3Af8B+AL3Af8B+AH3AfYB/wGjAZ0B3QH/AgAB8AH/AgABzAH/ + A/sB/wYAAdsB/wIAAc0B/8wAA/wB/wH5AvgB/wH5AvgB/wH5AfgB9wH/AfkB+AH3Af8C+AH3Af8B+QH4 + AfcB/wGjAZ0B3QH/AfkB+AH3Af8C+wH6Af/YAAH9AvwB/wH6AfkB+AH/AvkB+AH/AvkB+AH/AfkC+AH/ + AfkB+AH3Af8B+QH4AfcB/wH4AfcB9gH/AfgB9wH2Af8D+wH/2AAB/QL8Af8B+gH5AfgB/wH5AvgB/wH6 + AfkB+AH/AvkB+AH/AfkC+AH/AfkB+AH3Af8C+AH3Af8B+AH3AfYB/wH8AvsB/9gAAf0C/AH/AfoC+QH/ + AvoB+QH/AfoB+QH4Af8B+gH5AfgB/wL5AfgB/wH5AvgB/wH5AfgB9wH/AfgC9wH/AfwC+wH/2AAC/QH8 + Af8C+gH5Af8B+wH6AfkB/wH6AvkB/wH6AfkB+AH/AfoB+QH4Af8B+QL4Af8B+QH4AfcB/wL4AfcB/wH8 + AvsB/9gAA/0B/wH7AvoB/wL6AfkB/wH7AfoB+QH/AvoB+QH/AfkC+AH/AvkB+AH/AukB6AH/AekB6AHn + Af8B7ALrAf/YAAP9Af8C+wH6Af8B+wL6Af8C+gH5Af8B+gL5Af8B+gH5AfgB/wL5AfgB/wOmAf8D6QH/ + A9MB/9gAA/0B/wL7AfoB/wH7AvoB/wL6AfkB/wH6AvkB/wH6AfkB+AH/AvkB+AH/A6YB/wHeAt0B/wMh + ATDYAAOlAf8DowH/AaICoQH/A6AB/wOeAf8CnQGcAf8CmwGaAf8BmgKZAf8DIQEw/wDRAAFCAU0BPgcA + AT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB/wHcBgAB4AcAAeABAQYAAeABAwYAAeABAQYA + AeABBAYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABDwYA + Av8cAAs= + - - 0 - - - 文件å - - - 196 - - - 文件类型 - - - 63 - - - å¤§å° - - - 63 - - - 创建时间 - - - 127 - - - 修改时间 + + 百分比ToolStripMenuItemDisk - - 119 + + 901, 526 - - 属性 + + 显示所有用户的进程(&A) - - 83 + + Bottom, Left - + Fill - + 0, 0 - - 670, 493 - - - 192, 17 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw - BAAAAk1TRnQBSQFMAwEBAAEYAQkBGAEJARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA - ARADAAEBAQABIAYAARA8AAHNAf8MAAJQAVEBnwJQAVEBn8wAAvsB+gH/AvsB+gH/AvsB+gH/AvsB+gH/ - AvsB+gH/AvsB+gH/A/0B/wIAAdsB/wIAAdkB/wP9Af8CUAFRAZ8CAAHeAf8CUAFRAZ/MAAP7Af8B9wL2 - Af8B9wH2AfUB/wH3AfYB9QH/AfcB9gH1Af8B9wH2AfUB/wH3AfYB9QH/AvsB+gH/AgAB2wH/AgAB2QH/ - AgAB4gH/AlABUQGf0AAB/AL7Af8B+AH3AfYB/wH4AfcB9gH/AfgB9wH2Af8B+AH3AfYB/wH3AfYB9QH/ - AfcB9gH1Af8B+AH3AfYB/wIAAcoB/wIAAecB/wIAAdkB/9QAAfwC+wH/AfgC9wH/AfgC9wH/AfgB9wH2 - Af8B+AH3AfYB/wH4AfcB9gH/AvgB9wH/AgABzAH/AgAB6wH/AgABzAH/AgAB2wH/AgAB2QH/0AAC/AH7 - Af8B+QH4AfcB/wH5AfgB9wH/AfkB+AH3Af8B+AL3Af8B+AH3AfYB/wGjAZ0B3QH/AgAB8AH/AgABzAH/ - A/sB/wYAAdsB/wIAAc0B/8wAA/wB/wH5AvgB/wH5AvgB/wH5AfgB9wH/AfkB+AH3Af8C+AH3Af8B+QH4 - AfcB/wGjAZ0B3QH/AfkB+AH3Af8C+wH6Af/YAAH9AvwB/wH6AfkB+AH/AvkB+AH/AvkB+AH/AfkC+AH/ - AfkB+AH3Af8B+QH4AfcB/wH4AfcB9gH/AfgB9wH2Af8D+wH/2AAB/QL8Af8B+gH5AfgB/wH5AvgB/wH6 - AfkB+AH/AvkB+AH/AfkC+AH/AfkB+AH3Af8C+AH3Af8B+AH3AfYB/wH8AvsB/9gAAf0C/AH/AfoC+QH/ - AvoB+QH/AfoB+QH4Af8B+gH5AfgB/wL5AfgB/wH5AvgB/wH5AfgB9wH/AfgC9wH/AfwC+wH/2AAC/QH8 - Af8C+gH5Af8B+wH6AfkB/wH6AvkB/wH6AfkB+AH/AfoB+QH4Af8B+QL4Af8B+QH4AfcB/wL4AfcB/wH8 - AvsB/9gAA/0B/wH7AvoB/wL6AfkB/wH7AfoB+QH/AvoB+QH/AfkC+AH/AvkB+AH/AukB6AH/AekB6AHn - Af8B7ALrAf/YAAP9Af8C+wH6Af8B+wL6Af8C+gH5Af8B+gL5Af8B+gH5AfgB/wL5AfgB/wOmAf8D6QH/ - A9MB/9gAA/0B/wL7AfoB/wH7AvoB/wL6AfkB/wH6AvkB/wH6AfkB+AH/AvkB+AH/A6YB/wHeAt0B/wMh - ATDYAAOlAf8DowH/AaICoQH/A6AB/wOeAf8CnQGcAf8CmwGaAf8BmgKZAf8DIQEw/wDRAAFCAU0BPgcA - AT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB/wHcBgAB4AcAAeABAQYAAeABAwYAAeABAQYA - AeABBAYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABDwYA - Av8GAAs= - - - - 0 - - - listFm + + lbDriversCount - - System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Flat - - splitContainerFm.Panel2 + + 0, 0 - + 0 - - splitContainerFm.Panel2 + + pl_driverNotLoadTip - - System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.IO.FileSystemWatcher, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - splitContainerFm + + lbScNeedAdminTip - - 1 + + spl1 - - 900, 493 + + 1, 14 - - 226 + + Bottom, Left - - 1 + + 100, 22 - - splitContainerFm + + 901, 564 - - System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + textBoxFmCurrent - - tabPageFileCtl + + 性能监视 3 - - Top, Bottom, Left, Right + + columnHeader1 - - Bottom, Left + + btnEndProcessDetals - - NoControl + + 0 - - 112, 540 + + MiddleRight - - 1, 14 + + 0 - - 9 + + pl_perfGridHost - - sp4 + + å¤åˆ¶å称ToolStripMenuItem - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + pl_UWPEnumFailTip + + + columnHeader11 tabPageProcCtl - - 0 - - - Bottom, Left + + expandMoreDetals - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK - ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P - B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO - vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 - HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo - xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK - nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC - qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv - EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 - vqgqAAAAAElFTkSuQmCC - + + listService - - MiddleLeft + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 NoControl @@ -503,1832 +397,860 @@ 215, 533 - - 190, 23 + + True - - 3 + + NoControl - - 显示所有用户的进程(&A) + + - - MiddleCenter + + 0 - - False + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - check_showAllProcess + + splitContainerPerfCtls.Panel1 - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 901, 564 - - tabPageProcCtl + + linkLabelShowKernelTools - - 1 + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Bottom, Left + + 2 - + NoControl - - 203, 539 + + 4 - - 1, 14 + + pl_ScNeedAdminTip - - 7 + + 0 - - False + + 112, 22 - - spl1 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 147, 21 - - tabPageProcCtl + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 2 + + 112, 22 - - Bottom, Right + + fileSystemWatcher - - False + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - NoControl + + 81 - - 806, 533 + + tabPageScCtl - - 85, 24 + + contextMenuStripMainHeader - - 2 + + Fill - - 结æŸè¿›ç¨‹(&E) + + 0 - - btnEndProcess + + tabControlMain - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Bottom, Right - - tabPageProcCtl + + - - 3 + + - - Top, Bottom, Left, Right + + MiddleLeft - - 0, 0 + + - - 没有显示?试试刷新一下 + + 167, 136 - - 901, 525 + + - - 1 + + columnHeader9 - - 主进程视图 + + - - False + + 已登陆用户列表视图 - - listProcess + + å¸è½½åº”用(&U) - - PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null + + contextMenuStripProcDetalsCol - - tabPageProcCtl + + NoControl - - 4 + + 200, 17 - - Bottom, Left + + 901, 564 - - NoControl + + 正在åˆå§‹åŒ–中... - - 119, 533 + + å¸è½½åº”用ToolStripMenuItem - - 78, 22 + + tabPagePerfCtl - - 5 + + 百分比ToolStripMenuItemRam - - 进程数:-- + + linkRestartAsAdminDriver - - MiddleLeft + + tabPageUsers - - lbProcessCount + + - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 4, 26 - - tabPageProcCtl + + -1, 7 - - 5 + + Right - + Bottom, Left - - Flat - - - NoControl + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 11, 535 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 110, 21 + + tabControlMain - - 10 + + spBottom - - 简略信æ¯(&D) + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK + ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P + B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO + vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 + HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo + xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK + nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC + qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv + EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 + vqgqAAAAAElFTkSuQmCC + - - False + + splitContainerPerfCtls - - expandFewerDetals + + Top, Bottom, Left, Right - - PCMgr.Aero.ExpandButton, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null + + PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null - - tabPageProcCtl + + tabPageDetals - - 6 + + 6, 6, 6, 6 - - 4, 26 + + Top, Bottom, Left, Right - - 3, 3, 3, 3 + + 13 - - 901, 564 + + True - + 0 - - è¿›ç¨‹ç®¡ç† + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPageProcCtl + + PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabControlMain + + - - 0 + + 0, 0 - - Bottom, Left + + 简略信æ¯(&D) - - NoControl + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 93, 539 + + Bottom, Left - - 1, 14 + + - - 14 + + 13, 536 - - sp5 + + 2 - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 809, 558 - - tabPageKernelCtl + + - - 0 - - - Bottom, Left - - - True - - - 102, 537 + + 1 - - 104, 17 + + 0 - - 13 + + 2 - - 显示内核管ç†å·¥å…· + + 1 - - linkLabelShowKernelTools + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + imageListFileTypeList - - tabPageKernelCtl + + 0 - - 1 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - None + + contextMenuStripTray - + - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK - ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P - B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO - vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 - HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo - xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK - nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC - qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv - EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 - vqgqAAAAAElFTkSuQmCC + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw + CAAAAk1TRnQBSQFMAgEBAwEAAVABCQFUAQkBEAEAARABAAT/ASEBEAj/AUIBTQE2BwABNgMAASgDAAFA + AwABEAMAAQEBAAEgBgABELYAAlgBYgHvAlgBYgHvDAACWAFiAe8CWAFiAe+EAAGyAgAB/wwAAmIBWAHv + AdwBjwEAAf8B6AGXAQAB/wHoAZcBAAH/AegBlwEAAf8BwwIAAf8CRwFGAYAcAAGOAeQC/wGNAeMC/wGL + AeMC/wGKAeIC/wGIAeIC/wGHAeEC/wIAAb4B/wIAAeYB/wIAAbwB/wEAAdYB/AH/AgABuQH/AgAB3gH/ + AlgBYgHvSAAs/wM6AWAMAAHHAYUBAAH/Ac8BiQEAAf8COgE5AWAB3AGQAQAB/wHoAZgBAAH/AegBmAEA + Af8B6AGYAQAB/wHoAZgBAAH/AegBmAEAAf8B6AGYAQAB/wHoAZgBAAH/AbICAAH/GAABkAHkAv8BtQHt + Av8BjQHjAv8BiwHjAv8BigHiAv8BiAHiAv8BhwHhAv8CAAG+Af8CAAHmAf8CAAHBAf8CAAHiAf8CWAFi + Ae9IAAMMARAw/wwAAccBhQEAAf8B6AGZAQAB/wHoAZkBAAH/AegBmQEAAf8B5AGWAQAB/wJcAVcB3wMq + AUADKgFAAkwBSwGPAcMCAAH/AegBmQEAAf8B6AGZAQAB/wGyAgAB/xQAAZEB5QL/AbcB7QL/AY4B5AL/ + AY0B4wL/AYsB4wL/AYoB4gL/AYgB4gL/AYcB4QL/AgABxAH/AgAB5gH/AgABwQH/TAADXAHfAzIBUCz/ + AwwBEAgAAccBhQEAAf8B6AGaAQAB/wHoAZoBAAH/AeQBlwEAAf8DIQEwFAACYgFYAe8B6AGaAQAB/wHo + AZoBAAH/AkcBRgGAEAABkwHlAv8BtwHuAv8BkAHkAv8BjgHkAv8BjQHjAv8BiwHjAv8BigHiAv8CAAHA + Af8CAAHqAf8CAAHEAf8CAAHmAf8CWAFiAe9IAAT/BAAs/wNcAd8IAAHHAYYBAAH/AegBmgEAAf8B6AGa + AQAB/wHoAZoBAAH/Ac8BiQEAAf8YAAHHAgAB/wHoAZoBAAH/AcMCAAH/EAABlAHmAv8BuQHuAv8BkQHl + Av8BkAHkAv8BjgHkAv8BjQHjAv8CAAHDAf8CAAHuAf8CAAHAAf8BAAHSAfcB/wIAAb4B/wIAAeYB/wJY + AWIB70QABP8DTAGPA1EBnyz/CAABtwIAAf8BxwGFAQAB/wHHAYUBAAH/AccBhAEAAf8BxwGEAQAB/wGy + AgAB/xQAAkwBSwGPAccCAAH/AccCAAH/EAABlgHmAv8BuQHvAv8BkwHlAv8BkQHlAv8BkAHkAv8BjgHk + Av8CAAG8Af8CAAHDAf8BjAHjAv8BjAHeAfgB/wFZAlwBzwJYAWIB7wJYAWIB70QACP8EACz/A0wBj0wA + AZcB5wL/AbsB7wL/AZQB5gL/AZMB5QL/AZEB5QL/AZAB5AL/AY4B5AL/AY0B4wL/AYsB4wL/AbMB7AL/ + UAAI/wMqAUADXAHPLP9MAAGXAecC/wG7Ae8C/wGWAeYC/wGUAeYC/wGTAeUC/wGRAeUC/wGQAeQC/wGO + AeQC/wGNAeMC/wGzAe0C/1AADP8DDAEQMAACUQFQAZ8B6AGXAQAB/wHkAZQBAAH/GAABzwGFAQAB/wHo + AZcBAAH/AegBlwEAAf8B6AGXAQAB/wHoAZcBAAH/AyoBQAwAAZcB5wL/AbsB7wL/AZcB5wL/AZYB5gL/ + AZQB5gL/AZMB5QL/AZEB5QL/AZAB5AL/AY4B5AL/AbUB7QL/TAADDAEQNP8QAAHkAZYBAAH/AegBmAEA + Af8CYgFYAe8YAAHPAYUBAAH/AegBmAEAAf8B6AGYAQAB/wHoAZgBAAH/AyoBQAwAAZcB5wL/AbsB7wL/ + AZcB5wL/AZcB5wL/AZYB5gL/AZQB5gL/AZMB5QL/AZEB5QL/AZAB5AL/AbUB7QL/UAA0/xAAAlwBVwHf + AegBmQEAAf8B6AGZAQAB/wJiAVgB7xAAA0ABcAHcAY8BAAH/AegBmQEAAf8B6AGZAQAB/wHoAZkBAAH/ + AyoBQAwAAZcB5wL/AbsB7wL/AZcB5wL/AZcB5wL/AZcB5wL/AZYB5gL/AZQB5gL/AZMB5QL/AZEB5QL/ + AbcB7QL/ZAADDAEQGP8YAAGyAgAB/wHoAZoBAAH/AegBmgEAAf8B5AGXAQAB/wHHAYIBAAH/AccBggEA + Af8B0wGKAQAB/wHoAZoBAAH/AegBmgEAAf8B5AGWAQAB/wHPAYUBAAH/AegBmgEAAf8DKgFADAABlwHn + Av8BuwHvAv8BlwHnAv8BlwHnAv8BlwHnAv8BlwHnAv8BlgHmAv8BlAHmAv8BkwHlAv8BtwHuAv9sABD/ + IAACXAFXAd8B5AGXAQAB/wHoAZoBAAH/AegBmgEAAf8B6AGaAQAB/wHoAZoBAAH/AegBmgEAAf8BxwGA + AQAB/wMhATAEAAHPAYUBAAH/AyoBQAwAAZcB5wL/AbsB7wL/AZcB5wL/AZcB5wL/AZcB5wL/AZcB5wL/ + AZcB5wL/AZYB5gL/AZQB5gL/AbkB7gL/pAACUQFQAZ8BsgIAAf8BtwIAAf8CXAFZAc8DMgFQEAADKgFA + DQAB0AHyAf8BAAHQAfEB/wEAAc8B8QH/AQABzgHwAf8BAAHOAfAB/wEAAc0B7wH/AQABzAHvAf8BAAHM + Ae4B/wEAAcsB7gH/AQABygHtAf//AE0AAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcA + A/8BAAX/AZwCAAL/AbgBDwHgAwABwAEDAYABBwHgAQECAAGAAQMBgAEDAeABAwIAAYABAQGDAeEB4AEB + AgABoAEBAYMB8QHgAwABgAEBAYEB8QHgAwABkAEAAv8B4AEHAgABgAEAAv8B4AEHAgABhwH/AY8BwAHg + AQcDAAEDAccC4AEHAgABgAEDAcMBwAHgAQcCAAH8AQcB4AEAAeABBwIAAf8BDwHwAQQB4AEHAgAC/wH8 + AR4B4AEHAgAG/xgACw== - - MiddleLeft + + 805, 531 - - NoControl + + 10 - - 179, 39 + + tabPageKernelCtl - - 207, 21 + + Bottom, Left - - 9 + + sp5 - - 以管ç†å‘˜æƒé™é‡å¯è½¯ä»¶å¹¶åŠ è½½é©±åŠ¨ + + MiddleCenter - - MiddleRight + + columnHeader23 - - linkRestartAsAdminDriver + + 值 - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + - - pl_driverNotLoadTip + + 2 - - 0 + + 网络ToolStripMenuItem - - NoControl + + Fill - - 23, 16 + + 当å‰æ²¡æœ‰å¯åŠ¨é¡¹ - - 520, 23 + + 1 - - 0 + + 1 - - 驱动没有加载 + + 百分比 - - TopCenter + + NoControl - - lbRestartAsAdminDriver + + - + + MiddleRight + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - pl_driverNotLoadTip + + 百分比 - - 1 + + NoControl - - 162, 198 + + 6, 12 - - 563, 103 + + System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 11 + + éšè—列(&H) - - False + + System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - pl_driverNotLoadTip + + 驱动路径 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + columnHeader6 - - tabPageKernelCtl + + NoControl - - 2 + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Bottom, Left + + Fill - - True + + listStartup - - NoControl + + 13 - - 16, 537 + + - - 66, 17 + + 85, 24 - - 6 + + 1 - - 驱动数:-- + + $this - - lbDriversCount + + columnHeader10 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tabPageProcCtl - - tabPageKernelCtl + + 162, 198 - - 3 + + 0, 0 - - Top, Bottom, Left, Right + + 85, 24 - - 驱动å称 + + 901, 564 - - 154 + + 483, 228 - - åŸºåœ°å€ + + Bottom, Left - - 100 + + tabControlMain - - å¤§å° + + 值ToolStripMenuItemNet - - 87 + + 190, 23 - - 驱动对象 + + columnHeader13 - - 81 + + 907, 1 - - 驱动路径 + + columnHeader8 - - 190 + + 325, 228 - - æœåŠ¡å + + - - 90 + + System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - åŠ è½½é¡ºåº + + PCMgr.Aero.ExpandButton, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null - - 46 + + toolTip - - å‘布者 + + splitContainerPerfCtls.Panel2 - - 128 + + - - 0, 0 + + 6 - - 901, 519 + + listProcess - - 12 + + columnHeader4 - - listDrivers + + listUsers - - System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tabPageProcCtl - - tabPageKernelCtl + + 14 - - 4 + + 详细信æ¯(&D) - - 4, 26 + + 1 - - 3, 3, 3, 3 + + 166, 22 - - 901, 564 + + 打开应用ToolStripMenuItem - - 1 + + 内存 - - å†…æ ¸ç®¡ç† + + 3 - - tabPageKernelCtl + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabControlMain + + tabPageKernelCtl - - 1 + + 0, 0 - - Bottom, Left + + tabPagePerfCtl - - MiddleLeft + + 12 - - NoControl + + 160, 22 - - 13, 536 + + å¤åˆ¶(&C) - - 112, 17 + + 112, 22 - - 3 + + 32, 17 - - 打开资æºç›‘视器 + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - MiddleRight + + 0 - - linkLabelOpenPerfMon + + 210, 22 - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPagePerfCtl + + 112, 17 - - 0 + + NoControl - - 4, 26 + + è¯¦ç»†ä¿¡æ¯ - - 3, 3, 3, 3 + + System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 901, 564 + + 866, 16 - - 7 + + tabPageDetals - - 性能监视 + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPagePerfCtl + + 0 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + $this - - tabControlMain + + 203, 539 - + 2 - - None - - - Fill + + False - - NoControl + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0, 0 + + True - - 483, 228 + + 0 - + 0 - - 未知错误 + + System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - MiddleCenter + + 3 - - lbUWPEnumFailText + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 5 - - pl_UWPEnumFailTip + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + NoControl - - 210, 160 - - - 483, 228 - - - 11 + + 5 - + False - - pl_UWPEnumFailTip + + 5 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 4 - - tabPageUWPCtl + + tabPageKernelCtl - - 0 + + 1 - - Top, Bottom, Left, Right + + lbProcessCount - - 0, 0 + + 1 - - 没有数æ®æ˜¾ç¤º + + 119, 533 - - 898, 525 + + 1 - - 12 + + 就绪 - - 通用应用列表视图 + + 100 - - listUwpApps + + - - PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null + + Top, Left, Right - - tabPageUWPCtl + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1 + + None - - 4, 26 + + é€€å‡ºç¨‹åº - - 3, 3, 3, 3 + + Bottom, Left - - 901, 564 + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 6 + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 通用应用 + + 4, 26 - - tabPageUWPCtl + + tabPageProcCtl - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 4, 26 - - tabControlMain + + CenterScreen - - 3 + + Top, Bottom, Left, Right - - 微软雅黑, 9pt + + 值 - - -1, 0 + + NoControl - + + tabPageFileCtl + + + 2 + + + 670, 493 + + - - 901, 525 + + False - - 1 + + lbFileMgrStatus - - 已登陆用户列表视图 + + 3 - - listUsers + + Top, Bottom, Left, Right - - PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPageUsers + + columnHeader22 - - 0 + + PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null - - 4, 26 + + 179, 39 - - 3, 3, 3, 3 + + notifyIcon - - 901, 564 + + 未知错误 - - 9 + + 907, 593 - - 用户 + + Top, Bottom, Left, Right - - tabPageUsers + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 5 - + tabControlMain - - 4 + + tabControlMain - - None + + 1, 14 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK - ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P - B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO - vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 - HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo - xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK - nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC - qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv - EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 - vqgqAAAAAElFTkSuQmCC - + + 打开资æºç›‘视器 - - MiddleLeft + + listDrivers - - NoControl + + 211, 76 - - 27, 29 + + 11, 536 - - 147, 21 + + lbStartingStatus - - 9 + + tabPagePerfCtl - - 以管ç†å‘˜æƒé™é‡å¯è½¯ä»¶ + + PCMgr.Aero.ExpandButton, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null - - MiddleRight + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - linkRebootAsAdmin + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 907, 593 - - pl_ScNeedAdminTip + + btnEndProcess - - 0 + + 90 - - True + + 210, 22 - - NoControl + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1, 10 + + 显示éšè—ä¸»ç•Œé¢ - - 200, 17 + + Bottom, Left - - 0 - - - 需è¦ç®¡ç†å‘˜æƒé™æ‰èƒ½å¯åŠ¨æœåŠ¡ç®¡ç†å™¨ - - - lbScNeedAdminTip - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - pl_ScNeedAdminTip - - - 1 - - - 325, 228 - - - 200, 55 - - - 10 - - - False - - - pl_ScNeedAdminTip - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageScCtl - - - 0 - - - Bottom, Left - - - NoControl - - - 90, 538 - - - 1, 14 - - - 9 + + 128 - - sp2 + + 875, 4 - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + - - tabPageScCtl + + True - - 1 + + 112, 22 - - Bottom, Left + + 值ToolStripMenuItemRam - - - iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAb9JREFUSEvt - U1lLAmEU9Ye3EFEP0UJYEZaRmS2DmRoyWYhNZZpaVCYxtqEVLVMPZdgCcZpzmSKwyMEeCjpP3yznfOee - e6/jH78DLjWLQCIP67E+BJM6FnaLIqakC5jNn8u5d0ar74LE4RWypWvoxgMObp5QuHtExriHT8tD2zqy - Lx7O6CK4ZwpRUImuwR3U4AwlpQKKswJewPcW7XuMxXNCpsOe6Xm0dg28kxlDUj/F1k0ZI7Ed9E9F7Tnf - vntAdPsYXX3uKiIriu1fYjJ9WLsoG0YSHQ8pkU+JvDBhVKSZ3coSvHM1xEFSrGQ27f4FY6HFTwlLZs4U - 9ueuwGjYA+vT96DwctGARwlVkfypPcSvn+FLn9QuSIxEMxIHxTlydBSJr2JdL4KL4tu4eHfb7Kq++EtM - xjchDTIjWSu/iLvI2RMCRxWM75ThXKnAqe6iY0iR/ziGtqaDzr0rJtEU8aRv4dIMtHhiaPen0Njplgo4 - x1x1W9vYNhyGV10XQpNnEa2jYTk39E2I016fKs9qKieubS3LG1jqx+5z8xgZl4XbyLGzPtWHwYA5Zqb4 - VLIgMXSPz/+M8BsYl3X883A4XgEYYaNsCNPSbAAAAABJRU5ErkJggg== - - - - MiddleLeft - - - NoControl - - - 94, 536 - - - 79, 17 - - - 8 - - - 打开æœåŠ¡ - - - MiddleRight - - - linkOpenScMsc - - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageScCtl - - - 2 - - - Top, Bottom, Left, Right - - - å称 - - - 113 - - - PID - - - 43 - - - æè¿° - - - 173 - - - çŠ¶æ€ - - - 65 - - - 组 - - - 99 - - - å¯åŠ¨ç±»åž‹ - - - 67 - - - 类型 - - - 62 - - - 文件路径 - - - 180 - - - å‘布者 - - - 85 - - - 0, 0 - - - 901, 525 - - - 0 - - - listService - - - System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageScCtl - - - 3 - - - Bottom, Left - - - NoControl - - - 11, 536 - - - 65, 17 - - - 7 - - - æœåŠ¡æ•°ï¼š-- - - - MiddleCenter - - - lbServicesCount - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageScCtl - - - 4 - - - 4, 26 - - - 3, 3, 3, 3 - - - 901, 564 - - - 3 - - - æœåŠ¡ç®¡ç† - - - tabPageScCtl - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControlMain - - - 5 - - - Bottom, Right - - - False - - - NoControl - - - 805, 531 - - - 85, 24 - - - 3 - - - 结æŸè¿›ç¨‹(&E) - - - btnEndProcessDetals - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageDetals - - - 0 - - - Top, Bottom, Left, Right - - - -1, 7 - - - 903, 518 - - - 17, 34 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw - BAAAAk1TRnQBSQFMAwEBAAEgAQkBIAEJARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA - ARADAAEBAQABIAYAARA8AAHNAf8MAAJQAVEBnwJQAVEBn8wAAvsB+gH/AvsB+gH/AvsB+gH/AvsB+gH/ - AvsB+gH/AvsB+gH/A/0B/wIAAdsB/wIAAdkB/wP9Af8CUAFRAZ8CAAHeAf8CUAFRAZ/MAAP7Af8B9wL2 - Af8B9wH2AfUB/wH3AfYB9QH/AfcB9gH1Af8B9wH2AfUB/wH3AfYB9QH/AvsB+gH/AgAB2wH/AgAB2QH/ - AgAB4gH/AlABUQGf0AAB/AL7Af8B+AH3AfYB/wH4AfcB9gH/AfgB9wH2Af8B+AH3AfYB/wH3AfYB9QH/ - AfcB9gH1Af8B+AH3AfYB/wIAAcoB/wIAAecB/wIAAdkB/9QAAfwC+wH/AfgC9wH/AfgC9wH/AfgB9wH2 - Af8B+AH3AfYB/wH4AfcB9gH/AvgB9wH/AgABzAH/AgAB6wH/AgABzAH/AgAB2wH/AgAB2QH/0AAC/AH7 - Af8B+QH4AfcB/wH5AfgB9wH/AfkB+AH3Af8B+AL3Af8B+AH3AfYB/wGjAZ0B3QH/AgAB8AH/AgABzAH/ - A/sB/wYAAdsB/wIAAc0B/8wAA/wB/wH5AvgB/wH5AvgB/wH5AfgB9wH/AfkB+AH3Af8C+AH3Af8B+QH4 - AfcB/wGjAZ0B3QH/AfkB+AH3Af8C+wH6Af/YAAH9AvwB/wH6AfkB+AH/AvkB+AH/AvkB+AH/AfkC+AH/ - AfkB+AH3Af8B+QH4AfcB/wH4AfcB9gH/AfgB9wH2Af8D+wH/2AAB/QL8Af8B+gH5AfgB/wH5AvgB/wH6 - AfkB+AH/AvkB+AH/AfkC+AH/AfkB+AH3Af8C+AH3Af8B+AH3AfYB/wH8AvsB/9gAAf0C/AH/AfoC+QH/ - AvoB+QH/AfoB+QH4Af8B+gH5AfgB/wL5AfgB/wH5AvgB/wH5AfgB9wH/AfgC9wH/AfwC+wH/2AAC/QH8 - Af8C+gH5Af8B+wH6AfkB/wH6AvkB/wH6AfkB+AH/AfoB+QH4Af8B+QL4Af8B+QH4AfcB/wL4AfcB/wH8 - AvsB/9gAA/0B/wH7AvoB/wL6AfkB/wH7AfoB+QH/AvoB+QH/AfkC+AH/AvkB+AH/AukB6AH/AekB6AHn - Af8B7ALrAf/YAAP9Af8C+wH6Af8B+wL6Af8C+gH5Af8B+gL5Af8B+gH5AfgB/wL5AfgB/wOmAf8D6QH/ - A9MB/9gAA/0B/wL7AfoB/wH7AvoB/wL6AfkB/wH6AvkB/wH6AfkB+AH/AvkB+AH/A6YB/wHeAt0B/wMh - ATDYAAOlAf8DowH/AaICoQH/A6AB/wOeAf8CnQGcAf8CmwGaAf8BmgKZAf8DIQEw/wDRAAFCAU0BPgcA - AT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB/wHcBgAB4AcAAeABAQYAAeABAwYAAeABAQYA - AeABBAYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABDwYA - Av8GAAs= - - - - 0 - - - listProcessDetals - - - System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageDetals - - - 1 - - - 4, 26 - - - 3, 3, 3, 3 - - - 901, 564 - - - 8 - - - è¯¦ç»†ä¿¡æ¯ - - - tabPageDetals - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControlMain - - - 6 - - - Top, Bottom, Left, Right - - - 0, 0 - - - 当å‰æ²¡æœ‰å¯åŠ¨é¡¹ - - - 901, 525 - - - 0 - - - å¯åŠ¨é¡¹åˆ—表视图 - - - listStartup - - - PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null - - - tabPageStartCtl - - - 0 - - - 4, 26 - - - 3, 3, 3, 3 - - - 901, 564 - - - 4 - - - å¯åŠ¨é¡¹ç®¡ç† - - - tabPageStartCtl - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControlMain - - - 7 - - - Bottom, Left - - - True - - - NoControl - - - 16, 535 - - - 32, 17 - - - 6 - - - 就绪 - - - lbFileMgrStatus - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageFileCtl - - - 0 - - - Top, Right - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAjtJREFUOE+11FlrE1EUB/D5Ru47qF/CF1dajVL9Bn3qk/iqNVhKKFmapMnEZJpm - X5plkox5KW1BaFERKghS6GRfH479X3tzJ2lGEHXg/zAD85t7555zpP9yVatV/TikaRpplQqVy2UqlUqk - qioVi0UqFAqUz+cpl8vRZjZL2UyGMuk0pVMpSiWTlEwkKB6P6yccA2k4HP5VYtEYnXCShJXhYbfb/eN0 - Oh32bjQSMYDH25wEleI+XZ9z/zbAkMFgQJGNDQHin01boVLYo2vPVk0DrN1uMzAcDgsQB2C2ZVdil64+ - dU4NMA6uK4oAcZrTwMOjBt1bUOiKxT41wFqtFvX7fVJCIQGiNCbBw6M63V0I0mXLisiT8QBrNpsMDAWD - AkSdTYKWV2G69Nhmnlkbwzj4PhAQIIrWCO5++k4XZ5dP5fYLO72VP/y6n1lmWKPRoF6vRwFZFiA6wAg6 - olt0YWZpLLeer9D2/je2TTmzw54Bq9frDJT9fgGinYygVdbo/KN3o9ycs40wvs2X9k2GcdDv8wkQvWkE - Kztf6dxD6yiLvvIYxleG1Go1Bq55vQJEoxtBFOydeQ+dfbDIom59NsUQvOP1eASIqcFB3k7bewd0w7JE - Z+6/pljpoymm6zp7z+N2CxAjCCCWbkS/HPygeWuc3qypp7bMcb7CVZdLgJhnABG0EQ/qiwcfMwYIDz7u - cjoFiOGIeYYRhKmBRkdvop3QASha1BlKA6eJA8A/wzaxMmBOh0MM2H93SdJPnkQ2KO7DXA0AAAAASUVO - RK5CYII= - - - - NoControl - - - 875, 4 - - - 20, 20 - - - 3 - - - 480, 17 - - - 跳转到 - - - btnFmAddGoto - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageFileCtl - - - 1 - - - Top, Left, Right - - - 3, 6 - - - 866, 16 - - - 2 - - - textBoxFmCurrent - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageFileCtl - - - 2 - - - 4, 26 - - - 3, 3, 3, 3 - - - 901, 564 - - - 5 - - - æ–‡ä»¶ç®¡ç† - - - tabPageFileCtl - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControlMain - - - 8 - - - 微软雅黑, 9pt - - - 0, 0 - - - 909, 594 - - - 0 - - - False - - - tabControlMain - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 6 - - - Left, Right - - - 微软雅黑, 9pt - - - 2, 225 - - - 900, 84 - - - 8 - - - 正在åˆå§‹åŒ–中... - - - MiddleCenter - - - lbStartingStatus - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 5 - - - Bottom, Left, Right - - - NoControl - - - 0, 550 - - - 907, 1 - - - 1 - - - spBottom - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - 735, 17 - - - 166, 22 - - - 打开应用(&O) - - - 166, 22 - - - å¸è½½åº”用(&U) - - - 166, 22 - - - 打开安装ä½ç½®(&D) - - - 166, 22 - - - å¤åˆ¶å称(&N) - - - 166, 22 - - - å¤åˆ¶å®Œæ•´å称(&N) - - - 166, 22 - - - å¤åˆ¶(&C) - - - 167, 136 - - - contextMenuStripUWP - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Top, Bottom, Left, Right - - - 0, 0 - - - 当å‰æ²¡æœ‰è¿è¡Œåº”用 -您å¯ä»¥ç‚¹å‡»"详细信æ¯"æ¥æŸ¥çœ‹æ›´å¤šåŽå°åº”ç”¨çš„ä¿¡æ¯ - - - 907, 544 - - - 11 - - - 正在è¿è¡Œåº”用列表视图 - - - listApps - - - PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null - - - pl_simple - - - 2 - - - Bottom, Left - - - Flat - - - NoControl - - - 16, 560 - - - 102, 21 - - - 14 - - - 详细信æ¯(&D) - - - expandMoreDetals - - - PCMgr.Aero.ExpandButton, PCMgrApp32, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null - - - pl_simple - - - 0 - - - Bottom, Right - - - False - - - NoControl - - - 809, 558 - - - 85, 24 - - - 13 - - - 结æŸä»»åŠ¡(&E) - - - btnEndTaskSimple - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - pl_simple - - - 1 - - - Fill - - - 微软雅黑, 9pt - - - 0, 0 - - - 907, 593 - - - 12 - - - False - - - pl_simple - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 7 - - - 238, 34 - - - 210, 22 - - - éšè—列(&H) - - - 210, 22 - - - 选择列(&C) - - - 207, 6 - - - 210, 22 - - - 将此列调整为åˆé€‚大å°(&F) - - - 211, 76 - - - contextMenuStripProcDetalsCol - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 478, 34 - - - 160, 22 - - - 显示éšè—ä¸»ç•Œé¢ - - - 160, 22 - - - é€€å‡ºç¨‹åº - - - 161, 48 - - - contextMenuStripTray - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - Fill - - - 微软雅黑, 9pt - - - 0, 0 - - - 907, 593 - - - 11 - - - pl_perfGridHost - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 8 - - - 661, 34 - - - 109, 6 - - - 112, 22 - - - 百分比 - - - 112, 22 - - - 值 - - - 100, 22 - - - 内存 - - - 112, 22 - - - 百分比 - - - 112, 22 - - - 值 - - - 100, 22 - - - ç£ç›˜ - - - 112, 22 - - - 百分比 - - - 112, 22 - - - 值 - - - 100, 22 - - - 网络 - - - False - - - 112, 22 - - - 资æºå€¼ - - - False - - - 113, 32 - - - contextMenuStripMainHeader - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 573, 17 - - - en - - - True - - - 55 - - - 6, 12 - - - 907, 593 - - + AAABAAUAAAAAAAEAIADfEwAAVgAAAEBAAAABACAAKEIAADUUAAAwMAAAAQAgAKglAABdVgAAICAAAAEA IACoEAAABXwAABAQAAABACAAaAQAAK2MAACJUE5HDQoaCgAAAA1JSERSAAABAAAAAQAIBgAAAFxyqGYA @@ -2902,387 +1824,196 @@ ///vwf//78H//+/B//fluv/Wrmn///////////////////////////////////////////////////// ////////////oKCg/7u7u+0AAAAAAAAAAMXGxe2goKD///////////////////////////////////// //jx5v/OnET//u/G///vwf//78H/27Ru/+7ewf////////////////////////////////////////// - //////////////////////+goKD/u7u77QAAAAAAAAAAxcbG7aCgoP////////////////////////// - /////////////////+PHlv/lxov//+/B//ztxf/TpVT///79//////////////////////////////// - /////////////////////////////////6CgoP+7u7vtAAAAAAAAAADFxsbtoKCg//////////////// - /////////////////////////////fv4/9OlVP/77MP/6c6X/+TJm/////////////////////////// - ////////////////////////////////////////////oKCg/7u7u+0AAAAAAAAAAMXGxu2goKD///// - ////////////////////////////////////////////7du8/86eS//Jkzb/+vbu//////////////// - //////////////////////////////////////////////////////+goKD/u7u77QAAAAAAAAAAxcbG - 7aCgoP//////////////////////////////////////////////////////2LFu/969hP////////// - /////////////////////////////////////////////////////////////////6CgoP+7u7vtAAAA - AAAAAADFxsbtoKCg//////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////oKCg - /7u7u+0AAAAAAAAAAMXGxu2goKD///////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////+goKD/u7u77QAAAAAAAAAAxsfH8qCgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg - /6CgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg - /6CgoP+goKD/oKCg/6CgoP+7u7vyAAAAAAAAAADW19fcwsPD7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC - 7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC - 7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHB7dHS0twAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAD//////////////////////////4AAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAA - AYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAAB//// - /////////////////ygAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AL2+v+6urq/2rq6v9q6ur/aurq/2rq6v9q6ur/aurq/2rq6v9q6ur/aurq/2rq6v9q6ur/aurq/2rq6v - 9rm5uu6ztLb29ee+//vswP/77MD/++zA//vswP/77MD/++zA//vswP/77MD/++zA//vswP/77MD/++zA - //Xnvv+urq/2s7S29fnqv///78H//+/B///vwf//78H//+/B///vwf//78H/8tuk/+jMlP/86rv//+/B - ///vwf/56r//rq6v9bO0tvX56r///+/B///vwf//78H//+/B///vwf//78H//+/B/+fLlv/x4sr/7dOf - ///vwf//78H/+eq//66vsPWztLb1+eq////vwf//78H//+/B///vwf//78H//+/B//nmt//q1K3///79 - /+3buv/z3an//+/B//nqv/+ur7D1s7S29ezVn//y2Z//8tmf//Tdpv//78H//+/B///vwf/pzZP/+vTr - ///////9+vb/6tKk//HYn//s1Z//rq6u9bS1t/Xs4Mr/8uXN//Llzf/r1rD/89yn///vwf/+7sH/5cmZ - //79/P////////////v27//y5c3/7ODK/66urvWztLT1+fn5/////////////Pn0/+fLmP/97L7/79af - //Tp1f////////////////////////////n5+f+urq71s7S09fn5+f/////////////////16tf/69CY - /+bJk//////////////////////////////////5+fn/rq6u9bO0tPX5+fn//////////////////v38 - /+XKnf/s2bn/////////////////////////////////+fn5/66urvWztLT29fX1//v7+//7+/v/+/v7 - //v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//X19f+urq72wMHB7rGxsfaxsbH2sbGx - 9rGxsfaxsbH2sbGx9rGxsfaxsbH2sbGx9rGxsfaxsbH2sbGx9rGxsfaxsbH2vLy87gAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8A - AP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA//8A - AA== - - - - 200, 150 - - - CenterScreen - - - 任务管ç†å™¨ - - - imageListFileMgrLeft - - - System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader1 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader3 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader2 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader4 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader5 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader6 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - imageListFileTypeList + //////////////////////+goKD/u7u77QAAAAAAAAAAxcbG7aCgoP////////////////////////// + /////////////////+PHlv/lxov//+/B//ztxf/TpVT///79//////////////////////////////// + /////////////////////////////////6CgoP+7u7vtAAAAAAAAAADFxsbtoKCg//////////////// + /////////////////////////////fv4/9OlVP/77MP/6c6X/+TJm/////////////////////////// + ////////////////////////////////////////////oKCg/7u7u+0AAAAAAAAAAMXGxu2goKD///// + ////////////////////////////////////////////7du8/86eS//Jkzb/+vbu//////////////// + //////////////////////////////////////////////////////+goKD/u7u77QAAAAAAAAAAxcbG + 7aCgoP//////////////////////////////////////////////////////2LFu/969hP////////// + /////////////////////////////////////////////////////////////////6CgoP+7u7vtAAAA + AAAAAADFxsbtoKCg//////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////oKCg + /7u7u+0AAAAAAAAAAMXGxu2goKD///////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////+goKD/u7u77QAAAAAAAAAAxsfH8qCgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg + /6CgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg/6CgoP+goKD/oKCg + /6CgoP+goKD/oKCg/6CgoP+7u7vyAAAAAAAAAADW19fcwsPD7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC + 7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHC + 7cHBwu3BwcLtwcHC7cHBwu3BwcLtwcHB7dHS0twAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAD//////////////////////////4AAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAA + AYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAAB//// + /////////////////ygAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AL2+v+6urq/2rq6v9q6ur/aurq/2rq6v9q6ur/aurq/2rq6v9q6ur/aurq/2rq6v9q6ur/aurq/2rq6v + 9rm5uu6ztLb29ee+//vswP/77MD/++zA//vswP/77MD/++zA//vswP/77MD/++zA//vswP/77MD/++zA + //Xnvv+urq/2s7S29fnqv///78H//+/B///vwf//78H//+/B///vwf//78H/8tuk/+jMlP/86rv//+/B + ///vwf/56r//rq6v9bO0tvX56r///+/B///vwf//78H//+/B///vwf//78H//+/B/+fLlv/x4sr/7dOf + ///vwf//78H/+eq//66vsPWztLb1+eq////vwf//78H//+/B///vwf//78H//+/B//nmt//q1K3///79 + /+3buv/z3an//+/B//nqv/+ur7D1s7S29ezVn//y2Z//8tmf//Tdpv//78H//+/B///vwf/pzZP/+vTr + ///////9+vb/6tKk//HYn//s1Z//rq6u9bS1t/Xs4Mr/8uXN//Llzf/r1rD/89yn///vwf/+7sH/5cmZ + //79/P////////////v27//y5c3/7ODK/66urvWztLT1+fn5/////////////Pn0/+fLmP/97L7/79af + //Tp1f////////////////////////////n5+f+urq71s7S09fn5+f/////////////////16tf/69CY + /+bJk//////////////////////////////////5+fn/rq6u9bO0tPX5+fn//////////////////v38 + /+XKnf/s2bn/////////////////////////////////+fn5/66urvWztLT29fX1//v7+//7+/v/+/v7 + //v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//X19f+urq72wMHB7rGxsfaxsbH2sbGx + 9rGxsfaxsbH2sbGx9rGxsfaxsbH2sbGx9rGxsfaxsbH2sbGx9rGxsfaxsbH2vLy87gAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8A + AP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA//8A + AA== + - - System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 微软雅黑, 9pt - - columnHeader15 + + 4, 26 - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + splitContainerFm.Panel2 - - columnHeader16 + + 0 - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + MiddleRight - - columnHeader17 + + 以管ç†å‘˜æƒé™é‡å¯è½¯ä»¶ - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + MiddleLeft - - columnHeader18 + + True System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - columnHeader19 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader20 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader22 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader23 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader7 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader8 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader9 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 207, 6 - - columnHeader10 + + + iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAb9JREFUSEvt + U1lLAmEU9Ye3EFEP0UJYEZaRmS2DmRoyWYhNZZpaVCYxtqEVLVMPZdgCcZpzmSKwyMEeCjpP3yznfOee + e6/jH78DLjWLQCIP67E+BJM6FnaLIqakC5jNn8u5d0ar74LE4RWypWvoxgMObp5QuHtExriHT8tD2zqy + Lx7O6CK4ZwpRUImuwR3U4AwlpQKKswJewPcW7XuMxXNCpsOe6Xm0dg28kxlDUj/F1k0ZI7Ed9E9F7Tnf + vntAdPsYXX3uKiIriu1fYjJ9WLsoG0YSHQ8pkU+JvDBhVKSZ3coSvHM1xEFSrGQ27f4FY6HFTwlLZs4U + 9ueuwGjYA+vT96DwctGARwlVkfypPcSvn+FLn9QuSIxEMxIHxTlydBSJr2JdL4KL4tu4eHfb7Kq++EtM + xjchDTIjWSu/iLvI2RMCRxWM75ThXKnAqe6iY0iR/ziGtqaDzr0rJtEU8aRv4dIMtHhiaPen0Njplgo4 + x1x1W9vYNhyGV10XQpNnEa2jYTk39E2I016fKs9qKieubS3LG1jqx+5z8xgZl4XbyLGzPtWHwYA5Zqb4 + VLIgMXSPz/+M8BsYl3X883A4XgEYYaNsCNPSbAAAAABJRU5ErkJggg== + - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 1 - - columnHeader11 + + 113, 32 System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - columnHeader12 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader13 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader14 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - columnHeader21 - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - imageListProcessDetalsIcons - - - System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - toolTip - - - System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 打开应用ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - å¸è½½åº”用ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 打开安装ä½ç½®ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - å¤åˆ¶å称ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - å¤åˆ¶å®Œæ•´å称ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - å¤åˆ¶å‘布者ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - éšè—列ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 选择列ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - toolStripSeparator1 - - - System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 将此列调整为åˆé€‚大å°ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 显示éšè—主界é¢ToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 退出程åºToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - toolStripSeparator2 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0 - - 资æºå€¼ToolStripMenuItem + + Bottom, Right - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + - - 内存ToolStripMenuItem + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + åŸºåœ°å€ - - 百分比ToolStripMenuItemRam + + 1 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + pl_driverNotLoadTip - - 值ToolStripMenuItemRam + + 65, 17 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ç£ç›˜ToolStripMenuItem + + 87 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 520, 23 - - 百分比ToolStripMenuItemDisk + + 0 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 16, 560 - - 值ToolStripMenuItemDisk + + tabPageFileCtl - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + splitContainerPerfCtls - - 网络ToolStripMenuItem + + imageListFileMgrLeft - + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 百分比ToolStripMenuItemNet + + Bottom, Left - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 7 - - 值ToolStripMenuItemNet + + 值ToolStripMenuItemDisk - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - fileSystemWatcher + + - - System.IO.FileSystemWatcher, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + linkRebootAsAdmin - - notifyIcon + + - - System.Windows.Forms.NotifyIcon, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + - - FormMain + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + MiddleCenter - - 369, 17 - - + + + + AAABAAUAAAAAAAEAIADfEwAAVgAAAEBAAAABACAAKEIAADUUAAAwMAAAAQAgAKglAABdVgAAICAAAAEA IACoEAAABXwAABAQAAABACAAaAQAAK2MAACJUE5HDQoaCgAAAA1JSERSAAABAAAAAQAIBgAAAFxyqGYA @@ -3906,10 +2637,1468 @@ AA== - + + + + + + + + 483, 228 + + + 进程数:-- + + + 驱动数:-- + + + + + + NoControl + + + 0 + + + 166, 22 + + + 110, 21 + + + 0 + + + å¤åˆ¶å®Œæ•´å称(&N) + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 退出程åºToolStripMenuItem + + + 8 + + + 2, 225 + + + 112, 540 + + + 1, 10 + + + MiddleLeft + + + 跳转到 + + + + + + 0 + + + 85, 24 + + + 4 + + + 打开安装ä½ç½®(&D) + + + 8 + + + NoControl + + + 166, 22 + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 806, 533 + + + NoControl + + + 0 + + + tabPageProcCtl + + + splitContainerPerfCtls.Panel1 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 901, 564 + + + 0 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 16, 535 + + + MiddleCenter + + + 4 + + + columnHeader21 + + + åŠ è½½é¡ºåº + + + 显示éšè—主界é¢ToolStripMenuItem + + + 10 + + + 0 + + + tabPageStartCtl + + + 1 + + + False + + + 将此列调整为åˆé€‚大å°ToolStripMenuItem + + + + + + NoControl + + + lbUWPEnumFailText + + + 将此列调整为åˆé€‚大å°(&F) + + + 0, 0 + + + 以管ç†å‘˜æƒé™é‡å¯è½¯ä»¶å¹¶åŠ è½½é©±åŠ¨ + + + 4 + + + Flat + + + False + + + columnHeader12 + + + System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3, 3, 3, 3 + + + NoControl + + + 显示内核管ç†å·¥å…· + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + expandFewerDetals + + + False + + + 资æºå€¼ + + + + + + Bottom, Left, Right + + + 180 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 创建时间 + + + 通用应用列表视图 + + + 1 + + + Top, Bottom, Left, Right + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainerPerfCtls.Panel1 + + + 7 + + + Bottom, Right + + + splitContainerFm + + + tabPageUWPCtl + + + pl_ScNeedAdminTip + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.NotifyIcon, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 901, 525 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK + ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P + B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO + vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 + HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo + xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK + nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC + qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv + EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 + vqgqAAAAAElFTkSuQmCC + + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3, 3, 3, 3 + + + 901, 564 + + + 9 + + + 6 + + + 任务管ç†å™¨ + + + tabPageStartCtl + + + Bottom, Left + + + False + + + 901, 564 + + + 166, 22 + + + NoControl + + + True + + + linkOpenScMsc + + + 16, 537 + + + 当å‰æ²¡æœ‰è¿è¡Œåº”用 +您å¯ä»¥ç‚¹å‡»"详细信æ¯"æ¥æŸ¥çœ‹æ›´å¤šåŽå°åº”ç”¨çš„ä¿¡æ¯ + + + NoControl + + + 1 + + + 用户 + + + Left, Right + + + pl_ScNeedAdminTip + + + 3 + + + + + + splitContainerFm + + + PCMgr.Ctls.TaskMgrList, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null + + + columnHeader3 + + + tabPageProcCtl + + + 900, 493 + + + listUwpApps + + + + + + NoControl + + + NoControl + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 结æŸè¿›ç¨‹(&E) + + + å¯åŠ¨ç±»åž‹ + + + PCMgr.Ctls.PerformanceList, PCMgrApp32, Version=1.3.2.6, Culture=neutral, PublicKeyToken=null + + + 8 + + + sp4 + + + å‘布者 + + + 234 + + + å¯åŠ¨é¡¹åˆ—表视图 + + + tabPageScCtl + + + contextMenuStripUWP + + + 46 + + + + + + 200, 150 + + + tabPageUWPCtl + + + Top, Bottom, Left, Right + + + + + + 102, 537 + + + å¤åˆ¶å‘布者ToolStripMenuItem + + + + + + False + + + sp3 + + + 210, 160 + + + Top, Bottom, Left, Right + + + 0 + + + -1, 0 + + + å¤åˆ¶å称(&N) + + + 0, 0 + + + 200, 55 + + + 0 + + + 903, 518 + + + NoControl + + + 4 + + + sp2 + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + lbServicesCount + + + splitContainerFm.Panel2 + + + 1 + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControlMain + + + Bottom, Left + + + + + + 207, 21 + + + listProcessDetals + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + 196 + + + 驱动å称 + + + linkLabelOpenPerfMon + + + 4, 26 + + + 0 + + + 3, 3, 3, 3 + + + MiddleCenter + + + check_showAllProcess + + + 20, 20 + + + 100, 22 + + + 210, 22 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 119 + + + 23, 16 + + + 0 + + + FormMain + + + columnHeader20 + + + 102, 21 + + + å¤åˆ¶å®Œæ•´å称ToolStripMenuItem + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MiddleLeft + + + Top, Bottom, Left, Right + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 109, 6 + + + tabControlMain + + + 7 + + + 结æŸä»»åŠ¡(&E) + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + listApps + + + 6 + + + pl_simple + + + 67 + + + 907, 544 + + + MiddleLeft + + + å¤§å° + + + 226 + + + 901, 525 + + + æœåŠ¡ç®¡ç† + + + 3 + + + 没有数æ®æ˜¾ç¤º + + + 234, 526 + + + 90, 538 + + + + + + columnHeader5 + + + NoControl + + + tabControlMain + + + 11, 535 + + + 901, 525 + + + 类型 + + + 8 + + + 4, 26 + + + 11 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 没有显示?试试刷新一下 + + + 907, 593 + + + + + + 0 + + + 166, 22 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 1 + + + splitContainerPerfCtls + + + tabPageUWPCtl + + + + + + 909, 594 + + + splitContainerFm.Panel1 + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + æœåŠ¡å + + + $this + + + 微软雅黑, 9pt + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Top, Bottom, Left, Right + + + 11 + + + 4, 26 + + + + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + pl_driverNotLoadTip + + + tabPageScCtl + + + 2 + + + tabPageProcCtl + + + 百分比ToolStripMenuItemNet + + + 79, 17 + + + 0, 0 + + + ç£ç›˜ToolStripMenuItem + + + 文件类型 + + + 160, 22 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageKernelCtl + + + System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bottom, Left + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 1, 526 + + + 11 + + + tabPageDetals + + + 112, 22 + + + imageListProcessDetalsIcons + + + 打开应用(&O) + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 1 + + + 微软雅黑, 9pt + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 3, 3, 3, 3 + + + tabPageFileCtl + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + columnHeader7 + + + 94, 536 + + + columnHeader2 + + + 166, 22 + + + 内存ToolStripMenuItem + + + 1 + + + NoControl + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + å‘布者 + + + 结æŸè¿›ç¨‹(&E) + + + 112, 22 + + + 112, 22 + + + $this + + + + + + True + + + 选择列ToolStripMenuItem + + + 62 + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + ç£ç›˜ + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + columnHeader19 + + + å¤§å° + + + 14 + + + + + + columnHeader15 + + + 打开æœåŠ¡ + + + toolStripSeparator2 + + + MiddleLeft + + + 0 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + å称 + + + 63 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACw + BAAAAk1TRnQBSQFMAwEBAAEYAQkBHAEJARABAAEQAQAE/wEhARAI/wFCAU0BNgcAATYDAAEoAwABQAMA + ARADAAEBAQABIAYAARA8AAHNAf8MAAJQAVEBnwJQAVEBn8wAAvsB+gH/AvsB+gH/AvsB+gH/AvsB+gH/ + AvsB+gH/AvsB+gH/A/0B/wIAAdsB/wIAAdkB/wP9Af8CUAFRAZ8CAAHeAf8CUAFRAZ/MAAP7Af8B9wL2 + Af8B9wH2AfUB/wH3AfYB9QH/AfcB9gH1Af8B9wH2AfUB/wH3AfYB9QH/AvsB+gH/AgAB2wH/AgAB2QH/ + AgAB4gH/AlABUQGf0AAB/AL7Af8B+AH3AfYB/wH4AfcB9gH/AfgB9wH2Af8B+AH3AfYB/wH3AfYB9QH/ + AfcB9gH1Af8B+AH3AfYB/wIAAcoB/wIAAecB/wIAAdkB/9QAAfwC+wH/AfgC9wH/AfgC9wH/AfgB9wH2 + Af8B+AH3AfYB/wH4AfcB9gH/AvgB9wH/AgABzAH/AgAB6wH/AgABzAH/AgAB2wH/AgAB2QH/0AAC/AH7 + Af8B+QH4AfcB/wH5AfgB9wH/AfkB+AH3Af8B+AL3Af8B+AH3AfYB/wGjAZ0B3QH/AgAB8AH/AgABzAH/ + A/sB/wYAAdsB/wIAAc0B/8wAA/wB/wH5AvgB/wH5AvgB/wH5AfgB9wH/AfkB+AH3Af8C+AH3Af8B+QH4 + AfcB/wGjAZ0B3QH/AfkB+AH3Af8C+wH6Af/YAAH9AvwB/wH6AfkB+AH/AvkB+AH/AvkB+AH/AfkC+AH/ + AfkB+AH3Af8B+QH4AfcB/wH4AfcB9gH/AfgB9wH2Af8D+wH/2AAB/QL8Af8B+gH5AfgB/wH5AvgB/wH6 + AfkB+AH/AvkB+AH/AfkC+AH/AfkB+AH3Af8C+AH3Af8B+AH3AfYB/wH8AvsB/9gAAf0C/AH/AfoC+QH/ + AvoB+QH/AfoB+QH4Af8B+gH5AfgB/wL5AfgB/wH5AvgB/wH5AfgB9wH/AfgC9wH/AfwC+wH/2AAC/QH8 + Af8C+gH5Af8B+wH6AfkB/wH6AvkB/wH6AfkB+AH/AfoB+QH4Af8B+QL4Af8B+QH4AfcB/wL4AfcB/wH8 + AvsB/9gAA/0B/wH7AvoB/wL6AfkB/wH7AfoB+QH/AvoB+QH/AfkC+AH/AvkB+AH/AukB6AH/AekB6AHn + Af8B7ALrAf/YAAP9Af8C+wH6Af8B+wL6Af8C+gH5Af8B+gL5Af8B+gH5AfgB/wL5AfgB/wOmAf8D6QH/ + A9MB/9gAA/0B/wL7AfoB/wH7AvoB/wL6AfkB/wH6AvkB/wH6AfkB+AH/AvkB+AH/A6YB/wHeAt0B/wMh + ATDYAAOlAf8DowH/AaICoQH/A6AB/wOeAf8CnQGcAf8CmwGaAf8BmgKZAf8DIQEw/wDRAAFCAU0BPgcA + AT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB/wHcBgAB4AcAAeABAQYAAeABAwYAAeABAQYA + AeABBAYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABDwYA + Av8cAAs= + + + + lbRestartAsAdminDriver + + + tabPageScCtl + + + 154 + + + çŠ¶æ€ + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pl_simple + + + + + + 1, 14 + + + tabControlMain + + + 属性 + + + 63 + + + + + + + + + 打开安装ä½ç½®ToolStripMenuItem + + + 主进程视图 + + + 11 + + + 9 + + + 1 + + + + + + tabPageProcCtl + + + + + + å³ä¾§èµ„æºç®€æ˜“图表 + + + 0 + + + 值 + + + 563, 103 + + + pl_UWPEnumFailTip + + + 文件å + + + False + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 微软雅黑, 9pt + + + 3 + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 选择列(&C) + + + False + + + + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 4, 26 + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAjtJREFUOE+11FlrE1EUB/D5Ru47qF/CF1dajVL9Bn3qk/iqNVhKKFmapMnEZJpm + X5plkox5KW1BaFERKghS6GRfH479X3tzJ2lGEHXg/zAD85t7555zpP9yVatV/TikaRpplQqVy2UqlUqk + qioVi0UqFAqUz+cpl8vRZjZL2UyGMuk0pVMpSiWTlEwkKB6P6yccA2k4HP5VYtEYnXCShJXhYbfb/eN0 + Oh32bjQSMYDH25wEleI+XZ9z/zbAkMFgQJGNDQHin01boVLYo2vPVk0DrN1uMzAcDgsQB2C2ZVdil64+ + dU4NMA6uK4oAcZrTwMOjBt1bUOiKxT41wFqtFvX7fVJCIQGiNCbBw6M63V0I0mXLisiT8QBrNpsMDAWD + AkSdTYKWV2G69Nhmnlkbwzj4PhAQIIrWCO5++k4XZ5dP5fYLO72VP/y6n1lmWKPRoF6vRwFZFiA6wAg6 + olt0YWZpLLeer9D2/je2TTmzw54Bq9frDJT9fgGinYygVdbo/KN3o9ycs40wvs2X9k2GcdDv8wkQvWkE + Kztf6dxD6yiLvvIYxleG1Go1Bq55vQJEoxtBFOydeQ+dfbDIom59NsUQvOP1eASIqcFB3k7bewd0w7JE + Z+6/pljpoymm6zp7z+N2CxAjCCCWbkS/HPygeWuc3qypp7bMcb7CVZdLgJhnABG0EQ/qiwcfMwYIDz7u + cjoFiOGIeYYRhKmBRkdvop3QASha1BlKA6eJA8A/wzaxMmBOh0MM2H93SdJPnkQ2KO7DXA0AAAAASUVO + RK5CYII= + + + + 3 + + + NoControl + + + PID + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + None + + + 901, 564 + + + 127 + + + TopCenter + + + + + + 190 + + + + + + tabPageScCtl + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 + + + 7 + + + 27, 29 + + + 3, 3, 3, 3 + + + 113 + + + 网络 + + + + + + 3, 6 + + + tabPageFileCtl + + + 901, 564 + + + Bottom, Left + + + + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bottom, Left + + + 66, 17 + + + éšè—列ToolStripMenuItem + + + 9 + + + 83 + + + toolStripSeparator1 + + + 65 + + + splitContainerFm.Panel1 + + + 文件路径 + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0, 0 + + + 0, 0 + + + 修改时间 + + + 0, 550 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + listFm + + + + + + 资æºå€¼ToolStripMenuItem + + + 3 + + + 正在è¿è¡Œåº”用列表视图 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAglJREFUOE+Nkk1IG1EUhWcnuBB15UZD02KjBrvQaBatWKgFC0JBpMW17a6bEpUK + ShF0zELUFBTFLGJdBApqBFtEQSa2TZoaMtViJcl0YTWN/yLogKCn3OvMosz4c+Ayw5t3vnfm3StcJp/P + B4/Hw+X3+6EtXy9JkkDmSCQCRVEgyzK/0xp907YZpZ9IBqqagRAcAzFIY+WIBR6xmUBer5dhmu1CupFO + vN2fwN2uKDrDeyjpW0EyUICzvxb8mL6Hr/5ahlCRR7MLgtvtZnO+J4XGQIrNz2d2GbQ+V4bTtAvnW+X4 + HSxCeMTJe8mj2S8S0GJud5yNTybSKO1Pwt7yBX/mi3C+04CzdBMn+Tzi4LSmCQhQOJTksrdGYXslIbVo + xe73OziI2XC0Woywr+zyBFntUVg6l2FpC8H6epFrc8HKRUmUj4X4NlphTEB9JsB4Xwk2Q5U4WKvCYbyK + nzlvVpHZ/As5bWuwvI3jvmuWAYbZoDYtv6/GduQB1I06qFuPGULGjI595PWqKBg+hE2UzeeBekvkRKAC + qlLPEB2Q3aPilvcYpa0yPgRXjHNAogGh36Be7/18ipP1Zwyg2MXjx7C/28bDDsk8vi69G0tTDUgs1PHv + EMDZEkO165Px8sxEENoYnBIx2e2E4+UMXgzO89p/rbtKOoSKEtHo3tisiy6KTKIoml8aSxD+Ad2g8Av1 + vqgqAAAAAElFTkSuQmCC + + + + 组 + + + columnHeader14 + + + False + + + Fill + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 161, 48 + + + 78, 22 + + + MiddleRight + + + 85 + + + 43 + + + 901, 519 + + + 驱动没有加载 + + + pl_simple + + + Fill + + + 12 + + + False + + + 226, 493 + + + 3, 3, 3, 3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 100, 22 + + + Top, Right + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + + tabControlMain + + + + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0, 0 + + + å¯åŠ¨é¡¹ç®¡ç† + + 任务管ç†å™¨ - - True + + columnHeader17 + + + 4, 26 + + + 3, 3, 3, 3 + + + 通用应用 + + + 6 + + + tabPageFileCtl + + + 6 + + + btnEndTaskSimple + + + 233, 0 + + + False + + + 12 + + + å†…æ ¸ç®¡ç† + + + None + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + æ–‡ä»¶ç®¡ç† + + + æè¿° + + + 驱动对象 + + + 0, 0 + + + tabPageUsers + + + btnFmAddGoto + + + è¿›ç¨‹ç®¡ç† + + + 1, 14 + + + + + + 1, 28 + + + 百分比 + + + treeFmLeft + + 238, 34 + + + 478, 34 + + + 17, 17 + + + 735, 17 + + + 192, 17 + + + 369, 17 + + + 573, 17 + + + 661, 34 + + + 55 + + + 17, 34 + + + 480, 17 + + + True + \ No newline at end of file diff --git a/TaskMgr/Helpers/ConstVals.cs b/TaskMgr/Helpers/ConstVals.cs new file mode 100644 index 0000000..0d33388 --- /dev/null +++ b/TaskMgr/Helpers/ConstVals.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PCMgr.Helpers +{ + class ConstVals + { + public const string MICROSOFT = "Microsoft Corporation"; + } +} diff --git a/TaskMgr/Lanuages/LanuageFBuffers.cs b/TaskMgr/Lanuages/LanuageFBuffers.cs new file mode 100644 index 0000000..c5b68f2 --- /dev/null +++ b/TaskMgr/Lanuages/LanuageFBuffers.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections; +using System.Reflection; + +namespace PCMgr.Lanuages +{ + static class LanuageFBuffers + { + private class LanuageStrAttribute : Attribute + { + public string LanuageResName { get; private set; } + + public LanuageStrAttribute(string lanuageResName) + { + LanuageResName = lanuageResName; + } + } + + public static void LoadFBuffers() + { + Type t = typeof(LanuageFBuffers); + FieldInfo[] fields = t.GetFields(BindingFlags.Public | BindingFlags.Static); + foreach (FieldInfo field in fields) + { + LanuageStrAttribute attr = (LanuageStrAttribute)field.GetCustomAttribute(typeof(LanuageStrAttribute)); + if (attr != null && attr.LanuageResName != "") field.SetValue(null, LanuageMgr.GetStr(attr.LanuageResName, false)); + else field.SetValue(null, LanuageMgr.GetStr(field.Name.Remove(0, 4), false)); + } + } + + public static string Str_AppTitle = ""; + public static string Str_Yes = ""; + public static string Str_No = ""; + public static string Str_Cancel = ""; + public static string Str_Close = ""; + public static string Str_Failed = ""; + public static string Str_FileNotExist = ""; + public static string Str_DriverLoad = ""; + public static string Str_DriverNotLoad = ""; + public static string Str_DriverCountLoaded = ""; + public static string Str_DriverCount = ""; + public static string Str_AutoStart = ""; + public static string Str_DemandStart = ""; + public static string Str_Disabled = ""; + public static string Str_FileSystem = ""; + public static string Str_KernelDriver = ""; + public static string Str_UserService = ""; + public static string Str_SystemService = ""; + public static string Str_ErrTitle = ""; + public static string Str_AskTitle = ""; + public static string Str_TipTitle = ""; + public static string Str_Ready = ""; + public static string Str_ReadyStatus = ""; + public static string Str_ReadyStatusEnd2 = ""; + public static string Str_ReadyStatusEnd = ""; + public static string Str_VisitFolderFailed = ""; + public static string Str_Loading = ""; + public static string Str_ProcessCount = ""; + public static string Str_InterruptsProcessDsb = ""; + public static string Str_SystemInterrupts = ""; + public static string Str_IdleProcessDsb = ""; + + [LanuageStr("SystemIdleProcess")] + public static string Str_IdleProcess = ""; + public static string Str_StatusRunning = ""; + public static string Str_StatusStoppeed = ""; + public static string Str_StatusPaused = ""; + public static string Str_StatusHung = ""; + + [LanuageStr("BtnEndTask")] + public static string Str_Endtask = ""; + [LanuageStr("BtnEndProcess")] + public static string Str_Endproc = ""; + [LanuageStr("BtnRestart")] + public static string Str_Resrat = ""; + + public static string Str_Second = ""; + public static string Str_ServiceHost = ""; + public static string Str_Process32Bit = ""; + public static string Str_Process64Bit = ""; + } +} diff --git a/TaskMgr/Lanuages/LanuageMgr.cs b/TaskMgr/Lanuages/LanuageMgr.cs index 11cf4b9..f8ba772 100644 --- a/TaskMgr/Lanuages/LanuageMgr.cs +++ b/TaskMgr/Lanuages/LanuageMgr.cs @@ -1,10 +1,15 @@ -using System.Resources; +using System; +using System.Collections.Generic; +using System.Resources; +using System.Windows.Forms; +using static PCMgr.NativeMethods; namespace PCMgr.Lanuages { class LanuageMgr { private static ResourceManager resLG; + private static Dictionary lanuageBuffers = new Dictionary(); public static string CurrentLanuage { get; private set; } public static bool IsChinese { get; private set; } @@ -45,15 +50,171 @@ public static bool LoadLanuageResource(string lg) return false; } } - public static string GetStr(string name) + + public static string GetStr(string name, bool buffer = true) { - return resLG.GetString(name); + if (!buffer) + { + string s1 = resLG.GetString(name); + if (s1 == null) s1 = "[" + name + "::ResoureceNotFounnd]"; + return s1; + } + if (lanuageBuffers.ContainsKey(name)) + return lanuageBuffers[name]; + string s = resLG.GetString(name); + if (s != null) lanuageBuffers.Add(name, s); + else s = "[" + name + "::ResoureceNotFounnd]"; + return s; } public static string GetStr2(string name, out int size) { - string s = resLG.GetString(name); + string s = GetStr(name); size = s.Length + 1; return s; } + + public static void InitLanuage() + { + string lanuage = GetConfig("Lanuage", "AppSetting"); + if (lanuage != "") + { + try + { + Log("Load Lanuage Resource : " + lanuage); + LoadLanuageResource(lanuage); + } + catch (Exception e) + { + LogErr("Lanuage resource load failed !\n" + e.ToString()); + MessageBox.Show(e.ToString(), "ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + { + LoadLanuageResource("zh"); + SetConfig("Lanuage", "AppSetting", "zh"); + LogWarn("Not found Lanuage settings , use default zh-CN ."); + } + + InitLanuageItems(); + if (lanuage != "" && lanuage != "zh" && lanuage != "zh-CN") + System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lanuage); + } + private static void InitLanuageItems() + { + try + { + LanuageFBuffers.LoadFBuffers(); + + MLG_SetLanuageItems_CanRealloc(); + + MAppSetLanuageItems(0, 0, GetStr("KillAskStart"), 0); + MAppSetLanuageItems(0, 1, GetStr("KillAskEnd"), 0); + MAppSetLanuageItems(0, 2, GetStr("KillAskContent"), 0); + MAppSetLanuageItems(0, 3, GetStr("KillFailed"), 0); + MAppSetLanuageItems(0, 4, GetStr("AccessDenied"), 0); + MAppSetLanuageItems(0, 5, GetStr("OpFailed"), 0); + MAppSetLanuageItems(0, 6, GetStr("InvalidProcess"), 0); + MAppSetLanuageItems(0, 7, GetStr("CantCopyFile"), 0); + MAppSetLanuageItems(0, 8, GetStr("CantMoveFile"), 0); + MAppSetLanuageItems(0, 9, GetStr("ChooseTargetDir"), 0); + + int size = 0; + MAppSetLanuageItems(1, 0, GetStr2("Moveing", out size), size); + MAppSetLanuageItems(1, 1, GetStr2("Copying", out size), size); + MAppSetLanuageItems(1, 2, GetStr2("FileExist", out size), size); + MAppSetLanuageItems(1, 3, GetStr2("FileExist2", out size), size); + MAppSetLanuageItems(1, 4, GetStr2("TitleQuestion", out size), size); + MAppSetLanuageItems(1, 5, GetStr2("TipTitle", out size), size); + MAppSetLanuageItems(1, 6, GetStr2("DelSure", out size), size); + MAppSetLanuageItems(1, 7, GetStr2("DelAsk1", out size), size); + MAppSetLanuageItems(1, 8, GetStr2("DelAsk2", out size), size); + MAppSetLanuageItems(1, 9, GetStr2("DelAsk3", out size), size); + MAppSetLanuageItems(1, 10, GetStr2("DeleteIng", out size), size); + MAppSetLanuageItems(1, 11, GetStr2("NoAdminTipText", out size), size); + MAppSetLanuageItems(1, 12, GetStr2("NoAdminTipTitle", out size), size); + MAppSetLanuageItems(1, 13, GetStr2("DelFailed", out size), size); + MAppSetLanuageItems(1, 14, LanuageFBuffers.Str_IdleProcess, LanuageFBuffers.Str_IdleProcess.Length + 1); + MAppSetLanuageItems(1, 15, GetStr2("EndProcFailed", out size), size); + MAppSetLanuageItems(1, 16, GetStr2("OpenProcFailed", out size), size); + MAppSetLanuageItems(1, 17, GetStr2("SusProcFailed", out size), size); + MAppSetLanuageItems(1, 18, GetStr2("ResProcFailed", out size), size); + MAppSetLanuageItems(1, 19, GetStr2("MenuRebootAsAdmin", out size), size); + MAppSetLanuageItems(1, 20, GetStr2("Visible", out size), size); + MAppSetLanuageItems(1, 21, GetStr2("CantGetPath", out size), size); + MAppSetLanuageItems(1, 22, GetStr2("FreeLibSuccess", out size), size); + MAppSetLanuageItems(1, 23, GetStr2("Priority", out size), size); + MAppSetLanuageItems(1, 24, GetStr2("EntryPoint", out size), size); + MAppSetLanuageItems(1, 25, GetStr2("ModuleName", out size), size); + MAppSetLanuageItems(1, 26, GetStr2("State", out size), size); + MAppSetLanuageItems(1, 27, GetStr2("ContextSwitch", out size), size); + MAppSetLanuageItems(1, 28, GetStr2("ModulePath", out size), size); + MAppSetLanuageItems(1, 29, GetStr2("Address", out size), size); + MAppSetLanuageItems(1, 30, GetStr2("Size", out size), size); + MAppSetLanuageItems(1, 31, GetStr2("TitlePublisher", out size), size); + MAppSetLanuageItems(1, 32, GetStr2("WindowText", out size), size); + MAppSetLanuageItems(1, 33, GetStr2("WindowHandle", out size), size); + MAppSetLanuageItems(1, 34, GetStr2("WindowClassName", out size), size); + MAppSetLanuageItems(1, 35, GetStr2("BelongThread", out size), size); + MAppSetLanuageItems(1, 36, GetStr2("VWinTitle", out size), size); + MAppSetLanuageItems(1, 37, GetStr2("VModulTitle", out size), size); + MAppSetLanuageItems(1, 38, GetStr2("VThreadTitle", out size), size); + MAppSetLanuageItems(1, 39, GetStr2("EnumModuleFailed", out size), size); + MAppSetLanuageItems(1, 40, GetStr2("EnumThreadFailed", out size), size); + MAppSetLanuageItems(1, 41, GetStr2("FreeInvalidProc", out size), size); + MAppSetLanuageItems(1, 42, GetStr2("FreeFailed", out size), size); + MAppSetLanuageItems(1, 43, GetStr2("KillThreadError", out size), size); + MAppSetLanuageItems(1, 44, GetStr2("KillThreadInvThread", out size), size); + MAppSetLanuageItems(1, 45, GetStr2("OpenThreadFailed", out size), size); + MAppSetLanuageItems(1, 46, GetStr2("SuThreadErr", out size), size); + MAppSetLanuageItems(1, 47, GetStr2("ReThreadErr", out size), size); + MAppSetLanuageItems(1, 48, GetStr2("InvThread", out size), size); + MAppSetLanuageItems(1, 49, GetStr2("SuThreadWarn", out size), size); + MAppSetLanuageItems(1, 50, GetStr2("KernelNotLoad", out size), size); + + MAppSetLanuageItems(2, 0, GetStr2("DelStartupItemAsk", out size), size); + MAppSetLanuageItems(2, 1, GetStr2("DelStartupItemAsk2", out size), size); + MAppSetLanuageItems(2, 2, LanuageFBuffers.Str_Endtask, LanuageFBuffers.Str_Endtask.Length + 1); + MAppSetLanuageItems(2, 3, LanuageFBuffers.Str_Resrat, LanuageFBuffers.Str_Resrat.Length + 1); + MAppSetLanuageItems(2, 4, GetStr2("LoadDriver", out size), size); + MAppSetLanuageItems(2, 5, GetStr2("UnLoadDriver", out size), size); + MAppSetLanuageItems(2, 6, LanuageFBuffers.Str_FileNotExist, LanuageFBuffers.Str_FileNotExist.Length + 1); + MAppSetLanuageItems(2, 7, GetStr2("FileTrust", out size), size); + MAppSetLanuageItems(2, 8, GetStr2("FileNotTrust", out size), size); + MAppSetLanuageItems(2, 9, GetStr2("OpenServiceError", out size), size); + MAppSetLanuageItems(2, 10, GetStr2("DelScError", out size), size); + MAppSetLanuageItems(2, 11, GetStr2("ChangeScStartTypeFailed", out size), size); + MAppSetLanuageItems(2, 12, GetStr2("SetTo", out size), size); + MAppSetLanuageItems(2, 13, GetStr2("KillTreeAskEnd", out size), size); + MAppSetLanuageItems(2, 14, GetStr2("KillTreeContent", out size), size); + MAppSetLanuageItems(2, 15, GetStr2("WantDisconnectUser", out size), size); + MAppSetLanuageItems(2, 16, GetStr2("WantLogooffUser", out size), size); + MAppSetLanuageItems(2, 17, GetStr2("PleaseEnterPassword", out size), size); + MAppSetLanuageItems(2, 18, GetStr2("ConnectSessionFailed", out size), size); + MAppSetLanuageItems(2, 19, GetStr2("ConnectSession", out size), size); + MAppSetLanuageItems(2, 20, GetStr2("DisConnectSession", out size), size); + MAppSetLanuageItems(2, 21, GetStr2("DisConnectSessionFailed", out size), size); + MAppSetLanuageItems(2, 22, GetStr2("LogoffSession", out size), size); + MAppSetLanuageItems(2, 23, GetStr2("DisConnectSessionFailed1", out size), size); + MAppSetLanuageItems(2, 24, GetStr2("SetProcPriorityClassFailed", out size), size); + MAppSetLanuageItems(2, 25, GetStr2("SetProcAffinityFailed", out size), size); + MAppSetLanuageItems(2, 26, GetStr2("WarnTitle", out size), size); + MAppSetLanuageItems(2, 27, GetStr2("LoadDriverWarn", out size), size); + MAppSetLanuageItems(2, 28, GetStr2("LoadDriverWarnTitle", out size), size); + MAppSetLanuageItems(2, 29, GetStr2("DetachDebuggerTitle", out size), size); + MAppSetLanuageItems(2, 30, GetStr2("DetachDebuggerError", out size), size); + MAppSetLanuageItems(2, 31, GetStr2("DetachDebuggerNotDebugger", out size), size); + MAppSetLanuageItems(2, 32, GetStr2("ChangePriorityAsk", out size), size); + MAppSetLanuageItems(2, 33, GetStr2("ChangePriorityContent", out size), size); + MAppSetLanuageItems(2, 34, GetStr2("OpenFileError", out size), size); + MAppSetLanuageItems(2, 35, GetStr2("CreateDumpFailed", out size), size); + MAppSetLanuageItems(2, 36, GetStr2("CreateDumpSuccess", out size), size); + MAppSetLanuageItems(2, 37, GetStr2("PleaseEnumIn64", out size), size); + } + catch (Exception e) + { + MessageBox.Show(e.ToString(), "ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } diff --git a/TaskMgr/Lanuages/LanuageResource_en.Designer.cs b/TaskMgr/Lanuages/LanuageResource_en.Designer.cs index c15d8a2..2fad187 100644 --- a/TaskMgr/Lanuages/LanuageResource_en.Designer.cs +++ b/TaskMgr/Lanuages/LanuageResource_en.Designer.cs @@ -162,9 +162,9 @@ internal static string BtnEndTask { /// /// 查找类似 Restart (&E) 的本地化字符串。 /// - internal static string BtnRestartText { + internal static string BtnRestart { get { - return ResourceManager.GetString("BtnRestartText", resourceCulture); + return ResourceManager.GetString("BtnRestart", resourceCulture); } } diff --git a/TaskMgr/Lanuages/LanuageResource_en.resx b/TaskMgr/Lanuages/LanuageResource_en.resx index 4ea97a2..5e7ec57 100644 --- a/TaskMgr/Lanuages/LanuageResource_en.resx +++ b/TaskMgr/Lanuages/LanuageResource_en.resx @@ -129,7 +129,7 @@ &End Task - + Restart (&E) diff --git a/TaskMgr/Lanuages/LanuageResource_zh-Hant.Designer.cs b/TaskMgr/Lanuages/LanuageResource_zh-Hant.Designer.cs index 4d4ae8f..66ceae9 100644 --- a/TaskMgr/Lanuages/LanuageResource_zh-Hant.Designer.cs +++ b/TaskMgr/Lanuages/LanuageResource_zh-Hant.Designer.cs @@ -99,9 +99,9 @@ internal static string BtnEndTask { /// /// 查找类似 é‡æ–°å¯åŠ¨(E) 的本地化字符串。 /// - internal static string BtnRestartText { + internal static string BtnRestart { get { - return ResourceManager.GetString("BtnRestartText", resourceCulture); + return ResourceManager.GetString("BtnRestart", resourceCulture); } } diff --git a/TaskMgr/Lanuages/LanuageResource_zh-Hant.resx b/TaskMgr/Lanuages/LanuageResource_zh-Hant.resx index b5417d8..007a644 100644 --- a/TaskMgr/Lanuages/LanuageResource_zh-Hant.resx +++ b/TaskMgr/Lanuages/LanuageResource_zh-Hant.resx @@ -129,7 +129,7 @@ 结æŸä»»åŠ¡(E) - + é‡æ–°å¯åŠ¨(E) diff --git a/TaskMgr/Lanuages/LanuageResource_zh.Designer.cs b/TaskMgr/Lanuages/LanuageResource_zh.Designer.cs index f879722..9121d8b 100644 --- a/TaskMgr/Lanuages/LanuageResource_zh.Designer.cs +++ b/TaskMgr/Lanuages/LanuageResource_zh.Designer.cs @@ -162,9 +162,9 @@ internal static string BtnEndTask { /// /// 查找类似 é‡æ–°å¯åŠ¨(&E) 的本地化字符串。 /// - internal static string BtnRestartText { + internal static string BtnRestart { get { - return ResourceManager.GetString("BtnRestartText", resourceCulture); + return ResourceManager.GetString("BtnRestart", resourceCulture); } } diff --git a/TaskMgr/Lanuages/LanuageResource_zh.resx b/TaskMgr/Lanuages/LanuageResource_zh.resx index 5f9369b..788d2be 100644 --- a/TaskMgr/Lanuages/LanuageResource_zh.resx +++ b/TaskMgr/Lanuages/LanuageResource_zh.resx @@ -129,7 +129,7 @@ 结æŸä»»åŠ¡(&E) - + é‡æ–°å¯åŠ¨(&E) diff --git a/TaskMgr/Main/MainNativeBridge.cs b/TaskMgr/Main/MainNativeBridge.cs new file mode 100644 index 0000000..e70e0c5 --- /dev/null +++ b/TaskMgr/Main/MainNativeBridge.cs @@ -0,0 +1,197 @@ +using PCMgr.Aero.TaskDialog; +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.Main.MainUtils; +using static PCMgr.NativeMethods; +using static PCMgr.NativeMethods.CSCall; +using static PCMgr.NativeMethods.Win32; + +namespace PCMgr.Main +{ + internal class MainNativeBridge + { + public void InitCallbacks() + { + workerCallBack = AppWorkerCallBack; + lanuageItems_CallBack = Native_LanuageItems_CallBack; + + MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(exitCallBack), 1); + MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(terminateImporantWarnCallBack), 2); + MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(workerCallBack), 5); + MLG_SetLanuageItems_CallBack(Marshal.GetFunctionPointerForDelegate(lanuageItems_CallBack)); + } + + public MainNativeBridge(FormMain m) + { + formMain = m; + } + + public void WndProc(ref System.Windows.Forms.Message m) + { + //WndProc部分交予 Native 控制 + coreWndProc?.Invoke(m.HWnd, Convert.ToUInt32(m.Msg), m.WParam, m.LParam); + } + + private string Native_LanuageItems_CallBack(string s) + { + return LanuageMgr.GetStr(s, false); + } + + private FormMain formMain = null; + + //所有 Native 回调 + + public static LanuageItems_CallBack lanuageItems_CallBack; + public EnumUsersCallBack enumUsersCallBack; + + public MProcessMonitor.ProcessMonitorNewItemCallBack ProcessNewItemCallBackDetails; + public MProcessMonitor.ProcessMonitorRemoveItemCallBack ProcessRemoveItemCallBackDetails; + + public MProcessMonitor.ProcessMonitorNewItemCallBack ProcessNewItemCallBack; + public MProcessMonitor.ProcessMonitorRemoveItemCallBack ProcessRemoveItemCallBack; + + public EnumWinsCallBack enumWinsCallBack; + public GetWinsCallBack getWinsCallBack; + + public IntPtr enumUsersCallBackCallBack_ptr; + public IntPtr ptrProcessNewItemCallBack; + public IntPtr ptrProcessRemoveItemCallBack; + public IntPtr ptrProcessNewItemCallBackDetails; + public IntPtr ptrProcessRemoveItemCallBackDetails; + public IntPtr enumStartupsCallBackPtr = IntPtr.Zero; + public IntPtr scMgrEnumServicesCallBackPtr = IntPtr.Zero; + public IntPtr enumKernelModulsCallBackPtr = IntPtr.Zero; + + public WNDPROC coreWndProc = null; + public EXITCALLBACK exitCallBack; + public WORKERCALLBACK workerCallBack; + public TerminateImporantWarnCallBack terminateImporantWarnCallBack; + public MFCALLBACK fileMgrCallBack; + + public EnumServicesCallBack scMgrEnumServicesCallBack; + public EnumStartupsCallBack enumStartupsCallBack; + public EnumKernelModulsCallBack enumKernelModulsCallBack; + + + //Worker Callback + public void AppWorkerCallBack(int msg, IntPtr wParam, IntPtr lParam) + { + //这是从 c++ native 调用回æ¥çš„函数 + switch (msg) + { + case M_CALLBACK_SW_AOP_WND: break; + case M_CALLBACK_CLEAR_ILLEGAL_TOP_WND: + { + StringBuilder sb = new StringBuilder(260); + GetWindowText(wParam, sb, 260); + FormWindowKillAsk fa = new FormWindowKillAsk("窗å£å称 :" + sb.ToString(), wParam); + fa.Show(); + MAppWorkCall3(213, fa.Handle); + break; + } + case M_CALLBACK_SWITCH_IDM_ALWAYSTOP_SET: break; + case M_CALLBACK_SWITCH_MAINGROUP_SET: formMain.GroupSwitch(wParam.ToInt32() == 1); break; + case M_CALLBACK_SWITCH_REFESHRATE_SET: formMain.SetMainRefeshTimerInterval(wParam.ToInt32()); break; + case M_CALLBACK_SWITCH_TOPMOST_SET: formMain.TopMost = wParam.ToInt32() == 1; break; + case M_CALLBACK_SWITCH_CLOSEHIDE_SET: formMain.MainSettings.CloseHide = wParam.ToInt32() == 1; break; + case M_CALLBACK_SWITCH_MINHIDE_SET: formMain.MainSettings.MinHide = wParam.ToInt32() == 1; break; + case M_CALLBACK_GOTO_SERVICE: formMain.MainPageScMgr.ScMgrGoToService(Marshal.PtrToStringUni(wParam));break; + case M_CALLBACK_REFESH_SCLIST: formMain.MainPageScMgr.ScMgrRefeshList(); break; + case M_CALLBACK_KILLPROCTREE: formMain.MainPageProcess.ProcessListKillProcTree((uint)wParam.ToInt32()); break; + case M_CALLBACK_SPY_TOOL: + { + new FormSpyWindow(wParam).ShowDialog(); + break; + } + case M_CALLBACK_FILE_TOOL: + { + new FormFileTool().ShowDialog(); + break; + } + case M_CALLBACK_ABOUT: + { + new FormAbout().ShowDialog(); + break; + } + case M_CALLBACK_ENDTASK: formMain.MainPageProcess.ProcessListEndTask(Convert.ToUInt32(wParam.ToInt32())); break; + case M_CALLBACK_LOADDRIVER_TOOL: new FormLoadDriver().Show(); break; + case M_CALLBACK_SCITEM_REMOVED: formMain.MainPageScMgr.ScMgrRemoveInvalidItem(Marshal.PtrToStringUni(wParam)); break; + case M_CALLBACK_SHOW_PROGRESS_DLG: formMain.DelingDialogShowHide(true); break; + case M_CALLBACK_UPDATE_PROGRESS_DLG_TO_DELETEING: + { + formMain.DelingDialogShowHide(false); + formMain.DelingDialogUpdate(LanuageMgr.GetStr("DeleteFiles"), 0); + break; + } + case M_CALLBACK_UPDATE_PROGRESS_DLG_ALL: formMain.DelingDialogUpdate(Marshal.PtrToStringUni(wParam), lParam.ToInt32()); break; + case M_CALLBACK_UPDATE_PROGRESS_DLG_TO_COLLECTING: formMain.DelingDialogUpdate(LanuageMgr.GetStr("CollectingFiles"), -1); break; + case M_CALLBACK_KERNEL_INIT: + { + AppWorkerCallBack(41, IntPtr.Zero, IntPtr.Zero); + if (MInitKernel(null)) + if (GetConfigBool("SelfProtect", "AppSetting")) + MAppWorkCall3(203, IntPtr.Zero, IntPtr.Zero); + break; + } + case M_CALLBACK_VIEW_HANDLES: new FormVHandles(Convert.ToUInt32(wParam.ToInt32()), Marshal.PtrToStringUni(lParam)).ShowDialog(); break; + case M_CALLBACK_KERNEL_INIT_LIST: formMain.MainPageKernelDrvMgr.KernelListInit(); break; + case M_CALLBACK_KERNEL_SWITCH_SHOWALLDRV: formMain.MainPageKernelDrvMgr.KernelListToggleShowAllDrv(); break; + case M_CALLBACK_START_ITEM_REMVED: formMain.MainPageStartMgr.StartMListRemoveItem(Convert.ToUInt32(wParam.ToInt32())); break; + case M_CALLBACK_VIEW_KSTRUCTS: + { + if (MCanUseKernel()) new FormVKrnInfo(Convert.ToUInt32(wParam.ToInt32()), Marshal.PtrToStringUni(lParam)).ShowDialog(); + else MessageBox.Show(LanuageFBuffers.Str_DriverNotLoad); + break; + } + case M_CALLBACK_VIEW_TIMER: + { + //timer + if (MCanUseKernel()) new FormVTimers(Convert.ToUInt32(wParam.ToInt32())).ShowDialog(); + else MessageBox.Show(LanuageFBuffers.Str_DriverNotLoad); + break; + } + case M_CALLBACK_VIEW_HOTKEY: + { + //hotkey + if (MCanUseKernel()) new FormVHotKeys(Convert.ToUInt32(wParam.ToInt32())).ShowDialog(); + else MessageBox.Show(LanuageFBuffers.Str_DriverNotLoad); + break; + } + case M_CALLBACK_SHOW_TRUSTED_DLG: formMain.VeryTrust(Marshal.PtrToStringUni(wParam)); break; + case M_CALLBACK_MDETALS_LIST_HEADER_RIGHTCLICK: formMain.MainPageProcessDetails.ProcessListDetailsHeaderRightClick(wParam.ToInt32()); break; + case M_CALLBACK_KDA: new FormKDA().ShowDialog(formMain); break; + case M_CALLBACK_SETAFFINITY: new FormSetAffinity((uint)wParam.ToInt32(), lParam).ShowDialog(); break; + case M_CALLBACK_UPDATE_LOAD_STATUS: formMain.StartingProgressUpdate(Marshal.PtrToStringUni(wParam)); break; + case M_CALLBACK_SHOW_NOPDB_WARN: formMain.ShowNoPdbWarn(Marshal.PtrToStringAnsi(wParam)); break; + case M_CALLBACK_INVOKE_LASTLOAD_STEP: formMain.Invoke(new Action(formMain.AppLastLoadStep)); break; + case M_CALLBACK_DBGPRINT_SHOW: formMain.KDbgPrintShow(); break; + case M_CALLBACK_DBGPRINT_CLOSE: formMain.KDbgPrintClose(); break; + case M_CALLBACK_DBGPRINT_DATA: formMain.KDbgPrintData(Marshal.PtrToStringUni(wParam)); break; + case M_CALLBACK_DBGPRINT_EMEPTY: formMain.KDbgPrintData(); break; + case M_CALLBACK_SHOW_LOAD_STATUS: formMain. StartingProgressShowHide(true); break; + case M_CALLBACK_HLDE_LOAD_STATUS: formMain.StartingProgressShowHide(false); break; + case M_CALLBACK_MDETALS_LIST_HEADER_MOUSEMOVE: formMain.MainPageProcessDetails. ProcessListDetailsHeaderMouseMove(wParam.ToInt32(), new System.Drawing.Point(LOWORD(lParam), HIWORD(lParam))); break; + case M_CALLBACK_KERNEL_VIELL_PRGV: new FormVPrivilege(Convert.ToUInt32(wParam.ToInt32()), Marshal.PtrToStringUni(lParam)).ShowDialog(); break; + case M_CALLBACK_KERNEL_TOOL: formMain.ShowKernelTools(); break; + case M_CALLBACK_HOOKS: formMain.ShowFormHooks(); break; + case M_CALLBACK_NETMON: /*netmon*/ break; + case M_CALLBACK_REGEDIT: /*regedit*/ break; + case M_CALLBACK_FILEMGR: formMain.SetToFileMgr(); break; + case M_CALLBACK_COLLAPSE_ALL: formMain.CollapseAll(); break; + case M_CALLBACK_SIMPLEVIEW_ACT: + { + if (wParam.ToInt32() == 1) formMain.MainPageProcess.ProcessListEndCurrentApp(); + else if (wParam.ToInt32() == 0) formMain.MainPageProcess.ProcessListSetToCurrentApp(); + break; + } + case M_CALLBACK_UWPKILL: formMain.MainPageProcess.ProcessListKillCurrentUWP(); break; + case M_CALLBACK_EXPAND_ALL: formMain.ExpandAll(); break; + case M_CALLBACK_SHOW_HELP: new FormHelp().ShowDialog(); break; + } + } + } +} diff --git a/TaskMgr/Main/MainPage.cs b/TaskMgr/Main/MainPage.cs new file mode 100644 index 0000000..8d14c41 --- /dev/null +++ b/TaskMgr/Main/MainPage.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PCMgr.Main +{ + class MainPage + { + public MainPage(FormMain formMain, TabPage page) + { + Page = page; + FormMain = formMain; + NativeBridge = formMain.MainNativeBridge; + Handle = formMain.Handle; + } + + protected MainNativeBridge NativeBridge { get; private set; } + protected TabPage Page { get; private set; } + protected FormMain FormMain { get; private set; } + + public Size Size { get => FormMain.Size; set { FormMain.Size = value; } } + public Font Font { get => FormMain.Font; } + public Point MousePosition { get => Control.MousePosition; } + public IntPtr Handle { get; } = IntPtr.Zero; + public bool Inited { get; set; } = false; + public virtual int GetUpdateDatum() + { + return 1; + } + public void UnLoad() + { + OnUnLoad(); + } + public void Load() + { + OnLoad(); + OnLoadControlEvents(); + } + + protected virtual void OnUnLoad() { } + protected virtual void OnLoad() { } + protected virtual void OnLoadControlEvents() { } + } +} diff --git a/TaskMgr/Main/MainPageFileMgr.cs b/TaskMgr/Main/MainPageFileMgr.cs new file mode 100644 index 0000000..a1cc97c --- /dev/null +++ b/TaskMgr/Main/MainPageFileMgr.cs @@ -0,0 +1,639 @@ +using PCMgr.Aero.TaskDialog; +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.NativeMethods; + +namespace PCMgr.Main +{ + class MainPageFileMgr : MainPage + { + private ListView listFm; + private TreeView treeFmLeft; + private ImageList imageListFileMgrLeft; + private ImageList imageListFileTypeList; + private Label lbFileMgrStatus; + private TextBox textBoxFmCurrent; + private FileSystemWatcher fileSystemWatcher; + + public MainPageFileMgr(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageFileCtl) + { + listFm = formMain.listFm; + treeFmLeft = formMain.treeFmLeft; + imageListFileMgrLeft = formMain.imageListFileMgrLeft; + imageListFileTypeList = formMain.imageListFileTypeList; + lbFileMgrStatus = formMain.lbFileMgrStatus; + textBoxFmCurrent = formMain.textBoxFmCurrent; + fileSystemWatcher = formMain.fileSystemWatcher; + } + + protected override void OnLoadControlEvents() + { + treeFmLeft.BeforeExpand += new TreeViewCancelEventHandler(treeFmLeft_BeforeExpand); + treeFmLeft.AfterSelect += new TreeViewEventHandler(treeFmLeft_AfterSelect); + treeFmLeft.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeFmLeft_NodeMouseClick); + treeFmLeft.KeyDown += new KeyEventHandler(treeFmLeft_KeyDown); + treeFmLeft.MouseClick += new MouseEventHandler(treeFmLeft_MouseClick); + + listFm.AfterLabelEdit += new LabelEditEventHandler(listFm_AfterLabelEdit); + listFm.SelectedIndexChanged += new EventHandler(listFm_SelectedIndexChanged); + listFm.MouseClick += new MouseEventHandler(listFm_MouseClick); + listFm.MouseDoubleClick += new MouseEventHandler(listFm_MouseDoubleClick); + + fileSystemWatcher.Changed += new FileSystemEventHandler(fileSystemWatcher_Changed); + fileSystemWatcher.Created += new FileSystemEventHandler(fileSystemWatcher_Created); + fileSystemWatcher.Deleted += new FileSystemEventHandler(fileSystemWatcher_Deleted); + fileSystemWatcher.Renamed += new RenamedEventHandler(fileSystemWatcher_Renamed); + + textBoxFmCurrent.KeyDown += textBoxFmCurrent_KeyDown; + + FormMain.btnFmAddGoto.Click += new EventHandler(btnFmAddGoto_Click); + + base.OnLoadControlEvents(); + } + + //文件管ç†å™¨é¡µä»£ç  + + private Dictionary fileTypeNames = new Dictionary(); + private TreeNode lastClickTreeNode = null; + private string lastShowDir = ""; + private bool lastRightClicked = false; + + public void FileMgrInit() + { + if (!Inited) + { + FormMain.DelingDialogInit(); + + NativeBridge.fileMgrCallBack = FileMgrCallBack; + MFM_SetCallBack(Marshal.GetFunctionPointerForDelegate(NativeBridge.fileMgrCallBack)); + + imageListFileMgrLeft.Images.Add("folder", Icon.FromHandle(MFM_GetFolderIcon())); + imageListFileMgrLeft.Images.Add("mycp", Icon.FromHandle(MFM_GetMyComputerIcon())); + + imageListFileTypeList.Images.Add("folder", Icon.FromHandle(MFM_GetFolderIcon())); + + MAppWorkCall3(182, treeFmLeft.Handle, IntPtr.Zero); + MAppWorkCall3(182, listFm.Handle, IntPtr.Zero); + + Inited = true; + + string smycp = Marshal.PtrToStringAuto(MFM_GetMyComputerName()); + treeFmLeft.Nodes.Add("mycp", smycp, "mycp", "mycp").Tag = "mycp"; + MFM_GetRoots(); + } + } + + public void FileMgrShowFiles(string path) + { + if (path == null) + { + path = lastShowDir; + lastShowDir = null; + } + if (lastShowDir != path) + { + lastShowDir = path; + listFm.Items.Clear(); + if (lastShowDir == "mycp" || lastShowDir == "\\\\") + { + for (int i = 0; i < treeFmLeft.Nodes[0].Nodes.Count; i++) + listFm.Items.Add(new ListViewItem(treeFmLeft.Nodes[0].Nodes[i].Text, treeFmLeft.Nodes[0].Nodes[i].ImageKey) { Tag = "..\\ROOT\\" + treeFmLeft.Nodes[0].Nodes[i].Tag }); + textBoxFmCurrent.Text = treeFmLeft.Nodes[0].Text; + } + else + { + MFM_GetFiles(lastShowDir); + textBoxFmCurrent.Text = lastShowDir; + } + if (path == "mycp") fileSystemWatcher.Path = ""; + else fileSystemWatcher.Path = path; + fileSystemWatcher.EnableRaisingEvents = true; + + + FileMgrUpdateStatus(1); + } + } + public void FileMgrUpdateStatus(int i) + { + FileMgrCallBack(15, new IntPtr(i), IntPtr.Zero); + } + public void FileMgrTreeOpenItem(TreeNode n) + { + if (n.Nodes.Count == 0 || n.Nodes[0].Text == LanuageFBuffers.Str_Loading && n.Tag != null) + { + lastClickTreeNode = n; + string s = n.Tag.ToString(); + if (MFM_GetFolders(s)) + lastClickTreeNode.Nodes.Remove(lastClickTreeNode.Nodes[0]); + } + } + + private IntPtr FileMgrCallBack(int msg, IntPtr lParam, IntPtr wParam) + { + switch (msg) + { + case 2: + { + string s = Marshal.PtrToStringAuto(lParam); + string path = Marshal.PtrToStringAuto(wParam); + Icon icon = Icon.FromHandle(MFM_GetFileIcon(path, null, 0)); + imageListFileMgrLeft.Images.Add(path, icon); + imageListFileTypeList.Images.Add(path, icon); + TreeNode n = treeFmLeft.Nodes[0].Nodes.Add(path, s, path, path); + n.Tag = path; + n.Nodes.Add("loading", LanuageFBuffers.Str_Loading, "loading", "loading"); + break; + } + case 3: + { + if (wParam.ToInt32() == -1) + { + lastClickTreeNode.Nodes[0].Text = LanuageFBuffers.Str_VisitFolderFailed; + lastClickTreeNode.Nodes[0].ImageKey = "err"; + } + else + { + string s = Marshal.PtrToStringAuto(lParam); + string path = Marshal.PtrToStringAuto(wParam); + TreeNode n = lastClickTreeNode.Nodes.Add(s, s, "folder", "folder"); + if (path.EndsWith("\\")) + n.Tag = path + s; + else n.Tag = path + "\\" + s; + n.Nodes.Add("loading", LanuageFBuffers.Str_Loading, "loading", "loading"); + } + break; + } + case 5: + { + string s = Marshal.PtrToStringAuto(lParam); + string path = Marshal.PtrToStringAuto(wParam); + listFm.Items.Add(new ListViewItem(s, "folder") { Tag = path.EndsWith("\\") ? path + s : path + "\\" + s }); + break; + } + case 6: + case 26: + { + if (wParam.ToInt32() == -1) + { + listFm.Items.Clear(); + string path = Marshal.PtrToStringAuto(lParam); + listFm.Items.Add(new ListViewItem("..", "folder") { Tag = "..\\back\\" + path }); + ListViewItem lvi = listFm.Items.Add(LanuageFBuffers.Str_VisitFolderFailed, "err"); + } + else + { + ListViewItem it = null; + WIN32_FIND_DATA data = default(WIN32_FIND_DATA); + data = (WIN32_FIND_DATA)Marshal.PtrToStructure(lParam, data.GetType()); + string s = data.cFileName; + string path = Marshal.PtrToStringAuto(wParam); + string fpath = path + "\\" + s; + fpath = fpath.Replace("\\\\", "\\"); + string fext = "*" + Path.GetExtension(fpath); + if (fext == "") fext = "*.*"; + if (fext == "*.exe") + { + if (!imageListFileTypeList.Images.ContainsKey(fpath) && MFM_FileExist(fpath)) + { + StringBuilder sb0 = new StringBuilder(260); + IntPtr h = MGetExeIcon(fpath); + if (h != IntPtr.Zero) + imageListFileTypeList.Images.Add(fpath, Icon.FromHandle(h)); + if (!fileTypeNames.ContainsKey(fpath)) + { + MGetExeDescribe(fpath, sb0, 260); + fileTypeNames.Add(fpath, sb0.ToString()); + } + sb0 = null; + } + if (msg == 26) + { + foreach (ListViewItem i in listFm.Items) + { + if (i.Tag.ToString() == fpath) + { + it = i; + break; + } + } + } + else + { + it = listFm.Items.Add(new ListViewItem(s, fpath) { Tag = fpath }); + } + string typeName = ""; + if (fileTypeNames.TryGetValue(fpath, out typeName)) + it.SubItems.Add(typeName); + else it.SubItems.Add(""); + } + else + { + if (!imageListFileTypeList.Images.ContainsKey(fext)) + { + StringBuilder sb0 = new StringBuilder(80); + imageListFileTypeList.Images.Add(fext, Icon.FromHandle(MFM_GetFileIcon(fext, sb0, 80))); + if (!fileTypeNames.ContainsKey(fext)) + fileTypeNames.Add(fext, sb0.ToString()); + else imageListFileTypeList.Images.Add(fext, Icon.FromHandle(MFM_GetFileIcon(fext, null, 0))); + sb0 = null; + } + if (msg == 26) + { + foreach (ListViewItem i in listFm.Items) + { + if (i.Tag.ToString() == fpath) + { + it = i; + break; + } + } + } + else + { + it = listFm.Items.Add(new ListViewItem(s, fext) { Tag = fpath }); + } + + string typeName = ""; + if (fileTypeNames.TryGetValue(fext, out typeName)) + it.SubItems.Add(typeName); + else it.SubItems.Add(""); + } + + long size = (data.nFileSizeHigh * 0xffffffff + 1) + data.nFileSizeLow; + it.SubItems.Add(FormatFileSize(size)); + + StringBuilder sb = new StringBuilder(26); + if (MFM_GetFileTime(ref data.ftCreationTime, sb, 26)) + it.SubItems.Add(sb.ToString()); + else it.SubItems.Add("Unknow"); + + StringBuilder sb2 = new StringBuilder(26); + if (MFM_GetFileTime(ref data.ftLastWriteTime, sb2, 26)) + it.SubItems.Add(sb2.ToString()); + else it.SubItems.Add("Unknow"); + + StringBuilder sb3 = new StringBuilder(32); + bool hidden = false; + if (MFM_GetFileAttr(data.dwFileAttributes, sb3, 32, ref hidden)) + { + if (hidden) + { + it.ForeColor = Color.Gray; + it.SubItems[0].ForeColor = Color.Gray; + it.SubItems[1].ForeColor = Color.Gray; + it.SubItems[2].ForeColor = Color.Gray; + it.SubItems[3].ForeColor = Color.Gray; + } + it.SubItems.Add(sb3.ToString()); + } + else it.SubItems.Add(""); + + } + break; + } + case 7: + { + string path = Marshal.PtrToStringAuto(wParam); + listFm.Items.Add(new ListViewItem("..", "folder") { Tag = "..\\back\\" + path }); + break; + } + case 8: + FileMgrShowFiles(null); + break; + case 9: + { + if (listFm.SelectedItems.Count > 0) + { + ListViewItem listViewItem = listFm.SelectedItems[0]; + string path = listViewItem.Tag.ToString(); + listViewItem.BeginEdit(); + currEditingItem = listViewItem; + } + break; + } + case 10: + { + ListViewItem listViewItem = listFm.Items.Add(LanuageMgr.GetStr("NewFolder"), "folder"); + listViewItem.Tag = "newfolder"; + listViewItem.BeginEdit(); + currEditingItem = listViewItem; + break; + } + case 11: + { + foreach (ListViewItem i in listFm.Items) + i.Selected = true; + break; + } + case 12: + { + foreach (ListViewItem i in listFm.Items) + i.Selected = false; + break; + } + case 13: + { + foreach (ListViewItem i in listFm.Items) + i.Selected = !i.Selected; + break; + } + case 14: + lbFileMgrStatus.Text = Marshal.PtrToStringAuto(lParam); + break; + case 15: + switch (lParam.ToInt32()) + { + case 0: lbFileMgrStatus.Text = LanuageFBuffers.Str_Ready; break; + case 1: + { + if (listFm.SelectedItems.Count > 0) + lbFileMgrStatus.Text = LanuageFBuffers.Str_ReadyStatus + listFm.Items.Count + LanuageFBuffers.Str_ReadyStatusEnd2 + listFm.SelectedItems.Count + LanuageFBuffers.Str_ReadyStatusEnd; + else lbFileMgrStatus.Text = LanuageFBuffers.Str_ReadyStatus + listFm.Items.Count + LanuageFBuffers.Str_ReadyStatusEnd; + break; + } + case 2: lbFileMgrStatus.Text = ""; break; + case 3: lbFileMgrStatus.Text = ""; break; + case 4: lbFileMgrStatus.Text = ""; break; + case 5: lbFileMgrStatus.Text = LanuageMgr.GetStr("FileCuted"); break; + case 6: lbFileMgrStatus.Text = LanuageMgr.GetStr("FileCopyed"); break; + case 7: lbFileMgrStatus.Text = LanuageMgr.GetStr("NewFolderFailed"); break; + case 8: lbFileMgrStatus.Text = LanuageMgr.GetStr("NewFolderSuccess"); break; + case 9: lbFileMgrStatus.Text = LanuageMgr.GetStr("PathCopyed"); break; + case 10: lbFileMgrStatus.Text = LanuageMgr.GetStr("FolderCuted"); break; + case 11: lbFileMgrStatus.Text = LanuageMgr.GetStr("FolderCopyed"); break; + } + + break; + case 16: + int index = lParam.ToInt32(); + if (index > 0 && index < listFm.SelectedItems.Count) + return Marshal.StringToHGlobalAuto(listFm.SelectedItems[index].Tag.ToString()); + break; + case 17: + if (lParam != IntPtr.Zero) + Marshal.FreeHGlobal(wParam); + break; + case 18: + return FormMain.MainSettings.ShowHiddenFiles ? new IntPtr(1) : new IntPtr(0); + case 19: + FileMgrShowFiles(Marshal.PtrToStringAuto(lParam)); + break; + case 20: + { + new FormCheckFileUse(Marshal.PtrToStringAuto(lParam)).ShowDialog(); + break; + } + } + return IntPtr.Zero; + } + + private void textBoxFmCurrent_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + btnFmAddGoto_Click(sender, e); + } + private void btnFmAddGoto_Click(object sender, EventArgs e) + { + + if (textBoxFmCurrent.Text == "") + TaskDialog.Show(LanuageMgr.GetStr("PleaseEnterPath"), LanuageFBuffers.Str_TipTitle); + else + { + if (textBoxFmCurrent.Text.StartsWith("\"") && textBoxFmCurrent.Text.EndsWith("\"")) + { + textBoxFmCurrent.Text = textBoxFmCurrent.Text.Remove(textBoxFmCurrent.Text.Length - 1, 1); + textBoxFmCurrent.Text = textBoxFmCurrent.Text.Remove(0, 1); + } + if (Directory.Exists(textBoxFmCurrent.Text)) + FileMgrShowFiles(textBoxFmCurrent.Text); + else if (MFM_FileExist(textBoxFmCurrent.Text)) + { + string d = Path.GetDirectoryName(textBoxFmCurrent.Text); + string f = Path.GetFileName(textBoxFmCurrent.Text); + FileMgrShowFiles(d); + ListViewItem[] lis = listFm.Items.Find(f, false); + if (lis.Length > 0) lis[0].Selected = true; + } + else TaskDialog.Show(LanuageMgr.GetStr("PathUnExists"), LanuageFBuffers.Str_TipTitle); + } + } + private void treeFmLeft_BeforeExpand(object sender, TreeViewCancelEventArgs e) + { + FileMgrTreeOpenItem(e.Node); + } + private void treeFmLeft_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + + } + private void treeFmLeft_MouseClick(object sender, MouseEventArgs e) + { + TreeNode n = treeFmLeft.SelectedNode; + if (n != null && n.Tag != null) + { + if (e.Button == MouseButtons.Left) + lastRightClicked = false; + else if (e.Button == MouseButtons.Right) + { + lastRightClicked = true; + MAppWorkShowMenuFMF(n.Tag.ToString()); + } + } + } + private void treeFmLeft_AfterSelect(object sender, TreeViewEventArgs e) + { + if (e.Action == TreeViewAction.ByMouse) + { + if (!lastRightClicked) + { + lastClickTreeNode = e.Node; + FileMgrShowFiles(lastClickTreeNode.Tag.ToString()); + } + } + } + private void treeFmLeft_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + FileMgrTreeOpenItem(treeFmLeft.SelectedNode); + } + + private ListViewItem currEditingItem = null; + private void listFm_AfterLabelEdit(object sender, LabelEditEventArgs e) + { + if (currEditingItem != null && e.Item == 0) + { + string path = currEditingItem.Tag.ToString(); + string targetName = e.Label; + //Folder + if (path == "newfolder") + { + if (targetName == "") + { + targetName = LanuageMgr.GetStr("NewFolder"); + int ix = 1; + string spt = lastShowDir + "\\" + targetName + (ix == 1 ? "" : (" (" + ix + ")")); + bool finded = false; + while (!finded) + { + if (Directory.Exists(spt)) + ix++; + else + { + finded = true; + break; + } + } + if (!MFM_CreateDir(spt)) + { + e.CancelEdit = true; + listFm.Items.Remove(currEditingItem); + FileMgrUpdateStatus(7); + } + else FileMgrUpdateStatus(8); + } + else if (MFM_IsValidateFolderFileName(targetName)) + { + string spt = lastShowDir + "\\" + targetName; + if (Directory.Exists(spt)) + { + e.CancelEdit = true; + listFm.Items.Remove(currEditingItem); + TaskDialog.Show(LanuageMgr.GetStr("FolderHasExist")); + } + else + { + if (!MFM_CreateDir(spt)) + { + e.CancelEdit = true; + listFm.Items.Remove(currEditingItem); + FileMgrUpdateStatus(7); + } + else FileMgrUpdateStatus(8); + } + } + else + { + e.CancelEdit = true; + listFm.Items.Remove(currEditingItem); + TaskDialog.Show(LanuageMgr.GetStr("InvalidFileName")); + } + } + else + { + + } + } + else e.CancelEdit = true; + } + private void listFm_SelectedIndexChanged(object sender, EventArgs e) + { + FileMgrUpdateStatus(1); + } + private void listFm_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + if (listFm.SelectedItems.Count > 0) + { + ListViewItem listViewItem = listFm.SelectedItems[0]; + string path = listViewItem.Tag.ToString(); + if (path.StartsWith("..\\back\\")) + { + path = path.Remove(0, 8); + int ix = path.LastIndexOf('\\'); + if (ix > 0 && ix < path.Length) + { + path = path.Remove(ix); + FileMgrShowFiles(path); + } + } + else + { + if (listViewItem.ImageKey == "folder" && Directory.Exists(path)) + FileMgrShowFiles(path); + else if (path.StartsWith("..\\ROOT\\")) + { + path = path.Remove(0, 8); + FileMgrShowFiles(path); + } + else if (MFM_FileExist(path)) + { + if (path.EndsWith(".exe")) + { + if (TaskDialog.Show(LanuageMgr.GetStr("OpenAsk"), LanuageFBuffers.Str_AskTitle, LanuageMgr.GetStr("PathStart") + path, TaskDialogButton.Yes | TaskDialogButton.No) == Result.Yes) + MFM_OpenFile(path, Handle); + } + else MFM_OpenFile(path, Handle); + } + } + } + } + } + private void listFm_MouseClick(object sender, MouseEventArgs e) + { + if (listFm.SelectedItems.Count > 0) + { + ListViewItem listViewItem = listFm.SelectedItems[0]; + string path = listViewItem.Tag.ToString(); + if (e.Button == MouseButtons.Right) + MAppWorkShowMenuFM(path, listFm.SelectedItems.Count > 1, listFm.SelectedItems.Count); + } + } + + + private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) + { + string fullpath = e.FullPath; + MFM_UpdateFile(fullpath, Path.GetDirectoryName(fullpath)); + } + private void fileSystemWatcher_Created(object sender, FileSystemEventArgs e) + { + string fullpath = e.FullPath; + MFM_ReUpdateFile(fullpath, Path.GetDirectoryName(fullpath)); + FileMgrUpdateStatus(1); + } + private void fileSystemWatcher_Deleted(object sender, FileSystemEventArgs e) + { + //Remove + string fullpath = e.FullPath; + ListViewItem ii = null; + foreach (ListViewItem i in listFm.Items) + { + if (i.Tag.ToString() == fullpath) + { + ii = i; + break; + } + } + listFm.Items.Remove(ii); + FileMgrUpdateStatus(1); + } + private void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) + { + string oldfullpath = e.OldFullPath; + string fullpath = e.FullPath; + //Rename + ListViewItem ii = null; + foreach (ListViewItem i in listFm.Items) + { + if (i.Tag.ToString() == oldfullpath) + { + ii = i; + break; + } + } + ii.Tag = fullpath; + ii.Text = e.Name; + ii.ImageKey = "*" + Path.GetExtension(fullpath); + } + + + } +} diff --git a/TaskMgr/Main/MainPageKernelDrvMgr.cs b/TaskMgr/Main/MainPageKernelDrvMgr.cs new file mode 100644 index 0000000..6d33276 --- /dev/null +++ b/TaskMgr/Main/MainPageKernelDrvMgr.cs @@ -0,0 +1,253 @@ +using PCMgr.Lanuages; +using System; +using System.Collections; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.NativeMethods; +using PCMgr.Helpers; + +namespace PCMgr.Main +{ + class MainPageKernelDrvMgr : MainPage + { + private ListView listDrivers; + + private Label lbDriversCount; + + public MainPageKernelDrvMgr(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageKernelCtl) + { + listDrivers = formMain.listDrivers; + lbDriversCount = formMain.lbDriversCount; + } + + protected override void OnLoad() + { + mainSettings = FormMain.MainSettings; + base.OnLoad(); + } + protected override void OnLoadControlEvents() + { + FormMain.linkRestartAsAdminDriver.LinkClicked += linkRestartAsAdminDriver_LinkClicked; + FormMain.linkLabelShowKernelTools.LinkClicked += linkLabelShowKernelTools_LinkClicked; + + this.listDrivers.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listDrivers_ColumnClick); + this.listDrivers.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listDrivers_KeyDown); + this.listDrivers.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listDrivers_MouseUp); + + base.OnLoadControlEvents(); + } + + private MainSettings mainSettings = null; + + //å†…æ ¸é©±åŠ¨æžšä¸¾ä»£ç  + + private class ListViewItemComparerKr : IComparer + { + public int SortColum { get; set; } + public bool Asdening { get; set; } = false; + + public int Compare(object o1, object o2) + { + ListViewItem x = o1 as ListViewItem, y = o2 as ListViewItem; + int returnVal = -1; + if (x.SubItems[SortColum].Text == y.SubItems[SortColum].Text) return -1; + if (SortColum == 6) + { + int xi, yi; + if (int.TryParse(x.SubItems[SortColum].Text, out xi) && int.TryParse(y.SubItems[SortColum].Text, out yi)) + { + if (x.SubItems[SortColum].Text == y.SubItems[SortColum].Text) returnVal = 0; + else if (xi > yi) returnVal = 1; + else if (xi < yi) returnVal = -1; + } + } + else returnVal = String.Compare(((ListViewItem)x).SubItems[SortColum].Text, ((ListViewItem)y).SubItems[SortColum].Text); + if (Asdening) returnVal = -returnVal; + return returnVal; + } + } + + private IntPtr hListHeaderDrv = IntPtr.Zero; + + private ListViewItemComparerKr listViewItemComparerKr = new ListViewItemComparerKr(); + + private bool showAllDriver = false; + + public void KernelListInit() + { + if (!Inited) + { + if (FormMain.IsKernelLoaded) + { + NativeBridge.enumKernelModulsCallBack = KernelEnumCallBack; + NativeBridge.enumKernelModulsCallBackPtr = Marshal.GetFunctionPointerForDelegate(NativeBridge.enumKernelModulsCallBack); + + listViewItemComparerKr.SortColum = 6; + listDrivers.ListViewItemSorter = listViewItemComparerKr; + MAppWorkCall3(182, listDrivers.Handle, IntPtr.Zero); + hListHeaderDrv = ComCtlApi.MListViewGetHeaderControl(listDrivers.Handle, false); + + Inited = true; + + KernelLisRefesh(); + } + else + { + Inited = true; + + listDrivers.Hide(); + FormMain.pl_driverNotLoadTip.Show(); + FormMain.linkRestartAsAdminDriver.Visible = !FormMain.IsAdmin; + } + } + } + private void KernelEnumCallBack(IntPtr kmi, IntPtr BaseDllName, IntPtr FullDllPath, IntPtr FullDllPathOrginal, IntPtr szEntryPoint, IntPtr SizeOfImage, IntPtr szDriverObject, IntPtr szBase, IntPtr szServiceName, uint Order) + { + if (Order == 9999) + { + if (showAllDriver) lbDriversCount.Text = LanuageFBuffers.Str_DriverCountLoaded + kmi.ToInt32() + " " + LanuageFBuffers.Str_DriverCount + BaseDllName.ToInt32(); + else +#if _X64_ + lbDriversCount.Text = LanuageFBuffers.Str_DriverCount + kmi.ToInt64(); +#else + lbDriversCount.Text = LanuageFBuffers.Str_DriverCount + kmi.ToInt32(); +#endif + + return; + } + + string baseDllName = Marshal.PtrToStringUni(BaseDllName); + string fullDllPath = Marshal.PtrToStringUni(FullDllPath); + + ListViewItem li = new ListViewItem(baseDllName); + li.Tag = kmi; + //7 emepty items + for (int i = 0; i < 8; i++) li.SubItems.Add(new ListViewItem.ListViewSubItem() { Font = listDrivers.Font }); + + if (Order != 10000) + { + li.SubItems[0].Text = baseDllName; + li.SubItems[1].Text = Marshal.PtrToStringUni(szBase); + li.SubItems[2].Text = Marshal.PtrToStringUni(SizeOfImage); + li.SubItems[3].Text = Marshal.PtrToStringUni(szDriverObject); + li.SubItems[4].Text = fullDllPath; + li.SubItems[5].Text = Marshal.PtrToStringUni(szServiceName); + li.SubItems[6].Text = Order.ToString(); + } + else + { + li.SubItems[0].Text = baseDllName; + li.SubItems[1].Text = "-"; + li.SubItems[2].Text = "-"; + li.SubItems[3].Text = "-"; + li.SubItems[4].Text = fullDllPath; + li.SubItems[5].Text = Marshal.PtrToStringUni(szServiceName); + li.SubItems[6].Text = "-"; + } + + bool hightlight = false; + if (MFM_FileExist(fullDllPath)) + { + StringBuilder exeCompany = new StringBuilder(256); + if (MGetExeCompany(fullDllPath, exeCompany, 256)) + { + li.SubItems[7].Text = exeCompany.ToString(); + if (mainSettings.HighlightNoSystem && exeCompany.ToString() != ConstVals.MICROSOFT) + hightlight = true; + } + else if (mainSettings.HighlightNoSystem) hightlight = true; + if (hightlight) + { + li.ForeColor = Color.Blue; + foreach (ListViewItem.ListViewSubItem s in li.SubItems) + s.ForeColor = Color.Blue; + } + } + else + { + li.SubItems[7].Text = LanuageFBuffers.Str_FileNotExist; + if (mainSettings.HighlightNoSystem) hightlight = true; + } + if (hightlight) + { + li.ForeColor = Color.Blue; + foreach (ListViewItem.ListViewSubItem s in li.SubItems) + s.ForeColor = Color.Blue; + } + + listDrivers.Items.Add(li); + } + public void KernelLisRefesh() + { + if (FormMain.IsKernelLoaded) + { + foreach (ListViewItem li in listDrivers.Items) + { + IntPtr kmi = (IntPtr)li.Tag; + if (kmi != IntPtr.Zero) + M_SU_EnumKernelModulsItemDestroy(kmi); + } + listDrivers.Items.Clear(); + M_SU_EnumKernelModuls(NativeBridge.enumKernelModulsCallBackPtr, showAllDriver); + } + } + public void KernelListUnInit() + { + foreach (ListViewItem li in listDrivers.Items) + { + IntPtr kmi = (IntPtr)li.Tag; + if (kmi != IntPtr.Zero) + M_SU_EnumKernelModulsItemDestroy(kmi); + } + listDrivers.Items.Clear(); + } + public void KernelListToggleShowAllDrv() + { + showAllDriver = !showAllDriver; + KernelLisRefesh(); + } + + private void linkRestartAsAdminDriver_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + SetConfig("LoadKernelDriver", "Configure", "TRUE"); + MAppRebotAdmin2("select kernel"); + } + private void linkLabelShowKernelTools_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + FormMain.ShowKernelTools(); + } + + private void listDrivers_MouseUp(object sender, MouseEventArgs e) + { + if (listDrivers.SelectedItems.Count > 0) + { + if (e.Button == MouseButtons.Right) M_SU_EnumKernelModuls_ShowMenu((IntPtr)listDrivers.SelectedItems[0].Tag, showAllDriver, 0, 0); + } + } + private void listDrivers_ColumnClick(object sender, ColumnClickEventArgs e) + { + ((ListViewItemComparerKr)listDrivers.ListViewItemSorter).Asdening = !((ListViewItemComparerKr)listDrivers.ListViewItemSorter).Asdening; + ((ListViewItemComparerKr)listDrivers.ListViewItemSorter).SortColum = e.Column; + ComCtlApi.MListViewSetColumnSortArrow(hListHeaderDrv, ((ListViewItemComparerKr)listDrivers.ListViewItemSorter).SortColum, + ((ListViewItemComparerKr)listDrivers.ListViewItemSorter).Asdening, false); + listDrivers.Sort(); + } + private void listDrivers_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Apps) + { + if (listDrivers.SelectedItems.Count > 0) + { + ListViewItem item = listDrivers.SelectedItems[0]; + Point p = item.Position; p.X = 0; + p = listDrivers.PointToScreen(p); + M_SU_EnumKernelModuls_ShowMenu((IntPtr)item.Tag, showAllDriver, p.X, p.Y); + } + } + } + + + } +} diff --git a/TaskMgr/Main/MainPagePerf.cs b/TaskMgr/Main/MainPagePerf.cs new file mode 100644 index 0000000..a33941a --- /dev/null +++ b/TaskMgr/Main/MainPagePerf.cs @@ -0,0 +1,632 @@ +using PCMgr.Aero.TaskDialog; +using PCMgr.Ctls; +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.Main.MainUtils; +using static PCMgr.NativeMethods; +using static PCMgr.NativeMethods.Win32; +using static PCMgr.NativeMethods.DeviceApi; + +namespace PCMgr.Main +{ + class MainPagePerf : MainPage + { + private SplitContainer splitContainerPerfCtls; + private PerformanceList performanceLeftList; + private Panel pl_perfGridHost; + private PictureBox spBottom; + private TabControl tabControlMain; + + public MainPagePerf(FormMain formMain) : base(formMain, (TabPage)formMain.tabPagePerfCtl) + { + splitContainerPerfCtls = formMain.splitContainerPerfCtls; + performanceLeftList = formMain.performanceLeftList; + pl_perfGridHost = formMain.pl_perfGridHost; + spBottom = formMain.spBottom; + tabControlMain = formMain.tabControlMain; + } + + protected override void OnLoadControlEvents() + { + splitContainerPerfCtls.Panel2.SizeChanged += splitContainerPerfCtls_Panel2_SizeChanged; + performanceLeftList.SelectedtndexChanged += performanceLeftList_SelectedtndexChanged; + FormMain.linkLabelOpenPerfMon.LinkClicked += linkLabelOpenPerfMon_LinkClicked; + + + base.OnLoadControlEvents(); + } + + //性能页é¢ä»£ç  + + private bool perfTrayInited = false; + + public static Color CpuDrawColor = Color.FromArgb(17, 125, 187); + public static Color CpuBgColor = Color.FromArgb(241, 246, 250); + public static Color RamDrawColor = Color.FromArgb(139, 18, 174); + public static Color RamBgColor = Color.FromArgb(244, 242, 244); + public static Color DiskDrawColor = Color.FromArgb(77, 166, 12); + public static Color DiskBgColor = Color.FromArgb(239, 247, 223); + public static Color NetDrawColor = Color.FromArgb(167, 79, 1); + public static Color NetBgColor = Color.FromArgb(252, 243, 235); + + public static Color CpuDrawColor2 = Color.FromArgb(100, 17, 125, 187); + public static Color RamDrawColor2 = Color.FromArgb(100, 139, 18, 174); + public static Color DiskDrawColor2 = Color.FromArgb(100, 77, 166, 12); + public static Color NetDrawColor2 = Color.FromArgb(100, 167, 79, 1); + + public static Color CpuBgColor2 = Color.FromArgb(100, 85, 193, 255); + public static Color RamBgColor2 = Color.FromArgb(180, 220, 98, 244); + public static Color DiskBgColor2 = Color.FromArgb(100, 239, 247, 223); + public static Color NetBgColor2 = Color.FromArgb(100, 255, 157, 89); + + PerfItemHeader perfItemHeaderCpu; + PerfItemHeader perfItemHeaderRam; + + PerformanceListItem perf_cpu = new PerformanceListItem(); + PerformanceListItem perf_ram = new PerformanceListItem(); + + private class PerfItemHeader + { + public IntPtr performanceCounterNative = IntPtr.Zero; + public PerformanceListItem item = null; + public IPerformancePage performancePage = null; + + public bool Inited { get; set; } + + public override string ToString() + { + if (item != null) + return item.ToString(); + return base.ToString(); + } + } + + private List perfItems = new List(); + private List perfPages = new List(); + + private IPerformancePage currSelectedPerformancePage = null; + + private FormSpeedBall.SpeedItem itemCpu; + private FormSpeedBall.SpeedItem itemRam; + private FormSpeedBall.SpeedItem itemDisk; + private FormSpeedBall.SpeedItem itemNet; + private IntPtr netCounterMain = IntPtr.Zero; + + private Size lastGraphicSize = new Size(); + private Control lastGridParent = null; + private Size lastGridSize = new Size(); + private Size lastSize { get => FormMain.LastSize; set { FormMain.LastSize = value; } } + + private void splitContainerPerfCtls_Panel2_SizeChanged(object sender, EventArgs e) + { + PerfPagesResize(new Size(splitContainerPerfCtls.Panel2.Width - + (splitContainerPerfCtls.Panel2.VerticalScroll.Visible ? 40 : 30), splitContainerPerfCtls.Panel2.Height - 30)); + } + private void performanceLeftList_SelectedtndexChanged(object sender, EventArgs e) + { + if (performanceLeftList.Selectedtem == perf_cpu) + PerfPagesTo(0, perfItemHeaderCpu); + else if (performanceLeftList.Selectedtem == perf_ram) + PerfPagesTo(1, perfItemHeaderRam); + else if (performanceLeftList.Selectedtem.PageIndex != 0) + PerfPagesTo(performanceLeftList.Selectedtem.PageIndex, (PerfItemHeader)performanceLeftList.Selectedtem.Tag); + else PerfPagesToNull(); + } + private void OpeningPageMenuEventHandler(IPerformancePage sender, ToolStripMenuItem menuItemView) + { + if (menuItemView.DropDownItems.Count == 0) + { + /*ToolStripItem tcpu = menuItemView.DropDownItems.Add("CPU"); + tcpu.Tag = perfItemHeaderCpu.performancePage; + tcpu.Click += Tcpu_Click; + ToolStripItem tram = menuItemView.DropDownItems.Add(perfItemHeaderRam.item.Name); + tram.Tag = perfItemHeaderRam.performancePage; + tram.Click += Tram_Click;*/ + foreach (PerfItemHeader h in perfItems) + { + ToolStripItem tx = menuItemView.DropDownItems.Add(h.item.Name); + tx.Tag = h; + tx.Click += Tx_Click; + } + } + + foreach (ToolStripMenuItem i in menuItemView.DropDownItems) + { + if (i.Tag != null && ((PerfItemHeader)i.Tag).performancePage == sender) + i.Checked = true; + else if (i.Checked) i.Checked = false; + } + } + + private void Tx_Click(object sender, EventArgs e) + { + PerfItemHeader tag = null; + ToolStripItem item = sender as ToolStripItem; + if (item.Tag != null) + { + tag = (PerfItemHeader)item.Tag; + PerfPagesTo(tag.performancePage, tag); + } + } + private void Tcpu_Click(object sender, EventArgs e) + { + PerfPagesTo(0, perfItemHeaderCpu); + } + private void Tram_Click(object sender, EventArgs e) + { + PerfPagesTo(1, perfItemHeaderRam); + } + + private void SwithGraphicViewEventHandler(IPerformancePage sender) + { + Panel gridPanel = sender.GridPanel; + if (!sender.PageIsGraphicMode) + { + spBottom.Visible = false; + tabControlMain.Visible = false; + lastSize = Size; + + lastGridSize = gridPanel.Size; + + lastGridParent = gridPanel.Parent; + lastGridParent.Controls.Remove(gridPanel); + pl_perfGridHost.Controls.Add(gridPanel); + + gridPanel.Size = new Size(pl_perfGridHost.Width - 30, pl_perfGridHost.Height - 30); + gridPanel.Location = new Point(15, 15); + + sender.PageIsGraphicMode = true; + + pl_perfGridHost.BringToFront(); + + MAppWorkCall3(167, Handle, IntPtr.Zero); + + Size = lastGraphicSize; + } + else + { + pl_perfGridHost.SendToBack(); + + pl_perfGridHost.Controls.Remove(gridPanel); + lastGridParent.Controls.Add(gridPanel); + + MAppWorkCall3(173, Handle, IntPtr.Zero); + + gridPanel.Size = lastGridSize; + gridPanel.Location = Point.Empty; + + sender.PageIsGraphicMode = false; + + spBottom.Visible = true; + tabControlMain.Visible = true; + lastGraphicSize = Size; + Size = lastSize; + } + } + + private void PerfPagesToNull() + { + if (currSelectedPerformancePage != null) + { + currSelectedPerformancePage.PageHide(); + currSelectedPerformancePage.PageIsActive = false; + } + currSelectedPerformancePage = null; + } + private void PerfPagesTo(int index, PerfItemHeader header) + { + PerfPagesTo(perfPages[index], header); + } + private void PerfPagesTo(IPerformancePage page, PerfItemHeader header) + { + bool isGrMode = false; + + if (currSelectedPerformancePage != null) + { + if (currSelectedPerformancePage.PageIsGraphicMode) + { + isGrMode = true; + + pl_perfGridHost.SendToBack(); + + pl_perfGridHost.Controls.Remove(currSelectedPerformancePage.GridPanel); + lastGridParent.Controls.Add(currSelectedPerformancePage.GridPanel); + + currSelectedPerformancePage.GridPanel.Size = lastGridSize; + currSelectedPerformancePage.GridPanel.Location = Point.Empty; + + currSelectedPerformancePage.PageIsGraphicMode = false; + } + + currSelectedPerformancePage.PageHide(); + currSelectedPerformancePage.PageIsActive = false; + } + + currSelectedPerformancePage = null; + currSelectedPerformancePage = page; + + if (!header.Inited) + { + currSelectedPerformancePage.PageInit(); + header.Inited = true; + } + + currSelectedPerformancePage.PageShow(); + currSelectedPerformancePage.PageIsActive = true; + + performanceLeftList.Selectedtem = performanceLeftList.Items[perfPages.IndexOf(currSelectedPerformancePage)]; + + if (isGrMode) + { + lastGridSize = currSelectedPerformancePage.GridPanel.Size; + + lastGridParent = currSelectedPerformancePage.GridPanel.Parent; + lastGridParent.Controls.Remove(currSelectedPerformancePage.GridPanel); + pl_perfGridHost.Controls.Add(currSelectedPerformancePage.GridPanel); + + currSelectedPerformancePage.GridPanel.Size = new Size(pl_perfGridHost.Width - 30, pl_perfGridHost.Height - 30); + currSelectedPerformancePage.GridPanel.Location = new Point(15, 15); + + currSelectedPerformancePage.PageIsGraphicMode = true; + + pl_perfGridHost.BringToFront(); + } + } + private void PerfPagesAddToCtl(Control c, string name) + { + splitContainerPerfCtls.Panel2.Controls.Add(c); + + c.Visible = false; + c.Anchor = AnchorStyles.Left | AnchorStyles.Top;//| AnchorStyles.Right | AnchorStyles.Bottom; + //c.Size = new Size(splitContainerPerfCtls.Panel2.Width - 30, splitContainerPerfCtls.Panel2.Height - 30); + c.Location = new Point(15, 15); + c.Text = "资æºä¿¡æ¯é¡µ " + name; + c.Font = tabControlMain.Font; + } + private void PerfPagesResize(Size targetSize) + { + foreach (PerfItemHeader h in perfItems) + if (h.performancePage != null) + if (!h.performancePage.PageIsGraphicMode) + h.performancePage.Size = targetSize; + } + private void PerfPagesInit() + { + PerformancePageCpu performanceCpu = new PerformancePageCpu(); + performanceCpu.OpeningPageMenu += OpeningPageMenuEventHandler; + performanceCpu.SwithGraphicView += SwithGraphicViewEventHandler; + PerfPagesAddToCtl(performanceCpu, perf_cpu.Name); + perfPages.Add(performanceCpu); + + perfItemHeaderCpu = new PerfItemHeader(); + perfItemHeaderCpu.item = perf_cpu; + perfItemHeaderCpu.performancePage = performanceCpu; + perfItems.Add(perfItemHeaderCpu); + + PerformancePageRam performanceRam = new PerformancePageRam(); + performanceRam.OpeningPageMenu += OpeningPageMenuEventHandler; + performanceRam.SwithGraphicView += SwithGraphicViewEventHandler; + PerfPagesAddToCtl(performanceRam, perf_ram.Name); + perfPages.Add(performanceRam); + + perfItemHeaderRam = new PerfItemHeader(); + perfItemHeaderRam.item = perf_ram; + perfItemHeaderRam.performancePage = performanceRam; + perfItems.Add(perfItemHeaderRam); + } + public void PerfInit() + { + //åˆå§‹åŒ–perfé¡µé¢ + if (!Inited) + { + PerfLoadSettings(); + + MDEVICE_Init(); + + perf_cpu.Name = "CPU"; + perf_cpu.SmallText = "-- %"; + perf_cpu.BasePen = new Pen(CpuDrawColor, 2); + perf_cpu.BgBrush = new SolidBrush(CpuBgColor); + performanceLeftList.Items.Add(perf_cpu); + + perf_ram.Name = LanuageMgr.GetStr("TitleRam"); + perf_ram.SmallText = "-- %"; + perf_ram.BasePen = new Pen(RamDrawColor, 2); + perf_ram.BgBrush = new SolidBrush(RamBgColor); + performanceLeftList.Items.Add(perf_ram); + + PerfPagesInit(); + + //ç£ç›˜é¡µé¢ + MDEVICE_GetLogicalDiskInfo(); + uint count = MPERF_InitDisksPerformanceCounters(); + for (int i = 0; i < count; i++) + { + PerfItemHeader perfItemHeader = new PerfItemHeader(); + perfItemHeader.performanceCounterNative = MPERF_GetDisksPerformanceCounters(i); + perfItemHeader.item = new PerformanceListItem(); + + StringBuilder sb = new StringBuilder(32); + MPERF_GetDisksPerformanceCountersInstanceName(perfItemHeader.performanceCounterNative, sb, 32); + uint diskIndex = (uint)i;// MDEVICE_GetPhysicalDriveFromPartitionLetter(sb.ToString()[2]); + + perfItemHeader.item.Name = LanuageMgr.GetStr("TitleDisk") + sb.ToString(); + perfItemHeader.item.BasePen = new Pen(DiskDrawColor); + perfItemHeader.item.BgBrush = new SolidBrush(DiskBgColor); + perfItemHeader.item.Tag = perfItemHeader; + perfItems.Add(perfItemHeader); + + PerformancePageDisk performancedisk = new PerformancePageDisk(perfItemHeader.performanceCounterNative, diskIndex); + performancedisk.OpeningPageMenu += OpeningPageMenuEventHandler; + performancedisk.SwithGraphicView += SwithGraphicViewEventHandler; + PerfPagesAddToCtl(performancedisk, perfItemHeader.item.Name); + perfPages.Add(performancedisk); + + perfItemHeader.performancePage = performancedisk; + + perfItemHeader.item.PageIndex = perfPages.Count - 1; + performanceLeftList.Items.Add(perfItemHeader.item); + } + + //网å¡é¡µé¢ + count = MDEVICE_GetNetworkAdaptersInfo(); + for (int i = 0; i < count; i++) + { + StringBuilder sbName = new StringBuilder(128); + if (MDEVICE_GetNetworkAdapterInfoItem(i, sbName, 128)) + { + PerfItemHeader perfItemHeader = new PerfItemHeader(); + perfItemHeader.performanceCounterNative = MPERF_GetNetworksPerformanceCounterWithName(sbName.ToString()); + perfItemHeader.item = new PerformanceListItem(); + + bool isWifi = MDEVICE_GetNetworkAdapterIsWIFI(sbName.ToString()); + + perfItemHeader.item.Name = isWifi ? "Wi-Fi" : LanuageMgr.GetStr("Ethernet"); + perfItemHeader.item.BasePen = new Pen(NetDrawColor); + perfItemHeader.item.BgBrush = new SolidBrush(NetBgColor); + perfItemHeader.item.Tag = perfItemHeader; + perfItems.Add(perfItemHeader); + + StringBuilder sbIPV4 = new StringBuilder(32); + StringBuilder sbIPV6 = new StringBuilder(64); + bool enabled = MDEVICE_GetNetworkAdapterInfoFormName(sbName.ToString(), + sbIPV4, 32, sbIPV6, 64); + perfItemHeader.item.Gray = !enabled; + if (!enabled) + perfItemHeader.item.SmallText = LanuageMgr.GetStr("NotConnect"); + + PerformancePageNet performancenet = new PerformancePageNet(perfItemHeader.performanceCounterNative, isWifi, sbName.ToString()); + performancenet.OpeningPageMenu += OpeningPageMenuEventHandler; + performancenet.SwithGraphicView += SwithGraphicViewEventHandler; + performancenet.v4 = sbIPV4.ToString(); + performancenet.v6 = sbIPV6.ToString(); + + PerfPagesAddToCtl(performancenet, perfItemHeader.item.Name); + perfPages.Add(performancenet); + + perfItemHeader.performancePage = performancenet; + + perfItemHeader.item.PageIndex = perfPages.Count - 1; + performanceLeftList.Items.Add(perfItemHeader.item); + } + } + + performanceLeftList.UpdateAll(); + performanceLeftList.Invalidate(); + + PerfPagesTo(0, perfItemHeaderCpu); + PerfPagesResize(new Size(splitContainerPerfCtls.Panel2.Width - (splitContainerPerfCtls.Panel2.VerticalScroll.Visible ? 40 : 30), splitContainerPerfCtls.Panel2.Height - 30)); + + Inited = true; + } + } + private void PerfLoadSettings() + { + string sg = GetConfig("OldSizeGraphic", "AppSetting", "640-320"); + if (sg.Contains("-")) + { + string[] ss = sg.Split('-'); + try + { + int w = int.Parse(ss[0]); if (w + FormMain.Left > Screen.PrimaryScreen.WorkingArea.Width) w = Screen.PrimaryScreen.WorkingArea.Width - FormMain.Left; + int h = int.Parse(ss[1]); if (h + FormMain.Top > Screen.PrimaryScreen.WorkingArea.Height) h = Screen.PrimaryScreen.WorkingArea.Height - FormMain.Top; + lastGraphicSize = new Size(w, h); + } + catch { } + } + } + public void PerfInitTray() + { + if (!perfTrayInited) + { + if (MPERF_InitNetworksPerformanceCounters2() > 0) + netCounterMain = MPERF_GetNetworksPerformanceCounters(0); + + formSpeedBall = new FormSpeedBall(FormMain); + formSpeedBall.Show(); + ShowWindow(formSpeedBall.Handle, 0); + + Font itemHugeFont = new Font(Font.FontFamily, 10.5f); + Font itemValueFont = new Font(Font.FontFamily, 10.5f); + + itemCpu = new FormSpeedBall.SpeedItem("CPU", CpuBgColor2, CpuDrawColor); + itemRam = new FormSpeedBall.SpeedItem(LanuageMgr.GetStr("TitleRam"), RamBgColor2, RamDrawColor2); + itemDisk = new FormSpeedBall.SpeedItem(LanuageMgr.GetStr("TitleDisk"), DiskBgColor2, DiskDrawColor2); + itemNet = new FormSpeedBall.SpeedItem(LanuageMgr.GetStr("TitleNet"), NetBgColor2, NetDrawColor2); + + itemCpu.TextFont = itemHugeFont; + itemCpu.ValueFont = itemValueFont; + itemRam.TextFont = itemHugeFont; + itemRam.ValueFont = itemValueFont; + itemDisk.TextFont = itemHugeFont; + itemDisk.ValueFont = itemValueFont; + itemNet.TextFont = itemHugeFont; + itemNet.ValueFont = itemValueFont; + + itemCpu.GridType = FormSpeedBall.SpeedItemGridType.OneGrid; + itemRam.GridType = FormSpeedBall.SpeedItemGridType.NoGrid; + itemNet.GridType = FormSpeedBall.SpeedItemGridType.NoValue; + itemDisk.GridType = FormSpeedBall.SpeedItemGridType.OneGrid; + + formSpeedBall.Items.Add(itemCpu); + formSpeedBall.Items.Add(itemRam); + formSpeedBall.Items.Add(itemDisk); + formSpeedBall.Items.Add(itemNet); + + perfTrayInited = true; + } + } + public void PerfUpdate() + { + foreach (PerfItemHeader h in perfItems) + { + if (h.item.Gray) continue; + + string outCustomStr = null; + int outdata1 = -1; + int outdata2 = -1; + if (h.performancePage.PageUpdateSimple(out outCustomStr, out outdata1, out outdata2)) + { + if (outCustomStr != null) + h.item.SmallText = outCustomStr; + } + else + { + if (outCustomStr == null) + h.item.SmallText = outdata1.ToString("0.0") + "%"; + } + + if (outdata2 != -1 && outdata2 != -1) + { + h.item.AddData(outdata1); + h.item.AddData2(outdata2); + } + else if (outdata1 != -1) + h.item.AddData(outdata1); + } + + if (currSelectedPerformancePage != null) + currSelectedPerformancePage.PageUpdate(); + } + public void PerfClear() + { + foreach (IPerformancePage h in perfPages) + h.PageDelete(); + perfPages.Clear(); + + MPERF_DestroyNetworksPerformanceCounters(); + MPERF_DestroyDisksPerformanceCounters(); + perfItems.Clear(); + + MDEVICE_DestroyLogicalDiskInfo(); + MDEVICE_DestroyNetworkAdaptersInfo(); + MDEVICE_UnInit(); + + SetConfig("OldSizeGraphic", "AppSetting", lastGraphicSize.Width + "-" + lastGraphicSize.Height); + + formSpeedBall.Close(); + } + public void PerfUpdateGridUnit() + { + string unistr = ""; + if (FormMain.baseProcessRefeshTimer.Enabled) + unistr = (FormMain.baseProcessRefeshTimer.Interval / 1000 * 60).ToString() + LanuageFBuffers.Str_Second; + else unistr = LanuageFBuffers.Str_StatusPaused; + foreach (IPerformancePage p in perfPages) + p.PageSetGridUnit(unistr); + } + private void PerfSetTrayPos() + { + Point p = MousePosition; + p.X -= 15; p.Y -= 15; + Point t = new Point(); + if (p.Y < 50) + t.Y = 45; + else if (p.Y > Screen.PrimaryScreen.Bounds.Height - 50) + t.Y = Screen.PrimaryScreen.Bounds.Height - formSpeedBall.Height - 45; + else t.Y = p.Y - formSpeedBall.Height; + + if (p.X < 50) + t.X = 45; + else if (p.X > Screen.PrimaryScreen.Bounds.Width - 50) + t.X = Screen.PrimaryScreen.Bounds.Width - formSpeedBall.Width - 45; + else t.X = p.X - formSpeedBall.Width; + + if (t.X < 0) t.X = 2; + if (t.X > Screen.PrimaryScreen.Bounds.Width - formSpeedBall.Width) t.X = Screen.PrimaryScreen.Bounds.Width - formSpeedBall.Width - 2; + if (t.Y < 0) t.Y = 2; + if (t.Y > Screen.PrimaryScreen.Bounds.Height - formSpeedBall.Height) t.X = Screen.PrimaryScreen.Bounds.Height - formSpeedBall.Height - 2; + + formSpeedBall.Location = t; + } + public void PerfShowSpeedBall() + { + PerfSetTrayPos(); + ShowWindow(formSpeedBall.Handle, 5); + } + public void PerfDayUpdate(out double cpu, out double ram, out double disk, out double net, out bool perfsimpleGeted) + { + if (IsWindowVisible(formSpeedBall.Handle)) + { + MPERF_GlobalUpdatePerformanceCounters(); + + cpu = MPERF_GetCpuUseAge2(); + ram = MPERF_GetRamUseAge2() * 100; + disk = MPERF_GetDiskUseage() * 100; + net = MPERF_GetNetWorkUseage() * 100; + + perfsimpleGeted = true; + + itemCpu.Value = cpu.ToString("0.0") + " %"; + itemCpu.NumValue = cpu / 100; + itemCpu.AddData1((int)cpu); + + ulong all = MSystemMemoryPerformanctMonitor.GetAllMemory(); + ulong used = MSystemMemoryPerformanctMonitor.GetMemoryUsed(); + + ulong divor = 0; + string unit = GetBestFilesizeUnit(all, out divor); + + itemRam.Value = (used / (double)divor).ToString("0.0") + " " + unit + "/" + (all / (double)divor).ToString("0.0") + " " + unit + " (" + ram.ToString("0.0") + "%)"; + itemRam.NumValue = ram / 100; + + itemDisk.Value = disk.ToString("0.0") + " %"; + itemDisk.NumValue = disk / 100; + itemDisk.AddData1((int)disk); + + double netsent = 0, netreceive = 0; + if (MPERF_GetNetworksPerformanceCountersValues(netCounterMain, ref netsent, ref netreceive)) + itemNet.Value = LanuageMgr.GetStr("Send") + " " + (netsent / 1024 * 8).ToString("0.0") + " Kbps " + + LanuageMgr.GetStr("Receive") + " " + (netreceive / 1024 * 8).ToString("0.0") + " Kbps"; + else itemNet.Value = net.ToString("0.0") + " %"; + + formSpeedBall.Invalidate(); + } + else + { + cpu = 0; + ram = 0; + disk = 0; + net = 0; + perfsimpleGeted = false; + } + } + + private FormSpeedBall formSpeedBall = null; + + private void linkLabelOpenPerfMon_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + MRunExe("perfmon.exe", "/res"); + } + + } +} diff --git a/TaskMgr/Main/MainPageProcess.cs b/TaskMgr/Main/MainPageProcess.cs new file mode 100644 index 0000000..59c1426 --- /dev/null +++ b/TaskMgr/Main/MainPageProcess.cs @@ -0,0 +1,2768 @@ +using PCMgr.Ctls; +using PCMgr.Helpers; +using PCMgr.Lanuages; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.NativeMethods; +using static PCMgr.NativeMethods.Win32; +using static PCMgr.Main.MainUtils; + +namespace PCMgr.Main +{ + class MainPageProcess : MainPage + { + private TaskMgrList listProcess; + private TaskMgrList listApps; + private Button btnEndTaskSimple; + private Button btnEndProcess; + private Label lbProcessCount; + + public MainPageProcess(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageProcCtl) + { + listProcess = formMain.listProcess; + listApps = formMain.listApps; + btnEndTaskSimple = formMain.btnEndTaskSimple; + btnEndProcess = formMain.btnEndProcess; + lbProcessCount = formMain.lbProcessCount; + } + + protected override void OnLoad() + { + mainPageScMgr = FormMain.MainPageScMgr; + mainPageUwpMgr = FormMain.MainPageUwpMgr; + + base.OnLoad(); + } + protected override void OnLoadControlEvents() + { + FormMain.baseProcessRefeshTimerLow.Interval = 10000; + FormMain.baseProcessRefeshTimerLow.Tick += BaseProcessRefeshTimerLow_Tick; + FormMain.baseProcessRefeshTimerLowSc.Interval = 120000; + FormMain.baseProcessRefeshTimerLowSc.Tick += BaseProcessRefeshTimerLowSc_Tick; + FormMain.baseProcessRefeshTimerLowUWP.Interval = 5000; + FormMain.baseProcessRefeshTimerLowUWP.Tick += BaseProcessRefeshTimerLowUWP_Tick; + + FormMain.check_showAllProcess.CheckedChanged += check_showAllProcess_CheckedChanged; + FormMain.expandFewerDetals.Click += expandFewerDetals_Click; + FormMain.expandMoreDetals.Click += expandMoreDetals_Click; + + listProcess.Header.CloumClick += listProcess_Header_CloumClick; + listProcess.SelectItemChanged += listProcess_SelectItemChanged; + listProcess.KeyDown +=listProcess_KeyDown; + listProcess.MouseClick += listProcess_MouseClick; + listProcess.MouseDoubleClick += listProcess_MouseDoubleClick; + listProcess.MouseDown += listProcess_MouseDown; + listProcess.DrawUWPPausedIconIndexGetCallback = ProcessListGetSatateIndex; + + listApps.SelectItemChanged +=listApps_SelectItemChanged; + listApps.KeyDown += listApps_KeyDown; + listApps.MouseClick +=listApps_MouseClick; + listApps.MouseDoubleClick += listApps_MouseDoubleClick; + + FormMain.百分比ToolStripMenuItemRam.Click += 百分比ToolStripMenuItemRam_Click; + FormMain.值ToolStripMenuItemRam.Click += 值ToolStripMenuItemRam_Click; + FormMain.百分比ToolStripMenuItemDisk.Click += 百分比ToolStripMenuItemDisk_Click; + FormMain.值ToolStripMenuItemDisk.Click += 值ToolStripMenuItemDisk_Click; + FormMain.百分比ToolStripMenuItemNet.Click += 百分比ToolStripMenuItemNet_Click; + FormMain.值ToolStripMenuItemNet.Click += 值ToolStripMenuItemNet_Click; + + + base.OnLoadControlEvents(); + } + + private MainPageScMgr mainPageScMgr = null; + private MainPageUwpMgr mainPageUwpMgr = null; + + //主页进程页é¢ä»£ç  + + private const double PERF_LIMIT_MIN_DATA_DISK = 0.005; + private const double PERF_LIMIT_MIN_DATA_NETWORK = 0.001; + + private bool refeshLowLock = false; + private Size lastSimpleSize { get => FormMain.LastSimpleSize; set { FormMain.LastSimpleSize = value; } } + private Size lastSize { get => FormMain.LastSize; set { FormMain.LastSize = value; } } + private int nextSecType = -1; + private int sortitem = -1; + private bool sorta = false; + private bool isFirstLoad = true; + private bool mergeApps = true; + + private TaskListViewColumnSorter lvwColumnSorter = null; + + private bool isGlobalRefeshing = false; + private bool isGlobalRefeshingAll = false; + + private bool isRamPercentage = false; + private bool isDiskPercentage = false; + private bool isNetPercentage = false; + + private bool isSelectExplorer = false; + private uint currentProcessPid = 0; + + internal List GetLoadedPs() + { + return loadedPs; + } + + private List uwpHostPid = new List(); + private List loadedPs = new List(); + private List uwps = new List(); + private List uwpwins = new List(); + private List windowsProcess = new List(); + private List veryimporantProcess = new List(); + private Color dataGridZeroColor = Color.FromArgb(255, 244, 196); + + private string csrssPath = ""; + private string ntoskrnlPath = ""; + private string systemRootPath = ""; + private string svchostPath = ""; + private string svchostPathwow = ""; + + private TaskMgrListItem nextKillItem = null; + private Font smallListFont = null; + private TaskMgrListItem thisLoadItem = null; + + private int maxMem = 1024; + + private void MainGetWinsCallBack(IntPtr hWnd, IntPtr data, int i) + { + if (i == 1) + { + if (IsWindowVisible(hWnd)) + { + UwpWinItem item = new UwpWinItem(); + item.hWnd = hWnd; + item.ownerPid = (uint)data.ToInt32(); + uwpwins.Add(item); + } + } + else + { + if (thisLoadItem != null) + { + if (((PsItem)thisLoadItem.Tag).exepath.ToLower() != @"c:\windows\system32\dwm.exe") + { + if (!thisLoadItem.HasWindowChild(hWnd)) + { + if (IsWindowVisible(hWnd)) + { + IntPtr icon = MGetWindowIcon(hWnd); + TaskMgrListItemChild c = new TaskMgrListItemChild(Marshal.PtrToStringAuto(data), icon != IntPtr.Zero ? Icon.FromHandle(icon) : PCMgr.Properties.Resources.icoShowedWindow); + c.Tag = hWnd; + c.Type = TaskMgrListItemType.ItemWindow; + thisLoadItem.Childs.Add(c); + } + } + } + } + } + } + private void MainEnumWinsCallBack(IntPtr hWnd, IntPtr hWndParent) + { + WorkWindow.FormSpyWindow f = new WorkWindow.FormSpyWindow(hWnd); + Control fp = Control.FromHandle(hWndParent); + f.ShowDialog(fp); + } + + private bool IsVeryImporant(PsItem p) + { + if (p.exepath != null) + { + string str = p.exepath.ToLower(); + foreach (string s in veryimporantProcess) + if (s == str) return true; + } + return false; + } + private bool IsImporant(PsItem p) + { + /*if (p.exepath != null) + { + if (p.exepath.ToLower() == @"c:\windows\system32\svchost.exe") return true; + if (p.exepath.ToLower() == @"c:\windows\system32\cssrs.exe") return true; + if (p.exepath.ToLower() == @"c:\windows\system32\smss.exe") return true; + if (p.exepath.ToLower() == @"c:\windows\system32\lsass.exe") return true; + if (p.exepath.ToLower() == @"c:\windows\system32\sihost.exe") return true; + if (p.exepath.ToLower() == @"c:\windows\system32\cssrs.exe") return true; + + }*/ + if (p.exepath != null) + { + if (p.exepath.ToLower() == @"c:\windows\system32\svchost.exe") return true; + return IsWindowsProcess(p.exepath); + } + return false; + } + private bool IsExplorer(PsItem p) + { + if (p.exename != null && p.exename.ToLower() == "explorer.exe") return true; + if (p.exepath != null && p.exepath.ToLower() == @"c:\windows\explorer.exe") return true; + return false; + } + private bool IsWindowsProcess(string str) + { + //检测是ä¸æ˜¯Windows进程 + if (str != null) + { + str = str.ToLower(); + foreach (string s in windowsProcess) + if (s == str) return true; + } + return false; + } + + private bool ProcessListGetUwpIsRunning(TaskMgrListItem uwpHostItem, out IntPtr itsHwnd) + { + bool rs = false; + foreach (UwpWinItem u in uwpwins) + { + foreach (TaskMgrListItem uwpprocess in uwpHostItem.Childs) + { + if (uwpprocess.Type == TaskMgrListItemType.ItemUWPProcess) + { + if (uwpprocess.PID == u.ownerPid) + { + itsHwnd = u.hWnd; + rs = true; + return rs; + } + } + } + } + itsHwnd = IntPtr.Zero; + return rs; + } + private Color ProcessListGetColorFormValue(double v, double maxv) + { + //数值百分百转为颜色 + double d = v / maxv; + if (d <= 0) + return Color.FromArgb(255, 244, 196); + else if (d > 0 && d <= 0.1) + return Color.FromArgb(249, 236, 168); + else if (d > 0.1 && d <= 0.3) + return Color.FromArgb(255, 228, 135); + else if (d > 0.3 && d <= 0.6) + return Color.FromArgb(252, 207, 23); + else if (d > 0.6 && d <= 0.8) + return Color.FromArgb(252, 184, 22); + else if (d > 0.8 && d <= 0.9) + return Color.FromArgb(255, 167, 29); + else if (d > 0.9) + return Color.FromArgb(255, 160, 19); + return Color.FromArgb(255, 249, 228); + } + + //查找æ¡ç›® + private UwpHostItem ProcessListFindUWPItemWithHostId(uint pid) + { + UwpHostItem rs = null; + foreach (UwpHostItem i in uwpHostPid) + { + if (i.pid == pid) + { + rs = i; + break; + } + } + return rs; + } + private UwpItem ProcessListFindUWPItem(string fullName) + { + UwpItem rs = null; + foreach (UwpItem i in uwps) + { + if (i.uwpFullName == fullName) + { + rs = i; + break; + } + } + return rs; + } + private PsItem ProcessListFindPsItem(uint pid) + { + PsItem rs = null; + foreach (PsItem i in loadedPs) + { + if (i.pid == pid) + { + rs = i; + return rs; + } + } + return rs; + } + private TaskMgrListItem ProcessListFindItem(uint pid) + { + TaskMgrListItem rs = null; + foreach (TaskMgrListItem i in listProcess.Items) + { + if (i.PID == pid) + { + rs = i; + return rs; + } + if (i.Type == TaskMgrListItemType.ItemProcessHost + || i.Type == TaskMgrListItemType.ItemUWPProcess) + { + foreach (TaskMgrListItem ix in i.Childs) + { + if (ix.PID == pid) + { + rs = ix; + return rs; + } + } + } + } + return rs; + } + private bool ProcessListIsProcessLoaded(uint pid, out PsItem item) + { + bool rs = false; + foreach (PsItem f in loadedPs) + { + if (f.pid == pid) + { + item = f; + rs = true; + return rs; + } + } + item = null; + return rs; + } + + private IntPtr processMonitor = IntPtr.Zero; + + private bool perfMainInited = false; + private bool perfMainInitFailed = false; + + private int ProcessListGetSatateIndex() + { + return stateindex; + } + private void ProcessListLoadCallBacks() + { + NativeBridge.enumWinsCallBack = MainEnumWinsCallBack; + NativeBridge.getWinsCallBack = MainGetWinsCallBack; + + NativeBridge.ProcessNewItemCallBack = ProcessListNewItemCallBack; + NativeBridge.ProcessRemoveItemCallBack = ProcessListRemoveItemCallBack; + + MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(NativeBridge.enumWinsCallBack), 3); + MAppSetCallBack(Marshal.GetFunctionPointerForDelegate(NativeBridge.getWinsCallBack), 4); + + NativeBridge.ptrProcessNewItemCallBack = Marshal.GetFunctionPointerForDelegate(NativeBridge.ProcessNewItemCallBack); + NativeBridge.ptrProcessRemoveItemCallBack = Marshal.GetFunctionPointerForDelegate(NativeBridge.ProcessRemoveItemCallBack); + } + private void ProcessListLoadSettings() + { + mergeApps = GetConfigBool("MergeApps", "Configure", true); + isRamPercentage = GetConfigBool("RamPercentage", "Configure", false); + isDiskPercentage = GetConfigBool("DiskPercentage", "Configure", false); + isNetPercentage = GetConfigBool("NetPercentage", "Configure", false); + + if (isRamPercentage) FormMain.百分比ToolStripMenuItemRam.Checked = true; + else FormMain.值ToolStripMenuItemRam.Checked = true; + + if (isDiskPercentage) FormMain.百分比ToolStripMenuItemDisk.Checked = true; + else FormMain.值ToolStripMenuItemDisk.Checked = true; + + if (isNetPercentage) FormMain.百分比ToolStripMenuItemNet.Checked = true; + else FormMain.值ToolStripMenuItemNet.Checked = true; + + sorta = GetConfigBool("ListSortDk", "AppSetting", true); + string sortitemxx = GetConfig("ListSortIndex", "AppSetting", "0"); + if (sortitemxx != "" && sortitemxx != "-1") + int.TryParse(sortitemxx, out sortitem); + + } + private void ProcessListSaveSettings() + { + SetConfig("ListSortIndex", "AppSetting", sortitem.ToString()); + if (sorta) SetConfig("ListSortDk", "AppSetting", "TRUE"); + else SetConfig("ListSortDk", "AppSetting", "FALSE"); + + SetConfigBool("RamPercentage", "Configure", isRamPercentage); + SetConfigBool("DiskPercentage", "Configure", isDiskPercentage); + SetConfigBool("NetPercentage", "Configure", isNetPercentage); + } + private void ProcessListLoadCols() + { + TaskMgrListGroup lg = new TaskMgrListGroup(LanuageMgr.GetStr("TitleApp", false)); + listProcess.Groups.Add(lg); + TaskMgrListGroup lg2 = new TaskMgrListGroup(LanuageMgr.GetStr("TitleBackGround", false)); + listProcess.Groups.Add(lg2); + TaskMgrListGroup lg3 = new TaskMgrListGroup(LanuageMgr.GetStr("TitleWinApp", false)); + listProcess.Groups.Add(lg3); + listProcess.Header.CanMoveCloum = true; + + listProcessAddHeaderMenu("TitleProcName"); + listProcessAddHeaderMenu("TitleType"); + listProcessAddHeaderMenu("TitlePublisher"); + listProcessAddHeaderMenu("TitleStatus"); + listProcessAddHeaderMenu("TitlePID"); + listProcessAddHeaderMenu("TitleCPU"); + listProcessAddHeaderMenu("TitleRam"); + listProcessAddHeaderMenu("TitleDisk"); + listProcessAddHeaderMenu("TitleNet"); + listProcessAddHeaderMenu("TitleProcPath"); + listProcessAddHeaderMenu("TitleCmdLine"); + + string s1 = GetConfig("MainHeaders1", "AppSetting"); + if (s1 != "") listProcessAddHeader("TitleName", int.Parse(s1)); + else listProcessAddHeader("TitleName", 200); + string headers = GetConfig("MainHeaders", "AppSetting"); + if (headers.Contains("#")) + { + string[] headersv = headers.Split('#'); + for (int i = 0; i < headersv.Length; i++) + { + if (headersv[i].Contains("-")) + { + int width = 0; + string[] headersvx = headersv[i].Split('-'); + if (headersv.Length >= 2) + { + if (!int.TryParse(headersvx[1], out width) || width < 0 || width > 512) + width = listProcessTryGetHeaderDefaultWidth(headersvx[0]); + listProcessAddHeader(headersvx[0], width); + listProcessCheckHeaderMenu(headersvx[0], true); + } + } + } + } + else if (headers == "") + { + listProcessAddHeader("TitleStatus", listProcessTryGetHeaderDefaultWidth("TitleStatus")); + listProcessAddHeader("TitlePID", listProcessTryGetHeaderDefaultWidth("TitlePID")); + listProcessAddHeader("TitleProcName", listProcessTryGetHeaderDefaultWidth("TitleProcName")); + listProcessAddHeader("TitleCPU", listProcessTryGetHeaderDefaultWidth("TitleCPU")); + listProcessAddHeader("TitleRam", listProcessTryGetHeaderDefaultWidth("TitleRam")); + listProcessAddHeader("TitleDisk", listProcessTryGetHeaderDefaultWidth("TitleDisk")); + listProcessAddHeader("TitleNet", listProcessTryGetHeaderDefaultWidth("TitleNet")); + } + + listProcessGetAllHeaderIndexs(); + + if (pidindex != -1) listProcess.Header.Items[pidindex].Alignment = StringAlignment.Far; + if (cpuindex != -1) + { + listProcess.Header.Items[cpuindex].IsNum = true; + listProcess.Header.Items[cpuindex].Alignment = StringAlignment.Far; + } + if (ramindex != -1) + { + listProcess.Header.Items[ramindex].IsNum = true; + listProcess.Header.Items[ramindex].Alignment = StringAlignment.Far; + } + if (diskindex != -1) + { + listProcess.Header.Items[diskindex].IsNum = true; + listProcess.Header.Items[diskindex].Alignment = StringAlignment.Far; + } + if (netindex != -1) + { + listProcess.Header.Items[netindex].IsNum = true; + listProcess.Header.Items[netindex].Alignment = StringAlignment.Far; + } + } + private void ProcessListSaveCols() + { + if (saveheader) + { + string headers = ""; + for (int i = 1; i < listProcess.Header.SortedItems.Count; i++) + headers = headers + "#" + listProcess.Header.SortedItems[i].Identifier + "-" + listProcess.Header.SortedItems[i].Width; + SetConfig("MainHeaders", "AppSetting", headers); + } + SetConfig("MainHeaders1", "AppSetting", listProcess.Colunms[0].Width.ToString()); + } + private void ProcessListInitPerfs() + { + if (!perfMainInitFailed &&!perfMainInited) + { + //åˆå§‹åŒ–整体性能计数器 + MPERF_Init3PerformanceCounters(); + ProcessListForceRefeshAll(); + perfMainInited = true; + } + } + private void ProcessListUnInitPerfs() + { + if (perfMainInited) + { + //释放计数器 + MPERF_Destroy3PerformanceCounters(); + } + } + public void ProcessListInit() + { + //åˆå§‹åŒ– + if (!Inited) + { + lvwColumnSorter = new TaskListViewColumnSorter(this); + + ProcessListLoadCols(); + ProcessListLoadSettings(); + ProcessListLoadCallBacks(); + + currentProcessPid = (uint)MAppWorkCall3(180, IntPtr.Zero, IntPtr.Zero); + + processMonitor = MProcessMonitor.CreateProcessMonitor(NativeBridge.ptrProcessRemoveItemCallBack, NativeBridge.ptrProcessNewItemCallBack, Nullptr); + + if (!FormMain.IsAdmin) + { + FormMain.spl1.Visible = true; + FormMain.check_showAllProcess.Visible = true; + } + + smallListFont = new Font(FormMain.tabControlMain.Font.FontFamily, 9f); + + if (systemRootPath == "") systemRootPath = Marshal.PtrToStringUni(MAppWorkCall4(95, Nullptr, Nullptr)); + if (csrssPath == "") csrssPath = Marshal.PtrToStringUni(MAppWorkCall4(96, Nullptr, Nullptr)); + if (ntoskrnlPath == "") ntoskrnlPath = Marshal.PtrToStringUni(MAppWorkCall4(97, Nullptr, Nullptr)); + if (svchostPath == "") + { + svchostPath = (systemRootPath + @"\System32\svchost.exe").ToLower(); + svchostPathwow = (systemRootPath + @"\syswow64\svchost.exe").ToLower(); + } + + windowsProcess.Add(@"C:\Program Files\Windows Defender\NisSrv.exe".ToLower()); + windowsProcess.Add(@"C:\Program Files\Windows Defender\MsMpEng.exe".ToLower()); + windowsProcess.Add(svchostPath); + windowsProcess.Add((systemRootPath + @"\System32\csrss.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\conhost.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"‪\System32\sihost.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\winlogon.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\wininit.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\smss.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\services.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\dwm.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\lsass.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\explorer.exe").ToLower()); + + veryimporantProcess.Add((systemRootPath + @"\System32\wininit.exe").ToLower()); + veryimporantProcess.Add((systemRootPath + @"\System32\csrss.exe").ToLower()); + veryimporantProcess.Add((systemRootPath + @"\System32\lsass.exe").ToLower()); + veryimporantProcess.Add((systemRootPath + @"\System32\smss.exe").ToLower()); + + //计算å•ä¸ªç¨‹åºæœ€å¤§ç†æƒ³å†…å­˜mb,项目颜色需è¦ç”¨ + ulong allMem = MSystemMemoryPerformanctMonitor.GetAllMemory(); + if (allMem > 34359738368) maxMem = 16384; + else if (allMem > 17179869184) maxMem = 16384; + else if (allMem > 8589934592) maxMem = 8192; + else if (allMem > 4294967296) maxMem = 4096; + + Inited = true; + + if (MIsRunasAdmin()) FormMain.MainPageScMgr.ScMgrInit(); + if (SysVer.IsWin8Upper()) FormMain.MainPageUwpMgr.UWPListInit(); + + ProcessListRefesh(); + ProcessListSimpleInit(); + ProcessListInitPerfs(); + + if (isFirstLoad) + { + if (sortitem < listProcess.Header.Items.Count && sortitem >= 0) + { + lvwColumnSorter.Order = sorta ? SortOrder.Ascending : SortOrder.Descending; + lvwColumnSorter.SortColumn = sortitem; + listProcess.Header.Items[sortitem].ArrowType = sorta ? TaskMgrListHeaderSortArrow.Ascending : TaskMgrListHeaderSortArrow.Descending; + listProcess.Header.Invalidate(); + listProcess.ListViewItemSorter = lvwColumnSorter; + if (sortitem == 0) listProcess.ShowGroup = true; + else listProcess.ShowGroup = false; + } + + ProcessListLoadFinished(); + isFirstLoad = false; + } + + FormMain.baseProcessRefeshTimer.Start(); + FormMain.baseProcessRefeshTimerLowUWP.Start(); + FormMain.baseProcessRefeshTimerLow.Start(); + FormMain.baseProcessRefeshTimerLowSc.Start(); + + FormMain.StartingProgressShowHide(false); + } + + } + private void ProcessListLoadFinished() + { + //firstLoad + listProcess.Show(); + //Cursor = Cursors.Arrow; + } + + public void ProcessListDayUpdate(double cpu, double ram, double disk, double net, bool perfsimpleGeted) + { + listProcess.Locked = true; + + if (perfMainInited) + { + //Refesh perfs + if (!perfsimpleGeted && (cpuindex != -1 || ramindex != -1 || diskindex != -1 || netindex != -1)) + MPERF_GlobalUpdatePerformanceCounters(); + if (cpuindex != -1) + { + if (!perfsimpleGeted) cpu = MPERF_GetCpuUseAge(); + listProcess.Colunms[cpuindex].TextBig = (int)cpu + "%"; + if (cpu >= 95) + listProcess.Colunms[cpuindex].IsHot = true; + else listProcess.Colunms[cpuindex].IsHot = false; + } + if (ramindex != -1) + { + if (!perfsimpleGeted) ram = MPERF_GetRamUseAge2() * 100; + listProcess.Colunms[ramindex].TextBig = (int)ram + "%"; + if (ram >= 95) + listProcess.Colunms[ramindex].IsHot = true; + else listProcess.Colunms[ramindex].IsHot = false; + } + if (diskindex != -1) + { + if (!perfsimpleGeted) disk = MPERF_GetDiskUseage() * 100; + listProcess.Colunms[diskindex].TextBig = (int)disk + "%"; + if (disk >= 95) + listProcess.Colunms[diskindex].IsHot = true; + else listProcess.Colunms[diskindex].IsHot = false; + } + if (netindex != -1) + { + if (!perfsimpleGeted) net = MPERF_GetNetWorkUseage() * 100; + listProcess.Colunms[netindex].TextBig = (int)net + "%"; + if (net >= 95) + listProcess.Colunms[netindex].IsHot = true; + else listProcess.Colunms[netindex].IsHot = false; + } + } + + //Refesh Process List + ProcessListRefesh2(); + + listProcess.Locked = false; + listProcess.Header.Invalidate(); + } + public void ProcessListRefesh() + { + //清空整个列表并加载 + + uwps.Clear(); + uwpHostPid.Clear(); + uwpwins.Clear(); + + if (SysVer.IsWin8Upper()) MAppVProcessAllWindowsUWP(); + + listProcess.Locked = true; + listProcess.Items.Clear(); + + loadedPs.Clear(); + + MProcessMonitor.EnumAllProcess(processMonitor); + + ProcessListRefeshPidTree(); + + bool refeshAColumData = lvwColumnSorter.SortColumn == cpuindex + || lvwColumnSorter.SortColumn == ramindex + || lvwColumnSorter.SortColumn == diskindex + || lvwColumnSorter.SortColumn == netindex + || lvwColumnSorter.SortColumn == stateindex; + + lbProcessCount.Text = LanuageFBuffers.Str_ProcessCount + " : " + listProcess.Items.Count; + + refeshLowLock = true; + ProcessListForceRefeshAll(); + refeshLowLock = false; + + listProcess.Locked = false; + if (refeshAColumData) + listProcess.Sort(false);//æŽ’åº + listProcess.Locked = false; + //刷新列表 + listProcess.SyncItems(true); + } + public void ProcessListRefesh2() + { + isGlobalRefeshing = true; + + if (netindex != -1) MPERF_NET_UpdateAllProcessNetInfo(); + uwpwins.Clear(); + + //åˆ·æ–°æ‰€æœ‰æ•°æ® + listProcess.Locked = true; + + //åˆ·æ–°çª—å£ + MAppWorkCall3(222); + + MProcessMonitor.RefeshAllProcess(processMonitor); + + //枚举一些UWP应用 + if (SysVer.IsWin8Upper()) MAppVProcessAllWindowsUWP(); + + //åˆ·æ–°æ€§èƒ½æ•°æ® + bool refeshAColumData = lvwColumnSorter.SortColumn == cpuindex + || lvwColumnSorter.SortColumn == ramindex + || lvwColumnSorter.SortColumn == diskindex + || lvwColumnSorter.SortColumn == netindex + || lvwColumnSorter.SortColumn == stateindex; + ProcessListUpdateValues(refeshAColumData ? lvwColumnSorter.SortColumn : -1); + ProcessListRefeshPidTree(); + + if (!FormMain.IsSimpleView) + { + listProcess.Sort(false);//æŽ’åº + listProcess.Locked = false; + //刷新列表 + listProcess.SyncItems(true); + + FormMain.lbProcessCount.Text = LanuageFBuffers.Str_ProcessCount + " : " + listProcess.Items.Count; + } + else + { + listProcess.Locked = false; + ProcessListSimpleRefesh(); + } + + isGlobalRefeshing = false; + if (isGlobalRefeshingAll) + { + isGlobalRefeshingAll = false; + ProcessListForceRefeshAll(); + } + + ProcessListKillLastEndItem(); + } + + public void ProcessListRemoveEprocessCol() + { + if (eprocessindex != -1) + { + listProcess.Colunms.Remove(listProcess.Colunms[eprocessindex]); + eprocessindex = -1; + } + } + private void ProcessListRefeshPidTree() + { + //Refesh Pid tree + foreach (PsItem p in loadedPs) + { + p.parent = null; + p.childs.Clear(); + } + foreach (PsItem p in loadedPs) + { + PsItem parent = ProcessListFindPsItem(p.ppid); + if (parent != null) + { + p.parent = parent; + parent.childs.Add(p); + } + else if (p.parent != null) + { + if (p.parent.childs.Contains(p)) + p.parent.childs.Remove(p); + p.parent = null; + } + } + } + public void ProcessListForceRefeshAll(bool refeshStaticValues = false) + { + if (isGlobalRefeshing) + { + isGlobalRefeshingAll = true; + return; + } + //强制刷新所有的æ¡ç›® + foreach (PsItem p in loadedPs) + { + TaskMgrListItem li = p.item; + if (li.Type == TaskMgrListItemType.ItemUWPHost) + { + ProcessListUpdate(p.pid, false, li, -1); + if (refeshStaticValues) + { + foreach (TaskMgrListItem ix in li.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + ProcessListLoadStaticValues(ix.PID, ix, ((PsItem)ix.Tag)); + } + } + else + { + if (refeshStaticValues && li.Type == TaskMgrListItemType.ItemProcess) + ProcessListLoadStaticValues(p.pid, li, p); + else if (refeshStaticValues && li.Type == TaskMgrListItemType.ItemProcessHost) + { + foreach (TaskMgrListItem ix in li.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + ProcessListLoadStaticValues(ix.PID, ix, ((PsItem)ix.Tag)); + } + ProcessListUpdate(p.pid, false, li, -1); + } + } + } + private void ProcessListForceRefeshAllUWP() + { + for (int i = 0; i < listProcess.Items.Count; i++) + { + if (listProcess.Items[i].Type == TaskMgrListItemType.ItemUWPHost) + ProcessListUpdate(listProcess.Items[i].PID, false, listProcess.Items[i], -1); + } + } + + private void ProcessListLoad(uint pid, uint ppid, string exename, string exefullpath, IntPtr hprocess, IntPtr processItem) + { + //PsItem oldps = ProcessListFindPsItem(pid); + //if (oldps != null) + // Log("ProcessListLoad for a alreday contains item : " + oldps); + + bool need_add_tolist = true; + //base + PsItem p = new PsItem(); + p.processItem = processItem; + p.pid = pid; + p.ppid = ppid; + loadedPs.Add(p); + + PsItem parentpsItem = null; + if (ProcessListIsProcessLoaded(p.ppid, out parentpsItem)) + { + p.parent = parentpsItem; + parentpsItem.childs.Add(p); + } + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(exefullpath); + + bool isw = false; + PEOCESSKINFO infoStruct = new PEOCESSKINFO(); + if (FormMain.IsKernelLoaded) + { + if (MGetProcessEprocess(pid, ref infoStruct)) + { + if (string.IsNullOrEmpty(exefullpath)) + { + exefullpath = infoStruct.ImageFullName; + stringBuilder.Append(exefullpath); + } + } + } + + TaskMgrListItem taskMgrListItem; + if (pid == 0) + { + isw = true; + taskMgrListItem = new TaskMgrListItem(LanuageFBuffers.Str_IdleProcess); + stringBuilder.Append(LanuageFBuffers.Str_IdleProcessDsb); + } + else if (pid == 2) + { + isw = true; + exename = LanuageFBuffers.Str_SystemInterrupts; + taskMgrListItem = new TaskMgrListItem(LanuageFBuffers.Str_SystemInterrupts); + stringBuilder.Append(LanuageFBuffers.Str_InterruptsProcessDsb); + } + else if (pid == 4) + { + isw = true; + taskMgrListItem = new TaskMgrListItem("System"); + stringBuilder.Append(ntoskrnlPath); + } + else if (pid == 88 && exename == "Registry") { isw = true; taskMgrListItem = new TaskMgrListItem("Registry"); stringBuilder.Append(ntoskrnlPath); } + else if (pid < 1024 && hprocess == Nullptr && exename == "csrss.exe") + { + isw = true; + taskMgrListItem = new TaskMgrListItem("Client Server Runtime Process"); + stringBuilder.Append(csrssPath); + } + else if (exename == "Memory Compression") { isw = true; taskMgrListItem = new TaskMgrListItem("Memory Compression"); stringBuilder.Append(ntoskrnlPath); } + else if (stringBuilder.ToString() != "") + { + StringBuilder exeDescribe = new StringBuilder(256); + + if (MGetExeDescribe(stringBuilder.ToString(), exeDescribe, 256)) + { + string exeDescribeStr = exeDescribe.ToString(); + exeDescribeStr = exeDescribeStr.Trim(); + if (exeDescribeStr != "") + taskMgrListItem = new TaskMgrListItem(exeDescribeStr); + else taskMgrListItem = new TaskMgrListItem(exename); + } + else taskMgrListItem = new TaskMgrListItem(exename); + } + else taskMgrListItem = new TaskMgrListItem(exename); + //test is 32 bit app in 64os + if (FormMain.Is64OS) + { + if (hprocess != IntPtr.Zero) + { + if (MGetProcessIs32Bit(hprocess)) + taskMgrListItem.Text = taskMgrListItem.Text + " (" + LanuageFBuffers.Str_Process32Bit + ")"; + } + } + + p.item = taskMgrListItem; + p.handle = hprocess; + p.exename = exename; + p.pid = pid; + p.exepath = stringBuilder.ToString(); + p.isWindowsProcess = isw || IsWindowsProcess(exefullpath); + + StringBuilder stringBuilderUserName = new StringBuilder(260); + if (MGetProcessUserName(p.handle, stringBuilderUserName, 260)) + p.username = stringBuilderUserName.ToString(); + + taskMgrListItem.Type = TaskMgrListItemType.ItemProcess; + taskMgrListItem.IsFullData = true; + + //Test service + bool isSvcHoct = false; + if (exefullpath != null && (exefullpath.ToLower() == svchostPath || exefullpath.ToLower() == svchostPathwow) || exename == "svchost.exe") + { + //svchost.exe add a icon + taskMgrListItem.Icon = PCMgr.Properties.Resources.icoServiceHost; + isSvcHoct = true; + } + else + { + //get pe icon + IntPtr intPtr = MGetExeIcon(stringBuilder.ToString()); + if (intPtr != IntPtr.Zero) taskMgrListItem.Icon = Icon.FromHandle(intPtr); + } + + //try get service info + if (mainPageScMgr.ScCanUse && mainPageScMgr.ScValidPid.Contains(pid)) + { + //find sc item + if (mainPageScMgr.ScMgrFindRunSc(p)) + { + if (isSvcHoct) + { + if (p.svcs.Count == 1) + { + if (!string.IsNullOrEmpty(p.svcs[0].groupName)) + taskMgrListItem.Text = LanuageFBuffers.Str_ServiceHost + " : " + p.svcs[0].scName + " (" + mainPageScMgr.ScGroupNameToFriendlyName(p.svcs[0].groupName) + ")"; + else taskMgrListItem.Text = LanuageFBuffers.Str_ServiceHost + " : " + p.svcs[0].scName; + } + else + { + if (!string.IsNullOrEmpty(p.svcs[0].groupName)) + taskMgrListItem.Text = LanuageFBuffers.Str_ServiceHost + " : " + mainPageScMgr.ScGroupNameToFriendlyName(p.svcs[0].groupName) + "(" + p.svcs.Count + ")"; + else taskMgrListItem.Text = LanuageFBuffers.Str_ServiceHost + " (" + p.svcs.Count + ")"; + } + } + TaskMgrListItemChild tx = null; + for (int i = 0; i < p.svcs.Count; i++) + { + tx = new TaskMgrListItemChild(p.svcs[i].scDsb, mainPageScMgr.IcoSc); + tx.Tag = p.svcs[i].scName; + tx.Type = TaskMgrListItemType.ItemService; + taskMgrListItem.Childs.Add(tx); + } + p.isSvchost = true; + } + } + + // if (pid == 6064) + // ; + //if ((exefullpath != null && exefullpath.ToLower() == @"‪c:\windows\explorer.exe") + // || (exename != null && exename.ToLower() == @"‪explorer.exe")) + // explorerPid = pid; + + //ps data item + if (SysVer.IsWin8Upper()) + p.isUWP = hprocess == IntPtr.Zero ? false : MGetProcessIsUWP(hprocess); + + taskMgrListItem.Tag = p; + + //13 empty item + for (int i = 0; i < 13; i++) taskMgrListItem.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + + //UWP app + + UwpHostItem hostitem = null; + if (p.isUWP) + { + taskMgrListItem.IsUWP = true; + if (stateindex != -1) + { + taskMgrListItem.DrawUWPPausedGray = true; + taskMgrListItem.SubItems[stateindex].DrawUWPPausedIcon = true; + } + if (mainPageUwpMgr.Inited) + { + //get fullname + int len = 0; + if (!MGetUWPPackageFullName(hprocess, ref len, null)) + goto OUT; + StringBuilder b = new StringBuilder(len); + if (!MGetUWPPackageFullName(hprocess, ref len, b)) + goto OUT; + p.uwpFullName = b.ToString(); + if (p.uwpFullName == "") + goto OUT; + TaskMgrListItem uapp = mainPageUwpMgr.UWPListFindItem(p.uwpFullName); + if (uapp == null) + goto OUT; + //copy data form uwp app list + if (companyindex != -1) + taskMgrListItem.SubItems[companyindex].Text = taskMgrListItem.SubItems[1].Text; + taskMgrListItem.IsUWPICO = true; + taskMgrListItem.IsFullData = true; + taskMgrListItem.Type = TaskMgrListItemType.ItemUWPProcess; + taskMgrListItem.IsChildItem = true; + + UwpItem parentItem = ProcessListFindUWPItem(p.uwpFullName); + if (parentItem != null) + { + //Fill this item to parent item + TaskMgrListItemGroup g = parentItem.uwpItem; + g.Icon = uapp.Icon; + g.Image = uapp.Image; + g.Type = TaskMgrListItemType.ItemUWPHost; + g.Childs.Add(taskMgrListItem); + g.Text = uapp.Text; + g.DisplayChildCount = g.Childs.Count > 1; + p.uwpItem = parentItem; + + if (ProcessListFindUWPItemWithHostId(p.pid) == null) + uwpHostPid.Add(new UwpHostItem(parentItem, p.pid)); + + need_add_tolist = false; + } + else + { + //create new uwp item and add this to parent item + parentItem = new UwpItem(); + + TaskMgrListItemGroup g = new TaskMgrListItemGroup(uapp.Text); + UWP_PACKAGE_INFO pkg = (UWP_PACKAGE_INFO)uapp.Tag; + + g.Icon = uapp.Icon; + g.Image = uapp.Image; + g.Childs.Add(taskMgrListItem); + g.Type = TaskMgrListItemType.ItemUWPHost; + g.Group = listProcess.Groups[1]; + g.IsUWPICO = true; + + g.PID = (uint)1; + //10 empty item + for (int i = 0; i < 13; i++) g.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem() { Font = listProcess.Font }); + if (stateindex != -1) + { + g.SubItems[stateindex].DrawUWPPausedIcon = true; + } + if (nameindex != -1) g.SubItems[nameindex].Text = p.uwpFullName; + if (pathindex != -1) g.SubItems[pathindex].Text = uapp.SubItems[3].Text; + + g.Tag = parentItem; + + parentItem.uwpMainAppDebText = pkg.DisplayName; + parentItem.uwpInstallDir = pkg.InstallPath; + parentItem.uwpFullName = p.uwpFullName; + parentItem.uwpItem = g; + p.uwpItem = parentItem; + + if (ProcessListFindUWPItemWithHostId(p.pid) == null) uwpHostPid.Add(new UwpHostItem(parentItem, p.pid)); + + uwps.Add(parentItem); + listProcess.Items.Add(g); + need_add_tolist = false; + } + + p.uwpRealApp = p.exepath.Contains(parentItem.uwpInstallDir); + + //For Icon + if (p.exepath != "" && p.uwpRealApp) + taskMgrListItem.Icon = uapp.Icon; + else taskMgrListItem.IsUWPICO = false; + + if (p.uwpRealApp) + taskMgrListItem.Text = uapp.Text; + } + } + OUT: + if (need_add_tolist) + { + hostitem = ProcessListFindUWPItemWithHostId(ppid); + //UWP app childs + if (hostitem != null) + { + hostitem.item.uwpItem.Childs.Add(taskMgrListItem); + need_add_tolist = false; + } + } + + //data items + ProcessListLoadStaticValues(pid, taskMgrListItem, p); + + //Init performance + + for (int i = 1; i < taskMgrListItem.SubItems.Count; i++) + taskMgrListItem.SubItems[i].Font = smallListFont; + + thisLoadItem = taskMgrListItem; + MAppVProcessAllWindowsGetProcessWindow(pid); + thisLoadItem = null; + + if (taskMgrListItem.Childs.Count > 0) + taskMgrListItem.Group = listProcess.Groups[0]; + else if (p.isWindowsProcess) + taskMgrListItem.Group = listProcess.Groups[2]; + else taskMgrListItem.Group = listProcess.Groups[1]; + + taskMgrListItem.PID = pid; + if (need_add_tolist) listProcess.Items.Add(taskMgrListItem); + + ProcessListUpdate(pid, true, taskMgrListItem); + } + private void ProcessListLoadStaticValues(uint pid, TaskMgrListItem it, PsItem p) + { + if (nameindex != -1) + { + if (pid == 0) it.SubItems[nameindex].Text = LanuageFBuffers.Str_IdleProcess; + else if (pid == 4) it.SubItems[nameindex].Text = "ntoskrnl.exe"; + else it.SubItems[nameindex].Text = p.exename; + } + if (pidindex != -1) + { + if (pid == 2) + it.SubItems[pidindex].Text = "-"; + else it.SubItems[pidindex].Text = pid.ToString(); + } + if (pathindex != -1) if (p.exepath != "") it.SubItems[pathindex].Text = p.exepath; + if (cmdindex != -1 && p.handle != Nullptr) + { + StringBuilder s = new StringBuilder(1024); + if (MGetProcessCommandLine(p.handle, s, 1024, pid)) + it.SubItems[cmdindex].Text = s.ToString(); + } + if (companyindex != -1) + { + if (p.exepath != "") + { + StringBuilder exeCompany = new StringBuilder(256); + if (MGetExeCompany(p.exepath, exeCompany, 256)) + it.SubItems[companyindex].Text = exeCompany.ToString(); + } + } + } + private void ProcessListUpdate(uint pid, bool isload, TaskMgrListItem it, int ipdateOneDataCloum = -1, bool forceProcessHost = false) + { + if (!forceProcessHost && (it.Type == TaskMgrListItemType.ItemUWPHost || it.Type == TaskMgrListItemType.ItemProcessHost)) + { + //Group uppdate + ProcessListUpdate_GroupChilds(isload, it, ipdateOneDataCloum); + + if (it.Type == TaskMgrListItemType.ItemUWPHost) + { + bool ispause = false; + bool running = ProcessListGetUwpIsRunning(it, out ((UwpItem)it.Tag).firstHwnd); + if (it.Childs.Count > 0) + { + foreach (TaskMgrListItem ix in it.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + { + if (((PsItem)ix.Tag).isPaused) + { + ispause = true; + break; + } + } + if (stateindex != -1 && stateindex != ipdateOneDataCloum) + it.SubItems[stateindex].Text = ispause ? LanuageFBuffers.Str_StatusPaused : ""; + it.DrawUWPPaused = ispause; + if (ispause && running) + running = MAppWorkCall3(161, ((UwpItem)it.Tag).firstHwnd) == 1; + } + it.Group = running ? listProcess.Groups[0] : listProcess.Groups[1]; + } + else if (it.Type == TaskMgrListItemType.ItemProcessHost) + { + ProcessListUpdate_State(pid, it, (PsItem)it.Tag); + ProcessListUpdate_WindowsAndGroup(pid, it, ((PsItem)it.Tag), isload); + } + + //Performance + + if (cpuindex != -1 && ipdateOneDataCloum != cpuindex) + { + double d = 0; int datacount = 0; + foreach (TaskMgrListItem ix in it.Childs) + { + if (ix.Type == TaskMgrListItemType.ItemProcess) + { + d += ix.SubItems[cpuindex].CustomData; + datacount++; + } + } + double ii2 = d; + it.SubItems[cpuindex].Text = ii2.ToString("0.0") + "%"; + it.SubItems[cpuindex].BackColor = ProcessListGetColorFormValue(ii2, 100); + it.SubItems[cpuindex].CustomData = ii2; + } + if (ramindex != -1 && ipdateOneDataCloum != ramindex) + { + double d = 0; + foreach (TaskMgrListItem ix in it.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + d += ix.SubItems[ramindex].CustomData; + it.SubItems[ramindex].Text = FormatFileSizeMen(Convert.ToInt64(d * 1024)); + it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(d / 1024, maxMem); + it.SubItems[ramindex].CustomData = d; + } + if (diskindex != -1 && ipdateOneDataCloum != diskindex) + { + double d = 0; + foreach (TaskMgrListItem ix in it.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + d += ix.SubItems[diskindex].CustomData; + if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_DISK) d = 0.1; + else if (d < PERF_LIMIT_MIN_DATA_DISK) d = 0; + if (d != 0) + { + it.SubItems[diskindex].Text = d.ToString("0.0") + " MB/" + LanuageFBuffers.Str_Second; + it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(d, 1024); + it.SubItems[diskindex].CustomData = d; + } + else + { + it.SubItems[diskindex].Text = "0 MB/" + LanuageFBuffers.Str_Second; + it.SubItems[diskindex].BackColor = dataGridZeroColor; + it.SubItems[diskindex].CustomData = 0; + } + } + if (netindex != -1 && ipdateOneDataCloum != netindex) + { + double d = 0; + foreach (TaskMgrListItem ix in it.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + d += ix.SubItems[netindex].CustomData; + if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_NETWORK) d = 0.1; else if (d < PERF_LIMIT_MIN_DATA_NETWORK) d = 0; + if (d != 0) + { + it.SubItems[netindex].Text = d.ToString("0.0") + " Mbps"; + it.SubItems[netindex].CustomData = d; + it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(d, 16); + } + else + { + it.SubItems[netindex].Text = "0 Mbps"; + it.SubItems[netindex].CustomData = 0; + it.SubItems[netindex].BackColor = dataGridZeroColor; + } + } + } + else + { + PsItem p = ((PsItem)it.Tag); + + ProcessListUpdate_WindowsAndGroup(pid, it, p, isload); + + if (stateindex != -1) + { + if (ipdateOneDataCloum != stateindex) + ProcessListUpdate_State(pid, it, p); + } + else ProcessListUpdate_State(pid, it, p); + if (cpuindex != -1 && ipdateOneDataCloum != cpuindex) ProcessListUpdatePerf_Cpu(pid, it, p); + if (ramindex != -1 && ipdateOneDataCloum != ramindex) ProcessListUpdatePerf_Ram(pid, it, p); + if (diskindex != -1 && ipdateOneDataCloum != diskindex) ProcessListUpdatePerf_Disk(pid, it, p); + if (netindex != -1 && ipdateOneDataCloum != netindex) ProcessListUpdatePerf_Net(pid, it, p); + } + } + private void ProcessListUpdateOnePerfCloum(uint pid, TaskMgrListItem it, int ipdateOneDataCloum, bool forceProcessHost = false) + { + if (!forceProcessHost && (it.Type == TaskMgrListItemType.ItemUWPHost || it.Type == TaskMgrListItemType.ItemProcessHost)) + { + TaskMgrListItem ii = it as TaskMgrListItem; + if (stateindex != -1 && ipdateOneDataCloum == stateindex) + { + bool ispause = false; + + if (stateindex != -1 && ipdateOneDataCloum == stateindex && it.Childs.Count > 0) + { + foreach (TaskMgrListItem ix in it.Childs) + if (ix.Type == TaskMgrListItemType.ItemProcess) + { + PsItem p = ((PsItem)ix.Tag); + ProcessListUpdate_State(ix.PID, ix, p); + if (ix.SubItems[stateindex].Text == LanuageFBuffers.Str_StatusPaused) + { + ispause = true; + break; + } + } + it.SubItems[stateindex].Text = ispause ? LanuageFBuffers.Str_StatusPaused : ""; + } + if (it.Type == TaskMgrListItemType.ItemUWPHost) + { + bool running = ProcessListGetUwpIsRunning(it, out ((UwpItem)it.Tag).firstHwnd); + if (ispause && running) + running = MAppWorkCall3(161, ((UwpItem)it.Tag).firstHwnd) == 1; + it.Group = running ? listProcess.Groups[0] : listProcess.Groups[1]; + } + } + if (ipdateOneDataCloum > -1) + { + double d = 0; int datacount = 0; + foreach (TaskMgrListItem ix in ii.Childs) + { + if (ix.Type == TaskMgrListItemType.ItemProcess) + { + ProcessListUpdateOnePerfCloum(ix.PID, ix, ipdateOneDataCloum); + d += ix.SubItems[ipdateOneDataCloum].CustomData; + datacount++; + } + } + + //Performance + if (cpuindex != -1 && ipdateOneDataCloum == cpuindex) + { + double ii2 = d;// (d / datacount); + it.SubItems[cpuindex].Text = ii2.ToString("0.0") + "%"; + it.SubItems[cpuindex].BackColor = ProcessListGetColorFormValue(ii2, 100); + it.SubItems[cpuindex].CustomData = ii2; + } + else if (ramindex != -1 && ipdateOneDataCloum == ramindex) + { + it.SubItems[ramindex].Text = FormatFileSizeMen(Convert.ToInt64(d * 1024)); + it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(d / 1024, maxMem); + it.SubItems[ramindex].CustomData = d; + } + else if (diskindex != -1 && ipdateOneDataCloum == diskindex) + { + if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_DISK) d = 0.1; + else if (d < PERF_LIMIT_MIN_DATA_DISK) d = 0; + if (d != 0) + { + it.SubItems[diskindex].Text = d.ToString("0.0") + " MB/" + LanuageFBuffers.Str_Second; + it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(d, 1024); + it.SubItems[diskindex].CustomData = d; + return; + } + it.SubItems[netindex].Text = "0 MB/" + LanuageFBuffers.Str_Second; + it.SubItems[netindex].CustomData = 0; + it.SubItems[netindex].BackColor = dataGridZeroColor; + } + else if (netindex != -1 && ipdateOneDataCloum == netindex) + { + if (d < 0.1 && d >= PERF_LIMIT_MIN_DATA_NETWORK) d = 0.1; else if (d < PERF_LIMIT_MIN_DATA_NETWORK) d = 0; + if (d != 0) + { + it.SubItems[netindex].Text = d.ToString("0.0") + " Mbps"; + it.SubItems[netindex].CustomData = d; + it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(d, 16); + return; + } + it.SubItems[netindex].Text = "0 Mbps"; + it.SubItems[netindex].CustomData = 0; + it.SubItems[netindex].BackColor = dataGridZeroColor; + } + } + } + else + { + PsItem p = ((PsItem)it.Tag); + if (stateindex != -1 && ipdateOneDataCloum == stateindex) ProcessListUpdate_State(pid, it, p); + + if (cpuindex != -1 && ipdateOneDataCloum == cpuindex) ProcessListUpdatePerf_Cpu(pid, it, p); + if (ramindex != -1 && ipdateOneDataCloum == ramindex) ProcessListUpdatePerf_Ram(pid, it, p); + if (diskindex != -1 && ipdateOneDataCloum == diskindex) ProcessListUpdatePerf_Disk(pid, it, p); + if (netindex != -1 && ipdateOneDataCloum == netindex) ProcessListUpdatePerf_Net(pid, it, p); + } + } + + private void ProcessListUpdateValues(int refeshAllDataColum) + { + //update process perf data + + if (!FormMain.IsSimpleView) + { + if (refeshAllDataColum != -1) + foreach (PsItem p in loadedPs) + ProcessListUpdateOnePerfCloum(p.pid, p.item, refeshAllDataColum); + + for (int i = listProcess.ShowedItems.Count - 1; i < listProcess.ShowedItems.Count && i >= 0; i--) + { + if (listProcess.ShowedItems[i].Parent != null) continue; + //åªåˆ·æ–°æ˜¾ç¤ºçš„æ¡ç›® + if (listProcess.ShowedItems[i].Type == TaskMgrListItemType.ItemUWPHost) + ProcessListUpdate(listProcess.ShowedItems[i].PID, false, listProcess.ShowedItems[i], refeshAllDataColum); + else ProcessListUpdate(listProcess.ShowedItems[i].PID, false, listProcess.ShowedItems[i], refeshAllDataColum); + } + } + } + + //Child & Group + private int ProcessListUpdate_ChildItemsAdd(TaskMgrListItem it, PsItem p) + { + int allCount = 0; + //递归添加所有å­è¿›ç¨‹ + foreach (PsItem child in p.childs) + { + if (!child.isWindowShow) + { + allCount++; + + if (listProcess.Items.Contains(child.item)) + listProcess.Items.Remove(child.item); + else if (child.item.Parent != null) + child.item.Parent.Childs.Remove(child.item); + + if (!it.Childs.Contains(child.item)) + it.Childs.Add(child.item); + + if (child.childs.Count > 0) + allCount += ProcessListUpdate_ChildItemsAdd(it, child); + } + else + { + if (it.Childs.Contains(child.item)) + it.Childs.Remove(child.item); + else if (child.item.Parent != null) + child.item.Parent.Childs.Remove(child.item); + + if (!listProcess.Items.Contains(child.item)) + listProcess.Items.Add(child.item); + } + } + return allCount; + } + private void ProcessListUpdate_ChildItems(uint pid, TaskMgrListItem it, PsItem p) + { + if (p.isWindowShow && p.childs.Count > 0 && !IsExplorer(p) && !it.IsCloneItem) + { + if (it.Type != TaskMgrListItemType.ItemProcessHost) + { + it.Type = TaskMgrListItemType.ItemProcessHost; + + //Clone a child item + TaskMgrListItem cloneItem = new TaskMgrListItem(); + cloneItem.Text = it.Text; + cloneItem.PID = it.PID; + cloneItem.Type = TaskMgrListItemType.ItemProcess; + cloneItem.Tag = p; + cloneItem.DisplayChildCount = false; + cloneItem.DisplayChildValue = 0; + cloneItem.IsCloneItem = true; cloneItem.IsFullData = true; + cloneItem.Icon = it.Icon; cloneItem.Image = it.Image; + //Copy 13 empty item + for (int i = 0; i < 13; i++) + { + cloneItem.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + cloneItem.SubItems[i].Text = it.SubItems[i].Text; + cloneItem.SubItems[i].Font = it.SubItems[i].Font; + } + //Make it hight light + cloneItem.SubItems[0].ForeColor = Color.FromArgb(0x11, 0x66, 0x00); + if (pidindex != -1) + it.SubItems[pidindex].Text = ""; + it.Childs.Add(cloneItem); + } + + it.DisplayChildCount = true; + it.DisplayChildValue = ProcessListUpdate_ChildItemsAdd(it, p) + 1; + + if (it.DisplayChildValue == 1) + { + if (!ProcessListUpdate_GroupChildsIsValid(it)) + { + it.Type = TaskMgrListItemType.ItemProcess; + it.DisplayChildCount = false; + ProcessListUpdate_BreakProcHost(it, true); + } + } + } + else + { + if (it.Type != TaskMgrListItemType.ItemProcess) + it.Type = TaskMgrListItemType.ItemProcess; + + it.DisplayChildCount = false; + + if (it.Childs.Count > 0) + ProcessListUpdate_BreakProcHost(it, true); + } + } + private void ProcessListUpdate_GroupChilds(bool isload, TaskMgrListItem ii, int ipdateOneDataCloum = -1) + { + for (int i = ii.Childs.Count - 1; i >= 0; i--) + { + TaskMgrListItem li = ii.Childs[i]; + if (li.Type == TaskMgrListItemType.ItemProcess) + ProcessListUpdate(li.PID, isload, li, ipdateOneDataCloum); + } + } + private bool ProcessListUpdate_GroupChildsIsValid(TaskMgrListItem it) + { + bool findCloneItem = false, findRealItem = false; + if (it.Childs.Count > 0) + { + + for (int i = it.Childs.Count - 1; i >= 0; i--) + { + TaskMgrListItem lics = it.Childs[i]; + if (lics.Type == TaskMgrListItemType.ItemProcess) + { + if (lics.IsCloneItem) findCloneItem = true; + else findRealItem = true; + if (findCloneItem && findRealItem) + return true; + } + } + } + return findCloneItem && findRealItem; + } + + //All runtime data + private void ProcessListUpdate_WindowsAndGroup(uint pid, TaskMgrListItem it, PsItem p, bool isload) + { + if (pid > 4) + { + //Child and group + if (!p.isSvchost) + { + //remove invalid windows + for (int i = it.Childs.Count - 1; i >= 0; i--) + { + if (it.Childs[i].Type == TaskMgrListItemType.ItemWindow) + { + IntPtr h = (IntPtr)it.Childs[i].Tag; + if (!IsWindow(h) || !IsWindowVisible(h)) + it.Childs.Remove(it.Childs[i]); + } + } + if (!isload) + { + //update window + thisLoadItem = it; + MAppVProcessAllWindowsGetProcessWindow(pid); + thisLoadItem = null; + + IntPtr firstWindow = IntPtr.Zero; + int windowCount = 0; + for (int i = it.Childs.Count - 1; i >= 0; i--) + { + if (it.Childs[i].Type == TaskMgrListItemType.ItemWindow) + { + if (firstWindow == IntPtr.Zero) firstWindow = (IntPtr)it.Childs[i].Tag; + windowCount++; + } + } + //group + if (windowCount > 0) + { + p.isWindowShow = true; + if (it.Group != listProcess.Groups[0]) + it.Group = listProcess.Groups[0]; + ProcessListUpdate_ChildItems(pid, it, p); + if (windowCount == 1) + p.firstHwnd = firstWindow; + else p.firstHwnd = IntPtr.Zero; + } + else + { + p.firstHwnd = IntPtr.Zero; + + bool needBreak = false; + + if (p.isWindowsProcess) + { + if (it.Group != listProcess.Groups[2]) + { + if (typeindex != -1) + it.SubItems[typeindex].Text = listProcess.Groups[2].Header; + it.Group = listProcess.Groups[2]; + needBreak = true; + } + p.isWindowShow = false; + } + else + { + if (it.Group != listProcess.Groups[1]) + { + if (typeindex != -1) + it.SubItems[typeindex].Text = listProcess.Groups[1].Header; + it.Group = listProcess.Groups[1]; + needBreak = true; + } + p.isWindowShow = false; + } + + if (needBreak && it.Childs.Count > 0) + ProcessListUpdate_BreakProcHost(it); + } + } + } + else + { + if (isload) + { + p.isWindowShow = false; + it.Group = listProcess.Groups[p.isWindowsProcess ? 2 : 1]; + if (typeindex != -1) + it.SubItems[typeindex].Text = it.Group.Header; + } + } + } + } + private void ProcessListUpdate_State(uint pid, TaskMgrListItem it, PsItem p) + { + int i = MGetProcessState(p.processItem, IntPtr.Zero); + if (i == 1) + { + p.isPaused = false; + if (stateindex != -1) it.SubItems[stateindex].Text = ""; + if (p.isSvchost == false && it.Childs.Count > 0) + { + bool hung = false; + foreach (TaskMgrListItem c in it.Childs) + if (c.Type == TaskMgrListItemType.ItemWindow) + if (IsHungAppWindow((IntPtr)c.Tag)) + { + hung = true; + break; + } + p.isHung = hung; + if (hung) + { + if (stateindex != -1) + { + it.SubItems[stateindex].Text = LanuageFBuffers.Str_StatusHung; + it.SubItems[stateindex].ForeColor = Color.FromArgb(219, 107, 58); + } + } + } + else p.isHung = false; + } + else if (i == 2) + { + p.isPaused = true; + if (stateindex != -1) + { + it.SubItems[stateindex].Text = LanuageFBuffers.Str_StatusPaused; + it.SubItems[stateindex].ForeColor = Color.FromArgb(22, 158, 250); + } + } + else if (i == -1)//A bug + { + if (loadedPs.Contains(p)) loadedPs.Remove(p); + if (listProcess.Items.Contains(it)) listProcess.Items.Remove(it); + return; + } + else p.isPaused = false; + + if (p.isUWP && it.Parent != null) + it.DrawUWPPaused = p.isPaused; + else it.DrawUWPPaused = false; + } + private void ProcessListUpdatePerf_Cpu(uint pid, TaskMgrListItem it, PsItem p) + { + if (pid != 0 && p.processItem != IntPtr.Zero) + { + + double ii = MProcessPerformanctMonitor.GetProcessCpuUseAge(p.processItem); + it.SubItems[cpuindex].Text = ii.ToString("0.0") + "%"; + it.SubItems[cpuindex].BackColor = ProcessListGetColorFormValue(ii, 100); + it.SubItems[cpuindex].CustomData = ii; + } + else + { + it.SubItems[cpuindex].Text = "0.0%"; + it.SubItems[cpuindex].BackColor = dataGridZeroColor; + it.SubItems[cpuindex].CustomData = 0; + } + } + private void ProcessListUpdatePerf_Ram(uint pid, TaskMgrListItem it, PsItem p) + { + if (p.isUWP && p.isPaused) + { + it.SubItems[ramindex].Text = "0.1 MB"; + it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(0.1, 1024); + it.SubItems[ramindex].CustomData = 1; + } + else if (pid == 2) + { + it.SubItems[ramindex].Text = "0.0 MB"; + it.SubItems[ramindex].BackColor = dataGridZeroColor; + it.SubItems[ramindex].CustomData = 1; + } + else if (pid == 4 || pid == 0) + { + it.SubItems[ramindex].Text = "0.1 MB"; + it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(0.1, 1024); + it.SubItems[ramindex].CustomData = 1; + } + else if (p.processItem != IntPtr.Zero) + { + uint ii = MProcessPerformanctMonitor.GetProcessPrivateWoringSet(p.processItem); + it.SubItems[ramindex].Text = FormatFileSizeMen(Convert.ToInt64(ii)); + it.SubItems[ramindex].BackColor = ProcessListGetColorFormValue(ii / 1048576, maxMem); + it.SubItems[ramindex].CustomData = ii / 1024d; + } + } + private void ProcessListUpdatePerf_Disk(uint pid, TaskMgrListItem it, PsItem p) + { + if (p.processItem != IntPtr.Zero && p.pid != 2) + { + ulong disk = MProcessPerformanctMonitor.GetProcessIOSpeed(p.processItem); + double val = (disk / 1048576d); + if (val < 0.1 && val >= PERF_LIMIT_MIN_DATA_DISK) + { + it.SubItems[diskindex].Text = "0.1 MB/" + LanuageFBuffers.Str_Second; + it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(val, 128); + it.SubItems[diskindex].CustomData = val; + } + else if (val < PERF_LIMIT_MIN_DATA_DISK) val = 0; + else if (val != 0) + { + it.SubItems[diskindex].Text = val.ToString("0.0") + " MB/" + LanuageFBuffers.Str_Second; + it.SubItems[diskindex].BackColor = ProcessListGetColorFormValue(val, 128); + it.SubItems[diskindex].CustomData = val; + return; + } + } + + it.SubItems[diskindex].Text = "0 MB/" + LanuageFBuffers.Str_Second; + it.SubItems[diskindex].BackColor = dataGridZeroColor; + it.SubItems[diskindex].CustomData = 0; + } + private void ProcessListUpdatePerf_Net(uint pid, TaskMgrListItem it, PsItem p) + { + //if (p.updateLock) { p.updateLock = false; return; } + if (pid > 4 && MPERF_NET_IsProcessInNet(pid)) + { + double allMBytesPerSec = MProcessPerformanctMonitor.GetProcessNetworkSpeed(p.processItem) / 1048576d; + + if (allMBytesPerSec < 0.1 && allMBytesPerSec >= PERF_LIMIT_MIN_DATA_NETWORK) allMBytesPerSec = 0.1; + else if (allMBytesPerSec < PERF_LIMIT_MIN_DATA_NETWORK) + { + it.SubItems[netindex].Text = "0.1 Mbps"; + it.SubItems[netindex].CustomData = allMBytesPerSec; + it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(allMBytesPerSec, 16); + } + else if (allMBytesPerSec != 0) + { + it.SubItems[netindex].Text = allMBytesPerSec.ToString("0.0") + " Mbps"; + it.SubItems[netindex].CustomData = allMBytesPerSec; + it.SubItems[netindex].BackColor = ProcessListGetColorFormValue(allMBytesPerSec, 16); + return; + } + } + + it.SubItems[netindex].Text = "0 Mbps"; + it.SubItems[netindex].CustomData = 0; + it.SubItems[netindex].BackColor = dataGridZeroColor; + } + private void ProcessListUpdate_BreakProcHost(TaskMgrListItem it, bool doNotClearall = false) + { + if (it.Childs.Count > 0) + { + for (int i = it.Childs.Count - 1; i >= 0; i--) + { + TaskMgrListItem lics = it.Childs[i]; + if (lics.Type == TaskMgrListItemType.ItemProcess) + { + if (lics.IsCloneItem == false) listProcess.Items.Add(lics); + if (doNotClearall) it.Childs.Remove(lics); + } + } + if (!doNotClearall) it.Childs.Clear(); + } + if (pidindex != -1) it.SubItems[pidindex].Text = it.PID.ToString(); + } + + //Delete + private void ProcessListFree(PsItem it) + { + //remove invalid item + //MAppWorkCall3(174, IntPtr.Zero, new IntPtr(it.pid)); + + UwpHostItem hostitem = ProcessListFindUWPItemWithHostId(it.pid); + if (hostitem != null) uwpHostPid.Remove(hostitem); + if (it.uwpItem != null) + it.uwpItem = null; + + it.svcs.Clear(); + + foreach (PsItem pchid in it.childs) + pchid.parent = null; + it.childs.Clear(); + + if (it.parent != null) + { + it.parent.childs.Remove(it); + it.parent = null; + } + + TaskMgrListItem li = it.item; + if (li == null) li = ProcessListFindItem(it.pid); + if (li != null) + ProcessListRemoveItem(li); + else Log("ProcessListFree for a no host item : " + it); + + loadedPs.Remove(it); + } + public void ProcessListFreeAll() + { + //the exit clear + uwps.Clear(); + uwpHostPid.Clear(); + for (int i = 0; i < loadedPs.Count; i++) + ProcessListFree(loadedPs[i]); + loadedPs.Clear(); + listProcess.Items.Clear(); + + MProcessMonitor.DestroyProcessMonitor(processMonitor); + + ProcessListSaveCols(); + ProcessListSaveSettings(); + ProcessListUnInitPerfs(); + ProcessListSimpleExit(); + } + private void ProcessListRemoveItem(TaskMgrListItem li) + { + //is a group item + if (li.Type == TaskMgrListItemType.ItemUWPHost || li.Type == TaskMgrListItemType.ItemProcessHost) + { + li.Group = listProcess.Groups[1]; + ProcessListUpdate_BreakProcHost(li); + listProcess.Items.Remove(li); + } + else + { + if (li.Parent != null)//is a child item + { + TaskMgrListItem iii = li.Parent; + iii.Childs.Remove(li); + listProcess.Items.Remove(li); + //uwp host item + if (iii.Type == TaskMgrListItemType.ItemUWPHost) + { + if (iii.Childs.Count == 0)//o to remove + { + listProcess.Items.Remove(iii); + UwpItem parentItem = ProcessListFindUWPItem(iii.Tag.ToString()); + if (parentItem != null) + uwps.Remove(parentItem); + } + } + } + else + { + listProcess.Items.Remove(li); + } + } + } + + //CallBacks + private void ProcessListRemoveItemCallBack(uint pid) + { + PsItem oldps = ProcessListFindPsItem(pid); + if (oldps != null) + { + ProcessListFree(oldps); + } + else + { + TaskMgrListItem li = ProcessListFindItem(pid); + if (li != null) ProcessListRemoveItem(li); + else Log("ProcessListRemoveItemCallBack for a not found item : pid " + pid); + } + } + private void ProcessListNewItemCallBack(uint pid, uint parentid, string exename, string exefullpath, IntPtr hProcess, IntPtr processItem) + { + if (!FormMain.IsAdmin && string.IsNullOrEmpty(exefullpath) && pid != 0 && pid != 2 && pid != 4 && pid != 88) + return; + + ProcessListLoad(pid, parentid, exename, exefullpath, hProcess, processItem); + } + + //Operation + public void ProcessListEndTask(uint pid) + { + ProcessListEndTask(pid, null); + } + public void ProcessListSetTo(uint pid) + { + TaskMgrListItem i = ProcessListFindItem(pid); + if (i != null) ProcessListSetTo(i); + } + public void ProcessListKillProcTree(uint pid) + { + PsItem p = ProcessListFindPsItem(pid); + if (p != null) ProcessListKillProcTree(p, true); + } + public void ProcessListKillCurrentUWP() + { + TaskMgrListItem li = listProcess.SelectedItem; + if (li != null) ProcessListEndTask(0, li); + } + public void ProcessListEndCurrentApp() + { + TaskMgrListItem li = listApps.SelectedItem; + if (li == null) return; + ProcessListEndTask(0, li); + } + public void ProcessListSetToCurrentApp() + { + TaskMgrListItem li = listApps.SelectedItem; + if (li == null) return; + ProcessListSetTo(li); + } + + private void ProcessListEndTask(uint pid, TaskMgrListItem taskMgrListItem) + { + //结æŸä»»åŠ¡ + if (taskMgrListItem == null) taskMgrListItem = ProcessListFindItem(pid); + if (taskMgrListItem != null) + { + if (taskMgrListItem.Type == TaskMgrListItemType.ItemProcessHost) + { + bool ananyrs = false; + PsItem p = taskMgrListItem.Tag as PsItem; + if (p.isWindowShow && !p.isSvchost) + { + if (taskMgrListItem.Childs.Count > 0) + { + IntPtr target = IntPtr.Zero; + for (int i = taskMgrListItem.Childs.Count - 1; i >= 0; i--) + if (taskMgrListItem.Childs[i].Type == TaskMgrListItemType.ItemWindow) + { + target = (IntPtr)taskMgrListItem.Childs[i].Tag; + if (target != IntPtr.Zero) + if (MAppWorkCall3(192, IntPtr.Zero, target) == 1) + ananyrs = true; + } + } + else ananyrs = true; + } + + if (!ananyrs) + nextKillItem = taskMgrListItem; + else + { + foreach (TaskMgrListItem lichild in taskMgrListItem.Childs) + { + if (lichild.Type == TaskMgrListItemType.ItemProcess) + if (!MKillProcessUser2(lichild.PID, false, true)) + break; + } + MKillProcessUser2(taskMgrListItem.PID, true, true); + } + } + else if (taskMgrListItem.Type == TaskMgrListItemType.ItemUWPHost) + { + bool ananyrs = false; + IntPtr target = ((UwpItem)taskMgrListItem.Tag).firstHwnd; + if (target != Nullptr) + { + if (MAppWorkCall3(192, IntPtr.Zero, target) == 1) + ananyrs = true; + } + if (ananyrs) + { + foreach (TaskMgrListItem lichild in taskMgrListItem.Childs) + { + if (lichild.Type == TaskMgrListItemType.ItemProcess) + MKillProcessUser2(lichild.PID, true, true); + } + } + else nextKillItem = taskMgrListItem; + } + else if (taskMgrListItem.Type == TaskMgrListItemType.ItemProcess) + { + bool ananyrs = false; + PsItem p = taskMgrListItem.Tag as PsItem; + if (p.isWindowShow && !p.isSvchost) + { + if (taskMgrListItem.Childs.Count > 0) + { + IntPtr target = IntPtr.Zero; + for (int i = taskMgrListItem.Childs.Count - 1; i >= 0; i--) + if (taskMgrListItem.Childs[i].Tag != null) + { + target = (IntPtr)taskMgrListItem.Childs[i].Tag; + if (target != IntPtr.Zero) + if (MAppWorkCall3(192, IntPtr.Zero, target) == 1) + ananyrs = true; + } + } + else ananyrs = true; + } + if (ananyrs) MKillProcessUser2(taskMgrListItem.PID, true, false); + } + } + } + private void ProcessListSetTo(TaskMgrListItem taskMgrListItem) + { + //设置到 + if (taskMgrListItem != null) + { + if (taskMgrListItem.Type == TaskMgrListItemType.ItemProcessHost || taskMgrListItem.Type == TaskMgrListItemType.ItemProcess) + { + PsItem p = taskMgrListItem.Tag as PsItem; + if (p.firstHwnd != IntPtr.Zero) MAppWorkCall3(213, p.firstHwnd, p.firstHwnd); + } + else if (taskMgrListItem.Type == TaskMgrListItemType.ItemUWPHost) + { + UwpItem p = taskMgrListItem.Tag as UwpItem; + if (p.firstHwnd != IntPtr.Zero) MAppWorkCall3(213, p.firstHwnd, p.firstHwnd); + } + } + } + private void ProcessListKillProcTree(PsItem p, bool showerr) + { + for (int i = p.childs.Count - 1; i >= 0; i--) + { + PsItem child = ProcessListFindPsItem(p.childs[i].pid); + if (child.childs.Count > 0) + ProcessListKillProcTree(child, false); + MKillProcessUser2(child.pid, showerr, true); + } + } + private void ProcessListKillLastEndItem() + { + if (nextKillItem != null) + { + if (listProcess.Items.Contains(nextKillItem)) + { + if (nextKillItem.Type == TaskMgrListItemType.ItemProcessHost) + { + foreach (TaskMgrListItem lichild in nextKillItem.Childs) + { + if (lichild.Type == TaskMgrListItemType.ItemProcess) + if (!MKillProcessUser2(lichild.PID, false, true)) + break; + } + MKillProcessUser2(nextKillItem.PID, true, true); + } + else if (nextKillItem.Type == TaskMgrListItemType.ItemUWPHost) + { + if (!M_UWP_KillUWPApplication(((UwpItem)nextKillItem.Tag).uwpFullName)) + { + foreach (TaskMgrListItem lichild in nextKillItem.Childs) + { + if (lichild.Type == TaskMgrListItemType.ItemProcess) + if (!MKillProcessUser2(lichild.PID, false, true)) + break; + } + MKillProcessUser2(nextKillItem.PID, true, true); + } + } + } + nextKillItem = null; + } + } + + //Simple List + private void ProcessListSimpleInit() + { + listApps.NoHeader = true; + FormMain.expandFewerDetals.Show(); + FormMain.expandFewerDetals.Expanded = true; + + FormMain.IsSimpleView = GetConfigBool("SimpleView", "AppSetting", true); + } + private void ProcessListSimpleExit() + { + if (FormMain.IsSimpleView) lastSimpleSize = FormMain.Size; + SetConfig("OldSizeSimple", "AppSetting", lastSimpleSize.Width + "-" + lastSimpleSize.Height); + SetConfigBool("SimpleView", "AppSetting", FormMain.IsSimpleView); + } + private void ProcessListSimpleRefesh() + { + listApps.Locked = true; + listApps.Items.Clear(); + foreach (TaskMgrListItem li in listProcess.Items) + { + if (li.Group == listProcess.Groups[0]) + { + if (li.Type == TaskMgrListItemType.ItemProcess) + if (IsExplorer((PsItem)li.Tag)) + continue; + if (li.PID != currentProcessPid) + listApps.Items.Add(li); + } + } + listApps.Locked = false; + listApps.SyncItems(true); + listApps_SelectItemChanged(null, null); + } + + //Expand & Collapse + public void ProcessListExpandAll() + { + listProcess.Locked = true; + foreach (TaskMgrListItem li in listProcess.Items) + { + if (li.Childs.Count > 0 && !li.ChildsOpened) + li.ChildsOpened = true; + } + listProcess.Locked = false; + listProcess.SyncItems(true); + } + public void ProcessListCollapseAll() + { + listProcess.Locked = true; + foreach (TaskMgrListItem li in listProcess.Items) + { + if (li.Childs.Count > 0 && li.ChildsOpened) + li.ChildsOpened = false; + } + listProcess.Locked = false; + listProcess.SyncItems(true); + } + + //Events + public void check_showAllProcess_CheckedChanged(object sender, EventArgs e) + { + //switch to admin + //显示所有进程(切æ¢åˆ°ç®¡ç†å‘˜æ¨¡å¼ï¼‰ + if (!MIsRunasAdmin()) + { + if (FormMain.check_showAllProcess.Checked) + { + MAppRebotAdmin(); + FormMain.check_showAllProcess.Checked = false; + } + else FormMain.check_showAllProcess.Checked = false; + } + else FormMain.check_showAllProcess.Hide(); + } + public void expandFewerDetals_Click(object sender, EventArgs e) + { + if (!FormMain.IsSimpleView) + { + lastSize = FormMain.Size; + FormMain.IsSimpleView = true; + if (FormMain.Size.Width > lastSimpleSize.Width || FormMain.Size.Height > lastSimpleSize.Height) + FormMain.Size = lastSimpleSize; + } + } + public void expandMoreDetals_Click(object sender, EventArgs e) + { + if (FormMain.IsSimpleView) + { + lastSimpleSize = FormMain.Size; + FormMain.IsSimpleView = false; + if (FormMain.Size.Width < lastSize.Width || FormMain.Size.Height < lastSize.Height) + FormMain.Size = lastSize; + } + } + + //Buttons + public void btnEndTaskSimple_Click(object sender, EventArgs e) + { + TaskMgrListItem taskMgrListItem = listApps.SelectedItem; + if (taskMgrListItem != null) + ProcessListEndTask(0, taskMgrListItem); + } + public void btnEndProcess_Click(object sender, EventArgs e) + { + TaskMgrListItem taskMgrListItem = listProcess.SelectedItem; + if (taskMgrListItem != null) + { + if (taskMgrListItem.Group == listProcess.Groups[0]) + ProcessListEndTask(0, taskMgrListItem); + else MAppWorkCall3(178, FormMain.Handle, IntPtr.Zero); + } + } + + //Timers + private void BaseProcessRefeshTimerLowSc_Tick(object sender, EventArgs e) + { + if (FormMain.tabControlMain.SelectedTab == FormMain.tabPageProcCtl) + mainPageScMgr.ScMgrRefeshList(); + } + private void BaseProcessRefeshTimerLow_Tick(object sender, EventArgs e) + { + refeshLowLock = true; + if (FormMain.tabControlMain.SelectedTab == FormMain.tabPageProcCtl) + ProcessListForceRefeshAll(); + refeshLowLock = false; + } + private void BaseProcessRefeshTimerLowUWP_Tick(object sender, EventArgs e) + { + if (FormMain.tabControlMain.SelectedTab == FormMain.tabPageProcCtl) + ProcessListForceRefeshAllUWP(); + } + + #region ListEvents + + private void listApps_SelectItemChanged(object sender, EventArgs e) + { + btnEndTaskSimple.Enabled = listApps.SelectedItem != null; + } + private void listApps_KeyDown(object sender, KeyEventArgs e) + { + TaskMgrListItem li = listApps.SelectedItem; + if (li == null) return; + if (e.KeyCode == Keys.Delete) + ProcessListEndTask(0, li); + else if (e.KeyCode == Keys.Apps) + { + Point p = listApps.GetiItemPoint(li); + p = listApps.PointToScreen(p); + MAppWorkCall3(212, new IntPtr(p.X), new IntPtr(p.Y)); + MAppWorkCall3(214, FormMain.Handle, IntPtr.Zero); + } + } + private void listApps_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (listApps.SelectedItem != null) + { + MAppWorkCall3(212, new IntPtr(FormMain.MousePosition.X), new IntPtr(FormMain.MousePosition.Y)); + MAppWorkCall3(214, FormMain.Handle, IntPtr.Zero); + } + } + } + private void listApps_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + TaskMgrListItem li = listApps.SelectedItem; + if (li == null) return; + ProcessListSetTo(li); + } + } + + private void listProcess_MouseDoubleClick(object sender, MouseEventArgs e) + { + TaskMgrListItem li = listProcess.SelectedItem; + if (li == null) return; + if (e.Button == MouseButtons.Left) + { + if (li.OldSelectedItem != null) + { + if (li.OldSelectedItem.Type == TaskMgrListItemType.ItemWindow && li.OldSelectedItem.Tag != null) + { + IntPtr data = (IntPtr)li.OldSelectedItem.Tag; + MAppWorkCall3(213, data, IntPtr.Zero); + FormMain.WindowState = FormWindowState.Minimized; + } + } + else if (li.Type == TaskMgrListItemType.ItemWindow) + { + if (li.Tag != null) + { + IntPtr data = (IntPtr)li.Tag; + MAppWorkCall3(213, data, IntPtr.Zero); + FormMain.WindowState = FormWindowState.Minimized; + } + } + else if (li.Childs.Count > 0) + { + li.ChildsOpened = !li.ChildsOpened; + listProcess.SyncItems(true); + } + } + } + private void listProcess_ShowMenuSelectItem(Point pos = default(Point)) + { + if (listProcess.SelectedItem != null) + { + TaskMgrListItem selectedItem = listProcess.SelectedItem.OldSelectedItem == null ? + listProcess.SelectedItem : listProcess.SelectedItem.OldSelectedItem; + if (selectedItem.Type == TaskMgrListItemType.ItemProcess + || selectedItem.Type == TaskMgrListItemType.ItemUWPProcess + || selectedItem.Type == TaskMgrListItemType.ItemProcessHost) + { + PsItem t = (PsItem)selectedItem.Tag; + int rs = MAppWorkShowMenuProcess(t.exepath, selectedItem.Text, t.pid, FormMain.Handle, t.firstHwnd != FormMain.Handle ? t.firstHwnd : IntPtr.Zero, isSelectExplorer ? 1 : 0, nextSecType, pos.X, pos.Y); + } + else if (selectedItem.Type == TaskMgrListItemType.ItemUWPHost) + { + UwpItem t = (UwpItem)selectedItem.Tag; + MAppWorkShowMenuProcess(t.uwpInstallDir, t.uwpFullName, 1, FormMain.Handle, t.firstHwnd, 0, nextSecType, pos.X, pos.Y); + } + else if (selectedItem.Type == TaskMgrListItemType.ItemWindow) + { + MAppWorkCall3(212, new IntPtr(pos.X), new IntPtr(pos.Y)); + MAppWorkCall3(189, FormMain.Handle, (IntPtr)selectedItem.Tag); + } + else if (selectedItem.Type == TaskMgrListItemType.ItemService) + { + IntPtr scname = Marshal.StringToHGlobalUni((string)selectedItem.Tag); + MAppWorkCall3(212, new IntPtr(pos.X), new IntPtr(pos.Y)); + MAppWorkCall3(184, FormMain.Handle, scname); + Marshal.FreeHGlobal(scname); + } + } + } + private void listProcess_PrepareShowMenuSelectItem() + { + if (listProcess.SelectedItem != null) + { + TaskMgrListItem selectedItem = listProcess.SelectedItem.OldSelectedItem == null ? + listProcess.SelectedItem : listProcess.SelectedItem.OldSelectedItem; + if (selectedItem.Type == TaskMgrListItemType.ItemProcess + || selectedItem.Type == TaskMgrListItemType.ItemUWPProcess + || selectedItem.Type == TaskMgrListItemType.ItemProcessHost) + { + PsItem t = (PsItem)selectedItem.Tag; + if (t.pid > 4) + { + btnEndProcess.Enabled = true; + MAppWorkShowMenuProcessPrepare(t.exepath, t.exename, t.pid, IsImporant(t), IsVeryImporant(t)); + + if (IsExplorer(t)) + { + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_REBOOT; + btnEndProcess.Text = LanuageFBuffers.Str_Resrat; + isSelectExplorer = true; + } + else + { + if (t.isWindowShow) + { + if (stateindex != -1) + { + string s = listProcess.SelectedItem.SubItems[stateindex].Text; + if (s == LanuageFBuffers.Str_StatusPaused || s == LanuageFBuffers.Str_StatusHung) + { + btnEndProcess.Text = LanuageFBuffers.Str_Endproc; + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; + goto OUT; + } + } + + btnEndProcess.Text = LanuageFBuffers.Str_Endtask; + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_RESENT_BACK; + + } + else + { + btnEndProcess.Text = LanuageFBuffers.Str_Endproc; + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; + } + OUT: + isSelectExplorer = false; + } + } + else btnEndProcess.Enabled = false; + } + else if (selectedItem.Type == TaskMgrListItemType.ItemUWPHost) + { + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_UWP_RESENT_BACK; + string exepath = selectedItem.Tag.ToString(); + MAppWorkShowMenuProcessPrepare(exepath, null, 0, false, false); + btnEndProcess.Text = LanuageFBuffers.Str_Endtask; + btnEndProcess.Enabled = true; + } + else if (selectedItem.Type == TaskMgrListItemType.ItemWindow) + { + MAppWorkCall3(198, IntPtr.Zero, (IntPtr)selectedItem.Tag); + } + else if (selectedItem.Type == TaskMgrListItemType.ItemService) + { + IntPtr scname = Marshal.StringToHGlobalUni((string)selectedItem.Tag); + MAppWorkCall3(197, IntPtr.Zero, scname); + Marshal.FreeHGlobal(scname); + } + } + } + private void listProcess_MouseClick(object sender, MouseEventArgs e) + { + if (listProcess.SelectedItem == null) return; + if (e.Button == MouseButtons.Right) + { + listProcess_PrepareShowMenuSelectItem(); + listProcess_ShowMenuSelectItem(); + } + } + private void listProcess_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Right) + listProcess_PrepareShowMenuSelectItem(); + } + private void listProcess_SelectItemChanged(object sender, EventArgs e) + { + if (listProcess.SelectedItem == null) + btnEndProcess.Enabled = false; + } + private void listProcess_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Delete) + { + btnEndProcess_Click(sender, e); + } + else if (e.KeyCode == Keys.Apps) + { + if (listProcess.SelectedItem != null) + { + Point p = listProcess.GetiItemPoint(listProcess.SelectedItem); + + listProcess_PrepareShowMenuSelectItem(); + listProcess_ShowMenuSelectItem(listProcess.PointToScreen(p)); + } + } + } + + private void listProcess_Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) + { + if (e.MouseEventArgs.Button == MouseButtons.Left) + { + listProcess.Locked = true; + if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) + { + lvwColumnSorter.Order = SortOrder.Ascending; + sortitem = e.Index; + sorta = true; + } + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) + { + lvwColumnSorter.Order = SortOrder.Ascending; + sortitem = e.Index; + sorta = true; + } + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) + { + lvwColumnSorter.Order = SortOrder.Descending; + sortitem = e.Index; + sorta = false; + } + lvwColumnSorter.SortColumn = e.Index; + listProcess.ListViewItemSorter = lvwColumnSorter; + if (0 == lvwColumnSorter.SortColumn) + listProcess.ShowGroup = true; + else listProcess.ShowGroup = false; + listProcess.Sort(); + listProcess.Locked = false; + listProcess.Invalidate(); + } + else if (e.MouseEventArgs.Button == MouseButtons.Right) + { + FormMain.contextMenuStripMainHeader.Show(FormMain.MousePosition); + } + } + + private class TaskListViewColumnSorter : ListViewColumnSorter + { + private MainPageProcess m; + + public TaskListViewColumnSorter(MainPageProcess m) + { + this.m = m; + } + public override int Compare(TaskMgrListItem x, TaskMgrListItem y) + { + int compareResult = 0; + + if (SortColumn == 0) compareResult = string.Compare(x.Text, y.Text); + else if (SortColumn == m.cpuindex + || SortColumn == m.ramindex + || SortColumn == m.diskindex + || SortColumn == m.netindex) + compareResult = ObjectCompare.Compare(x.SubItems[SortColumn].CustomData, y.SubItems[SortColumn].CustomData); + else if (SortColumn == m.pidindex) + compareResult = ObjectCompare.Compare(x.PID, y.PID); + else compareResult = string.Compare(x.SubItems[SortColumn].Text, y.SubItems[SortColumn].Text); + + if (compareResult == 0) + compareResult = ObjectCompare.Compare(x.PID, y.PID); + if (Order == SortOrder.Ascending) + return compareResult; + else if (Order == SortOrder.Descending) + return (-compareResult); + return compareResult; + } + } + + private void 百分比ToolStripMenuItemRam_Click(object sender, EventArgs e) + { + if (!isRamPercentage) + { + isRamPercentage = true; + FormMain.百分比ToolStripMenuItemRam.Checked = true; + FormMain.值ToolStripMenuItemRam.Checked = false; + } + } + private void 值ToolStripMenuItemRam_Click(object sender, EventArgs e) + { + if (isRamPercentage) + { + isRamPercentage = false; + FormMain.百分比ToolStripMenuItemRam.Checked = false; + FormMain.值ToolStripMenuItemRam.Checked = true; + } + } + private void 百分比ToolStripMenuItemDisk_Click(object sender, EventArgs e) + { + if (!isDiskPercentage) + { + isDiskPercentage = true; + FormMain.百分比ToolStripMenuItemDisk.Checked = true; + FormMain.值ToolStripMenuItemDisk.Checked = false; + } + } + private void 值ToolStripMenuItemDisk_Click(object sender, EventArgs e) + { + if (isDiskPercentage) + { + isDiskPercentage = false; + FormMain.百分比ToolStripMenuItemDisk.Checked = false; + FormMain.值ToolStripMenuItemDisk.Checked = true; + } + } + private void 百分比ToolStripMenuItemNet_Click(object sender, EventArgs e) + { + if (!isNetPercentage) + { + isNetPercentage = true; + FormMain.百分比ToolStripMenuItemNet.Checked = true; + FormMain.值ToolStripMenuItemNet.Checked = false; + } + } + private void 值ToolStripMenuItemNet_Click(object sender, EventArgs e) + { + if (isNetPercentage) + { + isNetPercentage = false; + FormMain.百分比ToolStripMenuItemNet.Checked = false; + FormMain.值ToolStripMenuItemNet.Checked = true; + } + } + + #endregion + + #region Headers + + public bool saveheader = true; + private List headers = new List(); + private itemheaderTip[] headerTips = new itemheaderTip[]{ + new itemheaderTip("TitleCPU", "TipCPU"), + new itemheaderTip("TitleRam", "TipRam"), + new itemheaderTip("TitleDisk", "TipDisk"), + new itemheaderTip("TitleNet", "TipNet"), + }; + private itemheaderDef[] headerDefs = new itemheaderDef[]{ + new itemheaderDef("TitleProcName", 170), + new itemheaderDef("TitleType", 100), + new itemheaderDef("TitlePublisher", 100), + new itemheaderDef("TitleStatus", 80), + new itemheaderDef("TitlePID", 55), + new itemheaderDef("TitleCPU", 75), + new itemheaderDef("TitleRam", 75), + new itemheaderDef("TitleDisk", 75), + new itemheaderDef("TitleNet", 75), + new itemheaderDef("TitleProcPath", 240), + new itemheaderDef("TitleCmdLine", 200), + new itemheaderDef("TitleEProcess", 100), + + }; + private int currHeaderI = 0; + private int listProcessTryGetHeaderDefaultWidth(string name) + { + foreach (itemheaderDef d in headerDefs) + { + if (d.herdername == name) + return d.width; + } + return 100; + } + private string listProcessTryGetHeaderTip(string name) + { + foreach (itemheaderTip t in headerTips) + { + if (t.herdername == name) + return LanuageMgr.GetStr(t.name); + } + return null; + } + private void listProcessAddHeader(string name, int width) + { + if (listProcessGetListHeaderItem(name) != null) return; + headers.Add(new itemheader(currHeaderI, name, width)); + currHeaderI++; + TaskMgrListHeaderItem li = new TaskMgrListHeaderItem(); + string tip = listProcessTryGetHeaderTip(name); + if (name != null) + li.ToolTip = tip; + li.TextSmall = LanuageMgr.GetStr(name); + li.Identifier = name; + li.Width = width; + listProcess.Colunms.Add(li); + } + private int listProcessGetListIndex(string name) + { + int rs = -1; + foreach (TaskMgrListHeaderItem li in listProcess.Colunms) + { + if (li.Identifier == name) + { + rs = li.Index; + break; + } + } + return rs; + } + public itemheader listProcessGetListHeaderItem(string name) + { + itemheader rs = null; + for (int i = 0; i < headers.Count; i++) + { + if (headers[i].name == name) + { + rs = headers[i]; + break; + } + } + return rs; + } + private void listProcessAddHeaderMenu(string name) + { + ToolStripItem item = new ToolStripMenuItem(LanuageMgr.GetStr(name, false)); + + item.Name = name; + item.Click += MainHeadeMenuItem_Click; + + FormMain.contextMenuStripMainHeader.Items.Insert(FormMain.contextMenuStripMainHeader.Items.Count - 2, item); + } + private void listProcessCheckHeaderMenu(string name, bool show) + { + foreach (ToolStripItem item in FormMain.contextMenuStripMainHeader.Items) + { + if ((item is ToolStripMenuItem) && item.Name == name) + { + ((ToolStripMenuItem)item).Checked = show; + break; + } + } + } + private int listProcessGetHeaderMenuDefIndex(string name) + { + int index = 1; + for (int i = 1; i < FormMain.contextMenuStripMainHeader.Items.Count; i++) + { + ToolStripItem item = FormMain.contextMenuStripMainHeader.Items[i]; + if ((item is ToolStripMenuItem)) + { + if (((ToolStripMenuItem)item).Checked) + index++; + } + if (item.Name == name) + break; + } + return index; + } + private void listProcessGetAllHeaderIndexs(string name = "") + { + if (name == "") + { + nameindex = listProcessGetListIndex("TitleProcName"); + companyindex = listProcessGetListIndex("TitlePublisher"); + stateindex = listProcessGetListIndex("TitleStatus"); + pidindex = listProcessGetListIndex("TitlePID"); + cpuindex = listProcessGetListIndex("TitleCPU"); + ramindex = listProcessGetListIndex("TitleRam"); + diskindex = listProcessGetListIndex("TitleDisk"); + netindex = listProcessGetListIndex("TitleNet"); + pathindex = listProcessGetListIndex("TitleProcPath"); + cmdindex = listProcessGetListIndex("TitleCmdLine"); + eprocessindex = listProcessGetListIndex("TitleEProcess"); + typeindex = listProcessGetListIndex("TitleType"); + } + else + { + if (name == "TitleProcName") nameindex = listProcessGetListIndex("TitleProcName"); + else if (name == "TitlePublisher") companyindex = listProcessGetListIndex("TitlePublisher"); + else if (name == "TitleStatus") stateindex = listProcessGetListIndex("TitleStatus"); + else if (name == "TitlePID") pidindex = listProcessGetListIndex("TitlePID"); + else if (name == "TitleCPU") cpuindex = listProcessGetListIndex("TitleCPU"); + else if (name == "TitleRam") ramindex = listProcessGetListIndex("TitleRam"); + else if (name == "TitleDisk") diskindex = listProcessGetListIndex("TitleDisk"); + else if (name == "TitleNet") netindex = listProcessGetListIndex("TitleNet"); + else if (name == "TitleProcPath") pathindex = listProcessGetListIndex("TitleProcPath"); + else if (name == "TitleCmdLine") cmdindex = listProcessGetListIndex("TitleCmdLine"); + else if (name == "TitleEProcess") eprocessindex = listProcessGetListIndex("TitleEProcess"); + else if (name == "TitleType") typeindex = listProcessGetListIndex("TitleType"); + } + } + private void listProcessInsertHeader(string name, int width, int index) + { + if (listProcessGetListHeaderItem(name) != null) return; + headers.Add(new itemheader(index, name, width)); + currHeaderI++; + TaskMgrListHeaderItem li = new TaskMgrListHeaderItem(); + string tip = listProcessTryGetHeaderTip(name); + if (name != null) + li.ToolTip = tip; + li.TextSmall = LanuageMgr.GetStr(name); + li.Identifier = name; + li.Width = width; + listProcess.Colunms.Add(li); + + li.DisplayIndex = index; + + listProcessGetAllHeaderIndexs(""); + listProcess.Header.Invalidate(); + ProcessListForceRefeshAll(true); + + } + private void listProcessRemoveHeader(string name) + { + itemheader h = listProcessGetListHeaderItem(name); + if (h != null) + { + headers.Remove(h); + + foreach (TaskMgrListHeaderItem li in listProcess.Colunms) + { + if (li.Identifier == name) + { + listProcess.Colunms.Remove(li); + break; + } + } + + listProcessGetAllHeaderIndexs(""); + listProcess.Header.Invalidate(); + ProcessListForceRefeshAll(); + } + } + + private void MainHeadeMenuItem_Click(object sender, EventArgs e) + { + ToolStripMenuItem item = sender as ToolStripMenuItem; + if (item.Checked) + { + item.Checked = false; + listProcessRemoveHeader(item.Name); + } + else + { + item.Checked = true; + int index = listProcessGetHeaderMenuDefIndex(item.Name); + if (index < 1) index = 1; + listProcessInsertHeader(item.Name, listProcessTryGetHeaderDefaultWidth(item.Name), index); + } + listProcessGetAllHeaderIndexs(item.Name); + } + + int nameindex = 0; + int companyindex = 0; + public int stateindex = 0; + int pidindex = 0; + int cpuindex = 0; + int ramindex = 0; + int diskindex = 0; + int netindex = 0; + int pathindex = 0; + int cmdindex = 0; + int eprocessindex = 0; + int typeindex = 0; + + #endregion + } +} diff --git a/TaskMgr/Main/MainPageProcessDetails.cs b/TaskMgr/Main/MainPageProcessDetails.cs new file mode 100644 index 0000000..819cbd4 --- /dev/null +++ b/TaskMgr/Main/MainPageProcessDetails.cs @@ -0,0 +1,1209 @@ +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static PCMgr.Main.MainUtils; +using static PCMgr.NativeMethods; + +namespace PCMgr.Main +{ + class MainPageProcessDetails : MainPage + { + private ListView listProcessDetals; + private Button btnEndProcessDetals; + + public MainPageProcessDetails(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageDetals) + { + listProcessDetals = formMain.listProcessDetals; + btnEndProcessDetals = formMain.btnEndProcessDetals; + } + + protected override void OnLoadControlEvents() + { + btnEndProcessDetals.Click += btnEndProcessDetals_Click; + + listProcessDetals.ColumnClick += listProcessDetals_ColumnClick; + listProcessDetals.ColumnReordered += listProcessDetals_ColumnReordered; + listProcessDetals.SelectedIndexChanged += listProcessDetals_SelectedIndexChanged; + listProcessDetals.KeyDown += listProcessDetals_KeyDown; + listProcessDetals.MouseClick += listProcessDetals_MouseClick; + + FormMain.éšè—列ToolStripMenuItem.Click += éšè—列ToolStripMenuItem_Click; + FormMain.选择列ToolStripMenuItem.Click += 选择列ToolStripMenuItem_Click; + FormMain.将此列调整为åˆé€‚大å°ToolStripMenuItem.Click += 将此列调整为åˆé€‚大å°ToolStripMenuItem_Click; + + base.OnLoadControlEvents(); + } + + + //è¯¦ç»†ä¿¡æ¯ é¡µé¢ä»£ç  + + private IntPtr processMonitorDetals = IntPtr.Zero; + + private List loadedDetalProcess = new List(); + private class ProcessDetalItem + { + public ProcessDetalItem() + { + + } + public IntPtr handle; + public uint pid; + public uint ppid; + public string exename; + public string eprocess; + public string exepath; + public IntPtr processItem = IntPtr.Zero; + public ProcessDetalItem parent = null; + public ListViewItem item = null; + public List childs = new List(); + } + + private int nextSecType = -1; + public bool nextUpdateStaticVals = false; + + private List windowsProcess = new List(); + private List veryimporantProcess = new List(); + + private string csrssPath = ""; + private string ntoskrnlPath = ""; + private string systemRootPath = ""; + private string svchostPath = ""; + + private bool IsWindowsProcess(string str) + { + //检测是ä¸æ˜¯Windows进程 + if (str != null) + { + str = str.ToLower(); + foreach (string s in windowsProcess) + if (s == str) return true; + } + return false; + } + private bool IsVeryImporant(ProcessDetalItem p) + { + if (p.exepath != null) + { + string str = p.exepath.ToLower(); + foreach (string s in veryimporantProcess) + if (s == str) return true; + } + return false; + } + private bool IsImporant(ProcessDetalItem p) + { + if (p.exepath != null) + { + if (p.exepath.ToLower() == @"c:\windows\system32\svchost.exe") return true; + return IsWindowsProcess(p.exepath); + } + return false; + } + + //Find iten + private bool ProcessListDetailsIsProcessLoaded(uint pid, out ProcessDetalItem item) + { + bool rs = false; + foreach (ProcessDetalItem f in loadedDetalProcess) + { + if (f.pid == pid) + { + item = f; + rs = true; + return rs; + } + } + item = null; + return rs; + } + private ProcessDetalItem ProcessListDetailsFindPsItem(uint pid) + { + ProcessDetalItem rs = null; + foreach (ProcessDetalItem i in loadedDetalProcess) + { + if (i.pid == pid) + { + rs = i; + return rs; + } + } + return rs; + } + + public void ProcessListDetailsInit() + { + if (!Inited) + { + //if (!processListInited) ProcessListInit(); + + listViewItemComparerProcDetals = new ListViewItemComparerProcDetals(this); + + NativeBridge.ProcessNewItemCallBackDetails = ProcessListDetailsNewItemCallBack; + NativeBridge.ProcessRemoveItemCallBackDetails = ProcessListDetailsRemoveItemCallBack; + + NativeBridge.ptrProcessNewItemCallBackDetails = Marshal.GetFunctionPointerForDelegate(NativeBridge.ProcessNewItemCallBackDetails); + NativeBridge.ptrProcessRemoveItemCallBackDetails = Marshal.GetFunctionPointerForDelegate(NativeBridge.ProcessRemoveItemCallBackDetails); + + processMonitorDetals = MProcessMonitor.CreateProcessMonitor(NativeBridge.ptrProcessRemoveItemCallBackDetails, NativeBridge.ptrProcessNewItemCallBackDetails, Nullptr); + + MAppWorkCall3(160, listProcessDetals.Handle); + MAppWorkCall3(182, listProcessDetals.Handle); + listProcessDetals.ListViewItemSorter = listViewItemComparerProcDetals; + ComCtlApi.MListViewProcListWndProc(listProcessDetals.Handle); + + if (systemRootPath == "") systemRootPath = Marshal.PtrToStringUni(MAppWorkCall4(95, Nullptr, Nullptr)); + if (csrssPath == "") csrssPath = Marshal.PtrToStringUni(MAppWorkCall4(96, Nullptr, Nullptr)); + if (ntoskrnlPath == "") ntoskrnlPath = Marshal.PtrToStringUni(MAppWorkCall4(97, Nullptr, Nullptr)); + + windowsProcess.Add(@"C:\Program Files\Windows Defender\NisSrv.exe".ToLower()); + windowsProcess.Add(@"C:\Program Files\Windows Defender\MsMpEng.exe".ToLower()); + windowsProcess.Add(svchostPath); + windowsProcess.Add((systemRootPath + @"\System32\csrss.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\conhost.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"‪\System32\sihost.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\winlogon.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\wininit.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\smss.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\services.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\dwm.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\System32\lsass.exe").ToLower()); + windowsProcess.Add((systemRootPath + @"\explorer.exe").ToLower()); + + veryimporantProcess.Add((systemRootPath + @"\System32\wininit.exe").ToLower()); + veryimporantProcess.Add((systemRootPath + @"\System32\csrss.exe").ToLower()); + veryimporantProcess.Add((systemRootPath + @"\System32\lsass.exe").ToLower()); + veryimporantProcess.Add((systemRootPath + @"\System32\smss.exe").ToLower()); + + Inited = true; + + ProcessListDetailsLoadColumns(); + ProcessListDetailsILoadAllItem(); + + } + } + public void ProcessListDetailsUnInit() + { + if (Inited) + { + ProcessListDetailsSaveColumns(); + ProcessDetalsListFreeAll(); + + MProcessMonitor.DestroyProcessMonitor(processMonitorDetals); + Inited = false; + } + } + + //CallBacks + private void ProcessListDetailsRemoveItemCallBack(uint pid) + { + ProcessDetalItem oldps = ProcessListDetailsFindPsItem(pid); + if (oldps != null) ProcessListDetailsFree(oldps); + else Log("ProcessListDetailsRemoveItemCallBack for a not found item : pid " + pid); + } + private void ProcessListDetailsNewItemCallBack(uint pid, uint parentid, string exename, string exefullpath, IntPtr hProcess, IntPtr processItem) + { + if (!FormMain.IsAdmin && string.IsNullOrEmpty(exefullpath) && pid != 0 && pid != 2 && pid != 4 && pid != 88) + return; + ProcessListDetailsLoad(pid, parentid, exename, exefullpath, hProcess, processItem); + } + + + //Add item + private void ProcessListDetailsLoad(uint pid, uint ppid, string exename, string exefullpath, IntPtr hprocess, IntPtr processItem) + { + //base + ProcessDetalItem p = new ProcessDetalItem(); + + p.pid = pid; + p.ppid = ppid; + loadedDetalProcess.Add(p); + + ProcessDetalItem parentpsItem = null; + if (ProcessListDetailsIsProcessLoaded(p.ppid, out parentpsItem)) + { + p.parent = parentpsItem; + parentpsItem.childs.Add(p); + } + + if (pid == 0) + exename = LanuageFBuffers.Str_IdleProcess; + else if (pid == 2) + exename = LanuageFBuffers.Str_SystemInterrupts; + else if (pid == 4 || exename == "Registry" || exename == "Memory Compression") + exefullpath = ntoskrnlPath; + else if (pid < 800 && ppid < 500 && exename == "csrss.exe") + exefullpath = csrssPath; + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(exefullpath); + + PEOCESSKINFO infoStruct = new PEOCESSKINFO(); + if (FormMain.IsKernelLoaded) + { + if (MGetProcessEprocess(pid, ref infoStruct)) + { + p.eprocess = infoStruct.Eprocess; + + if (string.IsNullOrEmpty(exefullpath)) + { + exefullpath = infoStruct.ImageFullName; + stringBuilder.Append(exefullpath); + } + } + } + + ListViewItem li = new ListViewItem(); + + p.item = li; + p.processItem = processItem; + p.handle = hprocess; + p.exename = exename; + p.exepath = stringBuilder.ToString(); + + //icon + li.ImageKey = ProcessListDetailsGetIcon(p.exepath); + li.Tag = p; + + //16 empty item + for (int i = 0; i < 16; i++) li.SubItems.Add(new ListViewItem.ListViewSubItem()); + + + + //static items + ProcessListDetailsUpdateStaticItems(pid, li, p); + + ProcessListDetailsUpdate(pid, true, li); + + listProcessDetals.Items.Add(li); + } + + //Update dyamic data + private void ProcessListDetailsUpdateStaticItems(uint pid, ListViewItem li, ProcessDetalItem p) + { + //static items + if (colNameIndex != -1 && string.IsNullOrEmpty(li.SubItems[colNameIndex].Text)) li.SubItems[colNameIndex].Text = p.exename; + if (colPathIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPathIndex].Text)) li.SubItems[colPathIndex].Text = p.exepath; + if (colPIDIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPIDIndex].Text)) + { + if (pid == 2) + li.SubItems[colPIDIndex].Text = "-"; + else li.SubItems[colPIDIndex].Text = pid.ToString(); + } + if (colPPIDIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPPIDIndex].Text)) li.SubItems[colPPIDIndex].Text = p.ppid.ToString(); + if (colDescriptionIndex != -1 && string.IsNullOrEmpty(li.SubItems[colDescriptionIndex].Text)) + { + if (pid == 0) + li.SubItems[colDescriptionIndex].Text = LanuageFBuffers.Str_IdleProcessDsb; + else if (pid == 2) + li.SubItems[colDescriptionIndex].Text = LanuageFBuffers.Str_InterruptsProcessDsb; + else if (p.exepath != "") + { + StringBuilder stringBuilderDescription = new StringBuilder(260); + if (MGetExeDescribe(p.exepath, stringBuilderDescription, 260)) + li.SubItems[colDescriptionIndex].Text = stringBuilderDescription.ToString(); + } + } + + if (pid == 2) + goto JUMPADD; + + if (colEprocessIndex != -1 && string.IsNullOrEmpty(li.SubItems[colEprocessIndex].Text)) + li.SubItems[colEprocessIndex].Text = p.eprocess; + if (colCommandLineIndex != -1 && string.IsNullOrEmpty(li.SubItems[colCommandLineIndex].Text)) + { + StringBuilder stringBuilderCommandLine = new StringBuilder(512); + if (p.handle != IntPtr.Zero && MGetProcessCommandLine(p.handle, stringBuilderCommandLine, 512, pid)) + li.SubItems[colCommandLineIndex].Text = stringBuilderCommandLine.ToString(); + } + if (FormMain.Is64OS && colPlatformIndex != -1 && string.IsNullOrEmpty(li.SubItems[colPlatformIndex].Text)) + { + if (MGetProcessIs32Bit(p.handle)) + li.SubItems[colCommandLineIndex].Text = LanuageFBuffers.Str_Process32Bit; + else li.SubItems[colCommandLineIndex].Text = LanuageFBuffers.Str_Process64Bit; + } + + if (colUserNameIndex != -1 && p.handle != IntPtr.Zero && string.IsNullOrEmpty(li.SubItems[colUserNameIndex].Text)) + { + StringBuilder stringBuilderUserName = new StringBuilder(260); + if (MGetProcessUserName(p.handle, stringBuilderUserName, 260)) + li.SubItems[colUserNameIndex].Text = stringBuilderUserName.ToString(); + } + if (colSessionIDIndex != -1 && string.IsNullOrEmpty(li.SubItems[colSessionIDIndex].Text)) + li.SubItems[colSessionIDIndex].Text = MGetProcessSessionID(p.processItem).ToString(); + JUMPADD: + return; + } + private void ProcessListDetailsUpdate(uint pid, bool isload, ListViewItem it, int ipdateOneDataCloum = -1, bool forceProcessHost = false) + { + ProcessDetalItem p = it.Tag as ProcessDetalItem; + if (colCPUIndex != -1 && colCPUIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CPU(it, p); + if (colCycleIndex != -1 && colCycleIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_Cycle(it, p); + if (p.pid == 2) return; + if (colWorkingSetPrivateIndex != -1 && colWorkingSetPrivateIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSetPrivate(it, p); + if (colWorkingSetIndex != -1 && colWorkingSetIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSet(it, p); + if (colWorkingSetShareIndex != -1 && colWorkingSetShareIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSetShare(it, p); + if (colPeakWorkingSetIndex != -1 && colPeakWorkingSetIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PeakWorkingSet(it, p); + if (colNonPagedPoolIndex != -1 && colNonPagedPoolIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_NonPagedPool(it, p); + if (colPagedPoolIndex != -1 && colPagedPoolIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PagedPool(it, p); + if (colCommitedSizeIndex != -1 && colCommitedSizeIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CommitedSize(it, p); + if (colPageErrorIndex != -1 && colPageErrorIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PageFault(it, p); + if (colHandleCountIndex != -1 && colHandleCountIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_HandleCount(it, p); + if (colThreadCountIndex != -1 && colThreadCountIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_ThreadsCount(it, p); + if (colIOReadIndex != -1 && colIOReadIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IORead(it, p); + if (colIOWriteIndex != -1 && colIOWriteIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOWrite(it, p); + if (colIOOtherIndex != -1 && colIOOtherIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOOther(it, p); + if (colIOReadBytesIndex != -1 && colIOReadBytesIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOReadBytes(it, p); + if (colIOWriteBytesIndex != -1 && colIOWriteBytesIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOWriteBytes(it, p); + if (colIOOtherBytesIndex != -1 && colIOOtherBytesIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOOtherBytes(it, p); + if (colCPUTimeIndex != -1 && colCPUTimeIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CPUTime(it, p); + if (colStateIndex != -1 && colStateIndex != ipdateOneDataCloum) + ProcessListDetails_Update_State(it, p); + if (colGDIObjectIndex != -1 && colGDIObjectIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_GdiHandleCount(it, p); + if (colUserObjectIndex != -1 && colUserObjectIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_UserHandleCount(it, p); + if (colWorkingSetIncreasementIndex != -1 && colWorkingSetIncreasementIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSetIncreasement(it, p); + if (colPageErrorIncreasementIndex != -1 && colPageErrorIncreasementIndex != ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PageFaultIncreasement(it, p); + } + //update a column be use to sort + private void ProcessListDetailsUpdateOnePerfCloum(uint pid, ListViewItem it, int ipdateOneDataCloum, bool forceProcessHost = false) + { + ProcessDetalItem p = it.Tag as ProcessDetalItem; + if (p.pid == 2) + { + if (colCPUIndex != -1 && colCPUIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CPU(it, p); + else if (colCycleIndex != -1 && colCycleIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_Cycle(it, p); + return; + } + if (colCPUIndex != -1 && colCPUIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CPU(it, p); + else if (colWorkingSetPrivateIndex != -1 && colWorkingSetPrivateIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSetPrivate(it, p); + else if (colWorkingSetIndex != -1 && colWorkingSetIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSet(it, p); + else if (colWorkingSetShareIndex != -1 && colWorkingSetShareIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSetShare(it, p); + else if (colPeakWorkingSetIndex != -1 && colPeakWorkingSetIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PeakWorkingSet(it, p); + else if (colNonPagedPoolIndex != -1 && colNonPagedPoolIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_NonPagedPool(it, p); + else if (colPagedPoolIndex != -1 && colPagedPoolIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PagedPool(it, p); + else if (colCommitedSizeIndex != -1 && colCommitedSizeIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CommitedSize(it, p); + else if (colPageErrorIndex != -1 && colPageErrorIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PageFault(it, p); + else if (colHandleCountIndex != -1 && colHandleCountIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_HandleCount(it, p); + else if (colThreadCountIndex != -1 && colThreadCountIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_ThreadsCount(it, p); + else if (colIOReadIndex != -1 && colIOReadIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IORead(it, p); + else if (colIOWriteIndex != -1 && colIOWriteIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOWrite(it, p); + else if (colIOOtherIndex != -1 && colIOOtherIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOOther(it, p); + else if (colIOReadBytesIndex != -1 && colIOReadBytesIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOReadBytes(it, p); + else if (colIOWriteBytesIndex != -1 && colIOWriteBytesIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOWriteBytes(it, p); + else if (colIOOtherBytesIndex != -1 && colIOOtherBytesIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_IOOtherBytes(it, p); + else if (colCPUTimeIndex != -1 && colCPUTimeIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_CPUTime(it, p); + else if (colCycleIndex != -1 && colCycleIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_Cycle(it, p); + else if (colStateIndex != -1 && colStateIndex == ipdateOneDataCloum) + ProcessListDetails_Update_State(it, p); + else if (colGDIObjectIndex != -1 && colGDIObjectIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_GdiHandleCount(it, p); + else if (colUserObjectIndex != -1 && colUserObjectIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_UserHandleCount(it, p); + else if (colWorkingSetIncreasementIndex != -1 && colWorkingSetIncreasementIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_WorkingSetIncreasement(it, p); + else if (colPageErrorIncreasementIndex != -1 && colPageErrorIncreasementIndex == ipdateOneDataCloum) + ProcessListDetails_Perf_Update_PageFaultIncreasement(it, p); + } + private void ProcessListDetailsUpdateValues(int refeshAllDataColum, bool updateStaticItems = false) + { + //update process perf data + foreach (ListViewItem it in listProcessDetals.Items) + { + if (updateStaticItems) + ProcessListDetailsUpdateStaticItems(((ProcessDetalItem)it.Tag).pid, it, (ProcessDetalItem)it.Tag); + if (refeshAllDataColum != -1) + ProcessListDetailsUpdateOnePerfCloum(((ProcessDetalItem)it.Tag).pid, it, refeshAllDataColum); + } + if (updateStaticItems) + { + + foreach (ColumnHeader c in listProcessDetals.Columns) + { + itemheaderTag t = ((itemheaderTag)c.Tag); + if (t.needAutoSize) + { + listProcessDetals.AutoResizeColumn(c.Index, ColumnHeaderAutoResizeStyle.ColumnContent); + t.needAutoSize = false; + } + } + } + if (listProcessDetals.Items.Count == 0) return; + int start = listProcessDetals.Items.IndexOf(listProcessDetals.TopItem), end = listProcessDetals.Items.Count; + ListViewItem liThis = null; + for (int i = start; i < end; i++) + { + liThis = listProcessDetals.Items[i]; + if (liThis.Position.Y < listProcessDetals.Height) + ProcessListDetailsUpdate(((ProcessDetalItem)liThis.Tag).pid, false, liThis, refeshAllDataColum); + else break; + } + } + + //All perf data + private void ProcessListDetails_Perf_Update_CPU(ListViewItem it, ProcessDetalItem p) + { + double data = MProcessPerformanctMonitor.GetProcessCpuUseAge(p.processItem); + it.SubItems[colCPUIndex].Text = data.ToString("00.0"); + it.SubItems[colCPUIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_CPUTime(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessCpuTime(p.processItem); + TimeSpan time = TimeSpan.FromMilliseconds(Convert.ToDouble(data)); + it.SubItems[colCPUTimeIndex].Text = time.Hours + ":" + time.Minutes + ":" + time.Seconds; + it.SubItems[colCPUTimeIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_Cycle(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessCycle(p.processItem); + it.SubItems[colCycleIndex].Text = data.ToString(); + it.SubItems[colCycleIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_WorkingSetPrivate(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSETPRIVATE); + it.SubItems[colWorkingSetPrivateIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colWorkingSetPrivateIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_WorkingSetShare(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSETSHARE); + it.SubItems[colWorkingSetShareIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colWorkingSetShareIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_WorkingSet(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSET); + it.SubItems[colWorkingSetIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colWorkingSetIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_WorkingSetIncreasement(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_WORKINGSET_INC); + it.SubItems[colWorkingSetIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colWorkingSetIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_PeakWorkingSet(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PEAKWORKINGSET); + it.SubItems[colPeakWorkingSetIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colPeakWorkingSetIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_NonPagedPool(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_NONPAGEDPOOL); + it.SubItems[colNonPagedPoolIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colNonPagedPoolIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_PagedPool(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PAGEDPOOL); + it.SubItems[colPagedPoolIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colPagedPoolIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_CommitedSize(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_COMMITEDSIZE); + it.SubItems[colCommitedSizeIndex].Text = FormatFileSizeMenSingal(data); + it.SubItems[colCommitedSizeIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_PageFault(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PAGEDFAULT); + it.SubItems[colPageErrorIndex].Text = data.ToString(); + it.SubItems[colPageErrorIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_PageFaultIncreasement(ListViewItem it, ProcessDetalItem p) + { + uint data = MProcessPerformanctMonitor.GetProcessMemoryInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCMEM_PAGEDFAULT_INC); + it.SubItems[colPageErrorIndex].Text = data.ToString(); + it.SubItems[colPageErrorIndex].Tag = data; + } + + private void ProcessListDetails_Perf_Update_HandleCount(ListViewItem it, ProcessDetalItem p) + { + uint data = MGetProcessHandlesCount(p.processItem); + it.SubItems[colHandleCountIndex].Text = data.ToString(); + it.SubItems[colHandleCountIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_ThreadsCount(ListViewItem it, ProcessDetalItem p) + { + uint data = MGetProcessThreadsCount(p.processItem); + it.SubItems[colThreadCountIndex].Text = data.ToString(); + it.SubItems[colThreadCountIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_GdiHandleCount(ListViewItem it, ProcessDetalItem p) + { + uint data = MGetProcessGdiHandleCount(p.handle); + it.SubItems[colGDIObjectIndex].Text = data.ToString(); + it.SubItems[colGDIObjectIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_UserHandleCount(ListViewItem it, ProcessDetalItem p) + { + uint data = MGetProcessUserHandleCount(p.handle); + it.SubItems[colUserObjectIndex].Text = data.ToString(); + it.SubItems[colUserObjectIndex].Tag = data; + } + + private void ProcessListDetails_Perf_Update_IORead(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_READ); + it.SubItems[colIOReadIndex].Text = data.ToString(); + it.SubItems[colIOReadIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_IOWrite(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_WRITE); + it.SubItems[colIOWriteIndex].Text = data.ToString(); + it.SubItems[colIOWriteIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_IOOther(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_OTHER); + it.SubItems[colIOOtherIndex].Text = data.ToString(); + it.SubItems[colIOOtherIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_IOReadBytes(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_READ_BYTES); + it.SubItems[colIOReadBytesIndex].Text = data.ToString(); + it.SubItems[colIOReadBytesIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_IOWriteBytes(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_WRITE_BYTES); + it.SubItems[colIOWriteBytesIndex].Text = data.ToString(); + it.SubItems[colIOWriteBytesIndex].Tag = data; + } + private void ProcessListDetails_Perf_Update_IOOtherBytes(ListViewItem it, ProcessDetalItem p) + { + UInt64 data = MProcessPerformanctMonitor.GetProcessIOInfo(p.processItem, MProcessPerformanctMonitor.M_GET_PROCIO_OTHER_BYTES); + it.SubItems[colIOOtherBytesIndex].Text = data.ToString(); + it.SubItems[colIOOtherBytesIndex].Tag = data; + } + + private void ProcessListDetails_Update_State(ListViewItem it, ProcessDetalItem p) + { + int i = MGetProcessState(p.processItem, IntPtr.Zero); + if (i == 1) + { + it.SubItems[colStateIndex].Text = ""; + /*if (p.isSvchost == false && it.Childs.Count > 0) + { + bool hung = false; + foreach (TaskMgrListItem c in it.Childs) + if (c.Type == TaskMgrListItemType.ItemWindow) + if (IsHungAppWindow((IntPtr)c.Tag)) + { + hung = true; + break; + } + if (hung) + { + it.SubItems[colStateIndex].Text = str_status_hung; + it.SubItems[colStateIndex].ForeColor = Color.FromArgb(219, 107, 58); + } + }*/ + } + else if (i == 2) + { + it.SubItems[colStateIndex].Text = LanuageFBuffers.Str_StatusPaused; + it.SubItems[colStateIndex].ForeColor = System.Drawing.Color.FromArgb(22, 158, 250); + } + } + + public void ProcessListDetailsHeaderRightClick(int colLastDown) + { + this.colLastDown = colLastDown; + FormMain.éšè—列ToolStripMenuItem.Enabled = colLastDown != colNameIndex; + FormMain.contextMenuStripProcDetalsCol.Show(MousePosition); + } + public void ProcessListDetailsHeaderMouseMove(int clicks, Point pos) + { + listProcessDetals_ColumnMouseMove(listProcessDetals, clicks, pos); + } + + //Full load + public void ProcessListDetailsILoadAllItem() + { + ComCtlApi.MListViewProcListLock(true); + MProcessMonitor.EnumAllProcess(processMonitorDetals); + ComCtlApi.MListViewProcListLock(false); + listProcessDetals.Invalidate(); + } + + //Refesh + public void ProcessListDetailsRefesh() + { + ComCtlApi.MListViewProcListLock(true); + + //åˆ·æ–°æ‰€æœ‰æ•°æ® + MProcessMonitor.RefeshAllProcess(processMonitorDetals); + //åˆ·æ–°æ€§èƒ½æ•°æ® + bool refeshAColumData = ProcessListDetailsIsDyamicDataColumn(listViewItemComparerProcDetals.SortColumn); + ProcessListDetailsUpdateValues(refeshAColumData ? listViewItemComparerProcDetals.SortColumn : -1, nextUpdateStaticVals); + + nextUpdateStaticVals = false; + + listProcessDetals.Sort(); + ComCtlApi.MListViewProcListLock(false); + listProcessDetals.Invalidate(); + } + private void ProcessListDetailsFree(ProcessDetalItem it, bool delitem = true) + { + //remove invalid item + //MAppWorkCall3(174, IntPtr.Zero, new IntPtr(it.pid)); + + it.childs.Clear(); + if (it.parent != null && it.parent.childs.Contains(it)) + it.parent.childs.Remove(it); + it.parent = null; + loadedDetalProcess.Remove(it); + if (delitem) listProcessDetals.Items.Remove(it.item); + } + private void ProcessDetalsListFreeAll() + { + listProcessDetals.Items.Clear(); + //the exit clear + for (int i = 0; i < loadedDetalProcess.Count; i++) + ProcessListDetailsFree(loadedDetalProcess[i], false); + loadedDetalProcess.Clear(); + } + + //Ico + private string ProcessListDetailsGetIcon(string exepath) + { + if (exepath == "") exepath = "Default"; + if (!FormMain.imageListProcessDetalsIcons.Images.ContainsKey(exepath)) + { + IntPtr intPtr = MGetExeIcon(exepath == "Default" ? null : exepath); + if (intPtr != IntPtr.Zero) + FormMain.imageListProcessDetalsIcons.Images.Add(exepath, Icon.FromHandle(intPtr)); + } + return exepath; + } + + //Events + private void listProcessDetals_MouseClick(object sender, MouseEventArgs e) + { + if (listProcessDetals.SelectedItems.Count == 0) return; + ProcessDetalItem ps = listProcessDetals.SelectedItems[0].Tag as ProcessDetalItem; + if (e.Button == MouseButtons.Left) + { + if (ps.pid > 4) + { + btnEndProcessDetals.Enabled = true; + MAppWorkShowMenuProcessPrepare(ps.exepath, ps.exename, ps.pid, IsImporant(ps), IsVeryImporant(ps)); + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; + } + else btnEndProcessDetals.Enabled = false; + } + else if (e.Button == MouseButtons.Right) + { + nextSecType = MENU_SELECTED_PROCESS_KILL_ACT_KILL; + MAppWorkShowMenuProcessPrepare(ps.exepath, ps.exename, ps.pid, IsImporant(ps), IsVeryImporant(ps)); + MAppWorkShowMenuProcess(ps.exepath, ps.exename, ps.pid, FormMain.Handle, IntPtr.Zero, 0, nextSecType, FormMain.MousePosition.X, FormMain.MousePosition.Y); + } + } + private void listProcessDetals_SelectedIndexChanged(object sender, EventArgs e) + { + btnEndProcessDetals.Enabled = listProcessDetals.SelectedItems.Count != 0; + } + private void listProcessDetals_KeyDown(object sender, KeyEventArgs e) + { + if (listProcessDetals.SelectedItems.Count > 0) + { + if (e.KeyCode == Keys.Apps) + { + ListViewItem item = listProcessDetals.SelectedItems[0]; + Point p = item.Position; p.X = 0; + p = listProcessDetals.PointToScreen(p); + ProcessDetalItem ps = item.Tag as ProcessDetalItem; + MAppWorkShowMenuProcess(ps.exepath, ps.exename, ps.pid, FormMain.Handle, IntPtr.Zero, 0, nextSecType, p.X, p.Y); + } + else if (e.KeyCode == Keys.Delete) + { + ListViewItem item = listProcessDetals.SelectedItems[0]; + ProcessDetalItem ps = item.Tag as ProcessDetalItem; + MAppWorkShowMenuProcessPrepare(ps.exepath, ps.exename, ps.pid, IsImporant(ps), IsVeryImporant(ps)); + MAppWorkCall3(178, FormMain.Handle, IntPtr.Zero); + } + } + } + + private void btnEndProcessDetals_Click(object sender, EventArgs e) + { + if (listProcessDetals.SelectedItems.Count == 0) return; + MAppWorkCall3(178, FormMain.Handle, IntPtr.Zero); + } + + #region Columns + + private int colLastDown = -1; + + private int colEprocessIndex = -1;//ok + private int colUserNameIndex = -1;//ok + private int colNameIndex = -1;//ok + private int colPackageNameIndex = -1;//n + private int colPIDIndex = -1;//ok + private int colPPIDIndex = -1;//ok + private int colStateIndex = -1;//ok + private int colSessionIDIndex = -1;//ok + private int colJobIDIndex = -1; + private int colCPUIndex = -1;//ok + private int colCPUTimeIndex = -1;//ok + private int colCycleIndex = -1;//ok + private int colPeakWorkingSetIndex = -1;//ok + private int colWorkingSetIncreasementIndex = -1;//ok + private int colWorkingSetIndex = -1;//ok + private int colWorkingSetPrivateIndex = -1;//ok + private int colWorkingSetShareIndex = -1;//ok + private int colCommitedSizeIndex = -1;//ok + private int colPagedPoolIndex = -1;//ok + private int colNonPagedPoolIndex = -1;//ok + private int colPageErrorIndex = -1;//ok + private int colPageErrorIncreasementIndex = -1;//ok + private int colHandleCountIndex = -1;//ok + private int colThreadCountIndex = -1;//ok + private int colUserObjectIndex = -1;//ok + private int colGDIObjectIndex = -1;//ok + private int colIOReadIndex = -1;//ok + private int colIOWriteIndex = -1;//ok + private int colIOOtherIndex = -1;//ok + private int colIOReadBytesIndex = -1;//ok + private int colIOWriteBytesIndex = -1;//ok + private int colIOOtherBytesIndex = -1;//ok + private int colPathIndex = -1;//ok + private int colCommandLineIndex = -1;//ok + private int colPlatformIndex = -1;//ok + private int colOSContextIndex = -1; + private int colDescriptionIndex = -1;//ok + private int colDepIndex = -1; + private int colUACVIndex = -1; + + private IntPtr hListHeader = IntPtr.Zero; + private ToolTip colsTip = new ToolTip(); + + public string[] allCols = new string[] + { + "TitlePID","TitlePackageName","TitleStatus","TitleSessionID","TitleJobID","TitleParentPID","TitleCycle", + "TitleCPU","TitleCPUTime","TitlePeakWorkingSet","TitleWorkingSetCrease", + "TitleWorkingSet","TitleWorkingSetPrivate","TitleWorkingSetShare","TitleCommited", + "TitlePagedPool","TitleNonPagedPool","TitlePagedError","TitlePagedErrorCrease","TitleHandleCount", + "TitleThreadCount","TitleUserObject","TitleGdiObject","TitleIORead","TitleIOWrite","TitleIOOther", + "TitleIOReadBytes","TitleIOWriteBytes","TitleIOOtherBytes","TitleProcPath","TitleCmdLine","TitleEProcess", + "TitlePlatform","TitleOperationSystemContext","TitleDescription","TitleDEP","TitleUACVirtualization","TitleProcName" + }; + public string[] numberCols = new string[] + { + "TitlePID","TitleSessionID","TitleJobID","TitleParentPID","TitleCycle", + "TitleCPU","TitlePeakWorkingSet","TitleWorkingSetCrease", + "TitleWorkingSet","TitleWorkingSetPrivate","TitleWorkingSetShare","TitleCommited", + "TitlePagedPool","TitleNonPagedPool","TitlePagedError","TitlePagedErrorCrease","TitleHandleCount", + "TitleThreadCount","TitleUserObject","TitleGdiObject","TitleIORead","TitleIOWrite","TitleIOOther", + "TitleIOReadBytes","TitleIOWriteBytes","TitleIOOtherBytes" + }; + + private itemheaderTip[] detailsHeaderTips = new itemheaderTip[]{ + new itemheaderTip("TitleCPU", "TipCPU"), + new itemheaderTip("TitlePID", "TipPID"), + new itemheaderTip("TitleStatus", "TipStatus"), + new itemheaderTip("TitleJobID", "TipJobID"), + new itemheaderTip("TitleWorkingSetPrivate", "TipPrivateWorkingSet"), + new itemheaderTip("TitleCPUTime", "TipCPUTime"), + new itemheaderTip("TitleCycle", "TipCycle"), + new itemheaderTip("TitleCommited", "TipCommitedSize"), + new itemheaderTip("TitlePagedPool", "TipPagedSize"), + new itemheaderTip("TitleNonPagedPool", "TipNonPagedSize"), + new itemheaderTip("TitlePagedError", "TipPageErr"), + new itemheaderTip("TitleHandleCount", "TipHandleCount"), + new itemheaderTip("TitleThreadCount", "TipThredCount"), + new itemheaderTip("TitleCmdLine", "TipCmdLine"), + new itemheaderTip("TitleUserObject", "TipUserObject"), + new itemheaderTip("TitleGdiObject", "TipGDIObject"), + new itemheaderTip("TitlePlatform", "TipPlatform"), + new itemheaderTip("TitleWorkingSet", "TipWorkingSet"), + new itemheaderTip("TitleWorkingSetShare", "TipShareWorkingSet"), + new itemheaderTip("TitleIOOther", "TipIOOther"), + new itemheaderTip("TitleIOOtherBytes", "TipIOOtherBytes"), + new itemheaderTip("TitleIORead", "TipIORead"), + new itemheaderTip("TitleIOReadBytes", "TipIOReadBytes"), + new itemheaderTip("TitleIOWrite", "TipIOWrite"), + new itemheaderTip("TitleIOWriteBytes", "TipIOWriteBytes"), + }; + private class itemheaderTag + { + public string tip; + public bool needAutoSize; + } + + public string ProcessListDetailsGetHeaderTip(string name) + { + foreach (itemheaderTip t in detailsHeaderTips) + { + if (t.herdername == name) + return LanuageMgr.GetStr(t.name); + } + return null; + } + public void ProcessListDetailsAddHeader(string name, int width = -1) + { + itemheaderTag t = new itemheaderTag(); + ColumnHeader li = new ColumnHeader(); + li.Name = name; + li.Text = LanuageMgr.GetStr(name, false); + if (width == -1) + { + t.needAutoSize = true; + width = 100; + } + else t.needAutoSize = false; + li.Width = width; + string tip = ProcessListDetailsGetHeaderTip(name); + if (ProcessListDetailsIsMumberColumn(name)) + li.TextAlign = HorizontalAlignment.Right; + listProcessDetals.Columns.Add(li); + + if (tip != null) t.tip = tip; + + li.Tag = t; + } + public int ProcessListDetailsGetListIndex(string name) + { + int rs = -1; + ColumnHeader c = ProcessListDetailsFindHeader(name); + if (c != null) + rs = listProcessDetals.Columns.IndexOf(c); + return rs; + } + public ColumnHeader ProcessListDetailsFindHeader(string name) + { + ColumnHeader rs = null; + foreach (ColumnHeader c in listProcessDetals.Columns) + if (c.Name == name) + { + rs = c; + break; + } + return rs; + } + public void ProcessListDetailsRemoveHeader(string name) + { + ColumnHeader li = ProcessListDetailsFindHeader(name); + if (li != null) listProcessDetals.Columns.Remove(li); + } + + private bool ProcessListDetailsIsDyamicDataColumn(int index) + { + if (index != -1) + { + if (index == colCPUIndex || index == colCPUTimeIndex || index == colCycleIndex + || index == colPeakWorkingSetIndex || index == colWorkingSetIncreasementIndex || index == colWorkingSetIndex + || index == colWorkingSetPrivateIndex || index == colWorkingSetShareIndex || index == colCommitedSizeIndex + || index == colPagedPoolIndex || index == colHandleCountIndex + || index == colNonPagedPoolIndex || index == colPageErrorIndex || index == colPageErrorIncreasementIndex + || index == colThreadCountIndex || index == colGDIObjectIndex || index == colUserObjectIndex + || index == colIOOtherBytesIndex || index == colIOWriteBytesIndex || index == colIOReadBytesIndex + || index == colIOOtherIndex || index == colIOWriteIndex || index == colIOReadIndex) + return true; + } + return false; + } + private bool ProcessListDetailsIsMumberColumn(string name) + { + if (name != "") + { + foreach (string i in numberCols) + if (i == name) + return true; + } + return false; + } + public bool ProcessListDetailsIsStringColumn(int index) + { + if (index != -1) + { + if (index == colNameIndex || index == colPackageNameIndex || index == colStateIndex + || index == colCPUTimeIndex || index == colPathIndex || index == colCommandLineIndex + || index == colPlatformIndex || index == colOSContextIndex || index == colDescriptionIndex + || index == colDepIndex || index == colUACVIndex || index == colUserNameIndex) + return true; + } + return false; + } + public void ProcessListDetailsGetColumnsIndex() + { + //加载所有列表头的åºå· + colPPIDIndex = ProcessListDetailsGetListIndex("TitleParentPID"); + colPIDIndex = ProcessListDetailsGetListIndex("TitlePID"); + colPackageNameIndex = ProcessListDetailsGetListIndex("TitlePackageName"); + colStateIndex = ProcessListDetailsGetListIndex("TitleStatus"); + colSessionIDIndex = ProcessListDetailsGetListIndex("TitleSessionID"); + colJobIDIndex = ProcessListDetailsGetListIndex("TitleJobID"); + colCPUIndex = ProcessListDetailsGetListIndex("TitleCPU"); + colCPUTimeIndex = ProcessListDetailsGetListIndex("TitleCPUTime"); + colCycleIndex = ProcessListDetailsGetListIndex("TitleCycle"); + colPeakWorkingSetIndex = ProcessListDetailsGetListIndex("TitlePeakWorkingSet"); + colWorkingSetIncreasementIndex = ProcessListDetailsGetListIndex("TitleWorkingSetCrease"); + colWorkingSetIndex = ProcessListDetailsGetListIndex("TitleWorkingSet"); + colWorkingSetPrivateIndex = ProcessListDetailsGetListIndex("TitleWorkingSetPrivate"); + colWorkingSetShareIndex = ProcessListDetailsGetListIndex("TitleWorkingSetShare"); + colCommitedSizeIndex = ProcessListDetailsGetListIndex("TitleCommited"); + colPagedPoolIndex = ProcessListDetailsGetListIndex("TitlePagedPool"); + colNonPagedPoolIndex = ProcessListDetailsGetListIndex("TitleNonPagedPool"); + colPageErrorIndex = ProcessListDetailsGetListIndex("TitlePagedError"); + colPageErrorIncreasementIndex = ProcessListDetailsGetListIndex("TitlePagedErrorCrease"); + colHandleCountIndex = ProcessListDetailsGetListIndex("TitleHandleCount"); + colThreadCountIndex = ProcessListDetailsGetListIndex("TitleThreadCount"); + colUserObjectIndex = ProcessListDetailsGetListIndex("TitleUserObject"); + colGDIObjectIndex = ProcessListDetailsGetListIndex("TitleGdiObject"); + colIOReadIndex = ProcessListDetailsGetListIndex("TitleIORead"); + colIOWriteIndex = ProcessListDetailsGetListIndex("TitleIOWrite"); + colIOOtherIndex = ProcessListDetailsGetListIndex("TitleIOOther"); + colIOReadBytesIndex = ProcessListDetailsGetListIndex("TitleIOReadBytes"); + colIOWriteBytesIndex = ProcessListDetailsGetListIndex("TitleIOWriteBytes"); + colIOOtherBytesIndex = ProcessListDetailsGetListIndex("TitleIOOtherBytes"); + colPathIndex = ProcessListDetailsGetListIndex("TitleProcPath"); + colCommandLineIndex = ProcessListDetailsGetListIndex("TitleCmdLine"); + colPlatformIndex = ProcessListDetailsGetListIndex("TitlePlatform"); + colOSContextIndex = ProcessListDetailsGetListIndex("TitleOperationSystemContext"); + colDescriptionIndex = ProcessListDetailsGetListIndex("TitleDescription"); + colDepIndex = ProcessListDetailsGetListIndex("TitleDEP"); + colUACVIndex = ProcessListDetailsGetListIndex("TitleUACVirtualization"); + colNameIndex = ProcessListDetailsGetListIndex("TitleProcName"); + colUserNameIndex = ProcessListDetailsGetListIndex("TitleUserName"); + colEprocessIndex = ProcessListDetailsGetListIndex("TitleEProcess"); + + } + private void ProcessListDetailsSaveColumns() + { + if (listProcessDetals.Columns.Count > 0) + { + string finalString = ""; + ColumnHeader currentColumn = null; + for (int i = listProcessDetals.Columns.Count - 1; i >= 0; i--) + { + currentColumn = null; + foreach (ColumnHeader li in listProcessDetals.Columns) + if (li.DisplayIndex == i) + { + currentColumn = li; + break; + } + if (currentColumn != null) + finalString = currentColumn.Name + "-" + currentColumn.Width + "#" + finalString; + } + SetConfig("DetalHeaders", "AppSetting", finalString); + SetConfig("DetalSort", "AppSetting", listViewItemComparerProcDetals.SortColumn + "#" + (listViewItemComparerProcDetals.Asdening ? "Asdening" : "Descending")); + } + } + private void ProcessListDetailsLoadColumns() + { + hListHeader = ComCtlApi.MListViewGetHeaderControl(listProcessDetals.Handle); + //加载列表头 + if (listProcessDetals.Columns.Count > 0) listProcessDetals.Columns.Clear(); + string headersStr = GetConfig("DetalHeaders", "AppSetting"); + if (headersStr == "") headersStr = "TitleProcName-190#TitlePID-55#TitleStatus-55#TitleUserName-70#TitleCPU-60#TitleWorkingSetPrivate-70#TitleDescription-400#"; + string[] headers = headersStr.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < headers.Length && i < 16; i++) + ProcessListDetailsAddColumns(headers[i]); + + ProcessListDetailsGetColumnsIndex(); + if (colNameIndex == -1) + { + ProcessListDetailsAddColumns("TitleProcName-130"); + colNameIndex = ProcessListDetailsGetListIndex("TitleProcName"); + } + + string sortInfo = GetConfig("DetalSort", "AppSetting"); + if (sortInfo.Contains("#")) + { + string[] sortInfo2 = sortInfo.Split('#'); + if (sortInfo.Length >= 2) + { + int col = 0; + int.TryParse(sortInfo2[0], out col); + if (col >= 0 && col < listProcessDetals.Columns.Count) + listViewItemComparerProcDetals.SortColumn = col; + if (sortInfo2[1] == "Asdening") listViewItemComparerProcDetals.Asdening = true; + else if (sortInfo2[1] == "Descending") listViewItemComparerProcDetals.Asdening = false; + ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, listViewItemComparerProcDetals.Asdening, false); + } + } + } + private void ProcessListDetailsAddColumns(string s) + { + string sname = s; int width = 70; + if (s.Contains("-")) + { + string[] ss = s.Split('-'); + sname = ss[0]; + if (ss.Length >= 2) + int.TryParse(ss[1], out width); + } + if (width > 1024 || width <= 0) width = 70; + if (s.Trim() != "") ProcessListDetailsAddHeader(sname, width); + } + + private void éšè—列ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (colLastDown != -1) + { + listProcessDetals.Columns.Remove(listProcessDetals.Columns[colLastDown]); + colLastDown = -1; + ProcessListDetailsGetColumnsIndex(); + } + } + private void 选择列ToolStripMenuItem_Click(object sender, EventArgs e) + { + new FormDetalsistHeaders(FormMain).ShowDialog(); + } + private void 将此列调整为åˆé€‚大å°ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (colLastDown != -1) + listProcessDetals.AutoResizeColumn(colLastDown, ColumnHeaderAutoResizeStyle.ColumnContent); + } + + private int listProcessDetals_lastEnterColumn = -1; + + private void listProcessDetals_ColumnClick(object sender, ColumnClickEventArgs e) + { + colLastDown = e.Column; + if (listViewItemComparerProcDetals.SortColumn != e.Column) + { + ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, false, true); + listViewItemComparerProcDetals.SortColumn = e.Column; + listViewItemComparerProcDetals.Asdening = true; + ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, + listViewItemComparerProcDetals.Asdening, false); + } + else + { + listViewItemComparerProcDetals.Asdening = !listViewItemComparerProcDetals.Asdening; + ComCtlApi.MListViewSetColumnSortArrow(hListHeader, listViewItemComparerProcDetals.SortColumn, + listViewItemComparerProcDetals.Asdening, false); + } + listProcessDetals.Sort(); + } + private void listProcessDetals_ColumnMouseMove(object sender, int index, Point p) + { + if (index > 0 && index < listProcessDetals.Columns.Count) + { + if (index != listProcessDetals_lastEnterColumn) + { + listProcessDetals_lastEnterColumn = index; + ColumnHeader col = listProcessDetals.Columns[index]; + if (col.Tag != null) + { + colsTip.Show(((itemheaderTag)col.Tag).tip, listProcessDetals, p.X, p.Y + 3, 5000); + } + else + { + listProcessDetals_lastEnterColumn = -1; + colsTip.Hide(listProcessDetals); + } + } + } + else + { + listProcessDetals_lastEnterColumn = -1; + colsTip.Hide(listProcessDetals); + } + } + private void listProcessDetals_ColumnReordered(object sender, ColumnReorderedEventArgs e) + { + nextUpdateStaticVals = true; + } + + private ListViewItemComparerProcDetals listViewItemComparerProcDetals = null; + private class ListViewItemComparerProcDetals : IComparer + { + public ListViewItemComparerProcDetals(MainPageProcessDetails m) + { + formMain = m; + } + + private MainPageProcessDetails formMain; + + public int SortColumn { get; set; } + public bool Asdening { get; set; } = false; + + public int Compare(object o1, object o2) + { + ListViewItem x = o1 as ListViewItem, y = o2 as ListViewItem; + int returnVal = -1; + if (x.SubItems[SortColumn].Text == y.SubItems[SortColumn].Text) return -1; + if (formMain.ProcessListDetailsIsStringColumn(SortColumn)) + { + returnVal = String.Compare(((ListViewItem)x).SubItems[SortColumn].Text, ((ListViewItem)y).SubItems[SortColumn].Text); + } + else + { + UInt64 xi, yi; + if (UInt64.TryParse(x.SubItems[SortColumn].Text, out xi) && UInt64.TryParse(y.SubItems[SortColumn].Text, out yi)) + { + if (x.SubItems[SortColumn].Text == y.SubItems[SortColumn].Text) returnVal = 0; + else if (xi > yi) returnVal = 1; + else if (xi < yi) returnVal = -1; + } + } + if (Asdening) returnVal = -returnVal; + return returnVal; + } + } + + + #endregion + } +} diff --git a/TaskMgr/Main/MainPageScMgr.cs b/TaskMgr/Main/MainPageScMgr.cs new file mode 100644 index 0000000..4269f2f --- /dev/null +++ b/TaskMgr/Main/MainPageScMgr.cs @@ -0,0 +1,334 @@ +using PCMgr.Aero.TaskDialog; +using PCMgr.Helpers; +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.Main.MainUtils; +using static PCMgr.NativeMethods; + +namespace PCMgr.Main +{ + class MainPageScMgr : MainPage + { + private ListView listService; + + public MainPageScMgr(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageScCtl) + { + listService = formMain.listService; + } + + protected override void OnLoadControlEvents() + { + FormMain.linkRebootAsAdmin.LinkClicked += linkRebootAsAdmin_LinkClicked; + FormMain.linkOpenScMsc.LinkClicked += linkOpenScMsc_LinkClicked; + listService.ColumnClick += listService_ColumnClick; + listService.KeyDown += listService_KeyDown; + listService.MouseClick += listService_MouseClick; + + base.OnLoadControlEvents(); + } + protected override void OnLoad() + { + mainSettings = FormMain.MainSettings; + base.OnLoad(); + } + + //æœåŠ¡ç®¡ç† + + private class ListViewItemComparer : IComparer + { + public int SortColum { get; set; } + public bool Asdening { get; set; } = false; + + public int Compare(object x, object y) + { + int returnVal = -1; + if (((ListViewItem)x).SubItems[SortColum].Text == ((ListViewItem)y).SubItems[SortColum].Text) return -1; + returnVal = String.Compare(((ListViewItem)x).SubItems[SortColum].Text, ((ListViewItem)y).SubItems[SortColum].Text); + if (Asdening) returnVal = -returnVal; + return returnVal; + } + } + + private MainSettings mainSettings = null; + private ListViewItemComparer listViewItemComparerSc = new ListViewItemComparer(); + private List scValidPid = new List(); + private List runningSc = new List(); + private Icon icoSc = null; + private Dictionary scGroupFriendlyName = new Dictionary(); + private bool scCanUse = false; + private IntPtr hListHeaderSc = IntPtr.Zero; + + public Icon IcoSc { get { return icoSc; } } + public List ScValidPid { get { return scValidPid; } } + public bool ScCanUse { get { return scCanUse; } } + + public string ScGroupNameToFriendlyName(string s) + { + string rs = s; + if (LanuageMgr.IsChinese) + { + if (s != null) + if (!scGroupFriendlyName.TryGetValue(s, out rs)) + rs = s; + } + return rs; + } + public bool ScMgrFindRunSc(PsItem p) + { + bool rs = false; + if (p != null) + { + foreach (ScItem r in runningSc) + { + if (r.pid == p.pid) + { + p.svcs.Add(r); + rs = true; + } + } + } + return rs; + } + public string ScMgrFindDriverSc(string driverOrgPath) + { + string rs = ""; + foreach (ListViewItem li in listService.Items) + { + if (li.SubItems[7].Text == driverOrgPath) + { + rs = li.Text; + break; + } + } + return rs; + } + public void ScMgrInit() + { + if (!Inited) + { + Inited = true; + + if (!MIsRunasAdmin()) + { + listService.Hide(); + FormMain.pl_ScNeedAdminTip.Show(); + } + else + { + scGroupFriendlyName.Add("localService", LanuageMgr.GetStr("LocalService")); + scGroupFriendlyName.Add("LocalService", LanuageMgr.GetStr("LocalService")); + scGroupFriendlyName.Add("LocalSystem", LanuageMgr.GetStr("LocalSystem")); + scGroupFriendlyName.Add("LocalSystemNetworkRestricted", LanuageMgr.GetStr("LocalSystemNetworkRestricted")); + scGroupFriendlyName.Add("LocalServiceNetworkRestricted", LanuageMgr.GetStr("LocalServiceNetworkRestricted")); + scGroupFriendlyName.Add("LocalServiceNoNetwork", LanuageMgr.GetStr("LocalServiceNoNetwork")); + scGroupFriendlyName.Add("LocalServiceAndNoImpersonation", LanuageMgr.GetStr("LocalServiceAndNoImpersonation")); + scGroupFriendlyName.Add("NetworkServiceAndNoImpersonation", LanuageMgr.GetStr("NetworkServiceAndNoImpersonation")); + scGroupFriendlyName.Add("NetworkService", LanuageMgr.GetStr("NetworkService")); + scGroupFriendlyName.Add("NetworkServiceNetworkRestricted", LanuageMgr.GetStr("NetworkServiceNetworkRestricted")); + scGroupFriendlyName.Add("UnistackSvcGroup", LanuageMgr.GetStr("UnistackSvcGroup")); + scGroupFriendlyName.Add("NetSvcs", LanuageMgr.GetStr("NetworkService")); + scGroupFriendlyName.Add("netsvcs", LanuageMgr.GetStr("NetworkService")); + + MAppWorkCall3(182, listService.Handle, IntPtr.Zero); + + if (!MSCM_Init()) + TaskDialog.Show(LanuageMgr.GetStr("StartSCMFailed", false), LanuageFBuffers.Str_ErrTitle, "", TaskDialogButton.OK, TaskDialogIcon.Stop); + + NativeBridge.scMgrEnumServicesCallBack = ScMgrIEnumServicesCallBack; + NativeBridge.scMgrEnumServicesCallBackPtr = Marshal.GetFunctionPointerForDelegate(NativeBridge.scMgrEnumServicesCallBack); + + scCanUse = true; + ScMgrRefeshList(); + + } + + icoSc = new Icon(Properties.Resources.icoService, 16, 16); + + listService.ListViewItemSorter = listViewItemComparerSc; + hListHeaderSc = ComCtlApi.MListViewGetHeaderControl(listService.Handle, false); + + + } + } + public void ScMgrRefeshList() + { + if (scCanUse) + { + scValidPid.Clear(); + runningSc.Clear(); + listService.Items.Clear(); + MEnumServices(NativeBridge.scMgrEnumServicesCallBackPtr); + FormMain.lbServicesCount.Text = LanuageMgr.GetStr("ServiceCount") + " : " + (listService.Items.Count == 0 ? "--" : listService.Items.Count.ToString()); + } + } + private void ScMgrIEnumServicesCallBack(IntPtr dspName, IntPtr scName, uint scType, uint currentState, uint dwProcessId, bool syssc, + uint dwStartType, IntPtr lpBinaryPathName, IntPtr lpLoadOrderGroup) + { + ListViewItem li = new ListViewItem(Marshal.PtrToStringUni(scName)); + ScTag t = new ScTag(); + t.name = li.Text; + t.runningState = currentState; + t.startType = scType; + t.binaryPathName = Marshal.PtrToStringUni(lpBinaryPathName); + li.SubItems.Add(dwProcessId == 0 ? "" : dwProcessId.ToString()); + li.Tag = t; + if (dwProcessId != 0) + { + scValidPid.Add(dwProcessId); + runningSc.Add(new ScItem(Convert.ToInt32(dwProcessId), Marshal.PtrToStringUni(lpLoadOrderGroup), Marshal.PtrToStringUni(scName), Marshal.PtrToStringUni(dspName))); + } + li.SubItems.Add(Marshal.PtrToStringUni(dspName)); + switch (currentState) + { + case 0x0001: + case 0x0003: li.SubItems.Add(LanuageFBuffers.Str_StatusStoppeed); break; + case 0x0002: + case 0x0004: li.SubItems.Add(LanuageFBuffers.Str_StatusRunning); break; + case 0x0006: + case 0x0007: li.SubItems.Add(LanuageFBuffers.Str_StatusPaused); break; + default: li.SubItems.Add(""); break; + } + li.SubItems.Add(Marshal.PtrToStringUni(lpLoadOrderGroup)); + switch (dwStartType) + { + case 0x0000: li.SubItems.Add(LanuageFBuffers.Str_DriverLoad); break; + case 0x0001: li.SubItems.Add(LanuageFBuffers.Str_DriverLoad); break; + case 0x0002: li.SubItems.Add(LanuageFBuffers.Str_AutoStart); break; + case 0x0003: li.SubItems.Add(LanuageFBuffers.Str_DemandStart); break; + case 0x0004: li.SubItems.Add(LanuageFBuffers.Str_Disabled); break; + case 0x0080: li.SubItems.Add(""); break; + default: li.SubItems.Add(""); break; + } + switch (scType) + { + case 0x0002: li.SubItems.Add(LanuageFBuffers.Str_FileSystem); break; + case 0x0001: li.SubItems.Add(LanuageFBuffers.Str_KernelDriver); break; + case 0x0010: li.SubItems.Add(LanuageFBuffers.Str_UserService); break; + case 0x0020: li.SubItems.Add(LanuageFBuffers.Str_SystemService); break; + default: li.SubItems.Add(""); break; + } + + string path = Marshal.PtrToStringUni(lpBinaryPathName); + if (!MFM_FileExist(path)) + { + StringBuilder spath = new StringBuilder(260); + if (MCommandLineToFilePath(path, spath, 260)) + path = spath.ToString(); + } + + bool hightlight = false; + if (!string.IsNullOrEmpty(path) && MFM_FileExist(path)) + { + li.SubItems.Add(path); + StringBuilder exeCompany = new StringBuilder(256); + if (MGetExeCompany(path, exeCompany, 256)) + { + li.SubItems.Add(exeCompany.ToString()); + if (mainSettings.HighlightNoSystem && exeCompany.ToString() != ConstVals.MICROSOFT) + hightlight = true; + } + else if (mainSettings.HighlightNoSystem) hightlight = true; + } + else + { + li.SubItems.Add(path); + li.SubItems.Add(LanuageFBuffers.Str_FileNotExist); + if (mainSettings.HighlightNoSystem) hightlight = true; + } + if (hightlight) + { + li.ForeColor = Color.Blue; + foreach (ListViewItem.ListViewSubItem s in li.SubItems) + s.ForeColor = Color.Blue; + } + listService.Items.Add(li); + } + public void ScMgrRemoveInvalidItem(string targetName) + { + if (Inited && targetName != "") + { + ListViewItem target = null; + foreach (ListViewItem li in listService.Items) + { + if (li.Text == targetName) + { + target = li; + break; + } + } + if (target != null) + listService.Items.Remove(target); + } + } + public void ScMgrGoToService(string targetName) + { + FormMain.tabControlMain.SelectedTab = Page; + foreach (ListViewItem it in listService.Items) + { + if (it.Text == targetName) + { + int i = listService.Items.IndexOf(it); + listService.EnsureVisible(i); + it.Selected = true; + } + else it.Selected = false; + } + } + + private void listService_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Apps) + { + if (listService.SelectedItems.Count > 0) + { + ListViewItem item = listService.SelectedItems[0]; + Point p = item.Position; p.X = 0; + p = listService.PointToScreen(p); + ScTag t = item.Tag as ScTag; + MSCM_ShowMenu(Handle, t.name, t.runningState, t.startType, t.binaryPathName, p.X, p.Y); + } + } + } + private void listService_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (listService.SelectedItems.Count > 0) + { + ListViewItem item = listService.SelectedItems[0]; + ScTag t = item.Tag as ScTag; + MSCM_ShowMenu(Handle, t.name, t.runningState, t.startType, t.binaryPathName, 0, 0); + } + } + } + private void listService_ColumnClick(object sender, ColumnClickEventArgs e) + { + ((ListViewItemComparer)listService.ListViewItemSorter).Asdening = !((ListViewItemComparer)listService.ListViewItemSorter).Asdening; + ((ListViewItemComparer)listService.ListViewItemSorter).SortColum = e.Column; + ComCtlApi.MListViewSetColumnSortArrow(hListHeaderSc, ((ListViewItemComparer)listService.ListViewItemSorter).SortColum, + ((ListViewItemComparer)listService.ListViewItemSorter).Asdening, false); + listService.Sort(); + } + + private void linkRebootAsAdmin_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + MAppRebotAdmin2("select services"); + } + private void linkOpenScMsc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + MFM_OpenFile("services.msc", Handle); + } + + + + } +} diff --git a/TaskMgr/Main/MainPageStartMgr.cs b/TaskMgr/Main/MainPageStartMgr.cs new file mode 100644 index 0000000..6ad02ba --- /dev/null +++ b/TaskMgr/Main/MainPageStartMgr.cs @@ -0,0 +1,375 @@ +using PCMgr.Ctls; +using PCMgr.Lanuages; +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.NativeMethods; +using PCMgr.Helpers; + +namespace PCMgr.Main +{ + class MainPageStartMgr : MainPage + { + private TaskMgrList listStartup; + private MainSettings mainSettings = null; + + public MainPageStartMgr(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageStartCtl) + { + listStartup = formMain.listStartup; + } + + protected override void OnLoadControlEvents() + { + listStartup.MouseClick += listStartup_MouseClick; + listStartup.KeyDown += listStartup_KeyDown; + listStartup.Header.CloumClick += listStartup_Header_CloumClick; + + base.OnLoadControlEvents(); + } + protected override void OnLoad() + { + mainSettings = FormMain.MainSettings; + base.OnLoad(); + } + + //å¯åŠ¨é¡¹ 页é¢ï¼ˆå€Ÿé‰´äº†PCHunter) + + private TaskMgrListItemGroup knowDlls = null; + private TaskMgrListItemGroup rightMenu1 = null; + private TaskMgrListItemGroup rightMenu2 = null; + private TaskMgrListItemGroup rightMenu3 = null; + private TaskMgrListItemGroup printMonitors = null; + private TaskMgrListItemGroup printProviders = null; + + private MainPageUwpMgr.TaskListViewUWPColumnSorter startColumnSorter = new MainPageUwpMgr.TaskListViewUWPColumnSorter(); + private static uint startId = 0; + + private struct startitem + { + public uint id; + public startitem(string s, IntPtr rootregpath, string path, string valuename) + { + this.filepath = s; this.rootregpath = rootregpath; + this.path = path; + this.valuename = valuename; + id = startId++; + } + public string valuename; + public string path; + public string filepath; + public IntPtr rootregpath; + } + public void StartMListInit() + { + if (!Inited) + { + StartMListLoadCols(); + + listStartup.Header.Height = 36; + listStartup.ReposVscroll(); + listStartup.ListViewItemSorter = startColumnSorter; + + NativeBridge.enumStartupsCallBack = StartMList_CallBack; + NativeBridge.enumStartupsCallBackPtr = Marshal.GetFunctionPointerForDelegate(NativeBridge.enumStartupsCallBack); + + knowDlls = new TaskMgrListItemGroup("Know Dlls"); + knowDlls.Text = "Know Dlls"; + knowDlls.Icon = Properties.Resources.icoFiles; + for (int i = 0; i < 5; i++) + knowDlls.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + knowDlls.Type = TaskMgrListItemType.ItemGroup; + knowDlls.DisplayChildCount = true; + rightMenu1 = new TaskMgrListItemGroup("RightMenu 1"); + rightMenu1.Text = "RightMenu 1"; + for (int i = 0; i < 5; i++) + rightMenu1.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + rightMenu1.Type = TaskMgrListItemType.ItemGroup; + rightMenu1.DisplayChildCount = true; + rightMenu1.Image = Properties.Resources.iconContextMenu; + rightMenu2 = new TaskMgrListItemGroup("RightMenu 2"); + rightMenu2.Text = "RightMenu 2"; + for (int i = 0; i < 5; i++) + rightMenu2.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + rightMenu2.Type = TaskMgrListItemType.ItemGroup; + rightMenu2.DisplayChildCount = true; + rightMenu2.Image = Properties.Resources.iconContextMenu; + rightMenu3 = new TaskMgrListItemGroup("RightMenu 3"); + rightMenu3.Text = "RightMenu 3"; + for (int i = 0; i < 5; i++) + rightMenu3.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + rightMenu3.Type = TaskMgrListItemType.ItemGroup; + rightMenu3.DisplayChildCount = true; + rightMenu3.Image = Properties.Resources.iconContextMenu; + + printMonitors = new TaskMgrListItemGroup("PrintMonitors"); + printMonitors.Text = "PrintMonitors"; + for (int i = 0; i < 5; i++) + printMonitors.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + printMonitors.Type = TaskMgrListItemType.ItemGroup; + printMonitors.DisplayChildCount = true; + printMonitors.Icon = Properties.Resources.icoWins; + + printProviders = new TaskMgrListItemGroup("PrintProviders"); + printProviders.Text = "PrintProviders"; + for (int i = 0; i < 5; i++) + printProviders.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + printProviders.Type = TaskMgrListItemType.ItemGroup; + printProviders.DisplayChildCount = true; + printProviders.Icon = Properties.Resources.icoWins; + + Inited = true; + + StartMListRefesh(); + + } + } + public void StartMListRefesh() + { + knowDlls.Childs.Clear(); + rightMenu2.Childs.Clear(); + rightMenu1.Childs.Clear(); + listStartup.Items.Clear(); + startId = 0; + + MEnumStartups(NativeBridge.enumStartupsCallBackPtr); + + if (knowDlls.Childs.Count > 0) listStartup.Items.Add(knowDlls); + if (rightMenu1.Childs.Count > 0) listStartup.Items.Add(rightMenu1); + if (rightMenu2.Childs.Count > 0) listStartup.Items.Add(rightMenu2); + if (rightMenu3.Childs.Count > 0) listStartup.Items.Add(rightMenu3); + if (printMonitors.Childs.Count > 0) listStartup.Items.Add(printMonitors); + if (printProviders.Childs.Count > 0) listStartup.Items.Add(printProviders); + } + private void StartMList_CallBack(IntPtr name, IntPtr type, IntPtr path, IntPtr rootregpath, IntPtr regpath, IntPtr regvalue) + { + bool settoblue = false; + TaskMgrListItem li = new TaskMgrListItem(Marshal.PtrToStringUni(name)); + for (int i = 0; i < 5; i++) li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem() { Font = listStartup.Font }); + li.IsFullData = true; + li.SubItems[0].Text = li.Text; + // li.SubItems[1].Text = Marshal.PtrToStringUni(type); + li.Type = TaskMgrListItemType.ItemMain; + StringBuilder filePath = null; + if (path != IntPtr.Zero) + { + string pathstr = Marshal.PtrToStringUni(path); + if (!pathstr.StartsWith("\"")) { pathstr = "\"" + pathstr + "\""; } + li.SubItems[1].Text = (pathstr); + filePath = new StringBuilder(260); + if (MCommandLineToFilePath(pathstr, filePath, 260)) + { + li.SubItems[2].Text = filePath.ToString(); + pathstr = filePath.ToString(); + if (MFM_FileExist(pathstr)) + { + li.Icon = Icon.FromHandle(MGetExeIcon(pathstr)); + StringBuilder exeCompany = new StringBuilder(256); + if (MGetExeCompany(pathstr, exeCompany, 256)) + { + li.SubItems[3].Text = exeCompany.ToString(); + if (mainSettings.HighlightNoSystem && li.SubItems[3].Text != ConstVals.MICROSOFT) + settoblue = true; + } + else if (mainSettings.HighlightNoSystem) + settoblue = true; + } + else if (MFM_FileExist("C:\\WINDOWS\\system32\\" + pathstr)) + { + if (pathstr.EndsWith(".exe")) + li.Icon = Icon.FromHandle(MGetExeIcon(@"C:\Windows\System32\" + pathstr)); + StringBuilder exeCompany = new StringBuilder(256); + if (MGetExeCompany(@"C:\Windows\System32\" + pathstr, exeCompany, 256)) + { + li.SubItems[3].Text = exeCompany.ToString(); + if (mainSettings.HighlightNoSystem && li.SubItems[3].Text != ConstVals.MICROSOFT) + settoblue = true; + } + else if (mainSettings.HighlightNoSystem) + settoblue = true; + } + else if (MFM_FileExist("C:\\WINDOWS\\SysWOW64\\" + pathstr)) + { + if (pathstr.EndsWith(".exe")) + li.Icon = Icon.FromHandle(MGetExeIcon(@"C:\Windows\SysWOW64\" + pathstr)); + StringBuilder exeCompany = new StringBuilder(256); + if (MGetExeCompany(@"C:\Windows\SysWOW64\" + pathstr, exeCompany, 256)) + { + li.SubItems[3].Text = exeCompany.ToString(); + if (mainSettings.HighlightNoSystem && li.SubItems[3].Text != ConstVals.MICROSOFT) + settoblue = true; + } + else if (mainSettings.HighlightNoSystem) + settoblue = true; + } + else if (pathstr.StartsWith("wow64") && pathstr.EndsWith(".dll")) + { +#if !_X64_ + if (!MIs64BitOS()) + { + if (mainSettings.HighlightNoSystem) + settoblue = true; + li.SubItems[3].Text = LanuageFBuffers.Str_FileNotExist; + } +#endif + if (pathstr != "wow64.dll" && pathstr != "wow64cpu.dll" && pathstr != "wow64win.dll") + { + if (mainSettings.HighlightNoSystem) + settoblue = true; + li.SubItems[3].Text = LanuageFBuffers.Str_FileNotExist; + } + } + else + { + if (mainSettings.HighlightNoSystem) + settoblue = true; + li.SubItems[3].Text = LanuageFBuffers.Str_FileNotExist; + } + } + } + + string rootkey = Marshal.PtrToStringUni(MREG_ROOTKEYToStr(rootregpath)); + string regkey = rootkey + "\\" + Marshal.PtrToStringUni(regpath); + string regvalues = Marshal.PtrToStringUni(regvalue); + li.SubItems[4].Text = regkey + "\\" + regvalues; + li.Tag = new startitem(filePath == null ? null : filePath.ToString(), rootregpath, Marshal.PtrToStringUni(regpath), regvalues); + + string typestr = Marshal.PtrToStringUni(type); + if (typestr == "KnownDLLs") + { + li.Image = FormMain.imageListFileTypeList.Images[".dll"]; + knowDlls.Childs.Add(li); + } + else if (typestr == "RightMenu1") + rightMenu1.Childs.Add(li); + else if (typestr == "RightMenu2") + rightMenu2.Childs.Add(li); + else if (typestr == "RightMenu3") + rightMenu3.Childs.Add(li); + else if (typestr == "PrintMonitors") + printMonitors.Childs.Add(li); + else if (typestr == "PrintProviders") + printProviders.Childs.Add(li); + + else listStartup.Items.Add(li); + if (settoblue) + for (int i = 0; i < 5; i++) + li.SubItems[i].ForeColor = Color.Blue; + } + public void StartMListRemoveItem(uint id) + { + TaskMgrListItem target = null; + foreach (TaskMgrListItem li in listStartup.Items) + { + if (li.Tag != null) + { + startitem item = (startitem)li.Tag; + if (item.id == id) + { + target = li; + break; + } + } + } + if (target != null) + { + listStartup.Items.Remove(target); + listStartup.SyncItems(true); + } + } + private void StartMListLoadCols() + { + TaskMgrListHeaderItem li = new TaskMgrListHeaderItem(); + li.TextSmall = LanuageMgr.GetStr("TitleName", false); + li.Width = 200; + listStartup.Colunms.Add(li); + TaskMgrListHeaderItem li2 = new TaskMgrListHeaderItem(); + li2.TextSmall = LanuageMgr.GetStr("TitleCmdLine", false); + li2.Width = 200; + listStartup.Colunms.Add(li2); + TaskMgrListHeaderItem li3 = new TaskMgrListHeaderItem(); + li3.TextSmall = LanuageMgr.GetStr("TitleFilePath", false); + li3.Width = 200; + listStartup.Colunms.Add(li3); + TaskMgrListHeaderItem li4 = new TaskMgrListHeaderItem(); + li4.TextSmall = LanuageMgr.GetStr("TitlePublisher", false); + li4.Width = 100; + listStartup.Colunms.Add(li4); + TaskMgrListHeaderItem li5 = new TaskMgrListHeaderItem(); + li5.TextSmall = LanuageMgr.GetStr("TitleRegPath", false); + li5.Width = 200; + listStartup.Colunms.Add(li5); + + } + + public void StartMListExpandAll() + { + listStartup.Locked = true; + foreach (TaskMgrListItem li in listStartup.Items) + { + if (li.Childs.Count > 0 && !li.ChildsOpened) + li.ChildsOpened = true; + } + listStartup.Locked = false; + listStartup.SyncItems(true); + } + public void StartMListCollapseAll() + { + listStartup.Locked = true; + foreach (TaskMgrListItem li in listStartup.Items) + { + if (li.Childs.Count > 0 && li.ChildsOpened) + li.ChildsOpened = false; + } + listStartup.Locked = false; + listStartup.SyncItems(true); + } + + private void listStartup_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (listStartup.SelectedItem != null) + { + TaskMgrListItem selectedItem = listStartup.SelectedItem.OldSelectedItem == null ? + listStartup.SelectedItem : listStartup.SelectedItem.OldSelectedItem; + if (selectedItem.Type == TaskMgrListItemType.ItemMain) + { + startitem item = (startitem)selectedItem.Tag; + MStartupsMgr_ShowMenu(item.rootregpath, item.path, item.filepath, item.valuename, item.id, 0, 0); + } + } + } + } + private void listStartup_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Apps) + { + if (listStartup.SelectedItem != null) + { + Point p = listStartup.GetiItemPoint(listStartup.SelectedItem); + p = listStartup.PointToScreen(p); + startitem item = (startitem)listStartup.SelectedItem.Tag; + MStartupsMgr_ShowMenu(item.rootregpath, item.path, item.filepath, item.valuename, item.id, p.X, p.Y); + } + } + } + private void listStartup_Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) + { + if (e.MouseEventArgs.Button == MouseButtons.Left) + { + listStartup.Locked = true; + if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) + startColumnSorter.Order = SortOrder.Ascending; + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) + startColumnSorter.Order = SortOrder.Ascending; + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) + startColumnSorter.Order = SortOrder.Descending; + startColumnSorter.SortColumn = e.Index; + listStartup.Locked = false; + listStartup.Sort(); + } + } + } +} diff --git a/TaskMgr/Main/MainPageUserMgr.cs b/TaskMgr/Main/MainPageUserMgr.cs new file mode 100644 index 0000000..4e4993b --- /dev/null +++ b/TaskMgr/Main/MainPageUserMgr.cs @@ -0,0 +1,242 @@ +using PCMgr.Aero.TaskDialog; +using PCMgr.Ctls; +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.Main.MainUtils; +using static PCMgr.NativeMethods; + +namespace PCMgr.Main +{ + class MainPageUserMgr : MainPage + { + private TaskMgrList listUsers; + + private MainPageProcess mainPageProcess = null; + + public MainPageUserMgr(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageUsers) + { + listUsers = formMain.listUsers; + } + + protected override void OnLoad() + { + mainPageProcess = FormMain.MainPageProcess; + base.OnLoad(); + } + protected override void OnLoadControlEvents() + { + listUsers.KeyDown += listUsers_KeyDown; + listUsers.MouseClick += listUsers_MouseClick; + listUsers.Header.CloumClick += listUsers_Header_CloumClick; + + base.OnLoadControlEvents(); + } + + //ç”¨æˆ·é¡µä»£ç  + + public void UsersListInit() + { + if (!Inited) + { + NativeBridge.enumUsersCallBack = UsersListEnumUsersCallBack; + NativeBridge.enumUsersCallBackCallBack_ptr = Marshal.GetFunctionPointerForDelegate(NativeBridge.enumUsersCallBack); + + if (mainPageProcess.Inited) mainPageProcess.ProcessListRefesh2(); + + listViewItemCompareUsers = new ListViewItemComparerUsers(); + listViewItemCompareUsers.Order = SortOrder.Descending; + + UsersListLoadCols(); + + listUsers.ListViewItemSorter = listViewItemCompareUsers; + listUsers.Colunms[0].ArrowType = TaskMgrListHeaderSortArrow.Descending; + listUsers.Header.Height = 36; + listUsers.ReposVscroll(); + listUsers.DrawIcon = true; + + Inited = true; + + UsersListLoad(); + } + } + public void UsersListUnInit() + { + if (Inited) + { + listUsers.Items.Clear(); + + listViewItemCompareUsers = null; + Inited = false; + } + } + public void UsersListLoad() + { + listUsers.Items.Clear(); + MEnumUsers(NativeBridge.enumUsersCallBackCallBack_ptr, IntPtr.Zero); + listUsers.Sort(); + } + private void UsersListLoadCols() { + TaskMgrListHeaderItem li13 = new TaskMgrListHeaderItem(); + li13.TextSmall = LanuageMgr.GetStr("TitleName", false); + li13.Width = 550; + listUsers.Colunms.Add(li13); + TaskMgrListHeaderItem li14 = new TaskMgrListHeaderItem(); + li14.TextSmall = "ID"; + li14.Width = 50; + listUsers.Colunms.Add(li14); + TaskMgrListHeaderItem li15 = new TaskMgrListHeaderItem(); + li15.TextSmall = LanuageMgr.GetStr("TitleSessionID", false); + li15.Width = 50; + listUsers.Colunms.Add(li15); + TaskMgrListHeaderItem li16 = new TaskMgrListHeaderItem(); + li16.TextSmall = LanuageMgr.GetStr("TitleDomainName", false); + li16.Width = 130; + listUsers.Colunms.Add(li16); + } + private void UsersListAddProcess(TaskMgrListItem li, string userName) + { + //添加用户对应的所有进程 + + List loadedPs = mainPageProcess.GetLoadedPs(); + foreach (PsItem p in loadedPs) + { + if (p.username == userName) + { + TaskMgrListItemChild child = new TaskMgrListItemChild(p.item.Text, p.item.Icon); + if (p.item.IsUWPICO) child.IsUWPICO = true; + li.Childs.Add(child); + } + } + + li.Childs.Sort(listViewItemCompareUsers); + } + + private void listUsers_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Apps) + { + if (listUsers.SelectedItem != null && !listUsers.SelectedItem.IsChildItem && listUsers.SelectedChildItem == null) + { + Point p = listUsers.GetiItemPoint(listUsers.SelectedItem); + p = listUsers.PointToScreen(p); + + MAppWorkCall3(212, new IntPtr(p.X), new IntPtr(p.Y)); + IntPtr str = Marshal.StringToHGlobalUni(listUsers.SelectedItem.SubItems[0].Text); + MAppWorkCall3(170, Handle, str); + Marshal.FreeHGlobal(str); + MAppWorkCall3(175, Handle, new IntPtr((int)(uint)listUsers.SelectedItem.Tag)); + } + } + } + private void listUsers_MouseClick(object sender, MouseEventArgs e) + { + if (listUsers.SelectedItem != null && !listUsers.SelectedItem.IsChildItem && listUsers.SelectedChildItem == null) + { + if (e.Button == MouseButtons.Right) + { + MAppWorkCall3(212, new IntPtr(MousePosition.X), new IntPtr(MousePosition.Y)); + IntPtr str = Marshal.StringToHGlobalUni(listUsers.SelectedItem.SubItems[0].Text); + MAppWorkCall3(170, Handle, str); + Marshal.FreeHGlobal(str); + MAppWorkCall3(175, Handle, new IntPtr((int)(uint)listUsers.SelectedItem.Tag)); + } + } + } + private void listUsers_Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) + { + if (e.MouseEventArgs.Button == MouseButtons.Left && e.Index == 0) + { + listUsers.Locked = true; + if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) + listViewItemCompareUsers.Asdening = true; + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) + listViewItemCompareUsers.Asdening = true; + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) + listViewItemCompareUsers.Asdening = false; + + foreach (TaskMgrListItem li in listUsers.Items) + if (li.Childs.Count > 0) + li.Childs.Sort(listViewItemCompareUsers); + + listUsers.Sort(); + listUsers.Locked = false; + listUsers.Invalidate(); + } + } + + private ListViewItemComparerUsers listViewItemCompareUsers = null; + private class ListViewItemComparerUsers : ListViewColumnSorter + { + public bool Asdening + { + get + { + return Order == SortOrder.Ascending; + } + set + { + if (value) Order = SortOrder.Ascending; + else Order = SortOrder.Descending; + } + } + + + public override int Compare(TaskMgrListItem x, TaskMgrListItem y) + { + int returnVal = -1; + if (x is TaskMgrListItemChild && y is TaskMgrListItemChild) + returnVal = String.Compare(x.Text, y.Text); + else + { + UInt64 xi, yi; + if (UInt64.TryParse(x.SubItems[0].Text, out xi) && UInt64.TryParse(y.SubItems[0].Text, out yi)) + { + if (x.SubItems[0].Text == y.SubItems[0].Text) returnVal = 0; + else if (xi > yi) returnVal = 1; + else if (xi < yi) returnVal = -1; + } + else returnVal = String.Compare(((ListViewItem)x).SubItems[0].Text, ((ListViewItem)y).SubItems[0].Text); + } + if (Asdening) returnVal = -returnVal; + return returnVal; + } + } + + private bool UsersListEnumUsersCallBack(IntPtr userName, uint sessionId, uint userId, IntPtr domain, IntPtr customData) + { + string name = Marshal.PtrToStringUni(userName); + string domainStr = Marshal.PtrToStringUni(domain); + TaskMgrListItem li = new TaskMgrListItem(name); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems[0].Text = name; + li.SubItems[1].Text = userId.ToString(); + li.SubItems[2].Text = sessionId.ToString(); + li.SubItems[3].Text = domainStr; + li.SubItems[0].Font = listUsers.Font; + li.SubItems[1].Font = listUsers.Font; + li.SubItems[2].Font = listUsers.Font; + li.SubItems[3].Font = listUsers.Font; + li.Tag = sessionId; + li.DisplayChildCount = true; + li.IsUWPICO = true; + + UsersListAddProcess(li, name); + + listUsers.Items.Add(li); + return true; + } + + } +} diff --git a/TaskMgr/Main/MainPageUwpMgr.cs b/TaskMgr/Main/MainPageUwpMgr.cs new file mode 100644 index 0000000..bf77c91 --- /dev/null +++ b/TaskMgr/Main/MainPageUwpMgr.cs @@ -0,0 +1,291 @@ +using PCMgr.Aero.TaskDialog; +using PCMgr.Ctls; +using PCMgr.Helpers; +using PCMgr.Lanuages; +using PCMgr.WorkWindow; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +using static PCMgr.Main.MainUtils; +using static PCMgr.NativeMethods; + +namespace PCMgr.Main +{ + class MainPageUwpMgr : MainPage + { + private TaskMgrList listUwpApps; + private Panel pl_UWPEnumFailTip; + private Label lbUWPEnumFailText; + private ContextMenuStrip contextMenuStripUWP; + + public MainPageUwpMgr(FormMain formMain) : base(formMain, (TabPage)formMain.tabPageUWPCtl) + { + listUwpApps = formMain.listUwpApps; + pl_UWPEnumFailTip = formMain.pl_UWPEnumFailTip; + lbUWPEnumFailText = formMain.lbUWPEnumFailText; + contextMenuStripUWP = formMain.contextMenuStripUWP; + } + + protected override void OnLoadControlEvents() + { + listUwpApps.Header.CloumClick += listUwpApps_Header_CloumClick; + listUwpApps.KeyDown += listUwpApps_KeyDown; + listUwpApps.MouseClick += listUwpApps_MouseClick; + + FormMain.打开应用ToolStripMenuItem.Click += 打开应用ToolStripMenuItem_Click; + FormMain.å¸è½½åº”用ToolStripMenuItem.Click += å¸è½½åº”用ToolStripMenuItem_Click; + FormMain.打开安装ä½ç½®ToolStripMenuItem.Click += 打开安装ä½ç½®ToolStripMenuItem_Click; + FormMain.å¤åˆ¶å称ToolStripMenuItem.Click += å¤åˆ¶å称ToolStripMenuItem_Click; + FormMain.å¤åˆ¶å®Œæ•´å称ToolStripMenuItem.Click += å¤åˆ¶å®Œæ•´å称ToolStripMenuItem_Click; + FormMain.å¤åˆ¶å‘布者ToolStripMenuItem.Click += å¤åˆ¶å‘布者ToolStripMenuItem_Click; + + base.OnLoadControlEvents(); + } + + //枚举通用应用 + + public class TaskListViewUWPColumnSorter : ListViewColumnSorter + { + public TaskListViewUWPColumnSorter() + { + } + public override int Compare(TaskMgrListItem x, TaskMgrListItem y) + { + int compareResult = 0; + compareResult = string.Compare(x.SubItems[SortColumn].Text, y.SubItems[SortColumn].Text); + if (compareResult == 0) + compareResult = ObjectCompare.Compare(x.PID, y.PID); + if (Order == SortOrder.Ascending) + return compareResult; + else if (Order == SortOrder.Descending) + return (-compareResult); + return compareResult; + } + } + + private TaskListViewUWPColumnSorter uWPColumnSorter = new TaskListViewUWPColumnSorter(); + public void UWPListRefesh() + { + if (Inited) + { + listUwpApps.Show(); + pl_UWPEnumFailTip.Hide(); + listUwpApps.Items.Clear(); + + if (!M_UWP_EnumUWPApplications()) + { + listUwpApps.Hide(); + pl_UWPEnumFailTip.Show(); + lbUWPEnumFailText.Text = LanuageMgr.GetStr("UWPEnumFail", false); + return; + } + + + int count = M_UWP_GetUWPApplicationsCount(); + for (int i = 0; i < count; i++) + { + UWP_PACKAGE_INFO info = M_UWP_GetUWPApplicationAt((uint)i); + + TaskMgrListItem li = new TaskMgrListItem(info.DisplayName); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem()); + li.SubItems[0].Font = listUwpApps.Font; + li.SubItems[1].Font = listUwpApps.Font; + li.SubItems[2].Font = listUwpApps.Font; + li.SubItems[0].Text = info.DisplayName; + li.SubItems[1].Text = info.AppPackageFullName; + li.SubItems[2].Text = info.InstallPath; + li.SubItems[3].Text = info.AppUserModelId; + li.Tag = info; + li.IsUWPICO = true; + + string iconpath = UWPSearchIcon(info.InstallPath, info.IconPath); + if (iconpath != "" && MFM_FileExist(iconpath)) + { + using (Image img = Image.FromFile(iconpath)) + li.Icon = IconUtils.ConvertToIcon(img); + // li.Image = IconUtils.GetThumbnail(new Bitmap(iconpath), 16, 16); + } + listUwpApps.Items.Add(li); + } + } + } + public void UWPListInit() + { + if (!Inited) + { + listUwpApps.Header.Height = 36; + listUwpApps.ReposVscroll(); + listUwpApps.ListViewItemSorter = uWPColumnSorter; + + Inited = true; + + UWPListLoadCols(); + UWPListRefesh(); + } + } + public void UWPListUnInit() + { + listUwpApps.Items.Clear(); + } + private string UWPSearchIcon(string dir, string logoPath) + { + //Force search + var imageFile = Path.Combine(dir, logoPath); + var name = Path.GetFileName(imageFile); + + if (MFM_FileExist(imageFile)) return imageFile; + var + scaleImage = Path.ChangeExtension(imageFile, "scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "targetsize-16.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "targetsize-24.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "targetsize-44.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "contrast-black.targetsize-44.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "scale-200_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "scale-100_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + imageFile = dir + "\\" + logoPath.Replace(name, "") + "contrast-black\\" + name; + scaleImage = Path.ChangeExtension(imageFile, "scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "contrast-black_scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "scale-200_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "scale-100_contrast-black.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-200.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + scaleImage = Path.ChangeExtension(imageFile, "Theme-Dark_Scale-100.png"); if (MFM_FileExist(scaleImage)) return scaleImage; + + imageFile = Path.Combine(dir, "en-us", logoPath); + if (MFM_FileExist(imageFile)) return imageFile; + return ""; + } + private void UWPListLoadCols() + { + TaskMgrListHeaderItem li8 = new TaskMgrListHeaderItem(); + li8.TextSmall = LanuageMgr.GetStr("TitleName", false); + li8.Width = 300; + listUwpApps.Colunms.Add(li8); + TaskMgrListHeaderItem li10 = new TaskMgrListHeaderItem(); + li10.TextSmall = LanuageMgr.GetStr("TitleFullName", false); + li10.Width = 260; + listUwpApps.Colunms.Add(li10); + TaskMgrListHeaderItem li11 = new TaskMgrListHeaderItem(); + li11.TextSmall = LanuageMgr.GetStr("TitleInstallDir", false); + li11.Width = 260; + listUwpApps.Colunms.Add(li11); + } + + public TaskMgrListItem UWPListFindItem(string fullName) + { + TaskMgrListItem rs = null; + foreach (TaskMgrListItem r in listUwpApps.Items) + if (((UWP_PACKAGE_INFO)r.Tag).AppPackageFullName == fullName) + { + rs = r; + break; + } + return rs; + } + + private void 打开应用ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listUwpApps.SelectedItem != null) + { + UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); + if (pkg.AppUserModelId != "") + { + uint processid = 0; + M_UWP_RunUWPApp(pkg.AppUserModelId, ref processid); + } + } + } + private void å¸è½½åº”用ToolStripMenuItem_Click(object sender, EventArgs e) + { + MRunExe("ms-settings:appsfeatures", null); + } + private void 打开安装ä½ç½®ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listUwpApps.SelectedItem != null) + { + UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); + MFM_OpenFile(pkg.InstallPath, Handle); + } + } + private void å¤åˆ¶å称ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listUwpApps.SelectedItem != null) + { + UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); + MCopyToClipboard2(pkg.DisplayName); + } + } + private void å¤åˆ¶å®Œæ•´å称ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listUwpApps.SelectedItem != null) + { + UWP_PACKAGE_INFO pkg = ((UWP_PACKAGE_INFO)listUwpApps.SelectedItem.Tag); + MCopyToClipboard2(pkg.AppPackageFullName); + } + } + private void å¤åˆ¶å‘布者ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listUwpApps.SelectedItem != null) + { + string s = ""; + for (int i = 0; i < listUwpApps.Colunms.Count; i++) + { + s += " " + listUwpApps.Colunms[i].TextSmall + " : "; + s += listUwpApps.SelectedItem.SubItems[i].Text; + } + MCopyToClipboard2(s); + } + } + + private void listUwpApps_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Apps) + { + if (listUwpApps.SelectedItem != null) + { + Point p = listUwpApps.GetiItemPoint(listUwpApps.SelectedItem); + contextMenuStripUWP.Show(listUwpApps.PointToScreen(p)); + } + } + } + private void listUwpApps_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right && listUwpApps.SelectedItem != null) + contextMenuStripUWP.Show(MousePosition); + } + private void listUwpApps_Header_CloumClick(object sender, TaskMgrListHeader.TaskMgrListHeaderEventArgs e) + { + if (e.MouseEventArgs.Button == MouseButtons.Left) + { + listUwpApps.Locked = true; + if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.None) + uWPColumnSorter.Order = SortOrder.Ascending; + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Ascending) + uWPColumnSorter.Order = SortOrder.Ascending; + else if (e.Item.ArrowType == TaskMgrListHeaderSortArrow.Descending) + uWPColumnSorter.Order = SortOrder.Descending; + + uWPColumnSorter.SortColumn = e.Index; + listUwpApps.Locked = false; + listUwpApps.Sort(); + } + } + } +} diff --git a/TaskMgr/Main/MainSettings.cs b/TaskMgr/Main/MainSettings.cs new file mode 100644 index 0000000..872fa39 --- /dev/null +++ b/TaskMgr/Main/MainSettings.cs @@ -0,0 +1,225 @@ +using System; +using static PCMgr.NativeMethods; +using System.Windows.Forms; +using System.Drawing; +using PCMgr.Ctls; + +namespace PCMgr.Main +{ + class MainSettings + { + private FormMain formMain = null; + + public MainSettings(FormMain formMain) + { + this.formMain = formMain; + } + + private int showHideHotKetId = -1; + + public int GetShowHideHotKetId() { return showHideHotKetId; } + public bool MinHide { get; set; } = false; + public bool CloseHide { get; set; } = false; + public bool HighlightNoSystem { get; private set; } = false; + public bool ShowHiddenFiles { get; private set; } = false; + + public void LoadSettings() + { + ShowHiddenFiles = GetConfigBool("ShowHiddenFiles", "AppSetting"); + HighlightNoSystem = GetConfigBool("HighLightNoSystetm", "Configure", false); + + int iSplitterDistanceperf = 0; + if (int.TryParse(GetConfig("SplitterDistancePerf", "AppSetting", "0"), out iSplitterDistanceperf) && iSplitterDistanceperf > 0) + formMain.splitContainerPerfCtls.SplitterDistance = iSplitterDistanceperf; + + LoadNativeSettings(); + LoadLastPos(); + LoadHotKey(); + } + public void SaveSettings() + { + GetConfig("SplitterDistancePerf", "AppSetting", formMain.splitContainerPerfCtls.SplitterDistance.ToString()); + SetConfigBool("MainGrouping", "AppSetting", formMain.listProcess.ShowGroup); + + if (!formMain.IsSimpleView) + SetConfig("OldSize", "AppSetting", formMain.Width.ToString() + "-" + formMain.Height.ToString()); + else SetConfig("OldSize", "AppSetting", formMain.LastSize.Width.ToString() + "-" + formMain.LastSize.Height.ToString()); + SetConfig("OldPos", "AppSetting", formMain.Left.ToString() + "-" + formMain.Top.ToString()); + SetConfigBool("OldIsMax", "AppSetting", formMain.WindowState == FormWindowState.Maximized); + } + + private void LoadNativeSettings() + { + MFM_SetShowHiddenFiles(ShowHiddenFiles); + MAppWorkCall3(194, IntPtr.Zero, GetConfigBool("TopMost", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); + MAppWorkCall3(195, IntPtr.Zero, GetConfigBool("CloseHideToNotfication", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); + MAppWorkCall3(196, IntPtr.Zero, GetConfigBool("MinHide", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); + MAppWorkCall3(162, IntPtr.Zero, GetConfigBool("MainGrouping", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); + MAppWorkCall3(156, IntPtr.Zero, GetConfigBool("AlwaysOnTop", "AppSetting", false) ? new IntPtr(1) : IntPtr.Zero); + MAppWorkCall3(164, IntPtr.Zero, IntPtr.Zero); + MAppWorkCall3(163, IntPtr.Zero, IntPtr.Zero); + MAppWorkCall3(206, IntPtr.Zero, new IntPtr(GetConfig("TerProcFun", "Configure", "PspTerProc") == "ApcPspTerProc" ? 1 : 0)); + } + private void LoadLastPos() + { + if (GetConfigBool("OldIsMax", "AppSetting")) + formMain.WindowState = FormWindowState.Maximized; + else + { + string p = GetConfig("OldPos", "AppSetting"); + if (p.Contains("-")) + { + string[] pp = p.Split('-'); + try + { + formMain.Left = int.Parse(pp[0]); + formMain.Top = int.Parse(pp[1]); + if (formMain.Left > Screen.PrimaryScreen.Bounds.Width) + formMain.Left = 100; + if (formMain.Top > Screen.PrimaryScreen.Bounds.Height) + formMain.Top = 200; + } + catch { } + } + string sl = GetConfig("OldSizeSimple", "AppSetting", "380-334"); + if (sl.Contains("-")) + { + string[] ss = sl.Split('-'); + try + { + int w = int.Parse(ss[0]); if (w + formMain.Left > Screen.PrimaryScreen.WorkingArea.Width) w = Screen.PrimaryScreen.WorkingArea.Width - formMain.Left; + int h = int.Parse(ss[1]); if (h + formMain.Top > Screen.PrimaryScreen.WorkingArea.Height) h = Screen.PrimaryScreen.WorkingArea.Height - formMain.Top; + formMain.LastSimpleSize = new Size(w, h); + + if (GetConfigBool("SimpleView", "AppSetting", true)) + { + formMain.Width = w; + formMain.Height = h; + } + } + catch { } + } + string s = GetConfig("OldSize", "AppSetting", "780-500"); + if (s.Contains("-")) + { + string[] ss = s.Split('-'); + try + { + int w = int.Parse(ss[0]); if (w + formMain.Left > Screen.PrimaryScreen.WorkingArea.Width) w = Screen.PrimaryScreen.WorkingArea.Width - formMain.Left; + int h = int.Parse(ss[1]); if (h + formMain.Top > Screen.PrimaryScreen.WorkingArea.Height) h = Screen.PrimaryScreen.WorkingArea.Height - formMain.Top; + formMain.LastSize = new Size(w, h); + } + catch { } + } + } + } + private void LoadHotKey() + { + if (GetConfigBool("HotKey", "AppSetting", true)) + { + string k1 = GetConfig("HotKey1", "AppSetting", "(None)"); + string k2 = GetConfig("HotKey2", "AppSetting", "T"); + if (k1 == "(None)") k1 = "None"; + Keys kv1, kv2; + try + { + if (k1 != "(None)") kv1 = (Keys)Enum.Parse(typeof(Keys), k1); + else kv1 = Keys.None; + kv2 = (Keys)Enum.Parse(typeof(Keys), k2); + } + catch (Exception e) + { + LogErr("Invalid hotkey settings : " + e.Message); + kv2 = Keys.T; + kv1 = Keys.Shift; + } + + showHideHotKetId = MAppRegShowHotKey(formMain.Handle, (uint)(int)kv1, (uint)(int)kv2); + MAppWorkCall3(209, formMain.Handle, IntPtr.Zero); + } + } + + //ä¿å­˜å’Œè¯»å–视图列的宽度 + public void LoadListColumnsWidth() + { + string s = GetConfig("ListStartsWidths", "AppSetting", ""); + if (s.Contains("#")) + { + string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < ss.Length && i < formMain.listStartup.Colunms.Count; i++) + { + int width = 0; + if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) + formMain.listStartup.Colunms[i].Width = width; + } + } + s = GetConfig("ListUWPsWidths", "AppSetting", ""); + if (s.Contains("#")) + { + string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < ss.Length && i < formMain.listUwpApps.Colunms.Count; i++) + { + int width = 0; + if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) + formMain.listUwpApps.Colunms[i].Width = width; + } + } + s = GetConfig("ListUsersWidths", "AppSetting", ""); + if (s.Contains("#")) + { + string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < ss.Length && i < formMain.listUsers.Colunms.Count; i++) + { + int width = 0; + if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) + formMain.listUsers.Colunms[i].Width = width; + } + } + s = GetConfig("ListDriversWidths", "AppSetting", ""); + if (s.Contains("#")) + { + string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < ss.Length && i < formMain.listDrivers.Columns.Count; i++) + { + int width = 0; + if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) + formMain.listDrivers.Columns[i].Width = width; + } + } + s = GetConfig("ListServiceWidths", "AppSetting", ""); + if (s.Contains("#")) + { + string[] ss = s.Split(new Char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < ss.Length && i < formMain.listService.Columns.Count; i++) + { + int width = 0; + if (int.TryParse(ss[i], out width) && width > 0 && width < 1000) + formMain.listService.Columns[i].Width = width; + } + } + } + public void SaveListColumnsWidth() + { + string s = ""; + foreach (TaskMgrListHeaderItem he in formMain.listStartup.Colunms) + s += "#" + he.Width; + SetConfig("ListStartsWidths", "AppSetting", s); + s = ""; + foreach (TaskMgrListHeaderItem he in formMain.listUwpApps.Colunms) + s += "#" + he.Width; + SetConfig("ListUWPsWidths", "AppSetting", s); + s = ""; + foreach (TaskMgrListHeaderItem he in formMain.listUsers.Colunms) + s += "#" + he.Width; + SetConfig("ListUsersWidths", "AppSetting", s); + s = ""; + foreach (ColumnHeader he in formMain.listDrivers.Columns) + s += "#" + he.Width; + SetConfig("ListDriversWidths", "AppSetting", s); + s = ""; + foreach (ColumnHeader he in formMain.listService.Columns) + s += "#" + he.Width; + SetConfig("ListServiceWidths", "AppSetting", s); + } + } +} diff --git a/TaskMgr/Main/MainUtils.cs b/TaskMgr/Main/MainUtils.cs new file mode 100644 index 0000000..28d8433 --- /dev/null +++ b/TaskMgr/Main/MainUtils.cs @@ -0,0 +1,138 @@ +using PCMgr.Ctls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PCMgr.Main +{ + static class MainUtils + { + public class PsItem + { + public IntPtr processItem = IntPtr.Zero; + public IntPtr handle; + public uint pid; + public uint ppid; + public string exename; + public string exepath; + public TaskMgrListItem item = null; + public bool isSvchost = false; + public bool isUWP = false; + public bool isWindowShow = false; + public bool isWindowsProcess = false; + public bool isPaused = false; + public bool isHung = false; + + public string username; + + public IntPtr firstHwnd; + + public UwpItem uwpItem = null; + public string uwpFullName; + public bool uwpRealApp = false; + + public bool updateLock = false; + + public override string ToString() + { + return "(" + pid + ") " + exename + " " + exepath; + } + + public PsItem parent = null; + public List childs = new List(); + public List svcs = new List(); + } + public class UwpItem + { + public string uwpInstallDir = ""; + public TaskMgrListItemGroup uwpItem = null; + public string uwpFullName = ""; + public string uwpMainAppDebText = ""; + public IntPtr firstHwnd; + + public override string ToString() + { + return uwpMainAppDebText + " (" + uwpFullName + ")"; + } + } + public class UwpWinItem + { + public IntPtr hWnd = IntPtr.Zero; + public uint ownerPid = 0; + } + public class UwpHostItem + { + public UwpHostItem(UwpItem item, uint pid) + { + this.pid = pid; + this.item = item; + } + + public UwpItem item; + public uint pid; + + public override string ToString() + { + return "(" + pid + ")" + item.ToString(); + } + } + public class ScTag + { + public uint startType = 0; + public uint runningState = 0; + public string name = ""; + public string binaryPathName = ""; + } + public class ScItem + { + public ScItem(int pid, string groupName, string scName, string scDsb) + { + this.scDsb = scDsb; + this.scName = scName; + this.groupName = groupName; + this.pid = pid; + } + public string groupName = ""; + public string scName = ""; + public string scDsb = ""; + public int pid; + } + public class itemheader + { + public itemheader(int index, string name, int wi) + { + this.index = index; + this.name = name; + width = wi; + show = true; + } + + public int width = 0; + public bool show = false; + public int index = 0; + public string name = ""; + } + public struct itemheaderTip + { + public itemheaderTip(string hn, string n) + { + herdername = hn; + name = n; + } + public string herdername; + public string name; + } + public struct itemheaderDef + { + public itemheaderDef(string hn, int width) + { + herdername = hn; + this.width = width; + } + public string herdername; + public int width; + } + } +} diff --git a/TaskMgr/NativeMethods.cs b/TaskMgr/NativeMethods.cs index 41c51aa..738be83 100644 --- a/TaskMgr/NativeMethods.cs +++ b/TaskMgr/NativeMethods.cs @@ -14,6 +14,16 @@ namespace PCMgr /// class NativeMethods { + private static string _cfgFilePath = ""; + + public static string cfgFilePath + { + get + { + if(_cfgFilePath == "") _cfgFilePath = Marshal.PtrToStringUni(M_CFG_GetCfgFilePath()); + return _cfgFilePath; + } + } public static IntPtr Nullptr = new IntPtr(0); public static IntPtr True = new IntPtr(1); @@ -421,13 +431,13 @@ public static bool GetConfigBool(string configkey, string configSection, bool de } public static bool SetConfig(string configkey, string configSection, string configData) { - long OpStation = Win32.WritePrivateProfileString(configSection, configkey, configData, FormMain.cfgFilePath); + long OpStation = Win32.WritePrivateProfileString(configSection, configkey, configData, cfgFilePath); return (OpStation != 0); } public static string GetConfig(string configkey, string configSection, string configDefData = "") { StringBuilder temp = new StringBuilder(1024); - Win32.GetPrivateProfileString(configSection, configkey, configDefData, temp, 1024, FormMain.cfgFilePath); + Win32.GetPrivateProfileString(configSection, configkey, configDefData, temp, 1024, cfgFilePath); return temp.ToString(); } [DllImport(COREDLLNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] diff --git a/TaskMgr/PCMgr32.csproj b/TaskMgr/PCMgr32.csproj index 4427c2e..f89a0ea 100644 --- a/TaskMgr/PCMgr32.csproj +++ b/TaskMgr/PCMgr32.csproj @@ -201,8 +201,10 @@ FormSL.cs + + True @@ -219,7 +221,20 @@ True LanuageResource_zh.resx + + + + + + + + + + + + + @@ -624,6 +639,7 @@ + diff --git a/TaskMgr/PCMgr64.csproj b/TaskMgr/PCMgr64.csproj index 48049e1..c12c966 100644 --- a/TaskMgr/PCMgr64.csproj +++ b/TaskMgr/PCMgr64.csproj @@ -199,8 +199,10 @@ FormSL.cs + + True @@ -217,6 +219,19 @@ True LanuageResource_zh.resx + + + + + + + + + + + + + @@ -611,6 +626,7 @@ + diff --git a/TaskMgr/Program.cs b/TaskMgr/Program.cs index d8bc2d5..3f2ad91 100644 --- a/TaskMgr/Program.cs +++ b/TaskMgr/Program.cs @@ -15,8 +15,7 @@ public static class Program [STAThread] public static void Main(string[]agrs) { - FormMain.cfgFilePath = Marshal.PtrToStringUni(NativeMethods.M_CFG_GetCfgFilePath()); - FormMain.InitLanuage(); + LanuageMgr.InitLanuage(); NativeMethods.MGetPrivileges2(); @@ -49,7 +48,7 @@ private static bool MainRunAgrs(string[] agrs) { case "reboot": { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleReboot"), FormMain.str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleReboot"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); if (t.Show().CommonButton == Result.Yes) { NativeMethods.MGetPrivileges(); @@ -59,7 +58,7 @@ private static bool MainRunAgrs(string[] agrs) } case "shutdown": { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleShutdown"), FormMain.str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("TitleShutdown"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("TitleContinue"), TaskDialogButton.Yes | TaskDialogButton.No, TaskDialogIcon.Warning); if (t.Show().CommonButton == Result.Yes) { NativeMethods.MGetPrivileges(); @@ -150,6 +149,11 @@ private static bool MainRunAgrs(string[] agrs) Application.Run(new WorkWindow.FormTest()); return false; } + case "test2": + { + LanuageMgr.InitLanuage(); + return false; + } case "about": { Application.Run(new WorkWindow.FormAbout()); @@ -166,7 +170,7 @@ private static bool Show64Warn() { if (NativeMethods.GetConfigBool("X32Warning", "AppSetting", true)) { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("X64WarnTitle"), FormMain.str_AppTitle); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("X64WarnTitle"), LanuageFBuffers.Str_AppTitle); t.Content = LanuageMgr.GetStr("X64WarnText"); t.CommonIcon = TaskDialogIcon.Warning; t.VerificationText = LanuageMgr.GetStr("DoNotRemidMeLater"); @@ -187,7 +191,7 @@ private static bool ShowNOADMINWarn() { if (NativeMethods.GetConfigBool("NOAdminWarning", "AppSetting", false)) { - TaskDialog t = new TaskDialog(LanuageMgr.GetStr("NeedAdmin"), FormMain.str_AppTitle, LanuageMgr.GetStr("RequestAdminText")); + TaskDialog t = new TaskDialog(LanuageMgr.GetStr("NeedAdmin"), LanuageFBuffers.Str_AppTitle, LanuageMgr.GetStr("RequestAdminText")); t.CommonIcon = TaskDialogIcon.Warning; t.VerificationText = LanuageMgr.GetStr("DoNotRemidMeLater"); t.VerificationClick += T_TaskDialog_NOADMINWarn_VerificationClick; diff --git a/TaskMgr/WorkWindow/FormCheckFileUse.cs b/TaskMgr/WorkWindow/FormCheckFileUse.cs index 9a106e5..b209f33 100644 --- a/TaskMgr/WorkWindow/FormCheckFileUse.cs +++ b/TaskMgr/WorkWindow/FormCheckFileUse.cs @@ -67,13 +67,13 @@ private void btnRefesh_Click(object sender, EventArgs e) succeed = true; } } - else MessageBox.Show(FormMain.str_filenotexist); + else MessageBox.Show(Lanuages.LanuageFBuffers.Str_FileNotExist); if (!succeed) { btnRelease.Enabled = false; btnReleaseAll.Enabled = false; - MessageBox.Show(FormMain.str_failed); + MessageBox.Show(Lanuages.LanuageFBuffers.Str_Failed); } } @@ -83,8 +83,8 @@ private void btnRelease_Click(object sender, EventArgs e) { IntPtr handle = (IntPtr)listViewUsing.SelectedItems[0].Tag; if (M_SU_CloseHandleWithProcess(handle)) - MessageBox.Show(FormMain.str_UnlockFileSuccess); - else MessageBox.Show(FormMain.str_UnlockFileFailed); + MessageBox.Show(Lanuages.LanuageMgr.GetStr("UnlockFileSuccess")); + else MessageBox.Show(Lanuages.LanuageMgr.GetStr("UnlockFileFailed")); } } @@ -97,7 +97,7 @@ private void btnReleaseAll_Click(object sender, EventArgs e) { IntPtr handle = (IntPtr)listViewUsing.Items[i].Tag; if (!M_SU_CloseHandleWithProcess(handle)) - MessageBox.Show(FormMain.str_UnlockFileFailed + " : " + listViewUsing.Items[i].SubItems[1].Text); + MessageBox.Show(Lanuages.LanuageMgr.GetStr("UnlockFileFailed") + " : " + listViewUsing.Items[i].SubItems[1].Text); } } } diff --git a/TaskMgr/WorkWindow/FormDetalsistHeaders.cs b/TaskMgr/WorkWindow/FormDetalsistHeaders.cs index b247fd1..a13292e 100644 --- a/TaskMgr/WorkWindow/FormDetalsistHeaders.cs +++ b/TaskMgr/WorkWindow/FormDetalsistHeaders.cs @@ -5,10 +5,10 @@ namespace PCMgr.WorkWindow { public partial class FormDetalsistHeaders : Form { - public FormDetalsistHeaders() + public FormDetalsistHeaders(FormMain m) { InitializeComponent(); - formMain = FormMain.Instance; + formMain = m; } private FormMain formMain = null; @@ -21,12 +21,12 @@ private void FormDetalsistHeaders_Load(object sender, EventArgs e) { FormSettings.LoadFontSettingForUI(this); NativeMethods.MAppWorkCall3(182, listItems.Handle, IntPtr.Zero); - foreach (string s in formMain.allCols) + foreach (string s in formMain.MainPageProcessDetails.allCols) { ListViewItem item = new ListViewItem(); item.Name = s; item.Text = Lanuages.LanuageMgr.GetStr(s); - if (formMain.ProcessListDetailsGetListIndex(s) != -1) + if (formMain.MainPageProcessDetails.ProcessListDetailsGetListIndex(s) != -1) { item.Tag = "OldShow"; item.Checked = true; @@ -51,12 +51,12 @@ private void buttonOk_Click(object sender, EventArgs e) foreach (ListViewItem item in listItems.Items) { if (item.Tag.ToString() == "OldShow" && item.Checked == false) - formMain.ProcessListDetailsRemoveHeader(item.Name); + formMain.MainPageProcessDetails.ProcessListDetailsRemoveHeader(item.Name); if (item.Tag.ToString() == "NewShow" && item.Checked) - formMain.ProcessListDetailsAddHeader(item.Name); + formMain.MainPageProcessDetails.ProcessListDetailsAddHeader(item.Name); } - formMain.ProcessListDetailsGetColumnsIndex(); - formMain.nextUpdateStaticVals = true; + formMain.MainPageProcessDetails.ProcessListDetailsGetColumnsIndex(); + formMain.MainPageProcessDetails.nextUpdateStaticVals = true; Close(); } } diff --git a/TaskMgr/WorkWindow/FormFillWithData.cs b/TaskMgr/WorkWindow/FormFillWithData.cs index 2ebd573..22b8195 100644 --- a/TaskMgr/WorkWindow/FormFillWithData.cs +++ b/TaskMgr/WorkWindow/FormFillWithData.cs @@ -30,15 +30,15 @@ private void buttonStart_Click(object sender, EventArgs e) else { if(MFM_FillData(file, checkBoxForce.Checked, Convert.ToUInt32(numericUpDownFileSize.Value) * 1024)) - MessageBox.Show(FormMain.str_filldatasuccess); - else MessageBox.Show(FormMain.str_filldatafailed); + MessageBox.Show(LanuageMgr.GetStr("FillFileSuccess")); + else MessageBox.Show(LanuageMgr.GetStr("FillFileFailed")); } } else if(radioButtonEmepty.Checked) { if(MFM_EmeptyFile(file, checkBoxForce.Checked)) - MessageBox.Show(FormMain.str_filldatasuccess); - else MessageBox.Show(FormMain.str_filldatafailed); + MessageBox.Show(LanuageMgr.GetStr("FillFileSuccess")); + else MessageBox.Show(LanuageMgr.GetStr("FillFileFailed")); } } } diff --git a/TaskMgr/WorkWindow/FormMainListHeaders.cs b/TaskMgr/WorkWindow/FormMainListHeaders.cs index 4695e9b..8452a78 100644 --- a/TaskMgr/WorkWindow/FormMainListHeaders.cs +++ b/TaskMgr/WorkWindow/FormMainListHeaders.cs @@ -1,6 +1,7 @@ using PCMgr.Lanuages; using System; using System.Windows.Forms; +using static PCMgr.Main.MainUtils; namespace PCMgr.WorkWindow { @@ -24,7 +25,7 @@ private void button3_Click(object sender, EventArgs e) if (listView1.Items[i].Checked) headers = headers + "#" + ((aa)listView1.Items[i].Tag).a + "-" + ((aa)listView1.Items[i].Tag).b; NativeMethods.SetConfig("MainHeaders", "AppSetting", headers); - f.saveheader = false; + f.MainPageProcess.saveheader = false; } private void button1_Click(object sender, EventArgs e) @@ -64,7 +65,7 @@ private void Add(string name, int defw, bool en = true) ListViewItem li = new ListViewItem(LanuageMgr.GetStr(name)); if (en) { - FormMain.itemheader i = f.listProcessGetListHeaderItem(name); + itemheader i = f.MainPageProcess.listProcessGetListHeaderItem(name); if (i != null) { aa a = new aa(); diff --git a/TaskMgr/WorkWindow/FormSettings.Designer.cs b/TaskMgr/WorkWindow/FormSettings.Designer.cs index d37b8a1..3a98cb6 100644 --- a/TaskMgr/WorkWindow/FormSettings.Designer.cs +++ b/TaskMgr/WorkWindow/FormSettings.Designer.cs @@ -33,9 +33,6 @@ private void InitializeComponent() this.button_cancel = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.btnChooseFont = new System.Windows.Forms.Button(); - this.lbFont = new System.Windows.Forms.Label(); - this.label17 = new System.Windows.Forms.Label(); this.checkBoxShowHotKey = new System.Windows.Forms.CheckBox(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); @@ -117,9 +114,6 @@ private void InitializeComponent() // tabPage1 // resources.ApplyResources(this.tabPage1, "tabPage1"); - this.tabPage1.Controls.Add(this.btnChooseFont); - this.tabPage1.Controls.Add(this.lbFont); - this.tabPage1.Controls.Add(this.label17); this.tabPage1.Controls.Add(this.checkBoxShowHotKey); this.tabPage1.Controls.Add(this.label8); this.tabPage1.Controls.Add(this.label7); @@ -138,23 +132,6 @@ private void InitializeComponent() this.tabPage1.Name = "tabPage1"; this.tabPage1.UseVisualStyleBackColor = true; // - // btnChooseFont - // - resources.ApplyResources(this.btnChooseFont, "btnChooseFont"); - this.btnChooseFont.Name = "btnChooseFont"; - this.btnChooseFont.UseVisualStyleBackColor = true; - this.btnChooseFont.Click += new System.EventHandler(this.btnChooseFont_Click); - // - // lbFont - // - resources.ApplyResources(this.lbFont, "lbFont"); - this.lbFont.Name = "lbFont"; - // - // label17 - // - resources.ApplyResources(this.label17, "label17"); - this.label17.Name = "label17"; - // // checkBoxShowHotKey // resources.ApplyResources(this.checkBoxShowHotKey, "checkBoxShowHotKey"); @@ -586,9 +563,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox checkBoxUseMyDbgView; private System.Windows.Forms.CheckBox checkBoxNTOSPDB; private System.Windows.Forms.CheckBox checkBoxAbortShutdown; - private System.Windows.Forms.Button btnChooseFont; - private System.Windows.Forms.Label lbFont; - private System.Windows.Forms.Label label17; private System.Windows.Forms.FontDialog fontDialog1; } } \ No newline at end of file diff --git a/TaskMgr/WorkWindow/FormSettings.cs b/TaskMgr/WorkWindow/FormSettings.cs index e4a77ce..a130e1d 100644 --- a/TaskMgr/WorkWindow/FormSettings.cs +++ b/TaskMgr/WorkWindow/FormSettings.cs @@ -76,24 +76,7 @@ private void load_settings() break; } - try - { - string font = GetConfig("Font", "AppSetting"); - if (font != "") - { - tabControl1.Font = (Font)new FontConverter().ConvertFromString(font); - lbFont.Text = font; - } - else - { - lbFont.Text = new FontConverter().ConvertToString(tabControl1.Font); - } - fontDialog1.Font = Font; - } - catch - { - - } + checkBoxAbortShutdown.Checked = GetConfigBool("AbortShutdown", "AppSetting", false); checkBoxTop.Checked = GetConfigBool("TopMost", "AppSetting", false); @@ -149,9 +132,6 @@ private void save_settings() SetConfigBool("HotKey", "AppSetting", checkBoxShowHotKey.Checked); SetConfigBool("SelfProtect", "AppSetting", checkBoxSelfProtect.Checked); SetConfig("Title", "AppSetting", textBoxTitle.Text); - if (textBoxTitle.Text != "") - FormMain.Instance.Text = textBoxTitle.Text; - else FormMain.Instance.Text = FormMain.str_AppTitle; SetConfig("HotKey1", "AppSetting", comboBoxShowHotKey1.SelectedItem.ToString()); SetConfig("HotKey2", "AppSetting", comboBoxShowHotKey2.SelectedItem.ToString()); if(fontchanged) SetConfig("Font", "AppSetting", new FontConverter().ConvertToString(tabControl1.Font)); @@ -178,17 +158,17 @@ private void checkBoxCloseHide_CheckedChanged(object sender, EventArgs e) private void checkBoxCannotCreateProc_CheckedChanged(object sender, EventArgs e) { if (!M_SU_SetKrlMonSet_CreateProcess(checkBoxCannotCreateProc.Checked)) - MessageBox.Show(FormMain.str_failed); + MessageBox.Show(LanuageFBuffers.Str_Failed); } private void checkBoxCannotCreateThread_CheckedChanged(object sender, EventArgs e) { if (!M_SU_SetKrlMonSet_CreateThread(checkBoxCannotCreateThread.Checked)) - MessageBox.Show(FormMain.str_failed); + MessageBox.Show(LanuageFBuffers.Str_Failed); } private void checkBoxCannotLoadDriver_CheckedChanged(object sender, EventArgs e) { if (!M_SU_SetKrlMonSet_LoadImage(checkBoxCannotLoadDriver.Checked)) - MessageBox.Show(FormMain.str_failed); + MessageBox.Show(LanuageFBuffers.Str_Failed); } private void btnChooseFont_Click(object sender, EventArgs e) diff --git a/TaskMgr/WorkWindow/FormSettings.resx b/TaskMgr/WorkWindow/FormSettings.resx index eeda0a8..0f2e996 100644 --- a/TaskMgr/WorkWindow/FormSettings.resx +++ b/TaskMgr/WorkWindow/FormSettings.resx @@ -123,10 +123,13 @@ - 341, 411 + 682, 822 + + + 6, 6, 6, 6 - 75, 23 + 150, 46 @@ -151,10 +154,13 @@ Bottom, Right - 260, 411 + 520, 822 + + + 6, 6, 6, 6 - 75, 23 + 150, 46 1 @@ -180,95 +186,17 @@ True - - 281, 177 - - - 90, 23 - - - 17 - - - 选择字体 - - - btnChooseFont - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 0 - - - True - - - NoControl - - - 81, 182 - - - 32, 17 - - - 16 - - - 默认 - - - lbFont - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 1 - - - True - - - 13, 182 - - - 56, 17 - - - 15 - - - ç•Œé¢å­—体 - - - label17 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 2 - True - 15, 135 + 30, 270 + + + 6, 6, 6, 6 - 15, 14 + 28, 27 14 @@ -283,16 +211,19 @@ tabPage1 - 3 + 0 True - 142, 137 + 284, 274 + + + 6, 0, 6, 0 - 28, 17 + 54, 31 13 @@ -310,7 +241,7 @@ tabPage1 - 4 + 1 True @@ -319,10 +250,13 @@ NoControl - 264, 137 + 528, 274 + + + 6, 0, 6, 0 - 17, 17 + 32, 31 12 @@ -340,7 +274,7 @@ tabPage1 - 5 + 2 A @@ -457,10 +391,13 @@ F12 - 281, 132 + 562, 264 + + + 6, 6, 6, 6 - 50, 25 + 96, 39 11 @@ -475,16 +412,19 @@ tabPage1 - 6 + 3 True - 191, 137 + 382, 274 + + + 6, 0, 6, 0 - 17, 17 + 32, 31 10 @@ -502,7 +442,7 @@ tabPage1 - 7 + 4 Alt @@ -520,10 +460,13 @@ (None) - 208, 132 + 416, 264 + + + 6, 6, 6, 6 - 50, 25 + 96, 39 9 @@ -538,16 +481,19 @@ tabPage1 - 8 + 5 True - 34, 137 + 68, 274 + + + 6, 0, 6, 0 - 92, 34 + 182, 62 8 @@ -566,13 +512,16 @@ tabPage1 - 9 + 6 - 114, 99 + 228, 198 + + + 6, 6, 6, 6 - 257, 23 + 510, 39 7 @@ -587,16 +536,19 @@ tabPage1 - 10 + 7 True - 13, 102 + 26, 204 + + + 6, 0, 6, 0 - 80, 17 + 158, 31 6 @@ -614,7 +566,7 @@ tabPage1 - 11 + 8 True @@ -626,10 +578,13 @@ NoControl - 15, 241 + 30, 482 + + + 6, 6, 6, 6 - 159, 21 + 310, 35 5 @@ -647,7 +602,7 @@ tabPage1 - 12 + 9 True @@ -656,10 +611,13 @@ NoControl - 15, 263 + 30, 526 + + + 6, 6, 6, 6 - 267, 21 + 526, 35 4 @@ -677,7 +635,7 @@ tabPage1 - 13 + 10 True @@ -689,10 +647,13 @@ NoControl - 7, 214 + 14, 428 + + + 6, 0, 6, 0 - 83, 12 + 160, 24 3 @@ -710,16 +671,19 @@ tabPage1 - 14 + 11 True - 15, 61 + 30, 122 + + + 6, 6, 6, 6 - 143, 21 + 277, 35 2 @@ -737,16 +701,19 @@ tabPage1 - 15 + 12 True - 15, 39 + 30, 78 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 1 @@ -764,7 +731,7 @@ tabPage1 - 16 + 13 True @@ -773,10 +740,13 @@ 宋体, 9pt, style=Bold - 7, 15 + 14, 30 + + + 6, 0, 6, 0 - 57, 12 + 110, 24 0 @@ -794,16 +764,19 @@ tabPage1 - 17 + 14 - 4, 26 + 8, 45 + + + 6, 6, 6, 6 - 3, 3, 3, 3 + 6, 6, 6, 6 - 385, 291 + 836, 733 0 @@ -833,10 +806,13 @@ NoControl - 20, 219 + 40, 438 + + + 6, 6, 6, 6 - 175, 38 + 342, 66 29 @@ -861,10 +837,13 @@ True - 20, 545 + 40, 1090 + + + 6, 6, 6, 6 - 231, 38 + 454, 66 28 @@ -892,10 +871,13 @@ NoControl - 20, 676 + 40, 1352 + + + 6, 6, 6, 6 - 130, 21 + 251, 35 27 @@ -919,10 +901,13 @@ True - 20, 19 + 40, 38 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 26 @@ -949,10 +934,13 @@ NoControl - 20, 610 + 40, 1220 + + + 6, 6, 6, 6 - 243, 21 + 478, 35 25 @@ -982,10 +970,13 @@ NoControl - 7, 585 + 14, 1170 + + + 6, 0, 6, 0 - 31, 12 + 60, 24 24 @@ -1006,10 +997,13 @@ 5 - 36, 353 + 72, 706 + + + 6, 0, 6, 0 - 318, 24 + 636, 48 23 @@ -1033,10 +1027,13 @@ True - 20, 654 + 40, 1308 + + + 6, 6, 6, 6 - 127, 21 + 245, 35 22 @@ -1066,10 +1063,13 @@ NoControl - 7, 634 + 14, 1268 + + + 6, 0, 6, 0 - 57, 12 + 110, 24 21 @@ -1093,10 +1093,13 @@ True - 122, 19 + 244, 38 + + + 6, 0, 6, 0 - 56, 17 + 110, 31 20 @@ -1126,10 +1129,13 @@ NoControl - 7, 1000 + 14, 2000 + + + 6, 0, 6, 0 - 44, 12 + 85, 24 19 @@ -1156,10 +1162,13 @@ NoControl - 20, 521 + 40, 1042 + + + 6, 6, 6, 6 - 64, 21 + 118, 35 18 @@ -1186,10 +1195,13 @@ NoControl - 20, 487 + 40, 974 + + + 6, 6, 6, 6 - 290, 38 + 573, 66 17 @@ -1214,10 +1226,13 @@ True - 96, 440 + 192, 880 + + + 6, 6, 6, 6 - 185, 21 + 362, 35 16 @@ -1244,10 +1259,13 @@ NoControl - 20, 465 + 40, 930 + + + 6, 6, 6, 6 - 172, 21 + 334, 35 15 @@ -1277,10 +1295,13 @@ NoControl - 7, 441 + 14, 882 + + + 6, 0, 6, 0 - 83, 12 + 160, 24 14 @@ -1307,10 +1328,13 @@ NoControl - 20, 181 + 40, 362 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 13 @@ -1337,10 +1361,13 @@ NoControl - 20, 159 + 40, 318 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 12 @@ -1367,10 +1394,13 @@ NoControl - 20, 137 + 40, 274 + + + 6, 6, 6, 6 - 159, 21 + 310, 35 11 @@ -1397,10 +1427,13 @@ NoControl - 20, 115 + 40, 230 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 10 @@ -1427,10 +1460,13 @@ NoControl - 20, 93 + 40, 186 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 9 @@ -1454,10 +1490,13 @@ True - 20, 71 + 40, 142 + + + 6, 6, 6, 6 - 99, 21 + 190, 35 8 @@ -1487,10 +1526,13 @@ NoControl - 7, 47 + 14, 94 + + + 6, 0, 6, 0 - 187, 12 + 360, 24 7 @@ -1517,10 +1559,13 @@ NoControl - 20, 412 + 40, 824 + + + 6, 6, 6, 6 - 164, 21 + 317, 35 6 @@ -1547,10 +1592,13 @@ NoControl - 20, 390 + 40, 780 + + + 6, 6, 6, 6 - 229, 21 + 448, 35 5 @@ -1574,10 +1622,13 @@ True - 7, 305 + 14, 610 + + + 6, 0, 6, 0 - 368, 17 + 731, 31 3 @@ -1607,10 +1658,13 @@ NoControl - 7, 327 + 14, 654 + + + 6, 0, 6, 0 - 129, 12 + 248, 24 2 @@ -1631,13 +1685,16 @@ 26 - 4, 26 + 8, 45 + + + 6, 6, 6, 6 - 3, 3, 3, 3 + 6, 6, 6, 6 - 418, 363 + 836, 733 3 @@ -1658,13 +1715,16 @@ 1 - 4, 22 + 8, 45 + + + 6, 6, 6, 6 - 3, 3, 3, 3 + 6, 6, 6, 6 - 385, 295 + 836, 733 1 @@ -1694,10 +1754,13 @@ English - 67, 21 + 134, 42 + + + 6, 6, 6, 6 - 230, 25 + 456, 39 1 @@ -1718,10 +1781,13 @@ True - 20, 24 + 40, 48 + + + 6, 0, 6, 0 - 32, 17 + 62, 31 0 @@ -1742,13 +1808,16 @@ 1 - 4, 22 + 8, 45 + + + 6, 6, 6, 6 - 3, 3, 3, 3 + 6, 6, 6, 6 - 385, 295 + 836, 733 2 @@ -1772,10 +1841,13 @@ 微软雅黑, 9pt - 1, 12 + 2, 24 + + + 6, 6, 6, 6 - 426, 393 + 852, 786 2 @@ -1799,10 +1871,10 @@ True - 6, 12 + 12, 24 - 428, 446 + 856, 892 @@ -1828,8 +1900,11 @@ AADMZwAA/H8AAA== + + 6, 6, 6, 6 + - 411, 413 + 796, 755 CenterParent diff --git a/TaskMgr/WorkWindow/FormSpeedBall.cs b/TaskMgr/WorkWindow/FormSpeedBall.cs index da4b8b3..ecc40ec 100644 --- a/TaskMgr/WorkWindow/FormSpeedBall.cs +++ b/TaskMgr/WorkWindow/FormSpeedBall.cs @@ -7,8 +7,9 @@ namespace PCMgr.WorkWindow { public partial class FormSpeedBall : Form { - public FormSpeedBall() + public FormSpeedBall(FormMain m) { + formMain = m; Items = new List(); InitializeComponent(); @@ -19,6 +20,8 @@ public FormSpeedBall() rightCenterFormat.Alignment = StringAlignment.Far; } + private FormMain formMain = null; + private StringFormat leftCenterFormat; private StringFormat rightCenterFormat; @@ -198,13 +201,13 @@ private void FormSpeedBall_Paint(object sender, PaintEventArgs e) private void FormSpeedBall_Deactivate(object sender, System.EventArgs e) { Visible = false; - FormMain.Instance.notifyIcon_MouseLeave(sender, e); + formMain.notifyIcon_MouseLeave(sender, e); } private void FormSpeedBall_MouseLeave(object sender, System.EventArgs e) { Visible = false; - FormMain.Instance.notifyIcon_MouseLeave(sender, e); + formMain.notifyIcon_MouseLeave(sender, e); } } } diff --git a/TaskMgr/WorkWindow/FormSpyWindow.cs b/TaskMgr/WorkWindow/FormSpyWindow.cs index 88c651c..1603de5 100644 --- a/TaskMgr/WorkWindow/FormSpyWindow.cs +++ b/TaskMgr/WorkWindow/FormSpyWindow.cs @@ -228,7 +228,7 @@ private bool LoadChildWindows(bool re=false) d.loaded = false; d.info = wi; nd.Tag = d; - TreeNode ndnull = new TreeNode(FormMain.str_loading); + TreeNode ndnull = new TreeNode(Lanuages.LanuageMgr.GetStr("Loading", false)); ndnull.Name = "ndnull"; nd.Nodes.Add(ndnull); treeViewMain.Nodes.Add(nd); @@ -236,11 +236,11 @@ private bool LoadChildWindows(bool re=false) labelState.Hide(); panelMain.Show(); - if (re) MessageBox.Show(FormMain.str_RefeshSuccess); + if (re) MessageBox.Show(Lanuages.LanuageMgr.GetStr("RefeshSuccess")); } - else labelState.Text = FormMain.str_InvalidHwnd; + else labelState.Text = Lanuages.LanuageMgr.GetStr("InvalidHwnd"); } - else labelState.Text = FormMain.str_InvalidHwnd; + else labelState.Text = Lanuages.LanuageMgr.GetStr("InvalidHwnd"); return false; } private void LoadChilds(IntPtr hWnd, TreeNode treeNode) @@ -402,7 +402,7 @@ private void textBoxText_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { - if (MessageBox.Show(FormMain.str_ChangeWindowTextAsk, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + if (MessageBox.Show(Lanuages.LanuageMgr.GetStr("ChangeWindowTextAsk"), Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { textBoxText.Text.Remove(textBoxText.Text.Length - 1); SetWindowText(selectHwnd, textBoxText.Text); diff --git a/TaskMgr/WorkWindow/FormVKrnInfo.cs b/TaskMgr/WorkWindow/FormVKrnInfo.cs index 8609780..3195507 100644 --- a/TaskMgr/WorkWindow/FormVKrnInfo.cs +++ b/TaskMgr/WorkWindow/FormVKrnInfo.cs @@ -61,12 +61,12 @@ private void LoadItems() AddItem("ImageFileName", info.ImageFileName); } - AddItem(FormMain.str_DblCklShow_EPROCESS, "", "_EPROCESS"); - AddItem(FormMain.str_DblCklShow_PEB, "", "_PEB"); - AddItem(FormMain.str_DblCklShow_KPROCESS, "", "_KPROCES"); - AddItem(FormMain.str_DblCklShow_RTL_USER_PROCESS_PARAMETERS, "", "_RTL_USER_PROCESS_PARAMETERS"); + AddItem(Lanuages.LanuageMgr.GetStr("DblCklShow_EPROCESS", false), "", "_EPROCESS"); + AddItem(Lanuages.LanuageMgr.GetStr("DblCklShow_PEB", false), "", "_PEB"); + AddItem(Lanuages.LanuageMgr.GetStr("DblCklShow_KPROCESS", false), "", "_KPROCES"); + AddItem(Lanuages.LanuageMgr.GetStr("DblCklShow_RTL_USER_PROCESS_PARAMETERS", false), "", "_RTL_USER_PROCESS_PARAMETERS"); } - else AddItem("", FormMain.str_DriverNotLoad); + else AddItem("", Lanuages.LanuageFBuffers.Str_DriverNotLoad); } private void AddItem(string name, string value, object tag = null) diff --git a/TaskMgr/WorkWindow/KDbgPrint/FormKDbgPrint.cs b/TaskMgr/WorkWindow/KDbgPrint/FormKDbgPrint.cs index ac22e59..710a93b 100644 --- a/TaskMgr/WorkWindow/KDbgPrint/FormKDbgPrint.cs +++ b/TaskMgr/WorkWindow/KDbgPrint/FormKDbgPrint.cs @@ -111,7 +111,7 @@ private void FormFind_Find(object sender, EventArgs e) formFind.Hide(); MAppWorkCall3(213, Handle, IntPtr.Zero); } - else MessageBox.Show(FormMain.str_CantFind + " \"" + keyword + "\""); + else MessageBox.Show(Lanuages.LanuageMgr.GetStr("CantFind") + " \"" + keyword + "\""); } private void addItem(string s) diff --git a/TaskMgr/WorkWindow/Tools/FormFileTool.cs b/TaskMgr/WorkWindow/Tools/FormFileTool.cs index a5cf4cc..8aa8af1 100644 --- a/TaskMgr/WorkWindow/Tools/FormFileTool.cs +++ b/TaskMgr/WorkWindow/Tools/FormFileTool.cs @@ -1,4 +1,5 @@ -using System; +using PCMgr.Lanuages; +using System; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; @@ -33,8 +34,7 @@ private void btnFroceDelete_Click(object sender, EventArgs e) if (textBoxFilePath.Text != "") { if (MFM_DeleteFileForce(textBoxFilePath.Text)) - MessageBox.Show(FormMain.str_frocedelsuccess); - + MessageBox.Show(LanuageMgr.GetStr("FroceDelSuccess")); } } @@ -51,7 +51,7 @@ private void btnDisplayFileInfo_Click(object sender, EventArgs e) StringBuilder buf = new StringBuilder(256); if (MFM_GetFileInformationString(textBoxFilePath.Text, buf, 256)) labelFileInformation.Text = buf.ToString(); - else labelFileInformation.Text = FormMain.str_getfileinfofailed; + else labelFileInformation.Text = LanuageMgr.GetStr("GetFileInfoFailed"); } } } diff --git a/TaskMgr/WorkWindow/Tools/FormKDA.cs b/TaskMgr/WorkWindow/Tools/FormKDA.cs index 74b6ce1..611eb8a 100644 --- a/TaskMgr/WorkWindow/Tools/FormKDA.cs +++ b/TaskMgr/WorkWindow/Tools/FormKDA.cs @@ -1,6 +1,7 @@ using System; using System.Runtime.InteropServices; using System.Windows.Forms; +using PCMgr.Lanuages; using static PCMgr.NativeMethods; namespace PCMgr.WorkWindow @@ -41,7 +42,7 @@ private void _DACALLBACK(UInt64 curaddress, IntPtr addressstr, IntPtr shell, Int textBoxBariny.Text += barinystr; add_Item(Marshal.PtrToStringUni(addressstr), Marshal.PtrToStringUni(shell), barinystr, Marshal.PtrToStringUni(asm)); if (showedsize == oncemaxdsize) - add_Item("", "", FormMain.str_DblClickToDa, "conload"); + add_Item("", "", LanuageMgr.GetStr("DblClickToDa"), "conload"); } #else [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -54,7 +55,7 @@ private void _DACALLBACK(UInt32 curaddress, IntPtr addressstr, IntPtr shell, Int textBoxBariny.Text += barinystr; add_Item(Marshal.PtrToStringUni(addressstr), Marshal.PtrToStringUni(shell), barinystr, Marshal.PtrToStringUni(asm)); if (showedsize == oncemaxdsize) - add_Item("", "", FormMain.str_DblClickToDa, "conload"); + add_Item("", "", LanuageMgr.GetStr("DblClickToDa"), "conload"); } #endif private void FormDA_Load(object sender, EventArgs e) @@ -102,17 +103,17 @@ private void das() textBoxBariny.Text = ""; if (!MCanUseKernel()) { - show_err(FormMain.str_DriverLoadFailed); + show_err(LanuageMgr.GetStr("DriverLoadFailed")); return; } if (textBoxTargetAddress.Text == "") { - show_err(FormMain.str_PleaseEnterTargetAddress); + show_err(LanuageMgr.GetStr("PleaseEnterTargetAddress")); return; } if (textBoxDesize.Text == "") { - show_err(FormMain.str_PleaseEnterDaSize); + show_err(LanuageMgr.GetStr("PleaseEnterDaSize")); return; } @@ -137,7 +138,7 @@ private void das() if (size > oncemaxdsize) rs = M_SU_KDA(CallbackPtr, address, oncemaxdsize); else rs = M_SU_KDA(CallbackPtr, address, size); - if (!rs) NativeMethods.LogErr("KDA Failed!"); + if (!rs) LogErr("KDA Failed!"); } private void show_err(string s) { diff --git a/TaskMgr/WorkWindow/Tools/FormLoadDriver.cs b/TaskMgr/WorkWindow/Tools/FormLoadDriver.cs index ef3805a..e9cf15a 100644 --- a/TaskMgr/WorkWindow/Tools/FormLoadDriver.cs +++ b/TaskMgr/WorkWindow/Tools/FormLoadDriver.cs @@ -1,4 +1,5 @@ using PCMgr.Aero.TaskDialog; +using PCMgr.Lanuages; using System; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -13,11 +14,11 @@ public FormLoadDriver() InitializeComponent(); } - [DllImport(NativeMethods.COREDLLNAME, CallingConvention = CallingConvention.Cdecl)] + [DllImport(COREDLLNAME, CallingConvention = CallingConvention.Cdecl)] private static extern bool MUnLoadKernelDriver([MarshalAs(UnmanagedType.LPWStr)]string szSvrName); - [DllImport(NativeMethods.COREDLLNAME, CallingConvention = CallingConvention.Cdecl)] + [DllImport(COREDLLNAME, CallingConvention = CallingConvention.Cdecl)] private static extern bool MLoadKernelDriver([MarshalAs(UnmanagedType.LPWStr)]string lpszDriverName, [MarshalAs(UnmanagedType.LPWStr)]string driverPath, [MarshalAs(UnmanagedType.LPWStr)]string lpszDisplayName); - [DllImport(NativeMethods.COREDLLNAME, CallingConvention = CallingConvention.Cdecl)] + [DllImport(COREDLLNAME, CallingConvention = CallingConvention.Cdecl)] private static extern bool MFM_FileExist([MarshalAs(UnmanagedType.LPWStr)]string path); private void buttonChoose_Click(object sender, EventArgs e) @@ -31,34 +32,26 @@ private void buttonLoad_Click(object sender, EventArgs e) string path = textBoxDriverPath.Text; if (path == "") { - TaskDialog.Show(FormMain.str_PleaseChooseDriver, FormMain.str_TipTitle); + TaskDialog.Show(LanuageMgr.GetStr("PleaseChooseDriver"), LanuageFBuffers.Str_TipTitle); return; } if(!MFM_FileExist(path)) { - TaskDialog.Show(FormMain.str_PathUnExists, FormMain.str_TipTitle); + TaskDialog.Show(LanuageMgr.GetStr("PathUnExists"), LanuageFBuffers.Str_TipTitle); return; } - if (textBoxServName.Text == "") - textBoxServName.Text = System.IO.Path.GetFileNameWithoutExtension(path); - - if (MLoadKernelDriver(textBoxServName.Text, path, textBoxDrvServDsb.Text)) - TaskDialog.Show(FormMain.str_DriverLoadSuccessFull, FormMain.str_TipTitle); - else - TaskDialog.Show(string.Format(FormMain.str_DriverLoadFailed, Win32.GetLastError()), FormMain.str_TipTitle); + if (textBoxServName.Text == "") textBoxServName.Text = System.IO.Path.GetFileNameWithoutExtension(path); + if (MLoadKernelDriver(textBoxServName.Text, path, textBoxDrvServDsb.Text)) TaskDialog.Show(LanuageMgr.GetStr("DriverLoadSuccessFull"), LanuageFBuffers.Str_TipTitle); + else TaskDialog.Show(string.Format(LanuageMgr.GetStr("DriverLoadFailed"), Win32.GetLastError()), LanuageFBuffers.Str_TipTitle); } private void buttonUnLoad_Click(object sender, EventArgs e) { - if (textBoxServName.Text == "") + if (textBoxServName.Text == "") TaskDialog.Show(LanuageMgr.GetStr("PleaseEnterDriverServiceName"), LanuageFBuffers.Str_TipTitle); + else { - TaskDialog.Show(FormMain.str_PleaseEnterDriverServiceName, FormMain.str_TipTitle); - return; + if (MUnLoadKernelDriver(textBoxServName.Text)) TaskDialog.Show(LanuageMgr.GetStr("DriverUnLoadSuccessFull"), LanuageFBuffers.Str_TipTitle); + else TaskDialog.Show(string.Format(LanuageMgr.GetStr("DriverUnLoadFailed"), Win32.GetLastError()), LanuageFBuffers.Str_TipTitle); } - - if (MUnLoadKernelDriver(textBoxServName.Text)) - TaskDialog.Show(FormMain.str_DriverUnLoadSuccessFull, FormMain.str_TipTitle); - else - TaskDialog.Show(string.Format(FormMain.str_DriverUnLoadFailed, Win32.GetLastError()), FormMain.str_TipTitle); } private void textBoxDriverPath_DragDrop(object sender, DragEventArgs e) diff --git a/TaskMgrCore/mapphlp.cpp b/TaskMgrCore/mapphlp.cpp index e677cc8..24f7744 100644 --- a/TaskMgrCore/mapphlp.cpp +++ b/TaskMgrCore/mapphlp.cpp @@ -138,11 +138,6 @@ bool main_grouping = false; bool alwaysOnTop = false; bool aopTimer = false; -M_CAPI(VOID) TryCallThis() -{ - MAppWorkCall3(176, 0, 0); -} - bool can_debug = false; bool use_apc = false; int IDC_MAINLIST_HEADER = 0; @@ -1202,10 +1197,6 @@ M_API void MSetAsExplorerTheme(HWND hWnd) SetWindowTheme(hWnd, L"Explorer", NULL); } -M_API void MDrawImage(HDC hdc, int x, int y) -{ - -} M_API void MDrawIcon(HICON hIcon, HDC hdc, int x, int y) { DrawIconEx(hdc, x, y, hIcon, 16, 16, 0, NULL, DI_NORMAL); @@ -1976,8 +1967,7 @@ LRESULT CALLBACK MAppWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; } case IDM_START_MHOOK: { - if(InstallMouseHook()) - MessageBox(hWnd, L"Mouse hook started!", L"Tip", 0); + if(InstallMouseHook()) MessageBox(hWnd, L"Mouse hook started!", L"Tip", 0); else { LogErr2(L"Install Mouse hook failed, lasterr : %d", GetLastError()); MessageBox(hWnd, L"Install Mouse hook failed!", L"Tip", 0); diff --git a/TaskMgrCore/prochlp.cpp b/TaskMgrCore/prochlp.cpp index 6b13ee8..16a2f53 100644 --- a/TaskMgrCore/prochlp.cpp +++ b/TaskMgrCore/prochlp.cpp @@ -1298,10 +1298,15 @@ M_API int MGetProcessState(PMPROCESS_ITEM processItem, HWND hWnd) { if(IsWindow(hWnd) && IsHungAppWindow(hWnd)) return 3; - SYSTEM_THREADS systemThread = processItem->Data->Threads[0]; - if (systemThread.ThreadState == THREAD_STATE::StateWait && systemThread.WaitReason == Suspended) - return 2; - else return 1; + __try { + SYSTEM_THREADS systemThread = processItem->Data->Threads[0]; + if (systemThread.ThreadState == THREAD_STATE::StateWait && systemThread.WaitReason == Suspended) + return 2; + else return 1; + } + __except (EXCEPTION_EXECUTE_HANDLER) { + return -1; + } } return 0; } diff --git a/TaskMgrCore/syshlp.cpp b/TaskMgrCore/syshlp.cpp index 3270043..17a0bcb 100644 --- a/TaskMgrCore/syshlp.cpp +++ b/TaskMgrCore/syshlp.cpp @@ -184,12 +184,33 @@ M_CAPI(BOOL) MCommandLineToFilePath(LPWSTR cmdline, LPWSTR buffer, int size) if (cmdline && buffer) { int argc = 0; - LPWSTR *szArglist = CommandLineToArgvW(cmdline, &argc); - if (szArglist) - { - wcscpy_s(buffer, size, szArglist[0]); - LocalFree(szArglist); - return TRUE; + size_t len = wcslen(cmdline); + if (len > 0 && len < MAX_PATH && cmdline[0] == L'\"' && cmdline[len - 1] == L'\"') { + WCHAR fixcmdline[MAX_PATH]; + wcscpy_s(fixcmdline, cmdline); + + WCHAR* firstArgPos = wcswcs(fixcmdline, L".exe -"); + if (firstArgPos) { + *(firstArgPos + 2 * sizeof(WCHAR)) = L'\"'; + *(firstArgPos + 3 * sizeof(WCHAR)) = L'\0'; + } + + LPWSTR *szArglist = CommandLineToArgvW(fixcmdline, &argc); + if (szArglist && argc > 0) + { + wcscpy_s(buffer, size, szArglist[0]); + LocalFree(szArglist); + return TRUE; + } + } + else { + LPWSTR *szArglist = CommandLineToArgvW(cmdline, &argc); + if (szArglist && argc > 0) + { + wcscpy_s(buffer, size, szArglist[0]); + LocalFree(szArglist); + return TRUE; + } } } return FALSE;