Add file object flags, complete DEVOBJ_EXTENSION, and implement:
IoIsFileOriginRemote, IoGetLowerDeviceObject, IoGetdiskDeviceObject,
IoGetRequestorSessionId, IoGetRequestorProcessId
Modified: trunk/reactos/include/ddk/iotypes.h
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
Modified: trunk/reactos/ntoskrnl/io/device.c
Modified: trunk/reactos/ntoskrnl/io/file.c
Modified: trunk/reactos/ntoskrnl/io/irp.c
Modified: trunk/reactos/ntoskrnl/io/process.c
_____
Modified: trunk/reactos/include/ddk/iotypes.h
--- trunk/reactos/include/ddk/iotypes.h 2005-04-16 17:48:46 UTC (rev
14638)
+++ trunk/reactos/include/ddk/iotypes.h 2005-04-16 19:38:14 UTC (rev
14639)
@@ -645,6 +645,11 @@
#define FO_OPENED_CASE_SENSITIVE 0x00020000
#define FO_HANDLE_CREATED 0x00040000
#define FO_FILE_FAST_IO_READ 0x00080000
+#define FO_RANDOM_ACCESS 0x00100000
+#define FO_FILE_OPEN_CANCELLED 0x00200000
+#define FO_VOLUME_OPEN 0x00400000
+#define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000
+#define FO_REMOTE_ORIGIN 0x01000000
typedef struct _FILE_OBJECT
{
@@ -896,6 +901,12 @@
#define DRVO_BOOTREINIT_REGISTERED 0x20L
#define DRVO_LEGACY_RESOURCES 0x40L
+#define DOE_UNLOAD_PENDING 0x1
+#define DOE_DELETE_PENDING 0x2
+#define DOE_REMOVE_PENDING 0x4
+#define DOE_REMOVE_PROCESSED 0x8
+#define DOE_START_PENDING 0x10
+
typedef struct _DRIVER_OBJECT
{
CSHORT Type;
_____
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
--- trunk/reactos/ntoskrnl/include/internal/io.h 2005-04-16
17:48:46 UTC (rev 14638)
+++ trunk/reactos/ntoskrnl/include/internal/io.h 2005-04-16
19:38:14 UTC (rev 14639)
@@ -41,6 +41,7 @@
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
+struct _DEVICE_OBJECT_POWER_EXTENSION;
typedef struct _IO_COMPLETION_PACKET{
PVOID Key;
@@ -53,10 +54,17 @@
CSHORT Type;
USHORT Size;
PDEVICE_OBJECT DeviceObject;
- ULONG Unknown[3];
+ ULONG PowerFlags;
+ struct DEVICE_OBJECT_POWER_EXTENSION *Dope;
+ ULONG ExtensionFlags;
struct _DEVICE_NODE *DeviceNode;
+ PDEVICE_OBJECT AttachedTo;
+ LONG StartIoCount;
+ LONG StartIoKey;
+ ULONG StartIoFlags;
+ struct _VPB *Vpb;
} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
-
+
typedef struct _PRIVATE_DRIVER_EXTENSIONS {
struct _PRIVATE_DRIVER_EXTENSIONS *Link;
PVOID ClientIdentificationAddress;
_____
Modified: trunk/reactos/ntoskrnl/io/device.c
--- trunk/reactos/ntoskrnl/io/device.c 2005-04-16 17:48:46 UTC (rev
14638)
+++ trunk/reactos/ntoskrnl/io/device.c 2005-04-16 19:38:14 UTC (rev
14639)
@@ -247,30 +247,66 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
STDCALL
-IoGetDiskDeviceObject(
- IN PDEVICE_OBJECT FileSystemDeviceObject,
- OUT PDEVICE_OBJECT *DiskDeviceObject
- )
+IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject,
+ OUT PDEVICE_OBJECT *DiskDeviceObject)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ PDEVOBJ_EXTENSION DeviceExtension;
+ PVPB Vpb;
+ KIRQL OldIrql;
+
+ /* Make sure there's a VPB */
+ if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER;
+
+ /* Acquire it */
+ IoAcquireVpbSpinLock(&OldIrql);
+
+ /* Get the Device Extension */
+ DeviceExtension = FileSystemDeviceObject->DeviceObjectExtension;
+
+ /* Make sure this one has a VPB too */
+ Vpb = DeviceExtension->Vpb;
+ if (!Vpb) return STATUS_INVALID_PARAMETER;
+
+ /* Make sure someone it's mounted */
+ if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) return
STATUS_VOLUME_DISMOUNTED;
+
+ /* Return the Disk Device Object */
+ *DiskDeviceObject = Vpb->RealDevice;
+
+ /* Release the lock */
+ IoReleaseVpbSpinLock(OldIrql);
+ return STATUS_SUCCESS;
}
/*
- * @unimplemented
+ * @implemented
*/
PDEVICE_OBJECT
STDCALL
-IoGetLowerDeviceObject(
- IN PDEVICE_OBJECT DeviceObject
- )
+IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
{
- UNIMPLEMENTED;
- return 0;
+ PDEVOBJ_EXTENSION DeviceExtension =
DeviceObject->DeviceObjectExtension;
+ PDEVICE_OBJECT LowerDeviceObject = NULL;
+
+ /* Make sure it's not getting deleted */
+ if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING |
+ DOE_DELETE_PENDING |
+ DOE_REMOVE_PENDING |
+ DOE_REMOVE_PROCESSED))
+ {
+ /* Get the Lower Device Object */
+ LowerDeviceObject = DeviceExtension->AttachedTo;
+
+ /* Reference it */
+ ObReferenceObject(LowerDeviceObject);
+ }
+
+ /* Return it */
+ return LowerDeviceObject;
}
/*
_____
Modified: trunk/reactos/ntoskrnl/io/file.c
--- trunk/reactos/ntoskrnl/io/file.c 2005-04-16 17:48:46 UTC (rev
14638)
+++ trunk/reactos/ntoskrnl/io/file.c 2005-04-16 19:38:14 UTC (rev
14639)
@@ -265,16 +265,14 @@
}
/*
- * @unimplemented
+ * @implemented
*/
BOOLEAN
STDCALL
-IoIsFileOriginRemote(
- IN PFILE_OBJECT FileObject
- )
+IoIsFileOriginRemote(IN PFILE_OBJECT FileObject)
{
- UNIMPLEMENTED;
- return FALSE;
+ /* Return the flag status */
+ return (FileObject->Flags & FO_REMOTE_ORIGIN);
}
/*
_____
Modified: trunk/reactos/ntoskrnl/io/irp.c
--- trunk/reactos/ntoskrnl/io/irp.c 2005-04-16 17:48:46 UTC (rev
14638)
+++ trunk/reactos/ntoskrnl/io/irp.c 2005-04-16 19:38:14 UTC (rev
14639)
@@ -71,34 +71,6 @@
/*
* @unimplemented
*/
-ULONG
-STDCALL
-IoGetRequestorProcessId(
- IN PIRP Irp
- )
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-STDCALL
-IoGetRequestorSessionId(
- IN PIRP Irp,
- OUT PULONG pSessionId
- )
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-
-/*
- * @unimplemented
- */
BOOLEAN
STDCALL
IoIsValidNameGraftingBuffer(
_____
Modified: trunk/reactos/ntoskrnl/io/process.c
--- trunk/reactos/ntoskrnl/io/process.c 2005-04-16 17:48:46 UTC (rev
14638)
+++ trunk/reactos/ntoskrnl/io/process.c 2005-04-16 19:38:14 UTC (rev
14639)
@@ -18,44 +18,44 @@
/*
* @implemented
*/
-PVOID STDCALL
+PVOID
+STDCALL
IoGetInitialStack(VOID)
{
- return(PsGetCurrentThread()->Tcb.InitialStack);
+ return(PsGetCurrentThread()->Tcb.InitialStack);
}
-
/*
* @implemented
*/
-VOID STDCALL
+VOID
+STDCALL
IoGetStackLimits(OUT PULONG LowLimit,
- OUT PULONG HighLimit)
+ OUT PULONG HighLimit)
{
- *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit;
- *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase;
+ *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit;
+ *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase;
}
/*
- * @unimplemented
+ * @implemented
*/
BOOLEAN
STDCALL
-IoIsSystemThread(
- IN PETHREAD Thread
- )
+IoIsSystemThread(IN PETHREAD Thread)
{
- UNIMPLEMENTED;
- return FALSE;
+ /* Call the Ps Function */
+ return PsIsSystemThread(Thread);
}
/*
* @implemented
*/
-PEPROCESS STDCALL
+PEPROCESS
+STDCALL
IoThreadToProcess(IN PETHREAD Thread)
{
- return(Thread->ThreadsProcess);
+ return(Thread->ThreadsProcess);
}
@@ -65,10 +65,32 @@
PEPROCESS STDCALL
IoGetRequestorProcess(IN PIRP Irp)
{
- return(Irp->Tail.Overlay.Thread->ThreadsProcess);
+ return(Irp->Tail.Overlay.Thread->ThreadsProcess);
}
+/*
+ * @implemented
+ */
+ULONG
+STDCALL
+IoGetRequestorProcessId(IN PIRP Irp)
+{
+ return (ULONG)(IoGetRequestorProcess(Irp)->UniqueProcessId);
+}
+/*
+ * @implemented
+ */
+NTSTATUS
+STDCALL
+IoGetRequestorSessionId(IN PIRP Irp,
+ OUT PULONG pSessionId)
+{
+ *pSessionId = IoGetRequestorProcess(Irp)->SessionId;
+
+ return STATUS_SUCCESS;
+}
+
/**********************************************************************
* NAME EXPORTED
* IoSetThreadHardErrorMode@4
@@ -84,14 +106,15 @@
*
* @implemented
*/
-BOOLEAN STDCALL
+BOOLEAN
+STDCALL
IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled)
{
- BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled);
+ BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled);
- NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ?
FALSE : TRUE);
+ NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ?
FALSE : TRUE);
- return((TRUE == PreviousHEM) ? FALSE : TRUE);
+ return((TRUE == PreviousHEM) ? FALSE : TRUE);
}
/* EOF */