Hook samp.dll

S

Suppraza

Guest
How i can track samp.dll from anywhere ?
Code:
while (hWnd == 0)
	{
		hWnd = FindWindow(0, "GTA:SA:MP");
		Sleep(100);
	}
	cout << "50% Done!" << endl;

	while (g_dwSAMP_Addr == NULL)
	{
		g_dwSAMP_Addr = (DWORD)GetModuleHandleA("samp.dll");
		Sleep(100);
	}
This is on Console not dll
 
S

Suppraza

Guest
Ok... This is complicated code..
Someone has template or ready code like this?
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
make dll instead...
it's very hard to hook functions with external hack.
 
S

Suppraza

Guest
T3K link said:
make dll instead...
it's very hard to hook functions with external hack.

I like DLL/ASI Files too, but I like the way that heisenberg make is samp crasher without put any files in GTA folder..
Anyway I need template for DllMain has you have.
And what better to use: DLL or ASI ?
Thanks.
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
Suppraza link said:
I like DLL/ASI Files too, but I like the way that heisenberg make is samp crasher without put any files in GTA folder..
Anyway I need template for DllMain has you have.
And what better to use: DLL or ASI ?
Thanks.
He basically just put his dll in the exe extracted it in the tmp folder and injected it.
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
Suppraza link said:
I like DLL/ASI Files too, but I like the way that heisenberg make is samp crasher without put any files in GTA folder..
Anyway I need template for DllMain has you have.
And what better to use: DLL or ASI ?
Thanks.

yes like 688h said, you can just code ur hax in a dll, then hardcode your dll inside your exe app, and have some code to extract it and inject it.

ps: u can even inject it directly from memory by manual mapping
 

BBB

Active member
Joined
Apr 5, 2013
Messages
62
Reaction score
1
if you just want to call simple fuctions you can use code injection, it works fine
 
S

Suppraza

Guest
Ok, Thanks Guys!
But i have little problem:
error C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

Code:
void addToChatWindow(char *text, DWORD textColor)
{
	if (g_dwSAMP_Addr)
	{

		if (text == NULL || !text)
			return;

		DWORD	chatinfo = g_dwSAMP_Addr + 0x212A6C;
		DWORD	func = g_dwSAMP_Addr + 0x7A4F0;

		__asm mov eax, dword ptr[chatinfo]
		__asm mov ecx, dword ptr[eax]
		__asm push 0
		__asm push textColor
		__asm push 0
		__asm push text
		__asm push 8
		__asm call func
	}
}

void addMessageToChatWindow(DWORD Color, const char *text, ...)
{
	if (g_dwSAMP_Addr != NULL)
	{
		va_list ap;
		if (text == NULL)
			return;

		char	tmp[512];
		memset(tmp, 0, 512);

		va_start(ap, text);
		vsnprintf(tmp, sizeof(tmp) - 1, text, ap);
		va_end(ap);

		addToChatWindow(tmp, Color);
	}
}

Code:
vsnprintf(tmp, sizeof(tmp) - 1, text, ap);
 
S

Suppraza

Guest
Bump + Its possible to hook RakNet into New Project, and some explain.
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
pr1 : just use vsnprintf_s instead or disable deprecation (google that srsly...)

pr2 : for raknet, get bitstream libraries, and the header file for the virtual functions then hook that with samp's RakClient interface which is SAMP_INFO + 0x3C9

RakClientInterface *pRakClient = (RakClientInterface *)(*(DWORD*)(SAMP_MODULE + SAMP_INFO_OFFSET) + 0x3C9);
then u can do
pRakClient->RPC(...);
pRakClient->Connect();
.
.
.
etc

just take a look how raknet is implemented in s0beit's source and do the same in your new project.
 
Top