25
#if defined(MODERN) && !defined(NO_STDDEF_H)
25
28
#include "unzvers.h"
27
30
int main(int argc, char *argv[])
29
static UzpVer *pVersion; /* no pervert jokes, please... */
32
static ZCONST UzpVer *pVersion; /* no pervert jokes, please... */
31
34
pVersion = UzpVersion();
33
36
printf("UnZip stub: checking version numbers (DLL is dated %s)\n",
35
printf(" UnZip versions: expecting %d.%d%d, using %d.%d%d%s\n",
38
printf(" UnZip versions: expecting %u.%u%u, using %u.%u%u%s\n",
36
39
UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, pVersion->unzip.major,
37
40
pVersion->unzip.minor, pVersion->unzip.patchlevel, pVersion->betalevel);
38
printf(" ZipInfo versions: expecting %d.%d%d, using %d.%d%d\n",
41
printf(" ZipInfo versions: expecting %u.%u%u, using %u.%u%u\n",
39
42
ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, pVersion->zipinfo.major,
40
43
pVersion->zipinfo.minor, pVersion->zipinfo.patchlevel);
43
46
D2_M*VER and os2dll.* are obsolete, though retained for compatibility:
45
printf(" OS2 DLL versions: expecting %d.%d%d, using %d.%d%d\n",
48
printf(" OS2 DLL versions: expecting %u.%u%u, using %u.%u%u\n",
46
49
D2_MAJORVER, D2_MINORVER, D2_PATCHLEVEL, pVersion->os2dll.major,
47
50
pVersion->os2dll.minor, pVersion->os2dll.patchlevel);
50
53
if (pVersion->flag & 2)
51
54
printf(" using zlib version %s\n", pVersion->zlib_version);
56
/* This example code only uses the dll calls UzpVersion() and
57
* UzpMain(). The APIs for these two calls have maintained backward
58
* compatibility since at least the UnZip release 5.3 !
60
# define UZDLL_MINVERS_MAJOR 5
61
# define UZDLL_MINVERS_MINOR 3
62
# define UZDLL_MINVERS_PATCHLEVEL 0
63
/* This UnZip DLL stub requires a DLL version of at least: */
64
if ( (pVersion->unzip.major < UZDLL_MINVERS_MAJOR) ||
65
((pVersion->unzip.major == UZDLL_MINVERS_MAJOR) &&
66
((pVersion->unzip.minor < UZDLL_MINVERS_MINOR) ||
67
((pVersion->unzip.minor == UZDLL_MINVERS_MINOR) &&
68
(pVersion->unzip.patchlevel < UZDLL_MINVERS_PATCHLEVEL)
73
printf(" aborting because of too old UnZip DLL version!\n");
77
/* In case the offsetof() macro is not supported by some C compiler
78
environment, it might be replaced by something like:
79
((extent)(void *)&(((UzpVer *)0)->dllapimin))
81
if (pVersion->structlen >=
82
#if defined(MODERN) && !defined(NO_STDDEF_H)
83
( offsetof(UzpVer, dllapimin)
85
((unsigned)&(((UzpVer *)0)->dllapimin))
87
+ sizeof(_version_type) ))
90
# define UZ_API_COMP_MAJOR UZ_OS2API_COMP_MAJOR
91
# define UZ_API_COMP_MINOR UZ_OS2API_COMP_MINOR
92
# define UZ_API_COMP_REVIS UZ_OS2API_COMP_REVIS
95
# define UZ_API_COMP_MAJOR UZ_WINAPI_COMP_MAJOR
96
# define UZ_API_COMP_MINOR UZ_WINAPI_COMP_MINOR
97
# define UZ_API_COMP_REVIS UZ_WINAPI_COMP_REVIS
99
# define UZ_API_COMP_MAJOR UZ_GENAPI_COMP_MAJOR
100
# define UZ_API_COMP_MINOR UZ_GENAPI_COMP_MINOR
101
# define UZ_API_COMP_REVIS UZ_GENAPI_COMP_REVIS
105
" UnZip API version: can handle <= %u.%u%u, DLL supplies %u.%u%u\n",
106
UZ_API_COMP_MAJOR, UZ_API_COMP_MINOR, UZ_API_COMP_REVIS,
107
pVersion->dllapimin.major, pVersion->dllapimin.minor,
108
pVersion->dllapimin.patchlevel);
109
if ( (pVersion->dllapimin.major > UZ_API_COMP_MAJOR) ||
110
((pVersion->dllapimin.major == UZ_API_COMP_MAJOR) &&
111
((pVersion->dllapimin.minor > UZ_API_COMP_MINOR) ||
112
((pVersion->dllapimin.minor == UZ_API_COMP_MINOR) &&
113
(pVersion->dllapimin.patchlevel > UZ_API_COMP_REVIS)
118
printf(" aborting because of unsupported dll api version!\n");
54
124
/* call the actual UnZip routine (string-arguments version) */