2021.03.23 14:33:50.492 array out of range in 'SMBIOS.mqh' (170,8)
fxsaber:
Seems to be giving out a different number of fields. Tried to make an array with a margin and see if it moves out. Reposted SMBIOS.mqh.
PS: like I said, only tested on one computer. No access to the others. So don't be sorry.
Files:
SMBIOS.mqh
5 kb
Edgar Akhmadeev:
how to make it look pretty here:
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:
Seems to be giving out a different number of fields. Tried to make an array with a margin and see if it moves off. 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:
Thank you. Beautiful, but somehow redundant. I would like it without executable code.
Win7 x64
It worked, I need to attach it to the 4,
Worked when not logged into account.
2021.03.23 15:40:24.109 Terminal Windows 7 Service Pack 1 build 7601, Intel Core i3-3220 @ 3.30GHz, 0 / 7 Gb memory, 11 / 298 Gb disk, 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.
Edgar Akhmadeev:
Another correction.
Vitaly Muzichenko:
Win7 x64
Is that ALL the output?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Written code to read hardware information (motherboard and platform) from SMBIOS. WinAPI is used, of course. Can be used to bind products to hardware. In my opinion, it makes no sense to bind to anything other than the motherboard. Drives, video cards are variable.
Put SMBIOS.mqh in Include.
Test SMBIOS.mq5 - in Scripts.
For real use, when you don't need unnecessary information, comment it out / don't define #define SMBIOS_DEBUG
I've only tested it on one laptop and VPS and it needs community checking and reporting if it's not working correctly. Check the data against the hwinfo program.
1. The code makes the assumption that data from SMBIOS is output in a fixed order. Soif there are inconsistencies, it is advisable to give a full test output and screenshots from hwinfo from the BIOS, System, Mainboard and System enclosure tabs from the Motherboard/SMBIOS DMI tree. Otherwise I will not be able to debug.
2. Need some advice from handset programmers on how to make it look nice here: