Author: ion
Date: Sun Jul 2 01:58:29 2006
New Revision: 22748
URL:
http://svn.reactos.org/svn/reactos?rev=22748&view=rev
Log:
- Add some more functions that just build IRPs to send to devices into iofunc.c from
vpb.c
- Add IoCheckQuerySetvolumeInformation to util.c from vpb.c with other similar functions
- Add the actual VPB functions in vpc.c to fs.c, and rename fs.c to volume.c, because it
already contained Volume APIs, and now with VPB, even more so. It also still contains the
FileSystem stuff, which is of course also generically part of "volumes".
- Delete vpb.c, rename fs.c to volume.c.
Added:
trunk/reactos/ntoskrnl/io/iomgr/volume.c
- copied, changed from r22747, trunk/reactos/ntoskrnl/io/iomgr/fs.c
Removed:
trunk/reactos/ntoskrnl/io/iomgr/fs.c
trunk/reactos/ntoskrnl/io/iomgr/vpb.c
Modified:
trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
trunk/reactos/ntoskrnl/io/iomgr/util.c
trunk/reactos/ntoskrnl/ntoskrnl.rbuild
Removed: trunk/reactos/ntoskrnl/io/iomgr/fs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/fs.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/fs.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/fs.c (removed)
@@ -1,606 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/io/fs.c
- * PURPOSE: Filesystem functions
- *
- * PROGRAMMERS: David Welch (welch(a)mcmail.com)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-#if defined (ALLOC_PRAGMA)
-#pragma alloc_text(INIT, IoInitFileSystemImplementation)
-#endif
-
-/* TYPES *******************************************************************/
-
-typedef struct _FILE_SYSTEM_OBJECT
-{
- PDEVICE_OBJECT DeviceObject;
- LIST_ENTRY Entry;
-} FILE_SYSTEM_OBJECT, *PFILE_SYSTEM_OBJECT;
-
-typedef struct _FS_CHANGE_NOTIFY_ENTRY
-{
- LIST_ENTRY FsChangeNotifyList;
- PDRIVER_OBJECT DriverObject;
- PDRIVER_FS_NOTIFICATION FSDNotificationProc;
-} FS_CHANGE_NOTIFY_ENTRY, *PFS_CHANGE_NOTIFY_ENTRY;
-
-/* GLOBALS ******************************************************************/
-
-static ERESOURCE FileSystemListLock;
-static LIST_ENTRY FileSystemListHead;
-
-static KGUARDED_MUTEX FsChangeNotifyListLock;
-static LIST_ENTRY FsChangeNotifyListHead;
-
-static VOID
-IopNotifyFileSystemChange(PDEVICE_OBJECT DeviceObject,
- BOOLEAN DriverActive);
-
-
-/* FUNCTIONS *****************************************************************/
-
-VOID INIT_FUNCTION
-IoInitFileSystemImplementation(VOID)
-{
- InitializeListHead(&FileSystemListHead);
- ExInitializeResourceLite(&FileSystemListLock);
-
- InitializeListHead(&FsChangeNotifyListHead);
- KeInitializeGuardedMutex(&FsChangeNotifyListLock);
-}
-
-
-VOID
-IoShutdownRegisteredFileSystems(VOID)
-{
- FILE_SYSTEM_OBJECT* current;
- PIRP Irp;
- KEVENT Event;
- IO_STATUS_BLOCK IoStatusBlock;
- NTSTATUS Status;
-
- DPRINT("IoShutdownRegisteredFileSystems()\n");
-
- KeEnterCriticalRegion();
- ExAcquireResourceSharedLite(&FileSystemListLock,TRUE);
- KeInitializeEvent(&Event,
- NotificationEvent,
- FALSE);
-
- LIST_FOR_EACH(current, &FileSystemListHead, FILE_SYSTEM_OBJECT,Entry)
- {
- /* send IRP_MJ_SHUTDOWN */
- Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SHUTDOWN,
- current->DeviceObject,
- NULL,
- 0,
- 0,
- &Event,
- &IoStatusBlock);
-
- Status = IoCallDriver(current->DeviceObject,Irp);
- if (Status == STATUS_PENDING)
- {
- KeWaitForSingleObject(&Event,
- Executive,
- KernelMode,
- FALSE,
- NULL);
- }
- }
-
- ExReleaseResourceLite(&FileSystemListLock);
- KeLeaveCriticalRegion();
-}
-
-
-static NTSTATUS
-IopMountFileSystem(PDEVICE_OBJECT DeviceObject,
- PDEVICE_OBJECT DeviceToMount)
-{
- IO_STATUS_BLOCK IoStatusBlock;
- PIO_STACK_LOCATION StackPtr;
- KEVENT Event;
- PIRP Irp;
- NTSTATUS Status;
-
- DPRINT("IopMountFileSystem(DeviceObject 0x%p, DeviceToMount 0x%p)\n",
- DeviceObject,DeviceToMount);
-
- ASSERT_IRQL(PASSIVE_LEVEL);
-
- KeInitializeEvent(&Event, NotificationEvent, FALSE);
- Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
- if (Irp==NULL)
- {
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- Irp->UserIosb = &IoStatusBlock;
- DPRINT("Irp->UserIosb 0x%p\n", Irp->UserIosb);
- Irp->UserEvent = &Event;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
- StackPtr->MinorFunction = IRP_MN_MOUNT_VOLUME;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = NULL;
- StackPtr->CompletionRoutine = NULL;
-
- StackPtr->Parameters.MountVolume.Vpb = DeviceToMount->Vpb;
- StackPtr->Parameters.MountVolume.DeviceObject = DeviceToMount;
-
- Status = IoCallDriver(DeviceObject,Irp);
- if (Status==STATUS_PENDING)
- {
- KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
- Status = IoStatusBlock.Status;
- }
-
- return(Status);
-}
-
-
-static NTSTATUS
-IopLoadFileSystem(IN PDEVICE_OBJECT DeviceObject)
-{
- IO_STATUS_BLOCK IoStatusBlock;
- PIO_STACK_LOCATION StackPtr;
- KEVENT Event;
- PIRP Irp;
- NTSTATUS Status;
-
- DPRINT("IopLoadFileSystem(DeviceObject 0x%p)\n", DeviceObject);
-
- ASSERT_IRQL(PASSIVE_LEVEL);
-
- KeInitializeEvent(&Event, NotificationEvent, FALSE);
- Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
- if (Irp==NULL)
- {
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- Irp->UserIosb = &IoStatusBlock;
- DPRINT("Irp->UserIosb 0x%p\n", Irp->UserIosb);
- Irp->UserEvent = &Event;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
- StackPtr->MinorFunction = IRP_MN_LOAD_FILE_SYSTEM;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = NULL;
- StackPtr->CompletionRoutine = NULL;
-
- Status = IoCallDriver(DeviceObject,Irp);
- if (Status==STATUS_PENDING)
- {
- KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
- Status = IoStatusBlock.Status;
- }
-
- return(Status);
-}
-
-
-NTSTATUS
-IoMountVolume(IN PDEVICE_OBJECT DeviceObject,
- IN BOOLEAN AllowRawMount)
-/*
- * FUNCTION: Mounts a logical volume
- * ARGUMENTS:
- * DeviceObject = Device to mount
- * RETURNS: Status
- */
-{
- PFILE_SYSTEM_OBJECT current;
- NTSTATUS Status;
- DEVICE_TYPE MatchingDeviceType;
- PDEVICE_OBJECT DevObject;
-
- ASSERT_IRQL(PASSIVE_LEVEL);
-
- DPRINT("IoMountVolume(DeviceObject 0x%p AllowRawMount %x)\n",
- DeviceObject, AllowRawMount);
-
- switch (DeviceObject->DeviceType)
- {
- case FILE_DEVICE_DISK:
- case FILE_DEVICE_VIRTUAL_DISK: /* ?? */
- MatchingDeviceType = FILE_DEVICE_DISK_FILE_SYSTEM;
- break;
-
- case FILE_DEVICE_CD_ROM:
- MatchingDeviceType = FILE_DEVICE_CD_ROM_FILE_SYSTEM;
- break;
-
- case FILE_DEVICE_NETWORK:
- MatchingDeviceType = FILE_DEVICE_NETWORK_FILE_SYSTEM;
- break;
-
- case FILE_DEVICE_TAPE:
- MatchingDeviceType = FILE_DEVICE_TAPE_FILE_SYSTEM;
- break;
-
- default:
- CPRINT("No matching file system type found for device type: %x\n",
- DeviceObject->DeviceType);
- return(STATUS_UNRECOGNIZED_VOLUME);
- }
-
- KeEnterCriticalRegion();
- ExAcquireResourceSharedLite(&FileSystemListLock,TRUE);
-
-restart:
- LIST_FOR_EACH(current,&FileSystemListHead, FILE_SYSTEM_OBJECT, Entry)
- {
- if (current->DeviceObject->DeviceType != MatchingDeviceType)
- {
- continue;
- }
- /* If we are not allowed to mount this volume as a raw filesystem volume
- then don't try this */
- if (!AllowRawMount &&
RawFsIsRawFileSystemDeviceObject(current->DeviceObject))
- {
- Status = STATUS_UNRECOGNIZED_VOLUME;
- }
- else
- {
- Status = IopMountFileSystem(current->DeviceObject,
- DeviceObject);
- }
- switch (Status)
- {
- case STATUS_FS_DRIVER_REQUIRED:
- DevObject = current->DeviceObject;
- ExReleaseResourceLite(&FileSystemListLock);
- Status = IopLoadFileSystem(DevObject);
- if (!NT_SUCCESS(Status))
- {
- KeLeaveCriticalRegion();
- return(Status);
- }
- ExAcquireResourceSharedLite(&FileSystemListLock,TRUE);
- goto restart;
-
- case STATUS_SUCCESS:
- DeviceObject->Vpb->Flags = DeviceObject->Vpb->Flags |
- VPB_MOUNTED;
- ExReleaseResourceLite(&FileSystemListLock);
- KeLeaveCriticalRegion();
- return(STATUS_SUCCESS);
-
- case STATUS_UNRECOGNIZED_VOLUME:
- default:
- /* do nothing */
- break;
- }
- }
- ExReleaseResourceLite(&FileSystemListLock);
- KeLeaveCriticalRegion();
-
- return(STATUS_UNRECOGNIZED_VOLUME);
-}
-
-
-/**********************************************************************
- * NAME EXPORTED
- * IoVerifyVolume
- *
- * DESCRIPTION
- * Verify the file system type and volume information or mount
- * a file system.
- *
- * ARGUMENTS
- * DeviceObject
- * Device to verify or mount
- *
- * AllowRawMount
- * ...
- *
- * RETURN VALUE
- * Status
- *
- * @implemented
- */
-NTSTATUS STDCALL
-IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
- IN BOOLEAN AllowRawMount)
-{
- IO_STATUS_BLOCK IoStatusBlock;
- PIO_STACK_LOCATION StackPtr;
- KEVENT Event;
- PIRP Irp;
- NTSTATUS Status;
- PDEVICE_OBJECT DevObject;
-
- DPRINT("IoVerifyVolume(DeviceObject 0x%p AllowRawMount %x)\n",
- DeviceObject, AllowRawMount);
-
- Status = STATUS_SUCCESS;
-
- KeWaitForSingleObject(&DeviceObject->DeviceLock,
- Executive,
- KernelMode,
- FALSE,
- NULL);
-
- if (DeviceObject->Vpb->Flags & VPB_MOUNTED)
- {
- /* Issue verify request to the FSD */
- DevObject = DeviceObject->Vpb->DeviceObject;
-
- KeInitializeEvent(&Event,
- NotificationEvent,
- FALSE);
-
- Irp = IoAllocateIrp(DevObject->StackSize, TRUE);
- if (Irp==NULL)
- {
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- Irp->UserIosb = &IoStatusBlock;
- Irp->UserEvent = &Event;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
- StackPtr->MinorFunction = IRP_MN_VERIFY_VOLUME;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DevObject;
- StackPtr->FileObject = NULL;
- StackPtr->CompletionRoutine = NULL;
-
- StackPtr->Parameters.VerifyVolume.Vpb = DeviceObject->Vpb;
- StackPtr->Parameters.VerifyVolume.DeviceObject = DeviceObject;
-
- Status = IoCallDriver(DevObject,
- Irp);
- if (Status==STATUS_PENDING)
- {
- KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
- Status = IoStatusBlock.Status;
- }
-
- if (NT_SUCCESS(Status))
- {
- KeSetEvent(&DeviceObject->DeviceLock,
- IO_NO_INCREMENT,
- FALSE);
- return(STATUS_SUCCESS);
- }
- }
-
- if (Status == STATUS_WRONG_VOLUME)
- {
- /* Clean existing VPB. This unmounts the filesystem. */
- DPRINT("Wrong volume!\n");
-
- DeviceObject->Vpb->DeviceObject = NULL;
- DeviceObject->Vpb->Flags &= ~VPB_MOUNTED;
- }
-
- /* Start mount sequence */
- Status = IoMountVolume(DeviceObject,
- AllowRawMount);
-
- KeSetEvent(&DeviceObject->DeviceLock,
- IO_NO_INCREMENT,
- FALSE);
-
- return(Status);
-}
-
-
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
-{
- PFILE_SYSTEM_OBJECT Fs;
-
- DPRINT("IoRegisterFileSystem(DeviceObject 0x%p)\n", DeviceObject);
-
- Fs = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(FILE_SYSTEM_OBJECT),
- TAG_FILE_SYSTEM);
- ASSERT(Fs!=NULL);
-
- Fs->DeviceObject = DeviceObject;
- KeEnterCriticalRegion();
- ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE);
-
- /* The RAW filesystem device objects must be last in the list so the
- raw filesystem driver is the last filesystem driver asked to mount
- a volume. It is always the first filesystem driver registered so
- we use InsertHeadList() here as opposed to the other alternative
- InsertTailList(). */
- InsertHeadList(&FileSystemListHead,
- &Fs->Entry);
-
- ExReleaseResourceLite(&FileSystemListLock);
- KeLeaveCriticalRegion();
-
- IopNotifyFileSystemChange(DeviceObject,
- TRUE);
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
-{
- PFILE_SYSTEM_OBJECT current;
-
- DPRINT("IoUnregisterFileSystem(DeviceObject 0x%p)\n", DeviceObject);
-
- KeEnterCriticalRegion();
- ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE);
-
- LIST_FOR_EACH(current,&FileSystemListHead, FILE_SYSTEM_OBJECT,Entry)
- {
- if (current->DeviceObject == DeviceObject)
- {
- RemoveEntryList(¤t->Entry);
- ExFreePoolWithTag(current, TAG_FILE_SYSTEM);
- ExReleaseResourceLite(&FileSystemListLock);
- KeLeaveCriticalRegion();
- IopNotifyFileSystemChange(DeviceObject, FALSE);
- return;
- }
- }
-
- ExReleaseResourceLite(&FileSystemListLock);
- KeLeaveCriticalRegion();
-}
-
-
-/**********************************************************************
- * NAME EXPORTED
- * IoGetBaseFileSystemDeviceObject@4
- *
- * DESCRIPTION
- * Get the DEVICE_OBJECT associated to
- * a FILE_OBJECT.
- *
- * ARGUMENTS
- * FileObject
- *
- * RETURN VALUE
- *
- * NOTE
- * From Bo Branten's ntifs.h v13.
- *
- * @implemented
- */
-PDEVICE_OBJECT STDCALL
-IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject)
-{
- PDEVICE_OBJECT DeviceObject = NULL;
- PVPB Vpb = NULL;
-
- /*
- * If the FILE_OBJECT's VPB is defined,
- * get the device from it.
- */
- if (NULL != (Vpb = FileObject->Vpb))
- {
- if (NULL != (DeviceObject = Vpb->DeviceObject))
- {
- /* Vpb->DeviceObject DEFINED! */
- return DeviceObject;
- }
- }
- /*
- * If that failed, try the VPB
- * in the FILE_OBJECT's DeviceObject.
- */
- DeviceObject = FileObject->DeviceObject;
- if (NULL == (Vpb = DeviceObject->Vpb))
- {
- /* DeviceObject->Vpb UNDEFINED! */
- return DeviceObject;
- }
- /*
- * If that pointer to the VPB is again
- * undefined, return directly the
- * device object from the FILE_OBJECT.
- */
- return (
- (NULL == Vpb->DeviceObject)
- ? DeviceObject
- : Vpb->DeviceObject
- );
-}
-
-
-static VOID
-IopNotifyFileSystemChange(PDEVICE_OBJECT DeviceObject,
- BOOLEAN DriverActive)
-{
- PFS_CHANGE_NOTIFY_ENTRY ChangeEntry;
-
- KeAcquireGuardedMutex(&FsChangeNotifyListLock);
- LIST_FOR_EACH(ChangeEntry, &FsChangeNotifyListHead,FS_CHANGE_NOTIFY_ENTRY,
FsChangeNotifyList)
- {
- (ChangeEntry->FSDNotificationProc)(DeviceObject, DriverActive);
- }
- KeReleaseGuardedMutex(&FsChangeNotifyListLock);
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject,
- IN PDRIVER_FS_NOTIFICATION FSDNotificationProc)
-{
- PFS_CHANGE_NOTIFY_ENTRY Entry;
-
- Entry = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(FS_CHANGE_NOTIFY_ENTRY),
- TAG_FS_CHANGE_NOTIFY);
- if (Entry == NULL)
- return(STATUS_INSUFFICIENT_RESOURCES);
-
- Entry->DriverObject = DriverObject;
- Entry->FSDNotificationProc = FSDNotificationProc;
-
- KeAcquireGuardedMutex(&FsChangeNotifyListLock);
- InsertHeadList(&FsChangeNotifyListHead,
- &Entry->FsChangeNotifyList);
- KeReleaseGuardedMutex(&FsChangeNotifyListLock);
-
- return(STATUS_SUCCESS);
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoUnregisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject,
- IN PDRIVER_FS_NOTIFICATION FSDNotificationProc)
-{
- PFS_CHANGE_NOTIFY_ENTRY ChangeEntry;
-
- LIST_FOR_EACH(ChangeEntry, &FsChangeNotifyListHead, FS_CHANGE_NOTIFY_ENTRY,
FsChangeNotifyList)
- {
- if (ChangeEntry->DriverObject == DriverObject &&
- ChangeEntry->FSDNotificationProc == FSDNotificationProc)
- {
- KeAcquireGuardedMutex(&FsChangeNotifyListLock);
- RemoveEntryList(&ChangeEntry->FsChangeNotifyList);
- KeReleaseGuardedMutex(&FsChangeNotifyListLock);
-
- ExFreePoolWithTag(ChangeEntry, TAG_FS_CHANGE_NOTIFY);
- return;
- }
-
- }
-}
-
-/* EOF */
Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c Sun Jul 2 01:58:29 2006
@@ -400,6 +400,86 @@
/* Return the Length and Status. ReturnedLength is NOT optional */
*ReturnedLength = IoStatusBlock.Information;
return Status;
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL
+IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
+ IN FS_INFORMATION_CLASS FsInformationClass,
+ IN ULONG Length,
+ OUT PVOID FsInformation,
+ OUT PULONG ReturnedLength)
+{
+ IO_STATUS_BLOCK IoStatusBlock;
+ PIO_STACK_LOCATION StackPtr;
+ PDEVICE_OBJECT DeviceObject;
+ PIRP Irp;
+ NTSTATUS Status;
+
+ ASSERT(FsInformation != NULL);
+
+ DPRINT("FsInformation %p\n", FsInformation);
+
+ Status = ObReferenceObjectByPointer(FileObject,
+ FILE_READ_ATTRIBUTES,
+ IoFileObjectType,
+ KernelMode);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ DeviceObject = FileObject->DeviceObject;
+
+ Irp = IoAllocateIrp(DeviceObject->StackSize,
+ TRUE);
+ if (Irp == NULL)
+ {
+ ObDereferenceObject(FileObject);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ /* Trigger FileObject/Event dereferencing */
+ Irp->Tail.Overlay.OriginalFileObject = FileObject;
+ Irp->RequestorMode = KernelMode;
+ Irp->AssociatedIrp.SystemBuffer = FsInformation;
+ KeResetEvent( &FileObject->Event );
+ Irp->UserEvent = &FileObject->Event;
+ Irp->UserIosb = &IoStatusBlock;
+ Irp->Tail.Overlay.Thread = PsGetCurrentThread();
+
+ StackPtr = IoGetNextIrpStackLocation(Irp);
+ StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
+ StackPtr->MinorFunction = 0;
+ StackPtr->Flags = 0;
+ StackPtr->Control = 0;
+ StackPtr->DeviceObject = DeviceObject;
+ StackPtr->FileObject = FileObject;
+ StackPtr->Parameters.QueryVolume.Length = Length;
+ StackPtr->Parameters.QueryVolume.FsInformationClass =
+ FsInformationClass;
+
+ Status = IoCallDriver(DeviceObject,
+ Irp);
+ if (Status == STATUS_PENDING)
+ {
+ KeWaitForSingleObject(&FileObject->Event,
+ UserRequest,
+ KernelMode,
+ FALSE,
+ NULL);
+ Status = IoStatusBlock.Status;
+ }
+ DPRINT("Status %x\n", Status);
+
+ if (ReturnedLength != NULL)
+ {
+ *ReturnedLength = IoStatusBlock.Information;
+ }
+
+ return(Status);
}
/*
@@ -2421,3 +2501,328 @@
return(STATUS_NOT_IMPLEMENTED);
}
+/*
+ * FUNCTION: Queries the volume information
+ * ARGUMENTS:
+ * FileHandle = Handle to a file object on the target volume
+ * ReturnLength = DataWritten
+ * FsInformation = Caller should supply storage for the information
+ * structure.
+ * Length = Size of the information structure
+ * FsInformationClass = Index to a information structure
+ *
+ * FileFsVolumeInformation FILE_FS_VOLUME_INFORMATION
+ * FileFsLabelInformation FILE_FS_LABEL_INFORMATION
+ * FileFsSizeInformation FILE_FS_SIZE_INFORMATION
+ * FileFsDeviceInformation FILE_FS_DEVICE_INFORMATION
+ * FileFsAttributeInformation FILE_FS_ATTRIBUTE_INFORMATION
+ * FileFsControlInformation
+ * FileFsQuotaQueryInformation --
+ * FileFsQuotaSetInformation --
+ * FileFsMaximumInformation
+ *
+ * RETURNS: Status
+ *
+ * @implemented
+ */
+
+NTSTATUS STDCALL
+NtQueryVolumeInformationFile(IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID FsInformation,
+ IN ULONG Length,
+ IN FS_INFORMATION_CLASS FsInformationClass)
+{
+ PFILE_OBJECT FileObject;
+ PDEVICE_OBJECT DeviceObject;
+ PIRP Irp;
+ NTSTATUS Status = STATUS_SUCCESS;
+ PIO_STACK_LOCATION StackPtr;
+ PVOID SystemBuffer;
+ KPROCESSOR_MODE PreviousMode;
+
+ DPRINT("FsInformation %p\n", FsInformation);
+
+ PreviousMode = ExGetPreviousMode();
+
+ if (PreviousMode != KernelMode)
+ {
+ _SEH_TRY
+ {
+ if (IoStatusBlock != NULL)
+ {
+ ProbeForWrite(IoStatusBlock,
+ sizeof(IO_STATUS_BLOCK),
+ sizeof(ULONG));
+ }
+
+ if (Length != 0)
+ {
+ ProbeForWrite(FsInformation,
+ Length,
+ 1);
+ }
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+ }
+ else
+ {
+ ASSERT(IoStatusBlock != NULL);
+ ASSERT(FsInformation != NULL);
+ }
+
+ Status = ObReferenceObjectByHandle(FileHandle,
+ 0, /* FIXME - depends on the information class! */
+ IoFileObjectType,
+ PreviousMode,
+ (PVOID*)&FileObject,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ DeviceObject = FileObject->DeviceObject;
+
+ Irp = IoAllocateIrp(DeviceObject->StackSize,
+ TRUE);
+ if (Irp == NULL)
+ {
+ ObDereferenceObject(FileObject);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ SystemBuffer = ExAllocatePoolWithTag(NonPagedPool,
+ Length,
+ TAG_SYSB);
+ if (SystemBuffer == NULL)
+ {
+ IoFreeIrp(Irp);
+ ObDereferenceObject(FileObject);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ /* Trigger FileObject/Event dereferencing */
+ Irp->Tail.Overlay.OriginalFileObject = FileObject;
+
+ Irp->RequestorMode = PreviousMode;
+ Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
+ KeResetEvent( &FileObject->Event );
+ Irp->UserEvent = &FileObject->Event;
+ Irp->UserIosb = IoStatusBlock;
+ Irp->Tail.Overlay.Thread = PsGetCurrentThread();
+
+ StackPtr = IoGetNextIrpStackLocation(Irp);
+ StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
+ StackPtr->MinorFunction = 0;
+ StackPtr->Flags = 0;
+ StackPtr->Control = 0;
+ StackPtr->DeviceObject = DeviceObject;
+ StackPtr->FileObject = FileObject;
+ StackPtr->Parameters.QueryVolume.Length = Length;
+ StackPtr->Parameters.QueryVolume.FsInformationClass =
+ FsInformationClass;
+
+ Status = IoCallDriver(DeviceObject,
+ Irp);
+ if (Status == STATUS_PENDING)
+ {
+ KeWaitForSingleObject(&FileObject->Event,
+ UserRequest,
+ PreviousMode,
+ FALSE,
+ NULL);
+ Status = IoStatusBlock->Status;
+ }
+ DPRINT("Status %x\n", Status);
+
+ if (NT_SUCCESS(Status))
+ {
+ _SEH_TRY
+ {
+ DPRINT("Information %lu\n", IoStatusBlock->Information);
+ RtlCopyMemory(FsInformation,
+ SystemBuffer,
+ IoStatusBlock->Information);
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
+ ExFreePool(SystemBuffer);
+
+ return(Status);
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL
+NtSetVolumeInformationFile(IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PVOID FsInformation,
+ IN ULONG Length,
+ IN FS_INFORMATION_CLASS FsInformationClass)
+{
+ PFILE_OBJECT FileObject;
+ PDEVICE_OBJECT DeviceObject;
+ PIRP Irp;
+ NTSTATUS Status;
+ PIO_STACK_LOCATION StackPtr;
+ PVOID SystemBuffer;
+ KPROCESSOR_MODE PreviousMode;
+
+ PreviousMode = ExGetPreviousMode();
+
+ if (PreviousMode != KernelMode)
+ {
+ Status = STATUS_SUCCESS;
+ _SEH_TRY
+ {
+ if (IoStatusBlock != NULL)
+ {
+ ProbeForWrite(IoStatusBlock,
+ sizeof(IO_STATUS_BLOCK),
+ sizeof(ULONG));
+ }
+
+ if (Length != 0)
+ {
+ ProbeForRead(FsInformation,
+ Length,
+ 1);
+ }
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+ }
+ else
+ {
+ ASSERT(IoStatusBlock != NULL);
+ ASSERT(FsInformation != NULL);
+ }
+
+ Status = ObReferenceObjectByHandle(FileHandle,
+ FILE_WRITE_ATTRIBUTES,
+ NULL,
+ PreviousMode,
+ (PVOID*)&FileObject,
+ NULL);
+ if (Status != STATUS_SUCCESS)
+ {
+ return(Status);
+ }
+
+ DeviceObject = FileObject->DeviceObject;
+
+ Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE);
+ if (Irp == NULL)
+ {
+ ObDereferenceObject(FileObject);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ SystemBuffer = ExAllocatePoolWithTag(NonPagedPool,
+ Length,
+ TAG_SYSB);
+ if (SystemBuffer == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto failfreeirp;
+ }
+
+ if (PreviousMode != KernelMode)
+ {
+ _SEH_TRY
+ {
+ /* no need to probe again */
+ RtlCopyMemory(SystemBuffer,
+ FsInformation,
+ Length);
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if (!NT_SUCCESS(Status))
+ {
+ ExFreePoolWithTag(SystemBuffer,
+ TAG_SYSB);
+failfreeirp:
+ IoFreeIrp(Irp);
+ ObDereferenceObject(FileObject);
+ return Status;
+ }
+ }
+ else
+ {
+ RtlCopyMemory(SystemBuffer,
+ FsInformation,
+ Length);
+ }
+
+ /* Trigger FileObject/Event dereferencing */
+ Irp->Tail.Overlay.OriginalFileObject = FileObject;
+ Irp->RequestorMode = PreviousMode;
+ Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
+ KeResetEvent( &FileObject->Event );
+ Irp->UserEvent = &FileObject->Event;
+ Irp->UserIosb = IoStatusBlock;
+ Irp->Tail.Overlay.Thread = PsGetCurrentThread();
+
+ StackPtr = IoGetNextIrpStackLocation(Irp);
+ StackPtr->MajorFunction = IRP_MJ_SET_VOLUME_INFORMATION;
+ StackPtr->MinorFunction = 0;
+ StackPtr->Flags = 0;
+ StackPtr->Control = 0;
+ StackPtr->DeviceObject = DeviceObject;
+ StackPtr->FileObject = FileObject;
+ StackPtr->Parameters.SetVolume.Length = Length;
+ StackPtr->Parameters.SetVolume.FsInformationClass =
+ FsInformationClass;
+
+ Status = IoCallDriver(DeviceObject,Irp);
+ if (Status == STATUS_PENDING)
+ {
+ KeWaitForSingleObject(&FileObject->Event,
+ UserRequest,
+ PreviousMode,
+ FALSE,
+ NULL);
+ _SEH_TRY
+ {
+ Status = IoStatusBlock->Status;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
+ ExFreePool(SystemBuffer);
+
+ return(Status);
+}
Modified: trunk/reactos/ntoskrnl/io/iomgr/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/util.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/util.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/util.c Sun Jul 2 01:58:29 2006
@@ -195,4 +195,16 @@
return Thread->DeviceToVerify;
}
+/*
+ * @unimplemented
+ */
+NTSTATUS
+NTAPI
+IoCheckQuerySetVolumeInformation(IN FS_INFORMATION_CLASS FsInformationClass,
+ IN ULONG Length,
+ IN BOOLEAN SetOperation)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
/* EOF */
Copied: trunk/reactos/ntoskrnl/io/iomgr/volume.c (from r22747,
trunk/reactos/ntoskrnl/io/iomgr/fs.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/volume.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/fs.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/volume.c Sun Jul 2 01:58:29 2006
@@ -33,6 +33,10 @@
PDRIVER_FS_NOTIFICATION FSDNotificationProc;
} FS_CHANGE_NOTIFY_ENTRY, *PFS_CHANGE_NOTIFY_ENTRY;
+#if defined (ALLOC_PRAGMA)
+#pragma alloc_text(INIT, IoInitVpbImplementation)
+#endif
+
/* GLOBALS ******************************************************************/
static ERESOURCE FileSystemListLock;
@@ -45,8 +49,39 @@
IopNotifyFileSystemChange(PDEVICE_OBJECT DeviceObject,
BOOLEAN DriverActive);
-
+static KSPIN_LOCK IoVpbLock;
/* FUNCTIONS *****************************************************************/
+
+VOID INIT_FUNCTION
+IoInitVpbImplementation(VOID)
+{
+ KeInitializeSpinLock(&IoVpbLock);
+}
+
+NTSTATUS
+STDCALL
+IopAttachVpb(PDEVICE_OBJECT DeviceObject)
+{
+ PVPB Vpb;
+
+ /* Allocate the Vpb */
+ Vpb = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(VPB),
+ TAG_VPB);
+ if (Vpb == NULL) return(STATUS_UNSUCCESSFUL);
+
+ /* Clear it so we don't waste time manually */
+ RtlZeroMemory(Vpb, sizeof(VPB));
+
+ /* Set the Header and Device Field */
+ Vpb->Type = IO_TYPE_VPB;
+ Vpb->Size = sizeof(VPB);
+ Vpb->RealDevice = DeviceObject;
+
+ /* link it to the Device Object */
+ DeviceObject->Vpb = Vpb;
+ return(STATUS_SUCCESS);
+}
VOID INIT_FUNCTION
IoInitFileSystemImplementation(VOID)
@@ -603,4 +638,25 @@
}
}
+/*
+ * @implemented
+ */
+VOID STDCALL
+IoAcquireVpbSpinLock(OUT PKIRQL Irql)
+{
+ KeAcquireSpinLock(&IoVpbLock,
+ Irql);
+}
+
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+IoReleaseVpbSpinLock(IN KIRQL Irql)
+{
+ KeReleaseSpinLock(&IoVpbLock,
+ Irql);
+}
+
/* EOF */
Removed: trunk/reactos/ntoskrnl/io/iomgr/vpb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/vpb.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/vpb.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/vpb.c (removed)
@@ -1,502 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/io/vpb.c
- * PURPOSE: Volume Parameter Block managment
- *
- * PROGRAMMERS: David Welch (welch(a)mcmail.com)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-#if defined (ALLOC_PRAGMA)
-#pragma alloc_text(INIT, IoInitVpbImplementation)
-#endif
-
-
-/* GLOBALS *******************************************************************/
-
-static KSPIN_LOCK IoVpbLock;
-
-/* FUNCTIONS *****************************************************************/
-
-VOID INIT_FUNCTION
-IoInitVpbImplementation(VOID)
-{
- KeInitializeSpinLock(&IoVpbLock);
-}
-
-NTSTATUS
-STDCALL
-IopAttachVpb(PDEVICE_OBJECT DeviceObject)
-{
- PVPB Vpb;
-
- /* Allocate the Vpb */
- Vpb = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(VPB),
- TAG_VPB);
- if (Vpb == NULL) return(STATUS_UNSUCCESSFUL);
-
- /* Clear it so we don't waste time manually */
- RtlZeroMemory(Vpb, sizeof(VPB));
-
- /* Set the Header and Device Field */
- Vpb->Type = IO_TYPE_VPB;
- Vpb->Size = sizeof(VPB);
- Vpb->RealDevice = DeviceObject;
-
- /* link it to the Device Object */
- DeviceObject->Vpb = Vpb;
- return(STATUS_SUCCESS);
-}
-
-/*
- * FUNCTION: Queries the volume information
- * ARGUMENTS:
- * FileHandle = Handle to a file object on the target volume
- * ReturnLength = DataWritten
- * FsInformation = Caller should supply storage for the information
- * structure.
- * Length = Size of the information structure
- * FsInformationClass = Index to a information structure
- *
- * FileFsVolumeInformation FILE_FS_VOLUME_INFORMATION
- * FileFsLabelInformation FILE_FS_LABEL_INFORMATION
- * FileFsSizeInformation FILE_FS_SIZE_INFORMATION
- * FileFsDeviceInformation FILE_FS_DEVICE_INFORMATION
- * FileFsAttributeInformation FILE_FS_ATTRIBUTE_INFORMATION
- * FileFsControlInformation
- * FileFsQuotaQueryInformation --
- * FileFsQuotaSetInformation --
- * FileFsMaximumInformation
- *
- * RETURNS: Status
- *
- * @implemented
- */
-
-NTSTATUS STDCALL
-NtQueryVolumeInformationFile(IN HANDLE FileHandle,
- OUT PIO_STATUS_BLOCK IoStatusBlock,
- OUT PVOID FsInformation,
- IN ULONG Length,
- IN FS_INFORMATION_CLASS FsInformationClass)
-{
- PFILE_OBJECT FileObject;
- PDEVICE_OBJECT DeviceObject;
- PIRP Irp;
- NTSTATUS Status = STATUS_SUCCESS;
- PIO_STACK_LOCATION StackPtr;
- PVOID SystemBuffer;
- KPROCESSOR_MODE PreviousMode;
-
- DPRINT("FsInformation %p\n", FsInformation);
-
- PreviousMode = ExGetPreviousMode();
-
- if (PreviousMode != KernelMode)
- {
- _SEH_TRY
- {
- if (IoStatusBlock != NULL)
- {
- ProbeForWrite(IoStatusBlock,
- sizeof(IO_STATUS_BLOCK),
- sizeof(ULONG));
- }
-
- if (Length != 0)
- {
- ProbeForWrite(FsInformation,
- Length,
- 1);
- }
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
- }
- else
- {
- ASSERT(IoStatusBlock != NULL);
- ASSERT(FsInformation != NULL);
- }
-
- Status = ObReferenceObjectByHandle(FileHandle,
- 0, /* FIXME - depends on the information class! */
- IoFileObjectType,
- PreviousMode,
- (PVOID*)&FileObject,
- NULL);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
-
- DeviceObject = FileObject->DeviceObject;
-
- Irp = IoAllocateIrp(DeviceObject->StackSize,
- TRUE);
- if (Irp == NULL)
- {
- ObDereferenceObject(FileObject);
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- SystemBuffer = ExAllocatePoolWithTag(NonPagedPool,
- Length,
- TAG_SYSB);
- if (SystemBuffer == NULL)
- {
- IoFreeIrp(Irp);
- ObDereferenceObject(FileObject);
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- /* Trigger FileObject/Event dereferencing */
- Irp->Tail.Overlay.OriginalFileObject = FileObject;
-
- Irp->RequestorMode = PreviousMode;
- Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
- KeResetEvent( &FileObject->Event );
- Irp->UserEvent = &FileObject->Event;
- Irp->UserIosb = IoStatusBlock;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
- StackPtr->MinorFunction = 0;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = FileObject;
- StackPtr->Parameters.QueryVolume.Length = Length;
- StackPtr->Parameters.QueryVolume.FsInformationClass =
- FsInformationClass;
-
- Status = IoCallDriver(DeviceObject,
- Irp);
- if (Status == STATUS_PENDING)
- {
- KeWaitForSingleObject(&FileObject->Event,
- UserRequest,
- PreviousMode,
- FALSE,
- NULL);
- Status = IoStatusBlock->Status;
- }
- DPRINT("Status %x\n", Status);
-
- if (NT_SUCCESS(Status))
- {
- _SEH_TRY
- {
- DPRINT("Information %lu\n", IoStatusBlock->Information);
- RtlCopyMemory(FsInformation,
- SystemBuffer,
- IoStatusBlock->Information);
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- }
-
- ExFreePool(SystemBuffer);
-
- return(Status);
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
- IN FS_INFORMATION_CLASS FsInformationClass,
- IN ULONG Length,
- OUT PVOID FsInformation,
- OUT PULONG ReturnedLength)
-{
- IO_STATUS_BLOCK IoStatusBlock;
- PIO_STACK_LOCATION StackPtr;
- PDEVICE_OBJECT DeviceObject;
- PIRP Irp;
- NTSTATUS Status;
-
- ASSERT(FsInformation != NULL);
-
- DPRINT("FsInformation %p\n", FsInformation);
-
- Status = ObReferenceObjectByPointer(FileObject,
- FILE_READ_ATTRIBUTES,
- IoFileObjectType,
- KernelMode);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
-
- DeviceObject = FileObject->DeviceObject;
-
- Irp = IoAllocateIrp(DeviceObject->StackSize,
- TRUE);
- if (Irp == NULL)
- {
- ObDereferenceObject(FileObject);
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- /* Trigger FileObject/Event dereferencing */
- Irp->Tail.Overlay.OriginalFileObject = FileObject;
- Irp->RequestorMode = KernelMode;
- Irp->AssociatedIrp.SystemBuffer = FsInformation;
- KeResetEvent( &FileObject->Event );
- Irp->UserEvent = &FileObject->Event;
- Irp->UserIosb = &IoStatusBlock;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
- StackPtr->MinorFunction = 0;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = FileObject;
- StackPtr->Parameters.QueryVolume.Length = Length;
- StackPtr->Parameters.QueryVolume.FsInformationClass =
- FsInformationClass;
-
- Status = IoCallDriver(DeviceObject,
- Irp);
- if (Status == STATUS_PENDING)
- {
- KeWaitForSingleObject(&FileObject->Event,
- UserRequest,
- KernelMode,
- FALSE,
- NULL);
- Status = IoStatusBlock.Status;
- }
- DPRINT("Status %x\n", Status);
-
- if (ReturnedLength != NULL)
- {
- *ReturnedLength = IoStatusBlock.Information;
- }
-
- return(Status);
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-NtSetVolumeInformationFile(IN HANDLE FileHandle,
- OUT PIO_STATUS_BLOCK IoStatusBlock,
- IN PVOID FsInformation,
- IN ULONG Length,
- IN FS_INFORMATION_CLASS FsInformationClass)
-{
- PFILE_OBJECT FileObject;
- PDEVICE_OBJECT DeviceObject;
- PIRP Irp;
- NTSTATUS Status;
- PIO_STACK_LOCATION StackPtr;
- PVOID SystemBuffer;
- KPROCESSOR_MODE PreviousMode;
-
- PreviousMode = ExGetPreviousMode();
-
- if (PreviousMode != KernelMode)
- {
- Status = STATUS_SUCCESS;
- _SEH_TRY
- {
- if (IoStatusBlock != NULL)
- {
- ProbeForWrite(IoStatusBlock,
- sizeof(IO_STATUS_BLOCK),
- sizeof(ULONG));
- }
-
- if (Length != 0)
- {
- ProbeForRead(FsInformation,
- Length,
- 1);
- }
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
- }
- else
- {
- ASSERT(IoStatusBlock != NULL);
- ASSERT(FsInformation != NULL);
- }
-
- Status = ObReferenceObjectByHandle(FileHandle,
- FILE_WRITE_ATTRIBUTES,
- NULL,
- PreviousMode,
- (PVOID*)&FileObject,
- NULL);
- if (Status != STATUS_SUCCESS)
- {
- return(Status);
- }
-
- DeviceObject = FileObject->DeviceObject;
-
- Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE);
- if (Irp == NULL)
- {
- ObDereferenceObject(FileObject);
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
-
- SystemBuffer = ExAllocatePoolWithTag(NonPagedPool,
- Length,
- TAG_SYSB);
- if (SystemBuffer == NULL)
- {
- Status = STATUS_INSUFFICIENT_RESOURCES;
- goto failfreeirp;
- }
-
- if (PreviousMode != KernelMode)
- {
- _SEH_TRY
- {
- /* no need to probe again */
- RtlCopyMemory(SystemBuffer,
- FsInformation,
- Length);
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if (!NT_SUCCESS(Status))
- {
- ExFreePoolWithTag(SystemBuffer,
- TAG_SYSB);
-failfreeirp:
- IoFreeIrp(Irp);
- ObDereferenceObject(FileObject);
- return Status;
- }
- }
- else
- {
- RtlCopyMemory(SystemBuffer,
- FsInformation,
- Length);
- }
-
- /* Trigger FileObject/Event dereferencing */
- Irp->Tail.Overlay.OriginalFileObject = FileObject;
- Irp->RequestorMode = PreviousMode;
- Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
- KeResetEvent( &FileObject->Event );
- Irp->UserEvent = &FileObject->Event;
- Irp->UserIosb = IoStatusBlock;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_SET_VOLUME_INFORMATION;
- StackPtr->MinorFunction = 0;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = FileObject;
- StackPtr->Parameters.SetVolume.Length = Length;
- StackPtr->Parameters.SetVolume.FsInformationClass =
- FsInformationClass;
-
- Status = IoCallDriver(DeviceObject,Irp);
- if (Status == STATUS_PENDING)
- {
- KeWaitForSingleObject(&FileObject->Event,
- UserRequest,
- PreviousMode,
- FALSE,
- NULL);
- _SEH_TRY
- {
- Status = IoStatusBlock->Status;
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- }
-
- ExFreePool(SystemBuffer);
-
- return(Status);
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoAcquireVpbSpinLock(OUT PKIRQL Irql)
-{
- KeAcquireSpinLock(&IoVpbLock,
- Irql);
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoReleaseVpbSpinLock(IN KIRQL Irql)
-{
- KeReleaseSpinLock(&IoVpbLock,
- Irql);
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-STDCALL
-IoCheckQuerySetVolumeInformation(IN FS_INFORMATION_CLASS FsInformationClass,
- IN ULONG Length,
- IN BOOLEAN SetOperation)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-/* EOF */
Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Sun Jul 2 01:58:29 2006
@@ -175,7 +175,6 @@
<file>error.c</file>
<file>event.c</file>
<file>file.c</file>
- <file>fs.c</file>
<file>iocomp.c</file>
<file>iofunc.c</file>
<file>iomgr.c</file>
@@ -189,7 +188,7 @@
<file>util.c</file>
<file>symlink.c</file>
<file>timer.c</file>
- <file>vpb.c</file>
+ <file>volume.c</file>
</directory>
<directory name="pnpmgr">
<file>plugplay.c</file>