943,774 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 588
  • Assembly RSS
May 5th, 2009
0

Asm help .Please

Expand Post »
For Example .I have a function that code in C++ :
Assembly Syntax (Toggle Plain Text)
  1. void MyFunc(int s) {
  2. struct itemRec {
  3. int code;
  4. int index;
  5. } bItem;
  6. bItem.code = 0x0000000B;
  7. bItem.index = s;
  8. __asm {
  9. push eax
  10. push edx
  11. mov ecx,0x00625388
  12. push 00000000h
  13. lea edx,bItem
  14. push edx
  15. push 00000016h
  16. mov eax,0x00487273
  17. call eax
  18. pop edx
  19. pop eax
  20. }
  21. }

and when I compile that function,so I found in asm that code :

Assembly Syntax (Toggle Plain Text)
  1. push ebp
  2. mov ebp,esp
  3. sub esp,00000008h
  4. mov eax,[ebp+08h]
  5. mov dword ptr [ebp-08h],0000000Bh
  6. mov [ebp-04h],eax
  7. push eax
  8. push edx
  9. mov ecx,00625388h
  10. push 00000000h
  11. lea edx,[ebp-08h]
  12. push edx
  13. push 00000016h
  14. mov eax,0x00487273h
  15. call eax
  16. pop edx
  17. pop eax
  18. mov esp,ebp
  19. pop ebp
  20. retn

It's my example.So when I search in other asm file,I found that asm code :


Assembly Syntax (Toggle Plain Text)
  1. push ebp
  2. mov ebp,esp
  3. sub esp,00000008h
  4. mov eax,[ebp+08h]
  5. add eax,eax
  6. mov ecx,[eax+eax+L1000D004]
  7. add eax,eax
  8. lea edx,[ebp+08h]
  9. mov [ebp+08h],ecx
  10. mov [ebp-04h],eax
  11. mov [ebp-08h],edx
  12. push eax
  13. push ecx
  14. mov ecx,ds:[00838344h]
  15. add ecx,0000843Ch
  16. add ecx,00007EBCh
  17. push ecx
  18. add ecx,0000054Ch
  19. mov eax,[ebp-08h]
  20. push eax
  21. mov eax,0051F900h
  22. call eax
  23. mov ecx,[eax+0Ch]
  24. cmp ecx,[ebp+08h]
  25. pop ecx
  26. jnz L100010A8
  27. add eax,00000010h
  28. add ecx,[ebp-04h]
  29. mov [ecx],eax
  30. L100010A8:
  31. pop ecx
  32. pop eax
  33. mov esp,ebp
  34. pop ebp
  35. retn

Please help me and tell me know what the real code in C++ (same my example) .And parameter to function that has address 0051F900h .Please help me
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LangTuHaoHoa is offline Offline
4 posts
since May 2009
May 5th, 2009
0

Re: Asm help .Please

Either I don't know what you're asking for or this smells like homework.

Anyway the param to the function you were asking about

Assembly Syntax (Toggle Plain Text)
  1.  
  2. mov eax,[ebp-08h]
  3. push eax
  4. mov eax,0051F900h
  5. call eax

The C calling convention is to push arguments on the stack from right to left. So what do you think the argument passed is?
Reputation Points: 57
Solved Threads: 5
Light Poster
sysop_fb is offline Offline
42 posts
since Apr 2009
May 5th, 2009
0

Re: Asm help .Please

SO,I want to know how many arguments in that function,and How to use that function

for example:

void MyFunc(int s) {
struct itemRec {
int code;
int index;
} bItem;
bItem.code = 0x0000000B;
bItem.index = s;
__asm {
push eax
push edx
mov ecx,0x00625388
push 00000000h
lea edx,bItem
push edx
push 00000016h
mov eax,0x00487273
call eax
pop edx
pop eax
}
}


I really want to know how use that function ( 0x0051F900) .So because I don't know how many arguments that push to that function and code for use that function .Please help me.

In your post.You say :

Quote ...
mov eax,[ebp-08h]
push eax
mov eax,0051F900h
call eax
So [ebp-08h] is?I don't know type of that argument.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LangTuHaoHoa is offline Offline
4 posts
since May 2009
May 5th, 2009
0

Re: Asm help .Please

Click to Expand / Collapse  Quote originally posted by sysop_fb ...
Either I don't know what you're asking for or this smells like homework.

Anyway the param to the function you were asking about

Assembly Syntax (Toggle Plain Text)
  1.  
  2. mov eax,[ebp-08h]
  3. push eax
  4. mov eax,0051F900h
  5. call eax

The C calling convention is to push arguments on the stack from right to left. So what do you think the argument passed is?
If possible,please help me decompile that asm code to real code in C++ .Please see my example to understand what I say .Thanks u
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LangTuHaoHoa is offline Offline
4 posts
since May 2009
May 7th, 2009
0

Re: Asm help .Please

No one can help me how to use function 0x51F900 and what is arguments pass to that function ? Please help me
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LangTuHaoHoa is offline Offline
4 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Space Invaders
Next Thread in Assembly Forum Timeline: New to Win32 ASM programming





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC