PDA

View Full Version : آموزش: اطلاعات سخت افزار سیستم



shahabsalehi99
چهارشنبه 12 تیر 1392, 11:15 صبح
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Windows.Forms;
namespace InfoHardwareDLL
{
public class Info
{
public string Name;
public string Manufacturer;
public string SerialNumber;
public string Speed;
public string Capacity;
//============================================
public void GrtInfoCPU()
{
ManagementClass mc = new ManagementClass("win32_processor");
ManagementObjectCollection moc = mc.GetInstances();
string InfoID = "No This Property This Device";
string InfoName = "No This Property This Device";
string InfoManufacturer = "No This Property This Device";
try
{
foreach (ManagementObject mo in moc)
{
InfoID = mo.Properties["processorID"].Value.ToString();
InfoName = mo.Properties["Name"].Value.ToString();
InfoManufacturer = mo.Properties["Manufacturer"].Value.ToString();
break;
}
}
catch
{
InfoID = "No This Property This Device";
InfoName = "No This Property This Device";
InfoManufacturer = "No This Property This Device";
}
//============================================
MessageBox.Show("Name: " + InfoName + "\r\n" +
"Manufacturer: " + InfoManufacturer + "\r\n" +
"SerialNumber: " + InfoID + "\r\n"
, "اطلاعات پردازنده شما", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public void GetInfoMemory()
{
ManagementClass mc = new ManagementClass("Win32_PhysicalMemory");
ManagementObjectCollection moc = mc.GetInstances();
string InfoID = "No This Property This Device";
string InfoName = "No This Property This Device";
string InfoManufacturer = "No This Property This Device";
string InfoSpeed = "No This Property This Device";
string InfoCapacity = "No This Property This Device";
try
{
foreach (ManagementObject mo in moc)
{
InfoID = mo.Properties["SerialNumber"].Value.ToString();
InfoName = mo.Properties["Name"].Value.ToString();
InfoManufacturer = mo.Properties["Manufacturer"].Value.ToString();
InfoSpeed = mo.Properties["Speed"].Value.ToString();
InfoCapacity = mo.Properties["Capacity"].Value.ToString();
break;
}
}
catch
{
InfoID = "No This Property This Device";
InfoName = "No This Property This Device";
InfoManufacturer = "No This Property This Device";
InfoSpeed = "No This Property This Device";
InfoCapacity = "No This Property This Device";
}
//============================================
double cap = Convert.ToDouble(InfoCapacity);
MessageBox.Show("Name: " + InfoName + "\r\n" +
"Manufacturer: " + InfoManufacturer + "\r\n" +
"SerialNumber: " + InfoID + "\r\n" +
"Speed: " +InfoSpeed + "\r\n" +
"Capacity: "+ ((cap/1024)/1024).ToString()+" "+"MB"
, "اطلاعات حافظه شما", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public void GetInfoDVD_CD()
{
ManagementClass mc = new ManagementClass("Win32_CDROMDrive");
ManagementObjectCollection moc = mc.GetInstances();
string InfoID = "No This Property This Device";
string InfoName = "No This Property This Device";
string InfDrive = "No This Property This Device";
try
{
foreach (ManagementObject mo in moc)
{
InfoID = mo.Properties["DeviceID"].Value.ToString();
InfoName = mo.Properties["Name"].Value.ToString();
InfDrive = mo.Properties["Drive"].Value.ToString();
break;
}
}
catch
{
InfoID = "No This Property This Device";
InfoName = "No This Property This Device";
InfDrive = "No This Property This Device";
}
//============================================
MessageBox.Show("Name: " + InfoName + "\r\n" +
"Drive: " + InfDrive + "\r\n" +
"SerialNumber: " + InfoID + "\r\n"
, "اطلاعات گرداننده دیسک شما", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

مهرداد صفا
چهارشنبه 12 تیر 1392, 13:10 عصر
با سلام
تمام اطلاعات سخت افزاری، سیستمی ، ویندوز ، کاربرها و........
All Hardware Class in WMI (http://barnamenevis.org/showthread.php?146360-All-Hardware-Class-in-WMI)

saeidpsl
چهارشنبه 12 تیر 1392, 16:09 عصر
processor ID رو میشه هک کرد ؟