[Solved] Antivirus stops exe build but allows compile/run?

Everything else that doesn't fall into one of the other PB categories.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

[Solved] Antivirus stops exe build but allows compile/run?

Post by PB »

Per the subject... why can I compile/run an app, but when I try
to create an exe, the AV stops it? Why doesn't the AV also stop
the temp exe created from compile/run? Not logical. :shock:
Last edited by PB on Fri Nov 29, 2013 2:53 pm, edited 1 time in total.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Re: Anti-virus stops exe creation but allows compile/run?

Post by Joakim Christiansen »

False positives are not always logical. When run from the program the exe might be a little different, especially with the debugger enabled, probably different enough to not trigger the false positive.
I like logic, hence I dislike humans but love computers.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Anti-virus stops exe creation but allows compile/run?

Post by PB »

Ah, you're right! If I compile/run without the debugger from the IDE,
the AV stops it too (I get "POLINK: fatal error: Access is denied").

Now I just have to find out what's triggering the false positive. :(
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Re: Anti-virus stops exe creation but allows compile/run?

Post by Joakim Christiansen »

PB wrote:Now I just have to find out what's triggering the false positive. :(
Many AV companies allow you to send in false positives so they can repair their detection engine, I did that with success once.
I like logic, hence I dislike humans but love computers.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Anti-virus stops exe creation but allows compile/run?

Post by PB »

I know, but that's too much hassle to report to them all.

It started after I added a single line of code to my source,
but now I can't remember what it was. :( I should've stopped
and commented it immediately, but I ignored it and kept coding.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Anti-virus stops exe creation but allows compile/run?

Post by IdeasVacuum »

"POLINK: fatal error: Access is denied"
That normally means there is an exe of the same name already running - may be one that didn't terminate correctly? Check with Task Manager.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Anti-virus stops exe creation but allows compile/run?

Post by PB »

No, that's not the case here. Avira Antivir causes this error when
it doesn't allow the compiled exe to run. Thanks for asking, though.

(Just to reassure you: my exe is a run-once-and-quit tool, so it'll
never be left running in the background at all).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Fenix
Enthusiast
Enthusiast
Posts: 102
Joined: Wed May 07, 2003 1:45 am
Location: Germany

Re: Anti-virus stops exe creation but allows compile/run?

Post by Fenix »

PB wrote:I know, but that's too much hassle to report to them all.

It started after I added a single line of code to my source,
but now I can't remember what it was. :( I should've stopped
and commented it immediately, but I ignored it and kept coding.
I had this when I started using regular expressions.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Anti-virus stops exe creation but allows compile/run?

Post by PB »

I worked it out; I added a line to IncludeFile an ExeFromHwnd procedure by Rashad.
Obviously Avira thinks my app is being naughty for getting process information. :evil:

This is the line that makes Avira hate my exe:

Code: Select all

snap=CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,0)
Because if I change that to "snap=0", then Avira lets me build the exe.

However, I was able to trick Avira by not calling the CreateToolhelp32Snapshot API
directly, but by using OpenLibrary and CallFunction instead to "mask" the call:

Code: Select all

k32=OpenLibrary(#PB_Any,"kernel32.dll") ; Needed due to Avira.
If k32
  ;snap=CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,0) ; Avira hates this...
  snap=CallFunction(k32,"CreateToolhelp32Snapshot",#TH32CS_SNAPPROCESS,0) ; ...so we do this instead!
  If snap
  [...]
Now my exe builds. Kiss my ass, Avira! :twisted:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
endo
Enthusiast
Enthusiast
Posts: 141
Joined: Fri Apr 30, 2004 10:44 pm
Location: Turkiye (istanbul)
Contact:

Re: [Solved] Antivirus stops exe build but allows compile/ru

Post by endo »

Even if I have checked "Create temporary executable in the source directory", when I compile with debugger, PureBasic uses the temp folder (on Windows). It would be a solution to exclude a specific folder from antivirus program if I could set the temp folder for PureBasic compiler. But I cannot exclude the whole temp folder.
-= endo (registered user of purebasic since 98) =-
Post Reply