next up previous contents
Next: 6.2 WD_KernelPlugInClose() Up: 6. Kernel PlugIn User-Mode Previous: 6. Kernel PlugIn User-Mode   Contents


6.1 WD_KernelPlugInOpen()


PURPOSE

$\bullet$Obtain a valid handle to the Kernel PlugIn.


PROTOTYPE

DWORD WD_KernelPlugInOpen(
    HANDLE hWD,
    WD_KERNEL_PLUGIN *pKernelPlugIn);


PARAMETERS

Name Type Input/Output
$\bullet$hWD HANDLE Output
$\bullet$pKernelPlugIn WD_KERNEL_PLUGIN*  
$\gg$hKernelPlugIn DWORD Output
$\gg$pcDriverName PCHAR Input
$\gg$pcDriverPath PCHAR Input
$\gg$pOpenData PVOID Input


DESCRIPTION

Name Description
hWD Handle to WinDriver
pKernelPlugIn Pointer to Kernel PlugIn information structure:
$\bullet$ hKernelPlugIn Returns the handle to the Kernel PlugIn
$\bullet$ pcDriverName Name of Kernel PlugIn to load, up to 8 characters
$\bullet$ pcDriverPath This field should be set to NULL. WinDriver will search for the driver in the operating system's drivers/modules directory.
$\bullet$ pOpenData Pointer to data that will be passed to the KP_Open() callback in the Kernel PlugIn


RETURN VALUE

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


EXAMPLE

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);
}