How to build Autohotkey_H source code? Topic is solved

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
aurabunny
Posts: 1
Joined: 04 Dec 2018, 02:32

How to build Autohotkey_H source code?

05 Dec 2018, 01:15

I have build source code that was downloaded from https://github.com/HotKeyIt/ahkdll.

I used visual studio 2017 and sdk 10.0.17763.0.

it worked fine after succesfully building source code.

However, when i use the ahkThread() function in a script, it throw error message "Call to nonexistent function."

How do I fix an error?

please, let me know.
HotKeyIt
Posts: 1713
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to build Autohotkey_H source code?  Topic is solved

05 Dec 2018, 17:20

You have to build the dll files too and then run CleanUpAndPack.exe.exe located in root: https://github.com/HotKeyIt/ahkdll
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

05 Dec 2018, 18:23

aurabunny wrote:
05 Dec 2018, 01:15
it worked fine after succesfully building source code.
aurabunny - Is there any chance you kept track of the steps you took and if so, would you be willing to share them? It would be greatly appreciated. Thank you.
User avatar
jeeswg
Posts: 5442
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to build Autohotkey_H source code?

05 Dec 2018, 18:28

I would welcome that also. Btw this may be useful. Cheers.
Compile ahk L or ahk h on Visual Studio 2015 Community Edition - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 22&t=13373
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

05 Dec 2018, 18:52

jeeswg - Are the libhook and minhook and such specific to AHK_H or to Visual Studio 2015?
User avatar
jeeswg
Posts: 5442
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to build Autohotkey_H source code?

05 Dec 2018, 18:58

- Since you're putting them into a subfolder of ahkdll-master, I would suppose the answer is AHK_H.
- Btw I'm yet to try compiling with AutoHotkey_H, but may be doing so soon.
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

05 Dec 2018, 20:16

jeeswg wrote:
05 Dec 2018, 18:58
- Btw I'm yet to try compiling with AutoHotkey_H, but may be doing so soon.
jeeswg - Thank you for the response. If you are kind enough to record the steps as you go, may we trouble you to over simplify and include every seemingly minute aspect. As I am not a programmer and have no familiarity with Visual Studio and compiling and the like, even the slightest gap in instructions provided has, to date, resulted in failure.
coffee
Posts: 79
Joined: 01 Apr 2017, 07:55

Re: How to build Autohotkey_H source code?

06 Dec 2018, 02:13

2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\autohotkey.cpp(56): warning C4302: 'type cast': truncation from 'LPWSTR' to 'WORD'
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\autohotkey.cpp(137): warning C4302: 'type cast': truncation from 'LPWSTR' to 'WORD'
2>lowlevelbif.cpp
2>MemoryModule.cpp
2>MinHook.cpp
2>mt19937ar-cok.cpp
2>os_version.cpp
2>Registry.cpp
2>script.cpp
2>script2.cpp
2>script_autoit.cpp
2>script_com.cpp
2>script_expression.cpp
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\memorymodule.cpp(267): warning C4319: '~': zero extending 'DWORD' to 'uintptr_t' of greater size
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\memorymodule.cpp(276): warning C4319: '~': zero extending 'DWORD' to 'uintptr_t' of greater size
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\memorymodule.cpp(662): warning C4319: '~': zero extending 'DWORD' to 'size_t' of greater size
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\memorymodule.cpp(1138): warning C4312: 'type cast': conversion from 'DWORD' to 'LPVOID' of greater size
2>script_gui.cpp
2>script_menu.cpp
2>script_object.cpp
2>script_object_bif.cpp
2>script_registry.cpp
2>script_struct.cpp
2>SimpleHeap.cpp
2>StringConv.cpp
2>TextIO.cpp
2>util.cpp
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\script2.cpp(8412): warning C4302: 'type cast': truncation from 'LPWSTR' to 'WORD'
2>var.cpp
2>window.cpp
2>WinGroup.cpp
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\script2.cpp(16077): warning C4302: 'type cast': truncation from 'LPWSTR' to 'WORD'
2>exports.cpp
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\exports.cpp(189): warning C4311: 'type cast': pointer truncation from 'LPTSTR' to 'int'
2>c:\ahk\ahk_h v2 source\ahkdll-alpha\source\exports.cpp(189): warning C4302: 'type cast': truncation from 'LPTSTR' to 'int'
It seems to build successfully for me, but with warnings, not sure if this is normal.
On vs2017 enterprise.

