📄 ztvuncabtypes.pas
字号:
Unit ztvUnCabTypes;
Interface
Uses
Windows, ztvCabGbls;
Type
TFDIERROR = (
(* Description: No error *)
(* Cause: Function was successfull. *)
(* Response: Keep going! *)
FDIERROR_NONE,
(* Description: Cabinet not found *)
(* Cause: Bad file name or path passed to *)
(* FDICopy(), or returned to *)
(* fdintNEXT_CABINET. *)
(* Response: To prevent this error, validate the *)
(* existence of the the cabinet 'before' *)
(* passing the path to FDI. *)
FDIERROR_CABINET_NOT_FOUND,
(* Description: Cabinet file does not have the correct format *)
(* Cause: File passed to to FDICopy(), or returned to *)
(* fdintNEXT_CABINET, is too small to be a cabinet *)
(* file, or does not have the cabinet signature in *)
(* its first four bytes. *)
(* Response: To prevent this error, call FDIIsCabinet() to *)
(* check a cabinet before calling FDICopy() or *)
(* returning the cabinet path to fdintNEXT_CABINET.*)
FDIERROR_NOT_A_CABINET,
(* Description: Cabinet file has an unknown version number. *)
(* Cause: File passed to to FDICopy(), or returned to *)
(* fdintNEXT_CABINET, has what looks like a cabinet *)
(* file header, but the version of the cabinet file*)
(* format is not one understood by this version of*)
(* FDI. The erf.erfType field is filled in with the *)
(* version number found in the cabinet file. *)
(* Response: To prevent this error, call FDIIsCabinet() to *)
(* check a cabinet before calling FDICopy() or *)
(* returning the cabinet path to fdintNEXT_CABINET.*)
FDIERROR_UNKNOWN_CABINET_VERSION,
(* Description: Cabinet file is corrupt
(* Cause: FDI returns this error any time it finds a problem *)
(* with the logical format of a cabinet file, and any *)
(* time one of the passed-in file I/O calls fails when *)
(* operating on a cabinet (PFNOPEN, PFNSEEK, PFNREAD, *)
(* or PFNCLOSE). The client can distinguish these two *)
(* cases based upon whether the last file I/O call *)
(* failed or not. *)
(* Response: Assuming this is not a real corruption problem in *)
(* a cabinet file, the file I/O functions could attempt *)
(* to do retries on failure (for example, if there is a *)
(* temporary network connection problem). If this does *)
(* not work, and the file I/O call has to fail, then the *)
(* FDI client will have to clean up and call the *)
(* FDICopy() function again. *)
FDIERROR_CORRUPT_CABINET,
(* Description: Could not allocate enough memory *)
(* Cause: FDI tried to allocate memory with the PFNALLOC *)
(* function, but it failed. *)
(* Response: If possible, PFNALLOC should take whatever steps *)
(* are possible to allocate the memory requested. If *)
(* memory is not immediately available, it might post a *)
(* dialog asking the user to free memory, for example. *)
(* Note that the bulk of FDI's memory allocations are *)
(* made at FDICreate() time and when the first cabinet *)
(* file is opened during FDICopy(). *)
FDIERROR_ALLOC_FAIL,
(* Description: Unknown compression type in a cabinet folder *)
(* Cause: [Should never happen.] A folder in a cabinet has an *)
(* unknown compression type. This is probably caused by *)
(* a mismatch between the version of FCI.LIB used to *)
(* create the cabinet and the FDI.LIB used to read the *)
(* cabinet. *)
(* Response: Abort. *)
FDIERROR_BAD_COMPR_TYPE,
(* Description: Failure decompressing data from a cabinet file *)
(* Cause: The decompressor found an error in the data coming *)
(* from the file cabinet. The cabinet file was corrupted.*)
(* [11-Apr-1994 bens When checksuming is turned on, this *)
(* error should never occur.] *)
(* Response: Probably should abort; only other choice is to cleanup *)
(* and call FDICopy() again, and hope there was some *)
(* intermittent data error that will not reoccur. *)
FDIERROR_MDI_FAIL,
(* Description: Failure writing to target file *)
(* Cause: FDI returns this error any time it gets an error back *)
(* from one of the passed-in file I/O calls fails when *)
(* writing to a file being extracted from a cabinet. *)
(* Response: To avoid or minimize this error, the file I/O functions*)
(* could attempt to avoid failing. A common cause might *)
(* be disk full -- in this case, the PFNWRITE function *)
(* could have a check for free space, and put up a dialog *)
(* asking the user to free some disk space. *)
FDIERROR_TARGET_FILE,
(* Description: Cabinets in a set do not have the same RESERVE sizes *)
(* Cause: [Should never happen]. FDI requires that the sizes of *)
(* the per-cabinet, per-folder, and per-data block *)
(* RESERVE sections be consistent across all the cabinets *)
(* in a set. *)
(* Response: Abort. *)
FDIERROR_RESERVE_MISMATCH,
(* Description: Cabinet returned on fdintNEXT_CABINET is incorrect *)
(* Cause: NOTE: THIS ERROR IS NEVER RETURNED BY FDICopy()! *)
(* Rather, FDICopy() keeps calling the fdintNEXT_CABINET *)
(* callback until either the correct cabinet is specified,*)
(* or you return ABORT. *)
(* When FDICopy() is extracting a file that crosses a *)
(* cabinet boundary, it calls fdintNEXT_CABINET to ask *)
(* for the path to the next cabinet. Not being very *)
(* trusting, FDI then checks to make sure that the *)
(* correct continuation cabinet was supplied! It does *)
(* this by checking the "setID" and "iCabinet" fields *)
(* in the cabinet. When MAKECAB.EXE creates a set of *)
(* cabinets, it constructs the "setID" using the sum *)
(* of the bytes of all the destination file names in *)
(* the cabinet set. FDI makes sure that the 16-bit *)
(* setID of the continuation cabinet matches the *)
(* cabinet file just processed. FDI then checks that *)
(* the cabinet number (iCabinet) is one more than the *)
(* cabinet number for the cabinet just processed. *)
(* Response: You need code in your fdintNEXT_CABINET (see below) *)
(* handler to do retries if you get recalled with this *)
(* error. See the sample code (EXTRACT.C) to see how *)
(* this should be handled. *)
FDIERROR_WRONG_CABINET,
(* Description: FDI aborted. *)
(* Cause: An FDI callback returnd -1 (usually). *)
(* Response: Up to client. *)
FDIERROR_USER_ABORT
);
(* FDINOTIFICATION - Notification structure for PFNFDINOTIFY
*
* See the FDINOTIFICATIONTYPE definition for information on usage and
* meaning of these fields.
*)
PFDINOTIFICATION = ^TFDINOTIFICATION;
TFDINOTIFICATION = Packed Record
cb: longint; (* uncompressed filesize *)
psz1: PChar; (* next cabinet *)
psz2: PChar; (* next disk *)
psz3: PChar; (* cabinet path *)
pv: PVoid; (* Value for client *)
hf: Integer;
Date: TUUSHORT;
Time: TUUSHORT;
Attribs: TUUSHORT;
setID: TUUSHORT; (* Cabinet set ID *)
iCabinet: TUUSHORT; (* Cabinet number (0-based) *)
iFolder: TUUSHORT; (* Folder number (0-based) *)
fdie: TFDIERROR;
End;
{ fdin, pfdin }
(* FDINOTIFICATIONTYPE - FDICopy notification types
*
* The notification function for FDICopy can be called with the following
* values for the fdint parameter. In all cases, the pfdin->pv field is
* filled in with the value of the pvUser argument passed in to FDICopy().
*
* A typical sequence of calls will be something like this:
* fdintCABINET_INFO // Info about the cabinet
* fdintENUMERATE // Starting enumeration
* fdintPARTIAL_FILE // Only if this is not the first cabinet, and
* // one or more files were continued from the
* // previous cabinet.
* ...
* fdintPARTIAL_FILE
* fdintCOPY_FILE // The first file that starts in this cabinet
* ...
* fdintCOPY_FILE // Now let's assume you want this file...
* // PFNWRITE called multiple times to write to this file.
* fdintCLOSE_FILE_INFO // File done, set date/time/attributes
*
* fdintCOPY_FILE // Now let's assume you want this file...
* // PFNWRITE called multiple times to write to this file.
* fdintNEXT_CABINET // File was continued to next cabinet!
* fdintCABINET_INFO // Info about the new cabinet
* // PFNWRITE called multiple times to write to this file.
* fdintCLOSE_FILE_INFO // File done, set date/time/attributes
* ...
* fdintENUMERATE // Ending enumeration
*
* fdintCABINET_INFO:
* Called exactly once for each cabinet opened by FDICopy(), including
* continuation cabinets opened due to file(s) spanning cabinet
* boundaries. Primarily intended to permit EXTRACT.EXE to
* automatically select the next cabinet in a cabinet sequence even if
* not copying files that span cabinet boundaries.
* Entry:
* pfdin->psz1 = name of next cabinet
* pfdin->psz2 = name of next disk
* pfdin->psz3 = cabinet path name
* pfdin->setID = cabinet set ID (a random 16-bit number)
* pfdin->iCabinet = Cabinet number within cabinet set (0-based)
* Exit-Success:
* Return anything but -1
* Exit-Failure:
* Returns -1 => Abort FDICopy() call
* Notes:
* This call is made *every* time a new cabinet is examined by
* FDICopy(). So if "foo2.cab" is examined because a file is
* continued from "foo1.cab", and then you call FDICopy() again
* on "foo2.cab", you will get *two* fdintCABINET_INFO calls all
* told.
*
* fdintCOPY_FILE:
* Called for each file that *starts* in the current cabinet, giving
* the client the opportunity to request that the file be copied or
* skipped.
* Entry:
* pfdin->psz1 = file name in cabinet
* pfdin->cb = uncompressed size of file
* pfdin->date = file date
* pfdin->time = file time
* pfdin->attribs = file attributes
* pfdin->iFolder = file's folder index
* Exit-Success:
* Return non-zero file handle for destination file; FDI writes
* data to this file use the PFNWRITE function supplied to FDICreate,
* and then calls fdintCLOSE_FILE_INFO to close the file and set
* the date, time, and attributes. NOTE: This file handle returned
* must also be closeable by the PFNCLOSE function supplied to
* FDICreate, since if an error occurs while writing to this handle,
* FDI will use the PFNCLOSE function to close the file so that the
* client may delete it.
* Exit-Failure:
* Returns 0 => Skip file, do not copy
* Returns -1 => Abort FDICopy() call
*
* fdintCLOSE_FILE_INFO:
* Called after all of the data has been written to a target file.
* This function must close the file and set the file date, time,
* and attributes.
* Entry:
* pfdin->psz1 = file name in cabinet
* pfdin->hf = file handle
* pfdin->date = file date
* pfdin->time = file time
* pfdin->attribs = file attributes
* pfdin->iFolder = file's folder index
* pfdin->cb = Run After Extract (0 - don't run, 1 Run)
* Exit-Success:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -