Recuperare informazioni da SMBIOS

 

Codice scritto per leggere le informazioni hardware (scheda madre e piattaforma) da SMBIOS. Si usa WinAPI, ovviamente. Può essere usato per legare i prodotti all'hardware. Secondo me, non ha senso legarsi a qualcosa di diverso dalla scheda madre. Le unità, le schede video sono variabili.

Mettere SMBIOS.mqh in Include.

Test SMBIOS.mq5 - in Scripts.

Per un uso reale, quando non hai bisogno di informazioni inutili, commentalo / non definirlo #define SMBIOS_DEBUG

L'ho testato solo su un portatile e un VPS e deve essere verificato e segnalato se non funziona correttamente. Controlla i dati con il programma hwinfo.

1. Il codice presuppone che i dati di SMBIOS siano emessi in un ordine fisso. Quindi,se ci sono incongruenze, è consigliabile dare un output di test completo e screenshot da hwinfo dalle schede BIOS, System, Mainboard e System enclosure dall'albero Motherboard/SMBIOS DMI. Altrimenti non sarò in grado di eseguire il debug.

2. Ho bisogno di qualche consiglio da parte dei programmatori di telefoni cellulari su come renderlo carino qui:

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

Sembra che dia un numero diverso di campi. Ho provato a fare un array con un margine e vedere se si sposta. Riposto SMBIOS.mqh.

PS: come ho detto, testato solo su un computer. Nessun accesso agli altri. Quindi non essere dispiaciuto.
File:
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

come farla sembrare bella qui:

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:

Sembra che dia un numero diverso di campi. Ho provato a fare un array con un margine e vedere se si sposta. Riposto 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:

Grazie. Bello, ma in qualche modo ridondante. Lo vorrei senza codice eseguibile.

 

Win7 x64


 

Ha funzionato, devo attaccarlo al 4,

Ha funzionato quando non ha effettuato l'accesso all'account.

2021.03.23 15:40:24.109 Terminale Windows 7 Service Pack 1 build 7601, Intel Core i3-3220 @ 3.30GHz, 0 / 7 Gb memoria, 11 / 298 Gb 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:

Un'altra correzione.

File:
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

Un'altra correzione.

 
Vitaly Muzichenko:

Win7 x64

È TUTTA l'uscita?