google-site-verification: googlebaca44933768a824.html Help with code please. - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

Help with code please.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with code please.

    Hi.. im write extern bhop.. but code crashed when he Started Read memory from hl2.exe
    Code:
    #include <windows.h>
    #include <iostream>
    #include <Tlhelp32.h>
    
    using namespace std;
    HMODULE Clientdll = NULL;
    /*HWND hwnd;
    HANDLE phandle;
    DWORD pid;*/
    
    DWORD GetProcessIDFromName(LPSTR szProcName)				//this function gets the id of a process using a name (hl2.exe for instance)
    {
    	PROCESSENTRY32 procEntry;
    	HANDLE hSnapshot;
    	BOOL bFound;
    
    	if(!(hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0))) return 0;	
    	procEntry.dwSize = sizeof(PROCESSENTRY32);
    
    	bFound = Process32First(hSnapshot, &procEntry);
    	while(bFound) 
    	{
    		if(!lstrcmp(procEntry.szExeFile, szProcName)) 
    		{
    			CloseHandle(hSnapshot);
    			return procEntry.th32ProcessID;
    		}
    		bFound = Process32Next(hSnapshot, &procEntry);
    	}
    	CloseHandle(hSnapshot);
    	return 0;
    }
    
    HMODULE GetModuleHandleExtern( char *szModuleName, DWORD dwProcessId )			//GetMoguleHandle recode for external processes
    {
       if( !szModuleName || !dwProcessId ) { return NULL; }					//invalid input
       HANDLE hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwProcessId );
       if( hSnap == INVALID_HANDLE_VALUE ) { return NULL; }
       MODULEENTRY32 me;
       me.dwSize = sizeof( MODULEENTRY32 );
       if( Module32First( hSnap, &me ) )							//we go now
       {
          while( Module32Next( hSnap, &me ) )						//through all modules in the target process
          {
             if( !strcmp( me.szModule, szModuleName ) )					//is this the model we are looking for?
             {
                CloseHandle( hSnap );
                return me.hModule;								//this is our module, return it.
             }
          }
       }
       CloseHandle( hSnap );
       return NULL;										//counldn't find module
    }
    
    int main ()
    {
    	cout << "waiting for counter strike source...\n";
    	while( FindWindowA( "Valve001", NULL ) == NULL )				//before getting the module handle i wait for css
    	{
    		Sleep( 100 );
    	}
    
    	/*
    	while (!hwnd)									//this is a test trying to fix the actual issue
    	{
    		hwnd = FindWindowA( "Valve001", NULL );
    	}
    	GetWindowThreadProcessId(hwnd, &pid);
        phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
    	*/
    
    	cout << "found the game!\n";
    	cout << "the id of process is: " << GetProcessIDFromName("hl2.exe") << "\n";		//showing the id to debug better
    	cout << "getting the module handle of client.dll\n";
    	do
    	{    
    		Clientdll = GetModuleHandleExtern("client.dll", GetProcessIDFromName("hl2.exe"));	//at this point we get the module handle from an ext process
    		Sleep(20);						//thanks a lot to mencore
    	}
    	while(Clientdll == NULL);					//just looping it until we get it even if this shouldn't be needed
    	
    	cout << "got the module handle!!!";	
    	cout << "the base is: " << Clientdll << "\n";							//showing it to debug it
    
    	while (!GetAsyncKeyState(VK_F10))								//loops the bhop code untill f10 is pressed
    	{
    		if( (*(int*)((DWORD)Clientdll + 0x76192C) == 0) && (GetAsyncKeyState(VK_MENU)<0) )	//checks for OnGround->yes and ALT->pressed
    		{
    			keybd_event(VK_SPACE, 0x39, 0, 0);						
    			Sleep(60);
    			keybd_event(VK_SPACE, 0x39, KEYEVENTF_KEYUP, 0);
    		}
    		Sleep(1);									
    	}
    	return 0;
    }
    What not good in this code? please help guys..:)

    #2
    Re: Help with code please.

    I am not really convinced of helping peeps that c+p and even fail at simple things such as offsets or random easy-to-fix-anti-c+p.

    Why I think it is not your code?
    Well the comments inside "your" code, are written in proper english and your description is not even close to that. (no offend though)



    I would highly recommend you, to not start the trip in teh world of codenz with copypasta. You should start with basics and somewhen in 4-6 months you could take a look at reversing and stuff.

    Comment


      #3
      Re: Help with code please.

      LoL this code is uploaded on pastebin I really don't know why are you trying to compile it as is :P
      I think that it could be done even with shorter code, there is some useless stuff inside.
      This was something I tried to do but without success.

      Please don't laugh, I had some little skillz in lua, I could update offsets myself and make a simple bhop script that uses
      values from addresses of air, ground and so on. I know, it's sad but I hope I can learn something new if you could help me :)
      Code:
      #include "stdafx.h"
      #include <Windows.h>
      #include <iostream>
      #include <TlHelp32.h>
      #include <string>
      #define RPM "ReadProcessMemory"
      #define client "client.dll"
      #define hl2 "hl2.exe"
      const DWORD GroundOffset = 0x7325A4;
      #define WINGAME_NAME L"Counter-Strike Source"
      PROCESSENTRY32 pGame;
      
      #define FindW = FindWindowByName(NULL, WINGAME_NAME);
      	
      
      #define FindProcess = (!FindProcess(hl2, &pGame)) Sleep(10);
      	
      
      #define Check = (client + GroundOffset == 1);
      	
      
      void Main();
      	while (((FindW);FindProcess);Check)
                      {   Sleep(140);
                          keybd_event(VK_SPACE, 0x39, 0, 0);
                          Sleep(35);
                          keybd_event(VK_SPACE, 0x39, KEYEVENTF_KEYUP, 0);
      }
      In this code I'm trying to externally bhop while window is open and if I'm on the ground.
      I would appreciate some help :)
      Originally posted by God:
      Fuck this shit. I need a new planet...
      This is our moment.
      We have never been stronger.
      People are frightened yes, but
      If we show them the way
      They will rise behind us.

      Comment

      Working...
      X