整理的VC6编译出来指针和数组一些常见的反汇编笔记。
5: int n = 2; 0040D428 mov dword ptr [ebp-4],2 6: int *p1 = &n; 0040102F lea eax,[ebp-4] 00401032 mov dword ptr [ebp-8],eax
7: int **p2 = &p1; 00401035 lea ecx,[ebp-8] 00401038 mov dword ptr [ebp-0Ch],ecx
8: *p1 = 5; 0040103B mov edx,dword ptr [ebp-8] 0040103E mov dword ptr [edx],5
9: **p2 = 3; 00401044 mov eax,dword ptr [ebp-0Ch] 00401047 mov ecx,dword ptr [eax] 00401049 mov dword ptr [ecx],3
12: temp = *p1; 0040D44F mov edx,dword ptr [ebp-0Ch] 0040D452 mov eax,dword ptr [edx] 0040D454 mov dword ptr [ebp-8],eax
13: temp = **p2; 0040D457 mov ecx,dword ptr [ebp-10h] 0040D45A mov edx,dword ptr [ecx] 0040D45C mov eax,dword ptr [edx] 0040D45E mov dword ptr [ebp-8],eax
5: int intArr[] = {0, 1, 2, 3, 4}; 0040D428 mov dword ptr [ebp-14h],0 # intArr[0] 0040D42F mov dword ptr [ebp-10h],1 # intArr[1] 0040D436 mov dword ptr [ebp-0Ch],2 # intArr[2] 0040D43D mov dword ptr [ebp-8],3 # intArr[3] 0040D444 mov dword ptr [ebp-4],4 # intArr[4]
9: intArr[1] = 2; 0040D451 mov dword ptr [ebp-10h],2
10: temp = intArr[3]; 0040D458 mov ecx,dword ptr [ebp-8] 0040D45B mov dword ptr [ebp-18h],ecx
16: intArr[2]++; 0040D471 mov ecx,dword ptr [ebp-18h] 0040D474 add ecx,1 0040D477 mov dword ptr [ebp-18h],ecx
19: temp = intArr[n]; 0040D47E mov edx,dword ptr [ebp-4] # edx = n 0040D481 mov eax,dword ptr [ebp+edx*4-20h] 0040D485 mov dword ptr [ebp-24h],eax
20: intArr[n] = 10; 0040D488 mov ecx,dword ptr [ebp-4] # ecx = n 0040D48B mov dword ptr [ebp+ecx*4-20h],0Ah
7: int *pInt = intArr; 0040D44B lea eax,[ebp-14h] 0040D44E mov dword ptr [ebp-1Ch],eax
18: pInt++; 0040D47A mov edx,dword ptr [ebp-28h] 0040D47D add edx,4 # 指针的加减法 = 加减数 * sizeof(指向的类型) 0040D480 mov dword ptr [ebp-28h],edx
27: pInt[1] = temp; 0040D4B4 mov eax,dword ptr [ebp-28h] # pInt的地址 0040D4B7 mov ecx,dword ptr [ebp-24h] 0040D4BA mov dword ptr [eax+4],ecx # pInt的地址 + 4
28: temp = pInt[2]; 0040D4BD mov edx,dword ptr [ebp-28h] # pInt的地址 0040D4C0 mov eax,dword ptr [edx+8] # pInt的地址 + 8 0040D4C3 mov dword ptr [ebp-24h],eax
30: pInt[n] = temp; 0040D4C6 mov ecx,dword ptr [ebp-4] # n 0040D4C9 mov edx,dword ptr [ebp-28h] # pInt的地址 0040D4CC mov eax,dword ptr [ebp-24h] 0040D4CF mov dword ptr [edx+ecx*4],eax # pInt的地址 + n*4
31: temp = pInt[n]; 0040D4D2 mov ecx,dword ptr [ebp-4] # n 0040D4D5 mov edx,dword ptr [ebp-28h] 0040D4D8 mov eax,dword ptr [edx+ecx*4] 0040D4DB mov dword ptr [ebp-24h],eax # pInt的地址 + n*4
本文作者:菜鸟
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 许可协议。转载请注明出处!