DriverObject->MajorFunction[Param->MajorFunction]);
if (!DriverObject->MajorFunction[Param->MajorFunction])
- KeBugCheck(0);
+ {
+ if (Param->MajorFunction==IRP_MJ_FLUSH_BUFFERS)
+ {
+ ObDereferenceObject(Param->FileObject);
+ return STATUS_SUCCESS;
+ }
+ KeBugCheck(0);
+ }
return DriverObject->MajorFunction[Param->MajorFunction](DeviceObject, Irp);
}
#endif /* LIBCAPTIVE */
+
+#ifdef LIBCAPTIVE
+/* file-scope of libcaptive/io/irp.c: */
+extern void IofCompleteRequest_register_APC(PIRP Irp,CCHAR PriorityBoost);
+#endif /* LIBCAPTIVE */
+
VOID FASTCALL
IofCompleteRequest(PIRP Irp,
CCHAR PriorityBoost)
if (Irp->PendingReturned)
{
+#ifdef LIBCAPTIVE
+ /* FIXME: Why the hell should we bother with some damned APCs?!?
+ * Call it directly below!
+ */
+ DPRINT("IofCompleteRequest() dispatching APC: using g_idle_add_full()\n");
+ IofCompleteRequest_register_APC(Irp,PriorityBoost);
+#else /* !LIBCAPTIVE */
DPRINT("Dispatching APC\n");
-#ifndef LIBCAPTIVE
KeInitializeApc(&Irp->Tail.Apc,
&Irp->Tail.Overlay.Thread->Tcb,
0,
(PVOID)Irp,
(PVOID)(ULONG)PriorityBoost,
KernelMode);
- DPRINT("Finished dispatching APC\n");
-#else /* !LIBCAPTIVE */
- KeBugCheck(0);
#endif /* !LIBCAPTIVE */
+ DPRINT("Finished dispatching APC\n");
}
else
{
/* Check the FILE_OBJECT's flags first. */
FileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject;
+ if (FileObject == NULL)
+ KeBugCheck(0);
if (!(FO_SYNCHRONOUS_IO & FileObject->Flags))
{
/* Check IRP's flags. */