flat assembler
Message board for the users of flat assembler.
Index
> Windows > icon_dataEx |
Author |
|
LocoDelAssembly 01 Jul 2009, 02:04
All possible (well, the first would require "-239" out of the string).
The second, besides doing something like this for every line: Code: db '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' You could have a manifest.xml file and then, inside the source code do this Code:
file 'manifest.xml' That way, the entire content of the file will be included (kinda "include" directive but this one is processed by the assembler stage and the content of the file is included in the output binary as is). The first part, if I understand correctly that fasm must suck the icon from an existing DLL in the same way it does when you provide an icon file then it is possible, but it is not a ten lines of code solution. |
|||
01 Jul 2009, 02:04 |
|
semiono 01 Jul 2009, 07:35
Yes! Manifesto into! (I know about the file 'manifest.xml')
Code: include '%fasm%\win32ax.inc' entry start section '.rsrc' resource data readable directory RT_ICON,icons,RT_GROUP_ICON,group_icons,RT_VERSION,versions,RT_MANIFEST,manifest resource icons,\ 1,LANG_NEUTRAL,icon_data1,\ 2,LANG_NEUTRAL,icon_data2,\ 3,LANG_NEUTRAL,icon_data3,\ 4,LANG_NEUTRAL,icon_data4 resource group_icons,17,LANG_NEUTRAL,main_icon resource versions,1,LANG_NEUTRAL,version resource manifest,1,LANG_NEUTRAL,man icon main_icon,\ icon_data1,'.\Icons\exec_16x16.ico',\ icon_data2,'.\Icons\exec_32x32.ico',\ icon_data3,'.\Icons\exec_48x48.ico',\ icon_data4,'.\Icons\exec_64x64.ico' versioninfo version,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\ 'FileDescription','GetCurrentDirectory',\ 'LegalCopyright','2001-2005 GmbH',\ 'FileVersion','1.0.0.0',\ 'ProductVersion','1.0.0.0',\ 'OriginalFilename','GetCurrentDirectory.exe',\ 'Company','Semiono' resdata man db '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">',13,10 db '<dependency>',13,10 db '<dependentAssembly>',13,10,32,32,32,32,32,32,32,32 db '<assemblyIdentity ',13,10,32,32,32,32,32,32,32,32,32,32,32,32 db 'type="win32" ',13,10,32,32,32,32,32,32,32,32,32,32,32,32 db 'name="Microsoft.Windows.Common-Controls" ',13,10,32,32,32,32,32,32,32,32,32,32,32,32 db 'version="6.0.0.0" ',13,10,32,32,32,32,32,32,32,32,32,32,32,32 db 'processorArchitecture="X86" ',13,10,32,32,32,32,32,32,32,32,32,32,32,32 db 'publicKeyToken="6595b64144ccf1df" ',13,10,32,32,32,32,32,32,32,32,32,32,32,32 db 'language="*"',13,10,32,32,32,32,32,32,32,32 db '/>',13,10 db '</dependentAssembly>',13,10 db '</dependency>',13,10 db '</assembly>',13,10 endres section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',user32,'USER32.DLL' include '%fasm%\api\kernel32.inc' include '%fasm%\api\user32.inc' nBufferLength dw ? lpBuffer db ? start: invoke GetCurrentDirectory,nBufferLength,lpBuffer invoke MessageBox,NULL,lpBuffer,'I''m here:',MB_OK exit: invoke ExitProcess,0 Quote: the first would require "-239" out of the string this is not a code constant, this is a prompt windows comandline number... so as HKLM...Classes\exefile\DefaultIcon = "%1" etc. The properties has not in fasmw dll, icl... _________________ Windows 9, FL Studio 19 |
|||
01 Jul 2009, 07:35 |
|
LocoDelAssembly 01 Jul 2009, 15:06
But if you look shell32.dll with resource hacker don't you see the expected icon in Icon>239 (The shutdown icon?).
Or there is some kind of special icon resource which makes possible to extract the icon from shell32.dll at run-time automatically? |
|||
01 Jul 2009, 15:06 |
|
semiono 01 Jul 2009, 20:47
This is not the case. -239 or (+)239 or 32 and 1
Symply problem how to get any icon (1,2,3) from DLL directly in fasm.asm without extracting before it so like ResHacker tools... The dll's has compactly contains resources then placed separately exec_16x16.ico, exec_32x32.ico.. files in folders. So convenient. Sure: Code: resdata manifest file 'manifest.xml' endres resdata icons file 'icons.dll' endres |
|||
01 Jul 2009, 20:47 |
|
Tomasz Grysztar 01 Jul 2009, 22:07
Be careful what you wish for, because you may get it.
Code: macro extract_resource pe_file,type,id { ; get PE header offset virtual at 0 file pe_file:3Ch,4 load __header_offset dword from 0 end virtual ; load PE header virtual at 0 file pe_file:__header_offset,24 load __number_of_sections word from 6 load __size_of_optional_header word from 20 load __characteristics word from 22 end virtual ; load optional header virtual at 0 file pe_file:__header_offset+24,__size_of_optional_header load __magic word from 0 if __magic = 0x10B load __resource_base dword from 112 load __resource_size dword from 112+4 else load __resource_base qword from 128 load __resource_size qword from 128+8 end if end virtual ; load sections and scan for the one containing the resource virtual at 0 file pe_file:__header_offset+24+__size_of_optional_header,__number_of_sections*40 repeat __number_of_sections load __section_base dword from (%-1)*40+12 load __section_size dword from (%-1)*40+8 load __section_offset dword from (%-1)*40+20 if __resource_base>=__section_base & __resource_base+__resource_size<=__section_base+__section_size __resource_offset = __section_offset+(__resource_base-__section_base) break end if end repeat end virtual ; load all the resource and scan the tree for required entry virtual at 0 file pe_file:__resource_offset,__resource_size load __type_name_count word from 12 load __type_id_count word from 14 repeat __type_id_count load __type dword from 16+__type_name_count*8+(%-1)*8 if __type = type load __type_directory dword from 16+__type_name_count*8+(%-1)*8+4 __type_directory = __type_directory and 7FFFFFFFh break end if end repeat load __id_name_count word from __type_directory+12 load __id_id_count word from __type_directory+14 repeat __id_id_count load __id dword from __type_directory+16+__id_name_count*8+(%-1)*8 if __id = id load __id_directory dword from __type_directory+16+__id_name_count*8+(%-1)*8+4 __id_directory = __id_directory and 7FFFFFFFh break end if end repeat ; take first entry, no matter what language is it load __data_entry dword from __id_directory+16+4 load __data dword from __data_entry+16 load __size dword from __data_entry+16+4 end virtual ; get the data of selected resource file pe_file:__resource_offset+(__data-__resource_base),__size } Code: section '.rsrc' resource data readable directory RT_ICON,icons,\ RT_GROUP_ICON,group_icons resource icons,\ ICON_ID,LANG_NEUTRAL,icon_data resource group_icons,\ 239,LANG_NEUTRAL,main_icon resdata main_icon __group = $ extract_resource 'C:\WINDOWS\system32\shell32.dll',RT_GROUP_ICON,238 load __count word from __group+4 ; count of icons in group store word 1 at __group+4 ; cut to just one icon load ICON_ID word from __group+6+12 endres resdata icon_data extract_resource 'C:\WINDOWS\system32\shell32.dll',RT_ICON,ICON_ID endres |
|||
01 Jul 2009, 22:07 |
|
semiono 01 Jul 2009, 22:33
Oh! Das ist fantastish! Tomasz Grysztar!
Sorry for me! I'm very young and newbie. And more I very low speaking in Eanglish. Big thanks! Yes, good! extract_resource - cool! |
|||
01 Jul 2009, 22:33 |
|
semiono 02 Jul 2009, 00:30
The genuine library shell32.dll 7,99 MB (8 384 000 bytes) is well work with the macro!
But tweaked from original lib shell32.dll 26,6 MB (27 993 600 bytes) - fasm reports Out of memory! Large file or what it? It's fatal? This lib contained 32x32, 48x48 and 128x128 icons. |
|||
02 Jul 2009, 00:30 |
|
LocoDelAssembly 02 Jul 2009, 01:25
Perhaps you have FASMW configured to use little memory?
Try going to Options>Compiler setup... and increase the amount of memory (you are not forced to pick one of the list, write your own size if you have to). The size is expressed in KiB. |
|||
02 Jul 2009, 01:25 |
|
semiono 02 Jul 2009, 05:22
OK!
Last edited by semiono on 24 Feb 2013, 00:02; edited 1 time in total |
|||
02 Jul 2009, 05:22 |
|
semiono 24 Feb 2013, 00:01
I'm high!
Code: [Compiler] Memory=524288 |
|||
24 Feb 2013, 00:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.