AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

is there any error in this function

Ein Thema von randy_dom · begonnen am 20. Mär 2012 · letzter Beitrag vom 20. Mär 2012
Antwort Antwort
randy_dom

Registriert seit: 28. Apr 2008
17 Beiträge
 
#1

is there any error in this function

  Alt 20. Mär 2012, 11:38
Delphi-Version: 7
here is my function

Delphi-Quellcode:
Function call_to_func(mem, a, c: DWORD): integer;
var
b: integer;
begin
b := 0;
writeln(format('call_to_func: mem=%X a=%X c=%X',[mem,a,c]));
asm
mov ecx,a
mov edx,c
mov eax, mem
push ecx
call eax //--->!!! Program try to call assembled code which is stored in mem pointer
pop ecx
mov b, eax
end;
call_to_func := b;
end;
But when i call it i get an AV

Access violation at address 01496180. Write of address 01496180
...........
01496180 push esi ; <-- EXCEPTION
............

call_to_func works correctly
and assembled function called by "call eax"
but this assembled function can not push register??!!
stack not writeable???
All this under windows 7 .


Please is there any error in the above Function ?


many thanks
  Mit Zitat antworten Zitat
Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#2

AW: is there any error in this function

  Alt 20. Mär 2012, 11:52
Delphi-Quellcode:
Function call_to_func(mem, a, c: DWORD): integer;
var
b: integer;
begin
b := 0;

asm
mov ecx,mem
mov edx,c
mov eax, a
push ecx
call ecx //--->!!! Program try to call assembled code which is stored in mem pointer
pop ecx
mov b, eax
end;
call_to_func := b;
end;
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat
randy_dom

Registriert seit: 28. Apr 2008
17 Beiträge
 
#3

AW: is there any error in this function

  Alt 20. Mär 2012, 12:17
thank you Bummi , But can you explain me what's the difference between my function and your modified one ?
  Mit Zitat antworten Zitat
Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#4

AW: is there any error in this function

  Alt 20. Mär 2012, 12:25
my assembler time is years ago, perhaps this will help
http://www.delphipraxis.net/8982-inl...uebergabe.html
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz