0

im writing a complex program that analyses users writing, and i have problem when running this application on 64bit OS. Here is the code you can run to re-interprate the problem. http://thetechnofreak.com/technofreak/keylogger-visual-c/ but of course, you need to have 64bit OS, since the program runs correctly on 32bit OS.

after this call

pKbd = pKbdLayerDescriptor();

this pointer equals NULL

pKbd->pVkToWcharTable

I have tried to google the solution first, and i found this http://www.codeproject.com/Questions/211107/RegQueryValueEx-programcrash-on-64-Bit its the exact same problem as i have, but there seem not to be a solution. So do you have any ideas what can be wrong ?

There is this piece of code in the program and it seems that it takes care of the size differences between pointers on 32 and 64bit architecture

#if defined(BUILD_WOW6432)
#define KBD_LONG_POINTER __ptr64
#else
#define KBD_LONG_POINTER
#endif

But clearly, its not helping.

Anton Giertli
  • 896
  • 2
  • 10
  • 29

1 Answers1

1

I've just had exactly the same issue with that piece of code.

I'll assume you're compiling to 32-bit but running on 64-bit as I am. If so, then first you need to define BUILD_WOW6432 before including kbd.h (or kbdext.h if you're using it). Secondly, use

SHGetFolderPath(NULL, CSIDL_SYSTEMX86, NULL, 0, systemDirectory)

instead of GetSystemDirectory(systemDirectory, MAX_PATH). This means that you always use the 32-bit code, even on 64-bit machines.

This solved the problem for me, hope it helps you :)

Tisho
  • 8,320
  • 6
  • 44
  • 52
awsxdr
  • 11
  • 1