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 


Moving Mouse Gameguard c++
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
123qwe
Newbie cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 21

PostPosted: Mon Dec 29, 2008 6:49 am    Post subject: Moving Mouse Gameguard c++ Reply with quote

i was wondering how i would move the mouse to x postion in c++.

i have this function(see below), but gameguard seems to block me moving the mouse. i named the file EvoMouExec.exe, the game i play is Mu online global. so how would i move the mouse in c++? thanks for any help =]

Code:
void SetMousePos(int x, int y)
{
    double fScreenWidth = ::GetSystemMetrics( SM_CXSCREEN )-1;
    double fScreenHeight = ::GetSystemMetrics( SM_CYSCREEN )-1;
    double fx = x*(65535.0f/fScreenWidth);
    double fy = y*(65535.0f/fScreenHeight);
   
    INPUT inp;
    inp.type = INPUT_MOUSE;
    inp.mi.dx = fx;
    inp.mi.dy = fy;
    inp.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
    inp.mi.time = 0;
    SendInput(1, &inp, sizeof(INPUT));
}
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Mon Dec 29, 2008 6:58 am    Post subject: Reply with quote

SendInput hooked by gameguard just like all user32.dll api's
to bypass it jump 5 bytes over the hook
Code:

DWORD _si = (DWORD)GetProcAddress(GetModuleHandle("User32.Dll"),"SendInput");

__declspec(naked) unsigned int WINAPI _SendInput(UINT nInputs,LPINPUT pInputs, int cbSize)
{
  __asm
  {
    mov edi,edi
    push ebp
    mov ebp,esp
    jmp dword ptr ds:[_si]
  }
}
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Dec 29, 2008 7:33 am    Post subject: Reply with quote

I'm pretty sure SendInput is blocked on r0 not r3. Kiki had a driver to bypass it, but that appears to be patched (i BSOD using it with GG).
_________________
Back to top
View user's profile Send private message
Jvlaple
Grandmaster Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 768

PostPosted: Mon Dec 29, 2008 8:10 am    Post subject: Reply with quote

why don't you use java...

Code:

import java.awt.*;

public class fuck {
    public static void main(String args[]) {
        Robot f = new Robot();
        f.moveMouse(10, 10); //move mouse to pos 10, 10
    }
}


_________________
jadeling wrote:
how do i save my npc?

samerj13 wrote:
What the fuck is visual basic?
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Dec 29, 2008 8:58 am    Post subject: Reply with quote

Jvlaple wrote:
why don't you use java...

Code:

import java.awt.*;

public class fuck {
    public static void main(String args[]) {
        Robot f = new Robot();
        f.moveMouse(10, 10); //move mouse to pos 10, 10
    }
}




because java sucks. And it's blocked anyways aswell.

_________________
Back to top
View user's profile Send private message
Jvlaple
Grandmaster Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 768

PostPosted: Mon Dec 29, 2008 9:12 am    Post subject: Reply with quote

blankrider wrote:
Jvlaple wrote:
why don't you use java...

Code:

import java.awt.*;

public class fuck {
    public static void main(String args[]) {
        Robot f = new Robot();
        f.moveMouse(10, 10); //move mouse to pos 10, 10
    }
}




because java sucks. And it's blocked anyways aswell.


its not blocked o_O

_________________
jadeling wrote:
how do i save my npc?

samerj13 wrote:
What the fuck is visual basic?
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Mon Dec 29, 2008 9:57 am    Post subject: Reply with quote

I think in windows.h there is SetCursorPos. Include windows.h and just do
SetCursorPos(int x, int y); it's not sending anything to the game so gameguard shouldn't care.

_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Dec 29, 2008 10:07 am    Post subject: Reply with quote

Jvlaple wrote:
blankrider wrote:
Jvlaple wrote:
why don't you use java...

Code:

import java.awt.*;

public class fuck {
    public static void main(String args[]) {
        Robot f = new Robot();
        f.moveMouse(10, 10); //move mouse to pos 10, 10
    }
}




