Results 1 to 8 of 8
  1. #1
    wicho_koz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    194
    Reputation
    12
    Thanks
    52
    My Mood
    Shocked

    what is the error

    im using the combined base v2 and it work 3 minutes.. after 3 minutes the game are closed...

    it is my detour code:

    Code:
    #pragma warning(disable: 4311)
    #pragma warning(disable: 4312)
    #pragma warning(disable: 4244)
    	
    #pragma pack(push)
    #pragma pack(1)
    
    #define DETOUR_MAX_SRCH_OPLEN 64
    
    #define JMP32_SZ 5
    #define BIT32_SZ 4
    
    // jmp32 sig
    #define SIG_SZ 3
    #define SIG_OP_0 0xCC
    #define SIG_OP_1 0x90
    #define SIG_OP_2 0xC3
    
    static DWORD dwOldProt;
    
    int GetDetourLen(int patchType);
    int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen);
    
    // Thin wrapper for APIs
    LPVOID DetourCreate(LPCSTR lpModuleName, LPCSTR lpProcName, LPVOID lpFuncDetour, int patchType, int detourLen)
    {
    	LPVOID lpFuncOrig = NULL;
    		
    	if((lpFuncOrig = GetProcAddress(GetModuleHandleA(lpModuleName), lpProcName)) == NULL)
    		return NULL;
    
    	return DetourCreate(lpFuncOrig, lpFuncDetour, patchType, detourLen);
    }
    
    LPVOID DetourCreate(LPVOID lpFuncOrig, LPVOID lpFuncDetour, int patchType, int detourLen)
    {
    	LPVOID lpMallocPtr = NULL;
    	DWORD dwProt = NULL;
    	PBYTE pbMallocPtr = NULL;
    	PBYTE pbFuncOrig = (PBYTE)lpFuncOrig;
    	PBYTE pbFuncDetour = (PBYTE)lpFuncDetour;
    	PBYTE pbPatchBuf = NULL;
    	int minDetLen = 0;
    	int detLen = 0;
    
    	// Get detour length
    	if((minDetLen = GetDetourLen(patchType)) == 0)
    		return NULL;
    
    	if(detourLen != DETOUR_LEN_AUTO)
    		detLen = detourLen;
    
    	else if((detLen = GetDetourLenAuto(pbFuncOrig, minDetLen)) < minDetLen)
    		return NULL;
    
    	// Alloc mem for the overwritten bytes
    	if((lpMallocPtr = (LPVOID)malloc(detLen+JMP32_SZ+SIG_SZ)) == NULL)
    		return NULL;
    
    	pbMallocPtr = (PBYTE)lpMallocPtr;
    
    	// Enable writing to original
    	VirtualProtect(lpFuncOrig, detLen, PAGE_READWRITE, &dwProt);
    
    
    	// Write overwritten bytes to the malloc***********************************************************************
    	memcpy(lpMallocPtr, lpFuncOrig, detLen);
    	pbMallocPtr += detLen;
    	pbMallocPtr[0] = 0xE9;
    	*(DWORD*)(pbMallocPtr+1) = (DWORD)((pbFuncOrig+detLen)-pbMallocPtr)-JMP32_SZ;
    	pbMallocPtr += JMP32_SZ;
    	pbMallocPtr[0] = SIG_OP_0;
    	pbMallocPtr[1] = SIG_OP_1;
    	pbMallocPtr[2] = SIG_OP_2;
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    	// Create a buffer to prepare the detour bytes
    	pbPatchBuf = new BYTE[detLen];
    	memset(pbPatchBuf, 0x90, detLen);
    
    	switch(patchType)
    	{
    		case DETOUR_TYPE_JMP:
    			pbPatchBuf[0] = 0xE9;
    			*(DWORD*)&pbPatchBuf[1] = (DWORD)(pbFuncDetour - pbFuncOrig) - 5;
    			break;
    
    		case DETOUR_TYPE_PUSH_RET:
    			pbPatchBuf[0] = 0x68;
    			*(DWORD*)&pbPatchBuf[1] = (DWORD)pbFuncDetour;
    			pbPatchBuf[5] = 0xC3;
    			break;
    
    		case DETOUR_TYPE_NOP_JMP:
    			pbPatchBuf[0] = 0x90;
    			pbPatchBuf[1] = 0xE9;
    			*(DWORD*)&pbPatchBuf[2] = (DWORD)(pbFuncDetour - pbFuncOrig) - 6;
    			break;
    
    		case DETOUR_TYPE_NOP_NOP_JMP:
    			pbPatchBuf[0] = 0x90;
    			pbPatchBuf[1] = 0x90;
    			pbPatchBuf[2] = 0xE9;
    			*(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
    			break;
    
    		case DETOUR_TYPE_STC_JC:
    			pbPatchBuf[0] = 0xF9;
    			pbPatchBuf[1] = 0x0F;
    			pbPatchBuf[2] = 0x82;
    			*(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
    			break;
    
    		case DETOUR_TYPE_CLC_JNC:
    			pbPatchBuf[0] = 0xF8;
    			pbPatchBuf[1] = 0x0F;
    			pbPatchBuf[2] = 0x83;
    			*(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
    			break;
    		
    		default:
    			return NULL;
    	}
    	
    	// Write the detour
    	for(int i=0; i<detLen; i++)
    		pbFuncOrig[i] = pbPatchBuf[i];
    
    	delete [] pbPatchBuf;
    
    	// Reset original mem flags
    	VirtualProtect(lpFuncOrig, detLen, dwProt, &dwOldProt);
    
    	return lpMallocPtr;
    }
    
    BOOL DetourRemove(LPVOID lpDetourCreatePtr)
    {
    	PBYTE pbMallocPtr = NULL;
    	DWORD dwFuncOrig = NULL;
    	DWORD dwProt = NULL;
    	int i=0;
    
    	if((pbMallocPtr = (PBYTE)lpDetourCreatePtr) == NULL)
    		return FALSE;
    
    	// Find the orig jmp32 opcode sig
    	for(i=0; i<=DETOUR_MAX_SRCH_OPLEN; i++)
    	{
    		if(pbMallocPtr[i] == SIG_OP_0 
    			&& pbMallocPtr[i+1] == SIG_OP_1
    			&& pbMallocPtr[i+2] == SIG_OP_2)
    			break;
    
    		if(i == DETOUR_MAX_SRCH_OPLEN)
    			return FALSE;
    	}
    
    	// Calculate the original address
    	pbMallocPtr += (i-JMP32_SZ+1); // Inc to jmp
    	dwFuncOrig = *(DWORD*)pbMallocPtr; // Get 32bit jmp
    	pbMallocPtr += BIT32_SZ; // Inc to end of jmp
    	dwFuncOrig += (DWORD)pbMallocPtr; // Add this addr to 32bit jmp
    	dwFuncOrig -= (i-JMP32_SZ); // Dec by detour len to get to start of orig
    
    	// Write the overwritten bytes back to the original
    	VirtualProtect((LPVOID)dwFuncOrig, (i-JMP32_SZ), PAGE_READWRITE, &dwProt);
    	memcpy((LPVOID)dwFuncOrig, lpDetourCreatePtr, (i-JMP32_SZ));
    	VirtualProtect((LPVOID)dwFuncOrig, (i-JMP32_SZ), dwProt, &dwOldProt);
    
    	// Memory cleanup
    	free(lpDetourCreatePtr);
    
    	return TRUE;
    }
    
    int GetDetourLen(int patchType)
    {
    	switch(patchType)
    	{
    		case DETOUR_TYPE_JMP:
    			return 5;
    
    		case DETOUR_TYPE_PUSH_RET:
    		case DETOUR_TYPE_NOP_JMP:
    			return 6;
    		
    		case DETOUR_TYPE_NOP_NOP_JMP:
    		case DETOUR_TYPE_STC_JC:
    		case DETOUR_TYPE_CLC_JNC:
    			return 7;
    		
    		default:
    			return 0;
    	}
    }
    
    int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen)
    {
    	int len = 0;
    	PBYTE pbCurOp = pbFuncOrig;
    
    	while(len < minDetLen)
    	{
    		int i = oplen(pbCurOp);
    		
    		if(i == 0 || i == -1)
    			return 0;
    
    		if(len > DETOUR_MAX_SRCH_OPLEN)
    			return 0;
    
    		len += i;
    		pbCurOp += i;
    	}
    
    	return len;
    }
    i do what to make my detour working??

  2. #2
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,690
    Reputation
    184
    Thanks
    1,147
    My Mood
    Aggressive
    Quote Originally Posted by wicho_koz View Post
    im using the combined base v2 and it work 3 minutes.. after 3 minutes the game are closed...

    it is my detour code:

    Code:
    #pragma warning(disable: 4311)
    #pragma warning(disable: 4312)
    #pragma warning(disable: 4244)
    	
    #pragma pack(push)
    #pragma pack(1)
    
    #define DETOUR_MAX_SRCH_OPLEN 64
    
    #define JMP32_SZ 5
    #define BIT32_SZ 4
    
    // jmp32 sig
    #define SIG_SZ 3
    #define SIG_OP_0 0xCC
    #define SIG_OP_1 0x90
    #define SIG_OP_2 0xC3
    
    static DWORD dwOldProt;
    
    int GetDetourLen(int patchType);
    int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen);
    
    // Thin wrapper for APIs
    LPVOID DetourCreate(LPCSTR lpModuleName, LPCSTR lpProcName, LPVOID lpFuncDetour, int patchType, int detourLen)
    {
    	LPVOID lpFuncOrig = NULL;
    		
    	if((lpFuncOrig = GetProcAddress(GetModuleHandleA(lpModuleName), lpProcName)) == NULL)
    		return NULL;
    
    	return DetourCreate(lpFuncOrig, lpFuncDetour, patchType, detourLen);
    }
    
    LPVOID DetourCreate(LPVOID lpFuncOrig, LPVOID lpFuncDetour, int patchType, int detourLen)
    {
    	LPVOID lpMallocPtr = NULL;
    	DWORD dwProt = NULL;
    	PBYTE pbMallocPtr = NULL;
    	PBYTE pbFuncOrig = (PBYTE)lpFuncOrig;
    	PBYTE pbFuncDetour = (PBYTE)lpFuncDetour;
    	PBYTE pbPatchBuf = NULL;
    	int minDetLen = 0;
    	int detLen = 0;
    
    	// Get detour length
    	if((minDetLen = GetDetourLen(patchType)) == 0)
    		return NULL;
    
    	if(detourLen != DETOUR_LEN_AUTO)
    		detLen = detourLen;
    
    	else if((detLen = GetDetourLenAuto(pbFuncOrig, minDetLen)) < minDetLen)
    		return NULL;
    
    	// Alloc mem for the overwritten bytes
    	if((lpMallocPtr = (LPVOID)malloc(detLen+JMP32_SZ+SIG_SZ)) == NULL)
    		return NULL;
    
    	pbMallocPtr = (PBYTE)lpMallocPtr;
    
    	// Enable writing to original
    	VirtualProtect(lpFuncOrig, detLen, PAGE_READWRITE, &dwProt);
    
    
    	// Write overwritten bytes to the malloc***********************************************************************
    	memcpy(lpMallocPtr, lpFuncOrig, detLen);
    	pbMallocPtr += detLen;
    	pbMallocPtr[0] = 0xE9;
    	*(DWORD*)(pbMallocPtr+1) = (DWORD)((pbFuncOrig+detLen)-pbMallocPtr)-JMP32_SZ;
    	pbMallocPtr += JMP32_SZ;
    	pbMallocPtr[0] = SIG_OP_0;
    	pbMallocPtr[1] = SIG_OP_1;
    	pbMallocPtr[2] = SIG_OP_2;
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    	// Create a buffer to prepare the detour bytes
    	pbPatchBuf = new BYTE[detLen];
    	memset(pbPatchBuf, 0x90, detLen);
    
    	switch(patchType)
    	{
    		case DETOUR_TYPE_JMP:
    			pbPatchBuf[0] = 0xE9;
    			*(DWORD*)&pbPatchBuf[1] = (DWORD)(pbFuncDetour - pbFuncOrig) - 5;
    			break;
    
    		case DETOUR_TYPE_PUSH_RET:
    			pbPatchBuf[0] = 0x68;
    			*(DWORD*)&pbPatchBuf[1] = (DWORD)pbFuncDetour;
    			pbPatchBuf[5] = 0xC3;
    			break;
    
    		case DETOUR_TYPE_NOP_JMP:
    			pbPatchBuf[0] = 0x90;
    			pbPatchBuf[1] = 0xE9;
    			*(DWORD*)&pbPatchBuf[2] = (DWORD)(pbFuncDetour - pbFuncOrig) - 6;
    			break;
    
    		case DETOUR_TYPE_NOP_NOP_JMP:
    			pbPatchBuf[0] = 0x90;
    			pbPatchBuf[1] = 0x90;
    			pbPatchBuf[2] = 0xE9;
    			*(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
    			break;
    
    		case DETOUR_TYPE_STC_JC:
    			pbPatchBuf[0] = 0xF9;
    			pbPatchBuf[1] = 0x0F;
    			pbPatchBuf[2] = 0x82;
    			*(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
    			break;
    
    		case DETOUR_TYPE_CLC_JNC:
    			pbPatchBuf[0] = 0xF8;
    			pbPatchBuf[1] = 0x0F;
    			pbPatchBuf[2] = 0x83;
    			*(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
    			break;
    		
    		default:
    			return NULL;
    	}
    	
    	// Write the detour
    	for(int i=0; i<detLen; i++)
    		pbFuncOrig[i] = pbPatchBuf[i];
    
    	delete [] pbPatchBuf;
    
    	// Reset original mem flags
    	VirtualProtect(lpFuncOrig, detLen, dwProt, &dwOldProt);
    
    	return lpMallocPtr;
    }
    
    BOOL DetourRemove(LPVOID lpDetourCreatePtr)
    {
    	PBYTE pbMallocPtr = NULL;
    	DWORD dwFuncOrig = NULL;
    	DWORD dwProt = NULL;
    	int i=0;
    
    	if((pbMallocPtr = (PBYTE)lpDetourCreatePtr) == NULL)
    		return FALSE;
    
    	// Find the orig jmp32 opcode sig
    	for(i=0; i<=DETOUR_MAX_SRCH_OPLEN; i++)
    	{
    		if(pbMallocPtr[i] == SIG_OP_0 
    			&& pbMallocPtr[i+1] == SIG_OP_1
    			&& pbMallocPtr[i+2] == SIG_OP_2)
    			break;
    
    		if(i == DETOUR_MAX_SRCH_OPLEN)
    			return FALSE;
    	}
    
    	// Calculate the original address
    	pbMallocPtr += (i-JMP32_SZ+1); // Inc to jmp
    	dwFuncOrig = *(DWORD*)pbMallocPtr; // Get 32bit jmp
    	pbMallocPtr += BIT32_SZ; // Inc to end of jmp
    	dwFuncOrig += (DWORD)pbMallocPtr; // Add this addr to 32bit jmp
    	dwFuncOrig -= (i-JMP32_SZ); // Dec by detour len to get to start of orig
    
    	// Write the overwritten bytes back to the original
    	VirtualProtect((LPVOID)dwFuncOrig, (i-JMP32_SZ), PAGE_READWRITE, &dwProt);
    	memcpy((LPVOID)dwFuncOrig, lpDetourCreatePtr, (i-JMP32_SZ));
    	VirtualProtect((LPVOID)dwFuncOrig, (i-JMP32_SZ), dwProt, &dwOldProt);
    
    	// Memory cleanup
    	free(lpDetourCreatePtr);
    
    	return TRUE;
    }
    
    int GetDetourLen(int patchType)
    {
    	switch(patchType)
    	{
    		case DETOUR_TYPE_JMP:
    			return 5;
    
    		case DETOUR_TYPE_PUSH_RET:
    		case DETOUR_TYPE_NOP_JMP:
    			return 6;
    		
    		case DETOUR_TYPE_NOP_NOP_JMP:
    		case DETOUR_TYPE_STC_JC:
    		case DETOUR_TYPE_CLC_JNC:
    			return 7;
    		
    		default:
    			return 0;
    	}
    }
    
    int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen)
    {
    	int len = 0;
    	PBYTE pbCurOp = pbFuncOrig;
    
    	while(len < minDetLen)
    	{
    		int i = oplen(pbCurOp);
    		
    		if(i == 0 || i == -1)
    			return 0;
    
    		if(len > DETOUR_MAX_SRCH_OPLEN)
    			return 0;
    
    		len += i;
    		pbCurOp += i;
    	}
    
    	return len;
    }
    i do what to make my detour working??
    Don't leech and make your own fucking detour. /fp

  3. #3
    wicho_koz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    194
    Reputation
    12
    Thanks
    52
    My Mood
    Shocked

    hmm

    Quote Originally Posted by Stephen View Post


    Don't leech and make your own fucking detour. /fp
    THANKS FOR HELPING
    @Stephen
    Last edited by wicho_koz; 07-17-2011 at 02:14 PM.

  4. #4
    kibbles18's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    US
    Posts
    860
    Reputation
    5
    Thanks
    124
    the error is that you are trying to do something over your head.

  5. The Following User Says Thank You to kibbles18 For This Useful Post:

    Stephen (07-17-2011)

  6. #5
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,690
    Reputation
    184
    Thanks
    1,147
    My Mood
    Aggressive
    Quote Originally Posted by kibbles18 View Post
    the error is that you are trying to do something over your head.
    Tru dat.

  7. #6
    CoderNever's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    http://mpgh.net MPGHCash: $700,458,011
    Posts
    1,196
    Reputation
    131
    Thanks
    2,233
    My Mood
    Buzzed
    I'm working on a ASM detour if I finish I'll release publicly.
    I Apologize for my latest release "CN Hack 7-11-11" I assure you it is not up to "CN Standard", and I feel bad due to all its flaws. I'm working hard, and steadily to remake it for I can bring everyone a hack they will really like!


    Support NSY Inject

    CoderNever
    GameArena
    _Fk127_
    ViSiON
    -Lunar_
    Bubbles Kittys

    Code:
    ¢N Mike says
    Cyber Bulling is bad
    J Whit says
    Yea bob wants to fuck my pussy
    ¢N Mike says
    Whit
    dont be a cyber bully
    J Whit says
    FUCK YOU
    ¢N Mike says
    Words hurt
    ѱ NOOB says
    whit gets bullied in school so he goes online and bullies kids online
    J Whit says
    DUH
    Stress relieve
    relieving
    The kintergarden kids beat my ass
    ¢N Mike says
    Thats just sad

  8. #7
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    Ontario, Canada
    Posts
    15,689
    Reputation
    3319
    Thanks
    11,100
    My Mood
    Happy
    The detours from v2 are detected. So are the ones from v3.


    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.
     
     
    VM | PM

    Publicist Since 04.04.2015
    Middleman Since Unknown - Unknown
    Global Moderator Since 08.01.2013
    Donator Since 05.29.2013

    Minion+ Since 04.18.2013

    District 187 Minion Since 04.04.2013
    Steam Minion Since 02.26.2013
    WarRock Minion Since 02.19.2013
    A.V.A Minion Since 02.13.2013
    DayZ Minion Since 01.21.2013
    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  9. #8
    wicho_koz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    194
    Reputation
    12
    Thanks
    52
    My Mood
    Shocked

    :O

    Quote Originally Posted by CoderNever View Post
    I'm working on a ASM detour if I finish I'll release publicly.
    I'll be waiting

Similar Threads

  1. [Solved]Tool to find out what causes the Syntax error ?
    By prisma in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 5
    Last Post: 09-14-2010, 02:40 AM
  2. What does the CA Error lead to?
    By my80chevette in forum C++/C Programming
    Replies: 3
    Last Post: 10-30-2009, 04:37 PM
  3. what is the best hack in warrock
    By ktalin91 in forum WarRock - International Hacks
    Replies: 59
    Last Post: 04-26-2007, 10:58 AM
  4. I'm making a UCE, but what is the Invisible address?
    By scooby107 in forum WarRock - International Hacks
    Replies: 10
    Last Post: 04-17-2007, 08:11 PM
  5. What's the best way to make money online?
    By SATANICAT in forum General
    Replies: 8
    Last Post: 01-02-2007, 07:04 PM