For Example .I have a function that code in C++ :

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
	}
}

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

push	ebp
  		mov	ebp,esp
  		sub	esp,00000008h
  		mov	eax,[ebp+08h]
  		mov	dword ptr [ebp-08h],0000000Bh
  		mov	[ebp-04h],eax
  		push	eax
  		push	edx
  		mov	ecx,00625388h
  		push	00000000h
  		lea	edx,[ebp-08h]
  		push	edx
  		push	00000016h
  		mov	eax,0x00487273h
  		call	eax
  		pop	edx
  		pop	eax
  		mov	esp,ebp
  		pop	ebp
  		retn

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

push	ebp
  		mov	ebp,esp
  		sub	esp,00000008h
  		mov	eax,[ebp+08h]
  		add	eax,eax
  		mov	ecx,[eax+eax+L1000D004]
  		add	eax,eax
  		lea	edx,[ebp+08h]
  		mov	[ebp+08h],ecx
  		mov	[ebp-04h],eax
  		mov	[ebp-08h],edx
  		push	eax
  		push	ecx
  		mov	ecx,ds:[00838344h]
  		add	ecx,0000843Ch
  		add	ecx,00007EBCh
  		push	ecx
  		add	ecx,0000054Ch
  		mov	eax,[ebp-08h]
  		push	eax
  		mov	eax,0051F900h
  		call	eax
  		mov	ecx,[eax+0Ch]
  		cmp	ecx,[ebp+08h]
  		pop	ecx
  		jnz	L100010A8
  		add	eax,00000010h
  		add	ecx,[ebp-04h]
  		mov	[ecx],eax
 L100010A8:
  		pop	ecx
  		pop	eax
  		mov	esp,ebp
  		pop	ebp
  		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

Recommended Answers

All 4 Replies

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

mov	eax,[ebp-08h]
  		push	eax
  		mov	eax,0051F900h
  		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?

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.

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

mov	eax,[ebp-08h]
  		push	eax
  		mov	eax,0051F900h
  		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

No one can help me how to use function 0x51F900 and what is arguments pass to that function ? :( Please help me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.