AHK_H Compiler Oddities

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

AHK_H Compiler Oddities

Post by LBJ » 21 Feb 2022, 21:31

G'day All,

I've just downloaded the latest AutoHotkey_H master from...

https://github.com/HotKeyIt/ahkdll-v2-release/archive/refs/heads/master.zip

Using the included Ahk2Exe to compile scripts, quite a lot (probably most) v2 code that runs normally as a standard .ahk script with AHK_H installed, results in a compiled .exe that reports errors and fails to run.

This happens when the "Use Compression" and "Encrypt" boxes are checked.

The following example script runs normally as a .ahk script with AHK_H installed, but after compiling with "Use Compression" and "Encrypt" checked, the .exe displays an error and fails to run.

Code: Select all

form := gui()
buttonTest1 := form.add('button', '', 'Test1')
buttonTest2 := form.add('button', '', 'Test2')

buttonTestClick1(*) {
  MsgBox('Test1 Button Clicked')
}

buttonTest2Click(*) {
  MsgBox('Test2 Button Clicked')
}

buttonTest1.onEvent('click', buttonTestClick1)
buttonTest2.onEvent('click', buttonTest2Click)

form.show()

The .exe displays...

Code: Select all

test.exe

Error at line 8.

Line Test: buttonTest2Click(*) {
Error: Missing "}"

The program will exit.

Without checking "Use Compression" and "Encrypt", the compiled .exe runs normally.

Also, compiling with the standard AutoHotkey v2.0-beta.3 included Ahk2Exe also results in .exe files that run normally.

The errors only occur when the AHK_H version of Ahk2Exe is used and the "Use Compression" and "Encrypt" boxes are checked.

Is there a trick to this that I'm missing?

Thanks for any advice.

Regards,

LBJ

SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: AHK_H Compiler Oddities

Post by SOTE » 23 Feb 2022, 19:49

@LBJ

You should review the post on compiling (https://www.autohotkey.com/boards/viewtopic.php?f=65&t=62308), otherwise just select "compression", which will often be secure enough and if you are not going to do the additional steps.

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK_H Compiler Oddities

Post by LBJ » 23 Feb 2022, 20:38

G'day Sote,

Thanks for your reply, but even after a full compile with VS CE, the same errors occur with various AHK code.

From a bit of a search over the forum, I can see there are quite a few odd issues with the H stream.

I think I'll just leave the H stream until it becomes a bit more stable. I've found the standard V2 beta to be brilliant, but I'm guessing the H version is a bit more of a side interest for the maintainer. It should be great when it's up and running though.

Thank again.

Best regards,

LBJ

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: AHK_H Compiler Oddities

Post by thqby » 24 Feb 2022, 06:29

@LBJ
You can try this one. For ahk_h, resourceid is set to E4847ED08866458F8DD35F94B37001C0.
Attachments
ahk2exe.7z
(810.31 KiB) Downloaded 384 times

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK_H Compiler Oddities

Post by LBJ » 09 Mar 2022, 19:21

thqby wrote:
24 Feb 2022, 06:29
You can try this one. For ahk_h, resourceid is set to E4847ED08866458F8DD35F94B37001C0.

Thank you @thqby, but that version of Ahk2Exe has much the same issues.

If anyone is successfully using the AHK_H distributed Ahk2Exe to compile Version 2 code, with both the "Use Compression" (not referring to UPX/MPress here) and the "Encrypt" checkboxes ticked, could you please perform a compile of the following...

Code: Select all

form := gui()
buttonTest1 := form.add('button', '', 'Test1')
buttonTest2 := form.add('button', '', 'Test2')

buttonTestClick1(*) {
  MsgBox('Test1 Button Clicked')
}

buttonTest2Click(*) {
  MsgBox('Test2 Button Clicked')
}

buttonTest1.onEvent('click', buttonTestClick1)
buttonTest2.onEvent('click', buttonTest2Click)

form.show()

If you have success, could you please detail the exact configuration you're using to manage this?

I've found almost any Version 2 script which runs fine under AHK_H as a standard script will throw up syntax/execution errors after compiling with encryption using the Ahk2Exe contained in...

https://github.com/HotKeyIt/ahkdll-v2-release/archive/refs/heads/master.zip

I'm keen to do more with the AHK_H version, and I'm also interested in the AHK_H compiler encryption, but I can't manage to successfully compile anything with more than a few lines of simple Version 2 code when the encryption option is used. I'm hoping there's a trick that I'm missing.

Thanks very much.

Best regards,

LBJ

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: AHK_H Compiler Oddities

Post by thqby » 10 Mar 2022, 01:13

Use AutoHotKey.exe in the compressed file as the base file. I have no problem with the test.
@LBJ

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK_H Compiler Oddities

Post by LBJ » 10 Mar 2022, 02:11

thqby wrote:
10 Mar 2022, 01:13
Use AutoHotKey.exe in the compressed file as the base file. I have no problem with the test.
@LBJ

G'day @thqby ,

Sorry, I pasted the wrong test script in that last posting. Can you please give this a test at compiling with both the "Use Compression" (not referring to UPX/MPress here) and the "Encrypt" checkboxes ticked...

Code: Select all

form := gui()
buttonTest1 := form.add('button', '', 'Test1')
buttonTest2 := form.add('button', '', 'Test2')

buttonTest1Click(*) {
  MsgBox('Test1 Button Clicked')
}

rawLines := "
(

Test2 Button Clicked

Line 1

Line 2

)"

buttonTest2Click(*) {
  MsgBox(rawLines)
}

buttonTest1.onEvent('click', buttonTest1Click)
buttonTest2.onEvent('click', buttonTest2Click)

form.show()

Thanks for your help.

Best regards,

LBJ

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: AHK_H Compiler Oddities

Post by thqby » 10 Mar 2022, 08:18

The continuation string is broken by reading the script line by line, encrypting and generating the Base64 string, and encrypting the Base64 string to generate the final ciphertext.

Also a kind of encryption is full text encryption rather than each line encryption, can work normally, but not yet in ahk2exe.
Last edited by thqby on 10 Mar 2022, 08:37, edited 2 times in total.

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK_H Compiler Oddities

Post by LBJ » 10 Mar 2022, 08:25

G'day @thqby,

Cool. It's not just me then.

I couldn't find anything in the documentation that referenced specific limitations, but it is still a beta level, so that's to be expected.

I suspect there may be a few other V2 constructs it also has problems with.

Thanks again for your assistance.

Best regards,

LBJ

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: AHK_H Compiler Oddities

Post by thqby » 10 Mar 2022, 09:16

LBJ wrote:
10 Mar 2022, 08:25
I couldn't find anything in the documentation that referenced specific limitations, but it is still a beta level, so that's to be expected.

I suspect there may be a few other V2 constructs it also has problems with.
Sorry, This bug was introduced by me. The decryption was changed due to empty lines in the continuation string. It's not a bug in the encryption.

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK_H Compiler Oddities

Post by LBJ » 10 Mar 2022, 18:42

thqby wrote:
10 Mar 2022, 09:16
Sorry, This bug was introduced by me. The decryption was changed due to empty lines in the continuation string. It's not a bug in the encryption.

G'day @thqby,

Not a problem in the slightest. I'm just glad it wasn't a step I was missing.

I'll keep checking on new AHK_H releases from time to time to see how it's going.

Best regards,

LBJ

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: AHK_H Compiler Oddities

Post by thqby » 15 Mar 2022, 23:44


jsong55
Posts: 321
Joined: 30 Mar 2021, 22:02

Re: AHK_H Compiler Oddities

Post by jsong55 » 28 Mar 2024, 09:24

somehow when compiling ahk_h thinks that the library is in the source script file directory

Post Reply

Return to “AutoHotkey_H”