ThinLoader: easily run any program on a Thinstall sandbox

Discuss anything related to portable freeware here.
Message
Author
iamzenitraM
Posts: 5
Joined: Sat Mar 15, 2008 1:53 pm

ThinLoader: easily run any program on a Thinstall sandbox

#1 Post by iamzenitraM »

Thinstalled applications work by putting a "sandbox" between the program that is being run (contained onto the .exe) and the rest of the system, storing all the changes on a folder called Thinstall, located on Application Data or, if the Thinstall folder is present on the same place as the .exe, then it's placed next to the program.

But.. guess what: any program that gets executed by the app running Thinstalled gets Thinstalled too, and all the changes monitored and being sandboxed. So I had an idea. I made a simple app that asks you for a executable and runs it. And then I made a Thinstall version out of it.

So how does it work? Easy.. extract the files to any folder on your hard drive, and execute "ThinLoader.exe". Then you're asked for a program to be run (inside the Thinstall sandbox). Choose any installer, and install the program as usual. But there's a difference: The files are extracted inside the sandbox, and not directly onto the system.

And now run ThinLoader.exe again, and when you're asked for an app to run, (remember that you're browsing the contents INSIDE the sandbox), choose the program you have just installed, and that's all. Using this method you can install any application (well, at least Thinstall compatible) on a pendrive or wherever you want, and run it as usual as if it was Thinstalled but without having to get the full version of Thinstall or anything.

You can also use command-line parameters to set an app that should be automatically opened when you launch ThinLoader.exe. Just use:
ThinLoader.exe choosemain
and then you're asked for where the program is. Next time you launch ThinLoader.exe, that program will be executed directly, without being asked.

There's also a virtual drive, only available from inside ThinLoader, T:. That's where ThinLoader stores its configuration (well, only where the program is).. and where you can install any program too.

So, here it is. Feel free to use it and report any bugs you find..
Version 0.01b - stores data on ThinData folder
http://tinyload.com/VSjIj

Source code: (AutoIT)

Code: Select all

AutoItSetOption("TrayIconHide", 1)
If $CmdLine[0] = 0 Then
	$var = IniRead("T:\\thinloader.ini", "ThinLoader", "Launch", "Unset")
	If $var = "Unset" Then
			$var = FileOpenDialog("Choose program to launch into ThinLoader sandbox", ".", "Executables (*.exe;*.bat;*.com;*.pif)")
			If @error Then
				MsgBox(4096,"T:\","No File(s) chosen")
			Else
				Run($var)
			EndIf
		Else
			Run($var)
			If @error Then MsgBox(4096,"ThinLoader","Error executing "+$cmd+":\n"+@error)
			EndIf
ElseIf $CmdLine[1] = "choosemain" Then
	If $CmdLine[0] = 2 Then
		IniWrite("T:\\thinloader.ini", "ThinLoader", "Launch", $CmdLine[2])
	Else
	MsgBox(0, "ChooseMain", "Choose the file you want to load using the main file ThinLoader.exe.")
	$var = FileOpenDialog("Choose", "T:\", "Executables (*.exe;*.bat;*.com;*.pif)")
		If @error Then
			MsgBox(4096,"","No File(s) chosen")
		Else
			IniWrite("T:\\thinloader.ini", "ThinLoader", "Launch", $var)
		EndIf
	EndIf
ElseIf $CmdLine[1] = "run" Then
	If $CmdLine[0] = 2 Then
		Run($CmdLine[2])
	Else
	$var = FileOpenDialog("Choose program to launch into ThinLoader sandbox", ".", "Executables (*.exe;*.bat;*.com;*.pif)")
	If @error Then
		MsgBox(4096,"","No File(s) chosen")
	Else
		Run($var)
	EndIf
	EndIf
EndIf
Last edited by iamzenitraM on Sun Mar 16, 2008 7:46 am, edited 1 time in total.

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#2 Post by lococobra »

Interesting concept, I only have one suggestion.

In the thinstall package.ini, you should use settings like...

Code: Select all

SandboxName=VirtualData
SandboxPath=.
Change VirtualData to whatever you want, but this way you don't have to include a "Thinstall" folder..

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#3 Post by Queue »

Since it's just a single executable, it'd make sense to at least store the settings file along-side the executable, and in the settings allow the user to specify a directory to store stuff (or to just use the same current folder). I like the concept a lot though.

...if possible, I don't know if you have that sort of control after building a Thinstall program.

Something worth mentioning: your executable is currently tripping 2 virus scanners (out of over 2 dozen) as AdWare.Win32.Agent.ahg, which is most likely a false positive on the Thinstall code.

Queue

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#4 Post by lococobra »

Since it's just a single executable, it'd make sense to at least store the settings file along-side the executable, and in the settings allow the user to specify a directory to store stuff (or to just use the same current folder). I like the concept a lot though.
Yeah, all files created will currently be thrown into the ./Thinstall/ThinLoader directory. (Well... depending on how he set it up in his package.ini

iamzenitraM: How do you deal with file saving locations? is your DirectoryIsolationMode set to WriteCopy? You should use a merged sandbox, then use ##Attributes.ini files to specify sandboxed folders. I'd say you should definitely allow files to be saved to the desktop, my documents, and any external media.

iamzenitraM
Posts: 5
Joined: Sat Mar 15, 2008 1:53 pm

#5 Post by iamzenitraM »

I'm now uploading a new version that stores all data on ThinData on the same folder as you suggested (the older one stored it on Thinstall, and if the Thinstall folder didn't already exist, it stored it on %AppData%).

I forgot to mention it, both My Documents and the Desktop are already on Merged mode by ##Attributes.ini. External drives are too, on the Package.ini. Rest of places are WriteCopy.

I'd add multiple sandboxes, but I can't find a way to change the stored data folder on real-time. Maybe a external program that runs before Thinstall loads itself and renames any folder to ThinData, and then renames it back again after finishing would do the trick, but then you would be able to run one sandbox at once. I'm looking at the scripting functions, but I still have to figure out how to run them from AutoIt.

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#6 Post by Queue »

iamzenitraM wrote:...and if the Thinstall folder didn't already exist, it stored it on %AppData%).
Bah, now I don't know what I want. This functionality may prove really useful to me, as I often use a flash drive set read-only, so being able to leave a sandbox in the local %AppData% folder would be a good option for me in some cases.

Queue

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#7 Post by lococobra »

I know autoit pretty well, so ask away. Another thing is, standard autoit icon? Bahh... make one! or at least use one that looks better.

About the actual direction of the project, instead of aiming this toward your exe being used as a launch platform, why not make it a sort of use on runtime sort of thing. You should make it so that after running it the first time, it saves it's run settings (the exe it runs with) in an INI file, that way you can seamlessly use the ThinLoader exe instead of the app's from that point out. Alternatively, you could fall back to using only an INI file to choose the exe, this would reduce space in the autoit exe

If you want to do it this way, you should focus a lot of your attention towards minimizing the exe's size and memory footprint. In autoit, make sure you use the "Highest" level of UPX compression and remove all unnecessary code.

In Thinstall: https://thinstall.com/help/index.php?co ... ontype.htm

You probably have already done most of that, but I figured I'd remind you just in case.

Hurray for difficult to understand posts, sorry I was in a rush.

iamzenitraM
Posts: 5
Joined: Sat Mar 15, 2008 1:53 pm

#8 Post by iamzenitraM »

lococobra wrote:I know autoit pretty well, so ask away. Another thing is, standard autoit icon? Bahh... make one! or at least use one that looks better.

About the actual direction of the project, instead of aiming this toward your exe being used as a launch platform, why not make it a sort of use on runtime sort of thing. You should make it so that after running it the first time, it saves it's run settings (the exe it runs with) in an INI file, that way you can seamlessly use the ThinLoader exe instead of the app's from that point out. Alternatively, you could fall back to using only an INI file to choose the exe, this would reduce space in the autoit exe

If you want to do it this way, you should focus a lot of your attention towards minimizing the exe's size and memory footprint. In autoit, make sure you use the "Highest" level of UPX compression and remove all unnecessary code.

In Thinstall: https://thinstall.com/help/index.php?co ... ontype.htm

You probably have already done most of that, but I figured I'd remind you just in case.

Hurray for difficult to understand posts, sorry I was in a rush.
Icon and compression will come later :)
I don't know what do you mean with the "runtime" thing. It's already designed to run as a runtime with the choosemain option, doing that it stores the path to a .exe you want to run by default on a INI on the virtual T: drive and runs it the following times, so you can even rename ThinLoader.exe to whatever you want. The problem is the ThinData folder...

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#9 Post by lococobra »

Oh, right... I read that in the code, I guess I just wasn't quite getting it.

Honestly, I think it's pretty solid as is. The only thing I'd do code wise is create a function that handles the FileOpenDialog lines, so that code isn't repeated so much.... but, that really isn't necessary. Great job :)

If you wanted to "Maybe a external program that runs before Thinstall loads itself and renames any folder to ThinData" you could use some code similar to this to keep it all in one exe, however, this is messy because by the time the real program is loaded, you would have 3 programs running...

