Récupération des informations de SMBIOS

 

Code écrit pour lire les informations matérielles (carte mère et plate-forme) à partir de SMBIOS. WinAPI est utilisé, bien sûr. Peut être utilisé pour lier les produits au matériel. À mon avis, il est inutile de se lier à autre chose qu'à la carte mère. Les lecteurs, les cartes vidéo sont variables.

Mettez SMBIOS.mqh dans Include.

Test SMBIOS.mq5 - dans Scripts.

Pour une utilisation réelle, quand vous n'avez pas besoin d'informations inutiles, commentez-le / ne le définissez pas #define SMBIOS_DEBUG

Je ne l'ai testé que sur un ordinateur portable et un VPS et il doit être vérifié et signalé s'il ne fonctionne pas correctement. Vérifiez les données par rapport au programme hwinfo.

1. Le code part du principe que les données de SMBIOS sont sorties dans un ordre fixe. Ainsi,en cas d'incohérence, il est conseillé de fournir une sortie de test complète et des captures d'écran de hwinfo à partir des onglets BIOS, Système, Carte principale et Boîtier système de l'arborescence DMI de la carte mère/SMBIOS. Sinon, je ne serai pas en mesure de déboguer.

2. J'ai besoin de conseils de la part de programmeurs de téléphones sur la façon de rendre ça agréable ici :

//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
Dossiers :
SMBIOS.mqh  6 kb
 
2021.03.23 14:33:50.492 array out of range in 'SMBIOS.mqh' (170,8)
 
fxsaber:

Il semble qu'il y ait un nombre différent de champs. J'ai essayé de faire un tableau avec une marge et voir si ça bouge. Reposé SMBIOS.mqh.

PS : comme je l'ai dit, testé uniquement sur un ordinateur. Pas d'accès aux autres. Alors ne soyez pas désolé.
Dossiers :
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

comment le rendre joli ici :

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:

Il semble qu'il y ait un nombre différent de champs. J'ai essayé de faire un tableau avec une marge et voir si ça bouge. Reposé 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:

Merci. Magnifique, mais quelque part redondant. Je voudrais qu'il soit sans code exécutable.

 

Win7 x64


 

Ça a marché, je dois le boulonner à la 4,

Fonctionne avec un compte non connecté.

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 mémoire, 11 / 298 Gb de disque, 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:

Une autre correction.

Dossiers :
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

Une autre correction.

 
Vitaly Muzichenko:

Win7 x64

Est-ce que c'est TOUTE la sortie ?