Mounting Points and authentication IDs


When the disk driver mounts a volume, the volume must be accessible via certain mounting point. This is the name which will be used by the system to access this volume. Each volume must have at least one mounting point, and it can have several mounting points if necessary.

Mounting points can be global (i.e. visible in all user sessions) or local (visible only in some specific user session). Note that if the program is run with elevated rights ("run as administrator") and it creates a local mounting point, this local mounting point is local for elevated session and consequently is not visible to other applications including Explorer.

When the mounting point is added or removed, CBFS Disk API broadcasts a system message (WM_DEVICECHANGE) which tells Windows Explorer to refresh the list of disks available in the system. The problem comes when you add or remove the mounting point from the service application. The messages can't go across different user sessions, and Explorer won't receive the notifications. To work around this problem CBFS Disk inlcudes Explorer Notification helper DLL (described here).

Disk letter mounting points

You can add mounting points that will be visible to the user by specifying the "disk name" as a mounting point. The disk name consists of a single character in range A to Z followed by a colon, for example "Z:".

UNC path mounting points

You can create mounting points that will be only visible when you call them using their names. Such points start with "\\.\" followed by point name.

The functions, which work with mounting volumes, accept point names with "\\.\" part omited.
To add a new hidden mounting point call AddMountingPoint() and pass "CBFSDisk_Volume1" as the name, eg. AddMountingPoint("CBFSDisk_Volume1"). If you want to delete the name "\\.\CBFSDisk_Volume1", call DeleteMountingPoint() method and pass "CBFSDisk_Volume1" as the name, eg. DeleteMountingPoint("CBFSDisk_Volume1").

Network mounting points

Network mounting points are not much different from the regular mounting points, but they are seen by the OS as if they were remote devices. Such specifics is useful because

  • Windows Explorer doesn't read thumbnails from the files located on remote devices
  • Some applications are more tolerant to timeouts and delays when working with remote devices.
So if your virtual file system works with some slow storage or across network, you need to employ a network mounting point. When you use network mounting point, you need to install Network Redirector helper DLL (described here).

Also, you can share the network mounting point, i.e. make it visible for other computers, as if it were created as a network share from the real disk.

When you create a network mounint point (by setting a corresponding flag in the Flags parameter of AddMountingPoint method), the special form of the mounting point name is used. The mounting point has the following form:

<Local Mounting Point>;<Server name>;<Share Name>


  • Local Mounting Point is the name of the mounting point local to the system on which the point is created (as described above). You can leave this name empty. If you leave it empty, the mounting point will be accessible only via the UNC path (see belw).
  • Server Name and Share Name are used to create the UNC path for share name: \\server_name\share_name. You can use any names for each of these parameters.

First variant creates a local disk letter and a network share.
In the second sample MyMountingPoint can be used to access the mounting point locally as "\\.\MyMountingPoint". Other computers will be able to access this mounting point as "\\MyServer\VirtualShare".
In the last sample the local mounting point is omited altogether and the disk can be accessed using the network path.

Folder mounting points

You can add a mounting point, which will be visible as a virtual folder within NTFS file system on existing disk. MountingPoint parameter can be set to eg. ("Z:") for a drive letter or eg. "C:\Existing\Folder\MyMountingPoint". To do this use CBFSDISK_SYMLINK_MOUNT_MANAGER flag in AddMountingPoint method. Such mounting points are visible to all users in the system, and creation of such points requires administrative rights.

If you create a plug-n-play device (StorageType property is set to stDiskPnP) which is not removable (scRemovableMedia flag is not set in StorageCharacteristics property), you may call AddMountingPoint() method only after successful call to MountMedia() method, otherwise you will get an error.

Authentication IDs

An Authentication ID is the locally unique identifier, or LUID, that is assigned to the logon session that the access token represents. Authentication ID is obtained from the access token as follows: call GetTokenInformation() Windows API function and pass it "TokenGroupsAndPrivileges" or "TokenStatistics" in TokenInformation parameter. The resulting value will be a reference to the structure (refer to MSDN for details), which contains the needed Authentication ID.

To enumerate logon sessions and retrieve the Authentication ID for specific logon session use LsaEnumerateLogonSessions function from Windows API, which returns the list of existing logon session IDs (which you are looking for). To obtain information about some session (for example to find out if this is a session that you are looking for), use LsaGetLogonSessionData function from Windows API. LsaGetLogonSessionData will return the structure, that contains all information about the session. Read the article on CodeProject about how to enumerate logon sessions.