Solved

My last points on another ASM question lol

Posted on 2006-11-15
2
375 Views
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...

Asm
  mov eax,eip;
End;

Is there a hack?

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

Accepted Solution

by:
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?

Russell

0
 
LVL 4

Author Comment

by:tobjectpascal
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);
Var
 P: Pointer;
 Label Here;
begin
 P:=@Button5.OnClick;
 Asm
 // lea Eax,[TForm1.Button6Click+$11];
  Lea Eax,Here;
  Push Eax;
  Jmp TForm1.Button6Click;
  Jmp @@out;
  mov Eax,P;
  Jmp P;
  @@out:
 End;
 Here:
 ShowMessage('Seen');
end;

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


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 :)
0

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