Back home > Junction Points in Vista




 
  2/2007 - A Junction Point is a physical location on a local hard disk that points to another location on that disk or another storage device. It is essentially a shortcut, thus the shortcut icon on Junction Point folders in Windows Vista.

For the most part, you can ignore Junction Points for everyday use of Windows Vista. The Junction Points are in Vista for backward compatibility of pre-Vista applications. Pre-Vista applications (applications written for XP and 2000) look for folders that are no longer used in Vista. Folders with the “My” prefix such as My Documents, My Pictures, and so on. There are also folders in your user profile that have been changed in Vista, and pre-Vista apps might be looking for the old folder structure during installation. If you don’t set the option to Show Hidden Files in Windows Explorer, you will rarely even see the Junction Point folders.

--------------------------------------------------------------------------------------------------------

From the Microsoft MSDN web site:

In Windows Vista and Windows Server "Longhorn", the default locations for user data and system data have changed. For example, user data that was previously stored in the %SystemDrive%\Documents and Settings directory is now stored in the %SystemDrive%\Users directory. In order to minimize the amount of application compatibility problems users would experience due to the change in folders names, such as C:\Documents and Settings moving to C:\Users, Microsoft employed junction points.  These junction points make it so that hard coded reads and writes to legacy file locations would automatically go to the correct new location without changing the application.

Junction points can be identified as follows :

  • They have the FILE_ATTRIBUTE_REPARSE_POINT, FILE_ATTRIBUTE_HIDDEN, and FILE_ATTRIBUTE_SYSTEM file attributes set.
  • They also have their access control lists (ACLs) set to deny read access to everyone.

Applications that call out a specific path can traverse these junction points if they have the required permissions. However, attempts to enumerate the contents of the junction points will result in failures. It is important that backup applications do not traverse these junction points, or attempt to backup data under them, for two reasons:

  • Doing so can cause the backup application to back up the same data more than once.
  • It can also lead to cycles (circular references).

Per-User Junctions and System Junctions

The junction points that are used to provide file and registry virtualization in Windows Vista and Windows Server "Longhorn" can be divided into two classes: per-user junctions and system junctions.

Per-user junctions are created inside each individual user's profile to provide backward compatibility for user applications. The junction point at C:\Users\username\My Documents that points to C:\Users\username\Documents is an example of a per-user junction. Per-user junctions are created by the Profile service when the user's profile is created.

The other junctions are system junctions that do not reside under the Users\username directory. Examples of system junctions include:

  • Documents and Settings
  • Junctions within the All Users, Public, and Default User profiles

System junctions are created by userenv.dll when it is invoked by Windows Welcome (also called the machine out-of-box-experience, or mOOBE).

--------------------------------------------------------------------------------------------------------

Access Denied

You might have noticed when clicking on a folder in Windows Explorer, with a shortcut icon on it (a Junction Point), you get an Access Denied message from Vista. This is to be expected. As mentioned above, the Read permission for Junction Points is set to Everyone – Deny. You are not supposed to access these folders, and there really is no reason to access these folders. Again, these Junction Points are just pointers to the new folder structure used in Vista. So how do you know what this new folder structure is? Where are those Junction Points pointing to?

The easiest way to track down the real location of the files is to open a command prompt and change to the directory that contains the junction point, and run this command dir /aL (note: I use uppercase L so you would know it was an L, not an I. You can use lowercase letters too)

This will display all the junction points and the location that the Junction Point refers too. You can also run the following command from a command prompt to save a list of all the Junction Points on your C: drive:

C:\>dir /aL /s > c:\users\<username>\JunctionPoints.txt (you can redirect it to wherever you want)

Note: At the bottom of this document is a printout of all the Junction Points on a newly installed Vista Ultimate PC. 


User Profiles in Windows Vista

In Windows XP, 2000, 2003, user profiles are stored under c:\Documents and Settings. In Windows Vista (and the soon to be Windows Server 2008 – Longhorn), profiles are now stored under c:\Users. You will see a c:\Documents and Settings folder in Windows Explorer in Vista, but you will also notice the shortcut icon on this folder, and you will not be able to access this folder. c:\Documents and Settings is now a Junction Point. You can use the dir /aL command to see where c:\Documents and Settings points to or use the table below.

The following table lists the old profile path and the corresponding new path under Windows Vista/Longhorn Server.

Old Path

New Path

\Documents and Settings

\Users

\Documents and Settings\Default User or
%LOGONSERVER%\NETLOGON\Default User

\Users\Default or
%LOGONSERVER%\NETLOGON\Default

\Documents and Settings\<user>\My Documents

\Users\<user>\Documents

\Documents and Settings\<user>\My Documents\My Pictures

\Users\<user>\Pictures

\Documents and Settings\<user>\My Documents\My Music

\Users\<user>\Music

\Documents and Settings\<user>\Favorites

\Users\<user>\Favorites

N/A

\Users\<user>\Contacts

N/A

\Users\<user>\Downloads

N/A

\Users\<user>\SavedGames

\Documents and Settings\<user>\Application Data

\Users\<user>\AppData\Roaming

\Documents and Settings\<user>\Local Settings\Application Data

\Users\<user>\AppData\Local

\Documents and Settings\<user>\Start Menu

\Users\<user>\AppData\Roaming\Microsoft\Windows\ Start Menu

\Documents and Settings\All Users

\Users\Public

\Documents and Settings\All Users\Start Menu

\ProgramData\Microsoft\Windows\Start Menu

\Documents and Settings\All Users\Desktop

\Users\Public\Desktop

Folders to take note of here are the folders in the All Users path. Many older applications that use out of date methods to resolve system folders, will resolve paths under C:\ProgramData when looking for common locations. For example, the common desktop may be resolved as C:\ProgramData\Desktop, however; this is actually a junction point for C:\ProgramData\Users\Public\Desktop. A dir /aL listing in the C:\ProgramData folder reveals the following Junction Points:

Path

Points To

\ProgramData\Application Data

\ProgramData

\ProgramData\Desktop

\Users\Public\Desktop

\ProgramData\Documents

\Users\Public\Documents

\ProgramData\Favorites

\Users\Public\Favorites

\ProgramData\Start Menu

\ProgramData\Microsoft\Windows\Start Menu

\ProgramData\Templates

\ProgramData\Microsoft\Windows\Templates

 

Environmental Variables

There are also differences in environment variables between Windows Vista and the older versions of Windows. Windows Server 2003 and below define the following variables relating to profiles:

ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\bjohnson\Application Data
HOMEPATH=\Documents and Settings\bjohnson
TEMP=C:\DOCUME~1\bjohnson\LOCALS~1\Temp
TMP=C:\DOCUME~1\bjohnson\LOCALS~1\Temp
USERPROFILE=C:\Documents and Settings\bjohnson

Windows Vista and Longhorn Server define the same variables while adding a couple more.

ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\bjohnson\AppData\Roaming
HOMEPATH=\Users\bjohnson
LOCALAPPDATA=C:\Users\bjohnson\AppData\Local
ProgramData=C:\ProgramData
PUBLIC=C:\Users\Public
TEMP=C:\Users\bjohnson\AppData\Local\Temp
TMP=C:\Users\bjohnson\AppData\Local\Temp
USERPROFILE=C:\Users\bjohnson

So what is the point?

For the average user, Junction Points will be mostly invisible, so to speak. For application developers, understanding Junction Points and how their pre-Vista apps might behave in Windows Vista is very important. For IT admins and support people who must know the intimacies of the file system and where files are, Junction Points will probably be a pain in the neck. For example, where do you now put an application that you would have put in the startup folder for the All Users profile? What was fairly simple in XP, is now somewhat of a treasure hunt in Vista.

Microsoft, back oh so many years ago, decided to personalize Windows with My this and My that. It was a little cutesy, and unnecessary. Someone in Redmond must have said get rid of the My crap and go back to normal folder names. So now we are rid of cutsey, but have a maze of pointers, Junctions Points, soft links, hard links and so on to deal with.

 

List of Junction Points in Windows Vista

Volume in drive C has no label.
Volume Serial Number is A494-603B

Directory of C:\

11/02/2006 08:00 AM <JUNCTION> Documents and Settings [C:\Users]

0 File(s) 0 bytes

Directory of C:\ProgramData

11/02/2006 08:00 AM <JUNCTION> Application Data [C:\ProgramData]

11/02/2006 08:00 AM <JUNCTION> Desktop [C:\Users\Public\Desktop]

11/02/2006 08:00 AM <JUNCTION> Documents [C:\Users\Public\Documents]

11/02/2006 08:00 AM <JUNCTION> Favorites [C:\Users\Public\Favorites]

11/02/2006 08:00 AM <JUNCTION> Start Menu [C:\ProgramData\Microsoft\Windows\Start Menu]

11/02/2006 08:00 AM <JUNCTION> Templates [C:\ProgramData\Microsoft\Windows\Templates]

0 File(s) 0 bytes

Directory of C:\Users

11/02/2006 08:00 AM <SYMLINKD> All Users [C:\ProgramData]

11/02/2006 08:00 AM <JUNCTION> Default User [C:\Users\Default]

0 File(s) 0 bytes

Directory of C:\Users\All Users

11/02/2006 08:00 AM <JUNCTION> Application Data [C:\ProgramData]

11/02/2006 08:00 AM <JUNCTION> Desktop [C:\Users\Public\Desktop]

11/02/2006 08:00 AM <JUNCTION> Documents [C:\Users\Public\Documents]

11/02/2006 08:00 AM <JUNCTION> Favorites [C:\Users\Public\Favorites]

11/02/2006 08:00 AM <JUNCTION> Start Menu [C:\ProgramData\Microsoft\Windows\Start Menu]


