Click here to Skip to main content
15,867,308 members
Articles / Desktop Programming / MFC

TCExplorer - Portable Software to Import, Export, Delete, Rename, View, Edit and Execute Files in TrueCrypt Containers

Rate me:
Please Sign up or sign in to vote.
4.71/5 (13 votes)
9 Oct 20079 min read 207.8K   2.5K   52   40
A portable software to import, export, delete, rename, view, edit and execute files in TrueCrypt containers without requiring administrative privileges
Screenshot - TCExplorer.gif

Introduction

TrueCrypt is a free open-source disk encryption software. It is able to create a virtual encrypted disk within a file and mounts it as a real disk. The encryption is automatic, real-time (on-the-fly) and transparent. However, a major disadvantage of TrueCrypt and all other on-the-fly encryption software is the requirement of administrative privileges on the computers where they are used. Thus they will not be usable in places such as public libraries and internet cafes, where the computers are typically locked down and the users are given only limited privileges.

The purpose of this software is to overcome this limitation of TrueCrypt by providing an interface, similar to compression and decompression software, where directories and files can be imported and exported easily from TrueCrypt containers. There are some debates on the merits of such software. Those in favor argue that it will make TrueCrypt truly portable. Those against it argue that it is a security breach to extract files stored in TrueCrypt containers to computers where you do not have control. I do not wish to partake in such debates. This software arises because of my own needs. I wish to transport my documents (which are not very confidential) in my thumbdrive but I do not wish others to be able to look at my documents if I accidentally lose my thumbdrive. Thus I need to encrypt my files and a good candidate to encrypt them is TrueCrypt. However, as I may need to extract the files onto other computers (which most likely will not be logged in as administrator), I will need a software which allows me to extract TrueCrypt files without requiring administrative privileges. A search on the net shows that it is possible to create such software and a proof-of-concept commandline software, OTFExplorer has been created by Josh Harris. However, the author did not wish to continue the project to build a GUI interface. This software picks up where Josh Harris left off.

Main Features

  1. Import directories/files into TrueCrypt containers
  2. Export directories/files from TrueCrypt containers
  3. Delete directories/files stored in TrueCrypt containers
  4. Rename directories/files stored in TrueCrypt containers
  5. View text/HTML/graphic files stored in TrueCrypt containers
  6. Edit files stored in TrueCrypt containers
  7. Execute files stored in TrueCrypt containers
  8. Show total, used and free space in TrueCrypt containers
  9. Color-code files according to their extensions
  10. Rapidly access list of favorite TrueCrypt containers

Main Limitations

The following limitations primarily arise because of the limitation of OTFExplorer.

  1. Cannot handle files with Unicode names in TrueCrypt containers (though able to open TrueCrypt containers with Unicode names)
  2. Can only open TrueCrypt containers with FAT partitions
  3. Cannot handle hidden volumes (may not be a limitation of OTFExplorer)

Usage

Opening a TrueCrypt container: Either use File->Open or just drag and drop a TrueCrypt container from Windows Explorer to TCExplorer.

Importing directories/files into TrueCrypt container: Drag and drop directories/files from Windows Explorer to TCExplorer.

Exporting directories/files from TrueCrypt container: Drag and drop directories/files from TCExplorer to Windows Explorer. The directories/files will first be extracted to a predefined temporary directory, and then moved to the destination directory.

Deleting directories/files from TrueCrypt container Select directories/files in TCExplorer and press Del key.

Renaming directories/files from TrueCrypt container: Select a directory or file in TCExplorer and click on it again to activate the change name option.

Opening a TrueCrypt container from commandline: The command "TCExplorer.exe confidential.tc" will launch TCExplorer and load the TrueCrypt container "confidential.tc". TCExplorer will then prompt the user for password before continuing. This feature may be useful if you want to always automatically load a particular TrueCrypt container when you plug in your thumbdrive.

Opening a file in TrueCrypt container for editing or execution: Double click on the files to open. The files will first be extracted to a predefined temporary directory and then either opened using the associated program or if it is an executable file, it will be run. If the opened files were modified, the user will be asked whether he/she wishes to re-import the modified file into the TrueCrypt container.

Viewing a file using the internal viewerRight-click on a file and choose "View with Internal Viewer". The file will be extracted to memory and shown in an internal viewer. This feature is useful if you do not wish to write any files to disk. However, the file may still remain in memory after the internal viewer is closed.

Options

  1. Stay on top: Make TCExplorer stay on top of other windows
  2. View file size: View size of files stored in TrueCrypt containers
  3. Save window position: Save last window position and size on closing and revert on next launch

Points of Interest

TCExplorer is built using wxWidgets. The source codes provide a good learning resource for drag and drop operations. Of particular interest is the development of customized wxIDropSource and wxDropSource classes (TCIDropSource and TCDropSource).

