flat assembler
Message board for the users of flat assembler.

Index > Windows > Resource in EXE-file

Author
Thread Post new topic Reply to topic
genius



Joined: 10 Mar 2007
Posts: 5
genius
Good afternoon, I badly know English, Sad but I had a problem.

How I can include resource in my program? For example I know how include version and dialog resource. As I can add bitmap, strings, xml-theme and raw data resource to my program? In fasm.pdf I have not found this theme.

Sorry if the similar theme already met at a forum.
Thanks. Smile
Post 10 Mar 2007, 13:35
View user's profile Send private message Reply with quote
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
If you have compiled RES-file you can include one to your EXE-file like this:

Code:
section '.rsrc' resource from 'you_res_file_name' readable
    
Post 11 Mar 2007, 03:29
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
genius wrote:
How I can include resource in my program? For example I know how include version and dialog resource. As I can add bitmap, strings, xml-theme and raw data resource to my program? In fasm.pdf I have not found this theme.

In section 3.1.6 of FASM.PDF you can find the samples of including bitmap and a raw resource on the example of XML manifest. You read the same section online, too.
Post 11 Mar 2007, 14:14
View user's profile Send private message Visit poster's website Reply with quote
genius



Joined: 10 Mar 2007
Posts: 5
genius
Thanks, but I now tihs metohd. Me interests how to include string resource, and bitmap resource in my EXE file, What for this purpose exist macros on FASM. That is how it is possible to include any resources in an EXE-file using only opportunities FASM? Still there is a problem when I include icon in an EXE-file thats link only first image on my icon (icon has 16x16, 32x32 and 48x48 formats it's one file).

Code:
section '.rsrc' resource data readable

  directory RT_GROUP_ICON,group_icons,\
               RT_ICON,icons,\

  resource group_icons,\
           IDI_MAIN,LANG_NEUTRAL,main_icon

  resource icons,\
           1,LANG_NEUTRAL,main_icon_data

  icon main_icon,main_icon_data,'resource\mainicon.ico'
    


Compiller say "No errors", but it's code link only first image on icons. Explain it restrictions of macros or I incorrectly do something.

Thanks.
Post 12 Mar 2007, 15:49
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
Yes, the "icon" macro includes only the first image from .ICO file, if you want multiple images in one icon resource, you have to use separate .ICO files for each one.
Post 12 Mar 2007, 21:50
View user's profile Send private message Visit poster's website Reply with quote
hidden



Joined: 14 Feb 2007
Posts: 49
hidden
Quote:
Still there is a problem when I include icon in an EXE-file thats link only first image on my icon (icon has 16x16, 32x32 and 48x48 formats it's one file).
I have had this problem too, a little modification of icon macro allows you to extract every icon from multi icon file. To found out how many icons in the file, check 3rd word in this file.
Example:
Code:
format PE

include 'win32w.inc'

section '.res' resource

macro multi_icon group,[label,icon_file,num]
 { common local count
    count = 0
   forward local data,size,position
    label dd RVA data,size,0,0
    virtual at 0
     file icon_file:6+(num*16),16
     load size dword from 8
     load position dword from 12
    end virtual
    data file icon_file:position,size
    count = count+1
   common local header
    align 4
    group dd RVA header,6+count*14,0,0
    header dw 0,1,count
   forward
    file icon_file:6+(num*16),12
    dw label#.resid
   common
    align 4 }

  directory RT_ICON, icons,\
            RT_GROUP_ICON, group_icons

  resource icons,\
           1, LANG_NEUTRAL, icon_data1,\
           2, LANG_NEUTRAL, icon_data2,\
           3, LANG_NEUTRAL, icon_data3

  resource group_icons,\
           10, LANG_NEUTRAL, main_icon

  multi_icon main_icon,\
           icon_data1, 'ico103.ico', 0,\
           icon_data2, 'ico103.ico', 1,\
           icon_data3, 'ico103.ico', 2    

_________________
Image Lang: (eng|рус)
Post 20 Mar 2007, 06:10
View user's profile Send private message Reply with quote
genius



Joined: 10 Mar 2007
Posts: 5
genius
Hidden, thank for this macros. I shall necessarily look. Me still interests how to include in EXE-file string resource.
Thanks.
Post 20 Mar 2007, 15:58
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.