LIBDF Functions: dfApplyN, dfApplyH

Summary

 

Functions dfApplyN and dfApplyH are used to apply a df-file, i.e. to restore a new file having an existing old file and df-file.

 

Syntax

 

int dfApplyN (

 

TDfHandle

hDf,

_TCHAR const *

szOldFileName,

_TCHAR const *

szNewFileName

int

iApplyFlags,

TDfInteract *

pInteract );

 

int dfApplyH (

 

TDfHandle

hDf,

FD_T

hOldFile,

FD_T

hNewFile,

int

iApplyFlags,

TDfInteract *

pInteract );

 

Arguments

 

hDf

[Input]

Special df-file descriptor, created by dfOpenDfFile function.

 

szOldFileName

[Input]

Name of an old file.

May be skipped if an old file was skipped when creating df-file. (Field nOldFileSize of TDfCmp structure is equal to "-1").

 

szNewFileName

[Input]

Name of a new file.

Can be NULL value or empty string for verification purpose.

 

iApplyFlags

[Input]

Flags which define the procedure of df-file applying.

Possible values are: "0" or free combination of the following flags:

 

DFAF_DONT_CHG_DATETIME

Do not change last modification date/time of the new file.

If new file already exists then its last modification date/time is not changed.

Otherwise an old file's last modification date/time is taken.

DFAF_DONT_CHG_ATTR

Same as for DFAF_DONT_CHG_DATETIME, but for the value of new file's attributes.

DFAF_DONT_CHG_CONTENT

Same as for DFAF_DONT_CHG_DATETIME, but for the new file content.

DFAF_DEL_OLD_FILE

This flag prescribes to delete an old file after df-file applying in case of old and new files are not identical.

Valid only within dfApplyN function.

 

Default value: "0".

 

pInteract

[Input]

Pointer on the structure of interaction with application program (see description of the structure TDfInteract).

May be NULL.

 

hOldFile

[Input]

Old file descriptor.

Can be INVALID_FD_VALUE value, if old file was skipped when creating df-file. (Field nOldFileSize of TDfCmp structure is equal to "-1").

 

hNewFile

[Input]

New file descriptor.

Can be INVALID_FD_VALUE value or empty string for verification purpose.

 

 

Return Values

 

If the function succeeds, the return value is zero (EDF_SUCCESS).

 

If the function fails, the return value is one of the following:

EDF_BAD_PARAM

EDF_OUT_OF_MEMORY

EDF_FATAL

EDF_SYSERROR

EDF_READ_ERROR

EDF_WRITE_ERROR

EDF_ABORTED

EDF_TMP_CREATE_ERROR

EDF_DF_UNSUPP_COMPRESSOR

EDF_ALREADY_PATCHED

EDF_OLD_SIZE_UNEXPECTED

EDF_OLD_MD5_ERROR

EDF_NEW_MD5_ERROR

EDF_REPLACE_ERROR

 

Remarks

 

szOldFileName and szNewFileName may point on the same file. Then in case of successful df-file applying an old file is replaced by a new one.

 

hOldFile รจ hNewFile must represent different files when updating file.

 

At the moment of df-file applying a new file may already exist. Its replacement is implemented only after ensuring that new file restoration completed successfully (restoration is performed to a temporary file which then replaces the already existing one). That is why you can you can ensure that in case of any error the existing file will not be changed.

An moreover if the restored file replaces the already existing file and the existing file is on NTFS volume, then an attempt to pass the access permissions from the existing file to the restored one will me made.

It is necessary to mark that replacement of the already existing file is implemented only in case of file content updating.

 

These functions can determine the situation when an attempt to update the already patched file is made (in case of file content updating). Such situation can occur if you try to update the already updated file. In this case the function returns EDF_ALREADY_PATCHED error code.

 

See also

dfCloseDfFile, dfGetDfInfo, dfApplyN, dfApplyH

 

Converted from CHM to HTML with chm2web Standard 2.75 (unicode)