Modifying system folder?

Post Reply
PhilC
Newbie
Posts: 1
Joined: Tue Nov 08, 2011 1:10 pm

Modifying system folder?

Post by PhilC » Tue Nov 08, 2011 1:29 pm

Hello Andrew,
I’ve noticed an annoying behavior in Vistumbler (v10-b5) and offer a possible solution. Release 10 of Vistumbler tries to use a “temp folder” in the system program file path for its work files. This “peeing in the system pond” is considered rude programming. Each instance of a program should pee in its own pond. I’ve looked at the source code that you provide and believe that I can offer the following suggestion.
In the source code for Vistumbler 10, near line 52 contains this statement: “Dim $TmpDir = @ScriptDir & '\temp\'”.
This statement appears to set the value of “$TmpDir” using something called “@ScriptDir”, which apparently contains the path of the folder where the executable program lives. After installing Vistumbler with the normal installation, that folder is “C:\Program Files (x86)” – at least on my machine.
A better way to set $TmpDir would be to use the “temp” environment variable that Windows provides. This is a string that points to the temporary files folder for the current user.
You can check this by getting into the command prompt and typing “echo %temp%”. If you build the path to the temporary folder using this environment variable instead of @ScriptDir, Vistumbler should stop trying to write to the system folder.
Many other programs use this path for their work files, too. So, you should create a subdirectory off of that path for “%temp%\Vistumbler\” and use that string as your temporary files path.
The exact code to do this would depend, of course, on how "autoit" interacts with Windows.
The current code causes Vistumbler to try to modify the contents of a system folder. That might be the reason why the anti-malware programs are beating you up. Making this change could fix that problem, too.
Regards,
PhilC

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Modifying system folder?

Post by ACalcutt » Tue Nov 08, 2011 6:53 pm

Hi Phil,

You are correct, Vistumbler does create its own temp folder. Basically this folder is used for temporary storage for netsh output, auto kml, vistumbler mdb files and updates. The only reason it is located in the vistumbler directory is to keep different instances(vistumbler in different folders) separated and keep all vistumbler files self contained.

I guess it does make sense to put it in the system temp folder. Basically all that needs to be do is to change that line you found to

Code: Select all

Dim $TmpDir = @TempDir & '\Vistumbler\'
and it will use the users temp folder.

The one thing I can think of that that may affect is the way I save mdb files in the temp directory when a user chooses to save the db on exit. I may need to re-think how this is done. The real temp folder may be cleaned out, so I would need to move the saved db somewhere else.

If keeping temp files is considered bad practice I would Imagine i should look into moving the the save folders out or program files also...maybe to "my documents"

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Modifying system folder?

Post by ACalcutt » Wed Nov 09, 2011 12:41 am

I uploaded Vistumbler 10.1 Beta 20 to the svn (and automatic update if you have it set to download the beta edition)

I changed the 3 scripts that use the temp folder to use the users temp folder and save in the users my documents by default.

Post Reply