CBFSConnect.AddMountingPoint method


Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

CBFSConnect     See also    


Adds a mounting point for the storage.


    procedure AddMountingPoint(MountingPoint: TCBString);
    procedure AddMountingPoint( MountingPoint: TCBString; Flags : integer; AuthenticationID : PLUID );

    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void AddMountingPoint(const unsigned short *mountingPoint);
    void AddMountingPoint( const unsigned short *mountingPoint, DWORD Flags, PLUID AuthenticationID);

[C++ (VCL)]
    void __fastcall AddMountingPoint(TCBString MountingPoint);
    void __fastcall AddMountingPoint( TCBString MountingPoint, DWORD Flags, PLUID AuthenticationID);

[C++ (.NET)]
    void AddMountingPoint(String ^MountingPoint);
    void AddMountingPoint( String ^MountingPoint, UInt32 Flags, Object^ AuthenticationID );

    void AddMountingPoint(String MountingPoint);
    void AddMountingPoint( String MountingPoint, UInt32 Flags, Object AuthenticationID );

    Sub AddMountingPoint(ByVal MountingPoint As String)
    Sub AddMountingPoint( ByVal MountingPoint As String, ByVal Flags As UInt32, ByVal AuthenticationID As Object)

    void addMountingPoint(String mountingPoint);
    void addMountingPoint( string mountingPoint, int flags, LUID authenticationID );
    public class LUID {
      public long mLowPart;
      public long mHighPart;


  • MountingPoint - The path of the mounting point (see About Mounting Points topic)
  • Flags - Zero or more flags that specify parameters of mounting point creation (see details below).
    Several flags are joined using bitwise-OR in C++, C# and VB.NET.
  • AuthenticationId - Authentication ID of the session.
    This parameter can be NULL/null/Nothing/nil if CBFSCONNECT_SYMLINK_LOCAL flag is not set or if the mounting point is added for the "current" session.

Values of Flags


Use this method to add a mounting point for mounted volume. Use DeleteMountingPoint to delete the mounting point.

Short form of the method (the one that accepts only MountingPoint parameter) creates a globally accessible mounting point.

Long form of the method can be used to create all types of mounting points as defined by combination of Flags method.

Read more About Mounting Points.

If you are creating the network mounting point, you can expose it as a network share which can be used by other computers (SMB share). This is done by specifying one of CBFSCONNECT_SYMLINK_NETWORK_READ_NETWORK_ACCESS or CBFSCONNECT_SYMLINK_NETWORK_WRITE_NETWORK_ACCESS flags in Flags parameter. If the share is to be created, the following conditions must be met:

  1. The ServerName part of MountingPoint parameter must be either empty or equal to the value returned by GetComputerName() function of Windows API.
  2. The process, which creates a network share, must have proper security rights that allow creation of network shares. If the rights are insufficient, the function fails.

In the case when the drive letter mounting point is created, AddMountingPoint broadcasts the WM_DEVICECHANGE message and waits until it's handled. Usually such handling lasts 0-10 seconds. In the case you don't want such waiting, use CBFSCONNECT_SYMLINK_DRIVE_LETTER_NOTIFY_ASYNC flag. For example File Explorer doesn't show new drive letter until it is notified by this message. And the waiting is required in situations when your code uses some "shell extension" API (like SHFileOperation) immediately after the AddMountingPoint call. If the flag is not set, the method waits for completion of the broadcast of the message, that notifies all processes in the current user session about the new drive.

For PnP storages the mounting point can be added only after successful call to MountMedia() method. For other storages the order doesn't matter.

Call from...

This method may be called only from outside of callback / event handlers.

See also

MountingPointCount property     StorageCharacteristics property     StorageType property     DeleteMountingPoint method     GetMountingPoint method     MountMedia method