Recuperación de información de SMBIOS

 

Código escrito para leer la información del hardware (placa base y plataforma) de SMBIOS. Se utiliza WinAPI, por supuesto. Puede utilizarse para unir productos a los herrajes. En mi opinión, no tiene sentido enlazar con otra cosa que no sea la placa base. Las unidades, las tarjetas de vídeo son variables.

Poner SMBIOS.mqh en Include.

Prueba SMBIOS.mq5 - en Scripts.

Para un uso real, cuando no necesite información innecesaria, coméntelo / no defina #define SMBIOS_DEBUG

Sólo lo he probado en un portátil y en un VPS y hay que comprobarlo e informar si no funciona correctamente. Comprueba los datos con el programa hwinfo.

1. El código asume que los datos de SMBIOS se emiten en un orden fijo. Así quesi hay inconsistencias, es aconsejable dar una salida de prueba completa y capturas de pantalla de hwinfo de las pestañas BIOS, Sistema, Placa base y Recinto del sistema del árbol DMI de la placa base/SMBIOS. De lo contrario, no podré depurar.

2. Necesito algún consejo de los programadores de teléfonos sobre cómo hacer que se vea bien aquí:

//const uint    SMBIOS_signature = 'RSMB';
const uint      SMBIOS_signature = ('R' << 24) + ('S' << 16) + ('M' << 8) + 'B';
HWiNFO - Free System Information, Monitoring and Diagnostics
  • www.hwinfo.com
Free Hardware Analysis, Monitoring and Reporting. In-depth Hardware Information, Real-Time System Monitoring, Reporting & more
Archivos adjuntos:
SMBIOS.mqh  6 kb
 
2021.03.23 14:33:50.492 array out of range in 'SMBIOS.mqh' (170,8)
 
fxsaber:

Parece que da un número diferente de campos. Intenté hacer una matriz con un margen y ver si se desplaza. Reenviado SMBIOS.mqh.

PD: como he dicho, sólo se ha probado en un ordenador. No hay acceso a los demás. Así que no lo lamentes.
Archivos adjuntos:
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

cómo hacer que se vea bonito aquí:

template <typename T>
T StringToInteger2( const string Str )
{
  T Res = 0;
  
//  const int Size = MathMin(StringLen(Str), sizeof(T));
  const int Size = StringLen(Str);
  
  for (int i = 0; i < Size; i++)
    Res = (Res << 8) + Str[i];
    
  return(Res);
}

//const uint    SMBIOS_signature = 'RSMB';
const uint      SMBIOS_signature = StringToInteger2<uint>("RSMB");
 
Edgar Akhmadeev:

Parece que da un número diferente de campos. Intenté hacer una matriz con un margen y ver si se desplaza. Reenviado SMBIOS.mqh.

2021.03.23 14:49:24.516 Location in chassis:  
2021.03.23 14:49:24.516 array out of range in 'SMBIOS.mqh' (192,24)
 
fxsaber:

Gracias. Hermoso, pero de alguna manera redundante. Me gustaría que fuera sin código ejecutable.

 

Win7 x64


 

Funcionó, necesito atornillarlo al 4,

Funcionó con una cuenta no conectada.

2021.03.23 15:40:24.109 Terminal Windows 7 Service Pack 1 build 7601, Intel Core i3-3220 @ 3.30GHz, 0 / 7 Gb de memoria, 11 / 298 Gb de disco, IE 11, UAC, GMT+3


FM      0       15:51:26.042    Test_SMBIOS (USDSEK,M1) System Management BIOS Version: 2.7
GF      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) System BIOS Version: 4.6
RM      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Embedded Controller Firmware Version: 255.255
LJ      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) BIOS Vendor: American Megatrends Inc.
QN      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) BIOS Version: V1.6
DI      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) BIOS Release Date: 04/17/2012
RE      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) UUID: {0000-00-00-00-8 c89a5ffbfb6}
FL      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) System Manufacturer: MSI
DE      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Product Name: MS-7788
QR      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Product Version: 1.0
KK      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Product Serial Number: To be filled by O.E.M.
ON      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) SKU Number: To be filled by O.E.M.
KH      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Family: To be filled by O.E.M.
FH      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Mainboard Manufacturer: MSI
OL      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Mainboard Name: H61M-P20 (G3) (MS-7788)
ED      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Mainboard Version: 1.0
KM      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Mainboard Serial Number: To be filled by O.E.M.
EN      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Asset Tag: To be filled by O.E.M.
CI      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) Location in chassis: To be filled by O.E.M.
MP      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) {0000-00-00-00-8 c89a5ffbfb6}
EH      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) To be filled by O.E.M.
IP      0       15:51:26.043    Test_SMBIOS (USDSEK,M1) To be filled by O.E.M.
 
fxsaber:

Otra corrección.

Archivos adjuntos:
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

Otra corrección.

 
Vitaly Muzichenko:

Win7 x64

¿Es esa TODA la salida?

Razón de la queja: