Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 01:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Problem - Inline Assembly Call Function

Discussion on Problem - Inline Assembly Call Function within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
Problem - Inline Assembly Call Function

Old Client Function:

Code:
00414710 - push ecx
00414711 - mov ecx,[esp+0C]
00414715 - lea eax,[esp]
00414718 - push eax
00414719 - push 00
0041471B - push ecx
0041471C - call 00520550
00414721 - add esp,0C
00414724 - test al,al
00414726 - jne 00414734
00414728 - push 00
0041472A - call 00520640
0041472F - add esp,04
00414732 - pop ecx
00414733 - ret 
00414734 - mov edx,[esp]
00414737 - mov ecx,[0061C028] : [1F708A70]
0041473D - push edx
0041473E - call 0041F000
00414743 - call 005204C0
00414748 - pop ecx
My inline assembly code in c++:

Code:
void InlineASM(int arg)
{
     DWORD calladr = 0x0041F000;
     __asm{
          MOV EDX, 0x0061C028
          MOV ECX, DWORD PTR DS:[EDX]
          PUSH arg
          CALL calladr
     }
}
And It's working.



But in new client function:

Code:
004B1A10 - push ecx
004B1A11 - push esi
004B1A12 - mov esi,[esp+10]
004B1A16 - mov eax,0000FFFF
004B1A1B - push esi
004B1A1C - mov byte ptr [esp+08],01
004B1A21 - mov [esp+09],ax
004B1A26 - call dword ptr [00E3D824]
004B1A2C - add esp,04
004B1A2F - sub eax,01
004B1A32 - je 004B1A55
004B1A34 - sub eax,01
004B1A37 - jne 004B1A69
004B1A39 - lea ecx,[esp+04]
004B1A3D - push ecx
004B1A3E - push eax
004B1A3F - push esi
004B1A40 - call 0054EE80
004B1A45 - add esp,0C
004B1A48 - test al,al
004B1A4A - je 004B1A69
004B1A4C - lea edx,[esp+05]
004B1A50 - push edx
004B1A51 - push 01
004B1A53 - jmp 004B1A5C
004B1A55 - lea eax,[esp+05]
004B1A59 - push eax
004B1A5A - push 00
004B1A5C - push esi
004B1A5D - call 0054EEB0
004B1A62 - add esp,0C
004B1A65 - test al,al
004B1A67 - jne 004B1A76
004B1A69 - push 00
004B1A6B - call 0054EE10
004B1A70 - add esp,04
004B1A73 - pop esi
004B1A74 - pop ecx
004B1A75 - ret 
004B1A76 - mov dl,[esp+06]
004B1A7A - push ecx
004B1A7B - mov cx,[esp+08]
004B1A80 - mov eax,esp
004B1A82 - mov [eax],cx
004B1A85 - mov ecx,[00FFE7AC] : [00000000]
004B1A8B - mov [eax+02],dl
004B1A8E - call 004BD540
004B1A93 - call 008A4040
004B1A98 - pop esi
004B1A99 - pop ecx
004B1A9A - ret
I was trying work with new client function, doesn't work.

How to use new client function in inline assembly?

Thanks for helps.
-Zynel* is offline  
Old 04/27/2014, 10:39   #2
 
​Tension's Avatar
 
elite*gold: 110
Join Date: Jun 2013
Posts: 599
Received Thanks: 510
Are you sure it's the correct function?
​Tension is offline  
Thanks
1 User
Old 04/27/2014, 10:52   #3
 
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
Quote:
Originally Posted by ​Tension View Post
Are you sure it's the correct function?
Yes.

"SendItemUsePacket" in metin2.
-Zynel* is offline  
Old 04/27/2014, 11:37   #4
 
​Tension's Avatar
 
elite*gold: 110
Join Date: Jun 2013
Posts: 599
Received Thanks: 510
if you just want to call the function then your previous code should work since the parameter didn't changed. Do you want to call the function 0x004B1A10? Or Is the SendItemUsePacket function in that function?

Code:
bool SendItemUsePacket(BYTE ItemPos)
{
	typedef bool pSendItemUsePacket(BYTE Pos);
	pSendItemUsePacket* rSendItemUsePacket = (pSendItemUsePacket*)0x004B1A10;
	return rSendItemUsePacket(ItemPos);
}
should probably work too.

Inline ASM:
Code:
bool SendItemUsePacket(BYTE ItemPos)
{
	bool rval = false;
	DWORD call_addr = 0x004B1A10;
	_asm
	{
		push ItemPos
		call call_addr
		mov rval, eax	//Store the return value in rval
	}
	return rval;
}
​Tension is offline  
Thanks
1 User
Old 04/27/2014, 12:03   #5
 
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
Quote:
Originally Posted by ​Tension View Post
if you just want to call the function then your previous code should work since the parameter didn't changed. Do you want to call the function 0x004B1A10? Or Is the SendItemUsePacket function in that function?

