Recuperando informações do SMBIOS

 

Código escrito para ler informações de hardware (placa-mãe e plataforma) do SMBIOS. O WinAPI é utilizado, é claro. Pode ser usado para amarrar produtos a ferragens. Na minha opinião, não faz sentido se prender a nada além da placa-mãe. Acionamentos, placas de vídeo são variáveis.

Coloque SMBIOS.mqh em Incluir.

Teste SMBIOS.mq5 - em Scripts.

Para uso real, quando você não precisa de informações desnecessárias, comente / não defina #define SMBIOS_DEBUG

Só o testei em um laptop e VPS e ele precisa ser verificado e relatado se não estiver funcionando corretamente. Verifique os dados em relação ao programa hwinfo.

1. O código faz supor que os dados do SMBIOS são emitidos em uma ordem fixa. Portanto,se houver inconsistências, é aconselhável dar uma saída de teste completa e screenshots de hwinfo da BIOS, System, Mainboard e divisórias do Sistema da árvore da Placa-Mãe/SMBIOS DMI. Caso contrário, não serei capaz de depurar.

2. Preciso de alguns conselhos de programadores de aparelhos sobre como fazer com que fique bonito aqui:

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

Parece estar dando um número diferente de campos. Tentei fazer uma matriz com uma margem e ver se ela se movimentava. Reposted SMBIOS.mqh.

PS: como eu disse, testado apenas em um computador. Não há acesso aos outros. Portanto, não se arrependa.
Arquivos anexados:
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

como fazer com que fique bonito aqui:

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 estar dando um número diferente de campos. Tentei fazer uma matriz com uma margem e ver se ela se movimentava. Reposted 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:

Obrigado. Bonito, mas de alguma forma redundante. Eu gostaria de fazê-lo sem código executável.

 

Win7 x64


 

Funcionou, eu preciso anexá-lo ao 4,

Funcionou quando não foi feito o login.

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 memória, 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:

Outra correção.

Arquivos anexados:
SMBIOS.mqh  5 kb
 
Edgar Akhmadeev:

Outra correção.

 
Vitaly Muzichenko:

Win7 x64

É TODO o resultado?

Razão: