mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:36:11 +00:00
[SYSTEMINFO] Do some code lift-up; use Conutils lib to be able to display localized unicode strings
In particular: - unhardcode buffer sizes and API flags; - add our standard file header in the .c file (I haven't done it for the other files); - merge systeminfo.rc and rsrc.rc together.
This commit is contained in:
parent
dc7c7fb9f5
commit
12e01218ad
4 changed files with 212 additions and 219 deletions
|
@ -1,9 +1,10 @@
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
${REACTOS_SOURCE_DIR}/sdk/lib/conutils
|
||||||
${REACTOS_SOURCE_DIR}/sdk/lib/udmihelp)
|
${REACTOS_SOURCE_DIR}/sdk/lib/udmihelp)
|
||||||
|
|
||||||
add_executable(systeminfo systeminfo.c systeminfo.rc)
|
add_executable(systeminfo systeminfo.c systeminfo.rc)
|
||||||
set_module_type(systeminfo win32cui)
|
set_module_type(systeminfo win32cui UNICODE)
|
||||||
target_link_libraries(systeminfo udmihelp)
|
target_link_libraries(systeminfo conutils udmihelp ${PSEH_LIB})
|
||||||
add_importlibs(systeminfo user32 advapi32 netapi32 shlwapi iphlpapi ws2_32 msvcrt kernel32 ntdll)
|
add_importlibs(systeminfo user32 advapi32 netapi32 shlwapi iphlpapi ws2_32 msvcrt kernel32 ntdll)
|
||||||
add_cd_file(TARGET systeminfo DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET systeminfo DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
#include <windows.h>
|
|
||||||
#include "resource.h"
|
|
||||||
|
|
||||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|
||||||
|
|
||||||
/* UTF-8 */
|
|
||||||
#pragma code_page(65001)
|
|
||||||
|
|
||||||
#ifdef LANGUAGE_DE_DE
|
|
||||||
#include "lang/de-DE.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_EN_US
|
|
||||||
#include "lang/en-US.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_ES_ES
|
|
||||||
#include "lang/es-ES.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_FR_FR
|
|
||||||
#include "lang/fr-FR.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_IT_IT
|
|
||||||
#include "lang/it-IT.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_JA_JP
|
|
||||||
#include "lang/ja-JP.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_NO_NO
|
|
||||||
#include "lang/no-NO.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_PL_PL
|
|
||||||
#include "lang/pl-PL.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_RO_RO
|
|
||||||
#include "lang/ro-RO.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_SK_SK
|
|
||||||
#include "lang/sk-SK.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_TR_TR
|
|
||||||
#include "lang/tr-TR.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_UK_UA
|
|
||||||
#include "lang/uk-UA.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_ZH_CN
|
|
||||||
#include "lang/zh-CN.rc"
|
|
||||||
#endif
|
|
||||||
#ifdef LANGUAGE_ZH_TW
|
|
||||||
#include "lang/zh-TW.rc"
|
|
||||||
#endif
|
|
|
@ -1,20 +1,11 @@
|
||||||
/*
|
/*
|
||||||
This program is free software; you can redistribute it and/or modify
|
* PROJECT: ReactOS SystemInfo Command
|
||||||
it under the terms of the GNU General Public License as published by
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
* PURPOSE: Displays system information.
|
||||||
(at your option) any later version.
|
* COPYRIGHT: Copyright 2007 Dmitry Chapyshev <lentind@yandex.ru>
|
||||||
|
* Copyright 2011 Rafal Harabien <rafalh1992@o2.pl>
|
||||||
This program is distributed in the hope that it will be useful,
|
* Copyright 2018 Stanislav Motylkov <x86corez@gmail.com>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*/
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
/* Copyright (C) 2007, Dmitry Chapyshev <lentind@yandex.ru> */
|
|
||||||
/* Copyright (C) 2011, Rafal Harabien <rafalh1992@o2.pl> */
|
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +19,7 @@
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <udmihelp.h>
|
#include <udmihelp.h>
|
||||||
|
#include <conutils.h>
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
@ -35,11 +27,11 @@
|
||||||
|
|
||||||
/* Load string from registry */
|
/* Load string from registry */
|
||||||
static
|
static
|
||||||
unsigned
|
UINT
|
||||||
RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD cchBuf)
|
RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD cchBuf)
|
||||||
{
|
{
|
||||||
DWORD dwBytes = cchBuf*sizeof(WCHAR), dwType = 0;
|
DWORD dwBytes = cchBuf * sizeof(WCHAR), dwType = 0;
|
||||||
unsigned cChars;
|
UINT cChars;
|
||||||
|
|
||||||
/* If SubKey is specified open it */
|
/* If SubKey is specified open it */
|
||||||
if (lpSubKey && RegOpenKeyExW(hKey,
|
if (lpSubKey && RegOpenKeyExW(hKey,
|
||||||
|
@ -48,7 +40,8 @@ RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD c
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey) != ERROR_SUCCESS)
|
&hKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
wprintf(L"Warning! Cannot open %s. Last error: %lu.\n", lpSubKey, GetLastError());
|
ConPrintf(StdErr, L"Warning! Cannot open %s. Last error: %lu.\n",
|
||||||
|
lpSubKey, GetLastError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,15 +51,17 @@ RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD c
|
||||||
NULL,
|
NULL,
|
||||||
&dwType,
|
&dwType,
|
||||||
(LPBYTE)lpBuf,
|
(LPBYTE)lpBuf,
|
||||||
&dwBytes) != ERROR_SUCCESS || (dwType != REG_SZ && dwType != REG_MULTI_SZ))
|
&dwBytes) != ERROR_SUCCESS ||
|
||||||
|
(dwType != REG_SZ && dwType != REG_MULTI_SZ))
|
||||||
{
|
{
|
||||||
wprintf(L"Warning! Cannot query %s. Last error: %lu, type: %lu.\n", lpValueName, GetLastError(), dwType);
|
ConPrintf(StdErr, L"Warning! Cannot query %s. Last error: %lu, type: %lu.\n",
|
||||||
|
lpValueName, GetLastError(), dwType);
|
||||||
dwBytes = 0;
|
dwBytes = 0;
|
||||||
}
|
}
|
||||||
else if (dwBytes == 0)
|
else if (dwBytes == 0)
|
||||||
{
|
{
|
||||||
wcscpy(lpBuf, L"N/A");
|
wcscpy(lpBuf, L"N/A");
|
||||||
dwBytes = 6;
|
dwBytes = sizeof(L"N/A")-sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close key if we opened it */
|
/* Close key if we opened it */
|
||||||
|
@ -79,7 +74,7 @@ RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD c
|
||||||
lpBuf[min(cchBuf-1, cChars)] = L'\0';
|
lpBuf[min(cchBuf-1, cChars)] = L'\0';
|
||||||
|
|
||||||
/* Don't count NULL characters */
|
/* Don't count NULL characters */
|
||||||
while(cChars && !lpBuf[cChars-1])
|
while (cChars && !lpBuf[cChars-1])
|
||||||
--cChars;
|
--cChars;
|
||||||
|
|
||||||
return cChars;
|
return cChars;
|
||||||
|
@ -100,7 +95,8 @@ RegGetDWORD(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPDWORD lpData)
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey) != ERROR_SUCCESS)
|
&hKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
wprintf(L"Warning! Cannot open %s. Last error: %lu.\n", lpSubKey, GetLastError());
|
ConPrintf(StdErr, L"Warning! Cannot open %s. Last error: %lu.\n",
|
||||||
|
lpSubKey, GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +108,8 @@ RegGetDWORD(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPDWORD lpData)
|
||||||
(LPBYTE)lpData,
|
(LPBYTE)lpData,
|
||||||
&dwBytes) != ERROR_SUCCESS || dwType != REG_DWORD)
|
&dwBytes) != ERROR_SUCCESS || dwType != REG_DWORD)
|
||||||
{
|
{
|
||||||
wprintf(L"Warning! Cannot query %s. Last err: %lu, type: %lu\n", lpValueName, GetLastError(), dwType);
|
ConPrintf(StdErr, L"Warning! Cannot query %s. Last err: %lu, type: %lu\n",
|
||||||
|
lpValueName, GetLastError(), dwType);
|
||||||
*lpData = 0;
|
*lpData = 0;
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -127,11 +124,11 @@ RegGetDWORD(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPDWORD lpData)
|
||||||
/* Format bytes */
|
/* Format bytes */
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
FormatBytes(LPWSTR lpBuf, unsigned cBytes)
|
FormatBytes(LPWSTR lpBuf, UINT cBytes)
|
||||||
{
|
{
|
||||||
WCHAR szMB[32];
|
WCHAR szMB[32];
|
||||||
NUMBERFMTW fmt;
|
NUMBERFMTW fmt;
|
||||||
unsigned i;
|
UINT i;
|
||||||
|
|
||||||
_itow(cBytes / (1024*1024), szMB, 10);
|
_itow(cBytes / (1024*1024), szMB, 10);
|
||||||
|
|
||||||
|
@ -153,7 +150,7 @@ static
|
||||||
VOID
|
VOID
|
||||||
FormatDateTime(time_t Time, LPWSTR lpBuf)
|
FormatDateTime(time_t Time, LPWSTR lpBuf)
|
||||||
{
|
{
|
||||||
unsigned i;
|
UINT i;
|
||||||
SYSTEMTIME SysTime;
|
SYSTEMTIME SysTime;
|
||||||
const struct tm *lpTm;
|
const struct tm *lpTm;
|
||||||
|
|
||||||
|
@ -190,33 +187,23 @@ ULONGLONG GetSecondsQPC(VOID)
|
||||||
|
|
||||||
ULONGLONG GetSeconds(VOID)
|
ULONGLONG GetSeconds(VOID)
|
||||||
{
|
{
|
||||||
ULONGLONG (WINAPI * pGetTickCount64)(VOID);
|
ULONGLONG (WINAPI *pGetTickCount64)(VOID);
|
||||||
ULONGLONG Ticks64;
|
ULONGLONG Ticks64;
|
||||||
HMODULE hModule = GetModuleHandleW(L"kernel32.dll");
|
HMODULE hModule = GetModuleHandleW(L"kernel32.dll");
|
||||||
|
|
||||||
pGetTickCount64 = (PVOID)GetProcAddress(hModule, "GetTickCount64");
|
pGetTickCount64 = (PVOID)GetProcAddress(hModule, "GetTickCount64");
|
||||||
if (pGetTickCount64)
|
if (pGetTickCount64)
|
||||||
{
|
|
||||||
return pGetTickCount64() / 1000;
|
return pGetTickCount64() / 1000;
|
||||||
}
|
|
||||||
|
|
||||||
hModule = LoadLibraryW(L"kernel32_vista.dll");
|
hModule = LoadLibraryW(L"kernel32_vista.dll");
|
||||||
|
|
||||||
if (!hModule)
|
if (!hModule)
|
||||||
{
|
|
||||||
return GetSecondsQPC();
|
return GetSecondsQPC();
|
||||||
}
|
|
||||||
|
|
||||||
pGetTickCount64 = (PVOID)GetProcAddress(hModule, "GetTickCount64");
|
pGetTickCount64 = (PVOID)GetProcAddress(hModule, "GetTickCount64");
|
||||||
|
|
||||||
if (pGetTickCount64)
|
if (pGetTickCount64)
|
||||||
{
|
|
||||||
Ticks64 = pGetTickCount64() / 1000;
|
Ticks64 = pGetTickCount64() / 1000;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Ticks64 = GetSecondsQPC();
|
Ticks64 = GetSecondsQPC();
|
||||||
}
|
|
||||||
|
|
||||||
FreeLibrary(hModule);
|
FreeLibrary(hModule);
|
||||||
return Ticks64;
|
return Ticks64;
|
||||||
|
@ -227,56 +214,57 @@ static
|
||||||
VOID
|
VOID
|
||||||
Usage(VOID)
|
Usage(VOID)
|
||||||
{
|
{
|
||||||
WCHAR Buf[4096];
|
ConResPrintf(StdOut, IDS_USAGE);
|
||||||
if (LoadStringW(GetModuleHandle(NULL), IDS_USAGE, Buf, 4096))
|
|
||||||
wprintf(L"%s", Buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
PrintRow(UINT nTitleID, BOOL bIndent, LPWSTR lpFormat, ...)
|
PrintRow(UINT nTitleID, BOOL bIndent, LPWSTR lpFormat, ...)
|
||||||
{
|
{
|
||||||
WCHAR Buf[BUFFER_SIZE];
|
|
||||||
va_list Args;
|
va_list Args;
|
||||||
unsigned c;
|
UINT c;
|
||||||
|
WCHAR Buf[BUFFER_SIZE];
|
||||||
|
|
||||||
if (nTitleID)
|
if (nTitleID)
|
||||||
{
|
{
|
||||||
c = LoadStringW(GetModuleHandle(NULL), nTitleID, Buf, BUFFER_SIZE - 2);
|
c = LoadStringW(GetModuleHandle(NULL), nTitleID, Buf, _countof(Buf) - 2);
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wcscpy(Buf + c, L": ");
|
wcscpy(Buf + c, L": ");
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Buf[0] = L'\0';
|
Buf[0] = L'\0';
|
||||||
|
}
|
||||||
|
|
||||||
if (!bIndent)
|
if (!bIndent)
|
||||||
wprintf(L"%-32s", Buf);
|
ConPrintf(StdOut, L"%-32s", Buf);
|
||||||
else if (Buf[0])
|
else if (Buf[0])
|
||||||
wprintf(L"%38s%-16s", L"", Buf);
|
ConPrintf(StdOut, L"%38s%-16s", L"", Buf);
|
||||||
else
|
else
|
||||||
wprintf(L"%38s", L"");
|
ConPrintf(StdOut, L"%38s", L"");
|
||||||
|
|
||||||
va_start(Args, lpFormat);
|
va_start(Args, lpFormat);
|
||||||
vwprintf(lpFormat, Args);
|
ConPrintfV(StdOut, lpFormat, Args);
|
||||||
va_end(Args);
|
va_end(Args);
|
||||||
|
|
||||||
wprintf(L"\n");
|
ConPuts(StdOut, L"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print all system information */
|
/* Print all system information */
|
||||||
VOID
|
VOID
|
||||||
AllSysInfo(VOID)
|
AllSysInfo(VOID)
|
||||||
{
|
{
|
||||||
DWORD dwCharCount = BUFFER_SIZE, dwTimestamp, dwResult;
|
DWORD dwCharCount, dwTimestamp, dwResult;
|
||||||
OSVERSIONINFOW VersionInfo;
|
OSVERSIONINFOW VersionInfo;
|
||||||
SYSTEM_INFO SysInfo;
|
SYSTEM_INFO SysInfo;
|
||||||
WCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], szSystemDir[MAX_PATH];
|
WCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], szSystemDir[MAX_PATH];
|
||||||
const WCHAR *lpcszSysType;
|
LPCWSTR lpcszSysType;
|
||||||
LPWSTR lpBuffer;
|
LPWSTR lpBuffer;
|
||||||
NETSETUP_JOIN_STATUS NetJoinStatus;
|
NETSETUP_JOIN_STATUS NetJoinStatus;
|
||||||
MEMORYSTATUS MemoryStatus;
|
MEMORYSTATUS MemoryStatus;
|
||||||
unsigned int cSeconds, i, j;
|
UINT cSeconds, i, j;
|
||||||
TIME_ZONE_INFORMATION TimeZoneInfo;
|
TIME_ZONE_INFORMATION TimeZoneInfo;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
PIP_ADAPTER_ADDRESSES pAdapters;
|
PIP_ADAPTER_ADDRESSES pAdapters;
|
||||||
|
@ -284,42 +272,42 @@ AllSysInfo(VOID)
|
||||||
PVOID SMBiosBuf;
|
PVOID SMBiosBuf;
|
||||||
PCHAR DmiStrings[ID_STRINGS_MAX] = { 0 };
|
PCHAR DmiStrings[ID_STRINGS_MAX] = { 0 };
|
||||||
|
|
||||||
if (!GetSystemDirectoryW(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0])))
|
if (!GetSystemDirectoryW(szSystemDir, _countof(szSystemDir)))
|
||||||
{
|
{
|
||||||
wprintf(L"Error! GetSystemDirectory failed.\n");
|
ConPrintf(StdErr, L"Error! GetSystemDirectory failed.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSystemInfo(&SysInfo);
|
GetSystemInfo(&SysInfo);
|
||||||
|
|
||||||
// getting computer name
|
/* Getting computer name */
|
||||||
dwCharCount = BUFFER_SIZE;
|
dwCharCount = _countof(Buf);
|
||||||
if (!GetComputerNameW(Buf, &dwCharCount))
|
if (!GetComputerNameW(Buf, &dwCharCount))
|
||||||
wprintf(L"Error! GetComputerName failed.\n");
|
ConPrintf(StdErr, L"Error! GetComputerName failed.\n");
|
||||||
else
|
else
|
||||||
PrintRow(IDS_HOST_NAME, FALSE, L"%s", Buf);
|
PrintRow(IDS_HOST_NAME, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
// open CurrentVersion key
|
/* Open CurrentVersion key */
|
||||||
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
|
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey) != ERROR_SUCCESS)
|
&hKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
wprintf(L"Error! RegOpenKeyEx failed.\n");
|
ConPrintf(StdErr, L"Error! RegOpenKeyEx failed.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting OS Name
|
/* Getting OS Name */
|
||||||
RegGetSZ(hKey, NULL, L"ProductName", Buf, BUFFER_SIZE);
|
RegGetSZ(hKey, NULL, L"ProductName", Buf, _countof(Buf));
|
||||||
PrintRow(IDS_OS_NAME, FALSE, L"%s", Buf);
|
PrintRow(IDS_OS_NAME, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting OS Version
|
/* Getting OS Version */
|
||||||
ZeroMemory(&VersionInfo, sizeof(VersionInfo));
|
ZeroMemory(&VersionInfo, sizeof(VersionInfo));
|
||||||
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
|
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
|
||||||
GetVersionExW(&VersionInfo);
|
GetVersionExW(&VersionInfo);
|
||||||
|
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_BUILD, Tmp, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_BUILD, Tmp, _countof(Tmp)))
|
||||||
Tmp[0] = L'\0';
|
Tmp[0] = L'\0';
|
||||||
PrintRow(IDS_OS_VERSION,
|
PrintRow(IDS_OS_VERSION,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -331,51 +319,53 @@ AllSysInfo(VOID)
|
||||||
Tmp,
|
Tmp,
|
||||||
VersionInfo.dwBuildNumber);
|
VersionInfo.dwBuildNumber);
|
||||||
|
|
||||||
//getting OS Manufacturer
|
/* Getting OS Manufacturer */
|
||||||
|
|
||||||
//getting OS Configuration
|
/* Getting OS Configuration */
|
||||||
|
|
||||||
//getting OS Build Type
|
/* Getting OS Build Type */
|
||||||
RegGetSZ(hKey, NULL, L"CurrentType", Buf, BUFFER_SIZE);
|
RegGetSZ(hKey, NULL, L"CurrentType", Buf, _countof(Buf));
|
||||||
PrintRow(IDS_OS_BUILD_TYPE, FALSE, L"%s", Buf);
|
PrintRow(IDS_OS_BUILD_TYPE, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Registered Owner
|
/* Getting Registered Owner */
|
||||||
RegGetSZ(hKey, NULL, L"RegisteredOwner", Buf, BUFFER_SIZE);
|
RegGetSZ(hKey, NULL, L"RegisteredOwner", Buf, _countof(Buf));
|
||||||
PrintRow(IDS_REG_OWNER, FALSE, L"%s", Buf);
|
PrintRow(IDS_REG_OWNER, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Registered Organization
|
/* Getting Registered Organization */
|
||||||
RegGetSZ(hKey, NULL, L"RegisteredOrganization", Buf, BUFFER_SIZE);
|
RegGetSZ(hKey, NULL, L"RegisteredOrganization", Buf, _countof(Buf));
|
||||||
PrintRow(IDS_REG_ORG, FALSE, L"%s", Buf);
|
PrintRow(IDS_REG_ORG, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Product ID
|
/* Getting Product ID */
|
||||||
RegGetSZ(hKey, NULL, L"ProductId", Buf, BUFFER_SIZE);
|
RegGetSZ(hKey, NULL, L"ProductId", Buf, _countof(Buf));
|
||||||
PrintRow(IDS_PRODUCT_ID, FALSE, L"%s", Buf);
|
PrintRow(IDS_PRODUCT_ID, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Install Date
|
/* Getting Install Date */
|
||||||
RegGetDWORD(hKey, NULL, L"InstallDate", &dwTimestamp);
|
RegGetDWORD(hKey, NULL, L"InstallDate", &dwTimestamp);
|
||||||
FormatDateTime((time_t)dwTimestamp, Buf);
|
FormatDateTime((time_t)dwTimestamp, Buf);
|
||||||
PrintRow(IDS_INST_DATE, FALSE, L"%s", Buf);
|
PrintRow(IDS_INST_DATE, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
// close Current Version key now
|
/* Close Current Version key now */
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
//getting System Up Time
|
/* Getting System Up Time */
|
||||||
cSeconds = GetSeconds();
|
cSeconds = GetSeconds();
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_UP_TIME_FORMAT, Tmp, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_UP_TIME_FORMAT, Tmp, _countof(Tmp)))
|
||||||
Tmp[0] = L'\0';
|
Tmp[0] = L'\0';
|
||||||
swprintf(Buf, Tmp, cSeconds / (60*60*24), (cSeconds / (60*60)) % 24, (cSeconds / 60) % 60, cSeconds % 60);
|
swprintf(Buf, Tmp, cSeconds / (60*60*24), (cSeconds / (60*60)) % 24, (cSeconds / 60) % 60, cSeconds % 60);
|
||||||
PrintRow(IDS_UP_TIME, FALSE, L"%s", Buf);
|
PrintRow(IDS_UP_TIME, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
// prepare SMBIOS data
|
/* Prepare SMBIOS data */
|
||||||
SMBiosBuf = LoadSMBiosData(DmiStrings);
|
SMBiosBuf = LoadSMBiosData(DmiStrings);
|
||||||
|
|
||||||
//getting System Manufacturer; HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Manufacturer for Win >= 6.0
|
/* Getting System Manufacturer;
|
||||||
|
* HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Manufacturer
|
||||||
|
* for Win >= 6.0 */
|
||||||
swprintf(Tmp, L"%s\\oeminfo.ini", szSystemDir);
|
swprintf(Tmp, L"%s\\oeminfo.ini", szSystemDir);
|
||||||
GetPrivateProfileStringW(L"General",
|
GetPrivateProfileStringW(L"General",
|
||||||
L"Manufacturer",
|
L"Manufacturer",
|
||||||
L"",
|
L"",
|
||||||
Buf,
|
Buf,
|
||||||
sizeof(Buf)/sizeof(Buf[0]),
|
_countof(Buf),
|
||||||
Tmp);
|
Tmp);
|
||||||
if (wcslen(Buf) == 0 && SMBiosBuf)
|
if (wcslen(Buf) == 0 && SMBiosBuf)
|
||||||
{
|
{
|
||||||
|
@ -383,12 +373,14 @@ AllSysInfo(VOID)
|
||||||
}
|
}
|
||||||
PrintRow(IDS_SYS_MANUFACTURER, FALSE, 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
|
/* Getting System Model;
|
||||||
|
* HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Model
|
||||||
|
* for Win >= 6.0 */
|
||||||
GetPrivateProfileStringW(L"General",
|
GetPrivateProfileStringW(L"General",
|
||||||
L"Model",
|
L"Model",
|
||||||
L"",
|
L"",
|
||||||
Buf,
|
Buf,
|
||||||
sizeof(Buf)/sizeof(Buf[0]),
|
_countof(Buf),
|
||||||
Tmp);
|
Tmp);
|
||||||
if (wcslen(Buf) == 0 && SMBiosBuf)
|
if (wcslen(Buf) == 0 && SMBiosBuf)
|
||||||
{
|
{
|
||||||
|
@ -396,7 +388,7 @@ AllSysInfo(VOID)
|
||||||
}
|
}
|
||||||
PrintRow(IDS_SYS_MODEL, FALSE, L"%s", Buf);
|
PrintRow(IDS_SYS_MODEL, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting System type
|
/* Getting System type */
|
||||||
switch (SysInfo.wProcessorArchitecture)
|
switch (SysInfo.wProcessorArchitecture)
|
||||||
{
|
{
|
||||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||||
|
@ -414,34 +406,34 @@ AllSysInfo(VOID)
|
||||||
}
|
}
|
||||||
PrintRow(IDS_SYS_TYPE, FALSE, L"%s", lpcszSysType);
|
PrintRow(IDS_SYS_TYPE, FALSE, L"%s", lpcszSysType);
|
||||||
|
|
||||||
//getting Processor(s)
|
/* Getting Processor(s) */
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_PROCESSORS_FORMAT, Tmp, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_PROCESSORS_FORMAT, Tmp, _countof(Tmp)))
|
||||||
Tmp[0] = L'\0';
|
Tmp[0] = L'\0';
|
||||||
swprintf(Buf, Tmp, (unsigned)SysInfo.dwNumberOfProcessors);
|
swprintf(Buf, Tmp, (UINT)SysInfo.dwNumberOfProcessors);
|
||||||
PrintRow(IDS_PROCESSORS, FALSE, L"%s", Buf);
|
PrintRow(IDS_PROCESSORS, FALSE, L"%s", Buf);
|
||||||
for(i = 0; i < (unsigned int)SysInfo.dwNumberOfProcessors; i++)
|
for (i = 0; i < (UINT)SysInfo.dwNumberOfProcessors; i++)
|
||||||
{
|
{
|
||||||
swprintf(Tmp, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%u", i);
|
swprintf(Tmp, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%u", i);
|
||||||
j = swprintf(Buf, L"[%02u]: ", i + 1);
|
j = swprintf(Buf, L"[%02u]: ", i + 1);
|
||||||
|
|
||||||
j += RegGetSZ(HKEY_LOCAL_MACHINE, Tmp, L"Identifier", Buf + j, BUFFER_SIZE - j);
|
j += RegGetSZ(HKEY_LOCAL_MACHINE, Tmp, L"Identifier", Buf + j, _countof(Buf) - j);
|
||||||
if(j + 1 < BUFFER_SIZE)
|
if (j + 1 < _countof(Buf))
|
||||||
Buf[j++] = L' ';
|
Buf[j++] = L' ';
|
||||||
RegGetSZ(HKEY_LOCAL_MACHINE, Tmp, L"VendorIdentifier", Buf + j, BUFFER_SIZE - j);
|
RegGetSZ(HKEY_LOCAL_MACHINE, Tmp, L"VendorIdentifier", Buf + j, _countof(Buf) - j);
|
||||||
|
|
||||||
PrintRow(0, FALSE, L"%s", Buf);
|
PrintRow(0, FALSE, L"%s", Buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting BIOS Version
|
/* Getting BIOS Version */
|
||||||
if (SMBiosBuf)
|
if (SMBiosBuf)
|
||||||
{
|
{
|
||||||
j = GetSMBiosStringW(DmiStrings[BIOS_VENDOR], Buf, BUFFER_SIZE, TRUE);
|
j = GetSMBiosStringW(DmiStrings[BIOS_VENDOR], Buf, _countof(Buf), TRUE);
|
||||||
if (j + 1 < BUFFER_SIZE)
|
if (j + 1 < _countof(Buf))
|
||||||
{
|
{
|
||||||
Buf[j++] = L' ';
|
Buf[j++] = L' ';
|
||||||
Buf[j] = L'\0';
|
Buf[j] = L'\0';
|
||||||
}
|
}
|
||||||
GetSMBiosStringW(DmiStrings[BIOS_VERSION], Buf + j, BUFFER_SIZE - j, TRUE);
|
GetSMBiosStringW(DmiStrings[BIOS_VERSION], Buf + j, _countof(Buf) - j, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -449,14 +441,14 @@ AllSysInfo(VOID)
|
||||||
L"HARDWARE\\DESCRIPTION\\System",
|
L"HARDWARE\\DESCRIPTION\\System",
|
||||||
L"SystemBiosVersion",
|
L"SystemBiosVersion",
|
||||||
Buf,
|
Buf,
|
||||||
BUFFER_SIZE);
|
_countof(Buf));
|
||||||
}
|
}
|
||||||
PrintRow(IDS_BIOS_VERSION, FALSE, L"%s", Buf);
|
PrintRow(IDS_BIOS_VERSION, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//gettings BIOS date
|
/* Getting BIOS date */
|
||||||
if (SMBiosBuf)
|
if (SMBiosBuf)
|
||||||
{
|
{
|
||||||
GetSMBiosStringW(DmiStrings[BIOS_DATE], Buf, BUFFER_SIZE, TRUE);
|
GetSMBiosStringW(DmiStrings[BIOS_DATE], Buf, _countof(Buf), TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -464,87 +456,90 @@ AllSysInfo(VOID)
|
||||||
L"HARDWARE\\DESCRIPTION\\System",
|
L"HARDWARE\\DESCRIPTION\\System",
|
||||||
L"SystemBiosDate",
|
L"SystemBiosDate",
|
||||||
Buf,
|
Buf,
|
||||||
BUFFER_SIZE);
|
_countof(Buf));
|
||||||
}
|
}
|
||||||
PrintRow(IDS_BIOS_DATE, FALSE, L"%s", Buf);
|
PrintRow(IDS_BIOS_DATE, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
// clean SMBIOS data
|
/* Clean SMBIOS data */
|
||||||
FreeSMBiosData(SMBiosBuf);
|
FreeSMBiosData(SMBiosBuf);
|
||||||
|
|
||||||
//getting ReactOS Directory
|
/* Getting ReactOS Directory */
|
||||||
if (!GetWindowsDirectoryW(Buf, BUFFER_SIZE))
|
if (!GetWindowsDirectoryW(Buf, _countof(Buf)))
|
||||||
wprintf(L"Error! GetWindowsDirectory failed.");
|
ConPrintf(StdErr, L"Error! GetWindowsDirectory failed.");
|
||||||
else
|
else
|
||||||
PrintRow(IDS_ROS_DIR, FALSE, L"%s", Buf);
|
PrintRow(IDS_ROS_DIR, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting System Directory
|
/* Getting System Directory */
|
||||||
PrintRow(IDS_SYS_DIR, 0, L"%s", szSystemDir);
|
PrintRow(IDS_SYS_DIR, 0, L"%s", szSystemDir);
|
||||||
|
|
||||||
//getting Boot Device
|
/* Getting Boot Device */
|
||||||
RegGetSZ(HKEY_LOCAL_MACHINE,
|
RegGetSZ(HKEY_LOCAL_MACHINE,
|
||||||
L"SYSTEM\\Setup",
|
L"SYSTEM\\Setup",
|
||||||
L"SystemPartition",
|
L"SystemPartition",
|
||||||
Buf,
|
Buf,
|
||||||
BUFFER_SIZE);
|
_countof(Buf));
|
||||||
PrintRow(IDS_BOOT_DEV, FALSE, L"%s", Buf);
|
PrintRow(IDS_BOOT_DEV, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting System Locale
|
/* Getting System Locale */
|
||||||
if (GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, Tmp, BUFFER_SIZE))
|
if (GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, Tmp, _countof(Tmp)))
|
||||||
|
{
|
||||||
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
||||||
L"MIME\\Database\\Rfc1766",
|
L"MIME\\Database\\Rfc1766",
|
||||||
Tmp,
|
Tmp,
|
||||||
Buf,
|
Buf,
|
||||||
BUFFER_SIZE))
|
_countof(Buf)))
|
||||||
{
|
{
|
||||||
/* get rid of @filename,resource */
|
/* Get rid of @filename,resource */
|
||||||
lpBuffer = wcschr(Buf, L';');
|
lpBuffer = wcschr(Buf, L';');
|
||||||
if (lpBuffer)
|
if (lpBuffer)
|
||||||
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, BUFFER_SIZE - (lpBuffer-Buf) - 1, NULL);
|
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, _countof(Buf) - (lpBuffer-Buf) - 1, NULL);
|
||||||
|
|
||||||
PrintRow(IDS_SYS_LOCALE, FALSE, L"%s", Buf);
|
PrintRow(IDS_SYS_LOCALE, FALSE, L"%s", Buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//getting Input Locale
|
/* Getting Input Locale */
|
||||||
if (RegGetSZ(HKEY_CURRENT_USER,
|
if (RegGetSZ(HKEY_CURRENT_USER,
|
||||||
L"Keyboard Layout\\Preload",
|
L"Keyboard Layout\\Preload",
|
||||||
L"1",
|
L"1",
|
||||||
Tmp,
|
Tmp,
|
||||||
BUFFER_SIZE) && wcslen(Tmp) > 4)
|
_countof(Tmp)) && wcslen(Tmp) > 4)
|
||||||
|
{
|
||||||
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
||||||
L"MIME\\Database\\Rfc1766",
|
L"MIME\\Database\\Rfc1766",
|
||||||
Tmp + 4,
|
Tmp + 4,
|
||||||
Buf,
|
Buf,
|
||||||
BUFFER_SIZE))
|
_countof(Buf)))
|
||||||
{
|
{
|
||||||
/* get rid of @filename,resource */
|
/* Get rid of @filename,resource */
|
||||||
lpBuffer = wcschr(Buf, L';');
|
lpBuffer = wcschr(Buf, L';');
|
||||||
if (lpBuffer)
|
if (lpBuffer)
|
||||||
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, BUFFER_SIZE - (lpBuffer-Buf) - 1, NULL);
|
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, _countof(Buf) - (lpBuffer-Buf) - 1, NULL);
|
||||||
|
|
||||||
PrintRow(IDS_INPUT_LOCALE, FALSE, L"%s", Buf);
|
PrintRow(IDS_INPUT_LOCALE, FALSE, L"%s", Buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//getting Time Zone
|
/* Getting Time Zone */
|
||||||
GetTimeZoneInformation(&TimeZoneInfo);
|
GetTimeZoneInformation(&TimeZoneInfo);
|
||||||
|
|
||||||
/* Open Time Zones key */
|
/* Open Time Zones key */
|
||||||
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
|
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
|
||||||
0,
|
0,
|
||||||
KEY_ENUMERATE_SUB_KEYS|KEY_READ,
|
KEY_ENUMERATE_SUB_KEYS|KEY_READ,
|
||||||
&hKey) == ERROR_SUCCESS)
|
&hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
/* Find current timezone */
|
/* Find current timezone */
|
||||||
dwCharCount = BUFFER_SIZE;
|
UINT i;
|
||||||
for(i = 0; RegEnumKeyExW(hKey, i, Tmp, &dwCharCount, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++i, dwCharCount = 255)
|
dwCharCount = _countof(Tmp);
|
||||||
|
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);
|
RegGetSZ(hKey, Tmp, L"Std", Buf, _countof(Buf));
|
||||||
|
|
||||||
if (!wcscmp(Buf, TimeZoneInfo.StandardName))
|
if (!wcscmp(Buf, TimeZoneInfo.StandardName))
|
||||||
{
|
{
|
||||||
RegGetSZ(hKey, Tmp, L"Display", Buf, BUFFER_SIZE);
|
RegGetSZ(hKey, Tmp, L"Display", Buf, _countof(Buf));
|
||||||
|
|
||||||
PrintRow(IDS_TIME_ZONE, FALSE, L"%s", Buf);
|
PrintRow(IDS_TIME_ZONE, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
|
@ -554,37 +549,36 @@ AllSysInfo(VOID)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting Total Physical Memory
|
/* Getting Total Physical Memory */
|
||||||
GlobalMemoryStatus(&MemoryStatus);
|
GlobalMemoryStatus(&MemoryStatus);
|
||||||
FormatBytes(Buf, MemoryStatus.dwTotalPhys);
|
FormatBytes(Buf, MemoryStatus.dwTotalPhys);
|
||||||
PrintRow(IDS_TOTAL_PHYS_MEM, FALSE, L"%s", Buf);
|
PrintRow(IDS_TOTAL_PHYS_MEM, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Available Physical Memory
|
/* Getting Available Physical Memory */
|
||||||
FormatBytes(Buf, MemoryStatus.dwAvailPhys);
|
FormatBytes(Buf, MemoryStatus.dwAvailPhys);
|
||||||
PrintRow(IDS_AVAIL_PHISICAL_MEM, FALSE, L"%s", Buf);
|
PrintRow(IDS_AVAIL_PHISICAL_MEM, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Virtual Memory: Max Size
|
/* Getting Virtual Memory: Max Size */
|
||||||
FormatBytes(Buf, MemoryStatus.dwTotalVirtual);
|
FormatBytes(Buf, MemoryStatus.dwTotalVirtual);
|
||||||
PrintRow(IDS_VIRT_MEM_MAX, FALSE, L"%s", Buf);
|
PrintRow(IDS_VIRT_MEM_MAX, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Virtual Memory: Available
|
/* Getting Virtual Memory: Available */
|
||||||
FormatBytes(Buf, MemoryStatus.dwAvailVirtual);
|
FormatBytes(Buf, MemoryStatus.dwAvailVirtual);
|
||||||
PrintRow(IDS_VIRT_MEM_AVAIL, FALSE, L"%s", Buf);
|
PrintRow(IDS_VIRT_MEM_AVAIL, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Virtual Memory: In Use
|
/* Getting Virtual Memory: In Use */
|
||||||
FormatBytes(Buf, MemoryStatus.dwTotalVirtual-MemoryStatus.dwAvailVirtual);
|
FormatBytes(Buf, MemoryStatus.dwTotalVirtual-MemoryStatus.dwAvailVirtual);
|
||||||
PrintRow(IDS_VIRT_MEM_INUSE, FALSE, L"%s", Buf);
|
PrintRow(IDS_VIRT_MEM_INUSE, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
//getting Page File Location(s)
|
/* Getting Page File Location(s) */
|
||||||
if (RegGetSZ(HKEY_LOCAL_MACHINE,
|
if (RegGetSZ(HKEY_LOCAL_MACHINE,
|
||||||
L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management",
|
L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management",
|
||||||
L"PagingFiles",
|
L"PagingFiles",
|
||||||
Buf,
|
Buf,
|
||||||
BUFFER_SIZE))
|
_countof(Buf)))
|
||||||
{
|
{
|
||||||
int i;
|
UINT i;
|
||||||
|
for (i = 0; Buf[i]; i++)
|
||||||
for(i = 0; Buf[i]; i++)
|
|
||||||
{
|
{
|
||||||
if (Buf[i] == L' ')
|
if (Buf[i] == L' ')
|
||||||
{
|
{
|
||||||
|
@ -596,7 +590,7 @@ AllSysInfo(VOID)
|
||||||
PrintRow(IDS_PAGEFILE_LOC, FALSE, L"%s", Buf);
|
PrintRow(IDS_PAGEFILE_LOC, FALSE, L"%s", Buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting Domain
|
/* Getting Domain */
|
||||||
if (NetGetJoinInformation (NULL, &lpBuffer, &NetJoinStatus) == NERR_Success)
|
if (NetGetJoinInformation (NULL, &lpBuffer, &NetJoinStatus) == NERR_Success)
|
||||||
{
|
{
|
||||||
if (NetJoinStatus == NetSetupWorkgroupName || NetJoinStatus == NetSetupDomainName)
|
if (NetJoinStatus == NetSetupWorkgroupName || NetJoinStatus == NetSetupDomainName)
|
||||||
|
@ -605,12 +599,12 @@ AllSysInfo(VOID)
|
||||||
NetApiBufferFree(lpBuffer);
|
NetApiBufferFree(lpBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting Logon Server
|
/* Getting Logon Server */
|
||||||
|
|
||||||
//getting NetWork Card(s)
|
/* Getting NetWork Card(s) */
|
||||||
cbAdapters = 4096;
|
cbAdapters = 4096;
|
||||||
pAdapters = malloc(cbAdapters);
|
pAdapters = malloc(cbAdapters);
|
||||||
while((dwResult = GetAdaptersAddresses(AF_UNSPEC, 0x0002, NULL, pAdapters, &cbAdapters)) == ERROR_BUFFER_OVERFLOW)
|
while ((dwResult = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST, NULL, pAdapters, &cbAdapters)) == ERROR_BUFFER_OVERFLOW)
|
||||||
{
|
{
|
||||||
cbAdapters += 4096;
|
cbAdapters += 4096;
|
||||||
pAdapters = (PIP_ADAPTER_ADDRESSES)realloc(pAdapters, cbAdapters);
|
pAdapters = (PIP_ADAPTER_ADDRESSES)realloc(pAdapters, cbAdapters);
|
||||||
|
@ -619,54 +613,53 @@ AllSysInfo(VOID)
|
||||||
if (dwResult == ERROR_SUCCESS)
|
if (dwResult == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
PIP_ADAPTER_ADDRESSES pCurrentAdapter = pAdapters;
|
PIP_ADAPTER_ADDRESSES pCurrentAdapter = pAdapters;
|
||||||
unsigned cAdapters = 0;
|
UINT cAdapters = 0;
|
||||||
|
|
||||||
/* Count adapters */
|
/* Count adapters */
|
||||||
for(i = 0; pCurrentAdapter; ++i)
|
for (i = 0; pCurrentAdapter; ++i)
|
||||||
{
|
{
|
||||||
if (pCurrentAdapter->IfType != 24 && pCurrentAdapter->IfType != 131)
|
if (pCurrentAdapter->IfType != IF_TYPE_SOFTWARE_LOOPBACK && pCurrentAdapter->IfType != IF_TYPE_TUNNEL)
|
||||||
++cAdapters;
|
++cAdapters;
|
||||||
pCurrentAdapter = pCurrentAdapter->Next;
|
pCurrentAdapter = pCurrentAdapter->Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print adapters count */
|
/* Print adapters count */
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_NETWORK_CARDS_FORMAT, Tmp, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_NETWORK_CARDS_FORMAT, Tmp, _countof(Tmp)))
|
||||||
Tmp[0] = L'\0';
|
Tmp[0] = L'\0';
|
||||||
swprintf(Buf, Tmp, cAdapters);
|
swprintf(Buf, Tmp, cAdapters);
|
||||||
PrintRow(IDS_NETWORK_CARDS, FALSE, L"%s", Buf);
|
PrintRow(IDS_NETWORK_CARDS, FALSE, L"%s", Buf);
|
||||||
|
|
||||||
/* Show information about each adapter */
|
/* Show information about each adapter */
|
||||||
pCurrentAdapter = pAdapters;
|
pCurrentAdapter = pAdapters;
|
||||||
for(i = 0; pCurrentAdapter; ++i)
|
for (i = 0; pCurrentAdapter; ++i)
|
||||||
{
|
{
|
||||||
if (pCurrentAdapter->IfType != 24 && pCurrentAdapter->IfType != 131)//IF_TYPE_SOFTWARE_LOOPBACK)
|
if (pCurrentAdapter->IfType != IF_TYPE_SOFTWARE_LOOPBACK && pCurrentAdapter->IfType != IF_TYPE_TUNNEL)
|
||||||
{
|
{
|
||||||
PIP_ADAPTER_UNICAST_ADDRESS pAddress;
|
PIP_ADAPTER_UNICAST_ADDRESS pAddress;
|
||||||
|
|
||||||
PrintRow(0, FALSE, L"[%02u]: %s", i + 1, pCurrentAdapter->Description);
|
PrintRow(0, FALSE, L"[%02u]: %s", i + 1, pCurrentAdapter->Description);
|
||||||
PrintRow(IDS_CONNECTION_NAME, TRUE, L"%s", pCurrentAdapter->FriendlyName);
|
PrintRow(IDS_CONNECTION_NAME, TRUE, L"%s", pCurrentAdapter->FriendlyName);
|
||||||
if (!(pCurrentAdapter->Flags & 0x0004))
|
if (!(pCurrentAdapter->Flags & IP_ADAPTER_DHCP_ENABLED))
|
||||||
{
|
{
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_NO, Buf, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_NO, Buf, _countof(Buf)))
|
||||||
Buf[0] = L'\0';
|
Buf[0] = L'\0';
|
||||||
PrintRow(IDS_DHCP_ENABLED, TRUE, Buf);
|
PrintRow(IDS_DHCP_ENABLED, TRUE, Buf);
|
||||||
}
|
}
|
||||||
if (pCurrentAdapter->OperStatus == IfOperStatusDown)
|
if (pCurrentAdapter->OperStatus == IfOperStatusDown)
|
||||||
{
|
{
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_MEDIA_DISCONNECTED, Buf, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_MEDIA_DISCONNECTED, Buf, _countof(Buf)))
|
||||||
Buf[0] = L'\0';
|
Buf[0] = L'\0';
|
||||||
PrintRow(IDS_STATUS, TRUE, Buf);
|
PrintRow(IDS_STATUS, TRUE, Buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!LoadStringW(GetModuleHandle(NULL), IDS_IP_ADDRESSES, Buf, BUFFER_SIZE))
|
if (!LoadStringW(GetModuleHandle(NULL), IDS_IP_ADDRESSES, Buf, _countof(Buf)))
|
||||||
Buf[0] = L'\0';
|
Buf[0] = L'\0';
|
||||||
PrintRow(0, TRUE, Buf);
|
PrintRow(0, TRUE, Buf);
|
||||||
pAddress = pCurrentAdapter->FirstUnicastAddress;
|
pAddress = pCurrentAdapter->FirstUnicastAddress;
|
||||||
for (j = 0; pAddress; ++j)
|
for (j = 0; pAddress; ++j)
|
||||||
{
|
{
|
||||||
dwCharCount = BUFFER_SIZE;
|
dwCharCount = _countof(Buf);
|
||||||
WSAAddressToStringW(pAddress->Address.lpSockaddr, pAddress->Address.iSockaddrLength, NULL, Buf, &dwCharCount);
|
WSAAddressToStringW(pAddress->Address.lpSockaddr, pAddress->Address.iSockaddrLength, NULL, Buf, &dwCharCount);
|
||||||
PrintRow(0, TRUE, L"[%02u]: %s", j + 1, Buf);
|
PrintRow(0, TRUE, L"[%02u]: %s", j + 1, Buf);
|
||||||
pAddress = pAddress->Next;
|
pAddress = pAddress->Next;
|
||||||
|
@ -680,26 +673,26 @@ AllSysInfo(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main program */
|
/* Main program */
|
||||||
int
|
int wmain(int argc, wchar_t *argv[])
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
WSADATA WsaData;
|
WSADATA WsaData;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
/* Initialize the Console Standard Streams */
|
||||||
|
ConInitStdStreams();
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2, 2), &WsaData);
|
WSAStartup(MAKEWORD(2, 2), &WsaData);
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i)
|
for (i = 1; i < argc; ++i)
|
||||||
{
|
{
|
||||||
if (!strcmp(argv[i], "/?") || !strcmp(argv[i], "-?"))
|
if (!wcscmp(argv[i], L"/?") || !wcscmp(argv[i], L"-?"))
|
||||||
{
|
{
|
||||||
Usage();
|
Usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Unsupported argument: %s\n", argv[i]);
|
ConPrintf(StdErr, L"Unsupported argument: %s\n", argv[i]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,55 @@
|
||||||
|
#include <windef.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
#define REACTOS_STR_FILE_DESCRIPTION "System Information"
|
#define REACTOS_STR_FILE_DESCRIPTION "System Information"
|
||||||
#define REACTOS_STR_INTERNAL_NAME "systeminfo"
|
#define REACTOS_STR_INTERNAL_NAME "systeminfo"
|
||||||
#define REACTOS_STR_ORIGINAL_FILENAME "systeminfo.exe"
|
#define REACTOS_STR_ORIGINAL_FILENAME "systeminfo.exe"
|
||||||
#include <reactos/version.rc>
|
#include <reactos/version.rc>
|
||||||
|
|
||||||
#include "rsrc.rc"
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
|
/* UTF-8 */
|
||||||
|
#pragma code_page(65001)
|
||||||
|
|
||||||
|
#ifdef LANGUAGE_DE_DE
|
||||||
|
#include "lang/de-DE.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_EN_US
|
||||||
|
#include "lang/en-US.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_ES_ES
|
||||||
|
#include "lang/es-ES.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_FR_FR
|
||||||
|
#include "lang/fr-FR.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_IT_IT
|
||||||
|
#include "lang/it-IT.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_JA_JP
|
||||||
|
#include "lang/ja-JP.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_NO_NO
|
||||||
|
#include "lang/no-NO.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_PL_PL
|
||||||
|
#include "lang/pl-PL.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_RO_RO
|
||||||
|
#include "lang/ro-RO.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_SK_SK
|
||||||
|
#include "lang/sk-SK.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_TR_TR
|
||||||
|
#include "lang/tr-TR.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_UK_UA
|
||||||
|
#include "lang/uk-UA.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_ZH_CN
|
||||||
|
#include "lang/zh-CN.rc"
|
||||||
|
#endif
|
||||||
|
#ifdef LANGUAGE_ZH_TW
|
||||||
|
#include "lang/zh-TW.rc"
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue