flat assembler
Message board for the users of flat assembler.
Index
> Windows > How to embed an icon in the .asm source? |
Author |
|
macomics 30 Aug 2021, 23:48
macro icon group,[label,icon_file]
{ common local count count = 0 forward local data,size,position label dd RVA data,size,0,0 virtual at 0 file icon_file:6,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,12 dw label#.resid common align 4 } This line includes the data in the program It can be replaced with a construction of the following type Code: if icon_file eqtype "" data file icon_file:position,size end if //-------------- Code: label dd RVA data,size,0,0 virtual at 0 file icon_file:6,16 load size dword from 8 load position dword from 12 end virtual This piece reads the location of the icon data and their length from the file header It can be replaced with . . . Code: if icon_file eqtype "" label dd RVA data,size,0,0 virtual at 0 file icon_file:14,8 load size dword from 0 load position dword from 4 end virtual else label dd RVA icon_file,icon_file.#sizeof,0,0 end if //----------------- Code: file icon_file:6,12 This line adds a description of the icon in the resources It can be replaced with . . . Code: if icon_file eqtype "" file icon_file:6,12 else dq icon_file#.header_data dd icon_file#.sizeof end if //------------------------ And then you can pass a label to your data array instead of the file name (or file name), and you should define two values for the array Code: myarray db ... (any icon data) ... .sizeof = $ - myarray .header_data = (Icon header values, 8-byte) |
|||
30 Aug 2021, 23:48 |
|
Meowthist 31 Aug 2021, 01:31
Thanks so much!
Forgive me please, I didn't say that my icon data bytes are the whole content of the icon file. Therefore .sizeof = $ - myarray - 22. And .header_data are 8 bytes beginning from the 6th byte of the array, I figured out, great! Last edited by Meowthist on 31 Aug 2021, 04:18; edited 2 times in total |
|||
31 Aug 2021, 01:31 |
|
Meowthist 31 Aug 2021, 02:49
Many thanks again!
I have just rewritten the code AND I SEE IT WORKS! Code: format PE GUI 4.0 include 'INCLUDE\win32a.inc' ret macro myicon group,[label] { align 4 label dd RVA iconbody,103,0,0 iconbody db 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,1,0,0 db 0,1,0,1,3,0,0,0,102,188,58,37,0,0,0,3,80,76,84,69,214,58,242,88 db 100,57,17,0,0,0,31,73,68,65,84,120,1,237,193,1,1,0,0,8,2,160,254 db 175,238,70,41,48,0,0,0,0,0,0,0,0,207,45,33,0,0,1,132,95,242,171 db 0,0,0,0,73,69,78,68,174,66,96,130 align 4 group dd RVA header,20,0,0 header dw 0,1,1 db 0,0,2,0,1,0,1,0,103,0,0,0 dw label#.resid } section '.rsrc' resource data readable directory 3,icons,14,group_icons resource icons,1,0,icon_data resource group_icons,17,0,main_icon myicon main_icon,icon_data |
|||
31 Aug 2021, 02:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.