Anticheat Patch 0.3z

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Has anyone got the address to patch for 0.3z Anticheat? I am currently using "samp.dll + 0x61430" and patching with 0xC3 but my game still occasionally freezes when i call functions from samp.dll from my injected dll.
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
177
Just take it from the s0b sources, theres a snippet from the samp.cpp.

Code:
				// anticheat patch
				struct patch_set fuckAC =
				{
					"Anticheat patch", 0, 0,
					{
						{ 1, (void *)( g_dwSAMP_Addr + 0x61430 ), NULL, (uint8_t *)"\xC3", 0 }, 
						{ 1, (void *)( g_dwSAMP_Addr + 0x5B68B ), NULL, (uint8_t *)"\xEB", 0 },
						{ 1, (void *)( g_dwSAMP_Addr + 0x71410 ), NULL, (uint8_t *)"\xEB", 0 }
					}
				};
				patcher_install( &fuckAC );

				DWORD ACPatchOffsets[] =
				{
					0x5B681, 0x219F66
				};
				DWORD ACPatchOffsets2[] = 
				{
					0x225798
				};
				static DWORD ACC[2] = { 0, 0 };
				DWORD *pACC[] = { &ACC[0], &ACC[2] };
				for ( int i = 0; i < _countof( ACPatchOffsets ); i++ )
					memcpy_safe( ( void * )( g_dwSAMP_Addr + ACPatchOffsets[i] ), &pACC[0], 4 );
				for ( int i = 0; i < _countof( ACPatchOffsets2 ); i++ )
					memcpy_safe( (void *)( g_dwSAMP_Addr + ACPatchOffsets2[i] ), &pACC[1], 4 );
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Thanks 0x688!, I have used all of the above patches but my game continues to occasionally freeze when I call functions from samp.dll from my injected dll.
Should doing the above patches stop my game from freezing or do i have to do more than just patch the AC?
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
177
mrT101 link said:
Thanks 0x688!, I have used all of the above patches but my game continues to occasionally freeze when I call functions from samp.dll from my injected dll.
Should doing the above patches stop my game from freezing or do i have to do more than just patch the AC?
The Patches above should do the trick, are you sure that the patches get applied?
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
That's weird...

when i made the Anti-keylogger/stealer dll, the game doesn't freeze when i call addtexttochatwindow function... and i haven't added any memory patches on samp.dll...
you must be doing something wrong.
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
i am calling the function from samp.dll to show a dialog if i press a key. about 70% of the time it will work fine but the other 30% it will cause my game to just freeze and I have haveto signout of windows as task manager does not work.

I also use AddTexttoChatWindow and it never causes me to freeze, just the showdialog function
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
[member=2]0x688[/member] I use memcmp() after i apply the patches to check if they applied. My debug output shows that all 6 patches get applied when my dll attaches. I also reapply the patch immediately before calling the ShowPlayerDialog() function. My game still freezes occasionally when i call the ShowPlayerDialog function.
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
mrT101 link said:
[member=2]0x688[/member] I use memcmp() after i apply the patches to check if they applied. My debug output shows that all 6 patches get applied when my dll attaches. I also reapply the patch immediately before calling the ShowPlayerDialog() function. My game still freezes occasionally when i call the ShowPlayerDialog function.
What do you mean by "freezing", does the game crash, or your player just cannot move anymore?. have you checked the function that you're calling is it right or wrong? post more details we might be able to help you...
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
I mean that the game stops working without crashing. Its as if the game is replaced by a screenshot of the game when i call the function. Not just the player freezes, the whole screen does and I don't get the stack/address information like you would in a normal crash. The only way i can find to exit the game after it "freezes" is to sign out of windows account as task manager does come on but alt-tabbing to other windows doesn't work.

I think the function i am using is correct as it works correctly about 70% of the time.

Code:
void __cdecl showSampDialog (int send, int dialogID, int typedialog, char * caption, char * text, char * button1, char * button2)
{ 
patchAC(); //Apply the 6 patches as above

uint32_t func = pSAMP + SAMP_DIALOG_SHOW; 
uint32_t data = pSAMP + SAMP_DIALOG_INFO_OFFSET; 

__asm pushad

__asm mov eax, dword ptr [data]
__asm mov ecx, dword ptr [eax] //mov to offset
__asm push send //0 - No send response, 1 - Send response
__asm push button2
__asm push button1
__asm push text
__asm push caption
__asm push typedialog
__asm push dialogID
__asm call func

__asm popad

return;
}
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
mrT101 link said:
I mean that the game stops working without crashing. Its as if the game is replaced by a screenshot of the game when i call the function. Not just the player freezes, the whole screen does and I don't get the stack/address information like you would in a normal crash. The only way i can find to exit the game after it "freezes" is to sign out of windows account as task manager does come on but alt-tabbing to other windows doesn't work.

I think the function i am using is correct as it works correctly about 70% of the time.

Code:
void __cdecl showSampDialog (int send, int dialogID, int typedialog, char * caption, char * text, char * button1, char * button2)
{ 
patchAC(); //Apply the 6 patches as above

uint32_t func = pSAMP + SAMP_DIALOG_SHOW; 
uint32_t data = pSAMP + SAMP_DIALOG_INFO_OFFSET; 

__asm pushad

__asm mov eax, dword ptr [data]
__asm mov ecx, dword ptr [eax] //mov to offset
__asm push send //0 - No send response, 1 - Send response
__asm push button2
__asm push button1
__asm push text
__asm push caption
__asm push typedialog
__asm push dialogID
__asm call func

__asm popad

return;
}

