flat assembler
Message board for the users of flat assembler.

Index > Windows > fixups: "section" or align 16 "data"?

Author
Thread Post new topic Reply to topic
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix
Hi, everybody!
The question is about fixups: which method is better - declare them with
Code:
section '.reloc' fixups    

or
Code:
align 16
data fixups
end data    

?
First case - is guarantee to work on all Windows, but declaring new section often add 512 bytes to DLL. Second case - smaller size of executable file, but as far as I remember and tested far ago - do not load such DLL on Win98 in some cases. Now I haven't any opportunity to test it on Win earlier than XP, so please - tell your opinion and if you have such Windows installed, please check if it works with aligned 16 "data fixups".
Thanks a lot.

_________________
Flat Assembler is the best!
Post 10 Jan 2009, 19:42
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Both work fine under Win2K pro.
Post 10 Jan 2009, 20:23
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
I have tested a DLL on Win{95, 98SE, Me, 2000, XP, Vista} with "data fixups" instead of separated section and it worked on all the mentioned OSes and also in WINE. Also the exports and imports are set with the data directive rather than a separated section for each one. I don't have 16 byte alignment though, but I can't guarantee you that it is not needed (perhaps I'm already aligned in all cases). The type of data that I always needed alignment was "data resource", unless an "align 4" is present before the data directive then depending on whether $ is aligned to 4 or not determines if the program will run correctly (at least on XP).
Post 10 Jan 2009, 22:46
View user's profile Send private message Reply with quote
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix
Thanks a lot! No more "section" - only "data" )))))
Post 10 Jan 2009, 23:40
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
Doesn't work on Windows 98 SE:
Code:
        format  pe gui 4.1 dll at 0x00400000
        entry   DllEntryPoint
        include 'win32a.inc'

DllEntryPoint:
        mov     eax,[esp+0x08]
        dec     eax
        jnz     .exit
        mov     edx,[esp+0x04]
        mov     [hInstance],edx
        stdcall [OutputDebugString],_loaded
    .exit:
        xor     eax,eax
        inc     eax
        retn    0x0c     

        data    import
        library kernel32,'KERNEL32.DLL'
        include 'api/kernel32.inc'
        end     data

_loaded         db      'DLL is loaded!',0
hInstance       dd      ?

        data    fixups
        end     data
    
Post 11 Jan 2009, 13:49
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
The attached example works for me on Win98SE.

The DLL I was referring to had a code section and a data section and in the latter all the data directories were declared (import, export and fixups).

BTW, now I'm not sure if Win95 works because I don't have it on my virtual machines set, perhaps I did the test on my old Cx586 which has Win95 OSR2 as I remember I tested all the Windows versions I had but I cannot test now.


Description:
Download
Filename: fixups.zip
Filesize: 1.5 KB
Downloaded: 48 Time(s)

Post 11 Jan 2009, 15:39
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
LocoDelAssembly, thank you. It works.
Post 11 Jan 2009, 20:24
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.