0

I'm doing some random experimentation and want to print out the address the program is at at a given point. I tried doing the following, but it doesn't work:

void foo() {
    DWORD blah;
    __asm {
        mov blah, eip
    }
    std::cout << blah << "\n";
}

and instead gives "improper operand type" on the mov line.

I've tried several types for blah.

Anyone know what I'm doing wrong?

EvanED
  • 947
  • 6
  • 22

1 Answers1

1

There is no mov instruction that can touch the eip register. You'll have to use some kind trick to get its value.

How to check the EIP value with assembly language?

Community
  • 1
  • 1
Jens Björnhager
  • 5,632
  • 3
  • 27
  • 47