SetVolumeMountPoint function (Windows)

Switch View :
ScriptFree
SetVolumeMountPoint function

Applies to: desktop apps only

Associates a volume with a drive letter or a directory on another volume.

Syntax

BOOL WINAPI SetVolumeMountPoint(
  __in  LPCTSTR lpszVolumeMountPoint,
  __in  LPCTSTR lpszVolumeName
);

Parameters

lpszVolumeMountPoint [in]

The user-mode path to be associated with the volume. This may be a drive letter (for example, "X:\") or a directory on another volume (for example, "Y:\MountX\"). The string must end with a trailing backslash ('\').

lpszVolumeName [in]

A volume GUID path for the volume. This string must be of the form "\\?\Volume{GUID}\" where GUID is a GUID that identifies the volume. The "\\?\" turns off path parsing and is ignored as part of the path, as discussed in Naming a Volume.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If the lpszVolumeMountPoint parameter contains a path to a mounted folder, GetLastError returns ERROR_DIR_NOT_EMPTY, even if the directory is empty.

Remarks

When this function is used to associate a volume with a directory on another volume, the associated directory is called a mounted folder.

It is an error to associate a volume with a directory that has any files or subdirectories in it. This error occurs for system and hidden directories as well as other directories, and it occurs for system and hidden files.

When mounted folders are created on a volume on a clustered disk, they may be deleted unexpectedly under certain circumstances. For information on how to create and configure mounted folders to ensure that this does not happen, see Cluster Disk and Drive Connection Problems.

Examples

For an example, see Creating a Mounted Folder.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

SetVolumeMountPointW (Unicode) and SetVolumeMountPointA (ANSI)

See also

DeleteVolumeMountPoint
GetVolumeNameForVolumeMountPoint
GetVolumePathName
Volume Management Functions
Mounted Folders

 

 

Send comments about this topic to Microsoft

Build date: 4/17/2012

Community Content

wvd_vegt
GUID or Drive letter
It's not clear if a driverletter is also allowed instead of the guid path. Samplecode at http://msdn.microsoft.com/en-us/library/windows/desktop/aa365238(v=vs.85).aspx suggests it's allowed.