| View previous topic :: View next topic |
| Author |
Message |
homer_simpson Grandmaster Cheater
Reputation: 0
Joined: 25 Feb 2007 Posts: 596
|
Posted: Thu Jul 10, 2008 7:53 am Post subject: [c++] Dll help |
|
|
Im making a C++ dll for maplestory heres a chunk of the source:
| Code: | void MainThread()
{
Sleep(2500); //give time for maple to start
BypassCRC();
}
void BypassCRC()
{
FixMemEx(GetCurrentProcess(), (void*)CRCaddy, 0x1000, PAGE_EXECUTE_READWRITE, (DWORD*)oldprot);
CRC = VirtualAlloc(NULL, 0x00400000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
memcpy((void *)MEMDUMP, (void *)0x00400000, 0x00400000);
memcpy((void *)CRC, (void *)MEMDUMP, 0x00400000);
CRCaddy = 0x0047cc9e;
*(BYTE*)CRCaddy = 0xE8;
*(DWORD*)((unsigned long)CRCaddy + 1) = JMP(CRCaddy, CRCCave);
OutputDebugString("Bypassed CRC!");
} |
But my bulder keeps telling me this:
| Code: | | [C++ Error] dll.cpp(54): E2268 Call to undefined funcion 'BypassCRC' |
What am I doing wrong?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
Posted: Thu Jul 10, 2008 7:57 am Post subject: |
|
|
Either create a function prototype for BypassCRC at the top of the file, or put the BypassCRC function above the MainThread function.
_________________
- Retired. |
|
| Back to top |
|
 |
homer_simpson Grandmaster Cheater
Reputation: 0
Joined: 25 Feb 2007 Posts: 596
|
Posted: Thu Jul 10, 2008 8:27 am Post subject: |
|
|
Thanks it worked but now it gives me this error:
| Code: | | [C++ Error] dll.cpp(36): E2448 Undefined label 'VPX' |
And this is the code:
| Code: | #include <windows.h>
#pragma hdrstop
#include "Unit2.h"
#pragma link "Unit2"
#pragma argsused
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5);
HINSTANCE hMod;
LPVOID CRC;
DWORD oldp = 0;
PDWORD oldprot = &oldp;
BYTE MEMDUMP[0x400000];
DWORD Addy = 0x00400000, CRCaddy, ReturnMe;
static const FARPROC VPX = (FARPROC)((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5);
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
Application->Initialize();
Application->CreateForm(__classid(TForm2), &Form2);
Application->Run();
OutputDebugString("HomerTrainer activated ;)");
return 0;
}
__declspec(naked) BOOL WINAPI FixMemEx(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
_asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp VPX
}
return 0;
}
|
Guessing jmp VPX is the problem because VPX isn't properly defined?
|
|
| Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Thu Jul 10, 2008 8:30 am Post subject: |
|
|
| get rid of all the FARPROC crap and declare it as a DWORD.
|
|
| Back to top |
|
 |
homer_simpson Grandmaster Cheater
Reputation: 0
Joined: 25 Feb 2007 Posts: 596
|
Posted: Thu Jul 10, 2008 8:36 am Post subject: |
|
|
You mean like this?
| Code: | | static const DWORD VPX = ((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5); |
|
|
| Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Thu Jul 10, 2008 8:41 am Post subject: |
|
|
| That should probably work.
|
|
| Back to top |
|
 |
homer_simpson Grandmaster Cheater
Reputation: 0
Joined: 25 Feb 2007 Posts: 596
|
Posted: Thu Jul 10, 2008 8:56 am Post subject: |
|
|
| Still the same error.
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Thu Jul 10, 2008 9:02 am Post subject: |
|
|
Just do this.
| Code: |
DWORD VPX = (DWORD)GetProcAddress(LoadLibrary("KERNEL32.DLL"), "VirtualProtectEx")+5;
__declspec(naked) BOOL WINAPI FixMemEx(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
_asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp[VPX]
}
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
homer_simpson Grandmaster Cheater
Reputation: 0
Joined: 25 Feb 2007 Posts: 596
|
Posted: Thu Jul 10, 2008 9:08 am Post subject: |
|
|
Worked but now it gives me this:
| Code: | [C++ Error] dll.cpp(36): E2448 Undefined label '['
|
And I had to add return 0;
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Thu Jul 10, 2008 9:15 am Post subject: |
|
|
Don't add return 0. And what compiler are you using? I'm assuming VC++ because you're using forms. Well if it doesn't recognize [ then just do "jmp VPX".
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Thu Jul 10, 2008 9:16 am Post subject: |
|
|
WOW How surprising, you are using my leaked code, just changed some vars so it doesn't looks exactly the same.
Instead of
Just use
| oib111 wrote: | | Don't add return 0. And what compiler are you using? I'm assuming VC++ because you're using forms. Well if it doesn't recognize [ then just do "jmp VPX". |
No he is using Borland Developer Studio w/ my Leaked Trainer Source,
But he changed some vars so he get those problems.
_________________
Gone |
|
| Back to top |
|
 |
homer_simpson Grandmaster Cheater
Reputation: 0
Joined: 25 Feb 2007 Posts: 596
|
Posted: Thu Jul 10, 2008 9:22 am Post subject: |
|
|
| GMZorita wrote: | WOW How surprising, you are using my leaked code, just changed some vars so it doesn't looks exactly the same.
Instead of
Just use
| oib111 wrote: | | Don't add return 0. And what compiler are you using? I'm assuming VC++ because you're using forms. Well if it doesn't recognize [ then just do "jmp VPX". |
No he is using Borland Developer Studio w/ my Leaked Trainer Source,
But he changed some vars so he get those problems. |
Well at least im learning... And that gave be back to the VPX label error.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
Posted: Thu Jul 10, 2008 12:09 pm Post subject: |
|
|
Be sure you are defining things ABOVE what is calling them. Or you will get undefined errors like the one you are getting.
_________________
- Retired. |
|
| Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Thu Jul 10, 2008 12:11 pm Post subject: |
|
|
| homer_simpson wrote: | | GMZorita wrote: | WOW How surprising, you are using my leaked code, just changed some vars so it doesn't looks exactly the same.
Instead of
Just use
| oib111 wrote: | | Don't add return 0. And what compiler are you using? I'm assuming VC++ because you're using forms. Well if it doesn't recognize [ then just do "jmp VPX". |
No he is using Borland Developer Studio w/ my Leaked Trainer Source,
But he changed some vars so he get those problems. |
Well at least im learning... And that gave be back to the VPX label error. |
For god sake just use this code.
| Code: |
static const FARPROC VPX = (FARPROC)((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5);
DWORD oldp2 = 0;
PDWORD oldprot2 = &oldp2;
_declspec(naked) BOOL WINAPI FixMemEx(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
_asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp VPX
}
return 0;
}
//---------------------------------
void FixMem()
{
FixMemEx(GetCurrentProcess(), (void*)0x400000, 0x400000, PAGE_EXECUTE_READWRITE, (DWORD*)oldprot2);
} |
When you need to fix the memory just use
And no you are not learning you are mostly leeching.
_________________
Gone |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Thu Jul 10, 2008 12:38 pm Post subject: |
|
|
| Why not make FixMemEx void?
|
|
| Back to top |
|
 |
|