From 5b309642c101ce36019023aea84fdb6c0d82fc6c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 Sep 2014 17:29:07 +0200
Subject: ntoskrnl: Handle issues when driver returns two different status
 codes from dispatcher.

---
 dlls/ntoskrnl.exe/ntoskrnl.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 17a0d39..73e12b9 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -195,6 +195,19 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff,
         DPRINTF( "%04x:Ret  driver dispatch %p (device=%p,irp=%p) retval=%08x\n",
                  GetCurrentThreadId(), dispatch, device, &irp, status );
 
+    /* Ensure returned status code is consistent */
+    if (status == STATUS_PENDING)
+    {
+        FIXME( "driver returned status=STATUS_PENDING, irp.IoStatus.u.Status=%08x\n",
+               irp.IoStatus.u.Status );
+    }
+    else if (irp.IoStatus.u.Status != status)
+    {
+        FIXME( "driver returned status=%08x != irp.IoStatus.u.Status=%08x\n",
+               status, irp.IoStatus.u.Status );
+        irp.IoStatus.u.Status = status;
+    }
+
     *out_size = (irp.IoStatus.u.Status >= 0) ? irp.IoStatus.Information : 0;
     if ((code & 3) == METHOD_BUFFERED)
     {
-- 
2.1.1

