Lenovo ThinkPad 770X Technical Reference Manual for the ThinkPad 770 - Page 137
Dwordmyptr->smbhdr_r_segment << 16, 冗pfunc = Dwordmyptr->smbhdr_r_offset
View all Lenovo ThinkPad 770X manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 137 highlights
BOOLEAN GetSmapiEntry(PSMB pFunc) { PFSMB_HEADER_REAL MyPtr = xF ; WORD cnt = ; BYTE cksum = ; // // 1) Search for signature first // while((cnt++ < x1 ) && !(((MyPtr->SMBHDR_SIG MyPtr->SMBHDR_SIG)[1] == 'S') && ((MyPtr->SMBHDR_SIG)[2] == 'M') && ((MyPtr->SMBHDR_SIG)[3] == 'B') )) { MyPtr++ ; } // // 2) Find the Signature? // if (cnt >= x1 ) { // We cannot find it. return FALSE ; } else { // // 3) Calculate Checksum // for (cnt = ; cnt < MyPtr->SMBHDR_LEN ; cnt++) cksum += (BYTE)((MyPtr->SMBHDR_SIG)[cnt]) ; if (cksum) { // Bad Checksum return FALSE ; } else { // Build Return Address (ᑍpFunc) = ( (DWORD)(MyPtr->SMBHDR_R_OFFSET) + (((DWORD)(MyPtr->SMBHDR_R_SEGMENT))
BOOLEAN GetSmapiEntry(PSMB pFunc)
{
PFSMB_HEADER_REAL
MyPtr = ²xF²²²²²²² ;
WORD
cnt = ² ;
BYTE
cksum = ² ;
//
// 1) Search for signature first
//
while((cnt++ < ²x1²²²) &&
!(((MyPtr->SMBHDR_SIG)
[
²
]
== '$') &&
((MyPtr->SMBHDR_SIG)
[
1
]
== 'S') &&
((MyPtr->SMBHDR_SIG)
[
2
]
== 'M') &&
((MyPtr->SMBHDR_SIG)
[
3
]
== 'B') )) {
MyPtr++ ;
}
//
//
2) Find the Signature?
//
if (cnt >= ²x1²²²) {
// We cannot find it.
return FALSE ;
} else {
//
//
3) Calculate Checksum
//
for (cnt = ² ; cnt < MyPtr->SMBHDR_LEN ; cnt++)
cksum += (BYTE)((MyPtr->SMBHDR_SIG)
[
cnt
]
) ;
if (cksum) {
// Bad Checksum
return FALSE ;
} else {
// Build Return Address
(冗pFunc) = ( (DWORD)(MyPtr->SMBHDR_R_OFFSET) +
(((DWORD)(MyPtr->SMBHDR_R_SEGMENT)) << 16) ) ;
return TRUE ;
}
}
}
SMAPI BIOS
B-61