I see, the function looks quiet good, no errors, only some inconvenience happening right there., and by that i mean the __cdecl convention,and the pushad and popad instructions, also the fact that you're calling patchAC(); there is not soo convenient.

this is how i would use it:
Code:
void showSampDialog (int send, int dialogID, int typedialog, char * caption, char * text, char * button1, char * button2)
{ 
uint32_t func = pSAMP + SAMP_DIALOG_SHOW; 
uint32_t data = pSAMP + SAMP_DIALOG_INFO_OFFSET; 

__asm mov eax, dword ptr [data]
__asm mov ecx, dword ptr [eax] //mov to offset
__asm push send //0 - No send response, 1 - Send response
__asm push button2
__asm push button1
__asm push text
__asm push caption
__asm push typedialog
__asm push dialogID
__asm call func
}

PS: you can put patchAC(); at the dllMain or at the start of the thread, or at where you initialize pSAMP..., because normaly it needs to be called only 1 TIME really.
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Thx T3K!, I'll try with the new function and see if i freeze anymore.

I have patchAC() at the start of my first created thread but  tried putting it in the showSampDialog function aswell after i kept crashing.
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
mrT101 link said:
Thx T3K!, I'll try with the new function and see if i freeze anymore.

I have patchAC() at the start of my first created thread but  tried putting it in the showSampDialog function aswell after i kept crashing.
It really doesn't matter if you patch the anti cheat or not, because, SAMP is really stupid, i mean just look at how it is easy to bypass that simple air-brake anti-cheat, so this clearly proves that it's not going to go everywhere and intercept calls to samp.dll or something

if i am right and that function is correct, then it should work, regardless of whether you patch the AC or not.
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Ok, I am using the function above and patching AC but still have the freezing problem. Does anyone have an alternate Dialog function that they would be willing to share?
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
177
well, i don't see the problem it can't be on the function since the samp module is calling it anyway...
With the patches s0beit uses (that one you got it should work fine)...
I did a test module that does the exact same things, patches it using the offsets i gave ya and calling the dialog function every 100ms and that 100000ms long (1000 calls) nothing went wrong.
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Thanks for the help 0x688. It seems to me that if the game doesn't freeze the first time i show a dialog then it will not freeze and all dialogs will show correctly for the rest of my session. If the game is going to freeze it usually occurs the first time i try to call a dialog after running samp.
I cant work out how any of the rest of my code could be causing the problem since I just use 
Code:
if(GetASyncKeyState ......) { ShowSampDialog() }

PS. Can I check we are using the same offsets as SAMP_DIALOG_SHOW and SAMP_DIALOG_INFO_OFFSET ( 0x816F0 , 0x212A40  )
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
177
well, if the offsets were not correct nothing would happen or it'll cause a crash.

well, i'm not applying the patch inside the instructions or anything like that...
I just wait until the samp.dll module is loaded and patch these addresses (1x) time.
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
[member=2]0x688[/member]

I'm still trying to fix this bug with my program. Do you think it could be because I am typecasting a std::string to a (char *)?

my code is similar to:

Code:
std::string List = "12345678";
showSampDialog(0, 0 ,2,"LIST",(char *)List.c_str(),"OK","CLOSE");
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
mrT101 link said:
[member=2]0x688[/member]

I'm still trying to fix this bug with my program. Do you think it could be because I am typecasting a std::string to a (char *)?

my code is similar to:

Code:
std::string List = "12345678";
showSampDialog(0, 0 ,2,"LIST",(char *)List.c_str(),"OK","CLOSE");
Why would you use string in the first place??
and it is a really horrible thing to do lol that's not how you convert a const char* to char*
just:

Code:
char * List = "123456789";
showSampDialog(0, 0 ,2,"LIST",List,"OK","CLOSE");
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
T3K link said:
Why would you use string in the first place??
and it is a really horrible thing to do lol that's not how you convert a const char* to char*
just:

Code:
char * List = "123456789";
showSampDialog(0, 0 ,2,"LIST",List,"OK","CLOSE");

could that possibly be the cause of my random samp freezes, possibly due to memory corruption / leak?

The reason I'm using string is because I am creating a new string on runtime that contains the player's name and other dynamic variables and a std::string allows me to use append() etc..
I'm then showing the string in the dialog and since the dialog function requires "char * text" i was typecasting my std::string to a char
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
mrT101 link said:
could that possibly be the cause of my random samp freezes, possibly due to memory corruption / leak?

The reason I'm using string is because I am creating a new string on runtime that contains the player's name and other dynamic variables and a std::string allows me to use append() etc..
I'm then showing the string in the dialog and since the dialog function requires "char * text" i was typecasting my std::string to a char

Ok then you maybe can do it this way, BUT i'm not 100% sure...

Code:
void showSampDialog (int send, int dialogID, int typedialog, char * caption, const char * text, char * button1, char * button2)
{ 
uint32_t func = pSAMP + SAMP_DIALOG_SHOW; 
uint32_t data = pSAMP + SAMP_DIALOG_INFO_OFFSET; 

__asm mov eax, dword ptr [data]
__asm mov ecx, dword ptr [eax] //mov to offset
__asm push send //0 - No send response, 1 - Send response
__asm push button2
__asm push button1
__asm push text
__asm push caption
__asm push typedialog
__asm push dialogID
__asm call func
} 


///
std::string List = "12345678";
showSampDialog(0, 0 ,2,"LIST",List.c_str(),"OK","CLOSE");

since c_str() is return a const char* and the parameter needs to be a const char* you won't have problems with the function, unless if the function overwrites the str (list.c_str()) in that case it won't work... but i think it will since it doesn't have any reason to edit it... just try it
 
Top