5.9. WD_License()

Purpose

Transfers the license string to the WinDriver kernel module and returns information regarding the license type of the specified license string.

[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
• dwLicenseDWORDOutput
• dwLicense2DWORDOutput
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. If an empty string is transferred, then WinDriver kernel module returns the current license type to the parameter dwLicense.
• dwLicense Returns the license type of the specified license string (cLicnese). The return value is a bit-mask of license flags, defined as an enum in windrvr.h. Zero signifies an invalid license string. Additional flags for determining the license type are returned in dwLicense2, if needed.
• dwLicense2 Returns additional flags for determining the license type, if dwLicense cannot hold all the relevant information (otherwise — zero)
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:

DWORD RegisterWinDriver()
{
    HANDLE hWD;
    WD_LICENSE lic;
    DWORD dwStatus = WD_INVALID_HANDLE;

    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);
        WD_Close(hWD);
    }

    return dwStatus;
}