| ActivePatch Developer's Guide - Patch File Functions | ||
|
The ActivePatch library functions are divided into two general groups, those related to creating and applying patch files, and those related to managing patch packages. The first step in either creating or applying a patch file or package is to initialize the library with the InitActivePatch function. |
||
| InitActivePatch | ||
|
The InitActivePatch function is used to initialize the library with the license key that was created when the product was installed and registered. It is only necessary to call this function once, when the application starts. The license key is an array of bytes, terminated with a null byte, which is used to identify a licensed copy of the product. This key value is unique to an individual license, and is passed as the first parameter to the function. The second parameter is a reserved, 32-bit unsigned integer value which must be passed with a value of 0. If the product has been installed with an evaluation license, the key value will either be NULL or an empty string, depending on the programming language used. Failure to call the initialization function before calling other functions in the ActivePatch API will result in a licensing error. The actual key value is stored in a header file with the name bResult = InitActivePatch(APATCH_LICENSE_KEY, 0L);
if (bResult == FALSE)
{
// The initialization has failed. This typically indicates that
// the license key is NULL and the system does not have
// an evaluation license installed.
return;
}
To create and apply patches which update an individual file, there are two basic functions: CreatePatchFile and ApplyPatchFile. |
||
| CreatePatchFile | ||
|
The CreatePatchFile function is used to create a patch file, given the original version and the updated version of a file. A number of options are available when creating the patch, such as specifying the patch level (which determines how much memory the patch creation algorithm uses when analyzing the contents of the files) and the default options to be used when the patch is being applied. |
||
| ApplyPatchFile | ||
|
The ApplyPatchFile function is used to apply a previously created patch file. The original version of the file is then modified by the function and, if successful, it is replaced with the updated version. By default, the function uses those options which have been specified when the patch is created. However, they may be overridden by the application at the time the patch is being applied. For example, the application can specify that a backup copy of the original file should be made, whether or not to ignore differences in the file timestamp or attributes, and whether or not to search for a file that cannot be found in the specified directory. In addition to the functions for creating and applying the patch file, there is also an additional function called GetPatchFileInformation that returns information about a given patch file. |
||
| GetPatchFileInformation | ||
|
The GetPatchFileInformation function returns information about the patch file itself, as well as information about either the original version of the file being patched (called the reference file), or the updated version of the file (called the update file). This information is returned in a PATCH_FILE_INFORMATION structure, which includes specific details about the patch, such as the patch level, default options, compression ratio and expiration period. It will also contain information about the patched file's size, attributes, version, checksum and timestamps. This function is useful when the application needs to provide information about the patch to a user, or make additional checks against the target file that would be updated by the patch. |
||