- Sponsored Advertisement -
Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D hacking programming reversing
You are Unregistered, please register to gain Full access.
inline assembler syntax error (dx9-endscene-midfunction-hook XP)
09-10-2010, 08:16 AM
#1 n00bie Join Date: Sep 2010
Posts: 1
Reputation: 10 Rep Power: 18
inline assembler syntax error (dx9-endscene-midfunction-hook XP)
Code:
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
DWORD * VTable;
DWORD dwEndscene_hook, dwEndscene_ret;
BYTE EndSceneOpCodes[6];
__declspec(naked) void MyEndscene( )
{
__asm
{
//most registers have already been preserved
pushaf; //we are in the middle of a conditional jmp
mov dword ptr ss:[ebp-1C], edi;
mov dword ptr ss:[ebp-18], ebx; //replace patched code
mov m_pD3Ddev, esi; //Get the device (loaded previously)
}
__asm
{
popaf; //je is set
jmp dwEndscene_ret; //jump back to normal endscene
}
}
bool bCompare(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 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;
}
void *DetourCreate (BYTE *src, const BYTE *dst, const int len)
{
BYTE *jmp;
DWORD dwback;
DWORD jumpto, newjump;
VirtualProtect(src,len,PAGE_READWRITE,&dwback);
if(src[0] == 0xE9)
{
jmp = (BYTE*)malloc(10);
jumpto = (*(DWORD*)(src+1))+((DWORD)src)+5;
newjump = (jumpto-(DWORD)(jmp+5));
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = newjump;
jmp += 5;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src-jmp);
}
else
{
jmp = (BYTE*)malloc(5+len);
memcpy(jmp,src,len);
jmp += len;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src+len-jmp)-5;
}
src[0] = 0xE9;
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
for(int i = 5; i < len; i++)
src[i] = 0x90;
VirtualProtect(src,len,dwback,&dwback);
return (jmp-len);
}
void Dx9Hook( LPCSTR D3D9 )
{
DWORD hD3D = NULL;
while (!hD3D) hD3D = (DWORD)GetModuleHandle(D3D9);
DWORD PPPDevice = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
memcpy( &VTable, (void *)(PPPDevice + 2), 4);
dwEndscene_hook = VTable[42] + 0x36; //mid function
dwEndscene_ret = dwEndscene_hook + 0x6; //return address
}
DWORD WINAPI getddd(LPVOID)
{
Dx9Hook("d3d9.dll");
memcpy((void *)EndSceneOpCodes, (void *)"\x89\x7D\xE4\x89\x5D\xE8", 6);
while( 1 )
{
Sleep( 1000 );
if(memcmp((void *)EndSceneOpCodes, (void *)dwEndscene_hook, 6) == 0 )
DetourCreate((PBYTE)dwEndscene_hook, (PBYTE)MyEndscene, 6);
}
return NULL;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)getddd, NULL, NULL, NULL);
}
return TRUE;
}
hook\main.cpp(20) : error C2400: inline assembler syntax error in 'opcode'; found 'newline'
hook\main.cpp(20) : error C2041: illegal digit 'C' for base '10'
hook\main.cpp(29) : error C2400: inline assembler syntax error in 'opcode'; found 'newline'
Compile With VC++ 2008
Help me please
Last edited by Jetseter; 09-10-2010 at 09:11 AM .
Jetseter is offline
09-10-2010, 08:50 AM
#2 ◄ Super Moderator ►
Join Date: Dec 2009
Posts: 3,203
Reputation: 82046 Rep Power: 911
Maybe follow the line which is causing it?
__________________
Cal Hockley: Where are you going? To him? To be a whore to a gutter rat?
Rose : I'd rather be his whore than your wife.
-----------------------------------------------------
Georg Henrik von Wright: If one is satisfied with things, one doesn't complain about the downsides that exist, either.
Quote:
Winslow: Hanoi, your 'english' is not understandable
Quote:
AdilAA: not sure if i should release my incomplete BF P4F Hack with non-working toggles
Roverturbo: Hanoi22 is just a bitch, and it's hard to please bitches unless you let them get their own way.
Style by lowHertz.
Hanoi22 is offline
09-10-2010, 09:00 AM
#3 *_*
Join Date: Apr 2008
Location: H.M.P
Posts: 5,440
Reputation: 92853 Rep Power: 1083
Quote:
Maybe follow the line which is causing it?
top 2 errors is here
mov dword ptr ss:[ebp-1C], edi;
bottom is
jmp dwEndscene_ret;//jump back to normal endscene
__________________
┌∩ ┐(◕ _ ◕ ) ┌∩ ┐
°º¤ø„¸ ¨°º¤ø„¸¸„ø¤º°¨ ¸„ø¤º°¨ ¨°º¤ø„¸ MONKEY „ø¤º°¨ „ø¤º°¨ FOREVER `°º¤ø.. .
xTc charging me up like a battery, Like 1000 volts rushing through my body
HOOAH07 is online now
09-10-2010, 09:05 AM
#4 Guest
U gotta change the offsets to hex with the 0x notation.
09-10-2010, 09:32 AM
#5 Join Date: Dec 2009
Posts: 361
Reputation: 2804 Rep Power: 61
Last Achievements what type of hook is it?
Anddos is online now
09-10-2010, 10:06 AM
#6 n00bie Join Date: Mar 2009
Location: UK
Posts: 21
Reputation: 599 Rep Power: 41
Aye, both offsets are currently in decimal format, hence why it doesn't recognise the C.. Remember to change your other offsets as well, as currently the one below (18) is decimal also.
As for the other errors, download the VC++ Processor Pack.. should solve things
__________________
I was once called eVoByTe.. Then I grew up.
sraeG is offline
09-10-2010, 10:19 AM
#7 Guest
Quote:
Originally Posted by
Anddos what type of hook is it?
Midfunction endscene
Says so right on the function name.
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 09:52 PM .