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

📄 unzpriv.h

📁 完整的解压zip文件的源码。包含密码功能
💻 H
📖 第 1 页 / 共 5 页
字号:
#endif#if (defined(AOS_VS) || defined(ATARI) || defined(__BEOS__)) /* GRR: others? */#  ifndef HAVE_UNLINK#    define HAVE_UNLINK#  endif#endif/* OS-specific exceptions to the "ANSI <--> INT_SPRINTF" rule */#if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF))#  if (defined(SYSV) || defined(CONVEX) || defined(NeXT) || defined(BSD4_4))#    define INT_SPRINTF      /* sprintf() returns int:  SysVish/Posix */#  endif#  if (defined(DOS_FLX_OS2_W32) || defined(VMS) || defined(AMIGA))#    define INT_SPRINTF      /* sprintf() returns int:  ANSI */#  endif#  if (defined(ultrix) || defined(__ultrix)) /* Ultrix 4.3 and newer */#    if (defined(POSIX) || defined(__POSIX))#      define INT_SPRINTF    /* sprintf() returns int:  ANSI/Posix */#    endif#    ifdef __GNUC__#      define PCHAR_SPRINTF  /* undetermined actual return value */#    endif#  endif#  if (defined(__osf__) || defined(_AIX) || defined(CMS_MVS))#    define INT_SPRINTF      /* sprintf() returns int:  ANSI/Posix */#  endif#  if defined(sun)#    define PCHAR_SPRINTF    /* sprintf() returns char *:  SunOS cc *and* gcc */#  endif#endif/* defaults that we hope will take care of most machines in the future */#if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF))#  ifdef __STDC__#    define INT_SPRINTF      /* sprintf() returns int:  ANSI */#  endif#  ifndef INT_SPRINTF#    define PCHAR_SPRINTF    /* sprintf() returns char *:  BSDish */#  endif#endif#define MSG_STDERR(f)  (f & 1)        /* bit 0:  0 = stdout, 1 = stderr */#define MSG_INFO(f)    ((f & 6) == 0) /* bits 1 and 2:  0 = info */#define MSG_WARN(f)    ((f & 6) == 2) /* bits 1 and 2:  1 = warning */#define MSG_ERROR(f)   ((f & 6) == 4) /* bits 1 and 2:  2 = error */#define MSG_FATAL(f)   ((f & 6) == 6) /* bits 1 and 2:  (3 = fatal error) */#define MSG_ZFN(f)     (f & 0x0008)   /* bit 3:  1 = print zipfile name */#define MSG_FN(f)      (f & 0x0010)   /* bit 4:  1 = print filename */#define MSG_LNEWLN(f)  (f & 0x0020)   /* bit 5:  1 = leading newline if !SOL */#define MSG_TNEWLN(f)  (f & 0x0040)   /* bit 6:  1 = trailing newline if !SOL */#define MSG_MNEWLN(f)  (f & 0x0080)   /* bit 7:  1 = trailing NL for prompts *//* the following are subject to change */#define MSG_NO_WGUI(f) (f & 0x0100)   /* bit 8:  1 = skip if Windows GUI */#define MSG_NO_AGUI(f) (f & 0x0200)   /* bit 9:  1 = skip if Acorn GUI */#define MSG_NO_DLL2(f) (f & 0x0400)   /* bit 10:  1 = skip if OS/2 DLL */#define MSG_NO_NDLL(f) (f & 0x0800)   /* bit 11:  1 = skip if WIN32 DLL */#define MSG_NO_WDLL(f) (f & 0x1000)   /* bit 12:  1 = skip if Windows DLL */#if (defined(MORE) && !defined(SCREENLINES))#  ifdef DOS_FLX_OS2_W32#    define SCREENLINES 25  /* can be (should be) a function instead */#  else#    define SCREENLINES 24  /* VT-100s are assumed to be minimal hardware */#  endif#endif#define DIR_BLKSIZ  64      /* number of directory entries per block                             *  (should fit in 4096 bytes, usually) */#ifndef WSIZE#  define WSIZE     0x8000  /* window size--must be a power of two, and */#endif                      /*  at least 32K for zip's deflate method */#ifndef INBUFSIZ#  if (defined(MED_MEM) || defined(SMALL_MEM))#    define INBUFSIZ  2048  /* works for MS-DOS small model */#  else#    define INBUFSIZ  8192  /* larger buffers for real OSes */#  endif#endif#ifndef __16BIT__#  define nearmalloc  malloc#  define nearfree    free#  if (!defined(__IBMC__) || !defined(OS2))#    ifndef near#      define near#    endif#    ifndef far#      define far#    endif#  endif#endif#if (defined(DYNALLOC_CRCTAB) && !defined(DYNAMIC_CRC_TABLE))#  undef DYNALLOC_CRCTAB#endif#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT))#  undef DYNALLOC_CRCTAB   /* not safe with reentrant code */#endif#if (defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB))#  ifdef DYNALLOC_CRCTAB#    undef DYNALLOC_CRCTAB#  endif#endif#if (defined(USE_ZLIB) && defined(ASM_CRC))#  undef ASM_CRC#endif/* Logic for case of small memory, length of EOL > 1:  if OUTBUFSIZ == 2048, * OUTBUFSIZ>>1 == 1024 and OUTBUFSIZ>>7 == 16; therefore rawbuf is 1008 bytes * and transbuf 1040 bytes.  Have room for 32 extra EOL chars; 1008/32 == 31.5 * chars/line, smaller than estimated 35-70 characters per line for C source * and normal text.  Hence difference is sufficient for most "average" files. * (Argument scales for larger OUTBUFSIZ.) */#ifdef SMALL_MEM          /* i.e., 16-bit OSes:  MS-DOS, OS/2 1.x, etc. */#  define LoadFarString(x)       fLoadFarString(__G__ (x))#  define LoadFarStringSmall(x)  fLoadFarStringSmall(__G__ (x))#  define LoadFarStringSmall2(x) fLoadFarStringSmall2(__G__ (x))#  if (defined(_MSC_VER) && (_MSC_VER >= 600))#    define zfstrcpy(dest, src)  _fstrcpy((dest), (src))#  endif#  ifndef Far#    define Far far  /* __far only works for MSC 6.00, not 6.0a or Borland */#  endif#  define OUTBUFSIZ INBUFSIZ#  if (lenEOL == 1)#    define RAWBUFSIZ (OUTBUFSIZ>>1)#  else#    define RAWBUFSIZ ((OUTBUFSIZ>>1) - (OUTBUFSIZ>>7))#  endif#  define TRANSBUFSIZ (OUTBUFSIZ-RAWBUFSIZ)   typedef short  shrint;            /* short/int or "shrink int" (unshrink) */#else#  define zfstrcpy(dest, src)       strcpy((dest), (src))#  ifdef QDOS#    define LoadFarString(x)        Qstrfix(x)   /* fix up _ for '.' */#    define LoadFarStringSmall(x)   Qstrfix(x)#    define LoadFarStringSmall2(x)  Qstrfix(x)#  else#    define LoadFarString(x)        x#    define LoadFarStringSmall(x)   x#    define LoadFarStringSmall2(x)  x#  endif#  ifdef MED_MEM#    define OUTBUFSIZ 0xFF80         /* can't malloc arrays of 0xFFE8 or more */#    define TRANSBUFSIZ 0xFF80     typedef short  shrint;#  else#    define OUTBUFSIZ (lenEOL*WSIZE) /* more efficient text conversion */#    define TRANSBUFSIZ (lenEOL*OUTBUFSIZ)#    ifdef AMIGA       typedef short shrint;#    else       typedef int  shrint;          /* for efficiency/speed, we hope... */#    endif#  endif /* ?MED_MEM */#  define RAWBUFSIZ OUTBUFSIZ#endif /* ?SMALL_MEM */#ifndef Far#  define Far#endif#ifndef MAIN#  define MAIN  main#endif#ifdef SFX      /* disable some unused features for SFX executables */#  ifndef NO_ZIPINFO#    define NO_ZIPINFO#  endif#  ifdef TIMESTAMP#    undef TIMESTAMP#  endif#endif/* user may have defined both by accident...  NOTIMESTAMP takes precedence */#if (defined(TIMESTAMP) && defined(NOTIMESTAMP))#  undef TIMESTAMP#endif#if (!defined(COPYRIGHT_CLEAN) && !defined(USE_SMITH_CODE))#  define COPYRIGHT_CLEAN#endif#if (!defined(LZW_CLEAN) && !defined(USE_UNSHRINK))#  define LZW_CLEAN#endif#ifndef O_BINARY#  define O_BINARY  0#endif#ifndef PIPE_ERROR#  define PIPE_ERROR (errno == EPIPE)#endif/* File operations--use "b" for binary if allowed or fixed length 512 on VMS */#ifdef VMS#  define FOPR  "r","ctx=stm"#  define FOPM  "r+","ctx=stm","rfm=fix","mrs=512"#  define FOPW  "w","ctx=stm","rfm=fix","mrs=512"#endif /* VMS */#ifdef CMS_MVS/* Binary files must be RECFM=F,LRECL=1 for ftell() to get correct pos *//* ...unless byteseek is used.  Let's try that for a while.            */#  define FOPR "rb,byteseek"#  define FOPM "r+b,byteseek"#  define FOPW "wb,recfm=v,lrecl=32760"#  ifdef MVS#    define FOPWT "w,lrecl=133"#  else#    define FOPWT "w"#  endif#endif /* CMS_MVS */#ifdef TOPS20          /* TOPS-20 MODERN?  You kidding? */#  define FOPW "w8"#endif /* TOPS20 *//* Defaults when nothing special has been defined previously. */#ifdef MODERN#  ifndef FOPR#    define FOPR "rb"#  endif#  ifndef FOPM#    define FOPM "r+b"#  endif#  ifndef FOPW#    define FOPW "wb"#  endif#  ifndef FOPWT#    define FOPWT "wt"#  endif#else /* !MODERN */#  ifndef FOPR#    define FOPR "r"#  endif#  ifndef FOPM#    define FOPM "r+"#  endif#  ifndef FOPW#    define FOPW "w"#  endif#  ifndef FOPWT#    define FOPWT "w"#  endif#endif /* ?MODERN *//* * If <limits.h> exists on most systems, should include that, since it may * define some or all of the following:  NAME_MAX, PATH_MAX, _POSIX_NAME_MAX, * _POSIX_PATH_MAX. */#ifdef DOS_FLX_OS2#  include <limits.h>#endif#ifndef PATH_MAX#  ifdef MAXPATHLEN#    define PATH_MAX      MAXPATHLEN    /* in <sys/param.h> on some systems */#  else#    ifdef _MAX_PATH#      define PATH_MAX    _MAX_PATH#    else#      if FILENAME_MAX > 255#        define PATH_MAX  FILENAME_MAX  /* used like PATH_MAX on some systems */#      else#        define PATH_MAX  1024#      endif#    endif /* ?_MAX_PATH */#  endif /* ?MAXPATHLEN */#endif /* !PATH_MAX */#define FILNAMSIZ  PATH_MAX#ifdef SHORT_SYMS                   /* Mark Williams C, ...? */#  define extract_or_test_files     xtr_or_tst_files#  define extract_or_test_member    xtr_or_tst_member#endif#ifdef REALLY_SHORT_SYMS            /* TOPS-20 linker:  first 6 chars */#  define process_cdir_file_hdr     XXpcdfh#  define process_local_file_hdr    XXplfh#  define extract_or_test_files     XXxotf  /* necessary? */#  define extract_or_test_member    XXxotm  /* necessary? */#  define check_for_newer           XXcfn#  define overwrite_all             XXoa#  define process_all_files         XXpaf#  define extra_field               XXef#  define explode_lit8              XXel8#  define explode_lit4              XXel4#  define explode_nolit8            XXnl8#  define explode_nolit4            XXnl4#  define cpdist8                   XXcpdist8#  define inflate_codes             XXic#  define inflate_stored            XXis#  define inflate_fixed             XXif#  define inflate_dynamic           XXid#  define inflate_block             XXib#  define maxcodemax                XXmax#endif#ifndef S_TIME_T_MAX            /* max value of signed (>= 32-bit) time_t */#  define S_TIME_T_MAX  ((time_t)(ulg)0x7fffffffL)#endif#ifndef U_TIME_T_MAX            /* max value of unsigned (>= 32-bit) time_t */#  define U_TIME_T_MAX  ((time_t)(ulg)0xffffffffL)#endif#ifdef DOSTIME_MINIMUM          /* min DOSTIME value (1980-01-01) */#  undef DOSTIME_MINIMUM#endif#define DOSTIME_MINIMUM ((ulg)0x00210000L)#ifdef DOSTIME_2038_01_18       /* approximate DOSTIME equivalent of */#  undef DOSTIME_2038_01_18     /*  the signed-32-bit time_t limit */#endif#define DOSTIME_2038_01_18 ((ulg)0x74320000L)#ifdef QDOS#  define ZSUFX         "_zip"#  define ALT_ZSUFX     ".zip"#else#  ifdef RISCOS#    define ZSUFX       "/zip"#  else#    define ZSUFX       ".zip"#  endif#  define ALT_ZSUFX     ".ZIP"   /* Unix-only so far (only case-sensitive fs) */#endif#define CENTRAL_HDR_SIG   "\001\002"   /* the infamous "PK" signature bytes, */#define LOCAL_HDR_SIG     "\003\004"   /*  sans "PK" (so unzip executable not */#define END_CENTRAL_SIG   "\005\006"   /*  mistaken for zipfile itself) */#define EXTD_LOCAL_SIG    "\007\010"   /* [ASCII "\113" == EBCDIC "\080" ??] *//* choice of activities for do_string() */#define SKIP              0             /* skip header block */#define DISPLAY           1             /* display archive comment (ASCII) */#define DISPL_8           5             /* display file comment (ext. ASCII) */#define DS_FN             2             /* read filename (ext. ASCII) */#define EXTRA_FIELD       3             /* copy extra field into buffer */#define DS_EF             3#ifdef AMIGA#  define FILENOTE        4#endif#define DOES_NOT_EXIST    -1   /* return values for check_for_newer() */#define EXISTS_AND_OLDER  0#define EXISTS_AND_NEWER  1#define ROOT              0    /* checkdir() extract-to path:  called once */#define INIT              1    /* allocate buildpath:  called once per member */#define APPEND_DIR        2    /* append a dir comp.:  many times per member */#define APPEND_NAME       3    /* append actual filename:  once per member */#define GETPATH           4    /* retrieve the complete path and free it */#define END               5    /* free root path prior to exiting program *//* version_made_by codes (central dir):  make sure these *//*  are not defined on their respective systems!! */

⌨️ 快捷键说明

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