flat assembler
Message board for the users of flat assembler.

Index > Windows > section align with "format PE"

Author
Thread Post new topic Reply to topic
jekyll



Joined: 25 May 2004
Posts: 14
jekyll
How can I do section align with format PE?
Post 22 Jun 2004, 12:56
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
fasm chooses most minimal amount for you (512-bytes for PE EXE/DLL, 32-bytes for .SYS drivers)
there is no way to set an arbitrary amount

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 22 Jun 2004, 14:10
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
jekyll



Joined: 25 May 2004
Posts: 14
jekyll
May be Privalov will do it in next version? PE with sections aligned 32-bytes would be nice.

ps. sorry for my english
Post 22 Jun 2004, 20:23
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Quote:

PE with sections aligned 32-bytes would be nice

And wouldn't run on all windows versions Smile
Post 22 Jun 2004, 22:55
View user's profile Send private message Visit poster's website Reply with quote
jekyll



Joined: 25 May 2004
Posts: 14
jekyll
it's not important
Post 23 Jun 2004, 23:35
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Quote:

it's not important

Certainly depends what you're doing, and who you are targetting! Sure, would be a nice feature to have (and I can't see any reason not to do it, except avoiding "red tape").

I just hope that people using such a feature will know that their program won't work everywhere - just like executables without imports.
Post 24 Jun 2004, 04:24
View user's profile Send private message Visit poster's website Reply with quote
Torrey



Joined: 12 Oct 2003
Posts: 78
Torrey
f0dder wrote:
Quote:

it's not important

I just hope that people using such a feature will know that their program won't work everywhere - just like executables without imports.


I've never really understood why people say executables without imports don't work. In my experience, and tonight even I tested out a quick one, on the win9x/me and xp windows platform and it worked perfectly fine.

Are there specifics to this?
Post 24 Jun 2004, 04:58
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Try windows 2000, and possible NT4 as well. It's not even "no imports", it's "importing from kernel32.dll". Or rather, "ending up importing from kernel32.dll", it's enough importing say GDI32.DLL since it imports from kernel32. (Could be that the required import is really NTDLL, but I think it's KERNEL32). It "most likely" has to do with how and where the initial thread is started in your process...
Post 24 Jun 2004, 06:23
View user's profile Send private message Visit poster's website Reply with quote
XpoZed



Joined: 21 Mar 2004
Posts: 7
Location: Bulgaria
XpoZed
My progs writen in FASM dont work under XP (actually don't work as they must do) did you know why ?
Post 20 Jul 2004, 10:09
View user's profile Send private message Reply with quote
XpoZed



Joined: 21 Mar 2004
Posts: 7
Location: Bulgaria
XpoZed
Ooops... sorry i fix it =)
Post 20 Jul 2004, 10:38
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
jekyll wrote:
it's not important


its important to have control

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 20 Jul 2004, 18:19
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
jekyll



Joined: 25 May 2004
Posts: 14
jekyll
Quote:
its important to have control

Yes. But why this feauture not implemented in FASM? =(
Post 22 Jul 2004, 21:47
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
jekyll wrote:
Quote:
its important to have control

Yes. But why this feauture not implemented in FASM? =(


Privalov?

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 22 Jul 2004, 23:00
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark
Would be nice if i can switch between 512 and 4096 section alignment for XP and 98.
Post 23 Jul 2004, 04:57
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7711
Location: Kraków, Poland
Tomasz Grysztar
The 512 alignment for sections in file is a requirement and it should not be changed. The 4096 alignment of sections in memory is needed to allow correct setting of permission flags for section pages, the exception are drivers, which don't utilize the paging mechanism and require memory offsets to reflect the ones in file. So FASM uses 512 memory alignment for drivers (with "PE native" setting) and 4096 for any other file.

The limitation to use only standard alignment in general PE files is needed to keep FASM able to be literal in generating what you've specified (which was always the priority in the FASM's design) - to make the permission flags you specify for the section be correctly set, section needs to be page-aligned.

If you want to hack more into PE structure, you may use a binary output mode of fasm for this purpose - there were some examples floating around.
Post 23 Jul 2004, 05:51
View user's profile Send private message Visit poster's website Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark
Privalov wrote:
So FASM uses 512 memory alignment for drivers (with "PE native" setting) and 4096 for any other file.


Do you mean file alignment?
Im sorry on a bit obscured because of my English. My 'section' meant file alignment like specifing at linking time by using the /align:0x200 or /align:0x1000 and /opt:nowin98 to select 0x200 bytes or /opt:win98 to select 0x1000 bytes switchs if you ever use link.exe of MS.

Code:
                                             |----------|<-I mean them
section    virtual size    virtual offset    raw size   raw offset
.text      00000004        000001A0          00000020   000001A0
    


Do you guys talking about this or am i just misunderstood something? Question
Post 23 Jul 2004, 11:38
View user's profile Send private message Reply with quote
jekyll



Joined: 25 May 2004
Posts: 14
jekyll
> Do you guys talking about this?
Yes.
Post 26 Jul 2004, 00:33
View user's profile Send private message Reply with quote
BlueOwl



Joined: 02 May 2004
Posts: 14
BlueOwl
But, Privalov: The filealignment could be discarded for the last section right? (Maybe this could be an option?)
Post 28 Jul 2004, 22:29
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 29 Jul 2004, 00:09
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger 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-2020, Tomasz Grysztar.

Powered by rwasa.