Solved [SOLVED] hackProcess.h to get exe instead of dll ?

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

gayden

Newbie
Full Member
Jul 25, 2015
5
82
0
NOTE: The solution is in the post #4... Here's a link: https://guidedhacking.com/showthrea...e-instead-of-dll&p=35390&viewfull=1#post35390

Hello there,

I have a static pointer which points to the value which I need to change (tested it with CE and it's correct).

My problem is that I'm using hackProcess.h from fleep tutorial... the module (dword__client in this case) is the same as the process name which is the exe file of the game.
//Just explaining the current situation which is having the address as "blabla.exe"+0x1234 and the game file is also blabla.exe

The problem is that hSnapshot gets the value 0 each time it calls CreateToolhelp32Snapshot() and the result is an infinite loop

I tried to edit the function from another code and the result is this code which still has the same logical error:
//No syntax errors

C++:
DWORD GetModuleNamePointer(LPSTR LPSTRModuleName, DWORD __DwordProcessId)
{
		MODULEENTRY32 lpModuleEntry = {0};
		DWORD dwModuleNamePointer = 0;
		HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, __DwordProcessId);


		if(hSnapshot != INVALID_HANDLE_VALUE)
		{
		    lpModuleEntry.dwSize = sizeof(MODULEENTRY32);
		    if(Module32First(hSnapshot, &lpModuleEntry))
            {
                while(Module32Next(hSnapshot, &lpModuleEntry))
                {
                    if(_tcscmp(lpModuleEntry.szModule, LPSTRModuleName) == 0)
                    {
                        dwModuleNamePointer = (DWORD)lpModuleEntry.modBaseAddr;
                        break;
                    }
                }
            }
            CloseHandle(hSnapshot);
		}

		return dwModuleNamePointer;
}
I want to clarify something... My processor is 64-bits but the game exe is 32-bits.

What do you think I should do ?

Thanks in advance.
 
Last edited:

gayden

Newbie
Full Member
Jul 25, 2015
5
82
0
Update...

I solved the issue (I wasn't running my code as admin :D) but now I have a new problem which is that the following if statement is always false:
C++:
if(_tcscmp(lpModuleEntry.szModule, LPSTRModuleName) == 0)
I tried to cout hSnapshot and I keep getting values like these:

Untitled.png

Any thoughts ?
//Note: nothing changed in my code


//---------------------------------------------------------------------------------------------------------//
UPDATE2....

Again, I found the problem... This time lpModuleEntry.szModule is always a dll file it never goes to my exe file

Any thoughts ?




//--------------------------------------------------THE SOLUTION------------------------------------------------//
UPDATE3...

Well, I've finally found the solution...
Since the exe file is the same as the base which we need to get the correct address,
C++:
Module32First
will give
C++:
lpModuleEntry.szModule
the exe file which we need... but when we go to the loop
C++:
while(Module32Next(hSnapshot, &lpModuleEntry))
the
C++:
lpModuleEntry
will go to the next module and keep looping trying to find our exe and this will cause an infinite loop since we already passed the module we're interested in.

* Ok, tell me what should I do?

- I basically added an if statement to see if the module we're interested in is already the same as our lpModuleEntry.szModule and if it's true there will be no need for the loop and we'll immediately put that address in our variable... And if we're looking for a dll file or something else we'll use that loop to reach our destination.

Here's the edited code if anyone needed it in the future:

C++:
DWORD GetModuleNamePointer(LPSTR LPSTRModuleName, DWORD __DwordProcessId)
{
		MODULEENTRY32 lpModuleEntry = {0};
		DWORD dwModuleNamePointer = 0;
		HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, __DwordProcessId);

		if(hSnapshot != INVALID_HANDLE_VALUE)
		{
		    lpModuleEntry.dwSize = sizeof(MODULEENTRY32);
		    if(Module32First(hSnapshot, &lpModuleEntry))
            {
                if( _tcscmp(lpModuleEntry.szModule, LPSTRModuleName) == 0)
                {
                    dwModuleNamePointer = (DWORD)lpModuleEntry.modBaseAddr;
                }
                else
                {
                    while(Module32Next(hSnapshot, &lpModuleEntry))
                    {
                        if( _tcscmp(lpModuleEntry.szModule, LPSTRModuleName) == 0)
                        {
                            dwModuleNamePointer = (DWORD)lpModuleEntry.modBaseAddr;
                            break;
                        }
                    }
                }
            }
            CloseHandle(hSnapshot);
		}

		return dwModuleNamePointer;
}
 
Last edited:
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