using System;
using Microsoft.Win32;
namespace Win7游戏全屏补丁
{
class Program
{
static void Main(string[] args)
{
RegistryKey system_key = Registry.LocalMachine.OpenSubKey("SYSTEM");
if (system_key != null)
{
RegistryKey ControlSet001_key = system_key.OpenSubKey("ControlSet001");
if (ControlSet001_key != null)
{
RegistryKey Control_key = ControlSet001_key.OpenSubKey("Control");
if (Control_key != null)
{
RegistryKey GraphicsDrivers_key = Control_key.OpenSubKey("GraphicsDrivers");
if (GraphicsDrivers_key != null)
{
RegistryKey Configuration_key = GraphicsDrivers_key.OpenSubKey("Configuration");
if (Configuration_key != null)
{
string[] keynames = Configuration_key.GetSubKeyNames();
foreach (string name in keynames)
{
if (name.StartsWith("INL"))
{
RegistryKey Inl_key = Configuration_key.OpenSubKey(name);
if (Inl_key != null)
{
RegistryKey oo_key = Inl_key.OpenSubKey("00");
if (oo_key != null)
{
RegistryKey ooo_key = oo_key.OpenSubKey("00", true);
if (ooo_key != null)
{
if ((int)ooo_key.GetValue("Scaling") != 3)
{
ooo_key.SetValue("Scaling", 3);
}
Console.WriteLine("补丁已成功打上.");
}
}
}
}
}
}
}
}
}
}
Console.ReadKey();
}
}
}
posted @ 2011-07-20 13:33 皇城阁泪 阅读(184) 评论(2) 编辑
using System.Diagnostics;
using System.Text.RegularExpressions;
private void ShowPort_Click(object sender, EventArgs e)
{
StringBuilder str1 = new StringBuilder();//用于存储截获DOS控制台的输出流
string []str2=new string[2000];//存储端口号
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.Start();
p.StandardInput.WriteLine("netstat -an");
p.StandardInput.WriteLine("exit");
str1.AppendLine(p.StandardOutput.ReadToEnd()) ;
p.Close();Regex rx = new Regex("(:{1}\d+)");//用正则表达式筛选端口号,即":"号后面全是MatchCollection mc = rx.Matches(str1.ToString());//得到一个前缀带":"端口号的的数组
int Pcount = 0;//记录有效端口号个数
for (int i = 0; i < mc.Count; i++)
{
string temp = "";
temp = mc[i].ToString();
if (check(str2, temp.Remove(0, 1)),Pcount)//判断是否已存在的端口
{
str2[Pcount++] = temp.Remove(0, 1);//去掉前缀":"
}
}
for (int i = 0; i < Pcount; i++)
{
comboBox1.Items.Add(str2[i]);//用一个comBox加载显示
}
}
public bool check(string[] source, string checker,int Pcount)//检查是否有相同端口号
{
for (int i = 0; i < Pcount; i++)
{
if (checker == source[i])
return false;
}
return true;
}
posted @ 2011-06-05 14:54 皇城阁泪 阅读(171) 评论(2) 编辑
1 using System;
2
3 using System.Collections.Generic;
4
5 using System.Text;
6
7 using Microsoft.Win32;//注册表操作必须引入
8
9 namespace ConsoleApplication8
10
11 {
12
13 class Program
14
15 {
16
17 static void Main(string[] args)
18
19 {
20
21 using (RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))//注册表检索子项
22
23 {
24
25 if (key != null)
26
27 {
28
29 foreach (string keyName in key.GetSubKeyNames())
30
31 {
32
33 using (RegistryKey key2 = key.OpenSubKey(keyName, false))
34
35 {
36
37 if (key2 != null)
38
39 {
40
41 string softwareName = key2.GetValue("DisplayName", "").ToString();
42
43 string installLocation = key2.GetValue("InstallLocation", "").ToString();
44
45 if (!string.IsNullOrEmpty(installLocation))
46
47 {
48
49 Console.WriteLine(string.Format("软件名:{0} -- 安装路径:{1}\r\n", softwareName, installLocation));
50
51 }
52
53 }
54
55 }
56
57 }
58
59 Console.Read();
60
61 }
62
63 }
64
65 }
66
67 }
68
69 }
posted @ 2011-05-08 16:52 皇城阁泪 阅读(182) 评论(0) 编辑
1 using System;
2 using System.Collections.Generic;
3
4 using System.Text;
5
6 using System.Net;//网络应用,必须添加引用
7
8 namespace ConsoleApplication7
9
10 {
11
12 public class Program
13
14 {
15
16 public static void Main(string[] rags)
17
18 {
19
20 IPHostEntry ip_info = Dns.GetHostEntry(Dns.GetHostName());
21
22 // 获取本地计算机的主机名。
23
24 // 返回结果: 包含本地计算机的 DNS 主机名的字符串。
25
26 IPAddress[] ip_list = ip_info.AddressList;
27
28 // 返回结果: 一组字符串,包含解析为 System.Net.IPHostEntry.AddressList 属性中的 IP 地址的 DNS 名称。
29
30 if (ip_list.Length > 1)//局域网
31
32 {
33
34 Console.WriteLine("内网IP地址:{0}", ip_list[0].ToString());
35
36 Console.WriteLine("外网IP地址:{0}", ip_list[1].ToString());
37
38 }
39
40 else if (ip_list.Length > 0)
41
42 {
43
44 Console.WriteLine("IP地址:{0}", ip_list[0].ToString());
45
46 }
47
48 else
49
50 {
51
52 Console.WriteLine("获取IP失败!");
53
54 }
55
56 Console.Read();
57
58 }
59
60 }
61
62 }
posted @ 2011-05-07 13:23 皇城阁泪 阅读(191) 评论(0) 编辑
using System;
using System.Text;
using System.Management;//查看硬件信息的命名空间,必须添加引用
namespace ConsoleApplication7
{
public class Program
{
public static void Main(string[] rags)
{
string mac_ad = "";//结果变量
ManagementClass man = new ManagementClass("Win32_NetworkAdapterConfiguration");
// 表示 WMI 类路径的 System.Management.ManagementPath 实例。该类表示 WMI 中的一个 CIM 管理类。CIM
// 类表示包括硬件、软件、进程等在内的管理信息。
ManagementObjectCollection manObj = man.GetInstances();
// 使用指定选项异步返回包含类的所有实例的集合。
foreach(ManagementObject obj in manObj )
{
if ((bool)obj["IPEnabled"] == true)
{
mac_ad = obj["MacAddress"].ToString();
obj.Dispose();
}
}
Console.WriteLine(mac_ad);
Console.Read();
}
}
}
posted @ 2011-05-07 13:02 皇城阁泪 阅读(134) 评论(0) 编辑