Results 1 to 6 of 6
  1. #1
    AeroMan's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Hell
    Posts
    3,294
    Reputation
    189
    Thanks
    3,049
    My Mood
    Busy

    Post EndScene mid function

    Code:
    /*
    	* Information *
    	- Programmed by AeroMan & Znoen!
    
    	* Usage *
    	- Distribution and reusing allowed.
    	- Credits should be given at any point of time!
    	- Status: Unknown
    
    	https://mpgh.net
    */
    
    
    #define _SOURCE_
    #ifdef _SOURCE_
    
    
    #include <Windows.h>
    #include <d3dx9.h>
    #include <d3d9.h>
    
    #pragma comment(lib, "d3dx9.lib")
    #pragma comment(lib, "d3d9.lib")
    
    
    ID3DXFont *pfont;
    
    int pReset = 0;
    
    void MenuRender(LPDIRECT3DDEVICE9 pDevice, int FontSize, int Weight, TCHAR *pFontName)
    {
    
    	if (pReset == 0){					// If our cReset is NULL
    		D3DXCreateFont(pDevice,					// D3D9
    			FontSize,							// Font Height
    			0,									// Font Width
    			Weight,							    // Font Weight
    			1,									// Font MapLevel
    			0,									// Italic
    			DEFAULT_CHARSET,					// CharSet
    			OUT_DEFAULT_PRECIS,					// Precis
    			DEFAULT_QUALITY,					// Font Quality
    			0,									// Pitch And Family
    			(LPCWSTR)pFontName,					// Font Name (Arial,Verdana,Courier new,...)
    			&pfont);							// pFont
    		pReset = 1;
    	}					// Our cReset goes to 1
    }
    
    DWORD FindDevice(DWORD Len)
    {
    	DWORD dwObjBase = 0;
    	dwObjBase = (DWORD)LoadLibraryA("d3d9.dll");
    	while (dwObjBase++ < dwObjBase + Len)
    	{
    		if ((*(WORD*)(dwObjBase + 0x00)) == 0x06C7 && (*(WORD*)(dwObjBase + 0x06)) == 0x8689 && (*(WORD*)(dwObjBase + 0x0C)) == 0x8689)
    		{
    			dwObjBase += 2; break;
    		}
    	}
    	return (dwObjBase);
    }
    
    DWORD vTableID(int index)
    {
    	PDWORD VTable;
    	*(DWORD*)&VTable = *(DWORD*)FindDevice(0x128000);
    	return VTable[index];
    }
    
    void DrawString(char * string, int x, int y, int to, D3DCOLOR Color, ID3DXFont * pFont)
    {
    	RECT pRect;
    	SetRect(&pRect, x, y, x, y);
    
    	switch (to)
    	{
    	case 1:
    		pFont->DrawTextA(NULL, string, -1, &pRect, DT_NOCLIP | DT_CENTER, Color);
    		break;
    
    	case 0:
    		pFont->DrawTextA(NULL, string, -1, &pRect, DT_NOCLIP | DT_RIGHT, Color);
    		break;
    
    	case 2:
    		pFont->DrawTextA(NULL, string, -1, &pRect, DT_NOCLIP | DT_LEFT, Color);
    		break;
    	}
    }
    
    void PlaceJMP(BYTE * address, DWORD jumpTo, DWORD length)
    {
    	DWORD oldProtect, newProtect, relativeAddress;
    	VirtualProtect(address, length, PAGE_EXECUTE_READWRITE, &oldProtect);
    	relativeAddress = (DWORD)(jumpTo - (DWORD)address) - 5;
    	*address = 0xE9;
    	*((DWORD *)(address + 0x1)) = relativeAddress;
    	for (DWORD x = 0x5; x < length; x++)
    	{
    		*(address + x) = 0x90;
    	}
    	VirtualProtect(address, length, oldProtect, &newProtect);
    }
    
    
    DWORD dwReJmp = vTableID(42) + 5;
    __declspec(naked)HRESULT __stdcall dwEndScene()
    {
    	static LPDIRECT3DDEVICE9 pDev;
    
    	/* Original code -> 5 first hooking
    	695C279F     8BFF           MOV EDI,EDI
    	695C27A1   . 55             PUSH EBP
    	695C27A2   . 8BEC           MOV EBP,ESP
    
    	 * Modified code jmp to our EndScene
    	695C279F  -E9 9C06D9A5      JMP VIP_Base.dwEndScene
    	695C27A4   6A FF            PUSH -1
    	695C27A6   68 FCAD7369      PUSH d3d9.6973ADFC
    	695C27AB   64:A1 00000000   MOV EAX,DWORD PTR FS:[0]
    	695C27B1   50               PUSH EAX
    	695C27B2   83EC 14          SUB ESP,14
    	695C27B5   53               PUSH EBX
    	695C27B6   56               PUSH ESI
    	*/
    
    
    
    	__asm mov edi, edi
    	__asm push ebp
    	__asm mov ebp, esp
    	__asm mov eax, dword ptr ss : [ebp + 0x8]
    	__asm mov pDev, eax
    	__asm pushad
    
    	if (pDev)
    	{
    		MenuRender(pDev, 14, 600, (TCHAR*)"Arial");
    		DrawString("EndScene hooked!", 50, 50, 2, D3DCOLOR_ARGB(255, 255, 0, 0), pfont);
    	}
    
    	__asm popad
    	__asm jmp[dwReJmp]
    }
    
    DWORD ***********()
    {
    	HMODULE hDll;
    
    	do{
    		hDll = GetModuleHandleA("d3d9.dll");
    		Sleep(200);
    	} while (!hDll);
    
    	PlaceJMP((PBYTE)vTableID(42), (DWORD)dwEndScene, 5);
    
    	return 0;
    }
    
    BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID)
    {
    	if (dwReason == DLL_PROCESS_ATTACH)
    	{
    		CreateThread(NULL,
    			NULL,
    			(LPTHREAD_START_ROUTINE)***********,
    			NULL,
    			NULL,
    			NULL);
    	}
    	return TRUE;
    }
    
    #endif

  2. The Following 5 Users Say Thank You to AeroMan For This Useful Post:

    gagaka123 (03-03-2015),jericsond (02-08-2015),Mafia67 (07-30-2016),[MPGH]Mayion (02-12-2015),WhiteHat PH (02-14-2015)

  3. #2
    zerooww's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Location
    Somewhere in Philippines
    Posts
    25
    Reputation
    10
    Thanks
    1
    My Mood
    Blah
    what is this?

  4. #3
    Threadstarter
    Upcoming MPGHiean
    AeroMan's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Hell
    Posts
    3,294
    Reputation
    189
    Thanks
    3,049
    My Mood
    Busy
    Quote Originally Posted by zerooww View Post
    what is this?
    It's a small base.

  5. #4
    WhiteHat PH's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Some Where I Belong
    Posts
    1,350
    Reputation
    25
    Thanks
    3,100
    My Mood
    Aggressive
    Good Job! Thank's for sharing!






    When Im gone dont forget me cause I will come back someday.



    Youtube Channel


     


  6. #5
    Warrock.arevalo's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Posts
    25
    Reputation
    10
    Thanks
    302
    UPDAte po mga addies nyan sir>??

  7. #6
    Warrock.arevalo's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Posts
    25
    Reputation
    10
    Thanks
    302
    Quote Originally Posted by AeroMan View Post
    DWORD FindDevice(DWORD Len)
    {
    DWORD dwObjBase = 0;
    dwObjBase = (DWORD)LoadLibraryA("d3d9.dll");
    while (dwObjBase++ < dwObjBase + Len)
    {
    if ((*(WORD*)(dwObjBase + 0x00)) == 0x06C7 && (*(WORD*)(dwObjBase + 0x06)) == 0x8689 && (*(WORD*)(dwObjBase + 0x0C)) == 0x8689)
    {
    dwObjBase += 2; break;
    }
    }
    return (dwObjBase);
    }
    Tnx For Sharing I know how to use that but Small prob but Black screen XD

Similar Threads

  1. [C/C++ Tutorial] Mid Function Hook
    By MarkHC in forum Programming Tutorials
    Replies: 5
    Last Post: 08-09-2015, 03:06 PM
  2. [Release] Menu Selection v4 Mid Function
    By luizimloko in forum Combat Arms BR Hack Coding/Source Code
    Replies: 65
    Last Post: 08-23-2012, 01:44 PM
  3. [Discussion] Mid Function
    By DiogoMAT in forum Piercing Blow Hack Coding/Source Code
    Replies: 4
    Last Post: 05-30-2012, 01:28 PM
  4. [Source Code] DIP / Present / SetTransform Mid Functions
    By DirecTX_ in forum WarRock Hack Source Code
    Replies: 2
    Last Post: 11-23-2011, 02:07 PM
  5. [Help] Mid function hook
    By giniyat202 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 17
    Last Post: 08-07-2011, 04:33 AM