5.9. WD_License()

Purpose

Transfers the license string to the WinDriver kernel module.

[Note]
When using the high-level WDC library APIs, described in the WinDriver PCI Manual, the license registration is done via the WDC_DriverOpen() function, so you do not need to call WD_License() directly.
Prototype
DWORD WD_License(
    HANDLE hWD,
    WD_LICENSE *pLicense);
Parameters
NameTypeInput/Output
hWDHANDLEInput
pLicenseWD_LICENSE* 
• cLicenseCHAR[]Input
Description
NameDescription
hWDHandle to WinDriver's kernel-mode driver as received from WD_Open() [5.2]
pLicense Pointer to a WinDriver license information structure:
• cLicense A buffer to contain the license string that is to be transferred to the WinDriver kernel module.
Return Value

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

Remarks

When using a registered version, this function must be called before any other WinDriver API call, apart from WD_Open() [5.2], in order to register the license from the code.

Example

Example usage: Add registration routine to your application:

/* Use the returned handle when calling WinDriver API functions */
HANDLE WinDriverOpenAndRegister(void)
{
    HANDLE hWD;
    WD_LICENSE lic;
    DWORD dwStatus;

    hWD = WD_Open();
    if (hWD!=INVALID_HANDLE_VALUE)
    {
        BZERO(lic);
        /* Replace the following string with your license string: */
        strcpy(lic.cLicense, "12345abcde12345.CompanyName");
        dwStatus = WD_License(hWD, &lic);
        if (dwStatus != WD_STATUS_SUCCESS)
        {
             WD_Close(hWD);
             hWD = INVALID_HANDLE_VALUE;
        }
    }
    
    return hWD;
}