From: Timo Kreuzer Date: Mon, 16 Aug 2010 20:18:25 +0000 (+0000) Subject: [NTOSKRNL] X-Git-Tag: ReactOS-0.3.12~171 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=2ded5adf7ce90b5febcc72c1cdafc419035bb1fe [NTOSKRNL] - Fixed IoGetRequestorProcess, IoGetRequestorProcessId, IoGetRequestorSessionId - Pass user buffer in NtNotifyChangeDirectoryFile - Fixed magic value in IoGetPagingIoPriority Patch by Pierre Schweitzer svn path=/trunk/; revision=48557 --- diff --git a/reactos/include/ddk/wdm.h b/reactos/include/ddk/wdm.h index b1475afb4d0..daffb9b1fd5 100644 --- a/reactos/include/ddk/wdm.h +++ b/reactos/include/ddk/wdm.h @@ -5456,6 +5456,8 @@ typedef struct _IO_COMPLETION_CONTEXT { #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 diff --git a/reactos/include/xdk/iotypes.h b/reactos/include/xdk/iotypes.h index 55673244e1a..9e1446c2245 100644 --- a/reactos/include/xdk/iotypes.h +++ b/reactos/include/xdk/iotypes.h @@ -1793,6 +1793,9 @@ $if (_WDMDDK_) #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 diff --git a/reactos/ntoskrnl/io/iomgr/iofunc.c b/reactos/ntoskrnl/io/iomgr/iofunc.c index c40e7c9d789..6a3bfbc2862 100644 --- a/reactos/ntoskrnl/io/iomgr/iofunc.c +++ b/reactos/ntoskrnl/io/iomgr/iofunc.c @@ -1175,6 +1175,7 @@ NtNotifyChangeDirectoryFile(IN HANDLE FileHandle, 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; diff --git a/reactos/ntoskrnl/io/iomgr/irp.c b/reactos/ntoskrnl/io/iomgr/irp.c index a578e89731a..53649f1de70 100644 --- a/reactos/ntoskrnl/io/iomgr/irp.c +++ b/reactos/ntoskrnl/io/iomgr/irp.c @@ -1415,7 +1415,6 @@ IofCompleteRequest(IN PIRP Irp, 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 @@ IoGetPagingIoPriority(IN PIRP Irp) 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 @@ NTAPI 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 @@ ULONG 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 @@ NTAPI 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; } /*