Improve company productivity with a Business Account.Sign Up

x
?
Solved

My last points on another ASM question lol

Posted on 2006-11-15
2
Medium Priority
?
387 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 180 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

602 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