Sign in to follow this  
Followers 0
vdo

Any API To Change Compiled Script's ICON Resource

6 posts in this topic

#1 ·  Posted (edited)

Hello All,

I revisited AutoIT since back in about 1999 or 2000, and came to find things had improved drastically.

I just started using it again on a project for a salable software product, and 3 weeks later have quite a nice

application. Thanks to all the big and little contributors for making such a powerful, high-level language.

It's much more than a scripting language now.

The only problem I have not been able to find any answers to yet is this:

I've written an Installer that, upon doing the software install, DOS-"MOVE"s itself into the directory that

the executable code was installed to.

I want to change to Program Icon from it's Installer ICON to an UnInstaller ICON. I would like to not use

ResHacker, because I don't really want to bundle added files, but even if this were OK, the executable is

compressed, and I've had no luck with ResHacker and compressed files. (I want compression...and Obfuscation).

If I'm not mistaken, ResHacker won't work on Compressed files (I don't know about Obf'cated ones).

So, is there some internal windows API or any known way to change the program ICON, or perhaps a pointer,

or ?, such that what displays is different than the original compiled program's resource ICON?

(No, I know how to change the ICON representing all EXE's in Explorer (for example), but I mean the program's

resource ICON...what Windows displays on the desktop, for example.)

There seem to be some pretty Winternal-Savvy guys on this board, so I thought I'd run it by...

Thanks in advance for any help at all...

Edited by vdo

[center][font="Tahoma"]What are all those clowns following me for?[/font][/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I slept on this, and came up with an idea, but it doesn't really solve my question, for which I'm still interested in a solution.

For some possible launching points (eg: Program Menu) I'll change the Icon in the shortcuts. But I'd still like the program

Icon to be able to be changed post-compile somehow...

Anybody?

TIA

Edited by vdot

[center][font="Tahoma"]What are all those clowns following me for?[/font][/center]

Share this post


Link to post
Share on other sites

As an alternative, you can make a separate uninstall compiled script and drop that in the target dir. (FileInstall function can be used to include other files)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

(I don't think your code is relevant to the discussion)

I have thought of another way but it's difficult ... the installer will have to patch itself. But it has some drawbacks, because we want to keep the byte difference to a minimum, you can't use a normal executable packer (like upx) only some "dropper"

Check this out :

1) Compile without upx and with icon set to the one I attach to this post. Then rename the file. (Specifying one icon makes sure that the default 32x32 icon group doesn't get used, also the script is smaller)

2) Compile with another icon of the same dimensions and bit depth. I've included an example, you can edit it with an icon editor or use your own, as long as it's the same size.

3) Compare the differences. When using these 2 icons, the difference is "only" 738 bytes

4) Now you can use some standard file patching, so that when the installer copies itself, it also patches itself. It's gonna be a search'n'replace patching (very easy), so that you don't have to modify anything when changing your original script.

If I get a little time later I can make a test case of a compiled script that copies+patches itself to change its own icon. Unless you give up :)

icons.zip

Edited by Inverted

Share this post


Link to post
Share on other sites

Maybe you could try to translate the code from here: http://www.vbforums.com/showthread.php?t=538301


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Messing with the resources directory is kinda difficult I believe, so you can't just "point" to another resource. Windows just uses the first icon group it finds, so you actually need to change the resource.

Compression complicates the patching procedure even though the first icon group stays uncompressed (otherwise Windows can't use it statically)

It can be done with compression, but it may be more difficult. Should be possible with nice search'n'replace patterns. And won't need adjustments afterwards.

I don't see what the obfuscator has to do with anything, just like the script contents. Irrelevant.

In conclusion, I need to make a script to easily create patterns to change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0