flat assembler
Message board for the users of flat assembler.

Index > Windows > EXE file icon

Thread Post new topic Reply to topic

Joined: 29 Oct 2016
Posts: 7
Constantine 29 Oct 2016, 07:33
I need to create icon of my exe file. I wrote resources section as specified in docs:

section '.rsrc' resource data readable
  directory RT_ICON, icons, RT_GROUP_ICON, group_icons
  resource icons, 1, LANG_NEUTRAL, icon_data
  resource group_icons, 2, LANG_NEUTRAL, main_icon
  icon main_icon, icon_data, 'file.ico'

file.ico contains 10 icons of various sizes and bit depths. But resulting exe file got only one icon: 32x32x4. What should I change to get full range of icons in executable?
Post 29 Oct 2016, 07:33
View user's profile Send private message Send e-mail Reply with quote

Joined: 24 Mar 2012
Posts: 701
Location: Russian Federation, Sochi
ProMiNick 29 Oct 2016, 23:25
smsng like that (there bugs inside it is only idea)
macro multyicon group,[label,icon_file] ; usage multyicon instead of icon:  multyicon main_icon,<icon_data1_at_fileico,icon_data2_at_fileico,...>,'file.ico'
 { common local count
    count = 0
   forward ;local lcount
      irpv lbl,label \{
        local data,size,position
        lbl dd RVA data,size,0,0
        ;virtual at 0
        ;  file icon_file:4,2
        ;  load lcount word from 0
        ;end virtual
        ;% must be <=lcount
        virtual at 0
        file icon_file:6+16*(%-1),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
     irpv lbl,label \{
       file icon_file:6+16*(%-1),12
       dw lbl#.resid
    align 4 } 

And of course you can split 1 ico file to 10 by sm progs like microangelo and use standard macro.

Thou ever can split ico with fasm:

; must be compiled as many times as subicons file has
; source icon should be in other folder than code or it will be overriden
; source code each time should be renamed or each previous ico will be overriden
format binary as 'ico'
macro extractico icon_file,num
  virtual at 0
  file icon_file:4,2
  load count word from 0
  if count<num
    err 'Индекс иконки превысил количество'
  end if
  end virtual
  file icon_file,4
  dw 1
  file icon_file:6+num*16,16
  load size dword from $-8
  load offset dword from $-4
  file icon_file:offset,size
extractico 'file.ico',1 ; change that from 1 to ico count in file 

Thou can think how to implement 1st case, or use 2nd and don`t think.

I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 29 Oct 2016, 23:25
View user's profile Send private message Send e-mail 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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.