https://git.reactos.org/?p=reactos.git;a=commitdiff;h=baf2c0cc2d849fffa68a1…
commit baf2c0cc2d849fffa68a1634ed87e7da08805682
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Wed Nov 21 23:49:15 2018 +0300
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Nov 21 21:49:15 2018 +0100
[DRWTSN32] Add SMBIOS data to the system information (#1017)
[DMILIB][UDMIHELP] Allow functions to be linked with C++ code.
---
base/applications/drwtsn32/CMakeLists.txt | 6 ++++--
base/applications/drwtsn32/sysinfo.cpp | 31 +++++++++++++++++++++++++++++++
sdk/lib/dmilib/dmilib.h | 5 ++++-
sdk/lib/udmihelp/udmihelp.h | 15 ++++++++++++++-
4 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/base/applications/drwtsn32/CMakeLists.txt
b/base/applications/drwtsn32/CMakeLists.txt
index 66dbdab1f7..e58b1c095f 100644
--- a/base/applications/drwtsn32/CMakeLists.txt
+++ b/base/applications/drwtsn32/CMakeLists.txt
@@ -2,7 +2,9 @@
PROJECT(drwtsn32)
set_cpp(WITH_RUNTIME WITH_EXCEPTIONS WITH_STL)
-include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
+include_directories(
+ ${REACTOS_SOURCE_DIR}/sdk/lib/atl
+ ${REACTOS_SOURCE_DIR}/sdk/lib/udmihelp)
list(APPEND CPP_SOURCE
drwtsn32.cpp
@@ -15,6 +17,6 @@ list(APPEND CPP_SOURCE
add_executable(drwtsn32 ${CPP_SOURCE} drwtsn32.rc)
add_pch(drwtsn32 precomp.h CPP_SOURCE)
set_module_type(drwtsn32 win32gui UNICODE)
-target_link_libraries(drwtsn32 atlnew)
+target_link_libraries(drwtsn32 atlnew udmihelp)
add_importlibs(drwtsn32 dbghelp psapi advapi32 shell32 shlwapi msvcrt user32 kernel32
ntdll)
add_cd_file(TARGET drwtsn32 DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/drwtsn32/sysinfo.cpp
b/base/applications/drwtsn32/sysinfo.cpp
index 7148163b15..f52c58b2cb 100644
--- a/base/applications/drwtsn32/sysinfo.cpp
+++ b/base/applications/drwtsn32/sysinfo.cpp
@@ -6,6 +6,7 @@
*/
#include "precomp.h"
+#include <udmihelp.h>
#include <winreg.h>
#include <reactos/buildno.h>
@@ -71,6 +72,36 @@ void PrintSystemInfo(FILE* output, DumpData& data)
xfprintf(output, " User Name: %s" NEWLINE, Buffer);
+ PVOID SMBiosBuf;
+ PCHAR DmiStrings[ID_STRINGS_MAX] = { 0 };
+ SMBiosBuf = LoadSMBiosData(DmiStrings);
+ if (SMBiosBuf)
+ {
+ if (DmiStrings[BIOS_VENDOR])
+ xfprintf(output, " BIOS Vendor: %s" NEWLINE,
DmiStrings[BIOS_VENDOR]);
+ if (DmiStrings[BIOS_VERSION])
+ xfprintf(output, " BIOS Version: %s" NEWLINE,
DmiStrings[BIOS_VERSION]);
+ if (DmiStrings[BIOS_DATE])
+ xfprintf(output, " BIOS Date: %s" NEWLINE,
DmiStrings[BIOS_DATE]);
+ if (DmiStrings[SYS_VENDOR])
+ xfprintf(output, " System Manufacturer: %s" NEWLINE,
DmiStrings[SYS_VENDOR]);
+ if (DmiStrings[SYS_FAMILY])
+ xfprintf(output, " System Family: %s" NEWLINE,
DmiStrings[SYS_FAMILY]);
+ if (DmiStrings[SYS_PRODUCT])
+ xfprintf(output, " System Model: %s" NEWLINE,
DmiStrings[SYS_PRODUCT]);
+ if (DmiStrings[SYS_VERSION])
+ xfprintf(output, " System Version: %s" NEWLINE,
DmiStrings[SYS_VERSION]);
+ if (DmiStrings[SYS_SKU])
+ xfprintf(output, " System SKU: %s" NEWLINE,
DmiStrings[SYS_SKU]);
+ if (DmiStrings[BOARD_VENDOR])
+ xfprintf(output, " Baseboard Manufacturer: %s" NEWLINE,
DmiStrings[BOARD_VENDOR]);
+ if (DmiStrings[BOARD_NAME])
+ xfprintf(output, " Baseboard Model: %s" NEWLINE,
DmiStrings[BOARD_NAME]);
+ if (DmiStrings[BOARD_VERSION])
+ xfprintf(output, " Baseboard Version: %s" NEWLINE,
DmiStrings[BOARD_VERSION]);
+ FreeSMBiosData(SMBiosBuf);
+ }
+
SYSTEM_INFO info;
GetSystemInfo(&info);
xfprintf(output, " Number of Processors: %d" NEWLINE,
info.dwNumberOfProcessors);
diff --git a/sdk/lib/dmilib/dmilib.h b/sdk/lib/dmilib/dmilib.h
index 9bfcf5f507..203352db57 100644
--- a/sdk/lib/dmilib/dmilib.h
+++ b/sdk/lib/dmilib/dmilib.h
@@ -6,7 +6,8 @@
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer(a)reactos.org)
*/
-#pragma once
+#ifndef DMILIB_H
+#define DMILIB_H
enum _ID_STRINGS
{
@@ -34,3 +35,5 @@ ParseSMBiosTables(
_In_reads_bytes_(TableSize) PVOID SMBiosTables,
_In_ ULONG TableSize,
_Inout_updates_(ID_STRINGS_MAX) PCHAR * Strings);
+
+#endif /* DMILIB_H */
diff --git a/sdk/lib/udmihelp/udmihelp.h b/sdk/lib/udmihelp/udmihelp.h
index 8ed59d9f3c..27652229d9 100644
--- a/sdk/lib/udmihelp/udmihelp.h
+++ b/sdk/lib/udmihelp/udmihelp.h
@@ -5,7 +5,14 @@
* COPYRIGHT: Copyright 2018 Stanislav Motylkov
*/
-#pragma once
+#ifndef UDMIHELP_H
+#define UDMIHELP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <../dmilib/dmilib.h>
PVOID
LoadSMBiosData(
@@ -25,3 +32,9 @@ GetSMBiosStringW(
VOID
FreeSMBiosData(
_In_ PVOID Buffer);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* UDMIHELP_H */