Author: pschweitzer Date: Tue Aug 26 16:37:27 2008 New Revision: 35687
URL: http://svn.reactos.org/svn/reactos?rev=35687&view=rev Log: - Added ioevent.h that contains Win2k3 GUIDs for pnp event notifications - Added a ioevent lib which is used in ntoskrnl for GUIDs - Implemented FsRtlNotifyVolumeEvent. Some details seem to be wrong (such as IoReportTargetDeviceChangeAsynchronous call in all cases) and should be reviewed. Moreover IoReportTargetDeviceChangeAsynchronous isn't implemented, so we crash a bit farther.
Added: branches/pierre-fsd/include/psdk/ioevent.h (with props) branches/pierre-fsd/lib/sdk/ioevent/ (with props) branches/pierre-fsd/lib/sdk/ioevent/ioevent.c (with props) branches/pierre-fsd/lib/sdk/ioevent/ioevent.rbuild (with props) Modified: branches/pierre-fsd/lib/sdk/sdk.rbuild branches/pierre-fsd/ntoskrnl/fsrtl/pnp.c branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild
Added: branches/pierre-fsd/include/psdk/ioevent.h URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/psdk/ioevent.... ============================================================================== --- branches/pierre-fsd/include/psdk/ioevent.h (added) +++ branches/pierre-fsd/include/psdk/ioevent.h [iso-8859-1] Tue Aug 26 16:37:27 2008 @@ -1,0 +1,65 @@ +/* + * ioevent.h + * + * PnP Event Notification GUIDs + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +DEFINE_GUID(GUID_IO_VOLUME_CHANGE, + 0x7373654AL, 0x812A, 0x11D0, 0xBE, 0xC7, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F); +DEFINE_GUID(GUID_IO_VOLUME_DISMOUNT, + 0xD16A55E8L, 0x1059, 0x11D2, 0x8F, 0xFD, 0x00, 0xA0, 0xC9, 0xA0, 0x6D, 0x32); +DEFINE_GUID(GUID_IO_VOLUME_DISMOUNT_FAILED, + 0xE3C5B178L, 0x105D, 0x11D2, 0x8F, 0xFD, 0x00, 0xA0, 0xC9, 0xA0, 0x6D, 0x32); +DEFINE_GUID(GUID_IO_VOLUME_MOUNT, + 0xB5804878L, 0x1A96, 0x11D2, 0x8F, 0xFD, 0x00, 0xA0, 0xC9, 0xA0, 0x6D, 0x32); +DEFINE_GUID(GUID_IO_VOLUME_LOCK, + 0x50708874L, 0xC9AF, 0x11D1, 0x8F, 0xEF, 0x00, 0xA0, 0xC9, 0xA0, 0x6D, 0x32); +DEFINE_GUID(GUID_IO_VOLUME_LOCK_FAILED, + 0xAE2EED10L, 0x0BA8, 0x11D2, 0x8F, 0xFB, 0x00, 0xA0, 0xC9, 0xA0, 0x6D, 0x32); +DEFINE_GUID(GUID_IO_VOLUME_UNLOCK, + 0x9A8C3D68L, 0xD0CB, 0x11D1, 0x8F, 0xEF, 0x00, 0xA0, 0xC9, 0xA0, 0x6D, 0x32); +DEFINE_GUID(GUID_IO_VOLUME_NAME_CHANGE, + 0x2DE97F83, 0x4C06, 0x11D2, 0xA5, 0x32, 0x00, 0x60, 0x97, 0x13, 0x05, 0x5A); +DEFINE_GUID(GUID_IO_VOLUME_PREPARING_EJECT, + 0xC79EB16E, 0x0DAC, 0x4E7A, 0xA8, 0x6C, 0xB2, 0x5C, 0xEE, 0xAA, 0x88, 0xF6); +DEFINE_GUID(GUID_IO_VOLUME_PHYSICAL_CONFIGURATION_CHANGE, + 0x2DE97F84, 0x4C06, 0x11D2, 0xA5, 0x32, 0x00, 0x60, 0x97, 0x13, 0x05, 0x5A); +DEFINE_GUID(GUID_IO_VOLUME_FVE_STATUS_CHANGE, + 0x062998B2, 0xEE1F, 0x4B6A, 0xB8, 0x57, 0xE7, 0x6C, 0xBB, 0xE9, 0xA6, 0xDA); +DEFINE_GUID(GUID_IO_VOLUME_DEVICE_INTERFACE, + 0x53F5630D, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B); +DEFINE_GUID(GUID_IO_VOLUME_CHANGE_SIZE, + 0x3A1625BE, 0xAD03, 0x49F1, 0x8E, 0xF8, 0x6B, 0xBA, 0xC1, 0x82, 0xD1, 0xFD); +DEFINE_GUID(GUID_IO_MEDIA_ARRIVAL, + 0xD07433C0, 0xA98E, 0x11D2, 0x91, 0x7A, 0x00, 0xA0, 0xC9, 0x06, 0x8F, 0xF3); +DEFINE_GUID(GUID_IO_MEDIA_REMOVAL, + 0xD07433C1, 0xA98E, 0x11D2, 0x91, 0x7A, 0x00, 0xA0, 0xC9, 0x06, 0x8F, 0xF3); +DEFINE_GUID(GUID_IO_CDROM_EXCLUSIVE_LOCK, + 0xBC56C139, 0x7A10, 0x47EE, 0xA2, 0x94, 0x4C, 0x6A, 0x38, 0xF0, 0x14, 0x9A); +DEFINE_GUID(GUID_IO_CDROM_EXCLUSIVE_UNLOCK, + 0xA3B6D27D, 0x5E35, 0x4885, 0x81, 0xE5, 0xEE, 0x18, 0xC0, 0x0E, 0xD7, 0x79); +DEFINE_GUID(GUID_IO_DEVICE_BECOMING_READY, + 0xD07433F0, 0xA98E, 0x11D2, 0x91, 0x7A, 0x00, 0xA0, 0xC9, 0x06, 0x8F, 0xF3); +DEFINE_GUID(GUID_IO_DEVICE_EXTERNAL_REQUEST, + 0xD07433D0, 0xA98E, 0x11D2, 0x91, 0x7A, 0x00, 0xA0, 0xC9, 0x06, 0x8F, 0xF3); +DEFINE_GUID(GUID_IO_MEDIA_EJECT_REQUEST, + 0xD07433D1, 0xA98E, 0x11D2, 0x91, 0x7A, 0x00, 0xA0, 0xC9, 0x06, 0x8F, 0xF3); +DEFINE_GUID(GUID_IO_DRIVE_REQUIRES_CLEANING, + 0x7207877C, 0x90ED, 0x44E5, 0xA0, 0x00, 0x81, 0x42, 0x8D, 0x4C, 0x79, 0xBB); +DEFINE_GUID(GUID_IO_TAPE_ERASE, + 0x852D11EB, 0x4BB8, 0x4507, 0x9D, 0x9B, 0x41, 0x7C, 0xC2, 0xB1, 0xB4, 0x38); +DEFINE_GUID(GUID_IO_DISK_CLONE_ARRIVAL, + 0x6A61885B, 0x7C39, 0x43DD, 0x9B, 0x56, 0xB8, 0xAC, 0x22, 0xA5, 0x49, 0xAA); +DEFINE_GUID(GUID_IO_DISK_LAYOUT_CHANGE, + 0x11DFF54C, 0x8469, 0x41F9, 0xB3, 0xDE, 0xEF, 0x83, 0x64, 0x87, 0xC5, 0x4A);
Propchange: branches/pierre-fsd/include/psdk/ioevent.h ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: branches/pierre-fsd/lib/sdk/ioevent/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Aug 26 16:37:27 2008 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/pierre-fsd/lib/sdk/ioevent/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/pierre-fsd/lib/sdk/ioevent/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/pierre-fsd/lib/sdk/ioevent/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/pierre-fsd/lib/sdk/ioevent/ioevent.c URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/lib/sdk/ioevent/ioeve... ============================================================================== --- branches/pierre-fsd/lib/sdk/ioevent/ioevent.c (added) +++ branches/pierre-fsd/lib/sdk/ioevent/ioevent.c [iso-8859-1] Tue Aug 26 16:37:27 2008 @@ -1,0 +1,9 @@ + +#include <stdarg.h> + +#define COM_NO_WINDOWS_H +#include "initguid.h" + +#include <ioevent.h> + +/* EOF */
Propchange: branches/pierre-fsd/lib/sdk/ioevent/ioevent.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/pierre-fsd/lib/sdk/ioevent/ioevent.rbuild URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/lib/sdk/ioevent/ioeve... ============================================================================== --- branches/pierre-fsd/lib/sdk/ioevent/ioevent.rbuild (added) +++ branches/pierre-fsd/lib/sdk/ioevent/ioevent.rbuild [iso-8859-1] Tue Aug 26 16:37:27 2008 @@ -1,0 +1,5 @@ +<?xml version="1.0"?> +<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> +<module name="ioevent" type="staticlibrary"> + <file>ioevent.c</file> +</module>
Propchange: branches/pierre-fsd/lib/sdk/ioevent/ioevent.rbuild ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/pierre-fsd/lib/sdk/sdk.rbuild URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/lib/sdk/sdk.rbuild?re... ============================================================================== --- branches/pierre-fsd/lib/sdk/sdk.rbuild [iso-8859-1] (original) +++ branches/pierre-fsd/lib/sdk/sdk.rbuild [iso-8859-1] Tue Aug 26 16:37:27 2008 @@ -10,6 +10,9 @@ </directory> <directory name="nt"> <xi:include href="nt/nt.rbuild" /> + </directory> + <directory name="ioevent"> + <xi:include href="ioevent/ioevent.rbuild" /> </directory> <directory name="strmiids"> <xi:include href="strmiids/strmiids.rbuild" />
Modified: branches/pierre-fsd/ntoskrnl/fsrtl/pnp.c URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/pnp.c?... ============================================================================== --- branches/pierre-fsd/ntoskrnl/fsrtl/pnp.c [iso-8859-1] (original) +++ branches/pierre-fsd/ntoskrnl/fsrtl/pnp.c [iso-8859-1] Tue Aug 26 16:37:27 2008 @@ -3,12 +3,13 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fsrtl/pnp.c * PURPOSE: Manages PnP support routines for file system drivers. - * PROGRAMMERS: None. + * PROGRAMMERS: heis_spiter@hotmail.com */
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h> +#include <ioevent.h> #define NDEBUG #include <debug.h>
@@ -16,17 +17,18 @@
/*++ * @name FsRtlNotifyVolumeEvent - * @unimplemented + * @implemented * - * FILLME + * Notifies system (and applications) that something changed on volume. + * FSD should call it each time volume status changes. * * @param FileObject - * FILLME + * FileObject for the volume * * @param EventCode - * FILLME + * Event that occurs one the volume * - * @return None + * @return STATUS_SUCCESS if notification went well * * @remarks Only present in NT 5+. * @@ -36,7 +38,69 @@ FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject, IN ULONG EventCode) { - /* Unimplemented */ - KEBUGCHECK(0); - return STATUS_NOT_IMPLEMENTED; + LPGUID Guid = NULL; + NTSTATUS Status = STATUS_SUCCESS; + PDEVICE_OBJECT DeviceObject = NULL; + TARGET_DEVICE_CUSTOM_NOTIFICATION Notification; + + DeviceObject = IoGetRelatedDeviceObject(FileObject); + if (DeviceObject) + { + 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; + } + default: + { + Status = STATUS_INVALID_PARAMETER; + break; + } + } + if (Guid) + { + /* Copy GUID to notification structure and then report the change */ + RtlCopyMemory(&(Notification.Event), Guid, sizeof(GUID)); + IoReportTargetDeviceChangeAsynchronous(DeviceObject, + &Notification, + NULL, + NULL); + } + ObfDereferenceObject(DeviceObject); + } + return Status; }
Modified: branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/ntoskrnl-gen... ============================================================================== --- branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ branches/pierre-fsd/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Tue Aug 26 16:37:27 2008 @@ -32,6 +32,7 @@ <library>kdcom</library> <library>bootvid</library> <library>wdmguid</library> + <library>ioevent</library> <dependency>bugcodes</dependency> <directory name="include"> <pch>ntoskrnl.h</pch>