Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2
You last visited: Today at 13:28

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

Advertisement



[Help]How to call this function from c++ dll

Discussion on [Help]How to call this function from c++ dll within the Metin2 forum part of the Popular Games category.

Reply
 
Old   #1
 
mhcruz's Avatar
 
elite*gold: 0
Join Date: Mar 2011
Posts: 87
Received Thanks: 106
Red face [Help]How to call this function from c++ dll

Hi, I need some help, i see some tutorials but i cant understand how do this:

I want call SendAttackPacket From c++ dll

i Read process from GF metin2 (GF.es Server) i obtain this, now what i need do


In the picture i have reference string to get where are the function and
i can see in the memory viewer where start function etc...

What i need do now ?

Pls if you add me to skype i will thankful
My skype: the.cruz97


Yeah, my english is... like **** but i can speak and understand....
mhcruz is offline  
Old 07/30/2016, 01:46   #2
 
elite*gold: 0
Join Date: Dec 2014
Posts: 442
Received Thanks: 211
either send the packet, the length seems to be 8 and the actual buffer (packet data) is in eax.
0x4b5242 also seems to be a call to sub-function (maybe an api call?) which you can use in combination with a function pointer in c++.
i'd go with the first method and rather send the packet since you won't need to update each address when the client binary is recompiled...
of course you can always use inline assembler and call the function with it's appropriate parameters.

general approach: set a breakpoint at the beginning of the function and follow the address in the stack. then see what the function actually does, e.g. find out which parameters need to be passed or what datatype it returns.
and finally "re-create" the function in your code.
_asm is offline  
Old 07/30/2016, 02:34   #3
 
mhcruz's Avatar
 
elite*gold: 0
Join Date: Mar 2011
Posts: 87
Received Thanks: 106
Quote:
Originally Posted by _asm View Post
either send the packet, the length seems to be 8 and the actual buffer (packet data) is in eax.
0x4b5242 also seems to be a call to sub-function (maybe an api call?) which you can use in combination with a function pointer in c++.
i'd go with the first method and rather send the packet since you won't need to update each address when the client binary is recompiled...
of course you can always use inline assembler and call the function with it's appropriate parameters.

general approach: set a breakpoint at the beginning of the function and follow the address in the stack. then see what the function actually does, e.g. find out which parameters need to be passed or what datatype it returns.
and finally "re-create" the function in your code.
I will try the break point to see parameters etc, but when i have this how to i can put this code in c++?, i read that i need re-create function in asm code, but i dont know how, and what is classmanager

PD, any can say to gameforge that GameGuard is like a shit ? xD, more easy bypass is impossible


PD2............. Stupid GameGuard, I cant make a breakpoint, gameguard send initial error 500, i try jump this error or simple return but game close intantly....
---------------------------------------------------------------------------------------
Hi again, I bypass this stupid gameguard breakpoint detect

I breakpoint the jne before of the Send Battle Attack Error message

i got this but i dont know what i do now :/




BP in start of function:






if any can help me....
mhcruz is offline  
Thanks
1 User
Old 08/05/2016, 20:47   #4

 
EasyFarm's Avatar
 
elite*gold: 281
Join Date: May 2011
Posts: 1,552
Received Thanks: 946
Remember the address on the left and go to the start of the binary. Then look where the address gets called
EasyFarm is offline  
Thanks
1 User
Old 08/07/2016, 03:07   #5
 
mhcruz's Avatar
 
elite*gold: 0
Join Date: Mar 2011
Posts: 87
Received Thanks: 106
i need any to explaim me how i can do this... i try 34513 things and all dont do nothing or crash game i dont know what are happening, i try simple call pickcloseitem (supposedly more easy) but i cant pick one item ;/

If any can add me to skype: the.cruz97
thx...!

-------------------------------------------------
Hi again, Im trying call SendItemDropPacket (Only need one argument item position)

i make this:
DWORD SendItemDropPacket = 0x0058C140;
__asm{
PUSH 0x00000001 //Position of item
CALL SendItemDropPacket
}

0x0058C140 is possition of function
I push 1 because is position of item
and i think that im calling it correctly but dont happens anything

i really dont know what i doing wrong, and dll get correct injected because i put MessageBox in dll to say me when finish

then i dont know what happens... if any can help me....
mhcruz is offline  
Old 08/12/2016, 05:34   #6
 
mhcruz's Avatar
 
elite*gold: 0
Join Date: Mar 2011
Posts: 87
Received Thanks: 106
----------------------------------------------------------------------
I follow another tutorial and i make this:
Code:
#include <windows.h>

int(*WriteToSyserr)(const char*) = (int(*)(const char*))0x0064A290;
int(*SendBattleAttackPacket)(UINT,DWORD) = (int(*)(UINT, DWORD))0x0057E490;
void (*PickCloseItem)() = (void(*)())0x004C35A0;

int Main() {
	while (true)
	{
		Sleep(250);
		//PickCloseItem();//<-- Fails Why?
		//SendBattleAttackPacket(0, 222535);//<-- Fails Why? (0 is type of attack, 222535 is VID of mob)
		WriteToSyserr("syserror test");//<-- Works
	}
	return 0;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		CreateThread(0, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(Main), hModule, 0, NULL);
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
I can make sys error witout problems but sendbattleattackpacket and pickcloseitem fails, and idont know why, address are correctly

Thanks to Mercel i resolve my problem

The problem is that i dont push net module pointer in ecx

Now works perfectly

Code:
		DWORD SendBattleAttackPacket = 0x0057E490;
		int VID = 335752;
		__asm {
			mov ecx, DWORD PTR DS : [0x01A8D57C]
			push VID
			push 0
			call SendBattleAttackPacket
		}
Bye!!
mhcruz is offline  
Old 08/02/2021, 23:12   #7
 
elite*gold: 0
Join Date: Apr 2017
Posts: 5
Received Thanks: 0
Hi @, can you share your tutorial with me? I can't find a tutorial about this thread. Thank you in advance.
warrior1111 is offline  
Reply

Tags
call function, gf, metin2, reversing, sendattackpacket


Similar Threads Similar Threads
Call to undefined function mssql_connect()
09/21/2013 - Dekaron - 1 Replies
It's very common and i have no clue how to fix it.
[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>
Call Function in Process from another
09/04/2009 - General Coding - 7 Replies
Hi, how the topic says i'm wondering if it's possible to call an function from your application(no dll loaded from a loader) via jmp or call? example: i have app1 that has a function which opens a messagebox "Hello!". Now i'm tryin to call that function from another application while the app1 is running. thanks for your advice



All times are GMT +1. The time now is 13:30.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.