Solved Find Pattern

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

mr.moon

Newbie
Full Member
Nobleman
Aug 29, 2016
64
383
1
Hello i am trying to find a pattern on a address in list of addresses such as
if have pattern like that 55 ?? ?? ?? ?? 55 ?? ?? 55 and scan the results of the scan will be such as 5 addresses and i need when find a pattern get the address number 4 of the list



i am using this code to find pattern but always get the 1 st address

C++:
bool Memory::DataCompare(const unsigned char* pData, const unsigned char* pPattern, const char* pMask)
{
	for (; *pMask; ++pMask, ++pData, ++pPattern)
	{
		if (*pMask == 'x' && *pData != *pPattern)
			return false;
	}

	return *pMask == 0;
}

unsigned long Memory::FindPattern(void* pAddress, unsigned long ulSearchLength, const unsigned char* pPattern, const char* pMask)
{
	for (unsigned long i = 0; i < ulSearchLength; i++)
	{
		if (DataCompare(reinterpret_cast<BYTE*>(reinterpret_cast<unsigned long>(pAddress)+i), pPattern, pMask))
			return reinterpret_cast<unsigned long>(pAddress)+i;
	}

	return 0;
}
Thanks.
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,746
40,528
316
can't make a proper pattern which is unique how long it will be it always 5 addresses
If you say so...

and what do you mean with Repeat that 3 times and you're at the 4th? because i am using it like that
C++:
BYTE * First = (BYTE*)Memory::FindPattern(GetModuleHandle(0), Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
BYTE * Second = (BYTE*)Memory::FindPattern(First + 1, Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
BYTE * Third = (BYTE*)Memory::FindPattern(Second + 1, Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
void * Init = (void*)Memory::FindPattern(Third+ 1, Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
Memory::WriteMemory(Init, 0xC3);
 
Last edited:

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,746
40,528
316
After getting the first address start the scan from the first address. Repeat that 3 times and you're at the 4th. Or make a proper pattern which is unique.
 

mr.moon

Newbie
Full Member
Nobleman
Aug 29, 2016
64
383
1
After getting the first address start the scan from the first address. Repeat that 3 times and you're at the 4th. Or make a proper pattern which is unique.
can't make a proper pattern which is unique how long it will be it always 5 addresses

and what do you mean with Repeat that 3 times and you're at the 4th? because i am using it like that

C++:
void* Init = nullptr;
Init = (void*)Memory::FindPattern(GetModuleHandle(0), Memory::GetModuleSize(GetModuleHandle(0)), (unsigned char*)CONST_INIT_PATTERN, CONST_INIT_MASK);
	Memory::WriteMemory(Init, 0xC3);
 

mr.moon

Newbie
Full Member
Nobleman
Aug 29, 2016
64
383
1
If you say so...



C++:
BYTE * First = (BYTE*)Memory::FindPattern(GetModuleHandle(0), Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
BYTE * Second = (BYTE*)Memory::FindPattern(First + 1, Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
BYTE * Third = (BYTE*)Memory::FindPattern(Second + 1, Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
void * Init = (void*)Memory::FindPattern(Third+ 1, Memory::GetModuleSize(GetModuleHandle(0)), (BYTE*)pattern, mask);
Memory::WriteMemory(Init, 0xC3);
Thanks You
 
Status
Not open for further replies.
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods