https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dabe7fba461a3d1a48932…
commit dabe7fba461a3d1a48932004ac529d6609d94b38
Author: Justin Miller <justin.miller(a)reactos.org>
AuthorDate: Fri Jul 14 16:17:27 2023 -0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Jul 14 16:17:27 2023 -0700
[NTOS:IO] Implement IoConnectInterruptEx for fully specified interrupt types (#5416)
Implement IoConnectInterruptEx() for CONNECT_FULLY_SPECIFIED.
This gives ability to load various modern drivers that use IoConnectInterruptEx.
Various drivers work after this change, such as serial.sys MS sample driver when
compiled with the reactos tree and many more KMDF drivers from later Windows versions.
Co-authored-by: Victor Perevertkin <victor(a)perevertkin.ru>
---
ntoskrnl/io/iomgr/irq.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
ntoskrnl/ntoskrnl.spec | 2 ++
2 files changed, 60 insertions(+)
diff --git a/ntoskrnl/io/iomgr/irq.c b/ntoskrnl/io/iomgr/irq.c
index a604be1d604..f82d58d44c1 100644
--- a/ntoskrnl/io/iomgr/irq.c
+++ b/ntoskrnl/io/iomgr/irq.c
@@ -166,4 +166,62 @@ IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
ExFreePool(IoInterrupt); // ExFreePoolWithTag(IoInterrupt, TAG_KINTERRUPT);
}
+NTSTATUS
+IopConnectInterruptExFullySpecific(
+ _Inout_ PIO_CONNECT_INTERRUPT_PARAMETERS Parameters)
+{
+ NTSTATUS Status;
+ PAGED_CODE();
+
+ /* Fallback to standard IoConnectInterrupt */
+ Status = IoConnectInterrupt(Parameters->FullySpecified.InterruptObject,
+ Parameters->FullySpecified.ServiceRoutine,
+ Parameters->FullySpecified.ServiceContext,
+ Parameters->FullySpecified.SpinLock,
+ Parameters->FullySpecified.Vector,
+ Parameters->FullySpecified.Irql,
+ Parameters->FullySpecified.SynchronizeIrql,
+ Parameters->FullySpecified.InterruptMode,
+ Parameters->FullySpecified.ShareVector,
+ Parameters->FullySpecified.ProcessorEnableMask,
+ Parameters->FullySpecified.FloatingSave);
+ DPRINT("IopConnectInterruptEx_FullySpecific: has failed with status %X",
Status);
+ return Status;
+}
+
+NTSTATUS
+NTAPI
+IoConnectInterruptEx(
+ _Inout_ PIO_CONNECT_INTERRUPT_PARAMETERS Parameters)
+{
+ PAGED_CODE();
+ switch (Parameters->Version)
+ {
+ case CONNECT_FULLY_SPECIFIED:
+ return IopConnectInterruptExFullySpecific(Parameters);
+ case CONNECT_FULLY_SPECIFIED_GROUP:
+ //TODO: We don't do anything for the group type
+ return IopConnectInterruptExFullySpecific(Parameters);
+ case CONNECT_MESSAGE_BASED:
+ DPRINT1("FIXME: Message based interrupts are UNIMPLEMENTED\n");
+ break;
+ case CONNECT_LINE_BASED:
+ DPRINT1("FIXME: Line based interrupts are UNIMPLEMENTED\n");
+ break;
+ }
+ return STATUS_SUCCESS;
+}
+
+VOID
+NTAPI
+IoDisconnectInterruptEx(
+ _In_ PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters)
+{
+ PAGED_CODE();
+
+ //FIXME: This eventually will need to handle more cases
+ if (Parameters->ConnectionContext.InterruptObject)
+ IoDisconnectInterrupt(Parameters->ConnectionContext.InterruptObject);
+}
+
/* EOF */
diff --git a/ntoskrnl/ntoskrnl.spec b/ntoskrnl/ntoskrnl.spec
index ced05f9a8bd..fe90fb7fdfd 100644
--- a/ntoskrnl/ntoskrnl.spec
+++ b/ntoskrnl/ntoskrnl.spec
@@ -362,6 +362,7 @@
@ stdcall IoCheckShareAccess(long long ptr ptr long)
@ stdcall IoCompleteRequest(ptr long)
@ stdcall IoConnectInterrupt(ptr ptr ptr ptr long long long long long long long)
+@ stdcall -version=0x600+ IoConnectInterruptEx(ptr)
@ stdcall IoCreateController(long)
@ stdcall IoCreateDevice(ptr long ptr long long long ptr)
@ stdcall IoCreateDisk(ptr ptr)
@@ -390,6 +391,7 @@
@ extern IoDeviceHandlerObjectType
@ extern IoDeviceObjectType
@ stdcall IoDisconnectInterrupt(ptr)
+@ stdcall -version=0x600+ IoDisconnectInterruptEx(ptr)
@ extern IoDriverObjectType
@ stdcall IoEnqueueIrp(ptr)
@ stdcall IoEnumerateDeviceObjectList(ptr ptr long ptr)