6.3.WD_KernelPlugInCall()

Purpose

Calls a routine in the Kernel PlugIn to be executed.

Prototype
DWORD WD_KernelPlugInCall(
    HANDLE hWD,
    WD_KERNEL_PLUGIN_CALL *pKernelPlugInCall);
Parameters
NameTypeInput/Output
hWDHANDLE Input
pKernelPlugInCallWD_KERNEL_PLUGIN_CALL*Input
hKernelPlugInDWORDInput
dwMessageDWORDInput
pDataPVOIDInput/Output
dwResultDWORDOutput
Description
NameDescription
hWD Handle to WinDriver
pKernelPlugInCallPointer to a Kernel PlugIn message structure:
hKernelPlugIn Handle to the Kernel PlugIn
dwMessage Message ID to pass to the KP_Call callback
pData Pointer to data to pass between the Kernel PlugIn driver and the user-mode application, via the KP_Call callback
dwResult Value set by KP_Call callback
Return Value

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

Remarks

Calling the WD_KernelPlugInCall() function[6.3] in the user mode will call your KP_Call callback function in the kernel. The KP_Call Kernel PlugIn function will determine what routine to execute according to the message passed to it in the WD_KERNEL_PLUGIN_CALL structure.

Example
WD_KERNEL_PLUGIN_CALL kpCall;

BZERO (kpCall);
/* Prepare the kpCall structure from WD_KernelPlugInOpen(): */
kpCall.hKernelPlugIn = hKernelPlugIn;
/* Set the message to pass to KP_Call. This will determine
   the action performed in the kernel: */
kpCall.dwMessage = MY_DRV_MSG;

kpCall.pData = &mydrv; /* The data to pass to the Kernel PlugIn */
dwStatus = WD_KernelPlugInCall(hWD, &kpCall);
if (dwStatus == WD_STATUS_SUCCESS)
{
    printf("Result = 0x%x\n", kpCall.dwResult);
}
else
{
    printf("WD_KernelPlugInCall() failed. Error: 0x%x (%s)\n",
            dwStatus, Stat2Str(dwStatus));
}