我最近开始学习装配以进行逆向工程.我正在阅读实用逆向工程,并在那里看到这个汇编代码:
loop_start:
mov eax, [edi+4]
mov eax, [eax+ebx*4]
test eax, eax
... //They also did the dots here
jz short loc_7F627F
loc_7F627F:
inc ebx
cmp ebx, [edi]
jl short loop_start
Run Code Online (Sandbox Code Playgroud)
然后他们告诉我们这个信息应该给我们一个想法,把它反编译成这个(我正在做他们所做的所有点):
typedef struct _Foo
{
DWORD size;
DWORD array[...];} FOO, *PFOO;
PFOO bar= ...;
for(i= ...; i < bar->size; i++)
{
if(bar->array[i] != 0){
...
}
}
Run Code Online (Sandbox Code Playgroud)
但随着jz short loc_7F627F
只会跳,如果EAX的含量为零不应该的...
是之后jz
,而不是之前jz
?否则这将意味着我测试内容eax
,是否为零,然后做一些未知的东西,然后跳转,如果它是零(假设没有其他指令包含在...
影响ZF
标志),这似乎不匹配C - 他们写的代码.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);$$
// pull the turtle's ID out of the intent that the MainActivity used to load me
Intent intent = getIntent();
int id = intent.getIntExtra("turtle_id", R.id.leo);
String text = "";
if (id == R.id.leo) {
text = TURTLE_DETAILS[0];
} else if (id == R.id.mike) {
text = TURTLE_DETAILS[1];
} else if (id == R.id.don) {
text = TURTLE_DETAILS[2];
} else { // if (id == R.id.raph)
text = TURTLE_DETAILS[3];
}
Run Code Online (Sandbox Code Playgroud)
我无法解决问题
int id …
Run Code Online (Sandbox Code Playgroud)