11/02/2006 08:00 AM <JUNCTION> Templates [C:\ProgramData\Microsoft\Windows\Templates]

0 File(s) 0 bytes


Directory of C:\Users\bjohnson

01/12/2007 11:12 AM <JUNCTION> Application Data [C:\Users\bjohnson\AppData\Roaming]

01/12/2007 11:12 AM <JUNCTION> Cookies [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows\
Cookies]

01/12/2007 11:12 AM <JUNCTION> Local Settings [C:\Users\bjohnson\AppData\Local]

01/12/2007 11:12 AM <JUNCTION> My Documents [C:\Users\bjohnson\Documents]

01/12/2007 11:12 AM <JUNCTION> NetHood [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows\
Network Shortcuts]

01/12/2007 11:12 AM <JUNCTION> PrintHood [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows
\Printer Shortcuts]

01/12/2007 11:12 AM <JUNCTION> Recent [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows\
Recent]

01/12/2007 11:12 AM <JUNCTION> SendTo [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows\SendTo]

01/12/2007 11:12 AM <JUNCTION> Start Menu [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows\Start Menu]

01/12/2007 11:12 AM JUNCTION>Templates [C:\Users\bjohnson\AppData\Roaming\Microsoft\Windows\
Templates]

0 File(s) 0 bytes


Directory of C:\Users\bjohnson\AppData\Local

01/12/2007 11:12 AM <JUNCTION> Application Data [C:\Users\bjohnson\AppData\Local]

01/12/2007 11:12 AM <JUNCTION> History [C:\Users\bjohnson\AppData\Local\Microsoft\Windows\History]

01/12/2007 11:12 AM <JUNCTION> Temporary Internet Files [C:\Users\bjohnson\AppData\Local\Microsoft\Windows\Temporary Internet Files]

0 File(s) 0 bytes


Directory of C:\Users\bjohnson\Documents

01/12/2007 11:12 AM <JUNCTION> My Music [C:\Users\bjohnson\Music]

01/12/2007 11:12 AM <JUNCTION> My Pictures [C:\Users\bjohnson\Pictures]

01/12/2007 11:12 AM <JUNCTION> My Videos [C:\Users\bjohnson\Videos]

0 File(s) 0 bytes


Directory of C:\Users\Default

11/02/2006 08:00 AM <JUNCTION> Application Data [C:\Users\Default\AppData\Roaming]

11/02/2006 08:00 AM <JUNCTION> Cookies [C:\Users\Default\AppData\Roaming\Microsoft\Windows\Cookies]

11/02/2006 08:00 AM <JUNCTION> Local Settings [C:\Users\Default\AppData\Local]

11/02/2006 08:00 AM <JUNCTION> My Documents [C:\Users\Default\Documents]

11/02/2006 08:00 AM <JUNCTION> NetHood [C:\Users\Default\AppData\Roaming\Microsoft\Windows\Network Shortcuts]

11/02/2006 08:00 AM <JUNCTION> PrintHood [C:\Users\Default\AppData\Roaming\Microsoft\Windows\Printer Shortcuts]

11/02/2006 08:00 AM <JUNCTION> Recent [C:\Users\Default\AppData\Roaming\Microsoft\Windows\Recent]

11/02/2006 08:00 AM <JUNCTION> SendTo [C:\Users\Default\AppData\Roaming\Microsoft\Windows\SendTo]

11/02/2006 08:00 AM <JUNCTION> Start Menu [C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu]

11/02/2006 08:00 AM <JUNCTION> Templates [C:\Users\Default\AppData\Roaming\Microsoft\Windows\Templates]

0 File(s) 0 bytes


Directory of C:\Users\Default\AppData\Local

11/02/2006 08:00 AM <JUNCTION> Application Data [C:\Users\Default\AppData\Local]

11/02/2006 08:00 AM <JUNCTION> History [C:\Users\Default\AppData\Local\Microsoft\Windows\History]

11/02/2006 08:00 AM <JUNCTION> Temporary Internet Files [C:\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files]

0 File(s) 0 bytes


Directory of C:\Users\Default\Documents

11/02/2006 08:00 AM <JUNCTION> My Music [C:\Users\Default\Music]

11/02/2006 08:00 AM <JUNCTION> My Pictures [C:\Users\Default\Pictures]

11/02/2006 08:00 AM <JUNCTION> My Videos [C:\Users\Default\Videos]

0 File(s) 0 bytes


Directory of C:\Users\Public\Documents

11/02/2006 08:00 AM <JUNCTION> My Music [C:\Users\Public\Music]

11/02/2006 08:00 AM <JUNCTION> My Pictures [C:\Users\Public\Pictures]

11/02/2006 08:00 AM <JUNCTION> My Videos [C:\Users\Public\Videos]

0 File(s) 0 bytes


Total Files Listed:

0 File(s) 0 bytes
50 Dir(s) 22,453,432,320 bytes free

 

 

 
     
     
       
 

   Top