Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/

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.    
Reply
 
Thread Tools

inline assembler syntax error (dx9-endscene-midfunction-hook XP)
Old 09-10-2010, 08:16 AM   #1
n00bie

Jetseter's Avatar

Join Date: Sep 2010
Posts: 1
Reputation: 10
Rep Power: 18
Jetseter has made posts that are generally average in quality
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

Reply With Quote


Old 09-10-2010, 08:50 AM   #2
◄ Super Moderator ►

Hanoi22's Avatar

Join Date: Dec 2009
Posts: 3,203
Reputation: 82046
Rep Power: 911
Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!Hanoi22 has a huge epeen!
Fire At Will Champion Hot Pepper vs The Water Champion Krabbyball Champion If Pigs Can Fly Champion Muay Thai Champion Tadpole Champion Jumping Nutty Champion Blood Shed Champion Badger Racing Champion
Points: 56,012, Level: 35
Points: 56,012, Level: 35 Points: 56,012, Level: 35 Points: 56,012, Level: 35
Activity: 100.0%
Activity: 100.0% Activity: 100.0% Activity: 100.0%
Last Achievements
Award-Showcase
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

Reply With Quote

Old 09-10-2010, 09:00 AM   #3
*_*

HOOAH07's Avatar

Join Date: Apr 2008
Location: H.M.P
Posts: 5,440
Reputation: 92853
Rep Power: 1083
HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!HOOAH07 has a huge epeen!
Recognitions:
The UC Member of the Month award is a prestigious award given to a single community member on a monthly basis. Based on a vote by UnKnoWnCheaTs staff, the award is given to the forum member that has shown exemplary achievement and potential in the UnKnoWnCheaTs community, and has shown great commitment to upholding the principles upon which UnKnoWnCheaTs stands for. A member who has been awarded the Member of the Month award has been distinguished as an asset to the UnKnoWnCheaTs community. Member of the Month
Points: 68,727, Level: 38
Points: 68,727, Level: 38 Points: 68,727, Level: 38 Points: 68,727, Level: 38
Activity: 65.9%
Activity: 65.9% Activity: 65.9% Activity: 65.9%
Last Achievements
Award-Showcase
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

Reply With Quote

Old 09-10-2010, 09:05 AM   #4
SEGnosis
Guest

Posts: n/a
U gotta change the offsets to hex with the 0x notation.

Reply With Quote

Old 09-10-2010, 09:32 AM   #5
Supreme G0d

Anddos's Avatar

Join Date: Dec 2009
Posts: 361
Reputation: 2804
Rep Power: 61
Anddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating communityAnddos is a legend in the cheating community
Points: 3,550, Level: 5
Points: 3,550, Level: 5 Points: 3,550, Level: 5 Points: 3,550, Level: 5
Activity: 28.7%
Activity: 28.7% Activity: 28.7% Activity: 28.7%
Last Achievements
what type of hook is it?
Anddos is online now

Reply With Quote

Old 09-10-2010, 10:06 AM   #6
n00bie

sraeG's Avatar

Join Date: Mar 2009
Location: UK
Posts: 21
Reputation: 599
Rep Power: 41
sraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wall
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

Reply With Quote

Old 09-10-2010, 10:19 AM   #7
SEGnosis
Guest

Posts: n/a
Quote:
Originally Posted by Anddos View Post
what type of hook is it?
Midfunction endscene
Says so right on the function name.

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
assembler, error, inline, syntax
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 09:52 PM.