C++
STDMETHODIMP TCIDropSource::QueryContinueDrag(BOOL fEscapePressed,
                                              DWORD grfKeyState)
{
  if ( fEscapePressed )
    return DRAGDROP_S_CANCEL;

  // initialize ourselves with the drag begin button
  if ( m_grfInitKeyState == 0 ) {
    m_grfInitKeyState = grfKeyState & (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON);
  }

  if ( !(grfKeyState & m_grfInitKeyState) ) {
    // button which started d&d released, go!

    m_pDropSource->tcList_->Export(); 	// Export directories and files 
					// to temporary system directory.

    return DRAGDROP_S_DROP;
  }

  return S_OK;
}    

The above shows the modifications to the wxIDropSource class. By adding codes before the return DRAGDROP_S_DROP; statement, TCExplorer is able to delay the extraction of files to the temporary directory until the user releases the mouse button. However, I do not know how to check whether the window where the user drops the files is able to receive the files or not. So even if the window is not able to receive the files, the files will still be extracted to the temporary directory.

C++
TCDropSource::TCDropSource(TCList *tcl,
                           const wxCursor &cursorCopy,
                           const wxCursor &cursorMove,
                           const wxCursor &cursorStop)
            : wxDropSourceBase(cursorCopy, cursorMove, cursorStop), tcList_(tcl)
{
    Init();
}

TCDropSource::TCDropSource(wxDataObject& data,
                           TCList *tcl,
                           const wxCursor &cursorCopy,
                           const wxCursor &cursorMove,
                           const wxCursor &cursorStop)
            : wxDropSourceBase(cursorCopy, cursorMove, cursorStop), tcList_(tcl)
{
    Init();
    SetData(data);
}   

The above shows the main modification to the wxDropSource class. The two constructors are changed so that they will receive a pointer to the class which handles the export function.

A side effect of using the wxIDropSource and wxDropSource classes is that TCExplorer can only be compiled for the Windows platform, even though it is using wxWidgets.

In addition to the drag and drop operations, the source codes also provide numerous examples of directory operations in wxWidgets. The source codes are fairly well commented and the reader is invited to look at them to understand more of the inner workings of TCExplorer.

Compiling the Source Code

A Code::Blocks configuration file is provided. You will need to download and install wxWidgets before you can compile TCExplorer. For more details on the required location of the wxWidgets libraries, please refer to the Code::Blocks configuration file.

Known Bugs

  • Bug 1: The list control window in TCExplorer may not refresh correctly after renaming a directory/file. Workaround: Press F5 to refresh the list control. (If there are any wxWidgets experts who know how to solve this, please contact me.)
  • Bug 2: TCExplorer may crash when importing/exporting/deleting/renaming a file with apostrophe. I was able to duplicate the crash a few times before it disappears again.

License

TCExplorer is released as public domain. This means that the source code is provided without any restrictions. The licence for OTFExplorer is included in the source code package.

Future Plans

None. TCExplorer has currently met all my personal needs so I will not be adding any new features in the near future (though from my updates since version 1.1, you can see that I do add new features if I find that they are easy to add). Since the source code is public domain, you are free to modify it to suit your needs. However, I would appreciate it if you could either send me any important modifications so that I can incorporate it into TCExplorer, or release the modifications yourself so that everyone can benefit from it.

History

  • 29 September 2007: Version 1.6 released
    • Bugfix: Corrected bug that occurs during drag and drop TrueCrypt container file after previous opening error.
    • Enhancement: Added "Delete temp dir now" under File menu to delete the temporary directory immediately.
    • Enhancement: Added "Restore Defaults" button to Temporary Directory options.
    • Enhancement: Allow user to specify colours for displaying files based on their extensions.
    • Enhancement: Allow user to view contents of text files without extracting the files from the TrueCrypt container.
  • 17 September 2007: Version 1.5.1 released
    • Bugfix: Resolve "DDE execute request failed" error.
  • 4 September 2007: Version 1.5 released.
    • Bugfix: Corrected over-aggressive check for full TrueCrypt container on import.
    • Enhancement: Added message dialog for confirmation of overwriting existing files in container during import.
    • Enhancement: Allow user to define any directory as the temporary directory.
    • Enhancement: Added option to securely delete directories/files in temporary directory using Eraser commandline (eraserd.exe).
    • Enhancement: Added Favorites menu to allow user to maintain a list of TrueCrypt containers for easy access.
    • Enhancement: Allow TCExplorer to open a file in TrueCrypt container using the associated program and re-import the file if changes are done.
  • 11 June 2007: Version 1.4 released.
    • Enhancement: TCExplorer now has an icon!
    • Enhancement: Allow TCExplorer to open a file from the commandline. e.g. "TCExplorer.exe confidential.tc".
    • Enhancement: Added option to allow TCExplorer to save last window position and size on closing and revert on next launch.
    • Enhancement: Added option to allow TCExplorer to not delete directories/files in temporary directory after exporting is finished so that users can use their own file shredder software to securely delete the temporary directories/files.
    • Enhancement: Added option to securely delete directories/files in temporary directory after exporting is finished by overwriting the files with null characters and then renaming them to ~ before deleting them. Directories are also renamed to ~ before deletion.
  • 8 June 2007: Version 1.3 released
    • Bugfix: Prevent directories/files in TrueCrypt container from dragging and dropping onto the same TrueCrypt container. The previous bugfix didn't really solve the problem.
    • Bugfix: Remove error message when no renaming is done.
    • Enhancement: Added option to view size of files stored in TrueCrypt containers.
  • 7 June 2007: Version 1.2 released. Thanks to dcrochet from TrueCrypt forum for pointing out the following bugs.
    • Bugfix: Prevent files from being imported if TrueCrypt container becomes full.
    • Bugfix: Prevent directories/files in TrueCrypt container from dragging and dropping onto the same TrueCrypt container.
    • Enhancement: TCExplorer is now compressed with UPX, thanks to BuddhaChu from PortableApps for the suggestion.
  • 3 June 2007: Version 1.1 released
    • Renamed software to TCExplorer because TrueCrypt is a registered trademark and cannot be used
  • 2 June 2007: Version 1.0 released

