RE: error C2039: 'Eip' : is not a member of '_CONTEXT'

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Since I put this out here myself I can call it a stupid question. :-(

So just in case if someone reads this that doesn't know the hardware
architecture is different between win32 and x64 so the names of the registers
are different to accomodate the 64 bit width, I suppose they could have used
the same names, but who knows.

Several good articles on this

http://msdn.microsoft.com/en-us/magazine/cc300794.aspx

Just to get you going.

--
Scott Norberg


"Scott" wrote:

I have broken this down to a very simple 3 line program. When I compile in 32
bit mode it compiles, switching to 64 bit I get the above error.

I am running on a Vista 64/Ultimate using VS2008. For this example I created
a console application:

#include <stdafx.h>

int _tmain(int argc, _TCHAR* argv[])
{
CONTEXT ctx;

DWORD dwEip = ctx.Eip;
return 0;
}
The stdafx looks like:
#pragma once
//#define _AMD64_
//#define _IA64_
#include <stdio.h>
#include <tchar.h>
#include <windows.h>

#include "targetver.h"

I have tried defining either _AMD64_ or _IA64_ with varying results.

If I use _AMD64_, which is appropriate for the computer I am on, I get the
above error.

Defining _IA64_ I get

error C3861: '__readgsqword': identifier not found

This is probably reasonable since I am on multiCore DELL box using an Intel
chip set.

Shouldn't the project just switch when I change my project type from Win32
to X64? What needs to be defined to get this to work correctly?

Looking at WinNT.h it seems that defining _AMD64_ should bring in the
correct version of _CONTEXT but it doesn't.

So how is this supposed to work? I have other programs that I have
converted from WIN32 to X64 without (major) issue.


--
Scott Norberg
.



Relevant Pages

  • Re: different platform in MS visual studio
    ... Do you mean I can build the solution in Win32, but run it on x64? ... But can I do it vice versa? ... you can compile in either platform for the other platform. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: File Mapping: Win32 differs from x64??
    ... So what you are saying is that in x64 I will have to re-use my file ... Win32 allows a file to be opened twice by the same process and x64 ... So why is Win64 mentioning "another process"?? ... Tim Roberts, timr@xxxxxxxxx ...
    (microsoft.public.win32.programmer.kernel)
  • Re: different platform in MS visual studio
    ... I am a newbie in Microsoft visual studio. ... I use Win32. ... solution on x64, can I? ... Win32 platform? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: 32 to 64 bit porting question
    ... WIN32 defined on my pre-processor settings. ... Do I have to define WIN64 or not? ... You mentioned that if you pick X64, ...
    (microsoft.public.vc.language)