views:

347

answers:

3

Hi, We have the application, which used to download the firmware to external device. We used to release our SW as a zip file. Some of the users directly running the application from the zip file. So the application extracting to windows TEMP folder and running. That time windows firewall or anti virus software blocking the our application to access the systems resources. At this instance application crashes the connected device.

How to prevent application running from windows TEMP foder?

+1  A: 

Why not check the current directory to see if it's a temp folder? In pseudocode:

if (GetCurrentDir() == GetTempDir())
   abort("You cannot run our application from the temp folder.");
Kluge
GetCurrentDirectory api not giving full file path,if we running the application from TEMP folder (Ex: C:\Documents and Settings\username but the application path is C:\Documents and Settings\username\Local Settings\Temp). So i used <b>GetModuleFileName</b> to get the full path
santhosh
A: 

Create an installer and only run if you find in the registry an entry that is only created by your installer.

jmucchiello
+1  A: 

As i can see there are 2 solutions 1 You can bundle an installer as said above so that people install it before they use making it to be considered a legitimate app by the firewall or the anti virus.

or

  1. Instead of bundling the application in just a zip file, bundle it in a self-extracting archive and write a script for default extract path and what file to execute when extracted. I guess you can do this without any code writing in winrar. By default Extract to a specified folder like c:\softwarename\ and execute the required file.
tHeSiD