because java sucks. And it's blocked anyways aswell.


its not blocked o_O


The part of Robot class in Java that sends a click is blocked, so the method is crap because you won't be able to do anything other than move the mouse. If you argue that clicking or input isn't blocked in java then you are a moron. I've used the robot in java and it failed.

_________________
Back to top
View user's profile Send private message
BirdsEye
Advanced Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 94

PostPosted: Mon Dec 29, 2008 11:22 am    Post subject: Reply with quote

I'm not sure if bypassed SetCursorPos is needed. I think MAKELPARAM might do it. However, just to be safe, use it. Or just test it out later.

Code:

DWORD SCP = (DWORD)GetProcAddress(LoadLibrary(L"user32.dll")), "SetCursorPos") + 5;

__declspec(naked) BOOL WINAPI SetCursorPosX(int X, int Y)
{
   __asm
   {
      push   ebp
      mov    ebp, esp
      jmp    dword ptr [SCP]
   }
}

Code:

DWORD PMA = (DWORD)GetProcAddress(LoadLibrary(L"user32.dll")), "PostMessageA") + 5;

__declspec(naked) BOOL WINAPI PostMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   __asm
   {
      push   ebp
      mov    ebp, esp
      jmp    dword ptr [PMA]
   }
}


I guess you do something like this:
Code:

. . .
SetCursorPosX(x, y);
PostMessageX(hWnd, WM_LBUTTONDOWN, NULL, MAKELPARAM(x, y));
PostMessageX(hWnd, WM_LBUTTONUP, NULL, MAKELPARAM(x, y));
. . .


Or you could use the POINT structure so you don't have to keep re-writing the coords.
Code:

. . .
POINT coords = { x, y };
SetCursorPos(coords.x, coords.y);
PostMessageX(hWnd, WM_LBUTTONDOWN, NULL, MAKELPARAM(coords.x, coords.y));
PostMessageX(hWnd, WM_LBUTTONUP, NULL, MAKELPARAM(coords.x, coords.y));
Back to top
View user's profile Send private message
123qwe
Newbie cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 21

PostPosted: Tue Dec 30, 2008 5:16 am    Post subject: Reply with quote

what editor/compiler do you guys use? cause devc++ cant compile asm ^^

thanks, for all your feed back too
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue Dec 30, 2008 5:25 am    Post subject: Reply with quote

123qwe wrote:
what editor/compiler do you guys use? cause devc++ cant compile asm ^^

thanks, for all your feed back too


visual studio (costs but you can easily torrent)
visual C++ express (free, just google it)

_________________
Back to top
View user's profile Send private message
123qwe
Newbie cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 21

PostPosted: Wed Dec 31, 2008 4:25 pm    Post subject: Reply with quote

i get this error when compiling in visual c++ express, do you know whats wrong? thanks for your time and i hope its not a hassle =]


Code:
.\main.cpp(5) : error C2664: 'LoadLibraryA' : cannot convert parameter 1 from 'const wchar_t [11]' to 'LPCSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(5) : error C2660: 'GetProcAddress' : function does not take 1 arguments
.\main.cpp(5) : error C2059: syntax error : 'string'
.\main.cpp(5) : error C2059: syntax error : ')'
.\main.cpp(17) : error C2664: 'LoadLibraryA' : cannot convert parameter 1 from 'const wchar_t [11]' to 'LPCSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(17) : error C2660: 'GetProcAddress' : function does not take 1 arguments
.\main.cpp(17) : error C2059: syntax error : 'string'
.\main.cpp(17) : error C2059: syntax error : ')'
Back to top
View user's profile Send private message
FerrisBuellerYourMyHero
Master Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 401
Location: Inside your <kernel>

PostPosted: Wed Dec 31, 2008 4:31 pm    Post subject: Reply with quote

123qwe wrote:
i get this error when compiling in visual c++ express, do you know whats wrong? thanks for your time and i hope its not a hassle =]


Code:
.\main.cpp(5) : error C2664: 'LoadLibraryA' : cannot convert parameter 1 from 'const wchar_t [11]' to 'LPCSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(5) : error C2660: 'GetProcAddress' : function does not take 1 arguments
.\main.cpp(5) : error C2059: syntax error : 'string'
.\main.cpp(5) : error C2059: syntax error : ')'
.\main.cpp(17) : error C2664: 'LoadLibraryA' : cannot convert parameter 1 from 'const wchar_t [11]' to 'LPCSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(17) : error C2660: 'GetProcAddress' : function does not take 1 arguments
.\main.cpp(17) : error C2059: syntax error : 'string'
.\main.cpp(17) : error C2059: syntax error : ')'



when you prefix a string with L it is used as a unicode string.

either remove the L 's

or use the unicode versions of the functions.

LoadLibraryW instead of LoadLibraryA

unicode:
Code:

DWORD SCP = (DWORD)GetProcAddress(LoadLibraryW(L"user32.dll")), "SetCursorPos") + 5;


ascii:
Code:

DWORD SCP = (DWORD)GetProcAddress(LoadLibraryA("user32.dll")), "SetCursorPos") + 5;


and VC++ express! nice choice, I have the express edition too and its all you need. Remember winners don't do warez! Very Happy

@BirdsEye: yes you do need to bypass SetCursorPos because it is hooked, and doesn't work if you try to call it.

_________________
You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!

Back to top
View user's profile Send private message MSN Messenger
123qwe
Newbie cheater
Reputation: 0

Joined: 26 Dec 2006
Posts: 21

PostPosted: Wed Dec 31, 2008 4:52 pm    Post subject: Reply with quote

now i just get this error, which brackets is my troubles with? thanks



[code.\main.cpp(5) : error C2660: 'GetProcAddress' : function does not take 1 arguments
.\main.cpp(5) : error C2059: syntax error : 'string'
.\main.cpp(5) : error C2059: syntax error : ')'[/code]


Code:
DWORD SCP = (DWORD)GetProcAddress(LoadLibraryW(L"user32.dll")), "SetCursorPos") + 5;

__declspec(naked) BOOL WINAPI SetCursorPosX(int X, int Y)
{
   __asm
   {
      push   ebp
      mov    ebp, esp
      jmp    dword ptr [SCP]
   }
}
Back to top
View user's profile Send private message
FerrisBuellerYourMyHero
Master Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 401
Location: Inside your <kernel>

PostPosted: Wed Dec 31, 2008 4:58 pm    Post subject: Reply with quote

123qwe wrote:
now i just get this error, which brackets is my troubles with? thanks



[code.\main.cpp(5) : error C2660: 'GetProcAddress' : function does not take 1 arguments
.\main.cpp(5) : error C2059: syntax error : 'string'
.\main.cpp(5) : error C2059: syntax error : ')'[/code]


Code:
DWORD SCP = (DWORD)GetProcAddress(LoadLibraryW(L"user32.dll")), "SetCursorPos") + 5;

__declspec(naked) BOOL WINAPI SetCursorPosX(int X, int Y)
{
   __asm
   {
      push   ebp
      mov    ebp, esp
      jmp    dword ptr [SCP]
   }
}



lol, this one you should've figured out. think about what its telling you. GetProcAddress DOESN'T take 1 parameter. That means your only giving it 1 parameter. So take a look at whats screwing it up.

your closing it off with )

remove it

so

Code:

DWORD SCP = (DWORD)GetProcAddress(LoadLibraryW(L"user32.dll")), "SetCursorPos") + 5;


to

Code:

DWORD SCP = (DWORD)GetProcAddress(LoadLibraryW(L"user32.dll"), "SetCursorPos") + 5;


and actually its not your fault either, BirdsEye posted it like that with the extra parenthesis. And I didn't catch it. But that's why your compiler gives you the error so you can fix your mistake if you didn't catch it yourself.

_________________
You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!

Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 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