• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Page 1 of 3 123 LastLast
    Results 1 to 10 of 29
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iKasu's Avatar
      Join Date
      Jan 2013
      Posts
      23
      Thanks (-->)
      1
      Thanks (<--)
      0

      Sending Keystrokes to an Inactive Window

      John Kittz
      Good Morning/evening GDH :3

      I currently work on a Bot for the Online MMORPG "Fiesta Online" and i found a little problem for me x.x
      I can't send any Keys to this Game while it's not active / in focus.

      I tryed to do it via SendMessage / PostMessage but it doesn't work so i used Spy++ to locate a SubClass maybe this should help but it didn't.

      Here's a little sample written without copying it from my Source:
      Code:
      void test(){
      HWND hWindow = FindWindow("Gamebryo Application","FiestaOnline");
       if(!hWindow) return 0;
      HWND hWindow2 = FindWindowEx(hWindow, NULL, "Gamebryo Application", NULL);
       if(!hWindow2) return 0;
      SendMaMessage(hWindow2, "abcdefg");
      }
      
      void SendMaMessage(HWND hwnd, char String[]) {
      	for (int x = 0; String[x] != 0; x++) { SendMaKey(hwnd, String[x]); }
      }
      
      void SendMaKey(HWND hwnd, BYTE vk)  {
       
      	 SendMessage(hwnd, vk, WM_KEYDOWN, 0);
      	 PostMessage(hwnd, WM_CHAR, vk, 0);
               SendMessage(hwnd, vk, WM_KEYUP, 0);
      }
      I also know there must be a walk function because you can press on the floor and he will walk to this point where you pressed but
      i can't find it via ollydbg x.x

      Any Help is welcome and i hope you guys can help me.

      LG

    2. #2
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      491
      Haven't tried before but maybe you can directly call the callback of the window. Could be the game just doesn't handle input when not in focus.

      Try adding a sleep between sending keydown and keyup.

      What about SendInput?
      Last edited by c5; 09-05-2013 at 11:50 AM.
      Sending Keystrokes to an Inactive Window

    3. #3
      Coder
      Kappa
       
      Hacking
       
      Szaka's Avatar
      Join Date
      Mar 2013
      Posts
      168
      Thanks (-->)
      1
      Thanks (<--)
      6
      PostMessage with keyup and keydown

      To find the walk function reverse from "send" api

    4. #4
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iKasu's Avatar
      Join Date
      Jan 2013
      Posts
      23
      Thanks (-->)
      1
      Thanks (<--)
      0
      Quote Originally Posted by Szaka View Post
      PostMessage with keyup and keydown

      To find the walk function reverse from "send" api
      How u mean this? I tryed to look for something like walk, run, click but whenever i do a breakpoint the game doesn't care x.x

      Quote Originally Posted by c5 View Post
      Haven't tried before but maybe you can directly call the callback of the window.

      How u mean this?

      Well i checked with Spy++ that there is another Class "Gamebryo Application" and there i found the messages but
      whenever i enter something "abcbaasdhjasdgaisdhi" it always shows me WM_COMMAND instead of WM_KEYDOWN or whatever x.x

      LG

      Edit: Added some Screens:

      Here is what i get when i set the Focus to the Game and Send a "a" Key to it:
      Click image for larger version. 

Name:	4k1Zk.jpg 
Views:	10 
Size:	390.3 KB 
ID:	2013


      This is the Handle i get (the 2nd one) - The first one doesn't show's me anything if i enter something
      So it's the 2nd one:
      Attachment 2014
      Last edited by iKasu; 09-05-2013 at 06:19 PM.

    5. #5
      Coder
      Kappa
       
      Hacking
       
      Szaka's Avatar
      Join Date
      Mar 2013
      Posts
      168
      Thanks (-->)
      1
      Thanks (<--)
      6
      First make sure you got valid HWND by testing it with some API which has visible results and then try
      PostMessage(MyHwnd, WM_KEYDOWN, Virtual key code for exampel VK_F1, NULL);

      Aha,and run it as administrator

    6. #6
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iKasu's Avatar
      Join Date
      Jan 2013
      Posts
      23
      Thanks (-->)
      1
      Thanks (<--)
      0
      Okay after few more trys and fails i got the right handle, the right wparam and lparam - but.... it still doesn't work >.<

      Click image for larger version. 

