Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 28th February 2015, 01:48   #1
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
HeadOp.nsh: exehead-related macros (manifest, resources, upx)

Macros to:

- add additional SupportedOS GUIDs to manifest
- add/overwrite/delete resources
- perform custom operations
- pack with UPX

Allows in-script combining of operations, without the need for external batch files.

Note: NSIS 2.x Unicode is not supported. I will add support if requested but it requires some workarounds and I didn't want to complicate the code needlessly. There are legitimate reasons for sticking with 2.46 until 3.0 is officially stable but it is not the case with Unicode fork, in my opinion.
Attached Files
File Type: nsh HeadOp.nsh (9.7 KB, 133 views)

PostEnd:
aerDNA is offline   Reply With Quote
Old 1st March 2015, 20:39   #2
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
For the sake of completeness I added 2.x Unicode support, as a separate nsh.
Attached Files
File Type: nsh HeadOp_246U.nsh (19.8 KB, 116 views)

PostEnd:
aerDNA is offline   Reply With Quote
Old 3rd March 2015, 12:52   #3
stass
Senior Member
 
Join Date: Nov 2012
Posts: 144
aerDNA
Thanks for HeadOp.nsh
Unfortunately, the program Resource Hacker only works well with .res files ...
Is it possible to add in HeadOp.nsh, convert script files .rc in .res ?
( for example, on the basis of utility brcc32.exe ? )
stass is offline   Reply With Quote
Old 3rd March 2015, 13:07   #4
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
It requires .res for certain resource types like dialog. Why is that a problem? Do your editing in ResHacker and export as .res instead of .rc.

PostEnd:
aerDNA is offline   Reply With Quote
Old 3rd March 2015, 13:15   #5
stass
Senior Member
 
Join Date: Nov 2012
Posts: 144
I must first edit the file .rc in stand-alone applications, and only then, change the resource ... We need a converter ...
stass is offline   Reply With Quote
Old 3rd March 2015, 15:34   #6
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
Try this: before ${AddReplaceResource} use:
${CustomHeadOp} '"${ResHackerPath}" -extract ".rc path", ".res path", ,,'

PostEnd:
aerDNA is offline   Reply With Quote
Old 4th March 2015, 13:01   #7
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
Update

I guess it can be handy to be able to edit a dialog in notepad while scripting so I added rc2res as a dedicated macro. Also added validation of paths along with some minor changes.
.nsh in the first post is 9926 bytes, which is the same as Win10 preview build number, so clearly it wasn't destined to be the final version.
Attached Files
File Type: nsh HeadOp.nsh (11.2 KB, 159 views)
File Type: nsh HeadOp_246U.nsh (22.9 KB, 88 views)

PostEnd:
aerDNA is offline   Reply With Quote
Old 4th March 2015, 15:04   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,636
Why do you need two separate versions?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th March 2015, 15:42   #9
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
Portions of code are different in HeadOp_246U, mainly beause !appendfile outputs unicode. I could cram it all up in one nsh with version checks but it's cleaner this way. Also, to keep in line with Unicode fork conventions, nsh is unicode.

PostEnd:
aerDNA is offline   Reply With Quote
Old 5th March 2015, 12:59   #10
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
!appendpost^ HeadOp_246U.nsh does Type File1 > File2 to convert !appendfile output to ansi. It works and I can't think of a real reason not to do it but it still feels sort of hacky.
To clarify for anyone who might be wondering, 'normal' nsh works perfectly fine in 3.0b1 with Unicode true. For unicode installers, 3.0 is what people should be using. As far as I'm concerned, Unicode fork was a pivotal step but is now deprecated. 3.0b1 has less issues (if any) even though it's officially still in beta.

PostEnd:
aerDNA is offline   Reply With Quote
Old 23rd June 2015, 14:51   #11
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
Update

Nice to see ResHacker development resurrected but v4 broke rc2res macro.
Attached Files
File Type: nsh HeadOp.nsh (11.6 KB, 71 views)
File Type: nsh HeadOp_246U.nsh (23.8 KB, 60 views)

PostEnd:
aerDNA is offline   Reply With Quote
Old 12th December 2017, 18:57   #12
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
There were major changes to ResHacker command line syntax and HeadOp macros were broken as a result. I noticed this with only 2 years lag (better late than never).
Attached is the fixed version, for use with ResHacker v4.5.28 and newer.
Attached Files
File Type: nsh HeadOp.nsh (11.5 KB, 20 views)

PostEnd:
aerDNA is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump