InitActivePatch

The InitActivePatch function initializes the ActivePatch library.

BOOL InitActivePatch(
LPCTSTR lpszLicenseKey, // runtime license key
DWORD dwReserved // reserved
);

Parameters

lpszLicenseKey
[in] A pointer to a null-terminated string which specifies the runtime license key. The macro APATCH_LICENSE_KEY should be used to specify this value. For a registered developer, this will evaluate to the runtime license key for the product. If an evaluation copy of the product has been installed, this value will be NULL or an empty string.
dwReserved
[in] Reserved; must be zero.

Return Values

If the function succeeds, the return value is non-zero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Before creating or applying individual patch files or packages, the InitActivePatch function must be called to initialize the library. If an evaluation version of the product is being used, the license key will be defined as NULL or an empty string. In this case, the library will only function on the development system that the evaluation was installed on. Attempts to redistribute any product built using ActivePatch will result in an error.

There are two licensing related errors which may be returned by the ActivePatch functions. To obtain these error codes, use the GetLastError function. The error codes are:

AP_ERROR_INVALID_LICENSE
This error is returned when an invalid license key is passed to the initialization function, or if a NULL key is used and the local system does not have a licensed copy of ActivePatch installed. To redistribute an application built using ActivePatch, a licensed copy of the product must be purchased and registered.
 
AP_ERROR_PRODUCT_NOT_LICENSED
This error is returned when an ActivePatch function has been called, but the library has not been initialized with a license key, or the the initialization has failed. Make sure that the application checks the return value from the InitActivePatch function. If the return value is zero, subsequent function calls will fail with this error.

The license key is defined in the header file apkeys.h and created during product installation.

Requirements

Windows NT/2000/XP: Requires Windows NT 4.0 SP3 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Include apatch.h.
Library: Use apatch32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

ApplyPackage, ApplyPatchFile, CreatePackage, CreatePatchFile