Junction Box

A utility aimed at overcoming some of the problems created by  the 'junctions'  in Windows Vista/7 user-profiles. 


 
An issue experienced by users of Windows Vista or Windows 7 is that the user-profiles (Which are now stored under "Users" instead of "Documents and Settings") cannot be copied, transferred or backed-up in any simple way. This is owing-to the presence of 'junctions' within the profile.  JunctionBox offers a solution to this problem, by making it possible to backup and restore the junctions from a catalog. This catalog is a standard text  file which can be backed-up in the normal way.

-What is a junction?


A junction is a filesystem object not unlike a folder/directory (in fact it appears to most software that it IS a folder) but which is in reality a link to a folder elsewhere on the disk, or even on another disk.

When used carefully, junctions allow data from other sources to be included-into a folder-structure, such that software need not even be aware that the data is in fact located elsewhere. This can be useful in a number of circumstances.

-Why are Vista/7's junctions problematic, then?

Vista/7 user-profiles follow a different structure from those in Windows 2000/XP. To allow older software to function correctly in Vista/7, junctions are used to simulate the presence of the oldstyle profile-folders.

The key issue here is that some of these junctions are cyclic, that is they refer back to their own folder-structure, rather like a snake eating its own tail. The result is that programs which scan the folder-structure get stuck in an endless loop when they hit these cyclic junctions.

In an attempt to 'fix' this, Microsoft gave the junctions a special permission, that of Deny List Contents to Everyone. The idea here is that software which tries to scan the structure should see the junctions as being empty folders, and ignore them. Unfortunately the fix doesn't always work. This is primarily because backup-programs often have special rights to bypass restrictions on folders, thus the Deny permission is in this case not effective in preventing an endless loop.

Add to that, most file-copy routines simply don't know what to do with junctions (and this even includes Microsoft's own utilities!) thus a backup of a user's profile may omit the junctions entirely.

-What does Junction Box do?


JunctionBox allows you to backup and restore junctions to or from a catalog-file. It also allows you to delete them, if this is found necessary so that a backup of the profile proceeds normally. 

Creating a Backup:


Press Backup, and enter a suitable filename and location. Or just accept the suggested name. (The suggested extension is .ntj) By default, backups are saved to the program's own folder, since this is intended to be a portable utility. Depending on the amount of data on your disk, this may take a minute, or an hour. Once finished you should have a backup file. The structure of this is explained in DefaultJunctions.ntj

Backups always include the full set of junctions, the profile selector having no effect on this function.

Restoring Junctions:


Firstly select whether you wish to restore the set of junctions for the system-disk, or just those in a specific user-profile. 

You will then be presented with a file selector, from which the appropriate catalog should be selected.
A set of standard junctions is provided is the file DefaultJunctions.ntj, and this may be useful where you need to repair a computer for which no catalog has been made.

The restore process is relatively quick as only a small amount of data need be scanned, just the junctions.

After being restored, the junctions will have their special permissions applied, so that (well, in the hope that) this will prevent endless loops.

At present the software does not provide any way of restoring junctions without also adding these special permissions. If thought necessary this facility could be added.

Deleting Junctions:


Select the profile to delete the junctions within, and select Delete from the Junctions menu. Again you will be asked to specify a catalog file. This is NOT so that a backup can be made, and the catalog will not be altered. What happens here is that the catalog is used to identify the junctions to delete.

This approach is seen as being relatively safe, in that junctions will only be deleted which have already been included in the catalog. So, if you didn't backup, then you can only delete the default set of junctions, using DefaultJunctions.ntj. If you want to delete custom junctions which you've added yourself, then you need to backup first. Which, I think, makes sense.

Dependencies:


JunctionBox requires SetACL.exe by Helge Klein. This is included in the distribution, and is GPL licensed. The sourcecode is available from setacl.sourceforge.net.

The MKLINK component of cmd.exe is also required for restore operations, which rules-out use on platforms earlier than Vista. That said, earlier platforms such as Windows XP do not normally require a junction manager.

Notes:


Never attempt to delete a junction using Windows Explorer. You will probably not succeed, but if you DO, this will result in the contents being deleted instead of the junction itself, which could potentially be a disaster.

International Versions of Windows:


The names of system folders differ between languages, therefore a catalog made in one language should not be applied to another. To reduce the risk of accidents of this kind, the catalog-file header carries the locale information. You can edit this manually if you are sure that the file is suitable for your locale. See the comments in DefaultJunctions.ntj for more information.

Presently there is no support for languages which use special character-sets, which includes most Asian languages. As I don't have access to a suitable platform to test such aspects on, feedback or suggestions from users who do would be welcome. Be aware that operation on these language-versions is completely unverified, so please don't do your tests on a production computer!

Making your own DefaultJunctions file:


To make a DefaultJunctions.ntj file, run the backup option on an unmodified copy of the required Windows localization. Edit the file this produces using a text-editor (e.g. Notepad) to remove the useraccount-specific sections. Retain the system-folder sections and the All Users, Public and Default (or language equivalent thereof) profile sections. If necessary, add any more applicable locales to the OSLanguanges value in the General section, separated by commas. Now rename the file to DefaultJunctions.ntj

Download Here

Legal:


As ever, you use this system-level utility entirely at your own risk. Various forms of disaster are not excluded from the list of possible outcomes of its incorrect use. Or, even of its correct use.

This software may be duplicated any number of times, and used in private or commercial IT operations. The software may not be sold for profit in any shape or form. Third-party websites and P2P hosts may offer copies for download so long as these conditions are met.
 
The sourcecode and executables of this software are released under the GNU Public Licence, version 3. Icons and other graphics remain the intellectual property of IWR Consultancy, and may not be used in derivative works without permission.

It is not necessary to supply sourcecode with every downloaded copy, so long as a link to the publisher's website is included in some form or other at the download location.

The author supports the principle of the complete abolition of patents, and the review of copyright legislation to reduce its present levels of abuse.