⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unzpriv.h

📁 完整的解压zip文件的源码。包含密码功能
💻 H
📖 第 1 页 / 共 5 页
字号:
#define FS_FAT_           0    /* filesystem used by MS-DOS, OS/2, Win32 */#define AMIGA_            1#define VMS_              2#define UNIX_             3#define VM_CMS_           4#define ATARI_            5    /* what if it's a minix filesystem? [cjh] */#define FS_HPFS_          6    /* filesystem used by OS/2 (and NT 3.x) */#define MAC_              7    /* HFS filesystem used by MacOS */#define Z_SYSTEM_         8#define CPM_              9#define TOPS20_           10#define FS_NTFS_          11   /* filesystem used by Windows NT */#define QDOS_             12#define ACORN_            13   /* Archimedes Acorn RISC OS */#define FS_VFAT_          14   /* filesystem used by Windows 95, NT */#define MVS_              15#define BEOS_             16   /* hybrid POSIX/database filesystem */#define TANDEM_           17   /* Tandem/NSK */#define NUM_HOSTS         18   /* index of last system + 1 */#define STORED            0    /* compression methods */#define SHRUNK            1#define REDUCED1          2#define REDUCED2          3#define REDUCED3          4#define REDUCED4          5#define IMPLODED          6#define TOKENIZED         7#define DEFLATED          8#define ENHDEFLATED       9#define DCLIMPLODED      10#define NUM_METHODS      11    /* index of last method + 1 *//* don't forget to update list_files(), extract.c and zipinfo.c appropriately * if NUM_METHODS changes *//* (the PK-class error codes are public and have been moved into unzip.h) */#define DF_MDY            0    /* date format 10/26/91 (USA only) */#define DF_DMY            1    /* date format 26/10/91 (most of the world) */#define DF_YMD            2    /* date format 91/10/26 (a few countries) *//*---------------------------------------------------------------------------    Extra-field block ID values and offset info.  ---------------------------------------------------------------------------*//* extra-field ID values, all little-endian: */#define EF_AV        0x0007    /* PKWARE's authenticity verification */#define EF_OS2       0x0009    /* OS/2 extended attributes */#define EF_PKW32     0x000a    /* PKWARE's Win95/98/WinNT filetimes */#define EF_PKVMS     0x000c    /* PKWARE's VMS */#define EF_PKUNIX    0x000d    /* PKWARE's Unix */#define EF_IZVMS     0x4d49    /* Info-ZIP's VMS ("IM") */#define EF_IZUNIX    0x5855    /* Info-ZIP's old Unix[1] ("UX") */#define EF_IZUNIX2   0x7855    /* Info-ZIP's new Unix[2] ("Ux") */#define EF_TIME      0x5455    /* universal timestamp ("UT") */#define EF_MAC3      0x334d    /* Info-ZIP's new Macintosh (= "M3") */#define EF_JLMAC     0x07c8    /* Johnny Lee's old Macintosh (= 1992) */#define EF_ZIPIT     0x2605    /* Thomas Brown's Macintosh (ZipIt) */#define EF_ZIPIT2    0x2705    /* T. Brown's Mac (ZipIt) v 1.3.8 and newer ? */#define EF_VMCMS     0x4704    /* Info-ZIP's VM/CMS ("\004G") */#define EF_MVS       0x470f    /* Info-ZIP's MVS ("\017G") */#define EF_ACL       0x4c41    /* (OS/2) access control list ("AL") */#define EF_NTSD      0x4453    /* NT security descriptor ("SD") */#define EF_BEOS      0x6542    /* BeOS ("Be") */#define EF_QDOS      0xfb4a    /* SMS/QDOS ("J\373") */#define EF_AOSVS     0x5356    /* AOS/VS ("VS") */#define EF_SPARK     0x4341    /* David Pilling's Acorn/SparkFS ("AC") */#define EF_MD5       0x4b46    /* Fred Kantor's MD5 ("FK") */#define EF_ASIUNIX   0x756e    /* ASi's Unix ("nu") */#define EB_HEADSIZE       4    /* length of extra field block header */#define EB_ID             0    /* offset of block ID in header */#define EB_LEN            2    /* offset of data length field in header */#define EB_UCSIZE_P       0    /* offset of ucsize field in compr. data */#define EB_CMPRHEADLEN    6    /* lenght of compression header */#define EB_UX_MINLEN      8    /* minimal "UX" field contains atime, mtime */#define EB_UX_FULLSIZE    12   /* full "UX" field (atime, mtime, uid, gid) */#define EB_UX_ATIME       0    /* offset of atime in "UX" extra field data */#define EB_UX_MTIME       4    /* offset of mtime in "UX" extra field data */#define EB_UX_UID         8    /* byte offset of UID in "UX" field data */#define EB_UX_GID         10   /* byte offset of GID in "UX" field data */#define EB_UX2_MINLEN     4    /* minimal "Ux" field contains UID/GID */#define EB_UX2_UID        0    /* byte offset of UID in "Ux" field data */#define EB_UX2_GID        2    /* byte offset of GID in "Ux" field data */#define EB_UX2_VALID      (1 << 8)      /* UID/GID present */#define EB_UT_MINLEN      1    /* minimal UT field contains Flags byte */#define EB_UT_FLAGS       0    /* byte offset of Flags field */#define EB_UT_TIME1       1    /* byte offset of 1st time value */#define EB_UT_FL_MTIME    (1 << 0)      /* mtime present */#define EB_UT_FL_ATIME    (1 << 1)      /* atime present */#define EB_UT_FL_CTIME    (1 << 2)      /* ctime present */#define EB_FLGS_OFFS      4    /* offset of flags area in generic compressed                                  extra field blocks (OS2, NT, and others) */#define EB_OS2_HLEN       4    /* size of OS2/ACL compressed data header */#define EB_BEOS_HLEN      5    /* length of BeOS e.f attribute header */#define EB_BE_FL_UNCMPR   0x01 /* "BeOS attributes uncompressed" bit flag */#define EB_MAC3_HLEN      14   /* length of Mac3 attribute block header */#define EB_M3_FL_DATFRK   0x01 /* "this entry is data fork" flag */#define EB_M3_FL_UNCMPR   0x04 /* "Mac3 attributes uncompressed" bit flag */#define EB_M3_FL_TIME64   0x08 /* "Mac3 time fields are 64 bit wide" flag */#define EB_M3_FL_NOUTC    0x10 /* "Mac3 timezone offset fields missing" flag */#define EB_NTSD_C_LEN     4    /* length of central NT security data */#define EB_NTSD_L_LEN     5    /* length of minimal local NT security data */#define EB_NTSD_VERSION   4    /* offset of NTSD version byte */#define EB_NTSD_MAX_VER   (0)  /* maximum version # we know how to handle */#define EB_ASI_CRC32      0    /* offset of ASI Unix field's crc32 checksum */#define EB_ASI_MODE       4    /* offset of ASI Unix permission mode field *//*---------------------------------------------------------------------------    True sizes of the various headers, as defined by PKWARE--so it is not    likely that these will ever change.  But if they do, make sure both these    defines AND the typedefs below get updated accordingly.  ---------------------------------------------------------------------------*/#define LREC_SIZE   26   /* lengths of local file headers, central */#define CREC_SIZE   42   /*  directory headers, and the end-of-    */#define ECREC_SIZE  18   /*  central-dir record, respectively      */#define MAX_BITS    13                 /* used in unshrink() */#define HSIZE       (1 << MAX_BITS)    /* size of global work area */#define LF     10        /* '\n' on ASCII machines; must be 10 due to EBCDIC */#define CR     13        /* '\r' on ASCII machines; must be 13 due to EBCDIC */#define CTRLZ  26        /* DOS & OS/2 EOF marker (used in fileio.c, vms.c) */#ifdef EBCDIC#  define foreign(c)    ascii[(uch)(c)]#  define native(c)     ebcdic[(uch)(c)]#  define NATIVE        "EBCDIC"#  define NOANSIFILT#endif#if (defined(CRAY) && defined(ZMEM))#  undef ZMEM#endif#ifdef ZMEM#  undef ZMEM#  define memcmp(b1,b2,len)      bcmp(b2,b1,len)#  define memcpy(dest,src,len)   bcopy(src,dest,len)#  define memzero                bzero#else#  define memzero(dest,len)      memset(dest,0,len)#endif#ifdef VMS#  define ENV_UNZIP       "UNZIP_OPTS"     /* names of environment variables */#  define ENV_ZIPINFO     "ZIPINFO_OPTS"#endif /* VMS */#ifdef RISCOS#  define ENV_UNZIP       "Unzip$Options"#  define ENV_ZIPINFO     "Zipinfo$Options"#  define ENV_UNZIPEXTS   "Unzip$Exts"#endif /* RISCOS */#ifndef ENV_UNZIP#  define ENV_UNZIP       "UNZIP"          /* the standard names */#  define ENV_ZIPINFO     "ZIPINFO"#endif#define ENV_UNZIP2        "UNZIPOPT"     /* alternate names, for zip compat. */#define ENV_ZIPINFO2      "ZIPINFOOPT"#if (!defined(QQ) && !defined(NOQQ))#  define QQ#endif#ifdef QQ                         /* Newtware version:  no file */#  define QCOND     (!uO.qflag)   /*  comments with -vq or -vqq */#else                             /* Bill Davidsen version:  no way to */#  define QCOND     (longhdr)     /*  kill file comments when listing */#endif#ifdef OLD_QQ#  define QCOND2    (uO.qflag < 2)#else#  define QCOND2    (!uO.qflag)#endif#ifndef TRUE#  define TRUE      1   /* sort of obvious */#endif#ifndef FALSE#  define FALSE     0#endif#ifndef SEEK_SET#  define SEEK_SET  0#  define SEEK_CUR  1#  define SEEK_END  2#endif#if (defined(UNIX) && defined(S_IFLNK) && !defined(MTS))#  define SYMLINKS#  ifndef S_ISLNK#    define S_ISLNK(m)  (((m) & S_IFMT) == S_IFLNK)#  endif#endif /* UNIX && S_IFLNK && !MTS */#ifndef S_ISDIR#  ifdef CMS_MVS#    define S_ISDIR(m)  (FALSE)#  else#    define S_ISDIR(m)  (((m) & S_IFMT) == S_IFDIR)# endif#endif#ifndef IS_VOLID#  define IS_VOLID(m)  ((m) & 0x08)#endif/**************//*  Typedefs  *//**************/#ifdef NO_UID_GID#  ifdef UID_USHORT     typedef unsigned short  uid_t;    /* TI SysV.3 */     typedef unsigned short  gid_t;#  else     typedef unsigned int    uid_t;    /* SCO Xenix */     typedef unsigned int    gid_t;#  endif#endif#if (defined(WIN32) || defined(sgi) || defined(GOT_UTIMBUF) || defined(ATARI))   typedef struct utimbuf ztimbuf;#else   typedef struct ztimbuf {       time_t actime;        /* new access time */       time_t modtime;       /* new modification time */   } ztimbuf;#endiftypedef struct iztimes {   time_t atime;             /* new access time */   time_t mtime;             /* new modification time */   time_t ctime;             /* used for creation time; NOT same as st_ctime */} iztimes;#ifdef SET_DIR_ATTRIB   typedef struct dirtime {  /* temporary struct for holding directory info */       struct dirtime *next; /*  until can be sorted and set at end */       char *fn;             /* filename of directory */       union {           iztimes t3;       /* mtime, atime, ctime */           ztimbuf t2;       /* modtime, actime */       } u;       unsigned perms;       /* same as min_info.file_attr */       int have_uidgid;      /* flag */       ush uidgid[2];   } dirtime;#endif /* SET_DIR_ATTRIB */typedef struct min_info {    long offset;    ulg crc;                 /* crc (needed if extended header) */    ulg compr_size;          /* compressed size (needed if extended header) */    ulg uncompr_size;        /* uncompressed size (needed if extended header) */    int hostnum;    unsigned file_attr;      /* local flavor, as used by creat(), chmod()... */    unsigned encrypted : 1;  /* file encrypted: decrypt before uncompressing */    unsigned ExtLocHdr : 1;  /* use time instead of CRC for decrypt check */    unsigned textfile : 1;   /* file is text (according to zip) */    unsigned textmode : 1;   /* file is to be extracted as text */    unsigned lcflag : 1;     /* convert filename to lowercase */    unsigned vollabel : 1;   /* "file" is an MS-DOS volume (disk) label */} min_info;typedef struct VMStimbuf {    char *revdate;    /* (both roughly correspond to Unix modtime/st_mtime) */    char *credate;} VMStimbuf;/*---------------------------------------------------------------------------    Zipfile work area declarations.  ---------------------------------------------------------------------------*/#ifdef MALLOC_WORK   union work {     struct {                 /* unshrink(): */       shrint *Parent;          /* (8193 * sizeof(shrint)) */       uch *value;       uch *Stack;     } shrink;     uch *Slide;              /* explode(), inflate(), unreduce() */   };#else /* !MALLOC_WORK */   union work {     struct {                 /* unshrink(): */       shrint Parent[HSIZE];    /* (8192 * sizeof(shrint)) == 16KB minimum */       uch value[HSIZE];        /* 8KB */       uch Stack[HSIZE];        /* 8KB */     } shrink;                  /* total = 32KB minimum; 80KB on Cray/Alpha */     uch Slide[WSIZE];        /* explode(), inflate(), unreduce() */   };#endif /* ?MALLOC_WORK */#define slide  G.area.Slide#if (defined(DLL) && !defined(NO_SLIDE_REDIR))#  define redirSlide G.redirect_sldptr#else#  define redirSlide G.area.Slide#endif/*---------------------------------------------------------------------------    Zipfile layout declarations.  If these headers ever change, make sure the    xxREC_SIZE defines (above) change with them!  ---------------------------------------------------------------------------*/   typedef uch   local_byte_hdr[ LREC_SIZE ];#      define L_VERSION_NEEDED_TO_EXTRACT_0     0#      define L_VERSION_NEEDED_TO_EXTRACT_1     1#      define L_GENERAL_PURPOSE_BIT_FLAG        2#      define L_COMPRESSION_METHOD              4#      define L_LAST_MOD_DOS_DATETIME           6#      define L_CRC32                           10#      define L_COMPRESSED_SIZE                 14#      define L_UNCOMPRESSED_SIZE               18#      define L_FILENAME_LENGTH                 22#      define L_EXTRA_FIELD_LENGTH              24   typedef uch   cdir_byte_hdr[ CREC_SIZE ];#      define C_VERSION_MADE_BY_0               0#      define C_VERSION_MADE_BY_1               1#      define C_VERSION_NEEDED_TO_EXTRACT_0     2#      define C_VERSION_NEEDED_TO_EXTRACT_1     3#      define C_GENERAL_PURPOSE_BIT_FLAG        4#      define C_COMPRESSION_METHOD              6#      define C_LAST_MOD_DOS_DATETIME           8#      define C_CRC32                           12#      define C_COMPRESSED_SIZE                 16#      define C_UNCOMPRESSED_SIZE               20#      define C_FILENAME_LENGTH                 24#      define C_EXTRA_FIELD_LENGTH              26#      define C_FILE_COMMENT_LENGTH             28#      define C_DISK_NUMBER_START               30#      define C_INTERNAL_FILE_ATTRIBUTES        32#      define C_EXTERNAL_FILE_ATTRIBUTES        34#      define C_RELATIVE_OFFSET_LOCAL_HEADER    38   typedef uch   ec_byte_rec[ ECREC_SIZE+4 ];/*     define SIGNATURE                         0   space-holder only */#      define NUMBER_THIS_DISK                  4#      define NUM_DISK_WITH_START_CENTRAL_DIR   6#      define NUM_ENTRIES_CENTRL_DIR_THS_DISK   8#      define TOTAL_ENTRIES_CENTRAL_DIR         10#      define SIZE_CENTRAL_DIRECTORY            12#      define OFFSET_START_CENTRAL_DIRECTORY    16#      define ZIPFILE_COMMENT_LENGTH            20   typedef struct local_file_header {                 /* LOCAL */       uch version_needed_to_extract[2];       ush general_purpose_bit_flag;       ush compression_method;       ulg last_mod_dos_datetime;       ulg crc32;       ulg csize;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -