Windows 10 closing AHK compiled script without warning

Get help with using AutoHotkey and its commands and hotkeys
xabirau
Posts: 8
Joined: 21 Sep 2019, 23:17

Windows 10 closing AHK compiled script without warning

29 Oct 2019, 12:10

I have a compiled AHK program, which uses SQL database connections,. We all know that most antivirus accuse it as "false positive". In some cases, add it as exception works but some users of my script are facing a different problem: Windows 10 (I believe so) is closing the program after launching without warnings. I've tested it under these circunstances: unnistaled the antivirus, disabled firewall/Windows defender. What else could be happening?
Any1 had this issue before?
SOTE
Posts: 971
Joined: 15 Jun 2015, 06:21

Re: Windows 10 closing AHK compiled script without warning

29 Oct 2019, 20:42

Depending on what type of code you are using, like SetTimer, you might need to put #Persistent at the top of the script. For more info, check out https://www.autohotkey.com/docs/commands/_Persistent.htm. In various cases, the script will seem to suddenly "disappear"or won't run, because it needs #Persistent.

If you are saying that the actual script "disappears" and can't be found, then that might be Microsoft Defender or Anti-Virus related. In that case, there are a few things you can do:

Note- There have been other threads like this, so you might want to do a forum search or Google search, to see if those solutions work for you. Example of similar thread, https://www.autohotkey.com/boards/viewtopic.php?t=59598 (Microsoft Defender deleting my apps).

1) Make an exception in Microsoft Defender. It should then ignore the file and let it run normally.

https://support.microsoft.com/en-us/help/4028485/windows-10-add-an-exclusion-to-windows-security

2) Submit a false positive report to Microsoft. Specify "No — this file has been incorrectly detected"

Note- Microsoft will update you on the results of their findings about the files you have submitted. Usually within 24 hours.

https://www.microsoft.com/en-us/wdsi/filesubmission

Code: Select all

Do you believe this file contains malware?

No — this file has been incorrectly detected

Select the Microsoft security product used to scan the file *
Another possibility is that you are not using authentic AutoHotkey files from this website or the official GitHub, in addition to possibly including other files with your AutoHotkey applications from somewhere else that might be infected. Therefore you need to be very specific about where you got your files from and what is going on, otherwise you can't get the help you need.

Windows Defender will show you what files were put in quarantine or deleted. You can also put the files in a folder, have Windows Defender scan that folder, then look at the results. You can also submit individual files to Virus Total, https://www.virustotal.com/gui/home/upload, and then see what the results are. Do also feel free to put any negative results here, so the AutoHotkey community can see them as well, and help out.

After making sure the script and any files that it will use are safe, via scan by Windows Defender or other Anti-Virus software. If the program seems to run, but is not doing anything, it might be because it needs administrative rights to interact with other programs on your computer. Add the following code near the top.

Note- This would be a last step, after you made sure the other steps were not an issue.

Code: Select all

If not A_IsAdmin 
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}
xabirau
Posts: 8
Joined: 21 Sep 2019, 23:17

Re: Windows 10 closing AHK compiled script without warning

30 Oct 2019, 06:24

@SOTE Thank you for the reply,
My code is based in AHK and I use a SQL class found in the forums and also a script for file protection found here.
Im using the following tags inside an included file, my app has like 6-7 included files. But its not in the main script.

Code: Select all

#SingleInstance, Force
#Persistent
#WinActivateForce
Do they need to be in every file or what?
User avatar
Bugz000
Posts: 62
Joined: 30 Sep 2013, 10:01

Re: Windows 10 closing AHK compiled script without warning

30 Oct 2019, 06:32

#include is simply a flag to essentially copy/pasta the script contents at that point, ofcourse you can add it to the main script to be sure, but you shouldn't need it in any of the includes :) it's all pulled into one script anyway
Image
Image

[14/10/2019][03:06:09] <@tidbit> so, 8 years old. thats way too young for a human centipede.
[29/10/2019][01:48:42] <@tidbit> it should be a cloaca
[6/12/2019][01:53:34] <+Budgii> tidbit: how did you come up with your name?
[6/12/2019][01:53:59] <@tidbit> Budgii: I slapped a goat and phonetically spelt the sound it made
[15/1/2020][17:51:08] <@tidbit> b-b-b-bbaka!
[15/1/2020][17:59:42] <@tidbit> bugz knows his otakunese guys!
[28/2/2020][21:09:36] <@tidbit> find an eagle with some damn self control?
[07/3/2020][00:28:48] <@tidbit> maybe someone was fapping too close to heaven, so god sent a warning
xabirau
Posts: 8
Joined: 21 Sep 2019, 23:17

Re: Windows 10 closing AHK compiled script without warning

30 Oct 2019, 06:40

Bugz000 wrote: #include is simply a flag to essentially copy/pasta the script contents at that point, ofcourse you can add it to the main script to be sure, but you shouldn't need it in any of the includes :) it's all pulled into one script anyway
Thank you for the clarification Bugz! :D
xabirau
Posts: 8
Joined: 21 Sep 2019, 23:17

Re: Windows 10 closing AHK compiled script without warning

31 Oct 2019, 18:51

Nothing worked guys. I think it may be something related to other Windows feature. Maybe DEP (Data Execution Prevention), but disabling it in the DEP exception list also don't work. So I have no idea.
xabirau
Posts: 8
Joined: 21 Sep 2019, 23:17

Re: Windows 10 closing AHK compiled script without warning

31 Oct 2019, 19:30

Just found a related topic to my issue: https://www.autohotkey.com/boards/viewtopic.php?f=67&t=42897
I wonder what in Windows is triggering that..
User avatar
Bugz000
Posts: 62
Joined: 30 Sep 2013, 10:01

