Keylogger: Compiling klog_main.cpp errors
I have tried compiling the source on Dev-C++ and Visual Studio 2016, resulting in various errors. Using latest on master windows.
On Dev-C++ 5.11
In function 'LRESULT HookCallback(int, WPARAM, LPARAM)':
31 [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]
In function 'void SetHook()':
47 [Error] cannot convert 'const wchar_t*' to 'LPCSTR {aka const char*}' for argument '2' to 'int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)'
114 [Error] '::main' must return 'int'
On Visual Studio 2015 Community Edition
argument of type "const wchar_t *" is incompatible with parameter of type "LPCSTR"
'int MessageBoxA(HWND,LPCSTR,LPCSTR,UINT)': cannot convert argument 2 from 'const wchar_t [24]' to 'LPCSTR'
'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Very frustrating to compile and not simple anymore. The simplier choice would be version 2.0 but it takes up recurring 100% cpu usage.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (10 by maintainers)
@GiacomoLaw I’m also using VS Community Edition
@wicked The
fopenis just a warning, which VS ignores until you tell it to treat them as error. So it should compile if thats the only problem.The newest version doesn’t compile. No problem @GiacomoLaw , just reporting issues so other users won’t have any trouble compiling.
Using unmodified visible.
#define visible // (visible / invisible)Using Dev-C++ 5.11, TDM-GCC 4.9.2 64-bit Release, removed L infront of the strings in MessageBox(…) (line 47)
MessageBox(NULL, "Failed to install hook!", "Error", MB_ICONERROR);Using Visual Studio 2015, Visual C++ Empty Project, klog_main.cpp inside Source Files folder.
Using
fopen_sTry removing the L infront of the strings in MessageBox(…) (line 47)
MessageBox(NULL, "Failed to install hook!", "Error", MB_ICONERROR);In my case it would not compile without them, but your compiler may be different.
Edit: Technically you could just comment out that function, since it is only called incase the hook fails to install.