Code: Select all

FileInstall("C:\WINDOWS\system32\calc.exe", @ScriptDir&'\calc.exe')
$pid = Run(@ScriptDir&'\calc.exe')
ProcessWaitClose($pid)
FileDelete(@ScriptDir&'\calc.exe')
By the way, want me to host this on my site?

iamzenitraM
Posts: 5
Joined: Sat Mar 15, 2008 1:53 pm

#10 Post by iamzenitraM »

lococobra wrote:Oh, right... I read that in the code, I guess I just wasn't quite getting it.

Honestly, I think it's pretty solid as is. The only thing I'd do code wise is create a function that handles the FileOpenDialog lines, so that code isn't repeated so much.... but, that really isn't necessary. Great job :)

If you wanted to "Maybe a external program that runs before Thinstall loads itself and renames any folder to ThinData" you could use some code similar to this to keep it all in one exe, however, this is messy because by the time the real program is loaded, you would have 3 programs running...

Code: Select all

FileInstall("C:\WINDOWS\system32\calc.exe", @ScriptDir&'\calc.exe')
$pid = Run(@ScriptDir&'\calc.exe')
ProcessWaitClose($pid)
FileDelete(@ScriptDir&'\calc.exe')
By the way, want me to host this on my site?
I meant a way of choosing where do you want ThinLoader to read/store the sandbox data from on realtime, for example, having two sandboxes, one for App A and one for App B, on different folders (ie: AppAData and AppBData) and then choosing which sandbox do you want to run. Or choosing AppAData if Thinloader is renamed to AppA.exe and AppBData if it's AppB.exe. But I don't think that's possible.. seems that the folder is hardcoded on the Thinstaller app.

One solution would be to make a launcher that opens before ThinLoader, asks you which app do you want to run (AppA or AppB), renames AppAData to ThinData, and then executes ThinLoader. But doing that you wouldn't be able to run more than one at once..

So, I'll try to find a cool icon and optimize it as much as I can - as it works quite well as-is, as the hard work is done by Thinstall, it only needs improvements :)

Feel free to host it.

ssanai
Posts: 7
Joined: Mon Mar 17, 2008 10:19 am

it's a very interesting idea but it doen't work for me!

#11 Post by ssanai »

iamzenitraM~ your idea is brilliant. I love it.

However, I could not make it work.

I tried to install Firefox3 beta4 for testing but there are not proper files in the thindata folder\firefox.

in the firefox folder, firefox.exe was sopposed to exist but there wasn't.

Strangely, firefox.exe folder ( folder name is firefox.exe) was found. ???

Is it only my problem or all?

I hope you can figure out this issue.

Anyway, if it really works then .....


I guess .....

making a launcher, you can launch many programs from a thinData folder. Also many other things.


I hope it will work for me. keep updating it~ please.

Thanks.

freakazoid
Posts: 1212
Joined: Wed Jul 18, 2007 5:45 pm

#12 Post by freakazoid »

this looks very promising!

i will test this out at a later date.
is it stealth? ;)

iamzenitraM
Posts: 5
Joined: Sat Mar 15, 2008 1:53 pm

Re: it's a very interesting idea but it doen't work for me!

#13 Post by iamzenitraM »

ssanai wrote:iamzenitraM~ your idea is brilliant. I love it.

However, I could not make it work.

I tried to install Firefox3 beta4 for testing but there are not proper files in the thindata folder\firefox.

in the firefox folder, firefox.exe was sopposed to exist but there wasn't.

Strangely, firefox.exe folder ( folder name is firefox.exe) was found. ???

Is it only my problem or all?

I hope you can figure out this issue.

Anyway, if it really works then .....


I guess .....

making a launcher, you can launch many programs from a thinData folder. Also many other things.


I hope it will work for me. keep updating it~ please.

Thanks.
I just tried it - it seems it's a bug on Thinstall, as the files are extracted but they're folders instead of files. There's not much I can do about it.. :roll:

FITS
Posts: 14
Joined: Sat Mar 03, 2007 4:46 am
Contact:

#14 Post by FITS »

i am a user of thinstall and i have been called an expert at thinstalling i can net see the point of this no program can run from with in a thinstalled app unless its been done by scripting

so can someone please tell me the need for this app

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#15 Post by Queue »

Personally, I used "choosemain cmd.exe" so I have a way of copying files and whatnot into the sandbox. Explorer.exe unfortunately doesn't seem to get snagged by Thinstall properly. Ideally I want to dig up a very simple and small file manager that I can embed within the sandbox and use as my default application when I run ThinLoader.

Queue

Post Reply