flat assembler
Message board for the users of flat assembler.

Index > Windows > Simple method of adding resources to Fasm

Author
Thread Post new topic Reply to topic
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 08 Jul 2003, 09:02
Hi friends,

You can add compiled resource scripts to the executables assembled with
Fasm.The method is based on using a free resource linker (6.5Kb.)
from the Sphinx C-- website.

1)First,you add an "empty" resource section to the end of your source
file,this provides enough room for the resource section in the PE
object table:
Code:
section '.rsrc' resource data readable
    


2)Assemble the source file.
3)You delete the resource section body and add the compiled resource
file(.res) to the executable.This trick of "removing the resource section"
is required;otherwise the executable will not run on Win XP:
Code:
rl menu.exe /d
rl menu.exe rsrc.res /a
    


The advantage of this method that you can use directly all your resource
scripts with Fasm,just enough to have the final compiled resource file
(.res)
Another advantage;you don't need of .obj files.

A very usefull and free resource editor available from Hutch's homepage:

http://www.movsd.com/download/nre.exe

The free resource linker (included in the attachment):

http://sheker.chat.ru/rl.zip


Description:
Download
Filename: FASMRSRC.ZIP
Filesize: 14.92 KB
Downloaded: 753 Time(s)


_________________
Code it... That's all...
Post 08 Jul 2003, 09:02
View user's profile Send private message Visit poster's website Reply with quote
Aquila



Joined: 21 Jun 2003
Posts: 16
Location: Russia, Moscow
Aquila 08 Jul 2003, 12:15
Great. And this method can improved to make it easy for using with fasmw:

1. Make one exe using method above
2. Rename exe as 'dummy.exe'
3. Use tdump (for example) to know offset and size of .res section
4. Then write in your source:
Code:
section '.rsrc' resource data readable
file 'dummy.exe': 800h, 200h ; see file syntax and put actual values
    
Post 08 Jul 2003, 12:15
View user's profile Send private message Visit poster's website Reply with quote
Blag



Joined: 04 Jul 2003
Posts: 90
Location: Perú
Blag 08 Jul 2003, 14:55
Thanx Vortex and Aquila......i'm a newbie in FASM, but i know programming for a long time....and i can see that this is a great contribution. Very Happy

_________________
Alvaro Tejada Galindo
SinglePath games design
http://www.iespana.es/singlepath
Post 08 Jul 2003, 14:55
View user's profile Send private message MSN Messenger Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark 09 Jul 2003, 01:59
I just put the blank resource section to the last and use ResourceEditor and PEditor to edit (easy to expand in the future).
Post 09 Jul 2003, 01:59
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 09 Jul 2003, 23:35
Aquila: that might not work because resource data contains some RVA addresses and these can be changed when you place your resource section in some other place of file.
Post 09 Jul 2003, 23:35
View user's profile Send private message Visit poster's website Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 18 Jul 2003, 13:55
Aquila,

Have you tried Resource Hacker?

Quote:

Resource Hacker is a freeware utility to view, modify, rename, add, delete and extract resources in 32bit Windows executables and resource files (*.res). It incorporates an internal resource script compiler and decompiler and works on Win95, Win98, WinME, WinNT, Win2000 and WinXP operating systems.


http://www.users.on.net/johnson/resourcehacker/

_________________
Code it... That's all...
Post 18 Jul 2003, 13:55
View user's profile Send private message Visit poster's website Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 21 Sep 2004, 15:33
Hi friends,

Another method of embedding resources is to read binary resource data bytes from a .res file. This is equivalent to a dialog box template in memory.
Code:
pDlgbox FILE 'Rsrc.res' : 50h ;Skip the header to read directly binary resource data
    


This trick appears to be O.K for simple dialog box resources.

Without the resource section, the size of the final executable drops down by 512 bytes.


Description: Simple method of creating dialog box template in memory
Download
Filename: DlgRes.zip
Filesize: 2.38 KB
Downloaded: 646 Time(s)


_________________
Code it... That's all...
Post 21 Sep 2004, 15:33
View user's profile Send private message Visit poster's website 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.