Ejemplo n.º 1
0
        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;
                    if (info.IconBackgroundColor != 0 && info.IconBackgroundColor != 65535 && info.IconBackgroundColor != 30720)
                    {
                        li.UWPIcoColor = Uint32StrToColor((uint)info.IconBackgroundColor);
                    }

                    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);
                }
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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);
             }
         }
     }
 }
Ejemplo n.º 4
0
            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);
            }
Ejemplo n.º 5
0
        private TaskMgrListItem UWPForceReadAddItem(string fullName, string appfimalyid, string installDir, string dsbName, string logoPath, string bgColor)
        {
            UWP_PACKAGE_INFO info = new UWP_PACKAGE_INFO();

            info.AppPackageFullName   = fullName;
            info.AppPackageFamilyName = appfimalyid;
            info.DisplayName          = dsbName;
            info.IconPath             = logoPath;
            info.InstallPath          = installDir;

            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;
            if (bgColor != "" && bgColor != "transparent")
            {
                li.UWPIcoColor = MainUtils.HexStrToColor(bgColor);
            }
            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);
            }
            listUwpApps.Items.Add(li);
            return(li);
        }
Ejemplo n.º 6
0
        private void UsersListAddProcess(TaskMgrListItem li, string userName)
        {
            //添加用户对应的所有进程

            List <PsItem> 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);
        }
Ejemplo n.º 7
0
        private bool UsersListEnumUsersCallBack(IntPtr userName, uint sessionId, uint userId, IntPtr domain, IntPtr customData)
        {
            string          username  = Marshal.PtrToStringUni(userName);
            string          domainStr = Marshal.PtrToStringUni(domain);
            TaskMgrListItem li        = new TaskMgrListItem(username);

            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 = username;
            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 = false;
            li.IsUWPICO          = true;

            string userFullName, userIcoPath;

            if (UsersListEnumGetUserInfos(username, out userIcoPath, out userFullName))
            {
                li.Text             = userFullName + " (" + username + ")";
                li.SubItems[0].Text = li.Text;
            }

            UsersListAddProcess(li, username);
            if (li.Childs.Count == 0)
            {
                li.DisplayChildCount = false;
            }

            listUsers.Items.Add(li);
            return(true);
        }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
            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);
            }
Ejemplo n.º 10
0
        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;
                }
            }
        }