Register | Login
Forum Index > Source Help > fastcall question
Author Message
Pages: 1 2
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[286] fastcall question - posted: 2011-11-03 20:09:55

when ues fastcall do i have to move first param into Eax , and second param into Edx and so on or it automatically done by Ziorn

for example i am implement a simple strcpy function like this
Code:
function fastcall strcpy(Dword src,dst)
{ 
  Eax = src; 
  Edx = dst; 
  push Edx;
  BL = BYTE [Eax]; 
  while ( BL != 0)  
   { 
      BYTE [Edx] = BL; 
      Eax++; Edx++; 
      BL =  BYTE [Eax]; 
   }  
  [Edx] = 0;
  pop Eax;
} 


or like this

Code:
function fastcall strcpy(Dword src,dst)
{ 
// eax already holds src and edx holds dst
  push Edx;
  BL = BYTE [Eax]; 
  while ( BL != 0)  
   { 
      BYTE [Edx] = BL; 
      Eax++; Edx++; 
      BL =  BYTE [Eax]; 
   }  
  [Edx] = 0;
  pop Eax;
} 



http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[287] - posted: 2011-11-03 20:19:16
it is done automatically, so the first 3 variables are just register references, in your case

src = eax
dst = edx

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[288] - posted: 2011-11-03 20:27:48

ok ,

when calling my function like this i got error
invalid operand "mov eax, 5000"
Code:
    char  buf[5000];
    DWord Len;
    strcpy(@buf,'mov eax, 5000');



http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[289] - posted: 2011-11-03 20:29:44
yes, i've just been playing around with this, and it seems i have left out some support for a few different types of operands related to fastcall and zircall - i'm going to look into this now, and hopefully have a fix updated later.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[292] - posted: 2011-11-03 21:10:51

ok

i was plaing with plugin system , got this red error when test a program that uses the plugin.

Access violation at address 00405786 in module 'Ziron.exe'. read of address ffffec74
Code:
function event_Test() {
    uses edi;
    char  buf[5000];
    DWord Len;
    strcpy(@buf,'\'mov eax, 5000\'');
    Len = strlen(@buf);
    Ziron_ShowMessage(@buf);
    eax = Ziron_Execute(@buf,Len);
    if (eax == false) {
        Ziron_FatalError('myCMD plugin is not compatible with this version of Ziron');
     }  
    
    eax = true;
}


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[293] - posted: 2011-11-03 21:13:22
i will look into the access violation but

Code:
    strcpy(@buf,'\'mov eax, 5000\'');


this line is putting

"'mov eax, 5000'" into the buffer and executing it, you can not execute a string value.

you need to remove the \'

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[294] - posted: 2011-11-03 21:15:20

remove \ done.

still have the error.


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[295] - posted: 2011-11-03 21:26:56
looking into this now, will let you know asap.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 3 user(s) online. 0 member(s) and 3 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd