[DRWTSN32] Add SMBIOS data to the system information (#1017)

[DMILIB][UDMIHELP] Allow functions to be linked with C++ code.
This commit is contained in:
Stanislav Motylkov 2018-11-21 23:49:15 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent d897e271a2
commit baf2c0cc2d
4 changed files with 53 additions and 4 deletions

View file

@ -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)

View file

@ -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);

View file

@ -6,7 +6,8 @@
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@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 */

View file

@ -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 */