fix nasty bug:-(
[reactos.git] / reactos / doc / irp cancel boilerplate.c
index 94746a3..d56d3bc 100644 (file)
@@ -38,10 +38,12 @@ QUEUE_BOLIERPLATE
    IoSetCancelRoutine(Irp, CancelRoutine);\r
    if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))\r
    {              \r
-      // IRP has already been cancelled (before we got to queue it),\r
-      // but we got to remove the cancel routine before the canceler could, \r
-      // so complete irp ourself\r
\r
+      /*\r
+      Irp has already been cancelled (before we got to queue it),\r
+      and we got to remove the cancel routine before the canceler could, \r
+      so we cancel/complete the irp ourself.\r
+      */\r
+      \r
       Unlock(theLock);\r
  \r
       Irp->IoStatus.Status = STATUS_CANCELLED;\r
@@ -79,6 +81,10 @@ DEQUEUE_BOILERPLATE
       */\r
  \r
       InitializeListHead(&Irp->Tail.Overlay.ListEntry);\r
+      \r
+      Unlock(theLock);\r
+      \r
+      return;\r
    } \r
  \r
  \r