flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > short MZ headers

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 28 Feb 2006, 12:15
hi, i noticed fasm is able to produce extremely short EXE headers. They seemed to be working until now, schoolmate reported that same app runs under 2000 but does not execute on XP (systems says it cannot execute this program). I can't try now, but i think this may be issue with headers.

Also HIEW wasn't able to view such headers...

What's different in these short MZ headers compared to "standard" ones?
Post 28 Feb 2006, 12:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Feb 2006, 13:08
There are lots of stuff not running under XP, but working under other operating systems. XP is very cautious and double-checks everything. Even if it may work - it doesn't allow it to run because some errors in header etc.

Same goes to XP complaining about drivers that are for NT/2K. They are not different but they aren't signed "enough" for XP. Go figure Sad

Answer part A to your question:
I think short MZ header is not produced by original FASM but some 3rd party macros (like the raw editing to get ~a hundred byte PE working exe file).

I've noticed inconsistencies in other versions of Windowses. Have you tried running your completely legal files in Win2k3? They just won't work, or hang, or crash...
My friend tried every emulation mode that the Win2k3 had (it was the usual Server Edition), the XP/2K one and the older 9x/ME ones...nothing Sad

Answer part B:
the difference is that it strips the unused parts away because some operating systems scan only few bytes from the beginning. You can even make the bootstrap (512 bytes) header shorter by not jumping, but some BIOSs (like HP does) complain that they can't find any OS.

So there's a question about minimality and security - if you want to be safe, then just use the safest style of headers etc.
Post 28 Feb 2006, 13:08
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 28 Feb 2006, 13:38
Post 28 Feb 2006, 13:38
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 28 Feb 2006, 14:01
may be, but not exactly, it is about 230 bytes. Maybe just a bug:
Code:
format MZ
entry codes:start
stack 256 

offset equ ;tasm syntax


segment datas

_menu db "a - najdi znak",13,10
      db "b - nacitaj novy retazec",13,10
      db "c - ukonci program",13,10
      db "d - vypis usporiadany retazec",13,10
      db "Tvoja volba: $"
_error db "Volba nespravna, skus znova.",13,10,'$'
_newline db 13,10,'$'

segment codes

start:
        mov ax, datas
        mov ds, ax

menu:   mov ah, 09h
        mov dx, offset _menu
        int 21h

        ;nacitanie volby uzivatela
        mov ah, 01h
        int 21h

        ;zistenie co vlastne pouzivatel zadal
        cmp al, 'a'
        je a
        cmp al, 'b'
        je b
        cmp al, 'c'
        je exit
        cmp al, 'd'
        je d
        mov ah, 09h
        mov dx, offset _newline
        int 21h
        mov dx, offset _error
        int 21h
        jmp menu
a:
b:
d:
exit:   mov ax, 4c00h
        int 21h
    


may it be too small stack?
Post 28 Feb 2006, 14:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 28 Feb 2006, 14:34
It works perfectly on Windows 2003 here, I will try it on XP when I'm back home.
Post 28 Feb 2006, 14:34
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Feb 2006, 20:08
Perfect under W2K SP4 too, how's it for You vid?

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 28 Feb 2006, 20:08
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 28 Feb 2006, 21:03
On my XP Media Center 2005 edition it works perfectly, too.
Post 28 Feb 2006, 21:03
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 28 Feb 2006, 21:20
Works ok on WinXP SP2 Professional Very Happy
Post 28 Feb 2006, 21:20
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 01 Mar 2006, 00:36
Seems to run on Win XP Home SP2 (and under DOSbox 0.63, too). Can't understand the text, and it's basically useless, but at least it doesn't crash (for me)! Smile
Post 01 Mar 2006, 00:36
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 01 Mar 2006, 18:14
funny, this problem seems to occur only on one particular school-mate's computer. On other one it crashes on int21h/ah=4C. On others it works...

If i have some time i will try to find out why that one install of XP doesn't want to execute it, but it's not my computer so it maybe won't be possible
Post 01 Mar 2006, 18:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.