Asm help .Please

Reply

Join Date: May 2009
Posts: 4
Reputation: LangTuHaoHoa is an unknown quantity at this point 
Solved Threads: 0
LangTuHaoHoa LangTuHaoHoa is offline Offline
Newbie Poster

Asm help .Please

 
0
  #1
May 5th, 2009
For Example .I have a function that code in C++ :
  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 :

  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 :


  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
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 39
Reputation: sysop_fb is an unknown quantity at this point 
Solved Threads: 5
sysop_fb sysop_fb is offline Offline
Light Poster

Re: Asm help .Please

 
0
  #2
May 5th, 2009
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

  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?
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 4
Reputation: LangTuHaoHoa is an unknown quantity at this point 
Solved Threads: 0
LangTuHaoHoa LangTuHaoHoa is offline Offline
Newbie Poster

Re: Asm help .Please

 
0
  #3
May 5th, 2009
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 :

mov eax,[ebp-08h]
push eax
mov eax,0051F900h
call eax
So [ebp-08h] is?I don't know type of that argument.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 4
Reputation: LangTuHaoHoa is an unknown quantity at this point 
Solved Threads: 0
LangTuHaoHoa LangTuHaoHoa is offline Offline
Newbie Poster

Re: Asm help .Please

 
0
  #4
May 5th, 2009
Originally Posted by sysop_fb View Post
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

  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
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 4
Reputation: LangTuHaoHoa is an unknown quantity at this point 
Solved Threads: 0
LangTuHaoHoa LangTuHaoHoa is offline Offline
Newbie Poster

Re: Asm help .Please

 
0
  #5
May 7th, 2009
No one can help me how to use function 0x51F900 and what is arguments pass to that function ? Please help me
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC