Figure 2-11 is simple as well. The actual string names have been removed so you cannot cheat by searching the Internet.
Here is the disassembly of the function:
Figure 2-11. Practical Reverse Engineering. © 2014 by Bruce Dang |
The ARM processor is in Thumb state. This function can be written as a switch statement. It essentially takes an enum and returns a string based on the value.
const char *get_string(DWORD string_enum) { /* MOV R3, R0 */ switch (string_enum) { case 6: /* CMP R3, #6 */ return "E"; /* LDR R0, =aE ; "E" */ case 7: /* CMP R3, #7 */ return "D"; /* LDR R0, =aD ; "D" */ case 8: /* CMP R3, #8 */ return "C"; /* LDR R0, =ac ; "C" */ case 9: /* CMP R3, #9 */ return "B"; /* LDR R0, =aB ; "B" */ default: return "A"; /* LDR R0, =aA ; "A" */ } }
No comments :
Post a Comment