00048 :
00049
00050 This routine notifies any registered applications that a
00051 volume
is being locked, unlocked, etc.
00052
00053 Arguments:
00054
00055 FileeObject - Supplies a
file object
for the volume being
00056 locked.
00057
00058 EventCode - Which event
is occuring -- e.g.
FSRTL_VOLUME_LOCK
00059
00060 Return Value:
00061
00062
Status of
the notification.
00063
00064 --*/
00065
00066 {
00067
NTSTATUS Status = STATUS_SUCCESS;
00068
00069
TARGET_DEVICE_CUSTOM_NOTIFICATION Event;
00070
PDEVICE_OBJECT Pdo;
00071
00072
00073
00074
00075
00076
Status =
IoGetRelatedTargetDevice( FileObject, &Pdo );
00077
00078
if (
NT_SUCCESS( Status )) {
00079
00080
ASSERT(Pdo != NULL);
00081
00082
Event.Version = 1;
00083
Event.FileObject =
NULL;
00084
Event.NameBufferOffset = -1;
00085
Event.Size = (
USHORT)FIELD_OFFSET(
TARGET_DEVICE_CUSTOM_NOTIFICATION, CustomDataBuffer );
00086
00087
switch (EventCode) {
00088
00089
case FSRTL_VOLUME_DISMOUNT:
00090
00091 RtlCopyMemory( &
Event.Event, &GUID_IO_VOLUME_DISMOUNT,
sizeof( GUID ));
00092
break;
00093
00094
case FSRTL_VOLUME_DISMOUNT_FAILED:
00095
00096 RtlCopyMemory( &
Event.Event, &GUID_IO_VOLUME_DISMOUNT_FAILED,
sizeof( GUID ));
00097
break;
00098
00099
case FSRTL_VOLUME_LOCK:
00100
00101 RtlCopyMemory( &
Event.Event, &GUID_IO_VOLUME_LOCK,
sizeof( GUID ));
00102
break;
00103
00104
case FSRTL_VOLUME_LOCK_FAILED:
00105
00106 RtlCopyMemory( &
Event.Event, &GUID_IO_VOLUME_LOCK_FAILED,
sizeof( GUID ));
00107
break;
00108
00109
case FSRTL_VOLUME_MOUNT:
00110
00111
00112
00113
00114
00115
00116
00117 RtlCopyMemory( &
Event.Event, &GUID_IO_VOLUME_MOUNT,
sizeof( GUID ));
00118
IoReportTargetDeviceChangeAsynchronous( Pdo, &Event, NULL, NULL );
00119
ObDereferenceObject( Pdo );
00120
return STATUS_SUCCESS;
00121
break;
00122
00123
case FSRTL_VOLUME_UNLOCK:
00124
00125 RtlCopyMemory( &
Event.Event, &GUID_IO_VOLUME_UNLOCK,
sizeof( GUID ));
00126
break;
00127
00128
default:
00129
00130
ObDereferenceObject( Pdo );
00131
return STATUS_INVALID_PARAMETER;
00132 }
00133
00134
IoReportTargetDeviceChange( Pdo, &Event );
00135
ObDereferenceObject( Pdo );
00136 }
00137
00138
return Status;
00139 }