flat assembler
Message board for the users of flat assembler.

Index > Windows > resources

Thread Post new topic Reply to topic

Joined: 05 Nov 2005
Posts: 86
daluca 22 Jul 2006, 14:40
Hi: I'm beggining to study win32 assembly and i'm using FASM
with ms coff format as assembler and a program called golink
as linker ,so far i have been able to link succesfully several object files
but i haven't find out the way to create the resource with FASM.
i use simantec resource compiler or vc++ to create binary *.RES files and
gorc to convert these files in object format and finally link all these
obj files with golink.
but i was wondering: if FASM can handle the ms coff file format,
and has macros to deal with resources, is it posible to use FASM
to assemble an obj file containing the resource section? so i don't
have to use third party resource compilers and gorc to convertion.
i just want to depend on FASM and golink.

Post 22 Jul 2006, 14:40
View user's profile Send private message Reply with quote

Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi 22 Jul 2006, 15:13
I'm not sure if fasm can assemble ms coff file containing resources, but fasm does have resource macros(are they macros?), see manual.
Post 22 Jul 2006, 15:13
View user's profile Send private message MSN Messenger Reply with quote

Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 22 Jul 2006, 19:01
If you're talking about MS resource files (.rc and .h) they're standard C++ header files. I don't know how you'd go about it though. I dont' know much about assembly (just starting to read tutorials, but i'm not getting anywhere, just talking about how the hardware is setup at this point), but i am assuming that when you call the resources, you're calling a set of instructions that copies the resources (such as icons for example) to the RAM then some to deal with it there. If i'm right, you could either take the binary data and manually put all the values of it in your ASM file (via variables) or make a bunch of variables which are the exact size of the resource (but all are 0) to take up just enough space, then go into the exe file and hex edit the values in (which would be quicker and easier than putting them into the ASM).

But that's all my simple pre-assembly learning assumption. If you hex edit it in, you might want to make some of the 0s into a string that would help you identify the start and end of the space. I know it sounds like a pain, but if you make them english enough, it should make it alot easier.
Post 22 Jul 2006, 19:01
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote

Joined: 03 Aug 2006
Posts: 29
Xanfa 10 Aug 2006, 03:46
I use VC++6 to create .RES file and do this in my PE file:

section '.rsc' data resource from 'Myresource.res' readable

It's all for my resource section.
I've never work with MScoff format, but sure it's the same as PE format

(read documentation for more !)
Post 10 Aug 2006, 03:46
View user's profile Send private message Yahoo Messenger Reply with quote

Joined: 05 Nov 2005
Posts: 86
daluca 12 Aug 2006, 05:33
thank's Xanfa but what i really want is tu use only the macros that fasm
suplie like:
format ms coff

section '.rsrc' resource data readable

  ; resource directory

  directory RT_MENU,menus,\

  ; resource subdirectories

  resource menus,\

  resource icons,\

  resource group_icons,\

  resource versions,\

  menu main_menu
       menuitem '&File',0,MFR_POPUP
                menuitem '&New',IDM_NEW
                menuitem 'E&xit',IDM_EXIT,MFR_END
       menuitem '&Help',0,MFR_POPUP + MFR_END
                menuitem '&About...',IDM_ABOUT,MFR_END

  icon main_icon,icon_data,'minipad.ico'

              'FileDescription','MiniPad - example program',\
              'LegalCopyright','No rights reserved.',\

but fasm gives error.this macros only work with PE format
resource is just a data section right? but i don't now what simbols
should be public or extern
maybe is posible to create some macros to build this data
i only sai it since fasm can output *.obj files and golink
can link this *.obj files in to the final *.exe including the resources
that must be in *.obj format
i don't want to use any resource compiler only macros like in the
example above.
but thank's anyway
Post 12 Aug 2006, 05:33
View user's profile Send private message Reply with quote

Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 10 Sep 2006, 15:20
.RES files are generally the same as fasm's macros output (.RES files have some header first AFAIK). So it would be possible to do what you want, but these macros use 'RVA' which is reserved for 'format PE'.
Post 10 Sep 2006, 15:20
View user's profile Send private message Visit poster's website Reply with quote

Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 10 Sep 2006, 17:49

You can use FASM macros to create a resource section or use external resource editor and then use it in FASM.

Here is an example on using external resource editor (you need to use "format PE" and not COFF):

1) You build the resources, dialogs, icons, etc using the editor.
You can use MS VC++, Pelles C or ResEd (available at RADasm site).

2) One you save it you get a .rc and need to compile it.
Use gorc (available at http://www.jorgon.freeserve.co.uk/ ) to compile it:

gorc rsrc.rc

And you get a .res file.

3) Include the .res file in your source code:
section '.rsrc' resource data from 'rsrc.res'

data resource from 'rsrc.res'
end data

if you don't want a new section.

4) Assemble the source and test:

fasm mysource.asm

That's it.
If you have any questions I can post an example on both methods (external .res and FASM Resource macros)

To use FASM macros you also need "format PE" and not COFF, I think.
To use coff you need to use external resource editor, compile it to .res and then link:

fasm mysource.asm
gorc myresource.rc
golink mysource.obj myresoyrce.res
Post 10 Sep 2006, 17:49
View user's profile Send private message Reply with quote

Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower 11 Sep 2006, 08:58
But not all so is good, as can seem all over again. I have faced some problems enough for a long time, and they till now are not solved. Anybody and has not prompted their decision, and I not in a condition to solve them. For example, by means of standard macroses who are delivered with FASM, the dialogue window cannot appoint the class and if to use resources record
section '.rsrc' resource data from 'rsrc.res'

and it has not turned out to force to work for me dialogue windows. These questions I lifted all on branches of this forum, and they till now have remained without the answer.

About a problem of work of resource dialogue windows:

About a problem of purpose of a class to dialogue windows:
Post 11 Sep 2006, 08:58
View user's profile Send private message Visit poster's website 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.