2
Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
4
See the accompanying file LICENSE, version 2000-Apr-09 or later
5
(the contents of which are also included in unzip.h) for terms of use.
6
If, for some reason, all these files are missing, the Info-ZIP license
7
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
9
/*---------------------------------------------------------------------------
10
Win32 specific configuration section:
11
---------------------------------------------------------------------------*/
16
#if (defined(__CYGWIN32__) && !defined(__CYGWIN__))
17
# define __CYGWIN__ /* compatibility for CygWin B19 and older */
21
/* Those Idiots at Cygnus have started to set "Unix" identifiers
22
* for a Win32 compiler ...
29
#if (defined(_MSC_VER) && !defined(MSC))
33
/* enable multibyte character set support by default */
37
#if (defined(__CYGWIN__) && defined(_MBCS))
38
# undef _MBCS /* CygWin RTL lacks support for __mb_cur_max */
40
#if (defined(__DJGPP__) && !defined(__EMX__) && defined(_MBCS))
41
# undef _MBCS /* __mb_cur_max missing for RSXNTdj 1.6 beta */
44
#include <sys/types.h> /* off_t, time_t, dev_t, ... */
46
#include <io.h> /* read(), open(), etc. */
48
#if ((defined(__RSXNT__) || defined(__EMX__)) && !defined(tzset))
51
#if (defined(__LCC__) && !defined(tzset))
55
extern void _tzset(void); /* this is missing in <time.h> */
60
#ifdef W32_USE_IZ_TIMEZONE
62
# define tzname tzname
63
# define IZTZ_DEFINESTDGLOBALS
66
# define IZTZ_DEFINESTDGLOBALS
72
# define timezone _timezone
75
# define daylight _daylight
78
# define tzname _tzname
80
# if (!defined(NEED__ISINDST) && !defined(__BORLANDC__))
81
# define NEED__ISINDST
83
# ifdef IZTZ_GETLOCALETZINFO
84
# undef IZTZ_GETLOCALETZINFO
86
# define IZTZ_GETLOCALETZINFO GetPlatformLocalTimezone
87
#endif /* W32_USE_IZ_TIMEZONE */
89
#if (!defined(__RSXNT__) && !defined(__CYGWIN__))
90
# include <direct.h> /* mkdir() */
95
extern int setmode(int, int); /* this is missing in <fcntl.h> */
97
#if (defined(MSC) || defined(__WATCOMC__) || defined(__MINGW32__))
98
# include <sys/utime.h>
105
# if (!defined(__EMX__) && !defined(__MINGW32__) && !defined(__CYGWIN__))
106
# if (!defined(__DJGPP__))
108
# include <mbstring.h>
109
/* for MSC (and compatible compilers), use routines supplied by RTL */
110
# define PREINCSTR(ptr) (ptr = (char *)_mbsinc((const uch *)(ptr)))
111
# define MBSCHR(str, c) (char *)_mbschr((const uch *)(str), (c))
112
# define MBSRCHR(str, c) (char *)_mbsrchr((const uch *)(str), (c))
115
# if (defined(__MINGW32__) && !defined(MB_CUR_MAX))
117
extern int *__p___mb_cur_max(void);
118
# define MB_CUR_MAX (*__p___mb_cur_max())
120
extern int *_imp____mb_cur_max_dll;
121
# define MB_CUR_MAX (*_imp____mb_cur_max_dll)
124
# if (defined(__LCC__) && !defined(MB_CUR_MAX))
125
extern int *_imp____mb_cur_max;
126
# define MB_CUR_MAX (*_imp____mb_cur_max)
128
# if (defined(__DJGPP__) && !defined(__EMX__) && !defined(MB_CUR_MAX))
129
extern int *_imp____mb_cur_max;
130
# define MB_CUR_MAX (*_imp____mb_cur_max)
134
/* for UnZip, the "basic" part of the win32 api is sufficient */
135
#ifndef WIN32_LEAN_AND_MEAN
136
# define WIN32_LEAN_AND_MEAN
139
#if defined(__FILEIO_C)
143
# include <windows.h>
145
# include "../win32/rsxntwin.h"
147
# ifndef TIME_ZONE_ID_INVALID
148
# define TIME_ZONE_ID_INVALID (DWORD)0xFFFFFFFFL
151
#if (defined(__ENVARGS_C) || defined(__EXTRACT_C) || defined(__UNZIP_C) || \
152
defined(ZCRYPT_INTERNAL))
153
# include <windows.h>
155
# include "../win32/rsxntwin.h"
157
# ifndef TIME_ZONE_ID_INVALID
158
# define TIME_ZONE_ID_INVALID (DWORD)0xFFFFFFFFL
162
/* the following definitions are considered as "obsolete" by Microsoft and
163
* might be missing in some versions of <windows.h>
166
# define AnsiToOem CharToOemA
169
# define OemToAnsi OemToCharA
172
#define DIR_END '\\' /* OS uses '\\' as directory separator */
173
#define DIR_END2 '/' /* also check for '/' (RTL may convert) */
177
#define DATE_FORMAT dateformat()
179
#define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);}
181
#if (defined(__RSXNT__) && !defined(HAVE_MKTIME))
182
# define HAVE_MKTIME /* use mktime() in time conversion routines */
184
#if (defined(MSC) && !defined(HAVE_MKTIME))
185
# define HAVE_MKTIME /* use mktime() in time conversion routines */
187
#if (defined(__CYGWIN__) && defined(HAVE_MKTIME))
188
# undef HAVE_MKTIME /* Cygnus' mktime() implementation is buggy */
190
#if (defined(W32_USE_IZ_TIMEZONE) && !defined(HAVE_MKTIME))
191
# define HAVE_MKTIME /* use mktime() in time conversion routines */
193
#if (!defined(NT_TZBUG_WORKAROUND) && !defined(NO_NT_TZBUG_WORKAROUND))
194
# define NT_TZBUG_WORKAROUND
196
#if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
197
# define USE_EF_UT_TIME
199
#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
202
#if (!defined(NO_NTSD_EAS) && !defined(NTSD_EAS))
203
# define NTSD_EAS /* enable NTSD support unless explicitly suppressed */
205
#if (defined(NTSD_EAS) && !defined(RESTORE_ACL))
206
# define RESTORE_ACL /* "restore ACLs" only needed when NTSD_EAS active */
209
/* handlers for OEM <--> ANSI string conversions */
211
/* RSXNT uses OEM coded strings in functions supplied by C RTL */
212
# ifdef CRTL_CP_IS_ISO
213
# undef CRTL_CP_IS_ISO
215
# ifndef CRTL_CP_IS_OEM
216
# define CRTL_CP_IS_OEM
219
/* "real" native WIN32 compilers use ANSI coded strings in C RTL calls */
220
# ifndef CRTL_CP_IS_ISO
221
# define CRTL_CP_IS_ISO
223
# ifdef CRTL_CP_IS_OEM
224
# undef CRTL_CP_IS_OEM
228
#ifdef CRTL_CP_IS_ISO
229
/* C RTL's file system support assumes ANSI coded strings */
230
# define ISO_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));}
231
# define OEM_TO_INTERN(src, dst) OemToAnsi(src, dst)
232
# define INTERN_TO_ISO(src, dst) {if ((src) != (dst)) strcpy((dst), (src));}
233
# define INTERN_TO_OEM(src, dst) AnsiToOem(src, dst)
234
#endif /* CRTL_CP_IS_ISO */
235
#ifdef CRTL_CP_IS_OEM
236
/* C RTL's file system support assumes OEM coded strings */
237
# define ISO_TO_INTERN(src, dst) AnsiToOem(src, dst)
238
# define OEM_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));}
239
# define INTERN_TO_ISO(src, dst) OemToAnsi(src, dst)
240
# define INTERN_TO_OEM(src, dst) {if ((src) != (dst)) strcpy((dst), (src));}
241
#endif /* CRTL_CP_IS_OEM */
242
#define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1)
243
#define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1)
245
/* Despite best intentions, for the command-line version UzpPassword()
246
* could return either character set, depending on whether running under
247
* Win95 (DOS-session) or WinNT (native WinNT command interpreter)! */
248
# define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst)
249
# define STR_TO_CP3(dst, src) (OemToAnsi(src, dst), dst)
251
/* The WINDLL front end is known to supply ISO/ANSI-coded passwords! */
252
# define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst)
254
/* dummy defines to disable these functions, they are not needed */
258
/* Static variables that we have to add to Uz_Globs: */
259
#define SYSTEM_SPECIFIC_GLOBALS \
260
int created_dir, renamed_fullpath, fnlen;\
261
unsigned nLabelDrive;\
262
char lastRootPath[4];\
263
int lastVolOldFAT, lastVolLocTim;\
264
char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
265
ZCONST char *wildname;\
266
char *dirname, matchname[FILNAMSIZ];\
267
int rootlen, have_dirname, dirnamelen, notfirstcall;\
270
/* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by */
271
/* both mapname() and checkdir(). */
272
/* lastRootPath, lastVolOldFAT and lastVolLocTim are used by */
273
/* IsVolumeOldFAT() and NTQueryVolInfo(). */
274
/* rootlen, rootpath, buildpathHPFS, buildpathFAT, endHPFS, and endFAT */
275
/* are used by checkdir(). */
276
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
277
/* and notfirstcall are used by do_wild(). */
279
/* This replacement for C-RTL-supplied getch() (or similar) functionality
280
* avoids leaving unabsorbed LFs in the keyboard buffer under Windows95,
281
* and supports the <ALT>+[0]<digit><digit><digit> feature.
283
int getch_win32 OF((void));
285
/* Up to now, all versions of Microsoft C runtime libraries lack the support
286
* for customized (non-US) switching rules between daylight saving time and
287
* standard time in the TZ environment variable string.
288
* But non-US timezone rules are correctly supported when timezone information
289
* is read from the OS system settings in the Win32 registry.
290
* The following work-around deletes any TZ environment setting from
291
* the process environment. This results in a fallback of the RTL time
292
* handling code to the (correctly interpretable) OS system settings, read
295
#ifdef USE_EF_UT_TIME
296
# if (defined(__WATCOMC__) || defined(W32_USE_IZ_TIMEZONE))
297
# define iz_w32_prepareTZenv()
299
# define iz_w32_prepareTZenv() putenv("TZ=")
303
/* This patch of stat() is useful for at least two compilers. It is */
304
/* difficult to take a stat() of a root directory under Windows95, so */
305
/* zstat_win32() detects that case and fills in suitable values. */
307
# ifndef W32_STATROOT_FIX
308
# define W32_STATROOT_FIX
310
#endif /* !__RSXNT__ */
312
#if (defined(NT_TZBUG_WORKAROUND) || defined(W32_STATROOT_FIX))
313
# define W32_STAT_BANDAID
314
# if (defined(NT_TZBUG_WORKAROUND) && defined(REENTRANT))
315
# define __W32STAT_GLOBALS__ Uz_Globs *pG,
316
# define __W32STAT_G__ pG,
318
# define __W32STAT_GLOBALS__
319
# define __W32STAT_G__
324
# ifdef WILD_STAT_BUG
325
# define SSTAT(path, pbuf) (iswild(path) || zstat_win32(__W32STAT_G__ path, pbuf))
327
# define SSTAT(path, pbuf) zstat_win32(__W32STAT_G__ path, pbuf)
342
/* gaah -- Watcom's docs claim that _get_osfhandle exists, but it doesn't. */
343
# define _get_osfhandle _os_handle
345
/* Get asm routines to link properly without using "__cdecl": */
347
# pragma aux crc32 "_*" parm caller [] value [eax] modify [eax]
348
# pragma aux get_crc_table "_*" parm caller [] value [eax] \
350
# endif /* !USE_ZLIB */
351
# endif /* __386__ */
356
# define PIPE_ERROR (errno == EPIPE)
357
#endif /* __WATCOMC__ */
359
#define SCREENWIDTH 80
360
#define SCREENSIZE(scrrows, scrcols) screensize(scrrows, scrcols)
361
int screensize(int *tt_rows, int *tt_cols);
363
/* on the DOS or NT console screen, line-wraps are always enabled */
364
#define SCREENLWRAP 1
367
#endif /* !__w32cfg_h */