// vbgamerzip.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "..\zlib122\zip.h"
#include "..\zlib122\unzip.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD
ul_reason_for_call,
LPVOID
lpReserved
)
{
return TRUE;
}
////////////////
// General Export
////////////////
int __declspec(dllexport) WINAPI VBCRC32 (unsigned long crc,
const
unsigned char FAR *buf,
unsigned len)
{
return crc32(crc, buf, len);
}
////////////////
// Zip Section
////////////////
int __declspec(dllexport) WINAPI VBZipOpen (const char *pathname,
int
append,
zipcharpc*
globalcomment)
{
zipFile z = zipOpen2(pathname, append, globalcomment, NULL);
return (int)z;
}
int __declspec(dllexport) WINAPI VBZipOpenNewFileInZip(zipFile file,
const
char* filename,
const
char* comment,
const
char* password,
uLong
crcForCrypting)
{
return zipOpenNewFileInZip3(file, filename,
NULL, NULL, 0,NULL, 0,
comment,
Z_DEFLATED,
Z_BEST_COMPRESSION, 0,
-MAX_WBITS,
DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY,
password, crcForCrypting);
}
int __declspec(dllexport) WINAPI VBZipWriteFile(zipFile file,
const void*buf,
unsigned len)
{
return zipWriteInFileInZip(file, buf, len);
}
int __declspec(dllexport) WINAPI VBZipCloseFile(zipFile file)
{
return zipCloseFileInZip(file);
}
int __declspec(dllexport) WINAPI VBZipClose(zipFile file,
const char* global_comment)
{
return zipClose(file, global_comment);
}
////////////////
// UnZip section
////////////////
int __declspec(dllexport) WINAPI VBUnZipOpen (const char *path)
{
unzFile z = unzOpen(path);
return (int)z;
}
int __declspec(dllexport) WINAPI VBUnZipClose (unzFile file)
{
return unzClose(file);
}
int __declspec(dllexport) WINAPI VBUnZipGetGlobalInfo(unzFile file, unz_global_info *pglobal_info)
{
return unzGetGlobalInfo(file, pglobal_info);
}
int __declspec(dllexport) WINAPI VBUnZipGetGlobalComment(unzFile file,
char
*szComment, uLong uSizeBuf)
{
return unzGetGlobalComment(file, szComment, uSizeBuf);
}
int __declspec(dllexport) WINAPI VBUnZipFirstFile(unzFile file)
{
return unzGoToFirstFile(file);
}
int __declspec(dllexport) WINAPI VBUnZipNextFile(unzFile file)
{
return unzGoToNextFile(file);
}
int __declspec(dllexport) WINAPI VBUnZipGetFileInfo(unzFile file,
unz_file_info
*pfile_info,
char*szFileName,
uLongfileNameBufferSize,
void*extraField,
uLongextraFieldBufferSize,
char*szComment,
uLongcommentBufferSize )
{
return unzGetCurrentFileInfo(file, pfile_info,
szFileName,
fileNameBufferSize,
extraField,
extraFieldBufferSize,
szComment,
commentBufferSize);
}
int __declspec(dllexport) WINAPI VBUnZipOpenFile(unzFile file)
{
return unzOpenCurrentFile(file);
}
int __declspec(dllexport) WINAPI VBUnZipOpenFileEx(unzFile file, const char* password )
{
return unzOpenCurrentFilePassword(file, password);
}
int __declspec(dllexport) WINAPI VBUnZipCloseFile(unzFile file)
{
return unzCloseCurrentFile(file);
}
int __declspec(dllexport) WINAPI VBUnZipReadFile(unzFile file, voidp buf, unsigned len)
{
return unzReadCurrentFile(file, buf, len);
}