![]() |
implementing hotkey in exe
hi
Is it possible to implementing hotkey function in exe itself by asm code injection ,so pressing on the key does some code injection in memory. i have only some idea like get the main loop->create some asm function to detect specific keys->if key pressed do some editing in memory :) Is there any api to look for? regards |
There is an API function called "RegisterHotKey()" for defining a system-wide hot key. [ Dont forget it's partner UnRegisterHotkey() ]
Code:
BOOL RegisterHotKey( /keyboardinputreference/keyboardinputfunctions/registerhotkey.asp It generates a WM_HOTKEY and sends it to the supplied HWND so you need to setup a message listener for WM_HOTKEY. Quick delphi example I found Code:
/In the main forms OnCreate |
Quote:
What about creating an (external) app which checks for a particular key being pressed and if it is it writes sth into the process you want to hack (via WriteProcessMemory). I believe this is better than writing it directly into the exe... |
yes this is what everyone does mainly in trainers. i wanted something different which can be done within the exe.
redbull,thanks for your api help but badly those api are'nt in the imports and then how do we capture the key? |
Both RegisterHotKey and UnRegisterHotKey are found in "user32.dll"
You need to hope that the app you are hooking into (for evil purposes) has LoadLibrary and GetProcAddress... Otherwise you have to hard-code the calls into your program or have a range of calls hard coded for each operating system and service pack... You can find out which function these are in User32.dll and walk through user32.dll 's PE header export section and get the address of the function that way. Other than that you are going to have to do things the hard way. There are a number of papers on this writtern by the virus writers or rootkit authors .... |
if the software itself has some hotkeys, I think it's easy to do.
use exescope to open the software, u may find : accelarate... or sth like this , can we change here to build our own hotkeys? |
Look at SetWindowsHook(ex). You can write a dll which will be loaded into all gui processes, intercept the keypress, and do whatever you need to in the context of the process that received the keypress. The hotkey message would leave you in the context of your own process.
|
| All times are GMT +8. The time now is 01:46. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX