Author: rharabien
Date: Tue Apr 5 21:20:42 2011
New Revision: 51260
URL:
http://svn.reactos.org/svn/reactos?rev=51260&view=rev
Log:
[SYSTEMINFO]
Add Italian translation (patch by Vincenzo Cotugno <vins8920 at hotmail dot com>)
Decrease buffer size
Don't print NULL domain/workgroup
Add network adapters detection
Added:
trunk/rosapps/applications/sysutils/systeminfo/lang/it-IT.rc (with props)
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/rsrc.rc
trunk/rosapps/applications/sysutils/systeminfo/systeminfo.c
trunk/rosapps/applications/sysutils/systeminfo/systeminfo.rbuild
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] Tue Apr 5
21:20:42 2011
@@ -64,5 +64,11 @@
IDS_DOMAIN, "Domain"
IDS_NETWORK_CARDS, "Netzwerkkarte(n)"
IDS_NETWORK_CARDS_FORMAT, "%u Installiert."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
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] Tue Apr 5
21:20:42 2011
@@ -62,5 +62,11 @@
IDS_DOMAIN, "Domain"
IDS_NETWORK_CARDS, "Network Card(s)"
IDS_NETWORK_CARDS_FORMAT, "%u Installed."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
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] Tue Apr 5
21:20:42 2011
@@ -67,5 +67,11 @@
IDS_DOMAIN, "Dominio"
IDS_NETWORK_CARDS, "Tarjeta(s) de Red"
IDS_NETWORK_CARDS_FORMAT, "%u No Instalada."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
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] Tue Apr 5
21:20:42 2011
@@ -62,5 +62,11 @@
IDS_DOMAIN, "Domaine"
IDS_NETWORK_CARDS, "Carte(s) réseau"
IDS_NETWORK_CARDS_FORMAT, "%u installée(s)."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
Added: trunk/rosapps/applications/sysutils/systeminfo/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/lang/it-IT.rc (added)
+++ trunk/rosapps/applications/sysutils/systeminfo/lang/it-IT.rc [iso-8859-1] Tue Apr 5
21:20:42 2011
@@ -1,0 +1,72 @@
+LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
+
+STRINGTABLE DISCARDABLE
+BEGIN
+
+IDS_USAGE, "SYSTEMINFO [/S sistema [/U nomeutente [/P [password]]]] [/FO formato]
[/NH]\n\n\
+Descrizione:\n\
+ Questà utilità permettere ad un amministratore di\n\
+ visualizzare alcune informazioni basilari sulla configurazione del pc.\n\n\
+Lista Parametri:\n\
+ /S sistema Specifica il sistema remoto a cui connettersi.\n\n\
+ /U [dominio\\]utente Specifica il contesto utente in cui eseguire\n\
+ il comando.\n\n\
+ /P [password] Specifica la password per il dato\n\
+ contesto utente. Se omesso, viene richiesto.\n\n\
+ /FO formato Specifica il formato con cui l'output\n\
+ viene mostrato.\n\
+ Valori Validi: ""TABLE"",
""LIST"", ""CSV"".\n\n\
+ /NH Specifica che la ""Etichetta Colonna""
non\n\
+ deve essere mostrata nell'output.\n\
+ Valido solo per i formati ""TABLE"" e
""CSV"" .\n\n\
+ /? Mostra questo aiuto.\n\n\
+Esempi:\n\
+ SYSTEMINFO\n\
+ SYSTEMINFO /?\n\
+ SYSTEMINFO /S sistema\n\
+ SYSTEMINFO /S sistema /U utente\n\
+ SYSTEMINFO /S sistema /U dominio\\utente /P password /FO TABLE\n\
+ SYSTEMINFO /S sistema /FO LIST\n\
+ SYSTEMINFO /S sistema /FO CSV /NH\n"
+
+IDS_HOST_NAME, "Nome Host"
+IDS_OS_NAME, "Nome SO"
+IDS_OS_VERSION, "Versione SO"
+IDS_BUILD, "Build"
+IDS_OS_BUILD_TYPE, "Tipo SO"
+IDS_REG_OWNER, "Proprietario Registrato"
+IDS_REG_ORG, "Organizzazione Registrata"
+IDS_PRODUCT_ID, "ID Prodotto"
+IDS_INST_DATE, "Data Installazione"
+IDS_UP_TIME, "Tempo di Avvio Sistema"
+IDS_UP_TIME_FORMAT "%u Giorno, %u Ore, %u Minuti, %u Secondi"
+IDS_SYS_MANUFACTURER, "Produttore PC"
+IDS_SYS_MODEL, "Modello Sistema"
+IDS_SYS_TYPE, "Tipo Sistema"
+IDS_PROCESSORS, "Processore"
+IDS_PROCESSORS_FORMAT, "%u Processore(i) Installato."
+IDS_BIOS_DATE, "Data BIOS"
+IDS_BIOS_VERSION, "Versione BIOS"
+IDS_ROS_DIR, "Directory ReactOS"
+IDS_SYS_DIR, "Directory di Sistema"
+IDS_BOOT_DEV, "Periferica di Avvio"
+IDS_SYS_LOCALE, "Impostazioni Locali Sistema"
+IDS_INPUT_LOCALE, "Impostazioni Locali Input"
+IDS_TIME_ZONE, "Fuso Orario"
+IDS_TOTAL_PHYS_MEM, "Memoria Fisica Totale"
+IDS_AVAIL_PHISICAL_MEM, "Memoria Fisica Disponibile"
+IDS_VIRT_MEM_MAX, "Memoria Virtuale: Dimensione Massima"
+IDS_VIRT_MEM_AVAIL, "Memoria Virtuale: Disponibile"
+IDS_VIRT_MEM_INUSE, "Memoria Virtuale: In Uso"
+IDS_PAGEFILE_LOC, "Posizioni File di Paging"
+IDS_DOMAIN, "Dominio"
+IDS_NETWORK_CARDS, "Schede di Rete"
+IDS_NETWORK_CARDS_FORMAT, "%u Installate."
+IDS_CONNECTION_NAME, "Nome Connessione"
+IDS_STATUS, "Stato"
+IDS_MEDIA_DISCONNECTED, "Disconnesso"
+IDS_DHCP_ENABLED, "DHCP Abilitato"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "Indirizzo(i) IP"
+
+END
Propchange: trunk/rosapps/applications/sysutils/systeminfo/lang/it-IT.rc
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/rosapps/applications/sysutils/systeminfo/lang/it-IT.rc
------------------------------------------------------------------------------
svn:mime-type = text/plain
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] Tue Apr 5
21:20:42 2011
@@ -62,5 +62,11 @@
IDS_DOMAIN, "Domene"
IDS_NETWORK_CARDS, "Nettverkskort(er)"
IDS_NETWORK_CARDS_FORMAT, "%u installert."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
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] Tue Apr 5
21:20:42 2011
@@ -69,5 +69,11 @@
IDS_DOMAIN, "Domena"
IDS_NETWORK_CARDS, "Karty sieciowe"
IDS_NETWORK_CARDS_FORMAT, "Zainstalowane karty NIC: %u."
+IDS_CONNECTION_NAME, "Nazwa po³¹czenia"
+IDS_STATUS, "Stan"
+IDS_MEDIA_DISCONNECTED, "Nonik od³¹czony"
+IDS_DHCP_ENABLED, "DHCP w³¹czone"
+IDS_NO, "Nie"
+IDS_IP_ADDRESSES, "Adresy IP"
END
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] Tue Apr 5
21:20:42 2011
@@ -66,5 +66,11 @@
IDS_DOMAIN, "Domna"
IDS_NETWORK_CARDS, "Sieov karta(y)"
IDS_NETWORK_CARDS_FORMAT, "%u nainçtalovan."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
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] Tue Apr 5
21:20:42 2011
@@ -70,5 +70,11 @@
IDS_DOMAIN, "Äîìåí"
IDS_NETWORK_CARDS, "Ìåðåæíà êàðòà(è)"
IDS_NETWORK_CARDS_FORMAT, "%u Installed."
+IDS_CONNECTION_NAME, "Connection Name"
+IDS_STATUS, "Status"
+IDS_MEDIA_DISCONNECTED, "Media disconnected"
+IDS_DHCP_ENABLED, "DHCP Enabled"
+IDS_NO, "No"
+IDS_IP_ADDRESSES, "IP address(es)"
END
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] Tue Apr 5
21:20:42 2011
@@ -1,35 +1,41 @@
-#define IDS_USAGE 1000
+#define IDS_USAGE 1000
-#define IDS_HOST_NAME 100
-#define IDS_OS_NAME 101
-#define IDS_OS_VERSION 102
-#define IDS_BUILD 103
-#define IDS_OS_BUILD_TYPE 104
-#define IDS_REG_OWNER 105
-#define IDS_REG_ORG 106
-#define IDS_PRODUCT_ID 107
-#define IDS_INST_DATE 108
-#define IDS_UP_TIME 109
-#define IDS_UP_TIME_FORMAT 110
-#define IDS_SYS_MANUFACTURER 111
-#define IDS_SYS_MODEL 112
-#define IDS_SYS_TYPE 113
-#define IDS_PROCESSORS 114
-#define IDS_PROCESSORS_FORMAT 115
-#define IDS_BIOS_DATE 116
-#define IDS_BIOS_VERSION 117
-#define IDS_ROS_DIR 118
-#define IDS_SYS_DIR 119
-#define IDS_BOOT_DEV 120
-#define IDS_SYS_LOCALE 121
-#define IDS_INPUT_LOCALE 122
-#define IDS_TOTAL_PHYS_MEM 123
-#define IDS_AVAIL_PHISICAL_MEM 124
-#define IDS_VIRT_MEM_MAX 125
-#define IDS_VIRT_MEM_AVAIL 126
-#define IDS_VIRT_MEM_INUSE 127
-#define IDS_PAGEFILE_LOC 128
-#define IDS_TIME_ZONE 129
-#define IDS_DOMAIN 130
-#define IDS_NETWORK_CARDS 131
+#define IDS_HOST_NAME 100
+#define IDS_OS_NAME 101
+#define IDS_OS_VERSION 102
+#define IDS_BUILD 103
+#define IDS_OS_BUILD_TYPE 104
+#define IDS_REG_OWNER 105
+#define IDS_REG_ORG 106
+#define IDS_PRODUCT_ID 107
+#define IDS_INST_DATE 108
+#define IDS_UP_TIME 109
+#define IDS_UP_TIME_FORMAT 110
+#define IDS_SYS_MANUFACTURER 111
+#define IDS_SYS_MODEL 112
+#define IDS_SYS_TYPE 113
+#define IDS_PROCESSORS 114
+#define IDS_PROCESSORS_FORMAT 115
+#define IDS_BIOS_DATE 116
+#define IDS_BIOS_VERSION 117
+#define IDS_ROS_DIR 118
+#define IDS_SYS_DIR 119
+#define IDS_BOOT_DEV 120
+#define IDS_SYS_LOCALE 121
+#define IDS_INPUT_LOCALE 122
+#define IDS_TOTAL_PHYS_MEM 123
+#define IDS_AVAIL_PHISICAL_MEM 124
+#define IDS_VIRT_MEM_MAX 125
+#define IDS_VIRT_MEM_AVAIL 126
+#define IDS_VIRT_MEM_INUSE 127
+#define IDS_PAGEFILE_LOC 128
+#define IDS_TIME_ZONE 129
+#define IDS_DOMAIN 130
+#define IDS_NETWORK_CARDS 131
#define IDS_NETWORK_CARDS_FORMAT 132
+#define IDS_CONNECTION_NAME 133
+#define IDS_STATUS 134
+#define IDS_MEDIA_DISCONNECTED 135
+#define IDS_DHCP_ENABLED 136
+#define IDS_NO 137
+#define IDS_IP_ADDRESSES 138
Modified: trunk/rosapps/applications/sysutils/systeminfo/rsrc.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/rsrc.rc [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/systeminfo/rsrc.rc [iso-8859-1] Tue Apr 5
21:20:42 2011
@@ -5,7 +5,9 @@
#include "lang/en-US.rc"
#include "lang/es-ES.rc"
#include "lang/fr-FR.rc"
+#include "lang/it-IT.rc"
+#include "lang/no-NO.rc"
#include "lang/pl-PL.rc"
#include "lang/sk-SK.rc"
#include "lang/uk-UA.rc"
-#include "lang/no-NO.rc"
+
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] Tue Apr 5
21:20:42 2011
@@ -25,31 +25,22 @@
#include <locale.h>
#include <lm.h>
#include <shlwapi.h>
+#include <iphlpapi.h>
+#include <winsock2.h>
#include "resource.h"
-#define BUFFER_SIZE 32767
-
-/* Load from resource and convert to OEM */
-static
-BOOL
-GetOemStrings(UINT rcID, LPWSTR OutMsg)
-{
- if (LoadStringW(GetModuleHandle(NULL), rcID, OutMsg, BUFFER_SIZE))
- return TRUE;
-
- return FALSE;
-}
-
-/* Load data from registry */
+#define BUFFER_SIZE 1024
+
+/* Load string from registry */
static
unsigned
RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD cchBuf)
{
- DWORD dwBytes = cchBuf*sizeof(WCHAR), dwType;
+ DWORD dwBytes = cchBuf*sizeof(WCHAR), dwType = 0;
unsigned cChars;
- /* If SubKy is specified open it */
+ /* If SubKey is specified open it */
if (lpSubKey && RegOpenKeyExW(hKey,
lpSubKey,
0,
@@ -60,6 +51,7 @@
return 0;
}
+ /* Query registry value and check its type */
if (RegQueryValueExW(hKey,
lpValueName,
NULL,
@@ -70,6 +62,11 @@
wprintf(L"Warning! Cannot query %s. Last error: %lu, type: %lu.\n",
lpValueName, GetLastError(), dwType);
dwBytes = 0;
}
+ else
+ {
+ wcscpy(lpBuf, L"N/A");
+ dwBytes = 6;
+ }
/* Close key if we opened it */
if (lpSubKey)
@@ -87,6 +84,7 @@
return cChars;
}
+/* Load DWORD from registry */
static
BOOL
RegGetDWORD(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPDWORD lpData)
@@ -94,7 +92,7 @@
DWORD dwBytes = sizeof(*lpData), dwType;
BOOL bRet = TRUE;
- /* If SubKy is specified open it */
+ /* If SubKey is specified open it */
if (lpSubKey && RegOpenKeyExW(hKey,
lpSubKey,
0,
@@ -105,6 +103,7 @@
return FALSE;
}
+ /* Query registry value and check its type */
if (RegQueryValueExW(hKey,
lpValueName,
NULL,
@@ -124,6 +123,7 @@
return bRet;
}
+/* Format bytes */
static
VOID
FormatBytes(LPWSTR lpBuf, unsigned cBytes)
@@ -147,6 +147,7 @@
wcscpy(lpBuf + i, L" MB");
}
+/* Format date and time */
static
VOID
FormatDateTime(time_t Time, LPWSTR lpBuf)
@@ -181,30 +182,35 @@
VOID
Usage(VOID)
{
- WCHAR Buf[BUFFER_SIZE];
-
- if(GetOemStrings(IDS_USAGE, Buf))
+ WCHAR Buf[4096];
+ if (LoadStringW(GetModuleHandle(NULL), IDS_USAGE, Buf, 4096))
wprintf(L"%s", Buf);
}
static
VOID
-PrintRow(UINT nTitleID, unsigned cxOffset, LPWSTR lpFormat, ...)
+PrintRow(UINT nTitleID, BOOL bIndent, LPWSTR lpFormat, ...)
{
WCHAR Buf[BUFFER_SIZE];
va_list Args;
unsigned c;
-
+
if (nTitleID)
{
- c = LoadStringW(GetModuleHandle(NULL), nTitleID, Buf, BUFFER_SIZE);
+ c = LoadStringW(GetModuleHandle(NULL), nTitleID, Buf, BUFFER_SIZE - 2);
if (!c)
return;
-
- wcscpy(Buf + c, L":");
+
+ wcscpy(Buf + c, L": ");
} else
Buf[0] = L'\0';
- wprintf(L"%-32s ", Buf);
+
+ if (!bIndent)
+ wprintf(L"%-32s", Buf);
+ else if (Buf[0])
+ wprintf(L"%38s%-16s", L"", Buf);
+ else
+ wprintf(L"%38s", L"");
va_start(Args, lpFormat);
vwprintf(lpFormat, Args);
@@ -217,10 +223,10 @@
VOID
AllSysInfo(VOID)
{
- DWORD dwCharCount = BUFFER_SIZE, dwTimestamp;
+ DWORD dwCharCount = BUFFER_SIZE, dwTimestamp, dwResult;
OSVERSIONINFOW VersionInfo;
SYSTEM_INFO SysInfo;
- WCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], Msg[BUFFER_SIZE], szSystemDir[MAX_PATH];
+ WCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], szSystemDir[MAX_PATH];
const WCHAR *lpcszSysType;
LPWSTR lpBuffer;
NETSETUP_JOIN_STATUS NetJoinStatus;
@@ -228,6 +234,8 @@
unsigned int cSeconds, i, j;
TIME_ZONE_INFORMATION TimeZoneInfo;
HKEY hKey;
+ PIP_ADAPTER_ADDRESSES pAdapters;
+ ULONG cbAdapters;
if (!GetSystemDirectoryW(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0])))
{
@@ -242,7 +250,7 @@
if (!GetComputerNameW(Buf, &dwCharCount))
wprintf(L"Error! GetComputerName failed.\n");
else
- PrintRow(IDS_HOST_NAME, 0, L"%s", Buf);
+ PrintRow(IDS_HOST_NAME, FALSE, L"%s", Buf);
// open CurrentVersion key
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE,
@@ -257,7 +265,7 @@
//getting OS Name
RegGetSZ(hKey, NULL, L"ProductName", Buf, BUFFER_SIZE);
- PrintRow(IDS_OS_NAME, 0, L"%s", Buf);
+ PrintRow(IDS_OS_NAME, FALSE, L"%s", Buf);
//getting OS Version
ZeroMemory(&VersionInfo, sizeof(VersionInfo));
@@ -267,14 +275,14 @@
if (!LoadStringW(GetModuleHandle(NULL), IDS_BUILD, Tmp, BUFFER_SIZE))
Tmp[0] = L'\0';
PrintRow(IDS_OS_VERSION,
- 0,
- L"%u.%u.%u %s %s %u",
- (unsigned)VersionInfo.dwMajorVersion,
- (unsigned)VersionInfo.dwMinorVersion,
- (unsigned)VersionInfo.dwBuildNumber,
+ FALSE,
+ L"%lu.%lu.%lu %s %s %lu",
+ VersionInfo.dwMajorVersion,
+ VersionInfo.dwMinorVersion,
+ VersionInfo.dwBuildNumber,
VersionInfo.szCSDVersion,
Tmp,
- (unsigned)VersionInfo.dwBuildNumber);
+ VersionInfo.dwBuildNumber);
//getting OS Manufacturer
@@ -282,24 +290,24 @@
//getting OS Build Type
RegGetSZ(hKey, NULL, L"CurrentType", Buf, BUFFER_SIZE);
- PrintRow(IDS_OS_BUILD_TYPE, 0, L"%s", Buf);
+ PrintRow(IDS_OS_BUILD_TYPE, FALSE, L"%s", Buf);
//getting Registered Owner
RegGetSZ(hKey, NULL, L"RegisteredOwner", Buf, BUFFER_SIZE);
- PrintRow(IDS_REG_OWNER, 0, L"%s", Buf);
+ PrintRow(IDS_REG_OWNER, FALSE, L"%s", Buf);
//getting Registered Organization
RegGetSZ(hKey, NULL, L"RegisteredOrganization", Buf, BUFFER_SIZE);
- PrintRow(IDS_REG_ORG, 0, L"%s", Buf);
+ PrintRow(IDS_REG_ORG, FALSE, L"%s", Buf);
//getting Product ID
RegGetSZ(hKey, NULL, L"ProductId", Buf, BUFFER_SIZE);
- PrintRow(IDS_PRODUCT_ID, 0, L"%s", Buf);
+ PrintRow(IDS_PRODUCT_ID, FALSE, L"%s", Buf);
//getting Install Date
RegGetDWORD(hKey, NULL, L"InstallDate", &dwTimestamp);
FormatDateTime((time_t)dwTimestamp, Buf);
- PrintRow(IDS_INST_DATE, 0, L"%s", Buf);
+ PrintRow(IDS_INST_DATE, FALSE, L"%s", Buf);
// close Current Version key now
RegCloseKey(hKey);
@@ -309,7 +317,7 @@
if (!LoadStringW(GetModuleHandle(NULL), IDS_UP_TIME_FORMAT, Tmp, BUFFER_SIZE))
Tmp[0] = L'\0';
swprintf(Buf, Tmp, cSeconds / (60*60*24), (cSeconds / (60*60)) % 24, (cSeconds / 60)
% 60, cSeconds % 60);
- PrintRow(IDS_UP_TIME, 0, L"%s", Buf);
+ PrintRow(IDS_UP_TIME, FALSE, L"%s", Buf);
//getting System Manufacturer;
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Manufacturer for Win >=
6.0
swprintf(Tmp, L"%s\\oeminfo.ini", szSystemDir);
@@ -319,7 +327,7 @@
Buf,
sizeof(Buf)/sizeof(Buf[0]),
Tmp);
- PrintRow(IDS_SYS_MANUFACTURER, 0, L"%s", Buf);
+ PrintRow(IDS_SYS_MANUFACTURER, FALSE, L"%s", Buf);
//getting System Model;
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Model for Win >= 6.0
GetPrivateProfileStringW(L"General",
@@ -328,7 +336,7 @@
Buf,
sizeof(Buf)/sizeof(Buf[0]),
Tmp);
- PrintRow(IDS_SYS_MODEL, 0, L"%s", Buf);
+ PrintRow(IDS_SYS_MODEL, FALSE, L"%s", Buf);
//getting System type
switch (SysInfo.wProcessorArchitecture)
@@ -346,13 +354,13 @@
lpcszSysType = L"Unknown";
break;
}
- PrintRow(IDS_SYS_TYPE, 0, L"%s", lpcszSysType);
+ PrintRow(IDS_SYS_TYPE, FALSE, L"%s", lpcszSysType);
//getting Processor(s)
if (!LoadStringW(GetModuleHandle(NULL), IDS_PROCESSORS_FORMAT, Tmp, BUFFER_SIZE))
Tmp[0] = L'\0';
swprintf(Buf, Tmp, (unsigned)SysInfo.dwNumberOfProcessors);
- PrintRow(IDS_PROCESSORS, 0, L"%s", Buf);
+ PrintRow(IDS_PROCESSORS, FALSE, L"%s", Buf);
for(i = 0; i < (unsigned int)SysInfo.dwNumberOfProcessors; i++)
{
swprintf(Tmp, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%u",
i);
@@ -363,7 +371,7 @@
Buf[j++] = L' ';
RegGetSZ(HKEY_LOCAL_MACHINE, Tmp, L"VendorIdentifier", Buf + j,
BUFFER_SIZE - j);
- PrintRow(0, 0, L"%s", Buf);
+ PrintRow(0, FALSE, L"%s", Buf);
}
//getting BIOS Version
@@ -372,7 +380,7 @@
L"SystemBiosVersion",
Buf,
BUFFER_SIZE);
- PrintRow(IDS_BIOS_VERSION, 0, L"%s", Buf);
+ PrintRow(IDS_BIOS_VERSION, FALSE, L"%s", Buf);
//gettings BIOS date
RegGetSZ(HKEY_LOCAL_MACHINE,
@@ -380,13 +388,13 @@
L"SystemBiosDate",
Buf,
BUFFER_SIZE);
- PrintRow(IDS_BIOS_DATE, 0, L"%s", Buf);
+ PrintRow(IDS_BIOS_DATE, FALSE, L"%s", Buf);
//getting ReactOS Directory
if (!GetWindowsDirectoryW(Buf, BUFFER_SIZE))
wprintf(L"Error! GetWindowsDirectory failed.");
else
- PrintRow(IDS_ROS_DIR, 0, L"%s", Buf);
+ PrintRow(IDS_ROS_DIR, FALSE, L"%s", Buf);
//getting System Directory
PrintRow(IDS_SYS_DIR, 0, L"%s", szSystemDir);
@@ -397,7 +405,7 @@
L"SystemPartition",
Buf,
BUFFER_SIZE);
- PrintRow(IDS_BOOT_DEV, 0, L"%s", Buf);
+ PrintRow(IDS_BOOT_DEV, FALSE, L"%s", Buf);
//getting System Locale
if (GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, Tmp, BUFFER_SIZE))
@@ -412,7 +420,7 @@
if (lpBuffer)
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, BUFFER_SIZE - (lpBuffer-Buf)
- 1, NULL);
- PrintRow(IDS_SYS_LOCALE, 0, L"%s", Buf);
+ PrintRow(IDS_SYS_LOCALE, FALSE, L"%s", Buf);
}
//getting Input Locale
@@ -432,7 +440,7 @@
if (lpBuffer)
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, BUFFER_SIZE - (lpBuffer-Buf)
- 1, NULL);
- PrintRow(IDS_INPUT_LOCALE, 0, L"%s", Buf);
+ PrintRow(IDS_INPUT_LOCALE, FALSE, L"%s", Buf);
}
//getting Time Zone
@@ -448,16 +456,16 @@
unsigned i;
/* Find current timezone */
- dwCharCount = 256; // Windows seems to have a bug - it doesnt accept BUFFER_SIZE
here
+ dwCharCount = BUFFER_SIZE;
for(i = 0; RegEnumKeyExW(hKey, i, Tmp, &dwCharCount, NULL, NULL, NULL, NULL)
== ERROR_SUCCESS; ++i, dwCharCount = 255)
{
RegGetSZ(hKey, Tmp, L"Std", Buf, BUFFER_SIZE);
- if(!wcscmp(Buf, TimeZoneInfo.StandardName))
+ if (!wcscmp(Buf, TimeZoneInfo.StandardName))
{
RegGetSZ(hKey, Tmp, L"Display", Buf, BUFFER_SIZE);
- PrintRow(IDS_TIME_ZONE, 0, L"%s", Buf);
+ PrintRow(IDS_TIME_ZONE, FALSE, L"%s", Buf);
break;
}
@@ -468,23 +476,23 @@
//getting Total Physical Memory
GlobalMemoryStatus(&MemoryStatus);
FormatBytes(Buf, MemoryStatus.dwTotalPhys);
- PrintRow(IDS_TOTAL_PHYS_MEM, 0, L"%s", Buf);
+ PrintRow(IDS_TOTAL_PHYS_MEM, FALSE, L"%s", Buf);
//getting Available Physical Memory
FormatBytes(Buf, MemoryStatus.dwAvailPhys);
- PrintRow(IDS_AVAIL_PHISICAL_MEM, 0, L"%s", Buf);
+ PrintRow(IDS_AVAIL_PHISICAL_MEM, FALSE, L"%s", Buf);
//getting Virtual Memory: Max Size
FormatBytes(Buf, MemoryStatus.dwTotalVirtual);
- PrintRow(IDS_VIRT_MEM_MAX, 0, L"%s", Buf);
+ PrintRow(IDS_VIRT_MEM_MAX, FALSE, L"%s", Buf);
//getting Virtual Memory: Available
FormatBytes(Buf, MemoryStatus.dwAvailVirtual);
- PrintRow(IDS_VIRT_MEM_AVAIL, 0, L"%s", Buf);
+ PrintRow(IDS_VIRT_MEM_AVAIL, FALSE, L"%s", Buf);
//getting Virtual Memory: In Use
FormatBytes(Buf, MemoryStatus.dwTotalVirtual-MemoryStatus.dwAvailVirtual);
- PrintRow(IDS_VIRT_MEM_INUSE, 0, L"%s", Buf);
+ PrintRow(IDS_VIRT_MEM_INUSE, FALSE, L"%s", Buf);
//getting Page File Location(s)
if (RegGetSZ(HKEY_LOCAL_MACHINE,
@@ -504,13 +512,14 @@
}
}
- PrintRow(IDS_PAGEFILE_LOC, 0, L"%s", Buf);
+ PrintRow(IDS_PAGEFILE_LOC, FALSE, L"%s", Buf);
}
//getting Domain
if (NetGetJoinInformation (NULL, &lpBuffer, &NetJoinStatus) == NERR_Success)
{
- PrintRow(IDS_DOMAIN, 0, L"%s", lpBuffer);
+ if (NetJoinStatus == NetSetupWorkgroupName || NetJoinStatus ==
NetSetupDomainName)
+ PrintRow(IDS_DOMAIN, FALSE, L"%s", lpBuffer);
NetApiBufferFree(lpBuffer);
}
@@ -518,22 +527,100 @@
//getting Logon Server
//getting NetWork Card(s)
- if(GetOemStrings(IDS_NETWORK_CARDS, Msg))
- {
-
- }
+ cbAdapters = 4096;
+ pAdapters = malloc(cbAdapters);
+ while((dwResult = GetAdaptersAddresses(AF_UNSPEC, 0x0002, NULL, pAdapters,
&cbAdapters)) == ERROR_BUFFER_OVERFLOW)
+ {
+ cbAdapters += 4096;
+ pAdapters = (PIP_ADAPTER_ADDRESSES)realloc(pAdapters, cbAdapters);
+ }
+
+ if (dwResult == ERROR_SUCCESS)
+ {
+ PIP_ADAPTER_ADDRESSES pCurrentAdapter = pAdapters;
+ unsigned cAdapters = 0;
+
+ /* Count adapters */
+ for(i = 0; pCurrentAdapter; ++i)
+ {
+ if (pCurrentAdapter->IfType != 24 && pCurrentAdapter->IfType !=
131)
+ ++cAdapters;
+ pCurrentAdapter = pCurrentAdapter->Next;
+ }
+
+
+ /* Print adapters count */
+ if (!LoadStringW(GetModuleHandle(NULL), IDS_NETWORK_CARDS_FORMAT, Tmp,
BUFFER_SIZE))
+ Tmp[0] = L'\0';
+ swprintf(Buf, Tmp, cAdapters);
+ PrintRow(IDS_NETWORK_CARDS, FALSE, L"%s", Buf);
+
+ /* Show information about each adapter */
+ pCurrentAdapter = pAdapters;
+ for(i = 0; pCurrentAdapter; ++i)
+ {
+ if (pCurrentAdapter->IfType != 24 && pCurrentAdapter->IfType !=
131)//IF_TYPE_SOFTWARE_LOOPBACK)
+ {
+ PIP_ADAPTER_UNICAST_ADDRESS pAddress;
+
+ PrintRow(0, FALSE, L"[%02u]: %s", i + 1,
pCurrentAdapter->Description);
+ PrintRow(IDS_CONNECTION_NAME, TRUE, L"%s",
pCurrentAdapter->FriendlyName);
+ if (!(pCurrentAdapter->Flags & 0x0004))
+ {
+ if (!LoadStringW(GetModuleHandle(NULL), IDS_NO, Buf, BUFFER_SIZE))
+ Buf[0] = L'\0';
+ PrintRow(IDS_DHCP_ENABLED, TRUE, Buf);
+ }
+ if (pCurrentAdapter->OperStatus == IfOperStatusDown)
+ {
+ if (!LoadStringW(GetModuleHandle(NULL), IDS_MEDIA_DISCONNECTED, Buf,
BUFFER_SIZE))
+ Buf[0] = L'\0';
+ PrintRow(IDS_STATUS, TRUE, Buf);
+ }
+ else
+ {
+ if (!LoadStringW(GetModuleHandle(NULL), IDS_IP_ADDRESSES, Buf,
BUFFER_SIZE))
+ Buf[0] = L'\0';
+ PrintRow(0, TRUE, Buf);
+ pAddress = pCurrentAdapter->FirstUnicastAddress;
+ for (j = 0; pAddress; ++j)
+ {
+ dwCharCount = BUFFER_SIZE;
+ WSAAddressToStringW(pAddress->Address.lpSockaddr,
pAddress->Address.iSockaddrLength, NULL, Buf, &dwCharCount);
+ PrintRow(0, TRUE, L"[%02u]: %s", j + 1, Buf);
+ pAddress = pAddress->Next;
+ }
+ }
+ }
+ pCurrentAdapter = pCurrentAdapter->Next;
+ }
+ }
+ free(pAdapters);
}
/* Main program */
int
main(int argc, char *argv[])
{
+ WSADATA WsaData;
+ int i;
+
setlocale(LC_ALL, "");
- if (argc > 1 && (!strcmp(argv[1], "/?") || !strcmp(argv[1],
"-?")))
- {
- Usage();
- return 0;
+ WSAStartup(MAKEWORD(2, 2), &WsaData);
+
+ for (i = 1; i < argc; ++i)
+ {
+ if (!strcmp(argv[i], "/?") || !strcmp(argv[i], "-?"))
+ {
+ Usage();
+ return 0;
+ }
+ else
+ {
+ printf("Unsupported argument: %s\n", argv[i]);
+ return -1;
+ }
}
AllSysInfo();
Modified: trunk/rosapps/applications/sysutils/systeminfo/systeminfo.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/syst…
==============================================================================
--- trunk/rosapps/applications/sysutils/systeminfo/systeminfo.rbuild [iso-8859-1]
(original)
+++ trunk/rosapps/applications/sysutils/systeminfo/systeminfo.rbuild [iso-8859-1] Tue Apr
5 21:20:42 2011
@@ -4,6 +4,8 @@
<library>advapi32</library>
<library>netapi32</library>
<library>shlwapi</library>
+ <library>iphlpapi</library>
+ <library>ws2_32</library>
<file>systeminfo.c</file>
<file>systeminfo.rc</file>
<file>rsrc.rc</file>