Solved

My last points on another ASM question lol

Posted on 2006-11-15
2
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

718 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