As per
https://github.com/HotKeyIt/ahkdll/comm ... a88feeff6b
I don't think you need to update libminhook manually anymore.

The only step you probably should do from the linked steps above is:
C/C++ > Code Generation - set Runtime Library to "Multi-threaded (/MT)
on both the Autohotkeyx and lib_pcre.

There's also a good chance you will have to go into the project properties of each (autohotkeyx and lib_pcre) and set windows sdk version to inherit, platform toolset to something not _xp (v141) if you dont have the _xp targeting (e.g no v141_xp).
Then set the vc++ directories to inherit, except the excluded directories.

Build both 32bit and 64bit releases.

Open cleanupandpack.ahk and define a function called ErrMsg() to simply display a msgbox
ErrMsg()
{
Msgbox("ERROR")
}

Then double click on cleanupandpack.exe
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

06 Dec 2018, 09:47

Desiring to change the password appears to be the objective that leads to all of these steps for AHK_H.

Can some level of obfuscation for AHK_L be achieved by changing the password and then compiling one's own AHK_L?
SOTE
Posts: 227
Joined: 15 Jun 2015, 06:21

Re: How to build Autohotkey_H source code?

06 Dec 2018, 12:42

Is there any published list of steps for compiling AutoHotkey_H?

What I used was Joe Glines video, though many of his videos are very good and makes things easier to understand, this one was a bit difficult. Many of the Visual Studio settings were in German. There was jumping around from the topic on compiling and encryption, so as not to be completely covered and the actual steps were a bit unclear. Consequently, you will likely still have do a lot of experimenting to try to get it. Still, there was a lot of fantastic information given in the videos.

Videos- https://youtu.be/ao5FdsqWTVQ(part 1), https://youtu.be/tiL_bIebTx4(part 2)

If there is a better list of steps, maybe a link can be shown or a document with those steps could be created.
Last edited by SOTE on 06 Dec 2018, 13:19, edited 2 times in total.
SOTE
Posts: 227
Joined: 15 Jun 2015, 06:21

Re: How to build Autohotkey_H source code?

06 Dec 2018, 13:13

elmo wrote:
06 Dec 2018, 09:47
Desiring to change the password appears to be the objective that leads to all of these steps for AHK_H.

Can some level of obfuscation for AHK_L be achieved by changing the password and then compiling one's own AHK_L?
I think the AutoHotkey_L obfuscation issue has to be treated separately from AutoHotkey_H, particularly on this part of the forum where we are discussing AutoHotkey_H specifically. As AutoHotkey_H can already use encryption, it arguably doesn't need obfuscation or one could consider that an additional step.

However, as the AutoHotkey_L source code is available, a person that understands how to compile AutoHotkey_H could figure out how to do so for AutoHotkey_L. I think this knowledge is for the good of the community, as it can potentially lead to more contributors, and people knowing more about C++ and Visual Studio. A lot of people don't touch the source code or Visual Studio because AutoHotkey scripting, AHK Studio, AutoGUI, etc... is usually more than enough for their typical needs.

AutoHotkey_L does not use any encryption built into the source code, so for encryption or obfuscation, you need to refer to additional scripts done by Feiyue and Digidon. Feiyue did an encryption script for AutoHotkey_L, see here https://autohotkey.com/boards/viewtopic.php?t=42494 and for obfuscation, check out https://autohotkey.com/boards/viewtopic.php?f=6&t=49887 Digidon's obfuscation script was built upon work done earlier by David Malia https://autohotkey.com/board/topic/8935 ... y-scripts/ Both Digidon and Feiyue don't seem to be so active recently. Possibly somebody can take clues from what they have done to come up with something different, though what both of them have done is quite mature and usable in it's present form.

I think Feiyue has created the closest thing in AutoHotkey_L that you can get to AutoHotkey_H (in terms of using encryption), without compiling the source code. But, it looks like you will have to get into MCode (machine code) to create the encryption and decryption functions. Here there are a lot of options for creating MCode, from open source compilers and different languages like Assembly, Pascal, C, etc...
Last edited by SOTE on 06 Dec 2018, 13:32, edited 1 time in total.
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

