DLL Interface

DeltaMAXDecode

Applies a patch that was created with the DeltaMAXEncode function.

Syntax

int DeltaMAXDecode( LPCTSTR szSource

                  , LPCTSTR szTarget

                  , LPCTSTR szDiff

                  , DELTAMAX_DECODE_OPTIONS* pOptions );

Parameters

szSource

The path and filename of the source file, i.e. the "old" file that the patch is intended to update.

szTarget

The path and filename of the target file, i.e. the "new" file that the patch will create. After a successful decoding operation this file will be an exact duplicate of the original target file that was provided to the DeltaMAXEncode function.

Note: The source and target paths must point to different files.

szDiff

The path and filename of the diff file, i.e. the patch data itself, that was previously created using the DeltaMAXEncode function.

This file will be used to recreate the desired target file from the specified source file.

pOptions

A pointer to a valid DELTAMAX_DECODE_OPTIONS structure containing the settings for this decode operation.

Returns

Returns an integer value indicating success or failure of the decode operation. (0 indicates success, all other values correspond to a DeltaMAX error code.) See Error Codes for a list of possible error codes and their meanings.

Remarks

This function uses an encoded differences file (.diff) to recreate a specific target file from the data in a source file. In other words, it uses a previously generated .diff file to recreate a new file based upon a copy of the original source file.

The resulting target file is equivalent to applying the encoded differences to the source file. Note however that the changes are not applied directly to the source file. In order to ensure source file integrity during the decode operation, an entirely new file is created. You may want to replace the original source file with the target file once the decoding operation is complete.

The source file must be an exact duplicate of the original source file that was used to generate the diff. The decode operation will fail if the specified source file was modified in any way.

You can receive progress information during the operation by defining OnProgress and/or OnMessage callback functions.

Memory Needs

Memory usage generally isn't a concern for decoding. Although providing more memory will improve the speed of the operation, the engine can operate well in a low memory environment. However, it does benefit from having more memory for file buffering, especially when operating on large files.

Optimal Settings

For the best performance when applying patches, use the default values for all settings.

See Also: DELTAMAX_DECODE_OPTIONS, DeltaMAXEncode