Re: Windows 10 closing AHK compiled script without warning

31 Oct 2019, 20:39

i recently had windows defender completely corrupt itself (appeared to be a recent update with the insider program that went horrendously wrong, ofcourse microsofts solution to the issue was simply "re-install the operating system"... literally... that was their only available fix for the issue.)

so i guess the AV isn't without faults, and i, myself have had issues regarding defender holding a file under seige
deleting and replacing the file not working, i found trying to load the file from a different directory to work in most cases

regardless of this, perhaps it's worth posting a bug report with all information you know about the issue and research it some more?

you have a rare opportunity here where you have multiple people with the same issue
requesting changes to AHK for a single person is not happening, but if it's possible to replicate it on a couple different environments then it may just be worth implementing changes

this is ofcourse assuming ahk is at fault and not windows defender or something :lol:

at the very least you can potentially show windows that you've explored this avenue and it's definitely their system at fault
Image
Image

[14/10/2019][03:06:09] <@tidbit> so, 8 years old. thats way too young for a human centipede.
[29/10/2019][01:48:42] <@tidbit> it should be a cloaca
[6/12/2019][01:53:34] <+Budgii> tidbit: how did you come up with your name?
[6/12/2019][01:53:59] <@tidbit> Budgii: I slapped a goat and phonetically spelt the sound it made
[15/1/2020][17:51:08] <@tidbit> b-b-b-bbaka!
[15/1/2020][17:59:42] <@tidbit> bugz knows his otakunese guys!
[28/2/2020][21:09:36] <@tidbit> find an eagle with some damn self control?
[07/3/2020][00:28:48] <@tidbit> maybe someone was fapping too close to heaven, so god sent a warning
SOTE
Posts: 971
Joined: 15 Jun 2015, 06:21

Re: Windows 10 closing AHK compiled script without warning

31 Oct 2019, 21:40

xabirau wrote:
30 Oct 2019, 06:24
@SOTE Thank you for the reply,
My code is based in AHK and I use a SQL class found in the forums and also a script for file protection found here.
It seems to me that you might be doing something strange. What is this script for file protection that you are using? Why are you using file protection?

I would think you would test the script without compiling it and without any file protection to see if it works. After that, If you compile it, then test it without file protection to see how that goes. Then add the file protection, after everything else has gone well.
xabirau
Posts: 8
Joined: 21 Sep 2019, 23:17

Re: Windows 10 closing AHK compiled script without warning

03 Nov 2019, 20:23

@SOTE @Bugz000
Thanks guys for the answers. I have found the issue and a work around, but I still don't know which Windows feature is killing the process. So, for some reason and at some systems using UPX Compressing at the 'Highest' results in a unrecognizable kind of file to Windows, and it consider it as a potentially harmfull file. So if you change from 'Highest' to a lower options like 'High' is enough to bypass that unkown feature from windows. Hope it helps ppl with this very issue. :dance:
User avatar
Bugz000
Posts: 62
Joined: 30 Sep 2013, 10:01

Re: Windows 10 closing AHK compiled script without warning

05 Nov 2019, 18:10

it'd be windows defender by the sounds of things,
Mpress used to be included in ahk2exe but due to windows defender demolishing basically any file that contained mpress data, it was removed

it's still available in some compilers, may even be back in the main version for all i know, but generally "home-made exe's" are going to be demolished

to get around this you need to contact windows defender teams (and other) to have them check your file and have it added to the database of safe files, a lot of work and they won't care for script writers such as ourselves

i would personally look at another way of packing an EXE, depending what you want/need to do, it can likely be done natively in AHK
Image
Image

[14/10/2019][03:06:09] <@tidbit> so, 8 years old. thats way too young for a human centipede.
[29/10/2019][01:48:42] <@tidbit> it should be a cloaca
[6/12/2019][01:53:34] <+Budgii> tidbit: how did you come up with your name?
[6/12/2019][01:53:59] <@tidbit> Budgii: I slapped a goat and phonetically spelt the sound it made
[15/1/2020][17:51:08] <@tidbit> b-b-b-bbaka!
[15/1/2020][17:59:42] <@tidbit> bugz knows his otakunese guys!
[28/2/2020][21:09:36] <@tidbit> find an eagle with some damn self control?
[07/3/2020][00:28:48] <@tidbit> maybe someone was fapping too close to heaven, so god sent a warning
SOTE
Posts: 971
Joined: 15 Jun 2015, 06:21

Re: Windows 10 closing AHK compiled script without warning

05 Nov 2019, 20:42

xabirau wrote:
03 Nov 2019, 20:23
@SOTE @Bugz000
Thanks guys for the answers. I have found the issue and a work around, but I still don't know which Windows feature is killing the process. So, for some reason and at some systems using UPX Compressing at the 'Highest' results in a unrecognizable kind of file to Windows, and it consider it as a potentially harmfull file. So if you change from 'Highest' to a lower options like 'High' is enough to bypass that unkown feature from windows. Hope it helps ppl with this very issue. :dance:
You have to be careful with compression, because various types of Anti-Virus software might flag it, if it doesn't recognize the type of compression used or it can't uncompress/unpack the files and scan them. The more exotic or less known the packer, the more likely Anti-Virus software is to flag it. Supposedly, UPX is less likely to get flagged than Mpress because it's more well known or used by Anti-Virus makers/scan engines, but people have reported mixed and conflicting results about this.

To help stop Anti-Virus companies from being so lazy about flagging open source projects and files, please do submit false-positive flagged files to Anti-Virus companies for further testing. This way they can update their databases and make sure files are properly identified.

Return to “Ask For Help”

Who is online

Users browsing this forum: LadyGamer, prasad383 and 281 guests