12#pragma message(__FILE__": Compiled as C++ for testing purpose.")
15#define WIN32_LEAN_AND_MEAN
31#pragma message("ZIP image support is disabled.")
56static const char *ZLIB_ERROR(
int err)
59 case Z_OK :
return "Z_OK";
62 case Z_ERRNO :
return "Z_ERRNO";
68 default :
return "unknown";
85#define ZIP_LOCAL_SIGNATURE 0x04034b50
87#define ZIP_FLAG_ENCRYPTED 0x01
89#define ZIP_FLAG_DEFLATE_NORMAL 0x00
90#define ZIP_FLAG_DEFLATE_MAX 0x02
91#define ZIP_FLAG_DEFLATE_FAST 0x04
92#define ZIP_FLAG_DEFLATE_SUPER 0x06
93#define ZIP_FLAG_DEFLATE_MASK 0x06
95#define ZIP_FLAG_SIZE_IN_DESC 0x08
97#define ZIP_METHOD_STORED 0
98#define ZIP_METHOD_SHRUNK 1
99#define ZIP_METHOD_REDUCED1 2
100#define ZIP_METHOD_REDUCED2 3
101#define ZIP_METHOD_REDUCED3 4
102#define ZIP_METHOD_REDUCED4 5
103#define ZIP_METHOD_IMPLODED 6
104#define ZIP_METHOD_TOKENIZED 7
105#define ZIP_METHOD_DEFLATED 8
106#define ZIP_METHOD_DEFLATE64 9
107#define ZIP_METHOD_PKWARE_IMP 10
108#define ZIP_METHOD_RESERVED 11
109#define ZIP_METHOD_BZIP2 12
145 (
"SetFilePointer() - %s\n",
155 (
"ReadFile() - %s\n",
161 if (
result !=
sizeof(zip_hdr) ||
167 (
"[VFD] Invalid ZIP file\n"));
199 (
"[VFD] VfdExtractImz - IN\n"));
236 (
"[VFD] PKZIP header signature not found.\n"));
246 (
"[VFD] Bad PKZIP compression method.\n"));
255 (
"[VFD] PKZIP encrypted.\n"));
282 (
"[VFD] Unsupported image size %lu.\n",
297 (
"[VFD] PKZIP header too long.\n"));
309 (
"[VFD] Failed to allocate file cache.\n"));
329 stream.next_out = file_cache;
342 if (zlib_ret !=
Z_OK) {
346 (
"[VFD] inflateInit2() failed - %s.\n",
347 ZLIB_ERROR(zlib_ret)));
358 if (zlib_ret !=
Z_OK) {
364 (
"[VFD] inflate() failed - %s.\n",
365 ZLIB_ERROR(zlib_ret)));
379 if (
stream.total_in >= compressed) {
393 (
"[VFD] Read compressed data - %s.\n",
417 (
"[VFD] VfdExtractImz - OUT\n"));
#define ERROR_INVALID_FUNCTION
#define ReadFile(a, b, c, d, e)
#define ERROR_NOT_SUPPORTED
int inflate(z_streamp strm, int flush)
int inflateEnd(z_streamp strm)
void zcfree(voidpf opaque, voidpf ptr)
voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
GLenum GLuint GLenum GLsizei const GLchar * buf
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
static const BYTE uncompressed[]
#define UNREFERENCED_PARAMETER(P)
#define inflateInit2(strm, windowBits)
#define FIELD_OFFSET(t, f)
#define VFDTRACE(LEVEL, STRING)
#define VFD_BYTES_PER_SECTOR
#define VFD_SECTOR_TO_BYTE(s)
PCSTR SystemMessage(DWORD nError)
struct _zip_local_file_header * PZIP_HEADER
struct _zip_local_file_header ZIP_HEADER
DWORD ExtractZipImage(HANDLE hFile, PUCHAR *pBuffer, PULONG pLength)
#define ZIP_METHOD_DEFLATED
DWORD ExtractZipInfo(HANDLE hFile, ULONG *pSize)
#define ZIP_LOCAL_SIGNATURE
#define ZIP_FLAG_ENCRYPTED
DWORD WINAPI GetLastError(void)
#define ERROR_INVALID_DATA