ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

NTSTATUS NTAPI FsRtlNotifyVolumeEvent ( IN PFILE_OBJECT  FileObject,
IN ULONG  EventCode 
)

Definition at line 38 of file pnp.c.

Referenced by FatiCleanup(), RawMountVolume(), RawUserFsCtrl(), and VfatMount().

{
    NTSTATUS Status;
    LPGUID Guid = NULL;
    PDEVICE_OBJECT DeviceObject = NULL;
    TARGET_DEVICE_CUSTOM_NOTIFICATION Notification;

    Status = IoGetRelatedTargetDevice(FileObject, &DeviceObject);
    if (!NT_SUCCESS(Status))
    {
        return Status;
    }

    Status = STATUS_INVALID_PARAMETER;

    Notification.Version = 1;
    Notification.Size = sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION);
    /* MSDN says that FileObject must be null
       when calling IoReportTargetDeviceChangeAsynchronous */
    Notification.FileObject = NULL;
    Notification.NameBufferOffset = -1;
    /* Find the good GUID associated with the event */
    switch (EventCode)
    {
        case FSRTL_VOLUME_DISMOUNT:
        {
            Guid = (LPGUID)&GUID_IO_VOLUME_DISMOUNT;
            break;
        }
        case FSRTL_VOLUME_DISMOUNT_FAILED:
        {
            Guid = (LPGUID)&GUID_IO_VOLUME_DISMOUNT_FAILED;
            break;
        }
        case FSRTL_VOLUME_LOCK:
        {
            Guid = (LPGUID)&GUID_IO_VOLUME_LOCK;
            break;
        }
        case FSRTL_VOLUME_LOCK_FAILED:
        {
            Guid = (LPGUID)&GUID_IO_VOLUME_LOCK_FAILED;
            break;
        }
        case FSRTL_VOLUME_MOUNT:
        {
            Guid = (LPGUID)&GUID_IO_VOLUME_MOUNT;
            break;
        }
        case FSRTL_VOLUME_UNLOCK:
        {
            Guid = (LPGUID)&GUID_IO_VOLUME_UNLOCK;
            break;
        }
    }
    if (Guid)
    {
        /* Copy GUID to notification structure and then report the change */
        RtlCopyMemory(&(Notification.Event), Guid, sizeof(GUID));

        if (EventCode == FSRTL_VOLUME_MOUNT)
        {
            IoReportTargetDeviceChangeAsynchronous(DeviceObject,
                                                   &Notification,
                                                   NULL,
                                                   NULL);
        }
        else
        {
            IoReportTargetDeviceChange(DeviceObject,
                                       &Notification);
        }

        Status = STATUS_SUCCESS;
    }
    ObDereferenceObject(DeviceObject);

    return Status;
}

Generated on Fri May 25 2012 04:42:59 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.