06 Dec 2018, 13:18

SOTE wrote:
06 Dec 2018, 12:42
Is there any published list of steps for compiling AutoHotkey_H?
If there is a better list of steps, maybe a link can be shown or a document with those steps could be created.
SOTE - Agreed. Then if someone possesses the knowledge to list the steps, might they be grouped by what they are for; for instance:

1 - Find all these required components and download them thus to this folder
2 - Install or enable Visual Studio with these settings
3 - Edit these files in this order on these lines
4 - Set the compiler for these folders and then specify output as follows
5 - If you succeeded, then you should now see these files in this/these folders
6 - Move or modify these files in the following manner in relation to AHK_L
7 - Copy or move these files from AHK_L to this place relative to AHK_H
8 - Start AHK_H thusly with these parameters and do this test to confirm operation

It seems there are folks much smarter than I who do this frequently and if they could but record all of the steps, including even what is most obvious to them but a mystery to the rest of us, it would be greatly appreciated.
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

06 Dec 2018, 13:26

SOTE wrote:
06 Dec 2018, 13:13
Point 1:
I think the AutoHotkey_L obfuscation issue has to be treated separately from AutoHotkey_H, particularly on this part of the forum where we are discussing AutoHotkey_H specifically.
Point 2:
As AutoHotkey_H can already use encryption, it arguably doesn't need obfuscation or one could consider that an additional step.
SOTE - Agreed on your first point, best not to mangle _L and _H methods in same post.

To your second point, am I conflating Encryption with Obfuscation? Is that part of my confusion? Is that why I am still curious whether changing password in _L "is the same as" in _H?
SOTE
Posts: 227
Joined: 15 Jun 2015, 06:21

Re: How to build Autohotkey_H source code?

06 Dec 2018, 13:54

elmo wrote:
06 Dec 2018, 13:26
SOTE wrote:
06 Dec 2018, 13:13
Point 1:
I think the AutoHotkey_L obfuscation issue has to be treated separately from AutoHotkey_H, particularly on this part of the forum where we are discussing AutoHotkey_H specifically.
Point 2:
As AutoHotkey_H can already use encryption, it arguably doesn't need obfuscation or one could consider that an additional step.
SOTE - Agreed on your first point, best not to mangle _L and _H methods in same post.

To your second point, am I conflating Encryption with Obfuscation? Is that part of my confusion?
Obfuscation is different from encryption. People refer to obfuscation when making code difficult to read, which can be based on various methods that does or doesn't include an algorithm. For example, you can take a look at Digidon's Obfuscator. Some parts of the obfuscated script you can read, while other part's you can't. It's extremely difficult to read, but you can still read some parts of it.

Encryption is using an algorithm to make the data unreadable or unusable, so that you will need to know the secret password, key, or algorithm to decrypt it, to be able to read it. You will not be able to read any of the script.

Note- If you look at Feiyue Encryptor for AutoHotkey_L, you can't read the part of the script that's encrypted, but some parts of the script are visible. You can see some other parts, because the encrypt and decrypt function is visible. However, he put the function in MCode (machine code) to not be human readable. Machine code is not encryption, so can be more easily figured out. Encryption, in terms of AutoHotkey_H, means the entire script is encrypted. Only (in most circumstances) AutoHotkey_H's executable (interpreter) can read the script.

Encryption and obfuscation can be used to together, but we should be mindful of them being 2 different things.
Is that why I am still curious whether changing password in _L "is the same as" in _H?
The source code of AutoHotkey_L should be treated separately from AutoHotkey_H. AutoHotkey_L specifically does not use encryption in it's source code nor will it be included, therefore talking of changing passwords in it is not useful. The only way to get a password feature into AutoHotkey_L, is to add that feature into the source code. You might be thinking of AutoHotkey_Basic, the original (from Chris), which allowed for passwords. AutoHotkey_L took this feature out.

If you are talking about changing passwords, then you are talking about a feature that is included in AutoHotey_H's source code. That is, changing AutoHotkey_H's default password. But to change the password, you must recompile the source code, thus various people ask the question on how to do such.
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

06 Dec 2018, 15:02

SOTE,

Wow ... Thank you ... I learned so much from your post.

