My last points on another ASM question lol

Posted on 2006-11-15
Last Modified: 2013-11-23
Is it possible to access the EIP register in Delphi ... i know you can modify the register from the Debug CPU window but I want to be able to access it at runtime...

  mov eax,eip;

Is there a hack?

Rlibby, any information you can shed light onto, the points are yours...
Question by:tobjectpascal
LVL 26

Accepted Solution

Russell Libby earned 45 total points
ID: 17953569

No hack, no go....
The answer is NO. The inline assembler will NOT let you touch the EIP register using inline asm. Using the CPU window, you will not find any asm statement that touches the EIP reg, short of the r-click menu for modifying the reg. Better question is why you need to access the EIP reg?



Author Comment

ID: 17953853
Well.. I wanted to get the EIP, push the location onto the stack then set my own location for it to jump to.. but in the end i did this...

procedure TForm1.Button5Click(Sender: TObject);
 P: Pointer;
 Label Here;
 // lea Eax,[TForm1.Button6Click+$11];
  Lea Eax,Here;
  Push Eax;
  Jmp TForm1.Button6Click;
  Jmp @@out;
  mov Eax,P;
  Jmp P;

procedure TForm1.Button6Click(Sender: TObject);
  Pop Eax;
  Jmp Eax;
 ShowMessage('Hello - not seen');

Which ultimately did what i want...

Well the reason for wanting it was.. I've seen code that allows Push EIP. after closer inspection, i think it's undera a Linux compiler that does it... This morning it suddenly dawned on me that EIP is where the processor is executing the code and when my program gets into a loop, i can just set the pointer to go outside of the loop.. and i was wondering if it's possible to get the location,
maybe write some kind of routine where it detetcs if it's done something wrong i can make it jump back, but then i suppose a Label / goto would do that...

I was getting over excited for nothing lol.

But anyway thanks again :)

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now