This has nothing to do with your code, just remember
Execution from Hard drive is faster than from a removable drive.
this explains why your key-logger misses some strokes.
its a terribly written code, Never PAUSE. you can use Sleep() instead of PAUSE.
i hate script kiddies.
You replace system("PAUSE") with Sleep(), but anyway in your case you don't need either of them, as you want console window hiding anyway. You could use a GUI application with SW_HIDE in the first place instead of your nasty Stealth() function.
Does AllocConsole() work even in console programs ???????? Interesting, useless and stupid thing to do even if it works :)
As for another function instead of fprintf(), there is a few, anyway I suggest to not open/clos the file every time, instead open it once and keep it opened until the program ends.
@modoran
i like your suggestion about closing log file when program ends.. but the problem is the program never ends =D
@pharabot
hooking is a better option than using asynckey() function, getasynckey() raises suspicion.
just a little suggestion .. correct me if you are wrong .
Why are opening , and closing file in the loop. . can we not pass the pointer of file to the function .
i.e opening the file only once and then writting into the file for the whole loop. and then closing the file once .
Just flush the stream, no need to close and reopen. Unless there's some other purpose to it. Or set the buffer size to a lower amount.
it would be so kind of you, if you provide a little example code on how to accomplish this..
what i understand is this, store the keystrokes to a buffer and then write the buffer to a file, am i right?
When you use file streams, it automatically writes to a buffer and only writes to the file when the stream gets flushed, which happens when you call flush(), close the stream, or the buffer just gets full.
that means, i need not to close the file.. just keep on writing in an endless while loop, and the contents will automatically be saved.
or at the end of each loop i add sync() to save the contents
right?
I'd do something a little more clever than that. Either, do it at set time intervals, or try to sync when the stream isn't overly busy. It can be a costly operation to do every iteration