Disclaimer

The author does not guarantee that the software will work perfectly. Please use this software only on data that you can afford to lose. By downloading and using this software, you have implicitly agreed to be part of the guinea pig experiment to test the software for any bugs.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Researcher
Singapore Singapore
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionCan compile in VC++6 in debug mode, but not release mode Pin
JPM200914-Nov-13 7:36
JPM200914-Nov-13 7:36 
Generalhelp file to compile the source Pin
sanjayasaukar2-Dec-08 23:11
sanjayasaukar2-Dec-08 23:11 
Generalcannot find '/'. make sure the path is correct Pin
spdwslc25-Jun-08 14:47
spdwslc25-Jun-08 14:47 
AnswerRe: cannot find '/'. make sure the path is correct Pin
Raidiator31-Jul-08 3:34
Raidiator31-Jul-08 3:34 
Generalerror at first use: Not an OTF volume or incorrect password Pin
scottb8-Feb-08 12:24
scottb8-Feb-08 12:24 
GeneralRe: error at first use: Not an OTF volume or incorrect password Pin
Yap Chun Wei9-Feb-08 2:39
Yap Chun Wei9-Feb-08 2:39 
GeneralRe: error at first use: Not an OTF volume or incorrect password Pin
scottb11-Feb-08 9:42
scottb11-Feb-08 9:42 
GeneralRe: error at first use: Not an OTF volume or incorrect password Pin
Yap Chun Wei11-Feb-08 13:36
Yap Chun Wei11-Feb-08 13:36 
QuestionKeyfile support? Pin
Localfreak28-Dec-07 11:26
sussLocalfreak28-Dec-07 11:26 
GeneralRe: Keyfile support? Pin
Yap Chun Wei16-Jan-08 14:12
Yap Chun Wei16-Jan-08 14:12 
GeneralProblem in opening in vs 2005 Pin
bhaskar jatav18-Dec-07 22:20
bhaskar jatav18-Dec-07 22:20 
QuestionFeature request Pin
Dom7-Dec-07 2:05
Dom7-Dec-07 2:05 
GeneralRe: Feature request Pin
Yap Chun Wei16-Jan-08 14:10
Yap Chun Wei16-Jan-08 14:10 
GeneralI can't compile the sourcecode Pin
Trabi14-Nov-07 22:39
Trabi14-Nov-07 22:39 
Hello,

i tried to compile your sourcecode of TCExplorer 1.6 with
Code::Blocks 1.0 RC2 and wxWidget 2.8.6.

But i get this errormessage:

e:\CodeBlocks\lib/libmingw32.a(main.o):main.cFrown | :( text+0x106): undefined reference to `WinMain@16'

Can you explain me, what i do wrong?

Thanks.

Chris from Germany.
GeneralRe: I can't compile the sourcecode Pin
Yap Chun Wei16-Jan-08 14:10
Yap Chun Wei16-Jan-08 14:10 
QuestionError: Cannot find '/'. Make sure the path is correct. Pin
lz1nwm11-Nov-07 13:37
lz1nwm11-Nov-07 13:37 
GeneralTrojan-Downloader.Win32.Zlob.dmx (virus) Pin
lz1nwm23-Oct-07 13:31
lz1nwm23-Oct-07 13:31 
GeneralRe: Trojan-Downloader.Win32.Zlob.dmx (virus) Pin
Yap Chun Wei23-Oct-07 14:19
Yap Chun Wei23-Oct-07 14:19 
GeneralRe: Trojan-Downloader.Win32.Zlob.dmx (virus) Pin
lz1nwm11-Nov-07 13:34
lz1nwm11-Nov-07 13:34 
GeneralIssues Pin
Mc_Bain18-Sep-07 23:02
Mc_Bain18-Sep-07 23:02 
GeneralRe: Issues Pin
Yap Chun Wei20-Sep-07 3:08
Yap Chun Wei20-Sep-07 3:08 
GeneralRe: Issues Pin
Yap Chun Wei28-Sep-07 18:39
Yap Chun Wei28-Sep-07 18:39 
GeneralRe: Issues Pin
Mc_Bain1-Oct-07 21:07
Mc_Bain1-Oct-07 21:07 
Generalalternative Pin
donald00714-Sep-07 0:09
donald00714-Sep-07 0:09 
GeneralRe: alternative Pin
Yap Chun Wei17-Sep-07 4:53
Yap Chun Wei17-Sep-07 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.