GiacomoLaw / Keylogger

A simple keylogger for Windows, Linux and Mac
https://simple-keylogger.github.io/
MIT License
2.09k stars 616 forks source link

BUG in code (cpp) #133

Open oferrr opened 1 year ago

oferrr commented 1 year ago

I tried to compile the C++ code (for windows 11) with g++ (mingw) and I get a bug:

PS C:\Users\User\Keylogger\windows> g++ -c klog_main.cpp klog_main.cpp: In function 'int Save(int)': klog_main.cpp:132:57: error: 'strcpy_s' was not declared in this scope strcpy_s(lastwindow, sizeof(lastwindow), window_title); ^ klog_main.cpp:137:23: error: 'localtime_s' was not declared in this scope localtime_s(&tm, &t); ^

Is this a bug or problem in my pc?

k0dzi commented 1 year ago

Experienced this as well application works fine to log keystrokes but is not saving to .txt file on windows

GiacomoLaw commented 1 year ago

Using MinGW? Localtime_s doesn't work on stuff outside Windows compilers.

Try adding this:

define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL : Tm)

Does this help?

Commit 4d06f984fbe85a5374d1d5685473c7a9a1515256 should solve with the top issue. I am very rusty with CPP so help would be appreciated.