Code:
bool SendItemUsePacket(BYTE ItemPos)
{
	typedef bool pSendItemUsePacket(BYTE Pos);
	pSendItemUsePacket* rSendItemUsePacket = (pSendItemUsePacket*)0x004B1A10;
	return rSendItemUsePacket(ItemPos);
}
should probably work too.

Inline ASM:
Code:
bool SendItemUsePacket(BYTE ItemPos)
{
	bool rval = false;
	DWORD call_addr = 0x004B1A10;
	_asm
	{
		push ItemPos
		call call_addr
		mov rval, eax	//Store the return value in rval
	}
	return rval;
}
I will try, thanks

And SendItemUsePacket function is in that function.

Doesn't working with 0x004B1A10 func.

I need same as

Code:
void InlineASM(int arg)
{
     DWORD calladr = 0x0041F000;
     __asm{
          MOV EDX, 0x0061C028
          MOV ECX, DWORD PTR DS:[EDX]
          PUSH arg
          CALL calladr
     }
}
-Zynel* is offline  
Old 04/28/2014, 23:10   #6

 
elite*gold: 0
Join Date: Apr 2007
Posts: 2,394
Received Thanks: 6,644
Code:
void InlineASM(int arg)
{
     DWORD calladr = 0x004BD540;
     __asm{
          MOV EDX, 0x00FFE7AC
          MOV ECX, DWORD PTR DS:[EDX]
          PUSH arg
          CALL calladr
     }
}
try this
wurstbrot123 is offline  
Thanks
1 User
Old 04/29/2014, 12:58   #7


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,902
Received Thanks: 25,407
Use function pointers.
MrSm!th is offline  
Thanks
1 User
Old 04/29/2014, 13:42   #8
 
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
Quote:
Originally Posted by wurstbrot123 View Post
Code:
void InlineASM(int arg)
{
     DWORD calladr = 0x004BD540;
     __asm{
          MOV EDX, 0x00FFE7AC
          MOV ECX, DWORD PTR DS:[EDX]
          PUSH arg
          CALL calladr
     }
}
try this
I tried first this but it doesn't work

Quote:
Originally Posted by MrSm!th View Post
Use function pointers.
Have you example?
-Zynel* is offline  
Old 04/30/2014, 11:43   #9
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
Code:
void(*pFunc)(int) = (void(*)(int))0x11111111;
pFunc(param);
Tyrar is offline  
Old 05/24/2014, 17:15   #10
 
elite*gold: 0
Join Date: Aug 2013
Posts: 12
Received Thanks: 0
I tried all but doesn't work I think need to use asm.
-Zynel* is offline  
Reply


Similar Threads Similar Threads
[C++]Call a Game Function
08/27/2013 - Metin2 PServer Guides & Strategies - 3 Replies
Hello guys here is a quick tutorial : Metin2 How To Call A Function - www.darkhook.net - YouTube Source : // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" // We will call our function.
Call Function
02/20/2012 - General Coding - 3 Replies
huhu, eine kurze frage : Ich habe mir gerade ein ClickToMove Offset für nen spiel rausgesucht (nein kein WoW :D) wenn ich die daten in den Ramgeschrieben habe muss ich ja die Function Move(float x, float y) ausführen. muss ich dafür ne DLL injection vornehmen oder kann man das auch so machen. wenn möglich sogar ohne CodeCave??
call function of injected dll
09/22/2010 - General Coding - 3 Replies
Hey guys, i injected a dll which i want to use for custom packet sending to my game client. the problem now is how to use it. the code of the dll is the following: #include <Winsock2.h> #include <Windows.h> #include <fstream> #include <detours.h>
Assembly code Problem
08/19/2009 - Dekaron - 3 Replies
Hi i have the assembly code for a hack and i want to find the proper adress for the hack but when im searching in CE the assembly scan returns nothing. Btw for the others hacks assembly scan returns something. Why this could be happening? thanks Edit:thats the code im trying to get, movzx eax,word ptr opps sorry didnt saw that questions not allowed.
Assembly code Problem
08/16/2009 - Dekaron - 0 Replies
Hi i have the assembly code for a hack and i want to find the proper adress for the hack but when im searching in CE the assembly scan returns nothing. Btw for the others hacks assembly scan returns something. Thats the code i wanna get movzx eax,word ptr Why this could be happening? thanks



All times are GMT +1. The time now is 01:43.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.