This chapter describes the user-mode functions that initiate the Kernel PlugIn operations and activate its callbacks. For a description of the high-level WDC user-mode Kernel PlugIn APIs, which can be used instead of the low-level APIs described in this chapter, and for a description of the Kernel PlugIn structures and kernel-mode APIs, refer to the WinDriver PCI Manual.
Obtain a valid handle to the Kernel PlugIn.
DWORD WD_KernelPlugInOpen(
HANDLE hWD,
WD_KERNEL_PLUGIN *pKernelPlugIn);
| Name | Type | Input/Output |
|---|---|---|
| hWD | HANDLE | Output |
| pKernelPlugIn | WD_KERNEL_PLUGIN* | |
| • hKernelPlugIn | DWORD | Output |
| • pcDriverName | PCHAR | Input |
| • pcDriverPath | PCHAR | Input |
| • pOpenData | PVOID | Input |
| Name | Description |
|---|---|
| hWD | Handle to WinDriver |
| pKernelPlugIn | Pointer to Kernel PlugIn information structure: |
| • hKernelPlugIn | Returns the handle to the Kernel PlugIn |
| • pcDriverName | Name of Kernel PlugIn to load, up to 8 characters |
| • pcDriverPath |
This field should be set to NULL. WinDriver will search for the driver in
the operating system's drivers/modules directory.
|
| • pOpenData |
Pointer to data that will be passed to the KP_Open callback
in the Kernel PlugIn
|
Returns WD_STATUS_SUCCESS (0) on success, or an appropriate
error code otherwise
WD_KERNEL_PLUGIN kernelPlugIn;
BZERO(kernelPlugIn);
/* Tells WinDriver which driver to open */
kernelPlugIn.pcDriverName = "KPDriver";
HANDLE hWD = WD_Open(); /* Validate handle here */
dwStatus = WD_KernelPlugInOpen(hWD, &kernelPlugIn);
if (dwStatus)
{
printf ("Failed opening a handle to the Kernel PlugIn. Error: 0x%x (%s)\n",
dwStatus, Stat2Str(dwStatus));
}
else
{
printf("Opened a handle to the Kernel PlugIn (0x%x)\n",
kernelPlugIn.hKernelPlugIn);
}