ReactOS  0.4.14-dev-608-gd495a4f
pnp.c File Reference
#include <ntoskrnl.h>
#include <ioevent.h>
#include <debug.h>
Include dependency graph for pnp.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file pnp.c.

Function Documentation

◆ FsRtlNotifyVolumeEvent()

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

Definition at line 38 of file pnp.c.

40 {
42  LPGUID Guid = NULL;
45 
47  if (!NT_SUCCESS(Status))
48  {
49  return Status;
50  }
51 
53 
54  Notification.Version = 1;
55  Notification.Size = sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION);
56  /* MSDN says that FileObject must be null
57  when calling IoReportTargetDeviceChangeAsynchronous */
58  Notification.FileObject = NULL;
59  Notification.NameBufferOffset = -1;
60  /* Find the good GUID associated with the event */
61  switch (EventCode)
62  {
64  {
65  Guid = (LPGUID)&GUID_IO_VOLUME_DISMOUNT;
66  break;
67  }
69  {
70  Guid = (LPGUID)&GUID_IO_VOLUME_DISMOUNT_FAILED;
71  break;
72  }
73  case FSRTL_VOLUME_LOCK:
74  {
75  Guid = (LPGUID)&GUID_IO_VOLUME_LOCK;
76  break;
77  }
79  {
80  Guid = (LPGUID)&GUID_IO_VOLUME_LOCK_FAILED;
81  break;
82  }
83  case FSRTL_VOLUME_MOUNT:
84  {
85  Guid = (LPGUID)&GUID_IO_VOLUME_MOUNT;
86  break;
87  }
89  {
90  Guid = (LPGUID)&GUID_IO_VOLUME_UNLOCK;
91  break;
92  }
93  }
94  if (Guid)
95  {
96  /* Copy GUID to notification structure and then report the change */
97  RtlCopyMemory(&(Notification.Event), Guid, sizeof(GUID));
98 
100  {
102  &Notification,
103  NULL,
104  NULL);
105  }
106  else
107  {
109  &Notification);
110  }
111 
113  }
115 
116  return Status;
117 }
#define FSRTL_VOLUME_DISMOUNT
Definition: ntifs_ex.h:439
NTSTATUS NTAPI IoGetRelatedTargetDevice(IN PFILE_OBJECT FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1607
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _TARGET_DEVICE_CUSTOM_NOTIFICATION TARGET_DEVICE_CUSTOM_NOTIFICATION
_In_ NDIS_STATUS EventCode
Definition: ndis.h:4751
#define FSRTL_VOLUME_DISMOUNT_FAILED
Definition: ntifs_ex.h:440
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define FSRTL_VOLUME_UNLOCK
Definition: ntifs_ex.h:443
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define FSRTL_VOLUME_LOCK_FAILED
Definition: ntifs_ex.h:442
static GUID * Guid
Definition: apphelp.c:93
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure)
Definition: pnpreport.c:469
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define FSRTL_VOLUME_LOCK
Definition: ntifs_ex.h:441
#define FSRTL_VOLUME_MOUNT
Definition: ntifs_ex.h:444
struct _FILE_OBJECT * FileObject
Definition: iotypes.h:975
return STATUS_SUCCESS
Definition: btrfs.c:2938
NTSTATUS NTAPI IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure, IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, IN PVOID Context OPTIONAL)
Definition: pnpreport.c:519
GUID * LPGUID
Definition: guiddef.h:81

Referenced by _Dispatch_type_(), _Function_class_(), _Requires_lock_held_(), add_device(), dismount_volume(), do_write(), DriverEntry(), FatUnlockVolume(), finish_removing_device(), lock_volume(), mount_vol(), pnp_remove_device(), RawMountVolume(), RawUserFsCtrl(), resize_device(), unlock_volume(), VfatDismountVolume(), VfatLockOrUnlockVolume(), and VfatMount().