Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

My last points on another ASM question lol

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

772 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