January 16th, 2012, 05:34 PM
Lateloading of x86 / x64 bit DLL keyboard files and init defines
I currently have an issue with the init of lateloading DLLs (keyboard files) that is compiled either with x86 or x64. The app is a simple C++ MFC application (32-bit)
First, here is a summary of the lateloading of the keyboard files:
The pKbdLayerDescriptor() fills an struct of: *KBD_LONG_POINTER PKBDTABLES;
kbdLibrary = LoadLibrary(L"C:\\windows\\system32\\KBDUS.DLL");
pKbdLayerDescriptor = (KbdLayerDescriptor)GetProcAddress(kbdLibrary, "KbdLayerDescriptor");
PKBDTABLES pKbd = pKbdLayerDescriptor();
The definition of KBD_LONG_POINTER PKBDTABLES (from Microsofts kbd.h):
Now here is the mainissue, program is compiled with x86 but executed on a x64-system.
#define KBD_LONG_POINTER __ptr64
* All keyboard files in %windir%\system32\ is x64 DLLs files and failes (because BUILD_WOW6432 doesn't exist)
* Struct is partly filled, possible corrupt
Same app running on a x86-system:
* All keyboard files are loaded ok, because the keyboardfiles in %windir%\system32\ is x86.
Taking a x86 KBDxx.DLL to a x64-system:
* Loaded ok, without a problem
Forcing the KBD_LONG_POINTER as __ptr64 on a x32-system:
* All keyboard files fails to load (as expected)
Forcing the KBD_LONG_POINTER as __ptr64 on a x64-system:
* All keyboard files are loaded ok (as expected).
Any tips on how to get this to work, without creating a kbd64.h containing the "same" defines?
Is it possible to "redefine" during runtime?
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!