Hi all
Still working with my 64-bit researching and conversions, now I've found myself stucked on an error where the _CONTEXT struct in Winnt.h is involved. The following two fields are only long in that struct, but as you probably know a pointer in x64 is 64-bit and not 32... So, I'm afraid of that the previos cast from Context.Eip and Context.Ebp to a pointer would not work so very well...
Eip
Ebp
So, how to workaround this problem I've tried to find a simple fix but in that research I find myself more and more convinced that it isn't so easy. I'm pretty convinced now that there is some other way to handle the information in that struct in x64, but how
I'm programming in VS2005 but the code is supposed to be platform independant.
TIA

_CONTEXT struct in winnt.h with x64?
martan
Hi,
The context structure is defined at compile-time according to the target-platform pre-processor definitions. winnt.h has several definitions: one for x86, one for x64 etc... The one you get depends upon the platform your compiler is targetting.
It sounds like you're looking at the x86 one. If you're targetting x64 (using either the native or cross x64 compiler), you should get the definition guarded by #ifdef _M_AMD64, which has the appropriate -- 64 bit -- registers defined e.g. Rip instead of Eip, Rbp instead of Ebp etc....
This kind of code is not going to be platform independent. You are after all dealing with the actual registers on the hardware. Your best bet will be do to what the headers do -- have the platform-specific code in separate pre-processor blocks, or in separate compilands.
Hope this was helpful!
TedWagner