Platform SDK: Files and I/O

SetVolumeMountPoint

The SetVolumeMountPoint function mounts the specified volume at the specified volume mount point.

BOOL SetVolumeMountPoint(
  LPCTSTR lpszVolumeMountPoint, // mount point
  LPCTSTR lpszVolumeName        // volume to be mounted
);

Parameters

lpszVolumeMountPoint
[in] Pointer to a string that indicates the volume mount point where the volume is to be mounted. This may be a root directory (X:\) or a directory on a volume (X:\mnt\). The string must end with a trailing backslash ('\').
lpszVolumeName
[in] Pointer to a string that indicates the volume to be mounted. This string must be a unique volume name 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 Path Lengths. For example, "\\?\C:\myworld\private" is seen as "C:\myworld\private".

Return Values

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.

Remarks

It is not an error to attempt to mount a volume at a volume mount point at which a volume is already mounted. In this case, the system unmounts the preceding volume without sending notifications before attempting to mount the new volume.

It is an error to attempt to mount a volume on 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.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

File Systems Overview, File System Functions, DeleteVolumeMountPoint, GetVolumeNameForVolumeMountPoint, GetVolumePathName