 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Tue Oct 21, 2008 10:25 am Post subject: [C#] PMX.dll / PostMessageX with MOUSE (maplestory) |
|
|
http://pastebin.com/m3b5df731
Am trying to simulate mouse events towards maplestory, although it is "running" it doesn't do jackshit ingame. I tried simulating enter, or any key - worked fine.
Ideas?
| Code: | internal static int MakeLParam(int lo, int hi)
{
return (int)(((short)hi << 16) | (lo & 0xffff));
}
PostMessageX(WindowHandle, WM_LBUTTONDOWN, 0, MakeLParam(Convert.ToInt32(MouseX.Text), Convert.ToInt32(MouseY.Text))); |
(content of the pastebin)
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Tue Oct 21, 2008 11:27 am Post subject: |
|
|
| Code: |
void SendClick(bool dbl = false);
void SendClick(bool dbl)
{
POINT pPos;
GetCursorPos(&pPos);
SetCursorPos(pPos.x,pPos.y);
if (dbl)
{
PostMessageX(sHandle, WM_LBUTTONDBLCLK, NULL, (LPARAM)(pPos.x,pPos.y));
}
else
PostMessageX(sHandle, WM_LBUTTONDOWN, NULL, (LPARAM)(pPos.x,pPos.y));
PostMessageX(sHandle, WM_LBUTTONUP, NULL, (LPARAM)(pPos.x,pPos.y));
} |
Ohh my bad its C++, but you can make it to C# i guess.
_________________
Gone |
|
| Back to top |
|
 |
SFP+ Comp. talk moderator
Reputation: 26
Joined: 02 May 2007 Posts: 1228 Location: Sweden
|
Posted: Tue Oct 21, 2008 11:46 am Post subject: |
|
|
| Code: |
VOID SendClickEx(__in HWND hWnd, __in WPARAM wParam, __in BOOL bDoubleClick)
{
POINT Point;
if (GetCursorPos(&Point))
{
_PostMessage(hWnd, bDoubleClick ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN, wParam, MAKELPARAM(Point.x, Point.y));
_PostMessage(hWnd, WM_LBUTTONUP, wParam, MAKELPARAM(Point.x, Point.y));
}
}
#define SendClick(x, y) SendClickEx(x, 0, y) |
|
|
| Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Tue Oct 21, 2008 11:55 am Post subject: |
|
|
Gah, I'll fucking start coding in C++ soon. C# is starting to piss me off.
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Tue Oct 21, 2008 1:46 pm Post subject: |
|
|
| GMZorita wrote: | | Code: |
void SendClick(bool dbl = false);
void SendClick(bool dbl)
{
POINT pPos;
GetCursorPos(&pPos);
SetCursorPos(pPos.x,pPos.y);
if (dbl)
{
PostMessageX(sHandle, WM_LBUTTONDBLCLK, NULL, (LPARAM)(pPos.x,pPos.y));
}
else
PostMessageX(sHandle, WM_LBUTTONDOWN, NULL, (LPARAM)(pPos.x,pPos.y));
PostMessageX(sHandle, WM_LBUTTONUP, NULL, (LPARAM)(pPos.x,pPos.y));
} |
Ohh my bad its C++, but you can make it to C# i guess. |
ahhh remember that SetCursorPos is not hooked.
_________________
|
|
| Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Tue Oct 21, 2008 2:13 pm Post subject: |
|
|
| kitterz wrote: | | GMZorita wrote: | | Code: |
void SendClick(bool dbl = false);
void SendClick(bool dbl)
{
POINT pPos;
GetCursorPos(&pPos);
SetCursorPos(pPos.x,pPos.y);
if (dbl)
{
PostMessageX(sHandle, WM_LBUTTONDBLCLK, NULL, (LPARAM)(pPos.x,pPos.y));
}
else
PostMessageX(sHandle, WM_LBUTTONDOWN, NULL, (LPARAM)(pPos.x,pPos.y));
PostMessageX(sHandle, WM_LBUTTONUP, NULL, (LPARAM)(pPos.x,pPos.y));
} |
Ohh my bad its C++, but you can make it to C# i guess. |
ahhh remember that SetCursorPos is not hooked. |
You mean is hooked?
Well just use the trampoline bypass.
_________________
Gone |
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Tue Oct 21, 2008 2:34 pm Post subject: |
|
|
| GMZorita wrote: | | kitterz wrote: | | GMZorita wrote: | | Code: |
void SendClick(bool dbl = false);
void SendClick(bool dbl)
{
POINT pPos;
GetCursorPos(&pPos);
SetCursorPos(pPos.x,pPos.y);
if (dbl)
{
PostMessageX(sHandle, WM_LBUTTONDBLCLK, NULL, (LPARAM)(pPos.x,pPos.y));
}
else
PostMessageX(sHandle, WM_LBUTTONDOWN, NULL, (LPARAM)(pPos.x,pPos.y));
PostMessageX(sHandle, WM_LBUTTONUP, NULL, (LPARAM)(pPos.x,pPos.y));
} |
Ohh my bad its C++, but you can make it to C# i guess. |
ahhh remember that SetCursorPos is not hooked. |
You mean is hooked?
Well just use the trampoline bypass. |
He either made a typo, or doesn't think its hooked because he injects a .dll for his bots, and GG protected processes are allowed to use SetCursorPos.
|
|
| Back to top |
|
 |
sloppy Expert Cheater
Reputation: 0
Joined: 17 Aug 2008 Posts: 123
|
Posted: Tue Oct 21, 2008 4:00 pm Post subject: |
|
|
I wrote something similar to this awhile ago,
| Code: | [DllImport("gghh.dll")]
private static extern bool hhPostMessageA(IntPtr hWnd, uint Msg, uint wParam, uint lParam); // hook hop
[DllImport("gghh.dll")]
private static extern bool hhSetCursorPos(int x, int y); // hook hop
[DllImport("user32.dll")]
private static extern bool ClientToScreen(IntPtr hWnd, ref Point p);
const uint WM_LBUTTONDOWN = 0x0201;
const uint WM_LBUTTONUP = 0x0202;
const uint MK_LBUTTON = 0x0001;
public void Click(IntPtr hWnd, int x, int y) // click relative to the window
{
Point p = new Point(x, y);
ClientToScreen(hWnd, ref p);
hhSetCursorPos(p.X, p.Y);
Thread.Sleep(10); // increase delay if cursor moves but does not click.
hhPostMessageA(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, MakeLParam(x, y));
hhPostMessageA(hWnd, WM_LBUTTONUP, 0, MakeLParam(x, y));
}
private uint MakeLParam(int LoWord, int HiWord)
{
return (uint)((HiWord << 16) | (LoWord & 0xFFFF));
} |
Note: From past experience, using Spy++ shows that SetCursorPos is often recieved after the WM_LBUTTONDOWN message. I recommend you have a minor delay before the click, and possibly increase it for reliability if you need to.
Last edited by sloppy on Tue Oct 21, 2008 10:59 pm; edited 1 time in total |
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Tue Oct 21, 2008 7:55 pm Post subject: |
|
|
| smartz993 wrote: | | GMZorita wrote: | | kitterz wrote: | | GMZorita wrote: | | Code: |
void SendClick(bool dbl = false);
void SendClick(bool dbl)
{
POINT pPos;
GetCursorPos(&pPos);
SetCursorPos(pPos.x,pPos.y);
if (dbl)
{
PostMessageX(sHandle, WM_LBUTTONDBLCLK, NULL, (LPARAM)(pPos.x,pPos.y));
}
else
PostMessageX(sHandle, WM_LBUTTONDOWN, NULL, (LPARAM)(pPos.x,pPos.y));
PostMessageX(sHandle, WM_LBUTTONUP, NULL, (LPARAM)(pPos.x,pPos.y));
} |
Ohh my bad its C++, but you can make it to C# i guess. |
ahhh remember that SetCursorPos is not hooked. |
You mean is hooked?
Well just use the trampoline bypass. |
He either made a typo, or doesn't think its hooked because he injects a .dll for his bots, and GG protected processes are allowed to use SetCursorPos. |
lol ya typo i mean "now hooked" not "not hooked" lol
_________________
|
|
| Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Wed Oct 22, 2008 8:29 am Post subject: |
|
|
| sloppy wrote: | I wrote something similar to this awhile ago,
| Code: | [DllImport("gghh.dll")]
private static extern bool hhPostMessageA(IntPtr hWnd, uint Msg, uint wParam, uint lParam); // hook hop
[DllImport("gghh.dll")]
private static extern bool hhSetCursorPos(int x, int y); // hook hop
[DllImport("user32.dll")]
private static extern bool ClientToScreen(IntPtr hWnd, ref Point p);
const uint WM_LBUTTONDOWN = 0x0201;
const uint WM_LBUTTONUP = 0x0202;
const uint MK_LBUTTON = 0x0001;
public void Click(IntPtr hWnd, int x, int y) // click relative to the window
{
Point p = new Point(x, y);
ClientToScreen(hWnd, ref p);
hhSetCursorPos(p.X, p.Y);
Thread.Sleep(10); // increase delay if cursor moves but does not click.
hhPostMessageA(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, MakeLParam(x, y));
hhPostMessageA(hWnd, WM_LBUTTONUP, 0, MakeLParam(x, y));
}
private uint MakeLParam(int LoWord, int HiWord)
{
return (uint)((HiWord << 16) | (LoWord & 0xFFFF));
} |
Note: From past experience, using Spy++ shows that SetCursorPos is often recieved after the WM_LBUTTONDOWN message. I recommend you have a minor delay before the click, and possibly increase it for reliability if you need to. |
I'll do that, thanks for the tips.
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Sun Oct 26, 2008 12:56 am Post subject: |
|
|
so did it work?
im pretty sure im doing something wrong
i can't even reference pmx.dll
_________________
|
|
| Back to top |
|
 |
imeantobebad Master Cheater
Reputation: 0
Joined: 11 Jan 2007 Posts: 469 Location: Moree
|
Posted: Mon Oct 27, 2008 4:26 am Post subject: |
|
|
| Spawnfestis wrote: | | Gah, I'll fucking start coding in C++ soon. C# is starting to piss me off. |
Lol i thought u already coded in C++? SpawnPE?
|
|
| Back to top |
|
 |
|
|
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
|
|