Read the smbios information. In Windows, the following two methods are provided:
1. Use WMI (Windows Management Instrumentation) Read the smbios information.
2. The system APIs reads the smbios information:Enumsystemfirmwaretables ()AndGetsystemfirmwaretable ().
(I didn't write it, I hope I have time to go to study)
In dos, we can directly read smbios information through the method we mentioned earlier.
1. Find the EPS structure table to obtain the number of types and addresses.
Unsigned char far * tbladdress;
Unsigned int tbllen;
/* Seach the table's address */
Int search_strs ()
{
Char * str1 = "_ Sm _";
Char * str2 = "_ DMI _";
Unsigned char far * PTR;
Int J;
// Initialise the address pointer
PTR = (unsigned char far *) 0xf0000000;
// Seach the address, 0x000f0000-0x000fffff, but under the DOS, we will use the 20bit, so the address is f000: 0000-f000: FFFF
For (; PTR <= 0xf000ffff ;)
{
For (j = 0; j <strlen (str1); j ++)
{
If (* (PTR + J )! = * (Str1 + J ))
Break;
}
If (j> = strlen (str1)/*, the first string '_ Sm _' is found _', whether or not the five bytes of the last 16 bytes are the keyword '_ DMI _'*/
{
PTR + = 0x10; // Add 16 bytes to the address
For (j = 0; j <strlen (str2); j ++)
{
If (* (PTR + J )! = * (Str2 + J ))
Break;
}
If (j> = strlen (str2) // find the second string '_ DMI _'
{
Tbladdress = PTR + 8; // smbios schema table address
Tbllen = * (unsigned int far *) (PTR + 6 ));
Return 1;
}
}
Else
{
PTR + = 0x10; // The first string is not found, and PTR + 0x10 is re-searched.
}
}
Return 0;
}
2. If we have found it, We can print type0:
Unsigned int seg, offset;
Unsigned char far * tableaddr;
Unsigned char type, lenofstructure;
If (search_strs ())
{
// Pay attention to address conversion!
// Because x86 adopts the small-end byte order, the low-byte stores the high value, and thus re-writes it as "high-low"
SEG = * (unsigned int far *) (tableaddr + 2); // 16 bits of the int type are under DOS?
SEG <12; // get the segment address of type0
Offset = * (unsigned int far *) (tableaddr );
Tableaddr = (unsigned long) (SEG) <16) + (unsigned) (offset ));
// Print type0
Printf ("\ ntype 0 (BIOS information :) \ n ");
Printf ("type: % d \ n", * (tableaddr ));
Printf ("Length: % XH \ n", * (tableaddr + 1 ));
Printf ("handle: %. 4x \ n", * (unsigned int far *) (tableaddr + 2 )));
Printf ("BIOS starting address segment: %. 4x \ n", (* (unsigned int far *) (tableaddr + 6 )));
Printf ("BIOS Rom size: % dkb \ n", (* (tableaddr + 9) + 1) * 64 );
Printf ("BIOS characteristics: %. 8x %. 8x \ n ", * (unsigned long far *) (tableaddr + 0x0e), * (unsigned long far *) (tableaddr + 0x0a )));
Printf ("BIOS characterics extension Bytes: %. 4x \ n", * (unsigned int far *) (tableaddr + 0x12 )));
Printf ("system BIOS major release: % XH \ n", * (tableaddr + 0x14 ));
Printf ("system BIOS minor release: % XH \ n", * (tableaddr + 0x15 ));
Printf ("embedded controller firmware major release: % XH \ n", * (tableaddr + 0x16 ));
Printf ("embedded controller firmware minor release: % XH \ n", * (tableaddr + 0x17 ));
Tableaddr + = * (tableaddr + 1 );
Printf ("verdor :");
Tableaddr + = (print (tableaddr) + 1 );
Printf ("BIOS version :");
Tableaddr + = (print (tableaddr) + 1 );
Printf ("BIOS Release Date :");
Tableaddr + = Print (tableaddr );
}
Well, you probably have understood it. Pay attention to address translation!
Read the full text
Category:View BIOS comments