问题描述
我正在编写一个分析用户写作的复杂程序,我在 64 位操作系统上运行这个应用程序时遇到了问题.这是您可以运行以重新解释问题的代码.http://thetechnofreak.com/technofreak/keylogger-visual-c/但当然,您需要有 64 位操作系统,因为该程序可以在 32 位操作系统上正常运行.
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.
在这次通话之后
pKbd = pKbdLayerDescriptor();
这个指针等于NULL
pKbd->pVkToWcharTable
我试着先用谷歌搜索解决方案,我发现了这个http://www.codeproject.com/Questions/211107/RegQueryValueEx-programcrash-on-64-Bit它和我遇到的问题完全相同,但似乎没有解决方案.那么您有什么想法可能是错误的吗?
I have tried to google the solution first, and i found thishttp://www.codeproject.com/Questions/211107/RegQueryValueEx-programcrash-on-64-Bitits 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 ?
程序中有这段代码,似乎是在处理32位和64位架构上指针大小的差异
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.
推荐答案
我刚刚遇到了与那段代码完全相同的问题.
I've just had exactly the same issue with that piece of code.
我假设您正在编译为 32 位,但像我一样在 64 位上运行.如果是这样,那么首先您需要定义 BUILD_WOW6432
,然后再包含 kbd.h
(或 kbdext.h
,如果您正在使用它).其次,使用
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)
而不是 GetSystemDirectory(systemDirectory, MAX_PATH)
.这意味着您始终使用 32 位代码,即使在 64 位机器上也是如此.
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 :)
这篇关于KbdLayerDescriptor 在 64 位架构下返回 NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!