Name:	4kkRI.png 
Views:	7 
Size:	13.3 KB 
ID:	2019

      Thats my Function:
      Code:
      void SendMyKeyPls(int key, LPCSTR ClassName, LPCSTR WindowName){
      
      HWND hWnd = FindWindowA(ClassName, WindowName);
          if(hWnd){
      		LPARAM LPARAMDOWN = 0x00000001; 
      		LPARAM LPARAMUP = 0xC0000001; 
                      LPARAM SendKey = (MapVirtualKey(Key, 0) << 0x10);
      		PostMessage(hWnd, WM_KEYDOWN, VK_I, (LPARAM)( LPARAMDOWN | SendKey  ));
                      Sleep(100);
      		PostMessage(hWnd, WM_KEYDOWN, VK_I, (LPARAM)( LPARAMDOWN | SendKey  ));
      }
      
      SendMyKeyPls(VK_I /* 0x49 */, "Gamebryo Application", "FiestaOnline");
      Last edited by iKasu; 09-06-2013 at 06:00 AM.

    7. #7
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      Chuck E's Avatar
      Join Date
      Jan 2013
      Location
      United Kingdom
      Posts
      119
      Thanks (-->)
      30
      Thanks (<--)
      20
      This is how I did it in a simple program (C#) with 2 buttons, that sends the W key to WoW game client
      Open Game button
      Send W button



      // GLOBAL VARIABLE TO HOLD THE GAME'S PROCESS
      private Process gameProcess;

      // THIS IS ATTACHED TO A BUTTON - btnOpenGame
      // open the game client
      gameProcess = new Process();
      gameProcess.StartInfo.FileName = @"C:\World of Warcraft - Vanilla - Ballistix\WoW.exe";
      gameProcess.Start();



      // THIS IS ATTACHED TO A BUTTON - btnSendW
      PostMessage(gameProcess.MainWindowHandle, WM_KEYDOWN, VK_W, 0);


      EDIT: Just in case you are going to try this in C#, you need to add:
      // add this directive
      using System.Runtime.InteropServices; // used for win32 API - mouse/keyboard detection
      // add this to your variable declaration area
      [DllImport("user32.dll")]
      static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
      Last edited by Chuck E; 09-06-2013 at 09:34 AM.

    8. #8
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      iKasu's Avatar
      Join Date
      Jan 2013
      Posts
      23
      Thanks (-->)
      1
      Thanks (<--)
      0
      Quote Originally Posted by Chuck E View Post
      This is how I did it in a simple program (C#) with 2 buttons that sends the key W to WoW game client
      Open Game button
      Send W button



      // GLOBAL VARIABLE TO HOLD THE GAME'S PROCESSprivate Process gameProcess;

      // THIS IS ATTACHED TO A BUTTON - btnOpenGame
      // open the game client
      gameProcess = new Process();
      gameProcess.StartInfo.FileName = @"C:\World of Warcraft - Vanilla - Ballistix\WoW.exe";
      gameProcess.Start();



      // THIS IS ATTACHED TO A BUTTON - btnSendW
      PostMessage(gameProcess.MainWindowHandle, WM_KEYDOWN, VK_W, 0);


      EDIT: Just in case you are going to try this in C#, you need to add:
      // add this directive
      using System.Runtime.InteropServices; // used for win32 API - mouse/keyboard detection
      // add this to your variable declaration are
      [DllImport("user32.dll")]
      static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);

      Not working And Chuck E havn't got it to work too x.x
      How the fuck do we get this to work >.<

    9. #9
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      Chuck E's Avatar
      Join Date
      Jan 2013
      Location
      United Kingdom
      Posts
      119
      Thanks (-->)
      30
      Thanks (<--)
      20
      Apparently X-Tap anti cheat is used by Fiesta Online
      That is why it does not register the PostMessages
      See 2nd post in: https://isboxer.com/forum/viewtopic.php?f=13&t=3559

      Further reading, and it looks like X-Trap has stopped PostMessage from working, by creating a reference to that function, and that reference involves the function doing nothing.
      Therefore the only way round this, it seems, is to reverse engineer it and alter/remove that reference, if possible.
      See example here: https://stackoverflow.com/questions/...-message-event

      This is what is called an eduguess on my part (educated guess) It could be total <expletive here>
      Last edited by Chuck E; 09-06-2013 at 09:58 AM.

    10. #10
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      491
      Cheats'n'Trainers
      Heh.. XTrap.. one word: syscall..
      Sending Keystrokes to an Inactive Window

    Page 1 of 3 123 LastLast

    Similar Game Hacker Threads

    1. [Help] Sending KeyStrokes Problem
      By Clarityworld in forum C/C++
      Replies: 5
      Last Post: 08-06-2015, 08:24 PM
    2. [Tutorial] C++ Sending KeyStrokes
      By Brutalon in forum Tutorials and Snippets
      Replies: 8
      Last Post: 12-20-2014, 01:30 AM
    3. [Source Code] Win 32 window base (c++)
      By dmo in forum Tutorials and Snippets
      Replies: 3
      Last Post: 12-14-2014, 11:28 PM
    4. [Tutorial] C++ Sending KeyStrokes
      By Brutalon in forum Tutorials and Snippets
      Replies: 0
      Last Post: 11-12-2014, 11:16 AM
    5. [C#] Sending a UDP Packet
      By NubTIK in forum C#
      Replies: 3
      Last Post: 03-10-2013, 01:03 AM

    Tags for this Thread