// Program name: cftypes.h // Programmed by: Anthony Barbachan // Programmed in: C++ (Turbo C++ 3.0 Compatable) // Purpose: Header file for cabinet file types and constants. // Version: 1.00 // Last modified on: 11/5/1998 // Version: 1.01 // Last modified on: 12/4/1998 // Changes: Added functions to CabinetErrno to interpit to error as a string. // Version: 1.02 // Last modified on: 12/12/1998 // Changes: Moved definition of pathseparator to this header file. // Last modified on: 12/31/1998 // Changes: Added more error codes. #ifndef __CFTYPES_H__ #define __CFTYPES_H__ #include using std::istream; using std::ostream; typedef unsigned char byte; typedef unsigned short int word; typedef unsigned long int dword; enum Error { OK = 0, // Operation completed CLOSED_CABINET = -1, // Operation on a closed cabinet object NO_MEMORY = -2, // Failed because we are out of memory READ_ERROR = -3, // Error encountered during a read WRITE_ERROR = -4, // Error encountered during a write INVALID_DATA = -5, // Data either invalid or in bad format UNABLE_TO_OPEN = -6, // Unable to open a file stream INVALID_HEADER = -7, // If this cabinet's header is currupt INVALID_FOLDERNO = -8, // Invalid folder number SEEK_ERROR = -9, // A seek operation has failed MISSING_FILE = -11, // Expected file not found in blocks CHECKSUM_ERROR = -12, // A checksum error has been encountered UNSUPPORTED_COMPRESSION = -13,// An unsupported compression method choosen DECOMPRESSION_ERROR = -14, // An error has occured during decompression UNEXPECTED_EOF = -15, // An unexpected EOF was encountered NO_FOLDERS = -16, // Cabinet is lacking any folder entries FILE_NOT_FOUND = -17, // Requested file was not found NO_FILENAME = -18, // No filename specified GETCWD_FAILURE = -19, // The getcwd function call failed OUT_OF_MEMORY = -20, // An allocation operation has run out of memory CHDIR_FAILURE = -21, // A chdir operation failed MKDIR_FAILURE = -22, // A mkdir operation failed ACCESS_DENIED = -23, // Access was denied SETTIME_FAILURE = -24, // Operation failed to restore the date or time SETATTRIB_FAILURE = -25, // Operation failed to restore the attributes OPEN_TEMP_FAILURE = -26, // Unable to open temporary file stream FOLDER_CREATOR_FROZEN = -27, // An attempt was made to add a file to a frozen folder creator FOLDER_LIMIT_REACHED = -28, // No more folders can be added to this cabinet FILE_LIMIT_REACHED = -29, // No more files can be added to this folder NO_FOLDER = -30, // No folder exists FILE_OPEN_FAILURE = -31, // Unable to open a file FILE_CLOSE_FAILURE = -32,// Unable to close a file COMPRESSOR_OUT_OF_MEMORY = -33, // The compressor ran out of memory COMPRESSOR_BUF_TO_SMALL = -34,// To small of a buffer was passed to the compressor COMPRESSOR_UNKNOWN_ERROR = -35, // An unknown compressor error has occured FSTAT_FAILURE = -36, // A call to fstat failed GETATTRIB_FAILURE = -37, // Failed to retreive file attributes GETTIME_FAILURE = -38, // The call to retrieve the file's date/time failed NO_DBLOCKS = -39, // No datablocks in the folder NOT_IN_FOLDER = -40, // The data does not start within the folder DOES_NOT_END = -41, // The data does not end within the folder OPEN_ERROR = -42, // Open file error MUST_INIT = -43, // Decompression requires init COMPRESSOR_Z_OK = -50, // zlib error codes COMPRESSOR_Z_STREAM_END = -51, COMPRESSOR_Z_NEED_DICT = -52, COMPRESSOR_Z_ERRNO = -53, COMPRESSOR_Z_STREAM_ERROR = -54, COMPRESSOR_Z_DATA_ERROR = -55, COMPRESSOR_Z_MEM_ERROR = -56, COMPRESSOR_Z_BUF_ERROR = -57, COMPRESSOR_Z_VERSION_ERROR = -58, COMPRESSOR_Z_UNKNOWN_ERROR = -59, UNKNOWN_ERROR = -255 // An unknown error has occured }; #ifdef unix const char pathseparator = '/'; #else const char pathseparator = '\\'; #endif int convert_z_error_code(int code); const char* get_cabinet_error_string(int err); int io_read(istream& in, byte* buf, word len); int io_write(ostream& out, const byte* buf, word len); #endif