91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .cs
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-12
  • 語言: C#
  • 標簽: 系統所有??

資源簡介

通過讀取注冊表獲取系統所有安裝的軟件信息,獲取到的信息和系統程序和功能中一致

資源截圖

代碼片段和文件信息

using?Microsoft.Win32;
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Runtime.InteropServices;
using?System.ServiceProcess;
using?System.Text;

namespace?SystemInfosLib
{
????public?class?SoftWareList
????{
????????///?
????????///?獲取安裝的所有程序
????????///?

????????public?virtual?List?GetAllInstalledSoftware()
????????{
????????????List?list?=?new?List();
????????????//添加32位程序
????????????RegistryKey?pregkey?=?Registry.LocalMachine.OpenSubKey(@“Software\Microsoft\Windows\CurrentVersion\Uninstall“);//獲取指定路徑下的鍵

????????????AddSoftListRange(list?pregkey);
????????????//添加64位程序
????????????pregkey?=?Get64BitOsKey();
????????????AddSoftListRange(list?pregkey);
????????????//當前用戶
????????????pregkey?=?Registry.CurrentUser.OpenSubKey(@“Software\Microsoft\Windows\CurrentVersion\Uninstall“);
????????????AddSoftListRange(list?pregkey);
????????????return?list;
????????}
????????///?
????????///?獲取正在運行的程序
????????///?

????????///?
????????public?virtual?List?GetRunningSoftList()
????????{

????????????ProcessInfos?soft;
????????????List?listRunning?=?new?List();
????????????ServiceController[]?services?=?System.ServiceProcess.ServiceController.GetServices();
????????????for?(int?i?=?0;?i?????????????{
????????????????String?state?=?““;
????????????????if?((services[i].Status.ToString()).Equals(“Running“))
????????????????{
????????????????????state?=?“正在運行“;
????????????????????soft?=?new?ProcessInfos(services[i].ServiceName?services[i].DisplayName?state);
????????????????????listRunning.Add(soft);
????????????????}
????????????}
????????????return?listRunning;
????????}


????????private?RegistryKey?Get64BitOsKey()
????????{
????????????RegistryKey?pregkey?=?null;
????????????try
????????????{
????????????????RegistryKey?localKey;
????????????????localKey?=?RegistryKey.OpenbaseKey(RegistryHive.LocalMachine?RegistryView.Registry64);
????????????????pregkey?=?localKey.OpenSubKey(@“Software\Microsoft\Windows\CurrentVersion\Uninstall“);//獲取指定路徑下的鍵
????????????}
????????????catch?(Exception?ex)
????????????{

????????????}
????????????return?pregkey;

????????}
????????private?List?GetSoftKeyFromReg(RegistryKey?pregkey)
????????{
????????????List?list?=?new?List();
????????????string?temp?=?null?tempType?=?null;
????????????int?softNum?=?0;
????????????RegistryKey?currentKey?=?null;
????????????try
????????????{
????????????????foreach?(string?item?in?pregkey.GetSubKeyNames())???????????????//循環所有子鍵
????????????????{
????????????????????string?displayName?uninstallString?releaseType?PublishName?oInstallTime?oSize?oVersion;
????????????????????currentKey?=?pregkey.OpenSubKey(item);
????????????????????displayName?=?currentKey.GetValue(

評論

共有 條評論