ver class - Version Resource editing - 2021/08/01 - beta.1

Post your working scripts, libraries and tools.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

ver class - Version Resource editing - 2021/08/01 - beta.1

18 Jul 2021, 08:49

This was inspired by the Ahk2Exe VerResource.ahk lib file. I wanted an AHK v2 version so I can build my way up to possibly making an AHK v2 version of Ahk2Exe.

File Props example.png
File Props example.png (17.66 KiB) Viewed 1803 times

I (finally) managed to make editing version info resources super simple. This is a self-contained class to do it all.

This will also be part of a suite of classes for editing resources, later to include icons and RCDATA, and maybe others.

Thanks to the contributers of Ahk2Exe for all the well written examples that I was able to learn from!

:arrow: Download on GitHub

==================================================
Updates
==================================================
Last edited by TheArkive on 01 Aug 2021, 15:22, edited 1 time in total.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

01 Aug 2021, 11:34

2021/08/01
  • slightly condensed code for better readability
  • renamed file to something more appropriate
  • Changed output of ListValues() method to be an array
  • Combined "Load()" and "Read()" methods into just "Load()"
  • Simplified / updated example
  • General functionality is been modified to meet the icons class halfway, in order to make using these classes together more fluid
  • Apply() method now requires params. Can be used to add/remove resources for specified langs.
  • List() method now returns the list of version resources stored.
  • cp/lang/oldLang properties are now integers. They were strings.
  • Fixed inability to add new strings to the StringTable.
  • updated docs
tranht17
Posts: 52
Joined: 03 May 2017, 02:55

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

15 Mar 2022, 04:43

Hi ! This lib only works with exe compiled by Autohotkey, how to work with other files?
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

20 Mar 2022, 07:32

tranht17 wrote:
15 Mar 2022, 04:43
Hi ! This lib only works with exe compiled by Autohotkey, how to work with other files?
I just tested it with explorer.exe, it works fine. (I copied explorer.exe to the script dir for the test.)

Make sure you change the value of the sFile var at the top of the example. Also make sure the path to that file is correct.

NOTE: I suggest you copy the file you want to modify into the script dir, and don't attempt to modify the original until you are able to get a successful test in the example.
tranht17
Posts: 52
Joined: 03 May 2017, 02:55

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

21 Mar 2022, 03:51

I have tried several files:
- explorer.exe -> OK
- firefox.exe -> OK
- vmware.exe (VMware Workstation ) -> OK
- SnagitCapture.exe (Snagit) -> doesn't change anything
- Setup Capture.exe (VMware ThinApp) -> file error 35MB -> 334KB
- File created by 7z SFX -> file error
Thanks !
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

21 Mar 2022, 05:58

@tranht17
Ok thanks for the report. I'll try to find the cause, and maybe update error messages
User avatar
thqby
Posts: 406
Joined: 16 Apr 2021, 11:18
Contact:

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

21 Mar 2022, 06:40

If the PE file has a compressed shell, it may not be possible to simply export resources from the outside.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: ver class - Version Resource editing - 2021/08/01 - beta.1

22 Mar 2022, 00:16

@thqby

Thanks. That will help guide my efforts. I figured some kind of nonstandard file packaging was at play.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: arcylix, kunkel321, Spydor and 24 guests