Author: ion
Date: Fri Jun 30 23:37:45 2006
New Revision: 22727
URL:
http://svn.reactos.org/svn/reactos?rev=22727&view=rev
Log:
- Better organize some APIs that were a bit all over the place. No code/formatting
changes.
Added:
trunk/reactos/ntoskrnl/io/util.c
- copied, changed from r22693, trunk/reactos/ntoskrnl/io/share.c
Removed:
trunk/reactos/ntoskrnl/io/share.c
Modified:
trunk/reactos/ntoskrnl/io/device.c
trunk/reactos/ntoskrnl/io/file.c
trunk/reactos/ntoskrnl/io/fs.c
trunk/reactos/ntoskrnl/io/iofunc.c
trunk/reactos/ntoskrnl/io/iomgr.c
trunk/reactos/ntoskrnl/io/irp.c
trunk/reactos/ntoskrnl/ntoskrnl.rbuild
Modified: trunk/reactos/ntoskrnl/io/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/device.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/io/device.c (original)
+++ trunk/reactos/ntoskrnl/io/device.c Fri Jun 30 23:37:45 2006
@@ -1105,16 +1105,4 @@
}
}
-/*
- * @unimplemented
- */
-NTSTATUS
-STDCALL
-IoValidateDeviceIoControlAccess(IN PIRP Irp,
- IN ULONG RequiredAccess)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
/* EOF */
Modified: trunk/reactos/ntoskrnl/io/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/file.c?rev=227…
==============================================================================
--- trunk/reactos/ntoskrnl/io/file.c (original)
+++ trunk/reactos/ntoskrnl/io/file.c Fri Jun 30 23:37:45 2006
@@ -1462,5 +1462,202 @@
FileInformation);
}
-
+/*
+ * @unimplemented
+ */
+BOOLEAN STDCALL
+IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG OpenOptions,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ OUT PFILE_NETWORK_OPEN_INFORMATION Buffer)
+{
+ UNIMPLEMENTED;
+ return(FALSE);
+}
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+IoUpdateShareAccess(PFILE_OBJECT FileObject,
+ PSHARE_ACCESS ShareAccess)
+{
+ PAGED_CODE();
+
+ if (FileObject->ReadAccess ||
+ FileObject->WriteAccess ||
+ FileObject->DeleteAccess)
+ {
+ ShareAccess->OpenCount++;
+
+ ShareAccess->Readers += FileObject->ReadAccess;
+ ShareAccess->Writers += FileObject->WriteAccess;
+ ShareAccess->Deleters += FileObject->DeleteAccess;
+ ShareAccess->SharedRead += FileObject->SharedRead;
+ ShareAccess->SharedWrite += FileObject->SharedWrite;
+ ShareAccess->SharedDelete += FileObject->SharedDelete;
+ }
+}
+
+
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL
+IoCheckShareAccess(IN ACCESS_MASK DesiredAccess,
+ IN ULONG DesiredShareAccess,
+ IN PFILE_OBJECT FileObject,
+ IN PSHARE_ACCESS ShareAccess,
+ IN BOOLEAN Update)
+{
+ BOOLEAN ReadAccess;
+ BOOLEAN WriteAccess;
+ BOOLEAN DeleteAccess;
+ BOOLEAN SharedRead;
+ BOOLEAN SharedWrite;
+ BOOLEAN SharedDelete;
+
+ PAGED_CODE();
+
+ ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0;
+ WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0;
+ DeleteAccess = (DesiredAccess & DELETE) != 0;
+
+ FileObject->ReadAccess = ReadAccess;
+ FileObject->WriteAccess = WriteAccess;
+ FileObject->DeleteAccess = DeleteAccess;
+
+ if (ReadAccess || WriteAccess || DeleteAccess)
+ {
+ SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0;
+ SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
+ SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
+
+ FileObject->SharedRead = SharedRead;
+ FileObject->SharedWrite = SharedWrite;
+ FileObject->SharedDelete = SharedDelete;
+
+ if ((ReadAccess && (ShareAccess->SharedRead <
ShareAccess->OpenCount)) ||
+ (WriteAccess && (ShareAccess->SharedWrite <
ShareAccess->OpenCount)) ||
+ (DeleteAccess && (ShareAccess->SharedDelete <
ShareAccess->OpenCount)) ||
+ ((ShareAccess->Readers != 0) && !SharedRead) ||
+ ((ShareAccess->Writers != 0) && !SharedWrite) ||
+ ((ShareAccess->Deleters != 0) && !SharedDelete))
+ {
+ return(STATUS_SHARING_VIOLATION);
+ }
+
+ if (Update)
+ {
+ ShareAccess->OpenCount++;
+
+ ShareAccess->Readers += ReadAccess;
+ ShareAccess->Writers += WriteAccess;
+ ShareAccess->Deleters += DeleteAccess;
+ ShareAccess->SharedRead += SharedRead;
+ ShareAccess->SharedWrite += SharedWrite;
+ ShareAccess->SharedDelete += SharedDelete;
+ }
+ }
+
+ return(STATUS_SUCCESS);
+}
+
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+IoRemoveShareAccess(IN PFILE_OBJECT FileObject,
+ IN PSHARE_ACCESS ShareAccess)
+{
+ PAGED_CODE();
+
+ if (FileObject->ReadAccess ||
+ FileObject->WriteAccess ||
+ FileObject->DeleteAccess)
+ {
+ ShareAccess->OpenCount--;
+
+ ShareAccess->Readers -= FileObject->ReadAccess;
+ ShareAccess->Writers -= FileObject->WriteAccess;
+ ShareAccess->Deleters -= FileObject->DeleteAccess;
+ ShareAccess->SharedRead -= FileObject->SharedRead;
+ ShareAccess->SharedWrite -= FileObject->SharedWrite;
+ ShareAccess->SharedDelete -= FileObject->SharedDelete;
+ }
+}
+
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+IoSetShareAccess(IN ACCESS_MASK DesiredAccess,
+ IN ULONG DesiredShareAccess,
+ IN PFILE_OBJECT FileObject,
+ OUT PSHARE_ACCESS ShareAccess)
+{
+ BOOLEAN ReadAccess;
+ BOOLEAN WriteAccess;
+ BOOLEAN DeleteAccess;
+ BOOLEAN SharedRead;
+ BOOLEAN SharedWrite;
+ BOOLEAN SharedDelete;
+
+ PAGED_CODE();
+
+ ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0;
+ WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0;
+ DeleteAccess = (DesiredAccess & DELETE) != 0;
+
+ FileObject->ReadAccess = ReadAccess;
+ FileObject->WriteAccess = WriteAccess;
+ FileObject->DeleteAccess = DeleteAccess;
+
+ if (!ReadAccess && !WriteAccess && !DeleteAccess)
+ {
+ ShareAccess->OpenCount = 0;
+ ShareAccess->Readers = 0;
+ ShareAccess->Writers = 0;
+ ShareAccess->Deleters = 0;
+
+ ShareAccess->SharedRead = 0;
+ ShareAccess->SharedWrite = 0;
+ ShareAccess->SharedDelete = 0;
+ }
+ else
+ {
+ SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0;
+ SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
+ SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
+
+ FileObject->SharedRead = SharedRead;
+ FileObject->SharedWrite = SharedWrite;
+ FileObject->SharedDelete = SharedDelete;
+
+ ShareAccess->OpenCount = 1;
+ ShareAccess->Readers = ReadAccess;
+ ShareAccess->Writers = WriteAccess;
+ ShareAccess->Deleters = DeleteAccess;
+
+ ShareAccess->SharedRead = SharedRead;
+ ShareAccess->SharedWrite = SharedWrite;
+ ShareAccess->SharedDelete = SharedDelete;
+ }
+}
+
+/*
+ * @unimplemented
+ */
+VOID
+STDCALL
+IoCancelFileOpen(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PFILE_OBJECT FileObject
+ )
+{
+ UNIMPLEMENTED;
+}
/* EOF */
Modified: trunk/reactos/ntoskrnl/io/fs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/fs.c?rev=22727…
==============================================================================
--- trunk/reactos/ntoskrnl/io/fs.c (original)
+++ trunk/reactos/ntoskrnl/io/fs.c Fri Jun 30 23:37:45 2006
@@ -47,19 +47,6 @@
/* FUNCTIONS *****************************************************************/
-
-/*
- * @unimplemented
- */
-VOID
-STDCALL
-IoCancelFileOpen(
- IN PDEVICE_OBJECT DeviceObject,
- IN PFILE_OBJECT FileObject
- )
-{
- UNIMPLEMENTED;
-}
VOID INIT_FUNCTION
IoInitFileSystemImplementation(VOID)
@@ -422,40 +409,6 @@
}
-/*
- * @implemented
- */
-PDEVICE_OBJECT STDCALL
-IoGetDeviceToVerify(IN PETHREAD Thread)
-/*
- * FUNCTION: Returns a pointer to the device, representing a removable-media
- * device, that is the target of the given thread's I/O request
- */
-{
- return(Thread->DeviceToVerify);
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoSetDeviceToVerify(IN PETHREAD Thread,
- IN PDEVICE_OBJECT DeviceObject)
-{
- Thread->DeviceToVerify = DeviceObject;
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoSetHardErrorOrVerifyDevice(IN PIRP Irp,
- IN PDEVICE_OBJECT DeviceObject)
-{
- Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject;
-}
/*
Modified: trunk/reactos/ntoskrnl/io/iofunc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iofunc.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iofunc.c (original)
+++ trunk/reactos/ntoskrnl/io/iofunc.c Fri Jun 30 23:37:45 2006
@@ -400,6 +400,84 @@
/* Return the Length and Status. ReturnedLength is NOT optional */
*ReturnedLength = IoStatusBlock.Information;
return Status;
+}
+
+/*
+ * @unimplemented
+ */
+NTSTATUS STDCALL
+IoSetInformation(IN PFILE_OBJECT FileObject,
+ IN FILE_INFORMATION_CLASS FileInformationClass,
+ IN ULONG Length,
+ IN PVOID FileInformation)
+{
+ IO_STATUS_BLOCK IoStatusBlock;
+ PIRP Irp;
+ PDEVICE_OBJECT DeviceObject;
+ PIO_STACK_LOCATION StackPtr;
+ NTSTATUS Status;
+
+ ASSERT(FileInformation != NULL);
+
+ if (FileInformationClass == FileCompletionInformation)
+ {
+ return STATUS_NOT_IMPLEMENTED;
+ }
+
+
+
+ Status = ObReferenceObjectByPointer(FileObject,
+ 0, /* FIXME - depends on the information class */
+ IoFileObjectType,
+ KernelMode);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ DPRINT("FileObject 0x%p\n", FileObject);
+
+ 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 = FileInformation;
+ Irp->UserIosb = &IoStatusBlock;
+ Irp->UserEvent = &FileObject->Event;
+ Irp->Tail.Overlay.Thread = PsGetCurrentThread();
+ KeResetEvent( &FileObject->Event );
+
+ StackPtr = IoGetNextIrpStackLocation(Irp);
+ StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION;
+ StackPtr->MinorFunction = 0;
+ StackPtr->Flags = 0;
+ StackPtr->Control = 0;
+ StackPtr->DeviceObject = DeviceObject;
+ StackPtr->FileObject = FileObject;
+ StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass;
+ StackPtr->Parameters.SetFile.Length = Length;
+
+ Status = IoCallDriver(FileObject->DeviceObject, Irp);
+ if (Status==STATUS_PENDING)
+ {
+ KeWaitForSingleObject(&FileObject->Event,
+ Executive,
+ KernelMode,
+ FileObject->Flags & FO_ALERTABLE_IO,
+ NULL);
+ Status = IoStatusBlock.Status;
+ }
+
+ return Status;
}
/* NATIVE SERVICES ***********************************************************/
@@ -2342,3 +2420,4 @@
UNIMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED);
}
+
Modified: trunk/reactos/ntoskrnl/io/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr.c Fri Jun 30 23:37:45 2006
@@ -34,7 +34,6 @@
FILE_GENERIC_EXECUTE,
FILE_ALL_ACCESS};
-static KSPIN_LOCK CancelSpinLock;
extern LIST_ENTRY ShutdownListHead;
extern KSPIN_LOCK ShutdownListLock;
extern NPAGED_LOOKASIDE_LIST IoCompletionPacketLookaside;
@@ -60,6 +59,7 @@
INIT_FUNCTION
IoInitCancelHandling(VOID)
{
+ extern KSPIN_LOCK CancelSpinLock;
KeInitializeSpinLock(&CancelSpinLock);
}
@@ -479,88 +479,4 @@
NULL);
}
-/* FUNCTIONS *****************************************************************/
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-IoAcquireCancelSpinLock(PKIRQL Irql)
-{
- KeAcquireSpinLock(&CancelSpinLock,Irql);
-}
-
-/*
- * @implemented
- */
-PVOID
-STDCALL
-IoGetInitialStack(VOID)
-{
- return(PsGetCurrentThread()->Tcb.InitialStack);
-}
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-IoGetStackLimits(OUT PULONG LowLimit,
- OUT PULONG HighLimit)
-{
- *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit;
- *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase;
-}
-
-/*
- * @implemented
- */
-BOOLEAN
-STDCALL
-IoIsSystemThread(IN PETHREAD Thread)
-{
- /* Call the Ps Function */
- return PsIsSystemThread(Thread);
-}
-
-/*
- * @implemented
- */
-BOOLEAN STDCALL
-IoIsWdmVersionAvailable(IN UCHAR MajorVersion,
- IN UCHAR MinorVersion)
-{
- /* MinorVersion = 0x20 : WinXP
- 0x10 : Win2k
- 0x5 : WinMe
- <0x5 : Win98
-
- We report Win2k now
- */
- if (MajorVersion <= 1 && MinorVersion <= 0x10)
- return TRUE;
- return FALSE;
-}
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-IoReleaseCancelSpinLock(KIRQL Irql)
-{
- KeReleaseSpinLock(&CancelSpinLock,Irql);
-}
-
-/*
- * @implemented
- */
-PEPROCESS
-STDCALL
-IoThreadToProcess(IN PETHREAD Thread)
-{
- return(Thread->ThreadsProcess);
-}
-
/* EOF */
Modified: trunk/reactos/ntoskrnl/io/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/irp.c?rev=2272…
==============================================================================
--- trunk/reactos/ntoskrnl/io/irp.c (original)
+++ trunk/reactos/ntoskrnl/io/irp.c Fri Jun 30 23:37:45 2006
@@ -837,7 +837,7 @@
/* Sync IRPs are queued to requestor thread's irp cancel/cleanup list */
IoQueueThreadIrp(Irp);
- return(Irp);
+ return Irp;
}
/*
Removed: trunk/reactos/ntoskrnl/io/share.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/share.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/io/share.c (original)
+++ trunk/reactos/ntoskrnl/io/share.c (removed)
@@ -1,333 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/io/share.c
- * PURPOSE: No purpose listed.
- *
- * PROGRAMMERS: David Welch (welch(a)mcmail.com)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoUpdateShareAccess(PFILE_OBJECT FileObject,
- PSHARE_ACCESS ShareAccess)
-{
- PAGED_CODE();
-
- if (FileObject->ReadAccess ||
- FileObject->WriteAccess ||
- FileObject->DeleteAccess)
- {
- ShareAccess->OpenCount++;
-
- ShareAccess->Readers += FileObject->ReadAccess;
- ShareAccess->Writers += FileObject->WriteAccess;
- ShareAccess->Deleters += FileObject->DeleteAccess;
- ShareAccess->SharedRead += FileObject->SharedRead;
- ShareAccess->SharedWrite += FileObject->SharedWrite;
- ShareAccess->SharedDelete += FileObject->SharedDelete;
- }
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-IoCheckShareAccess(IN ACCESS_MASK DesiredAccess,
- IN ULONG DesiredShareAccess,
- IN PFILE_OBJECT FileObject,
- IN PSHARE_ACCESS ShareAccess,
- IN BOOLEAN Update)
-{
- BOOLEAN ReadAccess;
- BOOLEAN WriteAccess;
- BOOLEAN DeleteAccess;
- BOOLEAN SharedRead;
- BOOLEAN SharedWrite;
- BOOLEAN SharedDelete;
-
- PAGED_CODE();
-
- ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0;
- WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0;
- DeleteAccess = (DesiredAccess & DELETE) != 0;
-
- FileObject->ReadAccess = ReadAccess;
- FileObject->WriteAccess = WriteAccess;
- FileObject->DeleteAccess = DeleteAccess;
-
- if (ReadAccess || WriteAccess || DeleteAccess)
- {
- SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0;
- SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
- SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
-
- FileObject->SharedRead = SharedRead;
- FileObject->SharedWrite = SharedWrite;
- FileObject->SharedDelete = SharedDelete;
-
- if ((ReadAccess && (ShareAccess->SharedRead <
ShareAccess->OpenCount)) ||
- (WriteAccess && (ShareAccess->SharedWrite <
ShareAccess->OpenCount)) ||
- (DeleteAccess && (ShareAccess->SharedDelete <
ShareAccess->OpenCount)) ||
- ((ShareAccess->Readers != 0) && !SharedRead) ||
- ((ShareAccess->Writers != 0) && !SharedWrite) ||
- ((ShareAccess->Deleters != 0) && !SharedDelete))
- {
- return(STATUS_SHARING_VIOLATION);
- }
-
- if (Update)
- {
- ShareAccess->OpenCount++;
-
- ShareAccess->Readers += ReadAccess;
- ShareAccess->Writers += WriteAccess;
- ShareAccess->Deleters += DeleteAccess;
- ShareAccess->SharedRead += SharedRead;
- ShareAccess->SharedWrite += SharedWrite;
- ShareAccess->SharedDelete += SharedDelete;
- }
- }
-
- return(STATUS_SUCCESS);
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoRemoveShareAccess(IN PFILE_OBJECT FileObject,
- IN PSHARE_ACCESS ShareAccess)
-{
- PAGED_CODE();
-
- if (FileObject->ReadAccess ||
- FileObject->WriteAccess ||
- FileObject->DeleteAccess)
- {
- ShareAccess->OpenCount--;
-
- ShareAccess->Readers -= FileObject->ReadAccess;
- ShareAccess->Writers -= FileObject->WriteAccess;
- ShareAccess->Deleters -= FileObject->DeleteAccess;
- ShareAccess->SharedRead -= FileObject->SharedRead;
- ShareAccess->SharedWrite -= FileObject->SharedWrite;
- ShareAccess->SharedDelete -= FileObject->SharedDelete;
- }
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-IoSetShareAccess(IN ACCESS_MASK DesiredAccess,
- IN ULONG DesiredShareAccess,
- IN PFILE_OBJECT FileObject,
- OUT PSHARE_ACCESS ShareAccess)
-{
- BOOLEAN ReadAccess;
- BOOLEAN WriteAccess;
- BOOLEAN DeleteAccess;
- BOOLEAN SharedRead;
- BOOLEAN SharedWrite;
- BOOLEAN SharedDelete;
-
- PAGED_CODE();
-
- ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0;
- WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0;
- DeleteAccess = (DesiredAccess & DELETE) != 0;
-
- FileObject->ReadAccess = ReadAccess;
- FileObject->WriteAccess = WriteAccess;
- FileObject->DeleteAccess = DeleteAccess;
-
- if (!ReadAccess && !WriteAccess && !DeleteAccess)
- {
- ShareAccess->OpenCount = 0;
- ShareAccess->Readers = 0;
- ShareAccess->Writers = 0;
- ShareAccess->Deleters = 0;
-
- ShareAccess->SharedRead = 0;
- ShareAccess->SharedWrite = 0;
- ShareAccess->SharedDelete = 0;
- }
- else
- {
- SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0;
- SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
- SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
-
- FileObject->SharedRead = SharedRead;
- FileObject->SharedWrite = SharedWrite;
- FileObject->SharedDelete = SharedDelete;
-
- ShareAccess->OpenCount = 1;
- ShareAccess->Readers = ReadAccess;
- ShareAccess->Writers = WriteAccess;
- ShareAccess->Deleters = DeleteAccess;
-
- ShareAccess->SharedRead = SharedRead;
- ShareAccess->SharedWrite = SharedWrite;
- ShareAccess->SharedDelete = SharedDelete;
- }
-}
-
-
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-IoCheckDesiredAccess(IN OUT PACCESS_MASK DesiredAccess,
- IN ACCESS_MASK GrantedAccess)
-{
- PAGED_CODE();
-
- RtlMapGenericMask(DesiredAccess,
- &IoFileObjectType->TypeInfo.GenericMapping);
-
- if ((~(*DesiredAccess) & GrantedAccess) != 0)
- return STATUS_ACCESS_DENIED;
- else
- return STATUS_SUCCESS;
-}
-
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-IoCheckEaBufferValidity(IN PFILE_FULL_EA_INFORMATION EaBuffer,
- IN ULONG EaLength,
- OUT PULONG ErrorOffset)
-{
- UNIMPLEMENTED;
- return(STATUS_NOT_IMPLEMENTED);
-}
-
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-IoCheckFunctionAccess(IN ACCESS_MASK GrantedAccess,
- IN UCHAR MajorFunction,
- IN UCHAR MinorFunction,
- IN ULONG IoControlCode,
- IN PVOID ExtraData OPTIONAL,
- IN PVOID ExtraData2 OPTIONAL)
-{
- UNIMPLEMENTED;
- return(STATUS_NOT_IMPLEMENTED);
-}
-
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-IoSetInformation(IN PFILE_OBJECT FileObject,
- IN FILE_INFORMATION_CLASS FileInformationClass,
- IN ULONG Length,
- IN PVOID FileInformation)
-{
- IO_STATUS_BLOCK IoStatusBlock;
- PIRP Irp;
- PDEVICE_OBJECT DeviceObject;
- PIO_STACK_LOCATION StackPtr;
- NTSTATUS Status;
-
- ASSERT(FileInformation != NULL);
-
- if (FileInformationClass == FileCompletionInformation)
- {
- return STATUS_NOT_IMPLEMENTED;
- }
-
-
-
- Status = ObReferenceObjectByPointer(FileObject,
- 0, /* FIXME - depends on the information class */
- IoFileObjectType,
- KernelMode);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
-
- DPRINT("FileObject 0x%p\n", FileObject);
-
- 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 = FileInformation;
- Irp->UserIosb = &IoStatusBlock;
- Irp->UserEvent = &FileObject->Event;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
- KeResetEvent( &FileObject->Event );
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION;
- StackPtr->MinorFunction = 0;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = FileObject;
- StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass;
- StackPtr->Parameters.SetFile.Length = Length;
-
- Status = IoCallDriver(FileObject->DeviceObject, Irp);
- if (Status==STATUS_PENDING)
- {
- KeWaitForSingleObject(&FileObject->Event,
- Executive,
- KernelMode,
- FileObject->Flags & FO_ALERTABLE_IO,
- NULL);
- Status = IoStatusBlock.Status;
- }
-
- return Status;
-}
-
-
-/*
- * @unimplemented
- */
-BOOLEAN STDCALL
-IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes,
- IN ACCESS_MASK DesiredAccess,
- IN ULONG OpenOptions,
- OUT PIO_STATUS_BLOCK IoStatus,
- OUT PFILE_NETWORK_OPEN_INFORMATION Buffer)
-{
- UNIMPLEMENTED;
- return(FALSE);
-}
-
-/* EOF */
Copied: trunk/reactos/ntoskrnl/io/util.c (from r22693, trunk/reactos/ntoskrnl/io/share.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/util.c?p2=trun…
==============================================================================
--- trunk/reactos/ntoskrnl/io/share.c (original)
+++ trunk/reactos/ntoskrnl/io/util.c Fri Jun 30 23:37:45 2006
@@ -1,11 +1,9 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/io/share.c
- * PURPOSE: No purpose listed.
- *
- * PROGRAMMERS: David Welch (welch(a)mcmail.com)
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/io/util.c
+ * PURPOSE: I/O Utility Functions
+ * PROGRAMMERS: <UNKNOWN>
*/
/* INCLUDES *****************************************************************/
@@ -14,180 +12,93 @@
#define NDEBUG
#include <internal/debug.h>
+/* DATA **********************************************************************/
+
+KSPIN_LOCK CancelSpinLock;
+
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
-VOID STDCALL
-IoUpdateShareAccess(PFILE_OBJECT FileObject,
- PSHARE_ACCESS ShareAccess)
+VOID
+STDCALL
+IoAcquireCancelSpinLock(PKIRQL Irql)
{
- PAGED_CODE();
-
- if (FileObject->ReadAccess ||
- FileObject->WriteAccess ||
- FileObject->DeleteAccess)
- {
- ShareAccess->OpenCount++;
-
- ShareAccess->Readers += FileObject->ReadAccess;
- ShareAccess->Writers += FileObject->WriteAccess;
- ShareAccess->Deleters += FileObject->DeleteAccess;
- ShareAccess->SharedRead += FileObject->SharedRead;
- ShareAccess->SharedWrite += FileObject->SharedWrite;
- ShareAccess->SharedDelete += FileObject->SharedDelete;
- }
+ KeAcquireSpinLock(&CancelSpinLock,Irql);
}
-
/*
* @implemented
*/
-NTSTATUS STDCALL
-IoCheckShareAccess(IN ACCESS_MASK DesiredAccess,
- IN ULONG DesiredShareAccess,
- IN PFILE_OBJECT FileObject,
- IN PSHARE_ACCESS ShareAccess,
- IN BOOLEAN Update)
+PVOID
+STDCALL
+IoGetInitialStack(VOID)
{
- BOOLEAN ReadAccess;
- BOOLEAN WriteAccess;
- BOOLEAN DeleteAccess;
- BOOLEAN SharedRead;
- BOOLEAN SharedWrite;
- BOOLEAN SharedDelete;
-
- PAGED_CODE();
-
- ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0;
- WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0;
- DeleteAccess = (DesiredAccess & DELETE) != 0;
-
- FileObject->ReadAccess = ReadAccess;
- FileObject->WriteAccess = WriteAccess;
- FileObject->DeleteAccess = DeleteAccess;
-
- if (ReadAccess || WriteAccess || DeleteAccess)
- {
- SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0;
- SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
- SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
-
- FileObject->SharedRead = SharedRead;
- FileObject->SharedWrite = SharedWrite;
- FileObject->SharedDelete = SharedDelete;
-
- if ((ReadAccess && (ShareAccess->SharedRead <
ShareAccess->OpenCount)) ||
- (WriteAccess && (ShareAccess->SharedWrite <
ShareAccess->OpenCount)) ||
- (DeleteAccess && (ShareAccess->SharedDelete <
ShareAccess->OpenCount)) ||
- ((ShareAccess->Readers != 0) && !SharedRead) ||
- ((ShareAccess->Writers != 0) && !SharedWrite) ||
- ((ShareAccess->Deleters != 0) && !SharedDelete))
- {
- return(STATUS_SHARING_VIOLATION);
- }
-
- if (Update)
- {
- ShareAccess->OpenCount++;
-
- ShareAccess->Readers += ReadAccess;
- ShareAccess->Writers += WriteAccess;
- ShareAccess->Deleters += DeleteAccess;
- ShareAccess->SharedRead += SharedRead;
- ShareAccess->SharedWrite += SharedWrite;
- ShareAccess->SharedDelete += SharedDelete;
- }
- }
-
- return(STATUS_SUCCESS);
+ return(PsGetCurrentThread()->Tcb.InitialStack);
}
-
/*
* @implemented
*/
-VOID STDCALL
-IoRemoveShareAccess(IN PFILE_OBJECT FileObject,
- IN PSHARE_ACCESS ShareAccess)
+VOID
+STDCALL
+IoGetStackLimits(OUT PULONG LowLimit,
+ OUT PULONG HighLimit)
{
- PAGED_CODE();
-
- if (FileObject->ReadAccess ||
- FileObject->WriteAccess ||
- FileObject->DeleteAccess)
- {
- ShareAccess->OpenCount--;
-
- ShareAccess->Readers -= FileObject->ReadAccess;
- ShareAccess->Writers -= FileObject->WriteAccess;
- ShareAccess->Deleters -= FileObject->DeleteAccess;
- ShareAccess->SharedRead -= FileObject->SharedRead;
- ShareAccess->SharedWrite -= FileObject->SharedWrite;
- ShareAccess->SharedDelete -= FileObject->SharedDelete;
- }
+ *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit;
+ *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase;
}
-
/*
* @implemented
*/
-VOID STDCALL
-IoSetShareAccess(IN ACCESS_MASK DesiredAccess,
- IN ULONG DesiredShareAccess,
- IN PFILE_OBJECT FileObject,
- OUT PSHARE_ACCESS ShareAccess)
+BOOLEAN
+STDCALL
+IoIsSystemThread(IN PETHREAD Thread)
{
- BOOLEAN ReadAccess;
- BOOLEAN WriteAccess;
- BOOLEAN DeleteAccess;
- BOOLEAN SharedRead;
- BOOLEAN SharedWrite;
- BOOLEAN SharedDelete;
-
- PAGED_CODE();
-
- ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0;
- WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0;
- DeleteAccess = (DesiredAccess & DELETE) != 0;
-
- FileObject->ReadAccess = ReadAccess;
- FileObject->WriteAccess = WriteAccess;
- FileObject->DeleteAccess = DeleteAccess;
-
- if (!ReadAccess && !WriteAccess && !DeleteAccess)
- {
- ShareAccess->OpenCount = 0;
- ShareAccess->Readers = 0;
- ShareAccess->Writers = 0;
- ShareAccess->Deleters = 0;
-
- ShareAccess->SharedRead = 0;
- ShareAccess->SharedWrite = 0;
- ShareAccess->SharedDelete = 0;
- }
- else
- {
- SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0;
- SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
- SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
-
- FileObject->SharedRead = SharedRead;
- FileObject->SharedWrite = SharedWrite;
- FileObject->SharedDelete = SharedDelete;
-
- ShareAccess->OpenCount = 1;
- ShareAccess->Readers = ReadAccess;
- ShareAccess->Writers = WriteAccess;
- ShareAccess->Deleters = DeleteAccess;
-
- ShareAccess->SharedRead = SharedRead;
- ShareAccess->SharedWrite = SharedWrite;
- ShareAccess->SharedDelete = SharedDelete;
- }
+ /* Call the Ps Function */
+ return PsIsSystemThread(Thread);
}
+/*
+ * @implemented
+ */
+BOOLEAN STDCALL
+IoIsWdmVersionAvailable(IN UCHAR MajorVersion,
+ IN UCHAR MinorVersion)
+{
+ /* MinorVersion = 0x20 : WinXP
+ 0x10 : Win2k
+ 0x5 : WinMe
+ <0x5 : Win98
+
+ We report Win2k now
+ */
+ if (MajorVersion <= 1 && MinorVersion <= 0x10)
+ return TRUE;
+ return FALSE;
+}
+
+/*
+ * @implemented
+ */
+VOID
+STDCALL
+IoReleaseCancelSpinLock(KIRQL Irql)
+{
+ KeReleaseSpinLock(&CancelSpinLock,Irql);
+}
+
+/*
+ * @implemented
+ */
+PEPROCESS
+STDCALL
+IoThreadToProcess(IN PETHREAD Thread)
+{
+ return(Thread->ThreadsProcess);
+}
/*
* @implemented
@@ -236,98 +147,52 @@
return(STATUS_NOT_IMPLEMENTED);
}
-
/*
* @unimplemented
*/
-NTSTATUS STDCALL
-IoSetInformation(IN PFILE_OBJECT FileObject,
- IN FILE_INFORMATION_CLASS FileInformationClass,
- IN ULONG Length,
- IN PVOID FileInformation)
+NTSTATUS
+STDCALL
+IoValidateDeviceIoControlAccess(IN PIRP Irp,
+ IN ULONG RequiredAccess)
{
- IO_STATUS_BLOCK IoStatusBlock;
- PIRP Irp;
- PDEVICE_OBJECT DeviceObject;
- PIO_STACK_LOCATION StackPtr;
- NTSTATUS Status;
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
- ASSERT(FileInformation != NULL);
-
- if (FileInformationClass == FileCompletionInformation)
- {
- return STATUS_NOT_IMPLEMENTED;
- }
-
-
-
- Status = ObReferenceObjectByPointer(FileObject,
- 0, /* FIXME - depends on the information class */
- IoFileObjectType,
- KernelMode);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
-
- DPRINT("FileObject 0x%p\n", FileObject);
-
- 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 = FileInformation;
- Irp->UserIosb = &IoStatusBlock;
- Irp->UserEvent = &FileObject->Event;
- Irp->Tail.Overlay.Thread = PsGetCurrentThread();
- KeResetEvent( &FileObject->Event );
-
- StackPtr = IoGetNextIrpStackLocation(Irp);
- StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION;
- StackPtr->MinorFunction = 0;
- StackPtr->Flags = 0;
- StackPtr->Control = 0;
- StackPtr->DeviceObject = DeviceObject;
- StackPtr->FileObject = FileObject;
- StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass;
- StackPtr->Parameters.SetFile.Length = Length;
-
- Status = IoCallDriver(FileObject->DeviceObject, Irp);
- if (Status==STATUS_PENDING)
- {
- KeWaitForSingleObject(&FileObject->Event,
- Executive,
- KernelMode,
- FileObject->Flags & FO_ALERTABLE_IO,
- NULL);
- Status = IoStatusBlock.Status;
- }
-
- return Status;
+/*
+ * @implemented
+ */
+VOID STDCALL
+IoSetDeviceToVerify(IN PETHREAD Thread,
+ IN PDEVICE_OBJECT DeviceObject)
+{
+ Thread->DeviceToVerify = DeviceObject;
}
/*
- * @unimplemented
+ * @implemented
*/
-BOOLEAN STDCALL
-IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes,
- IN ACCESS_MASK DesiredAccess,
- IN ULONG OpenOptions,
- OUT PIO_STATUS_BLOCK IoStatus,
- OUT PFILE_NETWORK_OPEN_INFORMATION Buffer)
+VOID STDCALL
+IoSetHardErrorOrVerifyDevice(IN PIRP Irp,
+ IN PDEVICE_OBJECT DeviceObject)
{
- UNIMPLEMENTED;
- return(FALSE);
+ Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject;
}
+/*
+ * @implemented
+ */
+PDEVICE_OBJECT STDCALL
+IoGetDeviceToVerify(IN PETHREAD Thread)
+/*
+ * FUNCTION: Returns a pointer to the device, representing a removable-media
+ * device, that is the target of the given thread's I/O request
+ */
+{
+ return(Thread->DeviceToVerify);
+}
+
+
+
/* 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 Fri Jun 30 23:37:45 2006
@@ -189,7 +189,7 @@
<file>rawfs.c</file>
<file>remlock.c</file>
<file>resource.c</file>
- <file>share.c</file>
+ <file>util.c</file>
<file>symlink.c</file>
<file>timer.c</file>
<file>vpb.c</file>