However, now I can only "think about" the fact that AHK used to have a password that protected the user created script source code. Do you personally know whether it would be feasible to get that back? Do you know why it was taken out? Did the community want it taken out?
SOTE
Posts: 227
Joined: 15 Jun 2015, 06:21

Re: How to build Autohotkey_H source code?

06 Dec 2018, 17:17

elmo wrote:
06 Dec 2018, 15:02
SOTE,

Wow ... Thank you ... I learned so much from your post.

However, now I can only "think about" the fact that AHK used to have a password that protected the user created script source code. Do you personally know whether it would be feasible to get that back? Do you know why it was taken out?
That's a difficult question. It appears the use of passwords and encryption is the preference of the developer. Where one developer wanted it (AutoHotkey_H) and the other developer did not (AutoHotkey_L).

Also, how AutoHotkey_Basic implemented password protection was a little weird. I have to research what exactly that was again, but I think there was a hidden default password that worked on all scripts, and the user created password was a kind of fake. So password protection in AutoHotkey_Basic was more of a facade. Thus the different AutoHotkey developers seemed to react differently to this, though they can speak to exactly how they felt about it, as opposed to opinion. One developer decided to drop the feature, where the other decided to make it clear what the feature was, so that people could make real passwords through recompiling of the source code (AutoHotkey_H).
Did the community want it taken out?
The developers of AutoHotkey ultimately decide what does or doesn't go into it, and whether to accept a suggestion from users and the community or not.

If an individual person wants something included that the developers don't, then they would have to include it themselves and compile their own personal version or fork the source code and start a new version, which has happened and thus different "flavors" of AutoHotkey. Unlike closed source, AutoHotkey being open source means this is an option that is available.

The other alternatives to compiling source code, is MCode or the use of 3rd party DLLs. That is create your own function in some other programming language and include it with your script as MCode or call functions from a DLL that you found or created.
HotKeyIt
Posts: 1713
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to build Autohotkey_H source code?

06 Dec 2018, 18:13

Try following steps to compile AutoHotkey_H:
1. Open the project
2. Upgrade SDK for both projects
3. Change AutoHotkey to be the start project

4. Make sure following is set for all for all configurations and platforms (Debug, Release, ReleaseDll...) as well as (Win32, x64)
5. go to project properties and change platformtoolset to 140_xp or 141_xp
6. in project properties go to VC++ Directories and make sure checkbox is set (inherit standard) for include directories
7. also in include directories add 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared' (might be different depending on your SDK)
8. further in library directories add $(LibraryPath);
elmo
Posts: 81
Joined: 09 Oct 2013, 09:08

Re: How to build Autohotkey_H source code?

06 Dec 2018, 19:52

SOTE,
Well, that pretty much bends my mind for the day.
Wish _L could still be password protected.
Pretty confident I won't be able to MCode or fork or DDL in this lifetime.
Really appreciate you taking the time to explain.

HotKeyIt,
Ok, looks like you da man with da _H.
Definitely want to get it up and running.
Please take this as a compliment; I read your directions and still understand nothing ;-)
Nonetheless, I will try again someday!

Thanks to all and to all a goodnight.
SOTE
Posts: 227
Joined: 15 Jun 2015, 06:21

Re: How to build Autohotkey_H source code?

08 Dec 2018, 01:30

elmo wrote:
06 Dec 2018, 19:52
SOTE,
Well, that pretty much bends my mind for the day.
Wish _L could still be password protected.
Pretty confident I won't be able to MCode or fork or DDL in this lifetime.
Really appreciate you taking the time to explain.

HotKeyIt,
Ok, looks like you da man with da _H.
Definitely want to get it up and running.
Please take this as a compliment; I read your directions and still understand nothing ;-)
Nonetheless, I will try again someday!

Thanks to all and to all a goodnight.
Keep in mind that AutoHotkey_H can use the default password, so that can provide some protection unless the person knew what it was or was familiar with AutoHotkey_H, until you learn how to change the password and compile it. And of course there is Feiyue's script, if you want to use AutoHotkey_L.

Using MCode (https://autohotkey.com/boards/viewtopic.php?t=4642) or calling Dlls (https://youtu.be/aWEvHoRYh2U) isn't so bad. Just keep playing around with it until you get it.

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 2 guests