Results 1 to 14 of 14

Threaded View

  1. #1
    dborba's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    18
    Reputation
    10
    Thanks
    3
    My Mood
    Fine

    [Help] Programmers help me!

    I'm starting to ride my first menu with Hacker'm already with the base but not his place to put the code of the hacker, I would like someone could tell me where to put the codes.

    Code:
    #include "Base.h"
    #include "Menu.h"
    #include "Detour.h"
    #include "ADE32.h"
    #include <time.h>
    #include <stdio.h>
    int frame;
    
    
    DWORD dwHSDevicePointer, dwDevicePointer;
    
    int menuX = 20, menuY = 100, offsetX, offsetY;
    bool isDragging = false;
    POINT cPos;
    
    DWORD hD3D, adr, *vtbl; 
    
    bool Compare(const BYTE* pData, const BYTE* bMask, const char* szMask){
    	for(;*szMask;++szMask,++pData,++bMask)
    		if(*szMask=='x' && *pData!=*bMask)   return 0;
    	return (*szMask) == NULL;
    }
    
    DWORD Pattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask){
    	for(DWORD i=0; i<dwLen; i++)
    		if (Compare((BYTE*)(dwAddress+i),bMask,szMask))  return (DWORD)(dwAddress+i);
    	return 0;
    }
    
    void __cdecl Push( const char* szCommand )
    {
    DWORD *LTClient = ( DWORD* )(0xLTADRESS);
    DWORD CNADDIE = 0x46F670;
    void* Send = ( void* )*( DWORD* )(CNADDIE);
    void* CONoff = ( void* )*( DWORD* )( *LTClient + 0x208 );
    __asm
    {
    push szCommand;
    call CONoff;
    add esp,4;
    
    }
    }
    
    /***************************************************************************************************/
    LPD3DXFONT pFont;
    LPDIRECT3DDEVICE9 g_pDevice = 0;
    
    int	  FPScounter = 0;
    float FPSfLastTickCount = 0.0f;
    float FPSfCurrentTickCount;
    
    
    void DrawString(LPD3DXFONT Font, long x, long y, D3DCOLOR fontColor, char *text, ...)
    {  
        RECT rct;    
        rct.left     = x - 1;    
        rct.right    = x + 1;    
        rct.top      = y - 1 ;    
        rct.bottom   = y + 1;  
    
        if(!text) { return; } 
        va_list va_alist; 
        char logbuf[256] = {0}; 
        va_start (va_alist, text); 
        _vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), text, va_alist); 
        va_end (va_alist); 
        RECT FontRect = { x, y, x, y }; 
        pFont->DrawTextA(NULL, logbuf, -1, &rct, DT_NOCLIP, fontColor);  
    }
    
    
    void FillRGB( int x, int y, int w, int h, D3DCOLOR yourcolor, IDirect3DDevice9* pDevice )
    {
    const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
    struct Vertex
    {
    float x,y,z,ht;
    DWORD yourcolor;
    }
    
    V[4] =
    {
    {(float)x,(float)(y+h), 0.0f, 0.0f, yourcolor},
    {(float)x,(float)y, 0.0f, 0.0f, yourcolor},
    {(float)(x+w),(float)(y+h), 0.0f, 0.0f, yourcolor},
    {(float)(x+w),(float)y, 0.0f, 0.0f, yourcolor}
    };
    pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
    pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
    pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
    pDevice->SetRenderState( D3DRS_FOGENABLE, false );
    
    pDevice->SetFVF(D3D_FVF);
    pDevice->SetTexture(0, NULL);
    pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
    }
    
    
    void DrawBorder( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
    {
    	FillRGB( x, (y + h - px), w, px,	BorderColor, pDevice );
    	FillRGB( x, y, px, h,				BorderColor, pDevice );
    	FillRGB( x, y, w, px,				BorderColor, pDevice );
    	FillRGB( (x + w - px), y, px, h,	BorderColor, pDevice );
    }
    
    void DrawBox( int x, int y, int w, int h, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
    {
    	FillRGB( x, y, w, h,		BoxColor, pDevice );
    	DrawBorder( x, y, w, h, 1,	BorderColor, pDevice );
    }
    
    void FPScheck(char *str, char *format)
    {
    	FPSfCurrentTickCount = clock() * 0.001f;
    	FPScounter++;
    
    	if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f) {
    	    FPSfLastTickCount = FPSfCurrentTickCount;
    		sprintf(str,format,FPScounter);
    	    FPScounter = 0;
    	} 
    }
    
    HRESULT GenerateTexture(IDirect3DDevice9 *Device_Interface, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
    	if( FAILED(Device_Interface->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)) )
    	return E_FAIL;
    
    	WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
    	|(WORD)(((colour32>>20)&0xF)<<8)
    	|(WORD)(((colour32>>12)&0xF)<<4)
    	|(WORD)(((colour32>>4)&0xF)<<0);
    
    	D3DLOCKED_RECT d3dlr;
    	(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    	WORD *pDst16 = (WORD*)d3dlr.pBits;
    
    	for(int xy=0; xy < 8*8; xy++)
    	*pDst16++ = colour16;
    
    	(*ppD3Dtex)->UnlockRect(0);
    
    	return S_OK;
    }
    /************************************************************************************/
    bool Memoria( void * pDest, char * szPatch, size_t sSize ){
    DWORD dwOrgProtect = NULL;
    if ( !VirtualProtect ( pDest, sSize, PAGE_EXECUTE_READWRITE, &dwOrgProtect ))
    return FALSE;
    
    
    memcpy( pDest, szPatch, sSize );
    VirtualProtect( pDest, sSize, dwOrgProtect, NULL );
    return TRUE;
    }
    
    bool IsGameReadyForHook(void)
    {
        if( GetModuleHandleA( "d3d9.dll"     ) != NULL 
         && GetModuleHandleA( "ClientFX.fxd" ) != NULL 
         && GetModuleHandleA( "CShell.dll"   ) != NULL )
            return true;
        return false;
    }
    
    char sFPS[20]       ="xxx Fps";
    
    int visuals		= 0;
    
    int	cham		= 0;
    int	xhair		= 0;
    int Menu		= 0;
    
    int reload      = 0;
    
    
    char *Folder[] = { "+"  , "-" };	
    char *OnOff[]  = { "ON", "OFF"};
    	
    void RebuildMenu(void)
    
    {
       MenuAddText("Framerate"	, sFPS);
    	MenuAddItem("Menu"	, Folder, &visuals, 2, MENUFOLDER);
    	 if (visuals) {
    	MenuAddItem("No-Reload"	, OnOff	, &Menu	, 2, MENUITEM);
    
     
    	}
    }
    
    void ReFont(LPDIRECT3DDEVICE9 pDevice)
    {
    	if (g_pDevice != pDevice)
    	{
    		g_pDevice = pDevice;
    		try
    		{
    			if (pFont != 0)
    				pFont->Release();
    		} catch (...) {}
    		pFont = 0;
    		D3DXCreateFontA(pDevice, 15, 0, FW_NORMAL, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &pFont );
    		
    	}
    
    }
    
    void RenderFrame(LPDIRECT3DDEVICE9 pDevice)
    {
    	ReFont(pDevice);
    	if(Visible == 1) {
    
    
    	DrawBox(menuX-10, menuY-8, 140, frame, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), pDevice);
    	DrawBox( 8, 8, 140, 20, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), pDevice);
    	DrawString( pFont, 10, 10, D3DCOLOR_ARGB(255, 255, 0, 0), "   Nice-Shotter 1.0");
    
    	}else{
    
    	DrawBox( 8, 8, 140, 20, D3DCOLOR_ARGB(150, 0, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), pDevice);
    	DrawString( pFont, 10, 10, D3DCOLOR_ARGB(255, 255, 0, 0), " Nice-Shotter 1.0");
    
    	}
    	
    FPScheck(sFPS,"%d");
    
    	if (Menu == 1){
    	if(GetAsyncKeyState(VK_LBUTTON) < 0) 
    	{
    
    		GetCursorPos(&cPos);
    		
    		if(cPos.x > menuX - 10 && cPos.x < menuX + 125 && cPos.y > menuY - 10 && cPos.y < menuY + 455){
    			
    			if(!isDragging){
    
    				offsetX = cPos.x - menuX;
    				offsetY = cPos.y - menuY;
    				isDragging = true;
    			}
    		}
    	} else {
    
    		isDragging = false;
    	}
    	}
    	if(isDragging){
    		
    		menuX = cPos.x - offsetX;
    		menuY = cPos.y - offsetY;
    	}
    
    
    	if (Max == 0) RebuildMenu();
    	MenuShow(menuX,menuY,pFont);
    	MenuNav();
    }
    
    
    void PTC(void)
    {
    	while(1)
    	{
    		Sleep(200);
    
    		}
    		Sleep(200);
    	}
    
    HRESULT myPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect,CONST RECT* pDestRect, HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
    {
    	_asm NOP;
    	RenderFrame(pDevice);
    	return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
    }
    
    HRESULT WINAPI myReset( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
    {
    	__asm NOP;
    	pFont->OnLostDevice();
    	HRESULT hRet = pReset(pDevice, pPresentationParameters);
    	pFont->OnResetDevice();
        return hRet;
    }
    
    DWORD WINAPI Hacks(LPVOID)
    {
    	while( !IsGameReadyForHook() )
    	Sleep(100);
    	PTC();
    	return 0;
    }
    
    bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
    	for(;*szMask;++szMask,++pData,++bMask)
    		if(*szMask=='x' && *pData!=*bMask ) 
    			return false;
    
    	return (*szMask) == NULL;
    }
    
    
    DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
    {
    	for(DWORD i=0; i < dwLen; i++)
    		if( bCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
    			return (DWORD)(dwAddress+i);
    	return 0;
    }
    
    DWORD WINAPI D3DInit(LPVOID)
    {
    	
    	hD3D = 0; 
    
        do {
    		hD3D = (DWORD)GetModuleHandleA("d3d9.dll"); 
            Sleep(10); 
        } while(!hD3D); 
        adr = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx"); 
       
    	if (adr) { 
            memcpy(&vtbl,(void *)(adr+2),4);
            pReset     =  (oReset)DetourCreate		(( BYTE* )vtbl[16],	( BYTE* )myReset,	DETOUR_TYPE_JMP );
    		pPresent   =  (oPresent)DetourCreate	(( BYTE* )vtbl[17],	( BYTE* )myPresent, DETOUR_TYPE_JMP );
    	}
    	return 0;
    }
    
    BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
    {
    	DisableThreadLibraryCalls(hDll);
    	if (dwReason == DLL_PROCESS_ATTACH)
    	{
    		CreateThread(NULL, NULL, Hacks, NULL, NULL, NULL);
    		CreateThread(NULL, NULL, D3DInit, NULL, NULL, NULL);
    	}
    	return TRUE;
    }
    I appreciate if someone help me.

  2. The Following User Says Thank You to dborba For This Useful Post:

    rodolfgonzales4 (11-21-2010)

Similar Threads

  1. [HELP] Does any C++ programmer know how to edit a dll?
    By EI2468 in forum C++/C Programming
    Replies: 20
    Last Post: 11-05-2010, 04:50 PM
  2. [SOLVED][HELP] Programm AutoIt
    By Zanxx in forum CrossFire Help
    Replies: 0
    Last Post: 10-29-2010, 11:39 AM
  3. Programmers to help me
    By 117898140 in forum C++/C Programming
    Replies: 4
    Last Post: 02-17-2010, 09:53 AM
  4. [Request] A little help from programmers...
    By Ozman999 in forum CrossFire Hacks & Cheats
    Replies: 1
    Last Post: 02-13-2010, 01:10 PM
  5. Can a programmer help me?
    By moho401 in forum Hack Requests
    Replies: 1
    Last Post: 08-12-2009, 01:22 PM