Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[c++] need bypass for postmessage for maplestory
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Sun Sep 07, 2008 7:59 am    Post subject: Reply with quote

while(!(hWnd = FindWindow("MapleStoryClass", NULL)))
Sleep(100);
Back to top
View user's profile Send private message
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4023
Location: Romania

PostPosted: Sun Sep 07, 2008 8:20 am    Post subject: Reply with quote

You do realize that discussing these in open public forums, methods get patched within days/weeks, right?.. Just ignore common sense, but watch out for ban/warn hammer when you whine it's patched Smile
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sun Sep 07, 2008 1:11 pm    Post subject: Reply with quote

SunBeam wrote:
You do realize that discussing these in open public forums, methods get patched within days/weeks, right?.. Just ignore common sense, but watch out for ban/warn hammer when you whine it's patched Smile
Trampoline hasn't been patched for ages.
_________________
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Sep 08, 2008 2:13 am    Post subject: Reply with quote

dnsi0 wrote:
Hieroglyphics wrote:
Either look here

Or I THINK this might work correct me if I am wrong anybody:

Code:
#include "windows.h"

#include <iostream>

using namespace std;

DWORD PostMessA = (DWORD)GetProcAddress(LoadLibrary("USER32.DLL"), "PostMessageA"));

_declspec(naked) BOOL PostMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
   _asm {
      mov edi, edi
      push ebp
      mov ebp, esp
      jmp[PostMessA]
   }
}

int main() {
   while (true) {
      HWND hWnd;
      hWnd = FindWindow(NULL,"MapleStory");

      PostMessage(hWnd,WM_CHAR,0x41,1);

      Sleep(1);
   }
}



Then if you wanna edit memory

Code:
static const FARPROC VPX = (FARPROC)((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5);
DWORD oldp = 0;
PDWORD oldprot = &oldp;
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5);
DWORD dwBytesWritten;

_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
   }
}


Somethin like that

Sphere90 posted
Code:
   ULONG reentry_address = GetProcAddress( LoadLibrary("user32.dll"), "PostMessageA" ) + 5;

   __declspec(naked) void myPostMessageA(void)
   {
      __asm
      {
         mov edi,edi
         push ebp
         mov ebp,esp
         jmp [reentry_address]
      }
   }


Yea that works. All you really have to do is find out the PMA address which is a constant at: 0x77D1CB85
Create a hop to jump over the 5 byte jmp hook that gg does. But you still need it EXCEPT mov edi,edi which is pointless...

and then jump to pma+5 past the hook.

No PMA address is not a constant at 0x77D1CB85. If it was constant, there would be no need ot find it each time. That is the point of a dynamic link library. Funtions have variable addresses which are resolved at runtime. The address of a function can and do differ per system.
Back to top
View user's profile Send private message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Wed Sep 24, 2008 6:06 am    Post subject: Reply with quote

How would you use this 5 byte jump method on C# ?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Sep 24, 2008 7:57 am    Post subject: Reply with quote

Hieroglyphics wrote:
Then if you wanna edit memory

Code:
static const FARPROC VPX = (FARPROC)((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5);
DWORD oldp = 0;
PDWORD oldprot = &oldp;
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5);
DWORD dwBytesWritten;

_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
   }
}


Somethin like that


Just saw this post again. Are you sure this method works for bypassing VirtualProtectEx hooks ? Bearing in mind that ZwProtectVirtualMemory and NtProtectVirtualMemory are both hooked.. ?
Back to top
View user's profile Send private message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Wed Sep 24, 2008 8:06 am    Post subject: Reply with quote

Slugsnack wrote:
Hieroglyphics wrote:
Then if you wanna edit memory

Code:
static const FARPROC VPX = (FARPROC)((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5);
DWORD oldp = 0;
PDWORD oldprot = &oldp;
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5);
DWORD dwBytesWritten;

_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
   }
}


Somethin like that


Just saw this post again. Are you sure this method works for bypassing VirtualProtectEx hooks ? Bearing in mind that ZwProtectVirtualMemory and NtProtectVirtualMemory are both hooked.. ?


I think i had that code in my trainer on rev 1154 and 117? and it worked just fine...
How can i skip 5 bytes on PostMessage with C#, could i maybe use the PMX.dll for it?

Edit: I got my problem sorted out with delphi, but im still wanting to know how to do it on C#
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Sep 24, 2008 9:06 am    Post subject: Reply with quote

Do it dynamically. If you hardcode the prologue it is only 'guaranteed' to work on Windows XP SP2 and up and that is not even guaranteed. I suggest fetching the first 5 bytes first before the game/GameGuard even loads then copy it dynamically into a trampoline function later when you need it.
Back to top
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Wed Sep 24, 2008 4:32 pm    Post subject: Reply with quote

Quote:
Do it dynamically. If you hardcode the prologue it is only 'guaranteed' to work on Windows XP SP2 and up and that is not even guaranteed. I suggest fetching the first 5 bytes first before the game/GameGuard even loads then copy it dynamically into a trampoline function later when you need it.

You'd have to do more than just copy the first 5 bytes if you want to do it dynamically. There's no gaurantee the first 5 bytes will be a complete set of instructions which is why they added the hotpatching prologue in the first place.

_________________
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Sep 25, 2008 8:47 am    Post subject: Reply with quote

No guarantee, correct. If you want to do it properly, find what the instructions are and see if the size of them add up to 5. However just 5 will work the majority of the time for most (if not all) of the functions that GG hooks.
Back to top
View user's profile Send private message
RAKO
Master Cheater
Reputation: 0

Joined: 26 Jun 2006
Posts: 454

PostPosted: Thu Sep 25, 2008 7:30 pm    Post subject: Reply with quote

Dami3n wrote:
How would you use this 5 byte jump method on C# ?


i don't think you can do asm in c# so you would have to make a the function in c++ or delphi and put that into a dll. then you use introp.

_________________
Dark Byte wrote:
Who knows, perhaps i'm a maple gm!!!!
Back to top
View user's profile Send private message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Fri Sep 26, 2008 12:11 pm    Post subject: Reply with quote

RAKO wrote:
Dami3n wrote:
How would you use this 5 byte jump method on C# ?


i don't think you can do asm in c# so you would have to make a the function in c++ or delphi and put that into a dll. then you use introp.


Yeah, that is the one part i was thinking too...
Thanks for the replys, i guess il get somewhere with this Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites