Register | Login
Forum Index > Bugs and Fixes > Problem with macro fileread
Author Message
Pages: 1
Molotov
Member
(send private message)

Posts: 49
Topics: 21

Location:
Behind Keyboard
[836] Problem with macro fileread - posted: 2011-11-25 15:41:52
Code:
PlugSys: Emit plugin has loaded!
PlugSys: zirdebug.dll skipped - plugin does not have entry function "InitPlugin"
--------------------------------------------


[15,50]: Expected ( but found , in [macro fileread]
Code: 
  ReadFile($handle, $fbuffer, $maxlen, $fileread, $overlapped);

Press the [enter] key to exit.


when using

Code:
  pointer zFile;
  zFile = filecreate(settingsfile);
  fileread(zFile,settings,512,null);
  fileclose(zFile);


"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[838] - posted: 2011-11-25 20:15:30
decided to take a look at this before i go out to club smile anyways i've fixed a bug with mov instruction but for now i've applied a fix

edit the fileio.zir file and replace fileread with

Code:
inline function fileread(handle, fbuffer, maxlen, overlapped) {
  push 0
  ReadFile($handle, $fbuffer, $maxlen, esp, $overlapped);
  emit byte 0x8B, 0x04, 0x24;     //fix for "eax = [esp];"
  esp += 4;
  $return eax;
}


sample:
Code:
program WIN32CUI 'Test';

#include 'ch.zir';
#include 'fileio.zir';

////////////////////

const SettingsFile = '.\\Settings.dat';

char settings[1024];
pointer hFile;

hFile = fileopen(SettingsFile, OPEN_EXISTING);

fileread(hFile, @settings, 512, nil);

fileclose(hFile);

print('Settings = ', @settings, '\r\n');


wait_key(nil);
ExitProcess(0);



it should be noted that i plan to replace the fileio file with another in one of the upcoming releases, which will change all macro names.

e.g.

fileread will become File_Read(..., fileopen - File_Open(...

anyways for now this will solve your problem smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Molotov
Member
(send private message)

Posts: 49
Topics: 21

Location:
Behind Keyboard
[909] - posted: 2011-11-30 00:49:32
fileread keeps crashing the application, commenting out it and it works..

Exception code: c0000005
Exception shift: 0000314c


Code:
program WIN32CUI 'Test';

#include 'ch.zir';
#include 'fileio.zir';
#include 'strings.zir';
////////////////////

const serverfile = '.\\servers.dat';
const settingsfile = '.\\settings.dat';


function test_fileread() {
  uses edi esi ecx;

  char servers[512];
  
  pointer zFile;
  zFile = fileopen(serverfile,OPEN_EXISTING);
  if(zFile == null) {
    print('Couldn´t open file \r\n');
    return false;
  } else {
    print('File open\r\n');
  }
  fileread(zFile,@servers,512,null);
  fileclose(zFile);
  
}

test_fileread();

wait_key(nil);
ExitProcess(0);


"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[910] - posted: 2011-11-30 10:20:17
will look into it, did id only happen with latest release? what is "Exception shift" ?

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Molotov
Member
(send private message)

Posts: 49
Topics: 21

Location:
Behind Keyboard
[911] - posted: 2011-11-30 10:38:13
beats me what it is i have a swedish win7 and it was saying "Undantags förskjutning" Undantag = eception, förskjutning = shift, google translate says: excluding shift..
Yeah was with latest release.. Haven´t tested with an older version..

"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[912] - posted: 2011-11-30 11:36:54
ok this is fixed in the latest beta

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


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 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