"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "c-headers/win32/osdep.h" of archive zip232dN.zip:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /*
    2   Copyright (c) 1990-2006 Info-ZIP.  All rights reserved.
    3 
    4   See the accompanying file LICENSE, version 2004-May-22 or later
    5   (the contents of which are also included in zip.h) for terms of use.
    6   If, for some reason, both of these files are missing, the Info-ZIP license
    7   also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
    8 */
    9 
   10 /* Automatic setting of the common Microsoft C idenfifier MSC.
   11  * NOTE: Watcom also defines M_I*86 !
   12  */
   13 #if defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__))
   14 #  ifndef MSC
   15 #    define MSC                 /* This should work for older MSC, too!  */
   16 #  endif
   17 #endif
   18 
   19 /* Tell Microsoft Visual C++ 2005 to leave us alone and
   20  * let us use standard C functions the way we're supposed to.
   21  */
   22 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
   23 #  ifndef _CRT_SECURE_NO_DEPRECATE
   24 #    define _CRT_SECURE_NO_DEPRECATE
   25 #  endif
   26 #  ifndef _CRT_NONSTDC_NO_DEPRECATE
   27 #    define _CRT_NONSTDC_NO_DEPRECATE
   28 #  endif
   29 #endif
   30 
   31 #if defined(__WATCOMC__) && defined(__386__)
   32 #  define WATCOMC_386
   33 #endif
   34 
   35 #if (defined(__CYGWIN32__) && !defined(__CYGWIN__))
   36 #  define __CYGWIN__            /* compatibility for CygWin B19 and older */
   37 #endif
   38 
   39 /* enable multibyte character set support by default */
   40 #ifndef _MBCS
   41 #  define _MBCS
   42 #endif
   43 #if defined(__CYGWIN__)
   44 #  undef _MBCS
   45 #endif
   46 
   47 #ifndef MSDOS
   48 /*
   49  * Windows 95 (and Windows NT) file systems are (to some extend)
   50  * extensions of MSDOS. Common features include for example:
   51  *      FAT or (FAT like) file systems,
   52  *      '\\' as directory separator in paths,
   53  *      "\r\n" as record (line) terminator in text files, ...
   54  */
   55 #  define MSDOS
   56 /* inherit MS-DOS file system etc. stuff */
   57 #endif
   58 
   59 #define USE_CASE_MAP
   60 #define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \
   61                      procname(n, 1))
   62 #define BROKEN_FSEEK
   63 #ifndef __RSXNT__
   64 #  define HAVE_FSEEKABLE
   65 #endif
   66 
   67 /* File operations--use "b" for binary if allowed or fixed length 512 on VMS
   68  *                  use "S" for sequential access on NT to prevent the NT
   69  *                  file cache eating up memory with large .zip files
   70  */
   71 #define FOPR "rb"
   72 #define FOPM "r+b"
   73 #define FOPW "wbS"
   74 
   75 #if (defined(__CYGWIN__) && !defined(NO_MKTIME))
   76 #  define NO_MKTIME             /* Cygnus' mktime() implementation is buggy */
   77 #endif
   78 #if (!defined(NT_TZBUG_WORKAROUND) && !defined(NO_NT_TZBUG_WORKAROUND))
   79 #  define NT_TZBUG_WORKAROUND
   80 #endif
   81 #if (defined(UTIL) && defined(NT_TZBUG_WORKAROUND))
   82 #  undef NT_TZBUG_WORKAROUND    /* the Zip utilities do not use time-stamps */
   83 #endif
   84 #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
   85 #  define USE_EF_UT_TIME
   86 #endif
   87 #if (!defined(NO_NTSD_EAS) && !defined(NTSD_EAS))
   88 #  define NTSD_EAS
   89 #endif
   90 
   91 #if (defined(NTSD_EAS) && !defined(ZP_NEED_MEMCOMPR))
   92 #  define ZP_NEED_MEMCOMPR
   93 #endif
   94 
   95 #ifdef WINDLL
   96 # ifndef NO_ASM
   97 #   define NO_ASM
   98 # endif
   99 # ifndef MSWIN
  100 #   define MSWIN
  101 # endif
  102 # ifndef REENTRANT
  103 #   define REENTRANT
  104 # endif
  105 #endif /* WINDLL */
  106 
  107 /* Enable use of optimized x86 assembler version of longest_match() for
  108    MSDOS, WIN32 and OS2 per default.  */
  109 #if !defined(NO_ASM) && !defined(ASMV)
  110 #  define ASMV
  111 #endif
  112 
  113 /* Enable use of optimized x86 assembler version of crc32() for
  114    MSDOS, WIN32 and OS2 per default.  */
  115 #if !defined(NO_ASM) && !defined(ASM_CRC)  && !defined(NO_ASM_CRC)
  116 #  define ASM_CRC
  117 #endif
  118 
  119 #if !defined(__GO32__) && !defined(__EMX__) && !defined(__CYGWIN__)
  120 #  define NO_UNISTD_H
  121 #endif
  122 
  123 /* the following definitions are considered as "obsolete" by Microsoft and
  124  * might be missing in some versions of <windows.h>
  125  */
  126 #ifndef AnsiToOem
  127 #  define AnsiToOem CharToOemA
  128 #endif
  129 #ifndef OemToAnsi
  130 #  define OemToAnsi OemToCharA
  131 #endif
  132 
  133 #if (defined(__RSXNT__) && defined(__CRTRSXNT__))
  134 #  include <crtrsxnt.h>
  135 #endif
  136 
  137 /* Get types and stat */
  138 #include <sys/types.h>
  139 #include <sys/stat.h>
  140 #include <io.h>
  141 #ifdef _MBCS
  142 #  if (!defined(__EMX__) && !defined(__MINGW32__) && !defined(__CYGWIN__))
  143 #    include <stdlib.h>
  144 #    include <mbstring.h>
  145 #  endif
  146 #  if (defined(__MINGW32__) && !defined(MB_CUR_MAX))
  147 #    ifdef __MSVCRT__
  148        extern int *__p___mb_cur_max(void);
  149 #      define MB_CUR_MAX (*__p___mb_cur_max())
  150 #    else
  151        extern int *_imp____mb_cur_max_dll;
  152 #      define MB_CUR_MAX (*_imp____mb_cur_max_dll)
  153 #    endif
  154 #  endif
  155 #  if (defined(__LCC__) && !defined(MB_CUR_MAX))
  156      extern int *_imp____mb_cur_max;
  157 #    define MB_CUR_MAX (*_imp____mb_cur_max)
  158 #  endif
  159 #endif
  160 
  161 #ifdef __LCC__
  162 #  include <time.h>
  163 #  ifndef tzset
  164 #    define tzset _tzset
  165 #  endif
  166 #  ifndef utime
  167 #    define utime _utime
  168 #  endif
  169 #endif
  170 #ifdef __MINGW32__
  171    extern void _tzset(void);            /* this is missing in <time.h> */
  172 #  ifndef tzset
  173 #    define tzset _tzset
  174 #  endif
  175 #endif
  176 #if (defined(__RSXNT__) || defined(__EMX__)) && !defined(tzset)
  177 #  define tzset _tzset
  178 #endif
  179 #ifdef W32_USE_IZ_TIMEZONE
  180 #  ifdef __BORLANDC__
  181 #    define tzname tzname
  182 #    define IZTZ_DEFINESTDGLOBALS
  183 #  endif
  184 #  ifndef tzset
  185 #    define tzset _tzset
  186 #  endif
  187 #  ifndef timezone
  188 #    define timezone _timezone
  189 #  endif
  190 #  ifndef daylight
  191 #    define daylight _daylight
  192 #  endif
  193 #  ifndef tzname
  194 #    define tzname _tzname
  195 #  endif
  196 #  if (!defined(NEED__ISINDST) && !defined(__BORLANDC__))
  197 #    define NEED__ISINDST
  198 #  endif
  199 #  ifdef IZTZ_GETLOCALETZINFO
  200 #    undef IZTZ_GETLOCALETZINFO
  201 #  endif
  202 #  define IZTZ_GETLOCALETZINFO GetPlatformLocalTimezone
  203 #endif /* W32_USE_IZ_TIMEZONE */
  204 
  205 #ifdef MATCH
  206 #  undef MATCH
  207 #endif
  208 #define MATCH dosmatch          /* use DOS style wildcard matching */
  209 
  210 #ifdef ZCRYPT_INTERNAL
  211 #  ifdef WINDLL
  212 #    define ZCR_SEED2     (unsigned)3141592654L /* use PI as seed pattern */
  213 #  else
  214 #    include <process.h>        /* getpid() declaration for srand seed */
  215 #  endif
  216 #endif
  217 
  218 /* Up to now, all versions of Microsoft C runtime libraries lack the support
  219  * for customized (non-US) switching rules between daylight saving time and
  220  * standard time in the TZ environment variable string.
  221  * But non-US timezone rules are correctly supported when timezone information
  222  * is read from the OS system settings in the Win32 registry.
  223  * The following work-around deletes any TZ environment setting from
  224  * the process environment.  This results in a fallback of the RTL time
  225  * handling code to the (correctly interpretable) OS system settings, read
  226  * from the registry.
  227  */
  228 #ifdef USE_EF_UT_TIME
  229 # if (defined(__WATCOMC__) || defined(__CYGWIN__) || \
  230       defined(W32_USE_IZ_TIMEZONE))
  231 #   define iz_w32_prepareTZenv()
  232 # else
  233 #   define iz_w32_prepareTZenv()        putenv("TZ=")
  234 # endif
  235 #endif
  236 
  237 /* This patch of stat() is useful for at least three compilers.  It is   */
  238 /* difficult to take a stat() of a root directory under Windows95, so  */
  239 /* zstat_zipwin32() detects that case and fills in suitable values.    */
  240 #ifndef __RSXNT__
  241 #  ifndef W32_STATROOT_FIX
  242 #    define W32_STATROOT_FIX
  243 #  endif
  244 #endif /* !__RSXNT__ */
  245 
  246 #if (defined(NT_TZBUG_WORKAROUND) || defined(W32_STATROOT_FIX))
  247 #  define W32_STAT_BANDAID
  248    int zstat_zipwin32(const char *path, struct stat *buf);
  249 #  ifdef SSTAT
  250 #    undef SSTAT
  251 #  endif
  252 #  define SSTAT zstat_zipwin32
  253 #endif /* NT_TZBUG_WORKAROUND || W32_STATROOT_FIX */
  254 
  255 int getch_win32(void);
  256 
  257 #ifdef __GNUC__
  258 # define IZ_PACKED      __attribute__((packed))
  259 #else
  260 # define IZ_PACKED
  261 #endif
  262 
  263 /* for some (all ?) versions of IBM C Set/2 and IBM C Set++ */
  264 #ifndef S_IFMT
  265 #  define S_IFMT 0xF000
  266 #endif /* !S_IFMT */
  267 
  268 #ifdef __WATCOMC__
  269 #  include <stdio.h>    /* PATH_MAX is defined here */
  270 #  define NO_MKTEMP
  271 
  272 /* Get asm routines to link properly without using "__cdecl": */
  273 #  ifdef __386__
  274 #    ifdef ASMV
  275 #      pragma aux match_init    "_*" parm caller [] modify []
  276 #      pragma aux longest_match "_*" parm caller [] value [eax] \
  277                                       modify [eax ecx edx]
  278 #    endif
  279 #    if defined(ASM_CRC) && !defined(USE_ZLIB)
  280 #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
  281 #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
  282                                       modify [eax ecx edx]
  283 #    endif /* ASM_CRC && !USE_ZLIB */
  284 #  endif /* __386__ */
  285 #endif /* __WATCOMC__ */