home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2002 November
/
VPR0211A.ISO
/
OLS
/
ZIPS3001
/
zips3001.lzh
/
SFX32GUI.DIF
< prev
next >
Wrap
Text File
|
1998-10-11
|
59KB
|
1,668 lines
diff -urP origsrc/crypt.c src/crypt.c
--- origsrc/crypt.c Mon Oct 6 04:05:30 1997
+++ src/crypt.c Mon Mar 31 05:59:58 1997
@@ -1,12 +1,560 @@
/*
- crypt.c (dummy version) by Info-ZIP. Last revised: 5 Oct 97
+ crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
- This is a non-functional version of Info-ZIP's crypt.c encryption/
- decryption code for Zip, ZipCloak, UnZip and fUnZip. This file is
- not copyrighted and may be distributed freely. :-) See the "WHERE"
- file for sites from which to obtain the full encryption/decryption
- sources (zcrypt27.zip or later).
+ This code is not copyrighted and is put in the public domain. The
+ encryption/decryption parts (as opposed to the non-echoing password
+ parts) were originally written in Europe; the whole file can there-
+ fore be freely distributed from any country except the USA. If this
+ code is imported into the USA, it cannot be re-exported from from
+ there to another country. (This restriction might seem curious, but
+ this is what US law requires.)
*/
-/* something "externally visible" to shut up compiler/linker warnings */
-int zcr_dummy;
+/* This encryption code is a direct transcription of the algorithm from
+ Roger Schlafly, described by Phil Katz in the file appnote.txt. This
+ file (appnote.txt) is distributed with the PKZIP program (even in the
+ version without encryption capabilities).
+ */
+
+#define ZCRYPT_INTERNAL
+#include "zip.h"
+#include "crypt.h"
+#include "ttyio.h"
+
+#ifndef FALSE
+# define FALSE 0
+#endif
+
+#ifdef ZIP
+ /* For the encoding task used in Zip (and ZipCloak), we want to initialize
+ the crypt algorithm with some reasonably unpredictable bytes, see
+ the crypthead() function. The standard rand() library function is
+ used to supply these `random' bytes, which in turn is initialized by
+ a srand() call. The srand() function takes an "unsigned" (at least 16bit)
+ seed value as argument to determine the starting point of the rand()
+ pseudo-random number generator.
+ This seed number is constructed as "Seed = Seed1 .XOR. Seed2" with
+ Seed1 supplied by the current time (= "(unsigned)time()") and Seed2
+ as some (hopefully) nondeterministic bitmask. On many (most) systems,
+ we use some "process specific" number, as the PID or something similar,
+ but when nothing unpredictable is available, a fixed number may be
+ sufficient.
+ NOTE:
+ 1.) This implementation requires the availability of the following
+ standard UNIX C runtime library functions: time(), rand(), srand().
+ On systems where some of them are missing, the environment that
+ incorporates the crypt routines must supply suitable replacement
+ functions.
+ 2.) It is a very bad idea to use a second call to time() to set the
+ "Seed2" number! In this case, both "Seed1" and "Seed2" would be
+ (almost) identical, resulting in a (mostly) "zero" constant seed
+ number passed to srand().
+
+ The implementation environment defined in the "zip.h" header should
+ supply a reasonable definition for ZCR_SEED2 (an unsigned number; for
+ most implementations of rand() and srand(), only the lower 16 bits are
+ significant!). An example that works on many systems would be
+ "#define ZCR_SEED2 (unsigned)getpid()".
+ The default definition for ZCR_SEED2 supplied below should be regarded
+ as a fallback to allow successful compilation in "beta state"
+ environments.
+ */
+# include <time.h> /* time() function supplies first part of crypt seed */
+ /* "last resort" source for second part of crypt seed pattern */
+# ifndef ZCR_SEED2
+# define ZCR_SEED2 (unsigned)3141592654L /* use PI as default pattern */
+# endif
+# ifdef GLOBAL /* used in Amiga system headers, maybe others too */
+# undef GLOBAL
+# endif
+# define GLOBAL(g) g
+#else /* !ZIP */
+# define GLOBAL(g) G.g
+#endif /* ?ZIP */
+
+
+#ifdef UNZIP
+ /* char *key = (char *)NULL; moved to globals.h */
+# ifndef FUNZIP
+ local int testp OF((__GPRO__ uch *h));
+ local int testkey OF((__GPRO__ uch *h, char *key));
+# endif
+#endif /* UNZIP */
+
+#ifndef UNZIP /* moved to globals.h for UnZip */
+ local ulg keys[3]; /* keys defining the pseudo-random sequence */
+#endif /* !UNZIP */
+
+#ifndef Trace
+# ifdef CRYPT_DEBUG
+# define Trace(x) fprintf x
+# else
+# define Trace(x)
+# endif
+#endif
+
+#ifndef CRC_32_TAB
+# define CRC_32_TAB crc_32_tab
+#endif
+
+#define CRC32(c, b) (CRC_32_TAB[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
+
+/***********************************************************************
+ * Return the next byte in the pseudo-random sequence
+ */
+int decrypt_byte(__G)
+ __GDEF
+{
+ unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
+ * unpredictable manner on 16-bit systems; not a problem
+ * with any known compiler so far, though */
+
+ temp = ((unsigned)GLOBAL(keys[2]) & 0xffff) | 2;
+ return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
+}
+
+/***********************************************************************
+ * Update the encryption keys with the next byte of plain text
+ */
+int update_keys(__G__ c)
+ __GDEF
+ int c; /* byte of plain text */
+{
+ GLOBAL(keys[0]) = CRC32(GLOBAL(keys[0]), c);
+ GLOBAL(keys[1]) += GLOBAL(keys[0]) & 0xff;
+ GLOBAL(keys[1]) = GLOBAL(keys[1]) * 134775813L + 1;
+ {
+ register int keyshift = (int)(GLOBAL(keys[1]) >> 24);
+ GLOBAL(keys[2]) = CRC32(GLOBAL(keys[2]), keyshift);
+ }
+ return c;
+}
+
+
+/***********************************************************************
+ * Initialize the encryption keys and the random header according to
+ * the given password.
+ */
+void init_keys(__G__ passwd)
+ __GDEF
+ char *passwd; /* password string with which to modify keys */
+{
+ GLOBAL(keys[0]) = 305419896L;
+ GLOBAL(keys[1]) = 591751049L;
+ GLOBAL(keys[2]) = 878082192L;
+ while (*passwd != '\0') {
+ update_keys(__G__ (int)*passwd);
+ passwd++;
+ }
+}
+
+
+#ifdef ZIP
+
+/***********************************************************************
+ * Write encryption header to file zfile using the password passwd
+ * and the cyclic redundancy check crc.
+ */
+void crypthead(passwd, crc, zfile)
+ char *passwd; /* password string */
+ ulg crc; /* crc of file being encrypted */
+ FILE *zfile; /* where to write header */
+{
+ int n; /* index in random header */
+ int t; /* temporary */
+ int c; /* random byte */
+ int ztemp; /* temporary for zencoded value */
+ uch header[RAND_HEAD_LEN-2]; /* random header */
+ static unsigned calls = 0; /* ensure different random header each time */
+
+ /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
+ * output of rand() to get less predictability, since rand() is
+ * often poorly implemented.
+ */
+ if (++calls == 1) {
+ srand((unsigned)time(NULL) ^ ZCR_SEED2);
+ }
+ init_keys(passwd);
+ for (n = 0; n < RAND_HEAD_LEN-2; n++) {
+ c = (rand() >> 7) & 0xff;
+ header[n] = (uch)zencode(c, t);
+ }
+ /* Encrypt random header (last two bytes is high word of crc) */
+ init_keys(passwd);
+ for (n = 0; n < RAND_HEAD_LEN-2; n++) {
+ ztemp = zencode(header[n], t);
+ putc(ztemp, zfile);
+ }
+ ztemp = zencode((int)(crc >> 16) & 0xff, t);
+ putc(ztemp, zfile);
+ ztemp = zencode((int)(crc >> 24) & 0xff, t);
+ putc(ztemp, zfile);
+}
+
+
+#ifdef UTIL
+
+/***********************************************************************
+ * Encrypt the zip entry described by z from file source to file dest
+ * using the password passwd. Return an error code in the ZE_ class.
+ */
+int zipcloak(z, source, dest, passwd)
+ struct zlist far *z; /* zip entry to encrypt */
+ FILE *source, *dest; /* source and destination files */
+ char *passwd; /* password string */
+{
+ int c; /* input byte */
+ int res; /* result code */
+ ulg n; /* holds offset and counts size */
+ ush flag; /* previous flags */
+ int t; /* temporary */
+ int ztemp; /* temporary storage for zencode value */
+
+ /* Set encrypted bit, clear extended local header bit and write local
+ header to output file */
+ if ((n = ftell(dest)) == -1L) return ZE_TEMP;
+ z->off = n;
+ flag = z->flg;
+ z->flg |= 1, z->flg &= ~8;
+ z->lflg |= 1, z->lflg &= ~8;
+ z->siz += RAND_HEAD_LEN;
+ if ((res = putlocal(z, dest)) != ZE_OK) return res;
+
+ /* Initialize keys with password and write random header */
+ crypthead(passwd, z->crc, dest);
+
+ /* Skip local header in input file */
+ if (fseek(source, (long)(4 + LOCHEAD + (ulg)z->nam + (ulg)z->ext),
+ SEEK_CUR)) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+
+ /* Encrypt data */
+ for (n = z->siz - RAND_HEAD_LEN; n; n--) {
+ if ((c = getc(source)) == EOF) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ ztemp = zencode(c, t);
+ putc(ztemp, dest);
+ }
+ /* Skip extended local header in input file if there is one */
+ if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ if (fflush(dest) == EOF) return ZE_TEMP;
+ return ZE_OK;
+}
+
+/***********************************************************************
+ * Decrypt the zip entry described by z from file source to file dest
+ * using the password passwd. Return an error code in the ZE_ class.
+ */
+int zipbare(__G__ z, source, dest, passwd)
+ __GDEF
+ struct zlist far *z; /* zip entry to encrypt */
+ FILE *source, *dest; /* source and destination files */
+ char *passwd; /* password string */
+{
+ int c0, c1; /* last two input bytes */
+ ulg offset; /* used for file offsets */
+ ulg size; /* size of input data */
+ int r; /* size of encryption header */
+ int res; /* return code */
+ ush flag; /* previous flags */
+
+ /* Save position and skip local header in input file */
+ if ((offset = ftell(source)) == -1L ||
+ fseek(source, (long)(4 + LOCHEAD + (ulg)z->nam + (ulg)z->ext),
+ SEEK_CUR)) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ /* Initialize keys with password */
+ init_keys(passwd);
+
+ /* Decrypt encryption header, save last two bytes */
+ c1 = 0;
+ for (r = RAND_HEAD_LEN; r; r--) {
+ c0 = c1;
+ if ((c1 = getc(source)) == EOF) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ Trace((stdout, " (%02x)", c1));
+ zdecode(c1);
+ Trace((stdout, " %02x", c1));
+ }
+ Trace((stdout, "\n"));
+
+ /* If last two bytes of header don't match crc (or file time in the
+ * case of an extended local header), back up and just copy. For
+ * pkzip 2.0, the check has been reduced to one byte only.
+ */
+#ifdef ZIP10
+ if ((ush)(c0 | (c1<<8)) !=
+ (z->flg & 8 ? (ush) z->tim & 0xffff : (ush)(z->crc >> 16))) {
+#else
+ c0++; /* avoid warning on unused variable */
+ if ((ush)c1 != (z->flg & 8 ? (ush) z->tim >> 8 : (ush)(z->crc >> 24))) {
+#endif
+ if (fseek(source, offset, SEEK_SET)) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ if ((res = zipcopy(z, source, dest)) != ZE_OK) return res;
+ return ZE_MISS;
+ }
+
+ /* Clear encrypted bit and local header bit, and write local header to
+ output file */
+ if ((offset = ftell(dest)) == -1L) return ZE_TEMP;
+ z->off = offset;
+ flag = z->flg;
+ z->flg &= ~9;
+ z->lflg &= ~9;
+ z->siz -= RAND_HEAD_LEN;
+ if ((res = putlocal(z, dest)) != ZE_OK) return res;
+
+ /* Decrypt data */
+ for (size = z->siz; size; size--) {
+ if ((c1 = getc(source)) == EOF) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ zdecode(c1);
+ putc(c1, dest);
+ }
+ /* Skip extended local header in input file if there is one */
+ if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
+ return ferror(source) ? ZE_READ : ZE_EOF;
+ }
+ if (fflush(dest) == EOF) return ZE_TEMP;
+
+ return ZE_OK;
+}
+
+
+#else /* !UTIL */
+
+/***********************************************************************
+ * If requested, encrypt the data in buf, and in any case call fwrite()
+ * with the arguments to zfwrite(). Return what fwrite() returns.
+ */
+unsigned zfwrite(buf, item_size, nb, f)
+ zvoid *buf; /* data buffer */
+ extent item_size; /* size of each item in bytes */
+ extent nb; /* number of items */
+ FILE *f; /* file to write to */
+{
+ int t; /* temporary */
+
+ if (key != (char *)NULL) { /* key is the global password pointer */
+ ulg size; /* buffer size */
+ char *p = (char*)buf; /* steps through buffer */
+
+ /* Encrypt data in buffer */
+ for (size = item_size*(ulg)nb; size != 0; p++, size--) {
+ *p = (char)zencode(*p, t);
+ }
+ }
+ /* Write the buffer out */
+ return fwrite(buf, item_size, nb, f);
+}
+
+#endif /* ?UTIL */
+#endif /* ZIP */
+
+
+#if (defined(UNZIP) && !defined(FUNZIP))
+
+/***********************************************************************
+ * Get the password and set up keys for current zipfile member. Return
+ * PK_ class error.
+ */
+int decrypt(__G)
+ __GDEF
+{
+ ush b;
+ int n, r;
+ uch h[RAND_HEAD_LEN];
+
+ Trace((stdout, "\n[incnt = %d]: ", GLOBAL(incnt)));
+
+ /* get header once (turn off "encrypted" flag temporarily so we don't
+ * try to decrypt the same data twice) */
+ GLOBAL(pInfo->encrypted) = FALSE;
+ defer_leftover_input(__G);
+ for (n = 0; n < RAND_HEAD_LEN; n++) {
+ b = NEXTBYTE;
+ h[n] = (uch)b;
+ Trace((stdout, " (%02x)", h[n]));
+ }
+ undefer_input(__G);
+ GLOBAL(pInfo->encrypted) = TRUE;
+
+ if (GLOBAL(newzip)) { /* this is first encrypted member in this zipfile */
+ GLOBAL(newzip) = FALSE;
+ if (GLOBAL(P_flag)) { /* user gave password on command line */
+ if (!GLOBAL(key)) {
+ if ((GLOBAL(key) = (char *)malloc(PWLEN+1)) == (char *)NULL)
+ return PK_MEM2;
+ strncpy(GLOBAL(key), GLOBAL(pwdarg), PWLEN);
+ GLOBAL(nopwd) = TRUE; /* inhibit password prompting! */
+ }
+ } else if (GLOBAL(key)) { /* get rid of previous zipfile's key */
+ free(GLOBAL(key));
+ GLOBAL(key) = (char *)NULL;
+ }
+ }
+
+ /* if have key already, test it; else allocate memory for it */
+ if (GLOBAL(key)) {
+ if (!testp(__G__ h))
+ return PK_COOL; /* existing password OK (else prompt for new) */
+ else if (GLOBAL(nopwd))
+ return PK_WARN; /* user indicated no more prompting */
+ } else if ((GLOBAL(key) = (char *)malloc(PWLEN+1)) == (char *)NULL)
+ return PK_MEM2;
+
+ /* try a few keys */
+ n = 0;
+ do {
+ r = (*G.decr_passwd)((zvoid *)&G, &n, GLOBAL(key), PWLEN+1,
+ GLOBAL(zipfn), GLOBAL(filename));
+ if (r == IZ_PW_ERROR) { /* internal error in fetch of PW */
+ free (GLOBAL(key));
+ GLOBAL(key) = NULL;
+ return PK_MEM2;
+ }
+ if (r != IZ_PW_ENTERED) { /* user replied "skip" or "skip all" */
+ *GLOBAL(key) = '\0'; /* We try the NIL password, ... */
+ n = 0; /* and cancel fetch for this item. */
+ }
+ if (!testp(__G__ h))
+ return PK_COOL;
+ if (r == IZ_PW_CANCELALL) /* User replied "Skip all" */
+ GLOBAL(nopwd) = TRUE; /* inhibit any further PW prompt! */
+ } while (n > 0);
+
+ return PK_WARN;
+
+} /* end function decrypt() */
+
+
+
+/***********************************************************************
+ * Test the password. Return -1 if bad, 0 if OK.
+ */
+local int testp(__G__ h)
+ __GDEF
+ uch *h;
+{
+ int r;
+ char *key_translated;
+
+ /* On systems with "obscure" native character coding (e.g., EBCDIC),
+ * the first test translates the password to the "main standard"
+ * character coding. */
+
+#ifdef STR_TO_CP1
+ /* allocate buffer for translated password */
+ if ((key_translated = malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
+ return -1;
+ /* first try, test password translated "standard" charset */
+ r = testkey(__G__ h, STR_TO_CP1(key_translated, GLOBAL(key)));
+#else /* !STR_TO_CP1 */
+ /* first try, test password as supplied on the extractor's host */
+ r = testkey(__G__ h, GLOBAL(key));
+#endif /* ?STR_TO_CP1 */
+
+#ifdef STR_TO_CP2
+ if (r != 0) {
+#ifndef STR_TO_CP1
+ /* now prepare for second (and maybe third) test with translated pwd */
+ if ((key_translated = malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
+ return -1;
+#endif
+ /* second try, password translated to alternate ("standard") charset */
+ r = testkey(__G__ h, STR_TO_CP2(key_translated, GLOBAL(key)));
+#ifdef STR_TO_CP3
+ if (r != 0)
+ /* third try, password translated to another "standard" charset */
+ r = testkey(__G__ h, STR_TO_CP3(key_translated, GLOBAL(key)));
+#endif
+#ifndef STR_TO_CP1
+ free(key_translated);
+#endif
+ }
+#endif /* STR_TO_CP2 */
+
+#ifdef STR_TO_CP1
+ free(key_translated);
+ if (r != 0) {
+ /* last resort, test password as supplied on the extractor's host */
+ r = testkey(__G__ h, GLOBAL(key));
+ }
+#endif /* STR_TO_CP1 */
+
+ return r;
+
+} /* end function testp() */
+
+
+local int testkey(__G__ h, key)
+ __GDEF
+ uch *h; /* decrypted header */
+ char *key; /* decryption password to test */
+{
+ ush b;
+#ifdef ZIP10
+ ush c;
+#endif
+ int n;
+ uch *p;
+ uch hh[RAND_HEAD_LEN]; /* decrypted header */
+
+ /* set keys and save the encrypted header */
+ init_keys(__G__ key);
+ memcpy(hh, h, RAND_HEAD_LEN);
+
+ /* check password */
+ for (n = 0; n < RAND_HEAD_LEN; n++) {
+ zdecode(hh[n]);
+ Trace((stdout, " %02x", hh[n]));
+ }
+
+ Trace((stdout,
+ "\n lrec.crc= %08lx crec.crc= %08lx pInfo->ExtLocHdr= %s\n",
+ GLOBAL(lrec.crc32), GLOBAL(pInfo->crc),
+ GLOBAL(pInfo->ExtLocHdr) ? "true":"false"));
+ Trace((stdout, " incnt = %d unzip offset into zipfile = %ld\n",
+ GLOBAL(incnt),
+ GLOBAL(cur_zipfile_bufstart)+(GLOBAL(inptr)-GLOBAL(inbuf))));
+
+ /* same test as in zipbare(): */
+
+#ifdef ZIP10 /* check two bytes */
+ c = hh[RAND_HEAD_LEN-2], b = hh[RAND_HEAD_LEN-1];
+ Trace((stdout,
+ " (c | (b<<8)) = %04x (crc >> 16) = %04x lrec.time = %04x\n",
+ (ush)(c | (b<<8)), (ush)(GLOBAL(lrec.crc32) >> 16),
+ GLOBAL(lrec.last_mod_file_time)));
+ if ((ush)(c | (b<<8)) != (GLOBAL(pInfo->ExtLocHdr) ?
+ GLOBAL(lrec.last_mod_file_time) :
+ (ush)(GLOBAL(lrec.crc32) >> 16)))
+ return -1; /* bad */
+#else
+ b = hh[RAND_HEAD_LEN-1];
+ Trace((stdout, " b = %02x (crc >> 24) = %02x (lrec.time >> 8) = %02x\n",
+ b, (ush)(GLOBAL(lrec.crc32) >> 24),
+ (GLOBAL(lrec.last_mod_file_time) >> 8)));
+ if (b != (GLOBAL(pInfo->ExtLocHdr) ? GLOBAL(lrec.last_mod_file_time) >> 8 :
+ (ush)(GLOBAL(lrec.crc32) >> 24)))
+ return -1; /* bad */
+#endif
+ /* password OK: decrypt current buffer contents before leaving */
+ for (n = (long)GLOBAL(incnt) > GLOBAL(csize) ?
+ (int)GLOBAL(csize) : GLOBAL(incnt),
+ p = GLOBAL(inptr); n--; p++)
+ zdecode(*p);
+ return 0; /* OK */
+
+} /* end function testkey() */
+
+#endif /* UNZIP && !FUNZIP */
diff -urP origsrc/crypt.h src/crypt.h
--- origsrc/crypt.h Mon Oct 6 04:05:44 1997
+++ src/crypt.h Tue Apr 22 22:59:00 1997
@@ -1,11 +1,8 @@
/*
- crypt.h (dummy version) by Info-ZIP. Last revised: 5 Oct 97
+ crypt.h (full version) by Info-ZIP. Last revised: [see CR_VERSION_DATE]
- This is a non-functional version of Info-ZIP's crypt.h encryption/
- decryption header file for Zip, ZipCloak, UnZip and fUnZip. This
- file is not copyrighted and may be distributed without restriction.
- See the "WHERE" file for sites from which to obtain the full crypt
- sources (zcrypt27.zip or later).
+ This header file is not copyrighted, and non-beta versions may be
+ distributed without restriction.
*/
#ifndef __crypt_h /* don't include more than once */
@@ -14,11 +11,89 @@
#ifdef CRYPT
# undef CRYPT
#endif
-#define CRYPT 0 /* dummy version */
+#define CRYPT 1 /* full version */
-#define zencode
-#define zdecode
+#define CR_MAJORVER 2
+#define CR_MINORVER 7
+#ifdef CR_BETA
+# define CR_BETA_VER "m BETA"
+# define CR_VERSION_DATE "13 April 1997" /* last real code change */
+#else
+# define CR_BETA_VER ""
+# define CR_VERSION_DATE "22 April 1997" /* last public release date */
+# define CR_RELEASE
+#endif
+
+#ifndef __G /* UnZip only, for now (DLL stuff) */
+# define __G
+# define __G__
+# define __GDEF
+# define __GPRO void
+# define __GPRO__
+#endif
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32)
+# ifndef DOS_OS2_W32
+# define DOS_OS2_W32
+# endif
+#endif
+
+#if defined(DOS_OS2_W32) || defined(__human68k__)
+# ifndef DOS_H68_OS2_W32
+# define DOS_H68_OS2_W32
+# endif
+#endif
+
+#if defined(VM_CMS) || defined(MVS)
+# ifndef CMS_MVS
+# define CMS_MVS
+# endif
+#endif
+
+#ifdef REALLY_SHORT_SYMS
+# define decrypt_byte dcrbyt
+#endif
+
+#define PWLEN 80 /* input buffer size for reading encryption key */
+#define RAND_HEAD_LEN 12 /* length of encryption random header */
+
+/* the crc_32_tab array has to be provided externally for the crypt calculus */
+#ifndef UNZIP /* UnZip provides this in globals.h */
+ extern ulg near *crc_32_tab;
+#endif /* !UNZIP */
+
+/* encode byte c, using temp t. Warning: c must not have side effects. */
+#define zencode(c,t) (t=decrypt_byte(__G), update_keys(c), t^(c))
+
+/* decode byte c in place */
+#define zdecode(c) update_keys(__G__ c ^= decrypt_byte(__G))
+
+int decrypt_byte OF((__GPRO));
+int update_keys OF((__GPRO__ int c));
+void init_keys OF((__GPRO__ char *passwd));
+
+#ifdef ZIP
+ void crypthead OF((char *, ulg, FILE *));
+# ifdef UTIL
+ int zipcloak OF((struct zlist far *, FILE *, FILE *, char *));
+ int zipbare OF((__GPRO__ struct zlist far *, FILE *, FILE *, char *));
+# else
+ unsigned zfwrite OF((zvoid *, extent, extent, FILE *));
+ extern char *key;
+# endif
+#endif /* ZIP */
+
+#if (defined(UNZIP) && !defined(FUNZIP))
+ int decrypt OF((__GPRO));
+#endif
-#define zfwrite fwrite
+#ifdef FUNZIP
+ extern int encrypted;
+# ifdef NEXTBYTE
+# undef NEXTBYTE
+# endif
+# define NEXTBYTE \
+ (encrypted? update_keys(__G__ getc(G.in)^decrypt_byte(__G)) : getc(G.in))
+#endif /* FUNZIP */
#endif /* !__crypt_h */
diff -urP origsrc/debug/aaa/aiueo.txt src/debug/aaa/aiueo.txt
--- origsrc/debug/aaa/aiueo.txt Wed Dec 31 19:00:00 1969
+++ src/debug/aaa/aiueo.txt Sun Oct 11 00:40:58 1998
@@ -0,0 +1 @@
+aiueo
Binary files origsrc/debug/aiueo.exe and src/debug/aiueo.exe differ
diff -urP origsrc/debug/aiueo.txt src/debug/aiueo.txt
--- origsrc/debug/aiueo.txt Wed Dec 31 19:00:00 1969
+++ src/debug/aiueo.txt Sun Oct 11 00:40:58 1998
@@ -0,0 +1 @@
+aiueo
Binary files origsrc/debug/aiueo.zip and src/debug/aiueo.zip differ
Binary files origsrc/debug/apihelp.obj and src/debug/apihelp.obj differ
Binary files origsrc/debug/crc32.obj and src/debug/crc32.obj differ
Binary files origsrc/debug/crc_i386.obj and src/debug/crc_i386.obj differ
Binary files origsrc/debug/crctab.obj and src/debug/crctab.obj differ
Binary files origsrc/debug/crypt.obj and src/debug/crypt.obj differ
Binary files origsrc/debug/envargs.obj and src/debug/envargs.obj differ
Binary files origsrc/debug/explode.obj and src/debug/explode.obj differ
Binary files origsrc/debug/extract.obj and src/debug/extract.obj differ
Binary files origsrc/debug/fileio.obj and src/debug/fileio.obj differ
Binary files origsrc/debug/funzip.obj and src/debug/funzip.obj differ
Binary files origsrc/debug/globals.obj and src/debug/globals.obj differ
Binary files origsrc/debug/inflate.obj and src/debug/inflate.obj differ
Binary files origsrc/debug/match.obj and src/debug/match.obj differ
Binary files origsrc/debug/nt.obj and src/debug/nt.obj differ
Binary files origsrc/debug/process.obj and src/debug/process.obj differ
Binary files origsrc/debug/ttyio.obj and src/debug/ttyio.obj differ
Binary files origsrc/debug/unreduce.obj and src/debug/unreduce.obj differ
Binary files origsrc/debug/unshrink.obj and src/debug/unshrink.obj differ
Binary files origsrc/debug/unzip.obj and src/debug/unzip.obj differ
Binary files origsrc/debug/unzipsfx.exe and src/debug/unzipsfx.exe differ
diff -urP origsrc/debug/unzipsfx.ilk src/debug/unzipsfx.ilk
--- origsrc/debug/unzipsfx.ilk Wed Dec 31 19:00:00 1969
+++ src/debug/unzipsfx.ilk Sun Oct 11 03:55:36 1998
@@ -0,0 +1,2 @@
+Microsoft Linker Database
+
\ No newline at end of file
Binary files origsrc/debug/unzipsfx.pch and src/debug/unzipsfx.pch differ
diff -urP origsrc/debug/unzipsfx.pdb src/debug/unzipsfx.pdb
--- origsrc/debug/unzipsfx.pdb Wed Dec 31 19:00:00 1969
+++ src/debug/unzipsfx.pdb Sun Oct 11 03:55:36 1998
@@ -0,0 +1 @@
+Microsoft C/C++ program database 2.00
Binary files origsrc/debug/unzipsfx.res and src/debug/unzipsfx.res differ
Binary files origsrc/debug/unzipstb.obj and src/debug/unzipstb.obj differ
diff -urP origsrc/debug/vc50.idb src/debug/vc50.idb
--- origsrc/debug/vc50.idb Wed Dec 31 19:00:00 1969
+++ src/debug/vc50.idb Sun Oct 11 03:56:20 1998
@@ -0,0 +1 @@
+Microsoft C/C++ program database 2.00
diff -urP origsrc/debug/vc50.pdb src/debug/vc50.pdb
--- origsrc/debug/vc50.pdb Wed Dec 31 19:00:00 1969
+++ src/debug/vc50.pdb Sun Oct 11 03:55:34 1998
@@ -0,0 +1 @@
+Microsoft C/C++ program database 2.00
Binary files origsrc/debug/win32.obj and src/debug/win32.obj differ
Binary files origsrc/debug/wingui.obj and src/debug/wingui.obj differ
Binary files origsrc/debug/zipinfo.obj and src/debug/zipinfo.obj differ
diff -urP origsrc/extract.c src/extract.c
--- origsrc/extract.c Tue Oct 21 12:42:32 1997
+++ src/extract.c Sun Oct 11 14:28:08 1998
@@ -758,7 +758,11 @@
break;
}
if (query) {
-#ifdef WINDLL
+#if defined(WIN32) && defined(GUI)
+ /* Replace None */
+ G.overwrite_none = TRUE;
+ G.overwrite_all = FALSE; /* make sure */
+#elif defined(WINDLL)
switch (G.replace != NULL ?
(*G.replace)(G.filename) : IDM_REPLACE_NONE) {
case IDM_REPLACE_RENAME:
diff -urP origsrc/fileio.c src/fileio.c
--- origsrc/fileio.c Sun Oct 12 12:01:38 1997
+++ src/fileio.c Sun Oct 11 02:46:06 1998
@@ -38,8 +38,6 @@
zfstrcpy() (SMALL_MEM only)
---------------------------------------------------------------------------*/
-
-
#define FILEIO_C
#define UNZIP_INTERNAL
#include "unzip.h"
@@ -49,6 +47,11 @@
#include "crypt.h"
#include "ttyio.h"
+#if defined(GUI) && defined(WIN32)
+# include "wingui.h"
+#endif
+
+
/* setup of codepage conversion for decryption passwords */
#if CRYPT
# if (defined(CRYP_USES_ISO2OEM) && !defined(IZ_ISO2OEM_ARRAY))
@@ -971,7 +974,9 @@
To turn off *all* messages, use the UzpMessageNull() function instead
of this one.
---------------------------------------------------------------------------*/
-
+#if defined(GUI) && defined(WIN32)
+ return WinGuiUzpMessagePrnt(pG,buf,size,flag);
+#endif
#if (defined(OS2) && defined(DLL))
if (MSG_NO_DLL2(flag)) /* if OS/2 DLL bit is set, do NOT print this msg */
return 0;
@@ -1214,6 +1219,9 @@
/* tell picky compilers to shut up about "unused variable" warnings */
pG = pG;
+#if defined(GUI) && defined(WIN32)
+ return WinGuiUzpPassword (pG, rcnt, pwbuf, size, zfn, efn);
+#endif
if (*rcnt == 0) { /* First call for current entry */
*rcnt = 2;
diff -urP origsrc/readme.cr src/readme.cr
--- origsrc/readme.cr Wed Dec 31 19:00:00 1969
+++ src/readme.cr Thu Oct 16 15:58:10 1997
@@ -0,0 +1,103 @@
+__________________________________________________________________________
+
+ This is the Info-ZIP README.CR for zcrypt27.zip, last updated 16 Oct 97.
+__________________________________________________________________________
+
+
+The files described below contain the encryption code for Zip 2.2 and
+UnZip 5.3 (and later). They constitute only an add-on to the exportable
+versions (generally named zip22.zip and unzip53.tar.Z) and cannot be
+used without the complete Zip or UnZip packages.
+
+This encryption code is not copyrighted and is put in the public domain.
+It was originally written in Europe and can be freely distributed from
+any country except the U.S.A. If this code is imported into the US, it
+cannot be re-exported from the US to another country. (This restriction
+might seem curious but this is what US law requires.) However, Phil Katz
+has said that he got an export license for his algorithm, so this hassle
+of separate distribution may cease one day.
+
+ LIKE ANYTHING ELSE THAT IS FREE, ZIP, UNZIP AND THEIR ASSOCIATED
+ UTILITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND,
+ EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE AUTHORS BE LIABLE
+ FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE.
+
+The encryption code is a direct transcription of the algorithm from
+Roger Schlafly, described by Phil Katz in the file appnote.txt. This
+file is distributed with the PKZIP program (even in the version without
+encryption capabilities). Note that the encryption will probably resist
+attacks by amateurs if the password is well chosen and long enough (at
+least 8 characters) but it will probably not resist attacks by experts.
+Paul Kocher has made available information concerning a known-plaintext
+attack for the PKWARE encryption scheme; see http://www.cryptography.com/
+for details.) Short passwords consisting of lowercase letters only can be
+recovered in a few hours on any workstation. But for casual cryptography
+designed to keep your mother from reading your mail, it's OK.
+
+For more serious encryption, check into PGP (Pretty Good Privacy), a
+public-key-based encryption system available from various Internet sites.
+PGP has Zip and UnZip built into it. The most recent version at the time
+this was written was 5.0, although the previous 2.6.2 release (and 2.6.3i
+for non-US users) still seems to be in greater use.
+
+Zip 2.2x and UnZip 5.3x are compatible with PKZIP 2.04g. (Thanks to Phil
+Katz for accepting our suggested minor changes to the zipfile format.)
+
+IMPORTANT NOTE:
+
+ Zip archives produced by Zip 2.0 or later must not be *updated* by
+ Zip 1.1 or PKZIP 1.10 or PKZIP 1.93a, if they contain encrypted members
+ or if they have been produced in a pipe or on a non-seekable device.
+ The old versions of Zip or PKZIP would destroy the zip structure. The
+ old versions can list the contents of the zipfile but cannot extract
+ it anyway (because of the new compression algorithm). If you do not
+ use encryption and compress regular disk files, you need not worry about
+ this problem.
+
+
+Contents:
+
+ file what it is
+ ---- ----------
+ README.CR this file
+ WHERE where Zip/UnZip and related utilities can be found
+ crypt.c code for encryption and decryption (for Zip and UnZip)
+ crypt.h code for encryption and decryption (for Zip and UnZip)
+ file_id.diz description file for some BBSes
+
+All of the files are in Unix (LF only) format. On MSDOS systems, you
+can use the -a option of UnZip to convert the source files to CRLF
+format. This is only necessary if you wish to edit the files -- they
+will compile as is with Microsoft C and Turbo/Borland C++ 1.0 or
+later. However, you will have to convert the files (using "unzip -a")
+to the CRLF format to compile with the older Turbo C 1.0 or 2.0. You
+should be able to find Zip and UnZip in the same place you found this
+(see http://www.cdrom.com/pub/infozip/ or the file "WHERE" for details).
+
+To use the zcrypt sources:
+
+ (1) Get the main sources (e.g., Zip 2.2 or UnZip 5.32) and unpack into
+ a working directory, as usual.
+
+ (2) Overwrite the dummy crypt.c and crypt.h from the main sources with
+ the versions from this package. If you want to overwrite directly
+ out of the zcrypt27 archive, do not use UnZip's freshen/updating
+ option; the dummy files may be newer than the real sources in
+ zcrypt27. ("unzip -o zcrypt27 -d /your/working/dir -x WHERE" will
+ do the Right Thing without overwriting the existing WHERE file, which
+ is likely to be the same or newer in the Zip and UnZip distributions.)
+
+ (3) Read the main INSTALL document and compile normally! No makefile
+ changes are necessary on account of the zcrypt sources. You can
+ check that the version you just compiled has encryption or decryption
+ support enabled by typing "zip -v" or "unzip -v" and verifying that
+ the last "special compilation option" says encryption or decryption
+ is included.
+
+Encryption enables new "-e" and "-P password" options in Zip, and a new
+"-P password" option in UnZip--see the normal Zip and UnZip documentation
+for details. (Note that passing a plaintext password on the command line
+is potentially much more insecure than being prompted for it interactively,
+which is the default for UnZip and for Zip with "-e". Also note that the
+interactive method allows UnZip to deal with archives that use different
+passwords for different files.)
Binary files origsrc/release/aiueo.exe and src/release/aiueo.exe differ
Binary files origsrc/release/aiueo.zip and src/release/aiueo.zip differ
Binary files origsrc/release/apihelp.obj and src/release/apihelp.obj differ
Binary files origsrc/release/crc32.obj and src/release/crc32.obj differ
Binary files origsrc/release/crctab.obj and src/release/crctab.obj differ
Binary files origsrc/release/crypt/a.exe and src/release/crypt/a.exe differ
Binary files origsrc/release/crypt/a.zip and src/release/crypt/a.zip differ
diff -urP origsrc/release/crypt/aiueo.txt src/release/crypt/aiueo.txt
--- origsrc/release/crypt/aiueo.txt Wed Dec 31 19:00:00 1969
+++ src/release/crypt/aiueo.txt Sun Oct 11 00:40:58 1998
@@ -0,0 +1 @@
+aiueo
Binary files origsrc/release/crypt.obj and src/release/crypt.obj differ
Binary files origsrc/release/envargs.obj and src/release/envargs.obj differ
Binary files origsrc/release/explode.obj and src/release/explode.obj differ
Binary files origsrc/release/extract.obj and src/release/extract.obj differ
Binary files origsrc/release/fileio.obj and src/release/fileio.obj differ
Binary files origsrc/release/globals.obj and src/release/globals.obj differ
Binary files origsrc/release/inflate.obj and src/release/inflate.obj differ
Binary files origsrc/release/match.obj and src/release/match.obj differ
Binary files origsrc/release/nt.obj and src/release/nt.obj differ
Binary files origsrc/release/process.obj and src/release/process.obj differ
Binary files origsrc/release/ttyio.obj and src/release/ttyio.obj differ
Binary files origsrc/release/unreduce.obj and src/release/unreduce.obj differ
Binary files origsrc/release/unshrink.obj and src/release/unshrink.obj differ
Binary files origsrc/release/unzip.obj and src/release/unzip.obj differ
Binary files origsrc/release/unzipsfx.exe and src/release/unzipsfx.exe differ
Binary files origsrc/release/unzipsfx.pch and src/release/unzipsfx.pch differ
Binary files origsrc/release/unzipsfx.res and src/release/unzipsfx.res differ
diff -urP origsrc/release/vc50.idb src/release/vc50.idb
--- origsrc/release/vc50.idb Wed Dec 31 19:00:00 1969
+++ src/release/vc50.idb Sun Oct 11 14:28:12 1998
@@ -0,0 +1 @@
+Microsoft C/C++ program database 2.00
Binary files origsrc/release/win32.obj and src/release/win32.obj differ
Binary files origsrc/release/wingui.obj and src/release/wingui.obj differ
Binary files origsrc/release/zipinfo.obj and src/release/zipinfo.obj differ
diff -urP origsrc/resource.h src/resource.h
--- origsrc/resource.h Wed Dec 31 19:00:00 1969
+++ src/resource.h Sun Oct 11 14:24:52 1998
@@ -0,0 +1,23 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by unzipsfx.rc
+//
+#define IDD_DIALOG_LOG 101
+#define IDD_DIALOG_PASSWORD 102
+#define IDD_DIALOG_FOLDER 103
+#define IDC_EDIT_LOG 1000
+#define IDC_EDIT_PASSWORD 1001
+#define IDC_EDIT_ARCHIVE 1002
+#define IDC_EDIT_EXTRACTING 1003
+#define IDC_EDIT_FOLDER 1004
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1010
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff -urP origsrc/unzip.c src/unzip.c
--- origsrc/unzip.c Sun Oct 19 06:54:26 1997
+++ src/unzip.c Sun Oct 11 03:55:34 1998
@@ -482,16 +482,85 @@
/* main() / UzpMain() stub */
/*****************************/
+#if defined(GUI) && defined(WIN32)
+#include <windows.h>
+#include "resource.h"
+
+BOOL CALLBACK FolderDialogFunc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ int ret;
+ char *p;
+ char folder[1000];
+
+ switch(msg){
+ case WM_INITDIALOG:
+ GetModuleFileName(GetModuleHandle(NULL),folder,1000);
+ if((p=strrchr(folder,'\\'))){
+ *(p+1)='\0';
+ }
+ SetDlgItemText(hwnd,IDC_EDIT_FOLDER,folder);
+ return 1;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)){
+ case IDOK:
+ GetDlgItemText(hwnd,IDC_EDIT_FOLDER,folder,1000);
+ if(chdir(folder)==-1){
+ char buf[1000];
+ sprintf(buf,"Can't change directory to[%s]. Make directory?",folder);
+ ret = MessageBox(hwnd,buf,"UNZIPSFX",MB_YESNO);
+ if(ret==IDYES){
+ if(mkdir(folder)==-1){
+ MessageBox(hwnd,"Can't make directory","UNZIPSFX",0);
+ exit(1);
+ }
+ if(chdir(folder)==-1){
+ MessageBox(hwnd,"Can't change directory","UNZIPSFX",0);
+ exit(1);
+ }
+ }else{
+ exit(1);
+ }
+ }
+ EndDialog(hwnd,0);
+ return 1;
+ case IDCANCEL:
+ SendMessage(hwnd,WM_CLOSE,0,0);
+ return 1;
+ }
+ break;
+ case WM_CLOSE:
+ ret = MessageBox(hwnd,"Abort Really?","UNZIPSFX",MB_YESNO);
+ if(ret==IDYES){
+ exit(1);
+ }
+ break;
+ }
+ return 0;
+}
+int WINAPI WinMain(HANDLE hInst,HANDLE hPrev,char *cmd,int mode)
+{
+ int argc=1;
+ char *argv[2];
+ char progname[1000];
+
+ GetModuleFileName(GetModuleHandle(NULL),progname,1000);
+ argv[0]=progname;
+ argv[1]=NULL;
+ DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG_FOLDER),0,FolderDialogFunc);
+#else
int MAIN(argc, argv) /* return PK-type error code (except under VMS) */
int argc;
char *argv[];
{
- int r;
+#endif
+ {
+ int r;
- CONSTRUCTGLOBALS();
- r = unzip(__G__ argc, argv);
- DESTROYGLOBALS()
- RETURN(r);
+ CONSTRUCTGLOBALS();
+ r = unzip(__G__ argc, argv);
+ DESTROYGLOBALS()
+ RETURN(r);
+ }
}
Binary files origsrc/unzipsfx.aps and src/unzipsfx.aps differ
diff -urP origsrc/unzipsfx.dsp src/unzipsfx.dsp
--- origsrc/unzipsfx.dsp Wed Dec 31 19:00:00 1969
+++ src/unzipsfx.dsp Sun Oct 11 04:02:22 1998
@@ -0,0 +1,211 @@
+# Microsoft Developer Studio Project File - Name="unzipsfx" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** 編集しないでください **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=unzipsfx - Win32 Debug
+!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。
+!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください
+!MESSAGE
+!MESSAGE NMAKE /f "unzipsfx.mak".
+!MESSAGE
+!MESSAGE NMAKE の実行時に構成を指定できます
+!MESSAGE コマンド ライン上でマクロの設定を定義します。例:
+!MESSAGE
+!MESSAGE NMAKE /f "unzipsfx.mak" CFG="unzipsfx - Win32 Debug"
+!MESSAGE
+!MESSAGE 選択可能なビルド モード:
+!MESSAGE
+!MESSAGE "unzipsfx - Win32 Release" ("Win32 (x86) Console Application" 用)
+!MESSAGE "unzipsfx - Win32 Debug" ("Win32 (x86) Console Application" 用)
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "unzipsfx - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I ".." /I "." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "SFX" /D "CRYPT" /D "GUI" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x411 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "unzipsfx - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I ".." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "SFX" /D "CRYPT" /D "GUI" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "unzipsfx - Win32 Release"
+# Name "unzipsfx - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\consts.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\crc32.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\crctab.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\crypt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\crypt.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ebcdic.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\extract.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\fileio.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\globals.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\globals.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inflate.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\inflate.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\match.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\win32\nt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\win32\nt.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\process.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\win32\rsxntwin.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\tables.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ttyio.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ttyio.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\unreduce.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unzip.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unzip.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Unzipsfx.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\unzpriv.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\win32\w32cfg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\win32\win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\wingui.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\wingui.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\zip.h
+# End Source File
+# End Target
+# End Project
diff -urP origsrc/unzipsfx.dsw src/unzipsfx.dsw
--- origsrc/unzipsfx.dsw Wed Dec 31 19:00:00 1969
+++ src/unzipsfx.dsw Sat Oct 10 22:33:10 1998
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# 警告: このワークスペース ファイル を編集または削除しないでください!
+
+###############################################################################
+
+Project: "unzipsfx"=.\unzipsfx.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff -urP origsrc/unzipsfx.ncb src/unzipsfx.ncb
--- origsrc/unzipsfx.ncb Wed Dec 31 19:00:00 1969
+++ src/unzipsfx.ncb Sun Oct 11 14:28:32 1998
@@ -0,0 +1 @@
+Microsoft C/C++ program database 2.00
diff -urP origsrc/unzipsfx.opt src/unzipsfx.opt
--- origsrc/unzipsfx.opt Wed Dec 31 19:00:00 1969
+++ src/unzipsfx.opt Sun Oct 11 14:28:34 1998
@@ -0,0 +1 @@
+ミマ爍ア
\ No newline at end of file
diff -urP origsrc/unzipsfx.plg src/unzipsfx.plg
--- origsrc/unzipsfx.plg Wed Dec 31 19:00:00 1969
+++ src/unzipsfx.plg Sun Oct 11 14:28:12 1998
@@ -0,0 +1,43 @@
+--------------------構成: unzipsfx - Win32 Release--------------------
+Begining build with project "C:\Home\Lang\Vc5\unzip\src\unzipsfx.dsp", at root.
+Active configuration is Win32 (x86) Console Application (based on Win32 (x86) Console Application)
+
+Project's tools are:
+ "32-bit C/C++ Compiler for 80x86" with flags "/nologo /ML /W3 /GX /O2 /I ".." /I "." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "SFX" /D "CRYPT" /D "GUI" /Fp"Release/unzipsfx.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c "
+ "Win32 Resource Compiler" with flags "/l 0x411 /fo"Release/Unzipsfx.res" /d "NDEBUG" "
+ "Browser Database Maker" with flags "/nologo /o"Release/unzipsfx.bsc" "
+ "COFF Linker for 80x86" with flags "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/unzipsfx.pdb" /machine:I386 /out:"Release/unzipsfx.exe" "
+ "カスタム ビルド" with flags ""
+ "<Component 0xa>" with flags ""
+
+Creating temp file "C:\TMP\RSPC075.TMP" with contents </nologo /ML /W3 /GX /O2 /I ".." /I "." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "SFX" /D "CRYPT" /D "GUI" /Fp"Release/unzipsfx.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
+"C:\Home\Lang\Vc5\unzip\src\extract.c"
+>
+Creating command line "cl.exe @C:\TMP\RSPC075.TMP"
+Creating temp file "C:\TMP\RSPC076.TMP" with contents <kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/unzipsfx.pdb" /machine:I386 /out:"Release/unzipsfx.exe"
+.\Release\crc32.obj
+.\Release\crctab.obj
+.\Release\crypt.obj
+.\Release\extract.obj
+.\Release\fileio.obj
+.\Release\globals.obj
+.\Release\inflate.obj
+.\Release\match.obj
+.\Release\nt.obj
+.\Release\process.obj
+.\Release\ttyio.obj
+.\Release\unreduce.obj
+.\Release\unzip.obj
+.\Release\win32.obj
+.\Release\wingui.obj
+.\Release\Unzipsfx.res>
+Creating command line "link.exe @C:\TMP\RSPC076.TMP"
+コンパイル中...
+extract.c
+C:\Home\Lang\Vc5\unzip\src\extract.c(1074) : warning C4102: 'startover' : ラベルは 1 度も参照されません。
+C:\Home\Lang\Vc5\unzip\src\extract.c(1074) : warning C4101: 'len' : ローカル変数は 1 度も使われません。
+リンク中...
+
+
+
+unzipsfx.exe - エラー 0、警告 2
diff -urP origsrc/unzipsfx.rc src/unzipsfx.rc
--- origsrc/unzipsfx.rc Wed Dec 31 19:00:00 1969
+++ src/unzipsfx.rc Sun Oct 11 14:24:52 1998
@@ -0,0 +1,147 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// 日本語 resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_DIALOG_LOG DIALOG DISCARDABLE 0, 0, 235, 179
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "UNZIPSFX(WIN32/GUI)"
+FONT 9, "MS Pゴシック"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,60,165,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,120,165,50,14
+ EDITTEXT IDC_EDIT_LOG,5,5,225,155,ES_MULTILINE | ES_AUTOVSCROLL |
+ ES_WANTRETURN | WS_VSCROLL
+END
+
+IDD_DIALOG_PASSWORD DIALOG DISCARDABLE 0, 0, 275, 69
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "UNZIPSFX(WIN32/GUI)"
+FONT 9, "MS Pゴシック"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,225,40,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,225,55,50,14
+ EDITTEXT IDC_EDIT_PASSWORD,35,40,185,12,ES_PASSWORD |
+ ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT_ARCHIVE,35,5,185,12,ES_AUTOHSCROLL |
+ ES_READONLY
+ LTEXT "Archive:",IDC_STATIC,0,5,30,10
+ LTEXT "Extracting:",IDC_STATIC,0,20,30,10
+ EDITTEXT IDC_EDIT_EXTRACTING,35,20,185,12,ES_AUTOHSCROLL |
+ ES_READONLY
+ LTEXT "Password:",IDC_STATIC,0,40,30,15
+END
+
+IDD_DIALOG_FOLDER DIALOG DISCARDABLE 0, 0, 234, 79
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "UNZIPSFX(WIN32/GUI)"
+FONT 9, "MS Pゴシック"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,180,40,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,180,60,50,14
+ EDITTEXT IDC_EDIT_FOLDER,5,20,225,15,ES_AUTOHSCROLL
+ LTEXT "Extract Folder:",IDC_STATIC,5,5,45,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_DIALOG_LOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 228
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 172
+ END
+
+ IDD_DIALOG_PASSWORD, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 268
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 62
+ END
+
+ IDD_DIALOG_FOLDER, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 227
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 72
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // 日本語 resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff -urP origsrc/wingui.c src/wingui.c
--- origsrc/wingui.c Wed Dec 31 19:00:00 1969
+++ src/wingui.c Sun Oct 11 03:32:00 1998
@@ -0,0 +1,121 @@
+/*
+ wingui.c
+*/
+
+#include "wingui.h"
+#include "resource.h"
+#include <windows.h>
+#include <process.h>
+
+HWND LogDialogHwnd = NULL;
+HANDLE LogDialogEvent = NULL;
+HANDLE LogThread = 0;
+
+BOOL CALLBACK LogDialogFunc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ int ret;
+
+ switch(msg){
+ case WM_INITDIALOG:
+ LogDialogHwnd = hwnd;
+ SetEvent(LogDialogEvent);
+ return 1;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)){
+ case IDCANCEL:
+ SendMessage(hwnd,WM_CLOSE,0,0);
+ return 1;
+ }
+ break;
+ case WM_CLOSE:
+ ret = MessageBox(hwnd,"Abort Really?","UNZIPSFX",MB_YESNO);
+ if(ret==IDYES){
+ exit(1);
+ }
+ }
+ return 0;
+}
+DWORD WINAPI LogThreadFunc(void *dummy)
+{
+ int ret;
+
+ HINSTANCE hInst = GetModuleHandle(NULL);
+ ret = DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG_LOG),NULL,LogDialogFunc);
+ return 0;
+}
+int UZ_EXP WinGuiUzpMessagePrnt(zvoid *pG,uch *buf,ulg size,int flag)
+{
+ DWORD threadid;
+ if(LogThread == 0){
+ LogDialogEvent = CreateEvent(NULL,0,0,NULL);
+ //LogThread = _beginthread(LogThreadFunc,0,NULL);
+
+ LogThread = CreateThread(NULL,0,LogThreadFunc,0,0,&threadid);
+
+ WaitForSingleObject(LogDialogEvent,INFINITE);
+ CloseHandle(LogDialogEvent);
+ }
+ if(LogDialogHwnd){
+ char buf2[1000];
+ char *ptr=buf,*ptr2=buf2;
+ while(*ptr){
+ if(*ptr=='\n'){*ptr2++='\r';}
+ *ptr2++ = *ptr++;
+ }
+ *ptr2='\0';
+ SendDlgItemMessage(LogDialogHwnd,IDC_EDIT_LOG,EM_REPLACESEL,1,(DWORD)buf2);
+ //SendDlgItemMessage(LogDialogHwnd,IDC_EDIT_LOG,EM_FMTLINES,TRUE,0);
+ }
+ return 0;
+}
+typedef struct PasswordDialogStruct
+{
+ zvoid *pG;int *rcnt;char *pwbuf;int size;ZCONST char *zfn;char *efn;
+}PasswordDialogStruct;
+
+PasswordDialogStruct *s;
+BOOL CALLBACK PasswordDialogFunc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ int ret;
+
+ switch(msg){
+ case WM_INITDIALOG:
+ s = (PasswordDialogStruct*)lParam;
+ SetDlgItemText(hwnd,IDC_EDIT_ARCHIVE,s->zfn);
+ SetDlgItemText(hwnd,IDC_EDIT_EXTRACTING,s->zfn);
+ return 1;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)){
+ case IDOK:
+ GetDlgItemText(hwnd,IDC_EDIT_PASSWORD,s->pwbuf,s->size);
+ EndDialog(hwnd,IZ_PW_ENTERED/*0*/);
+ return 1;
+ case IDCANCEL:
+ EndDialog(hwnd,IZ_PW_CANCEL/*-1*/);
+ return 1;
+ break;
+ }
+ break;
+ case WM_CLOSE:
+ ret = MessageBox(hwnd,"Abort Really?","UNZIPSFX",MB_YESNO);
+ if(ret==IDYES){
+ exit(1);
+ }
+ break;
+ }
+ return 0;
+}
+int UZ_EXP WinGuiUzpPassword(zvoid *pG,int *rcnt,char *pwbuf,int size,ZCONST char *zfn,ZCONST char *efn)
+{
+ int ret;
+ HMODULE hInst = GetModuleHandle(NULL);
+ PasswordDialogStruct s = {pG,rcnt,pwbuf,size,zfn,efn};
+
+ if(*rcnt==0){*rcnt=2;}else{(*rcnt)--;}
+ ret = DialogBoxParam(hInst
+ ,MAKEINTRESOURCE(IDD_DIALOG_PASSWORD)
+ ,NULL
+ ,PasswordDialogFunc
+ ,(DWORD)&s);
+ return 0;
+}
diff -urP origsrc/wingui.h src/wingui.h
--- origsrc/wingui.h Wed Dec 31 19:00:00 1969
+++ src/wingui.h Sun Oct 11 02:48:30 1998
@@ -0,0 +1,9 @@
+/*
+ wingui.h
+*/
+#include "unzip.h"
+
+int UZ_EXP WinGuiUzpMessagePrnt(zvoid *pG,uch *buf,ulg size,int flag);
+int UZ_EXP WinGuiUzpPassword(zvoid *pG,int *rcnt,char *pwbuf,int size,ZCONST char *zfn,ZCONST char *efn);
+
+
Binary files origsrc/zcrypt27.zip and src/zcrypt27.zip differ