Virtual File System
Previous Top Next

Thinstall allows you to package multiple files inside of your EXE by creating a Virtual Filesystem
that is only visisble to your application. At runtime your application can access both virtual files
and real system without needed to know the difference between the two.
clip0318
To your application a virtual file is indistinguishable from a normal file, however it does not actually exist on the hard drive. Thinstall makes it appear as though all virtual files have been extracted to the hard drive. Because virtual and regular files may simutaneously exist at the same path location, Thinstall allows you to control which version will be used when a file is read, or where the data will be place when data is written to a file. Virtual files remain in the compressed archive form in your EXE package and never need to extract to disk.


An Example: Packaging CMD.EXE using Thinstall to add a virtual file.

In this example, we used Thinstall to package CMD.EXE using Thinstall. Thinstall created a new version of CMD.EXE called NEW_CMD.EXE which has one virtual file included. Note that in the directory listing on step 3 the virtual file shows up when we run the "dir" command, but in step 5 when we exit NEW_CMD.EXE (and return to normal CMD.EXE) the file disappears from the directory listing. In fact, the file never actually existed on the hard drive at all. Thinstall only makes the file appear to exists to the running application.
clip0314
What is happening in this demo?

Step 1: Create a real text file on the harddrive
We run the normal version of cmd.exe to obtain a DOS Shell. In the DOS shell we run the command:
type con > real_file.txt
This creates a text file. We could have also used notepad or any other text editor.

Step 2: Build NEW_CMD.EXE using Thinstall
· Build a Thinstall package using CMD.EXE as the input EXE and NEW_CMD.EXE as the output EXE.
· Add a virtual file to your Thinstall project by using Virtual Files -> Add Virtual File
· Double-click on the real_file.txt and edit the Virtual Filename.
· Change the Virtual Filename to %InstallPath%\virtual_file.txt, this means the virtual file will appear in the same directory as the main EXE with the name virtual_file.txt
· Click the Build! button
· Run the new_cmd.exe from your already open DOS Shell

clip0316
Step 3: Inspect the virtual environment
Run the command "dir" to verify the virtual file is visible to your application. If you switch to explorer or another cmd.exe you can verify the virtual file does not really exist on the hard drive.
Did you notice real_file.txt shows up in the directory listing as well? Real system files and virtual files can exist in the same directory.

Step 4: View the contents of the Virtual File
Run the command "type virtual_file.txt > con" to display the contents of the virtual file.

Step 5: Exit the new shell and verify the virtual file does not really exist
Running the command "exit" will quit the program NEW_CMD.EXE and return to the parent process "CMD.EXE".
If we return to the CMD.EXE process and run "dir" again, the virtual file has now disappeared. Only programs run by Thinstall have access to your virtual files.


Special Notes about this example
CMD.EXE is a 32bit program that comes with Windows NT, 2k, and XP. Windows 95/98/ME use a 16bit program called command.com to provide the DOS Shell. Thinstall does not support 16bit programs.