#ifndef _NTIOAPI_H
#define IOCTL_MOUNTMGR_CHANGE_NOTIFY CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS)
View code on GitHub// mountmgr.h
// CTL_CODE(0x006d, 0x008, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MOUNTMGR_CHANGE_NOTIFY 0x006D4020
View the official Windows Driver Kit DDI referenceThis IOCTL is documented in Windows Driver Kit.
Clients send this IOCTL to the mount manager to be informed whenever there is a change in the mount manager's persistent symbolic link name database.
The mount manager maintains a counter called EpicNumber that records how many changes have occurred in its persistent name database since the last startup. Clients send a number to the mount manager with every change notification request IRP, and the mount manager responds in the following manner:
If the number supplied by the client is not equal to EpicNumber, the mount manager returns STATUS_SUCCESS, indicating that changes have occurred since the client last compared its number with the mount manager's EpicNumber.
If the number supplied by the client is equal to EpicNumber, the mount manager interprets this as a request to be informed of the next change to the persistent name database, and it queues the change notification IRP and returns STATUS_PENDING. Whenever a change occurs in the database, the mount manager completes all of the pending change notification IRPs, thereby informing clients of the change.
A client that only wants to be informed of the changes to a particular volume is advised to register for Plug and Play target device notification and watch for GUID_IO_VOLUME_NAME_CHANGE.
The mount manager client initializes the MOUNTMGR_CHANGE_NOTIFY_INFO structure at the beginning of the buffer at Irp->AssociatedIrp.SystemBuffer.
Parameters.DeviceIoControl.InputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the input buffer, which must be greater than or equal to sizeof(MOUNTMGR_CHANGE_NOTIFY_INFO).
The mount manager returns the current EpicNumber in the MOUNTMGR_CHANGE_NOTIFY_INFO structure at the beginning of the buffer at Irp->AssociatedIrp.SystemBuffer.
None.
N/A
N/A
If the operation is successful, the Status field is set to STATUS_SUCCESS and the Information field is set to sizeof(MOUNTMGR_CHANGE_NOTIFY_INFO).
If InputBufferLength is less than sizeof(MOUNTMGR_CHANGE_NOTIFY_INFO) or OutputBufferLength is less than sizeof(MOUNTMGR_CHANGE_NOTIFY_INFO), the Status field is set to STATUS_INVALID_PARAMETER.
For more information, see Supporting Mount Manager Requests in a Storage Class Driver.