ReactOS 0.4.16-dev-336-gb667d82
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{
45
47 if (!NT_SUCCESS(Status))
48 {
49 return Status;
50 }
51
53
54 Notification.Version = 1;
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 }
74 {
75 Guid = (LPGUID)&GUID_IO_VOLUME_LOCK;
76 break;
77 }
79 {
80 Guid = (LPGUID)&GUID_IO_VOLUME_LOCK_FAILED;
81 break;
82 }
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 {
103 NULL,
104 NULL);
105 }
106 else
107 {
109 &Notification);
110 }
111
113 }
115
116 return Status;
117}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
_In_ NDIS_STATUS EventCode
Definition: ndis.h:4751
#define FSRTL_VOLUME_UNLOCK
Definition: ntifs_ex.h:443
#define FSRTL_VOLUME_LOCK
Definition: ntifs_ex.h:441
#define FSRTL_VOLUME_DISMOUNT_FAILED
Definition: ntifs_ex.h:440
#define FSRTL_VOLUME_DISMOUNT
Definition: ntifs_ex.h:439
#define FSRTL_VOLUME_MOUNT
Definition: ntifs_ex.h:444
#define FSRTL_VOLUME_LOCK_FAILED
Definition: ntifs_ex.h:442
NTSTATUS NTAPI IoGetRelatedTargetDevice(IN PFILE_OBJECT FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1607
NTSTATUS NTAPI IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure)
Definition: pnpreport.c:448
NTSTATUS NTAPI IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure, IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, IN PVOID Context OPTIONAL)
Definition: pnpreport.c:498
GUID * LPGUID
Definition: guiddef.h:81
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
struct _TARGET_DEVICE_CUSTOM_NOTIFICATION TARGET_DEVICE_CUSTOM_NOTIFICATION
#define ObDereferenceObject
Definition: obfuncs.h:203

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().