My laptop (Dell insprion 6400) was faulty a few months ago and still usable, but could not properly report the battery online and capacity to the system, recently, I want to upgrade the BIOS of A14 to A17. I found that the BIOS Upgrade Program provided by Dell requires the laptop to connect the power adapter and battery at the same time, which is designed for security, this prevents the user from damaging the machine when the power is interrupted during the BIOS upgrade. However, for a previously protected user like me, it is a bit unacceptable to buy a new battery to upgrade the BIOS, in addition, the original battery can still last for a while.
So I thought of a way to let the Upgrade Program skip the battery test and think that there is a battery in the system and the upgrade is successful:
First, enable IDA (decompilation tool and debugging tool) and load the BIOS Upgrade Program mm061a17. EXE to disassemble.
Then find the pop-up prompt:
. Data: 004425b0; char atheacadapteran []
. Data: 004425b0 atheacadapteran dB 'the AC adapter and battery must be plugged in before the sys'
. Data: 00420.b0; Data xref: sub_420d0a + 32O
. Data: 004da-b0 dB 'tem BIOS can be flashed. ', 0dh, 0ah
. Data: 004366b0 dB 0dh, 0ah
. Data: 004366b0 dB 'Press OK when they are both plugged in or cancel to quit. ', 0
. Data: 00431742 align 4
Then find the code that calls this string. It turns out to be a messageboxa API call. Find the following code:
. Text: 00420d26 loc_420d26:; Code xref: sub_420d0a + 58j
. Text: 00420d26 call sub_4213eb
. Text: 00420d2b test eax, eax
. Text: 00420d2d mov [esp + 18 h + var_8], eax
. Text: 00420d31 JZ short loc_420d6e
. Text: 00420d33 cmp dword ptr word_433c40, 0
. Text: 00420d3a jnz short loc_420d64
. Text: 00420d3c push offset atheacadapteran; "the AC adapter and battery must be plug "...
. Text: 00420d41 push ESI; lpstr
. Text: 00420d42 call EDI; wsprintfa
. Text: 00420d44 CMP [esp + 20 h + var_8], 3
. Text: 00420d49 pop ECx
. Text: 00420d4a pop ECx
Here is a call sub_4213eb subroutine call, where I place a breakpoint and start debugging and running.
After the program stops, press F7 to enter the subprogram step into trace. Later, it was found that the Win32 API of getsystempowerstatus was called in this subroutine. Obviously, it was going to query the power status of the system.
When you press f8:
. Text: 00421404 loc_421404:; Code xref: sub_4213eb + 13j
. Text: 00421404 CMP [EBP + systempowerstatus. batteryflag], 80 h
. Text: 00421408 JZ short loc_421424
. Text: 0042140a CMP [EBP + systempowerstatus. batteryflag], 0ffh
. Text: 0042140e JZ short loc_421424
. Text: 00421410 CMP [EBP + systempowerstatus. batterylifepercent], 0ah
. Text: 00421414 jbe short loc_421420
. Text: 00421416 CMP [EBP + systempowerstatus. batterylifepercent], 0ffh
. Text: 0042141a JZ short loc_421420
. Text: 0042141c XOR eax, eax
. Text: 0042141e leave
. Text: 0042141f retn
Well, it turns out that the battery's online status and power are checked. The XOR eax and eax lines are directly set as the current running address, so that it thinks that all the above checks have passed.
Press F9 again. The upgrade dialog box is displayed. It no longer checks the battery status. Confirm the upgrade, restart, update BIOS automatically, and restart again, the BIOS version is A17.