Author: rharabien
Date: Thu Mar 31 15:56:24 2011
New Revision: 51212
URL:
http://svn.reactos.org/svn/reactos?rev=51212&view=rev
Log:
[SYSTEMINFO]
Convert TABs to spaces
Print output to stdout instead of stderr
Close opened registry keys
Simplify a bit
Add System Manufacturer and System Model
Add System Up Time (patch by Edijs Kolesnikovics <terminedijs at yahoo dot com>, see
issue 6055 for more details)
Modified:
trunk/rosapps/applications/sysutils/systeminfo/lang/de-DE.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/en-US.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/es-ES.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/fr-FR.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/no-NO.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/pl-PL.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/sk-SK.rc
trunk/rosapps/applications/sysutils/systeminfo/lang/uk-UA.rc
trunk/rosapps/applications/sysutils/systeminfo/resource.h
trunk/rosapps/applications/sysutils/systeminfo/systeminfo.c
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/de-DE.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -32,11 +32,11 @@
SYSTEMINFO /S system /FO CSV /NH\n"
IDS_OS_NAME, "OS Name: %s\n"
-IDS_OS_VERSION, "OS Version: %d.%d.%d %s"
-IDS_OS_BUILD, " Build %s\n"
+IDS_OS_VERSION, "OS Version: %u.%u.%u %s Build %u\n"
IDS_OS_BUILD_TYPE, "OS Build Typ: %s\n"
IDS_REG_OWNER, "Registrierter Benutzer: %s\n"
IDS_REG_ORG, "Registrierte Organisation: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "Produkt ID: %s\n"
IDS_INST_DATE, "Installationsdatum: %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/en-US.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -30,11 +30,11 @@
SYSTEMINFO /S system /FO CSV /NH\n"
IDS_OS_NAME, "OS Name: %s\n"
-IDS_OS_VERSION, "OS Version: %d.%d.%d %s"
-IDS_OS_BUILD, " Build %s\n"
+IDS_OS_VERSION, "OS Version: %u.%u.%u %s Build %u\n"
IDS_OS_BUILD_TYPE, "OS Build Type: %s\n"
IDS_REG_OWNER, "Registered Owner: %s\n"
IDS_REG_ORG, "Registered Organization: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "Product ID: %s\n"
IDS_INST_DATE, "Install Date: %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/es-ES.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -35,11 +35,11 @@
SYSTEMINFO /S sistema /FO CSV /NH\n"
IDS_OS_NAME, "Nombre Sistema Operativo: %s\n"
-IDS_OS_VERSION, "Versión Sistema Operativo: %d.%d.%d %s"
-IDS_OS_BUILD, " Compilación %s\n"
+IDS_OS_VERSION, "Versión Sistema Operativo: %u.%u.%u %s Compilación %u\n"
IDS_OS_BUILD_TYPE, "Tipo Compilación: %s\n"
IDS_REG_OWNER, "Propietario: %s\n"
IDS_REG_ORG, "Organización: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "Identificador de Producto %s\n"
IDS_INST_DATE, "Fecha de Instalación: %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/fr-FR.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -30,11 +30,11 @@
SYSTEMINFO /S système /FO CSV /NH\n"
IDS_OS_NAME, "Nom du système d'exploitation : %s\n"
-IDS_OS_VERSION, "Version du système d'exploitation : %d.%d.%d %s"
-IDS_OS_BUILD, " Compilation %s\n"
+IDS_OS_VERSION, "Version du système d'exploitation : %u.%u.%u %s
Compilation %u\n"
IDS_OS_BUILD_TYPE, "Type de compilation du système d'exploitation
: %s\n"
IDS_REG_OWNER, "Propriétaire enregistré : %s\n"
IDS_REG_ORG, "Organisation enregistrée : %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "ID du produit : %s\n"
IDS_INST_DATE, "Date d'installation : %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/no-NO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/no-NO.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/no-NO.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -30,11 +30,11 @@
SYSTEMINFO /S system /FO CSV /NH\n"
IDS_OS_NAME, "OS navn: %s\n"
-IDS_OS_VERSION, "OS versjon: %d.%d.%d %s"
-IDS_OS_BUILD, " Bygget %s\n"
+IDS_OS_VERSION, "OS versjon: %u.%u.%u %s Bygget %u\n"
IDS_OS_BUILD_TYPE, "OS bygg type: %s\n"
IDS_REG_OWNER, "Registert eier: %s\n"
IDS_REG_ORG, "Registerert organisasjon: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "Produkt ID: %s\n"
IDS_INST_DATE, "Installert dato: %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/pl-PL.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -37,11 +37,11 @@
SYSTEMINFO /S system /FO CSV /NH\n"
IDS_OS_NAME, "Nazwa Systemu: %s\n"
-IDS_OS_VERSION, "Wersja: %d.%d.%d %s"
-IDS_OS_BUILD, " Kompilacja %s\n"
+IDS_OS_VERSION, "Wersja: %u.%u.%u %s Kompilacja %u\n"
IDS_OS_BUILD_TYPE, "Rodzaj kompilacji: %s\n"
IDS_REG_OWNER, "U¿ytkownik: %s\n"
IDS_REG_ORG, "Organizacja: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "ID produktu: %s\n"
IDS_INST_DATE, "Data instalacji: %s, "
IDS_INST_TIME, "%s\n"
@@ -49,7 +49,7 @@
IDS_SYS_TYPE_X86, "Architektura: X86-based PC\n"
IDS_SYS_TYPE_IA64, "Architektura: IA64-based PC\n"
IDS_SYS_TYPE_AMD64, "Rodzaj systemu: AMD64-based PC\n"
-IDS_PROCESSORS, "Iloæ Procesorów: %u .\n"
+IDS_PROCESSORS, "Iloæ Procesorów: %u.\n"
IDS_ROS_DIR, "Katalog ReactOS: %s\n"
IDS_SYS_DIR, "Katalog Systemowy: %s\n"
IDS_BOOT_DEV, "Urz¹dzenie ród³owe: %s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/sk-SK.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/sk-SK.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -34,11 +34,11 @@
SYSTEMINFO /S system /FO CSV /NH\n"
IDS_OS_NAME, "N zov OS: %s\n"
-IDS_OS_VERSION, "Verzia OS: %d.%d.%d %s"
-IDS_OS_BUILD, " Build %s\n"
+IDS_OS_VERSION, "Verzia OS: %u.%u.%u %s Build %u\n"
IDS_OS_BUILD_TYPE, "OS Build typ: %s\n"
IDS_REG_OWNER, "Registovanì vlastn¡k: %s\n"
IDS_REG_ORG, "Registrovan organiz cia: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "ID produktu: %s\n"
IDS_INST_DATE, "D tum inçtal cie: %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/uk-UA.rc [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -38,11 +38,11 @@
SYSTEMINFO /S ñèñòåìà /FO CSV /NH\n"
IDS_OS_NAME, "²ì'ÿ ÎÑ: %s\n"
-IDS_OS_VERSION, "Âåðñ³ÿ ÎÑ: %d.%d.%d %s"
-IDS_OS_BUILD, " Çá³ðêà %s\n"
+IDS_OS_VERSION, "Âåðñ³ÿ ÎÑ: %u.%u.%u %s Çá³ðêà %u\n"
IDS_OS_BUILD_TYPE, "Òèï çá³ðêè ÎÑ: %s\n"
IDS_REG_OWNER, "Çàðåºñòðîâàíèé âëàñíèê: %s\n"
IDS_REG_ORG, "Çàðåºñòðîâàíà îðãàí³çàö³ÿ: %s\n"
+IDS_UP_TIME, "System Up Time: %u Days, %u Hours, %u, Minutes, %u
Seconds\n"
IDS_PRODUCT_ID, "ID ïðîäóêòà: %s\n"
IDS_INST_DATE, "Äàòà óñòàíîâêè: %s, "
IDS_INST_TIME, "%s\n"
Modified: trunk/rosapps/applications/sysutils/systeminfo/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/resource.h [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/resource.h [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -2,13 +2,13 @@
#define IDS_OS_NAME 100
#define IDS_OS_VERSION 101
-#define IDS_OS_BUILD 102
-#define IDS_OS_BUILD_TYPE 103
-#define IDS_REG_OWNER 104
-#define IDS_REG_ORG 105
-#define IDS_PRODUCT_ID 106
-#define IDS_INST_DATE 107
-#define IDS_INST_TIME 108
+#define IDS_OS_BUILD_TYPE 102
+#define IDS_REG_OWNER 103
+#define IDS_REG_ORG 104
+#define IDS_PRODUCT_ID 105
+#define IDS_INST_DATE 106
+#define IDS_INST_TIME 107
+#define IDS_UP_TIME 108
#define IDS_SYS_TYPE_UNKNOWN 109
#define IDS_SYS_TYPE_X86 110
#define IDS_SYS_TYPE_IA64 111
Modified: trunk/rosapps/applications/sysutils/systeminfo/systeminfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/systeminfo.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/systeminfo.c [iso-8859-1] Thu Mar 31
15:56:24 2011
@@ -21,23 +21,26 @@
#include <ctype.h>
#include <windows.h>
#include <io.h>
+#include <tchar.h>
#include "resource.h"
#define BUFFER_SIZE 32767
+#define B_TO_MB(bytes) ((bytes)/(1024*1024))
+#define B_TO_KB(bytes) ((bytes)/1024)
/* Load from resource and convert to OEM */
static
BOOL
GetOemStrings(UINT rcID, LPSTR OutMsg)
{
- TCHAR Msg[BUFFER_SIZE];
- if (LoadString(GetModuleHandle(NULL), rcID, (LPTSTR)Msg, BUFFER_SIZE))
- {
- CharToOem(Msg, OutMsg);
- return TRUE;
- }
- return FALSE;
+ TCHAR Msg[BUFFER_SIZE];
+ if (LoadString(GetModuleHandle(NULL), rcID, (LPTSTR)Msg, BUFFER_SIZE))
+ {
+ CharToOem(Msg, OutMsg);
+ return TRUE;
+ }
+ return FALSE;
}
/* Load data from registry */
@@ -45,25 +48,25 @@
BOOL
GetRegistryValue(HKEY hKeyName, LPCTSTR SubKey, LPCTSTR ValueName, LPCTSTR Buf)
{
- DWORD CharCount = BUFFER_SIZE;
- HKEY hKey;
- LONG lRet;
-
- CharCount = BUFFER_SIZE;
- lRet = RegOpenKeyEx(hKeyName,
- SubKey,
- 0,
- KEY_QUERY_VALUE,
- &hKey);
- if (lRet != ERROR_SUCCESS) return FALSE;
- lRet = RegQueryValueEx(hKey,
- ValueName,
- NULL,
- NULL,
- (LPBYTE)Buf,
- &CharCount);
- if (lRet != ERROR_SUCCESS) return FALSE;
- return TRUE;
+ DWORD CharCount = BUFFER_SIZE;
+ HKEY hKey;
+ LONG lRet;
+
+ lRet = RegOpenKeyEx(hKeyName,
+ SubKey,
+ 0,
+ KEY_QUERY_VALUE,
+ &hKey);
+ if (lRet != ERROR_SUCCESS) return FALSE;
+ lRet = RegQueryValueEx(hKey,
+ ValueName,
+ NULL,
+ NULL,
+ (LPBYTE)Buf,
+ &CharCount);
+ if (lRet != ERROR_SUCCESS) return FALSE;
+ RegCloseKey(hKey);
+ return TRUE;
}
/* Show usage */
@@ -71,298 +74,298 @@
VOID
Usage(VOID)
{
- TCHAR Buf[BUFFER_SIZE];
- if(GetOemStrings(IDS_USAGE,Buf)) printf("%s",Buf);
+ TCHAR Buf[BUFFER_SIZE];
+ if(GetOemStrings(IDS_USAGE, Buf)) printf("%s",Buf);
}
/* Print all system information */
VOID
AllSysInfo(VOID)
{
- DWORD CharCount = BUFFER_SIZE;
- OSVERSIONINFO VersionInfo;
- BOOL bOsVersionInfoEx;
- SYSTEM_INFO SysInfo;
- TCHAR Buf[BUFFER_SIZE],Tmp[BUFFER_SIZE], Msg[BUFFER_SIZE];
- MEMORYSTATUS memory;
- unsigned int DIV = 1024;
- TIME_ZONE_INFORMATION TimeZoneInfo;
-
- GetSystemInfo(&SysInfo);
-
- // getting computer name
- CharCount = BUFFER_SIZE;
- if(!GetComputerName(Buf,&CharCount)) printf("Error getting:
GetComputerName");
- if(GetOemStrings(IDS_HOST_NAME,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting OS Name
- GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("ProductName"),
- Buf);
- if(GetOemStrings(IDS_OS_NAME,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting OS Version
- ZeroMemory(&VersionInfo, sizeof(OSVERSIONINFO));
- VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if(!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*)&VersionInfo)))
- {
- VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (!GetVersionEx((OSVERSIONINFO*)&VersionInfo))
- return;
- }
- if (VersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
- {
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("CSDVersion"),
- Buf))
- if(GetOemStrings(IDS_OS_VERSION,Msg))
- fprintf(stderr, Msg,
- (int)VersionInfo.dwMajorVersion,
- (int)VersionInfo.dwMinorVersion,
- (int)VersionInfo.dwBuildNumber,
- Buf);
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("CurrentBuildNumber"),
- Buf))
- if(GetOemStrings(IDS_OS_BUILD,Msg)) fprintf(stderr,Msg,Buf);
- }
-
- //getting OS Manufacturer
-
- //getting OS Configuration
-
- //getting OS Build Type
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("CurrentType"),
- Buf))
- if(GetOemStrings(IDS_OS_BUILD_TYPE,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Registered Owner
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("RegisteredOwner"),
- Buf))
- if(GetOemStrings(IDS_REG_OWNER,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Registered Organization
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("RegisteredOrganization"),
- Buf))
- if(GetOemStrings(IDS_REG_ORG,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Product ID
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
- TEXT("ProductId"),
- Buf))
- if(GetOemStrings(IDS_PRODUCT_ID,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Install Date
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\WBEM\\CIMOM"),
- TEXT("SetupDate"),
- Buf))
- if(GetOemStrings(IDS_INST_DATE,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Install Time
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\WBEM\\CIMOM"),
- TEXT("SetupTime"),
- Buf))
- if(GetOemStrings(IDS_INST_TIME,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting System Up Time
-
- //getting System Manufacturer
-
- //getting System Model
-
- //getting System type
- switch (SysInfo.wProcessorArchitecture)
- {
- case PROCESSOR_ARCHITECTURE_UNKNOWN:
- if(GetOemStrings(IDS_SYS_TYPE_UNKNOWN,Msg)) printf("%s",Msg);
- break;
- case PROCESSOR_ARCHITECTURE_INTEL:
- if(GetOemStrings(IDS_SYS_TYPE_X86,Msg)) printf("%s",Msg);
- break;
- case PROCESSOR_ARCHITECTURE_IA64:
- if(GetOemStrings(IDS_SYS_TYPE_IA64,Msg)) printf("%s",Msg);
- break;
- case PROCESSOR_ARCHITECTURE_AMD64:
- if(GetOemStrings(IDS_SYS_TYPE_AMD64,Msg)) printf("%s",Msg);
- break;
- }
-
- //getting Processor(s)
- if(GetOemStrings(IDS_PROCESSORS,Msg))
- {
- unsigned int i;
- fprintf(stderr,Msg,(unsigned int)SysInfo.dwNumberOfProcessors);
- for(i = 0; i < (unsigned int)SysInfo.dwNumberOfProcessors; i++)
- {
- sprintf(Tmp,"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%u",i);
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- (LPCTSTR)Tmp,
- TEXT("Identifier"),
- Buf))
- printf(" [0%u]: %s",i+1,Buf);
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- (LPCTSTR)Tmp,
- TEXT("VendorIdentifier"),
- Buf))
- printf(" %s\n",Buf);
- }
- }
-
- //getting BIOS Version
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("HARDWARE\\DESCRIPTION\\System"),
- TEXT("SystemBiosVersion"),
- Buf))
- if(GetOemStrings(IDS_BIOS_VERSION,Msg)) fprintf(stderr,Msg,Buf);
-
- //gettings BIOS date
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("HARDWARE\\DESCRIPTION\\System"),
- TEXT("SystemBiosDate"),
- Buf))
- if(GetOemStrings(IDS_BIOS_DATE,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting ReactOS Directory
- if(!GetWindowsDirectory(Buf,BUFFER_SIZE)) printf("Error getting:
GetWindowsDirectory");
- if(GetOemStrings(IDS_ROS_DIR,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting System Directory
- if(!GetSystemDirectory(Buf,BUFFER_SIZE)) printf("Error getting:
GetSystemDirectory");
- if(GetOemStrings(IDS_SYS_DIR,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Boot Device
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SYSTEM\\Setup"),
- TEXT("SystemPartition"),
- Buf))
- if(GetOemStrings(IDS_BOOT_DEV,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting System Locale
- if (GetRegistryValue(HKEY_CURRENT_USER,
- TEXT("Control Panel\\International"),
- TEXT("Locale"),
- Tmp))
- if (GetRegistryValue(HKEY_CLASSES_ROOT,
- TEXT("MIME\\Database\\Rfc1766"),
- (LPTSTR)Tmp,
- Buf))
- if(GetOemStrings(IDS_SYS_LOCALE,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Input Locale
- if (GetRegistryValue(HKEY_CURRENT_USER,
- TEXT("Keyboard Layout\\Preload"),
- TEXT("1"),
- Buf))
- {
- int i,j;
- for(j = 0, i = 4; i <= 8; j++, i++) Tmp[j] = Buf[i];
- if (GetRegistryValue(HKEY_CLASSES_ROOT,
- TEXT("MIME\\Database\\Rfc1766"),
- (LPTSTR)Tmp,
- Buf))
- if(GetOemStrings(IDS_INPUT_LOCALE,Msg)) fprintf(stderr,Msg,Buf);
- }
-
- //getting Time Zone
- GetTimeZoneInformation(&TimeZoneInfo);
- sprintf(Tmp,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time
Zones\\%S",TimeZoneInfo.StandardName);
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- (LPCTSTR)Tmp,
- TEXT("Display"),
- Buf))
- if(GetOemStrings(IDS_TIME_ZONE,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Total Physical Memory
- GlobalMemoryStatus(&memory);
- if(GetOemStrings(IDS_TOTAL_PHYS_MEM,Msg))
- fprintf(stderr,
- Msg,
- memory.dwTotalPhys/(DIV*DIV),
- memory.dwTotalPhys/DIV);
-
- //getting Available Physical Memory
- if(GetOemStrings(IDS_AVAIL_PHISICAL_MEM,Msg))
- fprintf(stderr,
- Msg,
- memory.dwAvailPhys/(DIV*DIV),
- memory.dwAvailPhys/DIV);
-
- //getting Virtual Memory: Max Size
- if(GetOemStrings(IDS_VIRT_MEM_MAX,Msg))
- fprintf(stderr,
- Msg,
- memory.dwTotalVirtual/(DIV*DIV),
- memory.dwTotalVirtual/DIV);
-
- //getting Virtual Memory: Available
- if(GetOemStrings(IDS_VIRT_MEM_AVAIL,Msg))
- fprintf(stderr,
- Msg,
- memory.dwAvailVirtual/(DIV*DIV),
- memory.dwAvailVirtual/DIV);
-
- //getting Virtual Memory: In Use
- if(GetOemStrings(IDS_VIRT_MEM_INUSE,Msg))
- fprintf(stderr,
- Msg,
- (memory.dwTotalVirtual-memory.dwAvailVirtual)/(DIV*DIV),
- (memory.dwTotalVirtual-memory.dwAvailVirtual)/DIV);
-
- //getting Page File Location(s)
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SYSTEM\\ControlSet001\\Control\\Session Manager\\Memory
Management"),
- TEXT("PagingFiles"),
- Buf))
- {
- int i;
- for(i = 0; i < strlen((char*)Buf); i++)
- {
- if (Buf[i] == ' ')
- {
- Buf[i] = '\0';
- break;
- }
- }
- if(GetOemStrings(IDS_PAGEFILE_LOC,Msg)) fprintf(stderr,Msg,Buf);
- }
-
- //getting Domain
- if (GetRegistryValue(HKEY_LOCAL_MACHINE,
- TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"),
- TEXT("CachePrimaryDomain"),
- Buf))
- if(GetOemStrings(IDS_DOMINE,Msg)) fprintf(stderr,Msg,Buf);
-
- //getting Logon Server
-
- //getting NetWork Card(s)
- if(GetOemStrings(IDS_NETWORK_CARDS,Msg))
- {
-
- }
+ DWORD dwCharCount = BUFFER_SIZE;
+ OSVERSIONINFO VersionInfo;
+ SYSTEM_INFO SysInfo;
+ TCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], Msg[BUFFER_SIZE], szSystemDir[MAX_PATH];
+ MEMORYSTATUS MemoryStatus;
+ unsigned int cSeconds;
+ TIME_ZONE_INFORMATION TimeZoneInfo;
+
+ if (!GetSystemDirectory(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0])))
+ printf("Error getting: GetSystemDirectory\n");
+ GetSystemInfo(&SysInfo);
+
+ // getting computer name
+ dwCharCount = BUFFER_SIZE;
+ if (!GetComputerName(Buf, &dwCharCount))
+ printf("Error getting: GetComputerName");
+ if (GetOemStrings(IDS_HOST_NAME, Msg))
+ printf(Msg, Buf);
+
+ //getting OS Name
+ GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
+ TEXT("ProductName"),
+ Buf);
+ if (GetOemStrings(IDS_OS_NAME, Msg)) printf(Msg, Buf);
+
+ //getting OS Version
+ ZeroMemory(&VersionInfo, sizeof(VersionInfo));
+ VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
+ GetVersionEx(&VersionInfo);
+
+ if (GetOemStrings(IDS_OS_VERSION, Msg))
+ printf(Msg,
+ (unsigned)VersionInfo.dwMajorVersion,
+ (unsigned)VersionInfo.dwMinorVersion,
+ (unsigned)VersionInfo.dwBuildNumber,
+ VersionInfo.szCSDVersion,
+ (unsigned)VersionInfo.dwBuildNumber);
+
+ //getting OS Manufacturer
+
+ //getting OS Configuration
+
+ //getting OS Build Type
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion"),
+ TEXT("CurrentType"),
+ Buf))
+ if (GetOemStrings(IDS_OS_BUILD_TYPE, Msg)) printf(Msg, Buf);
+
+ //getting Registered Owner
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion"),
+ TEXT("RegisteredOwner"),
+ Buf))
+ if (GetOemStrings(IDS_REG_OWNER, Msg)) printf(Msg, Buf);
+
+ //getting Registered Organization
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion"),
+ TEXT("RegisteredOrganization"),
+ Buf))
+ if (GetOemStrings(IDS_REG_ORG, Msg)) printf(Msg, Buf);
+
+ //getting Product ID // use SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion"),
+ TEXT("ProductId"),
+ Buf))
+ if (GetOemStrings(IDS_PRODUCT_ID, Msg)) printf(Msg, Buf);
+
+ //getting Install Date
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\WBEM\\CIMOM"),
+ TEXT("SetupDate"),
+ Buf))
+ if (GetOemStrings(IDS_INST_DATE, Msg)) printf(Msg, Buf);
+
+ //getting Install Time
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\WBEM\\CIMOM"),
+ TEXT("SetupTime"),
+ Buf))
+ if (GetOemStrings(IDS_INST_TIME, Msg)) printf(Msg, Buf);
+
+ //getting System Up Time
+ cSeconds = GetTickCount() / 1000;
+ if (GetOemStrings(IDS_UP_TIME, Msg))
+ printf(Msg, cSeconds / (60*60*24), (cSeconds / (60*60)) % 24, (cSeconds / 60) %
60, cSeconds % 60);
+
+ //getting System Manufacturer
+ sprintf(Tmp, "%s\\oeminfo.ini", szSystemDir);
+ GetPrivateProfileString(TEXT("General"),
+ TEXT("Manufacturer"),
+ TEXT("To Be Filled By O.E.M."),
+ Buf,
+ sizeof(Buf)/sizeof(Buf[0]),
+ Tmp);
+ printf("System Manufacturer:\t\t%s\n", Buf);
+
+ //getting System Model
+ GetPrivateProfileString(TEXT("General"),
+ TEXT("Model"),
+ TEXT("To Be Filled By O.E.M."),
+ Buf,
+ sizeof(Buf)/sizeof(Buf[0]),
+ Tmp);
+ printf("System Model:\t\t\t%s\n", Buf);
+
+ //getting System type
+ switch (SysInfo.wProcessorArchitecture)
+ {
+ case PROCESSOR_ARCHITECTURE_UNKNOWN:
+ if (GetOemStrings(IDS_SYS_TYPE_UNKNOWN, Msg)) printf("%s", Msg);
+ break;
+ case PROCESSOR_ARCHITECTURE_INTEL:
+ if (GetOemStrings(IDS_SYS_TYPE_X86, Msg)) printf("%s", Msg);
+ break;
+ case PROCESSOR_ARCHITECTURE_IA64:
+ if (GetOemStrings(IDS_SYS_TYPE_IA64, Msg)) printf("%s", Msg);
+ break;
+ case PROCESSOR_ARCHITECTURE_AMD64:
+ if (GetOemStrings(IDS_SYS_TYPE_AMD64, Msg)) printf("%s", Msg);
+ break;
+ }
+
+ //getting Processor(s)
+ if (GetOemStrings(IDS_PROCESSORS, Msg))
+ {
+ unsigned int i;
+ printf(Msg, (unsigned int)SysInfo.dwNumberOfProcessors);
+ for(i = 0; i < (unsigned int)SysInfo.dwNumberOfProcessors; i++)
+ {
+
sprintf(Tmp,"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%u",i);
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ (LPCTSTR)Tmp,
+ TEXT("Identifier"),
+ Buf))
+ printf(" [0%u]: %s", i+1, Buf);
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ (LPCTSTR)Tmp,
+ TEXT("VendorIdentifier"),
+ Buf))
+ printf(" %s\n", Buf);
+ }
+ }
+
+ //getting BIOS Version
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("HARDWARE\\DESCRIPTION\\System"),
+ TEXT("SystemBiosVersion"),
+ Buf))
+ if (GetOemStrings(IDS_BIOS_VERSION, Msg)) printf(Msg, Buf);
+
+ //gettings BIOS date
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("HARDWARE\\DESCRIPTION\\System"),
+ TEXT("SystemBiosDate"),
+ Buf))
+ if (GetOemStrings(IDS_BIOS_DATE, Msg)) printf(Msg, Buf);
+
+ //getting ReactOS Directory
+ if (!GetWindowsDirectory(Buf, BUFFER_SIZE)) printf("Error getting:
GetWindowsDirectory");
+ if (GetOemStrings(IDS_ROS_DIR, Msg)) printf(Msg, Buf);
+
+ //getting System Directory
+ if (GetOemStrings(IDS_SYS_DIR, Msg)) printf(Msg, szSystemDir);
+
+ //getting Boot Device
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SYSTEM\\Setup"),
+ TEXT("SystemPartition"),
+ Buf))
+ if (GetOemStrings(IDS_BOOT_DEV, Msg)) printf(Msg, Buf);
+
+ //getting System Locale
+ if (GetRegistryValue(HKEY_CURRENT_USER,
+ TEXT("Control Panel\\International"),
+ TEXT("Locale"),
+ Tmp))
+ if (GetRegistryValue(HKEY_CLASSES_ROOT,
+ TEXT("MIME\\Database\\Rfc1766"),
+ (LPTSTR)Tmp,
+ Buf))
+ if (GetOemStrings(IDS_SYS_LOCALE, Msg)) printf(Msg, Buf);
+
+ //getting Input Locale
+ if (GetRegistryValue(HKEY_CURRENT_USER,
+ TEXT("Keyboard Layout\\Preload"),
+ TEXT("1"),
+ Buf))
+ {
+ int i,j;
+ for(j = 0, i = 4; i <= 8; j++, i++) Tmp[j] = Buf[i];
+ if (GetRegistryValue(HKEY_CLASSES_ROOT,
+ TEXT("MIME\\Database\\Rfc1766"),
+ (LPTSTR)Tmp,
+ Buf))
+ if (GetOemStrings(IDS_INPUT_LOCALE, Msg)) printf(Msg, Buf);
+ }
+
+ //getting Time Zone
+ GetTimeZoneInformation(&TimeZoneInfo);
+ sprintf(Tmp,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time
Zones\\%S",TimeZoneInfo.StandardName);
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ (LPCTSTR)Tmp,
+ TEXT("Display"),
+ Buf))
+ if (GetOemStrings(IDS_TIME_ZONE, Msg)) printf(Msg, Buf);
+
+ //getting Total Physical Memory
+ GlobalMemoryStatus(&MemoryStatus);
+ if(GetOemStrings(IDS_TOTAL_PHYS_MEM, Msg))
+ printf(Msg,
+ B_TO_MB(MemoryStatus.dwTotalPhys),
+ B_TO_KB(MemoryStatus.dwTotalPhys));
+
+ //getting Available Physical Memory
+ if(GetOemStrings(IDS_AVAIL_PHISICAL_MEM,Msg))
+ printf(Msg,
+ B_TO_MB(MemoryStatus.dwAvailPhys),
+ B_TO_KB(MemoryStatus.dwAvailPhys));
+
+ //getting Virtual Memory: Max Size
+ if(GetOemStrings(IDS_VIRT_MEM_MAX, Msg))
+ printf(Msg,
+ B_TO_MB(MemoryStatus.dwTotalVirtual),
+ B_TO_KB(MemoryStatus.dwTotalVirtual));
+
+ //getting Virtual Memory: Available
+ if(GetOemStrings(IDS_VIRT_MEM_AVAIL, Msg))
+ printf(Msg,
+ B_TO_MB(MemoryStatus.dwAvailVirtual),
+ B_TO_KB(MemoryStatus.dwAvailVirtual));
+
+ //getting Virtual Memory: In Use
+ if(GetOemStrings(IDS_VIRT_MEM_INUSE, Msg))
+ printf(Msg,
+ B_TO_MB(MemoryStatus.dwTotalVirtual-MemoryStatus.dwAvailVirtual),
+ B_TO_KB(MemoryStatus.dwTotalVirtual-MemoryStatus.dwAvailVirtual));
+
+ //getting Page File Location(s)
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SYSTEM\\ControlSet001\\Control\\Session
Manager\\Memory Management"),
+ TEXT("PagingFiles"),
+ Buf))
+ {
+ int i;
+ for(i = 0; i < strlen((char*)Buf); i++)
+ {
+ if (Buf[i] == ' ')
+ {
+ Buf[i] = '\0';
+ break;
+ }
+ }
+ if(GetOemStrings(IDS_PAGEFILE_LOC, Msg)) printf(Msg, Buf);
+ }
+
+ //getting Domain
+ if (GetRegistryValue(HKEY_LOCAL_MACHINE,
+ TEXT("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Winlogon"),
+ TEXT("CachePrimaryDomain"),
+ Buf))
+ if(GetOemStrings(IDS_DOMINE, Msg)) printf(Msg, Buf);
+
+ //getting Logon Server
+
+ //getting NetWork Card(s)
+ if(GetOemStrings(IDS_NETWORK_CARDS, Msg))
+ {
+
+ }
}
/* Main program */
int
main(int argc, char *argv[])
{
- if (argc > 1 && !strcmp(argv[1], "/?"))
- {
- Usage();
- return 0;
- }
- AllSysInfo();
- return 0;
-}
+ if (argc > 1 && (!strcmp(argv[1], "/?") || !strcmp(argv[1],
"-?")))
+ {
+ Usage();
+ return 0;
+ }
+ AllSysInfo();
+ return 0;
+}