Author: tkreuzer
Date: Mon Aug 16 20:18:25 2010
New Revision: 48557
URL:
http://svn.reactos.org/svn/reactos?rev=48557&view=rev
Log:
[NTOSKRNL]
- Fixed IoGetRequestorProcess, IoGetRequestorProcessId, IoGetRequestorSessionId
- Pass user buffer in NtNotifyChangeDirectoryFile
- Fixed magic value in IoGetPagingIoPriority
Patch by Pierre Schweitzer
Modified:
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/xdk/iotypes.h
trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
trunk/reactos/ntoskrnl/io/iomgr/irp.c
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=4855…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Mon Aug 16 20:18:25 2010
@@ -5456,6 +5456,8 @@
#define IRP_DEFER_IO_COMPLETION 0x00000800
#define IRP_OB_QUERY_NAME 0x00001000
#define IRP_HOLD_DEVICE_QUEUE 0x00002000
+#define IRP_RETRY_IO_COMPLETION 0x00004000
+#define IRP_CLASS_CACHE_OPERATION 0x00008000
#define IRP_QUOTA_CHARGED 0x01
#define IRP_ALLOCATED_MUST_SUCCEED 0x02
Modified: trunk/reactos/include/xdk/iotypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/iotypes.h?rev=…
==============================================================================
--- trunk/reactos/include/xdk/iotypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/iotypes.h [iso-8859-1] Mon Aug 16 20:18:25 2010
@@ -1793,6 +1793,9 @@
#define IRP_DEFER_IO_COMPLETION 0x00000800
#define IRP_OB_QUERY_NAME 0x00001000
#define IRP_HOLD_DEVICE_QUEUE 0x00002000
+/* The following 2 are missing in latest WDK */
+#define IRP_RETRY_IO_COMPLETION 0x00004000
+#define IRP_CLASS_CACHE_OPERATION 0x00008000
#define IRP_QUOTA_CHARGED 0x01
#define IRP_ALLOCATED_MUST_SUCCEED 0x02
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] Mon Aug 16 20:18:25 2010
@@ -1175,6 +1175,7 @@
Irp->RequestorMode = PreviousMode;
Irp->UserIosb = IoStatusBlock;
Irp->UserEvent = Event;
+ Irp->UserBuffer = Buffer;
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
Irp->Tail.Overlay.OriginalFileObject = FileObject;
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Mon Aug 16 20:18:25 2010
@@ -1415,7 +1415,6 @@
else
{
/* The IRP just got canceled... does a thread still own it? */
- Thread = Irp->Tail.Overlay.Thread;
if (Thread)
{
/* Yes! There is still hope! Initialize the APC */
@@ -1576,7 +1575,7 @@
Flags = Irp->Flags;
/* Check what priority it has */
- if (Flags & 0x8000) // FIXME: Undocumented flag
+ if (Flags & IRP_CLASS_CACHE_OPERATION)
{
/* High priority */
Priority = IoPagingPriorityHigh;
@@ -1604,7 +1603,12 @@
IoGetRequestorProcess(IN PIRP Irp)
{
/* Return the requestor process */
- return Irp->Tail.Overlay.Thread->ThreadsProcess;
+ if (Irp->Tail.Overlay.Thread)
+ {
+ return Irp->Tail.Overlay.Thread->ThreadsProcess;
+ }
+
+ return NULL;
}
/*
@@ -1614,8 +1618,15 @@
NTAPI
IoGetRequestorProcessId(IN PIRP Irp)
{
+ PEPROCESS Process;
+
/* Return the requestor process' id */
- return PtrToUlong(IoGetRequestorProcess(Irp)->UniqueProcessId);
+ if ((Process = IoGetRequestorProcess(Irp)))
+ {
+ return PtrToUlong(Process->UniqueProcessId);
+ }
+
+ return 0;
}
/*
@@ -1626,9 +1637,17 @@
IoGetRequestorSessionId(IN PIRP Irp,
OUT PULONG pSessionId)
{
+ PEPROCESS Process;
+
/* Return the session */
- *pSessionId = IoGetRequestorProcess(Irp)->Session;
- return STATUS_SUCCESS;
+ if ((Process = IoGetRequestorProcess(Irp)))
+ {
+ *pSessionId = Process->Session;
+ return STATUS_SUCCESS;
+ }
+
+ *pSessionId = (ULONG)-1;
+ return STATUS_UNSUCCESSFUL;
}
/*