Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "volume" in [All]

advapi32

.

        case SecurityEntity.SE_MANAGE_VOLUME_NAME:

.

           return "SeManageVolumePrivilege";

.

      SE_MANAGE_VOLUME_NAME,

.

public const string SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege";

ntdll

.
Summary
Creates a new file or directory, or opens an existing file, device, directory, or volume.
.

    #region change time available only thru NtQueryInformationFile and only on NTFS volume

.

    #endregion change time available only thru NtQueryInformationFile and only on NTFS volume

Enums

.

    FILE_DEVICE_DFS_VOLUME = 0x36,

.

    FILE_DEVICE_TRUST_ENV = 0x56 // IOCTL_VOLUME_BASE

.

    FILE_DEVICE_DFS_VOLUME = &H36

.

    FILE_DEVICE_TRUST_ENV = &H56 ' IOCTL_VOLUME_BASE

.
Summary
Specifies a set of bit flags that describes the Dfs root or link. One DFS_VOLUME_STATE flag is set and one DFS_VOLUME_FLAVOR flag is set.
.

enum DFS_VOLUME_FLAVORS {

.

    DFS_VOLUME_FLAVOR_UNUSED1=0x0000,

.

    DFS_VOLUME_FLAVOR_STANDALONE=0x0100,

.

    DFS_VOLUME_FLAVOR_AD_BLOB=0x0200,

.

Enum DFS_VOLUME_FLAVOR

.
Documentation
[DFS_VOLUME_FLAVORS] on MSDN
.
Summary
Specifies a set of bit flags that describes the Dfs root or link. One DFS_VOLUME_STATE flag is set and one DFS_VOLUME_FLAVOR flag is set.
.

enum DFS_VOLUME_STATE {

.

    DFS_VOLUME_STATE_OK =0x1,

.

    DFS_VOLUME_STATE_INCONSISTENT=2,

.

    DFS_VOLUME_STATE_OFFLINE=3,

.

    DFS_VOLUME_STATE_ONLINE=4

.

Enum DFS_VOLUME_STATE

.
Documentation
[DFS_VOLUME_STATE] on MSDN
.

    /// The file system supports file-based compression. This flag is incompatible with the FILE_VOLUME_IS_COMPRESSED flag.  

.

    FILE_VOLUME_QUOTAS          = 0x00000020,

.

    /// The specified volume is a compressed volume. This flag is incompatible with the FILE_FILE_COMPRESSION flag.  

.

    FILE_VOLUME_IS_COMPRESSED       = 0x00008000,

.

    /// Microsoft Windows XP and later: The specified volume is read-only.  

.

    FILE_READ_ONLY_VOLUME       = 0x00080000

.

    VolumeMounted = 0x00000109,

.

    WrongVolume = 0xc0000012,

.

    InvalidVolumeLabel = 0xc0000086,

.

    VolumeDirty = 0xc0000806,

.

    /// removable media across multiple devices based on the volume name. It also uses the

.

    ''' removable media across multiple devices based on the volume name. It also uses the

.

        VolumeMute = 0xAD,

.

        VolumeDown = 0xAE,

.

        VolumeUp = 0xAF,

.

    VK_VOLUME_MUTE = &HAD       ' // [VolumeMute] = 173

.

    VK_VOLUME_DOWN = &HAE       ' // [VolumeDown] = 174

.

    VK_VOLUME_UP = &HAF     ' // [VolumeUp] = 175

12: VK
.

        ///Windows 2000/XP: Volume Mute key

.

        VOLUME_MUTE = 0xAD,

.

        ///Windows 2000/XP: Volume Down key

.

        VOLUME_DOWN = 0xAE,

.

        ///Windows 2000/XP: Volume Up key

.

        VOLUME_UP = 0xAF,

.

    VOLUME_MUTE = 173

.

    VOLUME_DOWN = 174

.

    VOLUME_UP = 175

shell32

.

On Vista and better, you also have the Win32_Volume WMI classes. See http://msdn.microsoft.com/en-us/library/aa390432(VS.85).aspx

.

    SHOP_VOLUMEGUID = &H4  '// lpObject points to a Volume GUID

.

    SHOP_VOLUMEGUID = &H4  '// lpObject points to a Volume GUID

fbwflib

.

     string volume,

.

     string volume,

.

var returnCode = NativeFbwfMethods.FbwfGetExclusionList(protectedVolume, true, pBuffer, ref size);

.
Summary
Retrieves the list of protected volumes for either the current or next session.
.

static extern uint FbwfGetVolumeList(

.

     IntPtr volumeList,

.

Declare Function FbwfGetVolumeList Lib "fbwflib.dll" (TODO) As TODO

.

The "volumeList" parameter is a pointer to a multi-wide-string meaning one character consists of 2 bytes, every string is terminated by 2 NUL bytes and the whole thing is terminated by 4 NUL bytes.

.

NativeMethods.FbwfGetVolumeList(true, pBuffer, ref size);

.
Documentation
[FbwfGetVolumeList] on MSDN
.
Summary
Enables write protection for a specified volume.
.

static extern uint FbwfProtectVolume(

.

     string volume);

.

Declare Function FbwfProtectVolume Lib "fbwflib.dll" (TODO) As TODO

.

The "volume" parameter will not accept the "normal" drive letters (e.g. "C:"). It has to be something like this "\Device\HarddiskVolume1\". The right string can be checked using "diskpart".

.
Documentation
[FbwfProtectVolume] on MSDN
.

     string volume,

.
Summary
Removes write protection for the specified volume.
.

static extern uint FbwfUnprotectVolume(

.

     string volume,

.

Declare Function FbwfUnprotectVolume Lib "fbwflib.dll" (TODO) As TODO

.
Documentation
[FbwfUnprotectVolume] on MSDN

coredll

.
Summary
Retrieves information about the amount of space available on a disk volume.
.
Summary
Returns the current system volume
.

protected static extern int waveOutGetVolume(IntPtr device, ref uint volume);

.

Declare Function waveOutGetVolume Lib "coredll.dll" (ByVal uDeviceID As Integer, ByRef lpdwVolume As Integer) As Integer

.

0 is off, 65536 is max volume.

.

waveOutGetVolume(IntPtr.Zero, ref ret);

.

public enum Volumes : int {

.

internal static extern int waveOutSetVolume(IntPtr device, int volume);

.

internal static extern int waveOutGetVolume(IntPtr device, ref int volume);

.

public static Volumes Volume {

.

    waveOutGetVolume(IntPtr.Zero, ref v);

.

        case (int)Volumes.OFF: return Volumes.OFF;

.

        case (int)Volumes.LOW: return Volumes.LOW;

.

        case (int)Volumes.NORMAL: return Volumes.NORMAL;

.

        case (int)Volumes.MEDIUM: return Volumes.MEDIUM;

.

        case (int)Volumes.HIGH: return Volumes.HIGH;

.

        case (int)Volumes.VERY_HIGH: return Volumes.VERY_HIGH;

.

        default: return Volumes.OFF;

.

     set { waveOutSetVolume(IntPtr.Zero, (int)value); }

.
Documentation
[waveOutGetVolume] on MSDN
.
Summary
This function sets the output audio volume of the pocket pc device.
.

protected static extern int waveOutSetVolume(IntPtr device, uint volume);

.

Declare Function waveOutSetVolume Lib "coredll.dll" (ByVal device As IntPtr, ByVal volume As Integer) As Integer

.

values for 'volume' are between value between 0 (off) and 65536 (max)

.

  // The volume to pass in (0xffff or 65535 equals max volume)

.

  uint newVolume = (uint)0xffff;

.

  uint NewVolumeAllChannels = ((( uint )newVolume & 0x0000ffff) | (( uint )newVolume << 16));

.

  // Call func to set volume.

.

  waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels);

.
RichardW
Fixed the example code. It didn't work because the range of volume values are 0 to 65535 and the value passed in the example was 65536, which is set the right volume to 1 (out of 65535) and the left volume to 0.
.

  public enum Volumes : int {

.

internal static extern int waveOutSetVolume(IntPtr device, int volume);

.

internal static extern int waveOutGetVolume(IntPtr device, ref int volume);

.

public static Volumes Volume {

.

    waveOutGetVolume(IntPtr.Zero, ref v);

.

        case (int)Volumes.OFF: return Volumes.OFF;

.

        case (int)Volumes.LOW: return Volumes.LOW;

.

        case (int)Volumes.NORMAL: return Volumes.NORMAL;

.

        case (int)Volumes.MEDIUM: return Volumes.MEDIUM;

.

        case (int)Volumes.HIGH: return Volumes.HIGH;

.

        case (int)Volumes.VERY_HIGH: return Volumes.VERY_HIGH;

.

        default: return Volumes.OFF;

.

     set { waveOutSetVolume(IntPtr.Zero, (int)value); }

.
Documentation
[waveOutSetVolume] on MSDN

user32

.

                VK_VOLUME_MUTE = 0xAD,

.

                VK_VOLUME_DOWN = 0xAE,

.

                VK_VOLUME_UP = 0xAF,

.

    VK_VOLUME_MUTE    = 0xAD,

.

    VK_VOLUME_DOWN    = 0xAE,

.

    VK_VOLUME_UP      = 0xAF,

.

    public const uint VK_VOLUME_MUTE = 0xAD;

.

    public const uint VK_VOLUME_DOWN = 0xAE;

.

    public const uint VK_VOLUME_UP = 0xAF;

netapi32

.

With a Flags value of 1 (DFS_ADD_VOLUME), the call to NetDfsAdd will fail if the link (DFSEntryPath) already exists, even if the target (ServerName, PathName) is new. Use a Flags value of 0 to add multiple targets to the same DFS link.

.

// DFS_ADD_VOLUME has a value of 1 - see MSDN docs

.

    [MarshalAs(UnmanagedType.LPWStr)] string DfsEntryPath,        // DFS entry path for the volume

.

    [MarshalAs(UnmanagedType.LPWStr)] string DfsEntryPath,    // DFS entry path for the volume

Structures

.

        public uint VolumeSerialNumber;

.

  <FieldOffset(28)> Public dwVolumeSerialNumber As Int32

.

    val mutable VolumeSerialNumber:UInt32

.

struct DEV_BROADCAST_VOLUME {

.

Structure DEV_BROADCAST_VOLUME

.
Documentation
[DEV_BROADCAST_VOLUME] on MSDN
.

    [MarshalAs(UnmanagedType.LPWStr)] public string Comment;    // Comment for this volume or storage

.

    [MarshalAs(UnmanagedType.LPWStr)] public string Comment;    // Comment for this volume or storage

.

    [MarshalAs(UnmanagedType.LPWStr)] public string EntryPath;    // Dfs name for the top of this volume

.

    [MarshalAs(UnmanagedType.LPWStr)] public string Comment;    // Comment for this volume

.

    public int State;                        // State of this volume, one of DFS_VOLUME_STATE_*

.

    public int NumberOfStorages;                // Number of storages for this volume

.

    [MarshalAs(UnmanagedType.LPWStr)] public string EntryPath;  // Dfs name for the top of this volume

.

    [MarshalAs(UnmanagedType.LPWStr)] public string Comment;    // Comment for this volume

.

    public int State;                        // State of this volume, one of DFS_VOLUME_STATE_*

.

    public int NumberOfStorages;                // Number of storage servers for this volume

.

        [MarshalAs(UnmanagedType.LPWStr)] public string EntryPath;    // Dfs name for the top of this volume

.

        [MarshalAs(UnmanagedType.LPWStr)] public string Comment;    // Comment for this volume

.

        public int State;                                            // State of this volume, one of DFS_VOLUME_STATE_*

.

        public int NumberOfStorages;                                // Number of storage servers for this volume

.

        ///Windows 2000/XP: Volume Mute key

.

        VOLUME_MUTE = 0xAD,

.

        ///Windows 2000/XP: Volume Down key

.

        VOLUME_DOWN = 0xAE,

.

        ///Windows 2000/XP: Volume Up key

.

        VOLUME_UP = 0xAF,

.

        VOLUME_MUTE = 32,

.

        VOLUME_DOWN = 46,

.

        VOLUME_UP = 48,

.

     VOLUME     =(FADER + 1),

.

    WAVECAPS_VOLUME = &H4    'supports volume control

.

    WAVECAPS_LRVOLUME = &H8    'separate left-right volume control

kernel32

.

VolumeFunctions.DefineDosDevice(0, @"Y:", @"c:\test\folder\name\");

.

VolumeFunctions.DefineDosDevice(

.

    VolumeFunctions.DDD_REMOVE_DEFINITION + VolumeFunctions.DDD_EXACT_MATCH_ON_REMOVE,

.

DeleteVolumeMountPoint(@"Y:\");

.

public class VolumeFunctions

.
Summary
.

static extern bool DeleteVolumeMountPoint(string lpszVolumeMountPoint);

.

DeleteVolumeMountPoint(DriveLetter+":\\");

.
Documentation
[DeleteVolumeMountPoint] on MSDN
.

hDevice - To retrieve a handle to a volume, call CreateFile with the lpFileName parameter set to a string of the following form: \\.\DriveLetter:. DriveLetter is not case-sensitive and does not require a colon after it.

.

    DfsVolume            = 0x00000036,

.

     ChangerQueryVolumeTags = (EFileDevice.Changer << 16) | (0x000B << 2) | EMethod.Buffered | (FileAccess.ReadWrite << 14),

.

     FsctlLockVolume = (EFileDevice.FileSystem << 16) | (6 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlUnlockVolume = (EFileDevice.FileSystem << 16) | (7 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlDismountVolume = (EFileDevice.FileSystem << 16) | (8 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlIsVolumeMounted = (EFileDevice.FileSystem << 16) | (10 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlMarkVolumeDirty = (EFileDevice.FileSystem << 16) | (12 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlInvalidateVolumes = (EFileDevice.FileSystem << 16) | (21 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlGetNtfsVolumeData = (EFileDevice.FileSystem << 16) | (25 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlGetVolumeBitmap = (EFileDevice.FileSystem << 16) | (27 << 2) | EMethod.Neither | (0 << 14),

.

     FsctlIsVolumeDirty = (EFileDevice.FileSystem << 16) | (30 << 2) | EMethod.Buffered | (0 << 14),

.

     FsctlExtendVolume = (EFileDevice.FileSystem << 16) | (60 << 2) | EMethod.Buffered | (0 << 14),

.
Summary
.

static extern IntPtr FindFirstVolume([Out] StringBuilder lpszVolumeName,

.

  Declare Function FindFirstVolumeW Lib "kernel32.dll" (ByVal lpszVolumeName As System.Text.StringBuilder, ByVal cchBufferLength As UInteger) As IntPtr

.

    static extern FindVolumeSafeHandle FindFirstVolume([Out] StringBuilder lpszVolumeName, uint cchBufferLength);

.

    static extern bool FindNextVolume(FindVolumeSafeHandle hFindVolume, [Out] StringBuilder lpszVolumeName, uint cchBufferLength);

.

    static extern bool FindVolumeClose(IntPtr hFindVolume);

.

    public class FindVolumeSafeHandle : SafeHandleZeroOrMinusOneIsInvalid

.

        private FindVolumeSafeHandle()

.

        public FindVolumeSafeHandle(IntPtr preexistingHandle, bool ownsHandle)

.

        return FindVolumeClose(handle);

.

    public static StringCollection GetVolumes()

.

        StringBuilder volume = new StringBuilder((int)bufferLength, (int)bufferLength);

.

        using (FindVolumeSafeHandle volumeHandle = FindFirstVolume(volume, bufferLength))

.

        if (volumeHandle.IsInvalid)

.

            ret.Add(volume.ToString());

.

        } while (FindNextVolume(volumeHandle, volume, bufferLength));

.
Documentation
[FindFirstVolume] on MSDN
.

FindNextVolume

.

FindVolumeClose

.
Summary
.

static extern bool FindNextVolume(IntPtr hFindVolume, [Out] StringBuilder

.

   lpszVolumeName, uint cchBufferLength);

.

FindFirstVolume

.
Documentation
[FindNextVolume] on MSDN
.
Summary
Retrieves information about the amount of space available on a disk volume.
.

/// <param name="folderName">Directory or unc folder name of the volume to

.
Summary
Retrieves information about the amount of space available on a disk volume.
.

/// <param name="folderName">Directory or unc folder name of the volume to

.

    /// <summary>The root path is invalid, for example, no volume is mounted at the path.</summary>

.

namespace Volume

.
Summary
.

    TCHAR volumeName[MAX_PATH + 1] = { 0 };

.

    if (GetVolumeInformation(

.

        volumeName,

.

        ARRAYSIZE(volumeName),

.

        m_sn_textbox.Format(_T("GetVolumeInformation : %lu"),serialNumber);

.

  public extern static bool GetVolumeInformation(

.

    StringBuilder volumeNameBuffer,

.

    int volumeNameSize,

.

    out uint volumeSerialNumber,

.

  Private Declare Auto Function GetVolumeInformation Lib "kernel32.dll" ( _

.

     ByVal VolumeNameBuffer As System.Text.StringBuilder, _

.

     ByVal VolumeNameSize As UInt32, _

.

     ByRef VolumeSerialNumber As UInt32, _

.

    /// The specified volume is a direct access (DAX) volume. This flag was introduced in Windows 10, version 1607.

.

    DaxVolume = 0x20000000,

.

    /// The specified volume is read-only.

.

    ReadOnlyVolume = 0x80000,

.

    /// The volume supports a single sequential write.

.

    /// The specified volume supports extended attributes. An extended attribute is a piece of

.

    /// The specified volume supports hard links. For more information, see Hard Links and Junctions.

.

    /// The volume supports transactions.

.

    /// The specified volume supports update sequence number (USN) journals. For more information,

.

    /// The specified volume is a compressed volume, for example, a DoubleSpace volume.

.

    VolumeIsCompressed = 0x8000,

.

    VolumeQuotas = 0x20

.

The volumeSerialNumber is not optional with this signature!!!

.

If you specify rootPathName as a drive letter (eg not a volume name) then you have to terminate it with a backslash.

.

if(!GetVolumeInformation("c:\\", volname, volname.Capacity, out sernum, out maxlen, out flags, fsname, fsname.Capacity))

.

   ''' Returns volume name and serial number, maximum path component length, and filesystem name and flags

.

   ''' <param name="VolumeName">Returns volume name.</param>

.

   ''' <param name="VolumeSerialNumber">Returns volume serial number.</param>

.

   Public Sub GetVolumeInfo( _

.

     ByRef VolumeName As String, _

.

     ByRef VolumeSerialNumber As String, _

.

      Dim RetVal As UInt32 = GetVolumeInformation(sRootFolder, volname, volname.Capacity, _

.

      VolumeName = volname.ToString

.

      VolumeSerialNumber = Hex(hpart).PadLeft(4, "0"c) & "-" & Hex(lpart).PadLeft(4, "0"c)

.

Private Function GetVolumeSerial(ByVal DriveLetter As String) As String

.

        If DiskProperty.Name = "VolumeSerialNumber" Then

.

            Return DiskProperty.Value.ToString  '.ToString 'Return the volume serial number.

.
Documentation
[GetVolumeInformation] on MSDN
.
Summary
.

static extern bool GetVolumeNameForVolumeMountPoint(string

.

   lpszVolumeMountPoint, [Out] StringBuilder lpszVolumeName,

.

public static string GetVolumeName(string MountPoint)

.

     const int MaxVolumeNameLength = 100;

.

     StringBuilder sb = new StringBuilder(MaxVolumeNameLength);

.

     if (!GetVolumeNameForVolumeMountPoint(MountPoint, sb, (uint) MaxVolumeNameLength))

.
Documentation
[GetVolumeNameForVolumeMountPoint] on MSDN
.
Summary
Retrieves a list of path names for the specified volume name.
.

public static extern bool GetVolumePathNamesForVolumeNameW(string lpszVolumeName,

.

        char [] lpszVolumePathNames, uint cchBuferLength,

.

public static extern bool GetVolumePathNamesForVolumeNameW(

.

        string lpszVolumeName,

.

        string lpszVolumePathNames,

.

Declare Function GetVolumePathNamesForVolumeName Lib "kernel32.dll" (TODO) As TODO

.

    EntryPoint:="GetVolumePathNamesForVolumeNameW")> _

.

  Public Shared Function GetVolumePathNamesForVolumeNameW(

.

                                ByVal sVolumeName As String, _

.

        if (!GetVolumePathNamesForVolumeName(volumeName, buffer, (uint)buffer.Length, ref dwRequired))

.

        if (!GetVolumePathNamesForVolumeName(volumeName, buffer, (uint)buffer.Length, ref dwRequired))

.

    public List<string> GetMountPointsForVolume(string volumeDeviceName)

.

        // GetVolumePathNamesForVolumeName is only available on Windows XP/2003 and above

.

        GetVolumePathNamesForVolumeNameW(volumeDeviceName, buffer, (uint)buffer.Length, ref lpcchReturnLength);

.

        if (!GetVolumePathNamesForVolumeNameW(volumeDeviceName, buffer, lpcchReturnLength, ref lpcchReturnLength))

.

                EntryPoint:="GetVolumePathNamesForVolumeNameW", _

.

    Public Shared Function GetMountPointsPtr(ByVal sVolumeName As String, _

.

    ' if no Volume GUID passed to sub, use the one corresponding to my USB stick

.

    Private Sub ListMountPoints(Optional strVolumeName As String = _

.

                "\\?\Volume{9a615499-414c-11e0-bd72-78e7d1722cbc}\")

.

        PInvoke.GetMountPointsPtr(strVolumeName, lpBuffer, uintBufferLen, uintRequiredBufferLen)

.

        Throw New ApplicationException("Invalid volume specified?")

.

        If CBool(Not (PInvoke.GetMountPointsPtr(strVolumeName, lpBuffer, _

.

        Console.WriteLine(strVolumeName + " has the following mountpoints: " _

.
Documentation
[GetVolumePathNamesForVolumeName] on MSDN
.
Summary
Retrieves a list of path names for the specified volume name.
.

public static extern bool GetVolumePathNamesForVolumeNameW(string lpszVolumeName,

.

        char [] lpszVolumePathNames, uint cchBuferLength,

.

public static extern bool GetVolumePathNamesForVolumeNameW(

.

        string lpszVolumeName,

.

        string lpszVolumePathNames,

.

Declare Function GetVolumePathNamesForVolumeName Lib "kernel32.dll" (TODO) As TODO

.

    EntryPoint:="GetVolumePathNamesForVolumeNameW")> _

.

  Public Shared Function GetVolumePathNamesForVolumeNameW(

.

                                ByVal sVolumeName As String, _

.

        if (!GetVolumePathNamesForVolumeName(volumeName, buffer, (uint)buffer.Length, ref dwRequired))

.

        if (!GetVolumePathNamesForVolumeName(volumeName, buffer, (uint)buffer.Length, ref dwRequired))

.

    public List<string> GetMountPointsForVolume(string volumeDeviceName)

.

        // GetVolumePathNamesForVolumeName is only available on Windows XP/2003 and above

.

        GetVolumePathNamesForVolumeNameW(volumeDeviceName, buffer, (uint)buffer.Length, ref lpcchReturnLength);

.

        if (!GetVolumePathNamesForVolumeNameW(volumeDeviceName, buffer, lpcchReturnLength, ref lpcchReturnLength))

.

                EntryPoint:="GetVolumePathNamesForVolumeNameW", _

.

    Public Shared Function GetMountPointsPtr(ByVal sVolumeName As String, _

.

    ' if no Volume GUID passed to sub, use the one corresponding to my USB stick

.

    Private Sub ListMountPoints(Optional strVolumeName As String = "\\?\Volume{9a615499-414c-11e0-bd72-78e7d1722cbc}\")

.

        PInvoke.GetMountPointsPtr(strVolumeName, lpBuffer, uintBufferLen, uintRequiredBufferLen)

.

        Throw New ApplicationException("Invalid volume specified?")

.

        If CBool(Not (PInvoke.GetMountPointsPtr(strVolumeName, lpBuffer, _

.

        Console.WriteLine(strVolumeName + " has the following mountpoints: " _

.
Documentation
[GetVolumePathNamesForVolumeName] on MSDN
.
Summary
Sets the label of a file system volume.
.

static extern bool SetVolumeLabel(string lpRootPathName, string lpVolumeName);

.

Private Shared Function SetVolumeLabel(ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Boolean

.

^^^^^^^^ Unfortunately the DriveInfo Class only handles volume with drive letter.

.

        static extern bool SetVolumeLabel(string lpRootPathName, string lpVolumeName);

.

            if(SetVolumeLabel("C:\\","PInvokeC Drive"))

.

Public Module VolumeLabel

.

    Private Function SetVolumeLabel(ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Boolean

.

            Return Dir(DrivePath, FileAttribute.Volume)

.

            If Not SetVolumeLabel(DrivePath, value) Then Throw New Win32Exception(Marshal.GetLastWin32Error())

.

MessageBox.Show(Drive.VolumeLabel & " [" & Drive.Name & "]")

.

Drive.VolumeLabel = "Test volume label"

.
Documentation
[SetVolumeLabel] on MSDN
.
Summary
.

static extern bool SetVolumeMountPoint(string lpszVolumeMountPoint,

.

   string lpszVolumeName);

.

    VolumeFunctions.GetVolumeNameForVolumeMountPoint("C:\\", sb, sb.Capacity);

.

    VolumeFunctions.SetVolumeMountPoint(@"W:\", @"\C:\Test");

.

public class VolumeFunctions

.

    internal static extern bool GetVolumeNameForVolumeMountPoint(

.

        string volumeName,

.

        StringBuilder uniqueVolumeName,

.

    internal static extern bool SetVolumeMountPoint(string lpszVolumeMountPoint,

.

       string lpszVolumeName);

.
Documentation
[SetVolumeMountPoint] on MSDN
.

  public const int FILE_VOLUME_QUOTAS          = 0x00000020;

.

  public const int FILE_VOLUME_IS_COMPRESSED       = 0x00008000;

.

  public const int FILE_READ_ONLY_VOLUME           = 0x00080000;

Constants

.

    public static readonly Guid GUID_DEVCLASS_VOLUME = new Guid("{0x71a27cdd, 0x812a, 0x11d0, {0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f}}");

.

    public static readonly Guid GUID_DEVCLASS_VOLUMESNAPSHOT = new Guid("{0x533c5b84, 0xec70, 0x11d2, {0x95, 0x05, 0x00, 0xc0, 0x4f, 0x79, 0xde, 0xaf}}");

.

    public static Guid GUID_DEVINTERFACE_VOLUME = new Guid("53F5630D-B6BF-11D0-94F2-00A0C91EFB8B");

.

    public static Guid GUID_IO_VOLUME_DEVICE_INTERFACE = new Guid("53F5630D-B6BF-11D0-94F2-00A0C91EFB8B");

57: MIXER
.

private const UInt32 MIXERCONTROL_CONTROLTYPE_VOLUME        = MIXERCONTROL_CONTROLTYPE_FADER + 1;

58: NERR_
.

        public const int DfsVolumeDataCorrupt = 2661;

.

        public const int DfsNoSuchVolume = 2662;

.

        public const int DfsVolumeAlreadyExists = 2663;

.

        public const int DfsNotALeafVolume = 2666;

.

        public const int DfsLeafVolume = 2667;

.

        public const int DfsVolumeHasMultipleServers = 2668;

.

        public const int DfsVolumeIsOffline = 2672;

.

        public const int DfsVolumeIsInterDfs = 2678;

.

    public static PropertyKey PKEY_Volume_FileSystem = new PropertyKey( 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 4);

.

    public static PropertyKey PKEY_Volume_IsMappedDrive = new PropertyKey( 0x149C0B69, 0x2C2D, 0x48FC, 0x80, 0x8F, 0xD3, 0x18, 0xD7, 0x8C, 0x46, 0x36, 2);

.

    public static PropertyKey PKEY_Volume_IsRoot = new PropertyKey( 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 10);

.

public const int FSCTL_LOCK_VOLUME = 0x00090018;

.

public const int FSCTL_UNLOCK_VOLUME = 0x0009001c;

.

public const int FSCTL_DISMOUNT_VOLUME = 0x00090020;

.

public const int FSCTL_IS_VOLUME_MOUNTED = 0x00090028;

.

public const int FSCTL_MARK_VOLUME_DIRTY = 0x00090030;

.

public const int FSCTL_INVALIDATE_VOLUMES = 0x00090054;

.

public const int FSCTL_GET_NTFS_VOLUME_DATA = 0x00090064;

.

public const int FSCTL_GET_VOLUME_BITMAP = 0x0009006f;

.

public const int FSCTL_IS_VOLUME_DIRTY = 0x00090078;

.

public const int FSCTL_EXTEND_VOLUME = 0x000900f0;

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: