Kernel32SetVolumeMountPoint Method

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

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static bool SetVolumeMountPoint(
	string volumeMountPoint,
	string volumeName
)

Parameters

volumeMountPoint  String
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 ('').

If the volumeMountPoint parameter contains a path to a mounted folder, last error returns ERROR_DIR_NOT_EMPTY, even if the directory is empty.

volumeName  String
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.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also