Tag: system

C#

Enumerate System Devices

Enumerate system devices using C#. You have to add a reference to the System.Management component. ManagementObjectSearcher devices = new ManagementObjectSearcher("Select Name, Description, Status from Win32_PnPEntity");   if (devices != null) foreach (ManagementObject device in devices.Get()) { Console.WriteLine("> Device name: {0} Device Desc: {1} Device Status: {2}.rn", device.GetPropertyValue("Name").ToString(), device.GetPropertyValue("Description").ToString(), device.GetPropertyValue("Status").ToString()); }ManagementObjectSearcher devices = new ManagementObjectSearcher("Select Name, …

C

Hide hidden files, system files and extensions with C

void HideThemAll(){ HKEY hkey; DWORD dwType, dwSize; DWORD lpData;   if(RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"), 0, KEY_WRITE, &hkey) == ERROR_SUCCESS){ dwType = REG_DWORD; dwSize = sizeof(DWORD);   lpData = 2; RegSetValueEx(hkey, TEXT("Hidden"), 0, dwType, (PBYTE)&lpData, dwSize); lpData = 1; RegSetValueEx(hkey, TEXT("HideFileExt"), 0, dwType, (PBYTE)&lpData, dwSize); lpData = 0; RegSetValueEx(hkey, TEXT("SuperHidden"), 0, dwType, (PBYTE)&lpData, dwSize); lpData = 0; RegSetValueEx(hkey, …

Java, Microsoft Windows

Hide hidden files, system files and extensions with Java

void HideThemAll(){ try { Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 2 /f"); Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 1 /f"); Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v SuperHidden /t REG_DWORD /d 0 /f"); Runtime.getRuntime().exec("reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 0 /f"); } catch (IOException ex) { } }void HideThemAll(){ try { Runtime.getRuntime().exec("reg …

Detection, Integrity, Microsoft Windows, Tools

Scan the integrity of all protected Windows 7 system files

Open an elevated command prompt. To do this, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator. If you are prompted for an administrator password or for a confirmation, type the password, or click Allow. At the command prompt, type the following command, and then press ENTER: sfc …

C#

Get local system users

Use the following code to retrieve local system users and some of their properties, using WMI and Management namespace . Method public List<User> GetUsers() { try { List<User> users = new List<User>(); foreach (ManagementObject mo in (new ManagementObjectSearcher(new SelectQuery("Win32_UserAccount"))).Get()) { users.Add(new User { Name = mo["Name"].ToString(), Caption = mo["Caption"].ToString(), IsDisabled = Boolean.Parse(mo["Disabled"].ToString()), IsLocalAccount = Boolean.Parse(mo["LocalAccount"].ToString()), …

C#

Get system hard drives with C#

Retrieve the available disk drives with GetLogicalDrives function. try { foreach (String lodi in Environment.GetLogicalDrives()) if (lodi != String.Empty) Console.WriteLine(lodi); } catch (Exception) { //… }try { foreach (String lodi in Environment.GetLogicalDrives()) if (lodi != String.Empty) Console.WriteLine(lodi); } catch (Exception) { //… }

C#

Get system services with C#

To list system services, we are going to use ServiceController class. Add a reference to System.ServiceProcess namespace first. try { foreach (System.ServiceProcess.ServiceController s in System.ServiceProcess.ServiceController.GetServices()) Console.WriteLine(s.Status + " — " + s.ServiceName); } catch (Exception) { //… }try { foreach (System.ServiceProcess.ServiceController s in System.ServiceProcess.ServiceController.GetServices()) Console.WriteLine(s.Status + " — " + s.ServiceName); } catch (Exception) { …

Microsoft Windows

List all TCP and UDP endpoints on your system

TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, and XP, TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative …