#ifndef _NTIOAPI_H
#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
View code on GitHub// mountmgr.h
// CTL_CODE(0x004d, 0x002, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME 0x004D0008
View the official Windows Driver Kit DDI referenceThis IOCTL is documented in Windows Driver Kit.
Upon receiving this IOCTL a client driver must provide the (nonpersistent) device (or target) name for the volume. The mount manager uses the device name returned by the client as the target of a symbolic link. An example of a device name would be "\Device\HarddiskVolume1".
Support for this IOCTL by the mount manager clients is mandatory.
None.
None.
The mount manager client returns a variable-length structure of type MOUNTDEV_NAME at the beginning of the buffer at Irp->AssociatedIrp.SystemBuffer. The device name must be inserted at the address pointed to by the Name member of this structure.
Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the output buffer, which must be greater than or equal to sizeof(MOUNTDEV_NAME).
The Information field is set to FIELD_OFFSET(MOUNTDEV_NAME, Name) + output->NameLength, or alternatively, output->NameLength + sizeof(USHORT), where output points to the buffer at Irp->AssociatedIrp.SystemBuffer.
If the operation is successful, the mount manager client must set the Information field to the length of the NULL-terminated string containing the device name and the Status field to STATUS_SUCCESS.
If the output buffer is too small to hold the device name, the mount manager client must set the Information field to sizeof(MOUNTDEV_NAME) and the Status field to STATUS_BUFFER_OVERFLOW. In addition, the mount manager client fills in the NameLength member of the MOUNTDEV_NAME structure.
As a best practice, the implementer must not thread-synchronize and must not make blocking and/or Interprocess Communication (IPC) function calls.
For more information, see Supporting Mount Manager Requests in a Storage Class Driver.