6.4. WD_IntEnable()

Purpose

Enables interrupt handling in the Kernel PlugIn.

Prototype
DWORD WD_IntEnable(HANDLE hWD, WD_INTERRUPT *pInterrupt);
Parameters
NameTypeInput/Output
hWDHANDLEInput
pInterruptWD_INTERRUPT* 
• kpCallWD_KERNEL_PLUGIN_CALL 
 * hKernelPlugInHANDLEInput
 * dwMessageDWORDN/A
 * pDataPVOIDInput
 * dwResultDWORDN/A
Description
NameDescription
hWD Handle to WinDriver
pInterrupt Pointer to an interrupt information structure:
• kpCall Kernel PlugIn message structure:
 * hKernelPlugIn Handle to the Kernel PlugIn. If zero, no Kernel PlugIn interrupt handler is installed
 * pData Pointer to data to pass to the KP_IntEnable callback in the Kernel PlugIn
Return Value

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [A].

Remarks
  • If a valid handle to a Kernel PlugIn is passed to this function, the interrupts will be handled in the Kernel PlugIn. In such a case, the KP_IntEnable callback will execute as a result of the call to WD_IntEnable(), and upon receiving the interrupt your kernel-mode high-IRQL interrupt handler function — KP_IntAtIrql (legacy interrupts) or KP_IntAtIrqlMSI (MSI/MSI-X) — will execute. If this function returns a value greater than zero, your Deferred Procedure Call (DPC) handler — KP_IntAtDpc (legacy interrupts) or KP_IntAtDpcMSI (MSI/MSI-X) — will be called.
  • For information regarding the additional pInterrupt fields, refer to the description of the pInterrupt parameter of the WD_IntEnable() function in Section 3.2.

Example
WD_INTERRUPT Intrp;
BZERO(Intrp);
Intrp.hInterrupt = hInterrupt; /* From WD_CardRegister() */
/* From WD_KernelPlugInOpen(): */
Intrp.kpCall.hKernelPlugIn = hKernelPlugIn;

WD_IntEnable(hWD, &Intrp);

if (!Intrp.fEnableOk)
    printf ("failed enabling interrupt\n");