Zlib official website is www.zlib.net
开源代码:http://www.zlib.net/
zlib使用手册:http://www.zlib.net/manual.html
zlib wince版:http://www.tenik.co.jp/~adachi/wince/
Zlib dll named as Zlib1.dll
Before version 1.2.4 there is folder named “project”, in which vc6 project file “.dsw” could be used to compile the static library.
However, after 1.2.4, this folder was removed. Here is the url for downloading source codef for zlib1.2.4
Steps:
follow readme.txt under contrib\vstudio directory.
zlibwapi.dll uses the WINAPI calling convention for the exported functions, and includes the minizip functionality.
zlib1.dll is exporting the functions using the CDECL convention.
the former dll library will be created by the zlibvc project which is included in the zlib.sln solution under contrib\vstudio
the later dll library will be created by the official
For win32 version
using visual studio command tools to run contrib\masmx86\bld_ml32.bat, and then open the solution contrib\vstudio\vc9 or contrib\vstudio\vc10. That depends on which visual studio version(vc9 for visual studio 2008, vc10 for visual studio 2010).
project “zlibvc” for dynamic library; project “zlibstat” for static library.
For x64 version
using visual studio command tools(x64 cross or x64) to run contrib\masmx64\bld_ml64.bat, and then follow the same path like win32 version to open the solution and choose the compilatoin configurtion to change as x64.
Done
int CZipFileDecoder::UnCompress(const char * src, const char * dst) { char uSorceBuffer[102400] = {0}; FILE* fin = nullptr; FILE* fout = nullptr; fin = fopen(src,"r+b"); if (fin == nullptr) { cerr<<"Failed to open file:"<<src<<endl; return 1; } fseek(fin,0L,SEEK_END); long ufileLength = ftell(fin); fseek(fin, 0L, SEEK_SET); fread(uSorceBuffer,ufileLength,1,fin); fclose(fin); uLongf uDestBufferLen=1024000; char* uDestBuffer=(char*)::calloc((uInt)uDestBufferLen, 1); int ret = uncompress((Bytef*)uDestBuffer,(uLongf*)&uDestBufferLen,(Bytef*)uSorceBuffer,(uLongf)ufileLength); if(ret!=Z_OK) { cerr<<"Failed to uncompress:"<<ret<<endl; return 1; } fout = fopen(dst, "wb"); if (fout == nullptr) { free(uDestBuffer); return 1; } fwrite(uDestBuffer,uDestBufferLen,1,fout); fclose(fout); free(uDestBuffer); cout<<"Done"<<endl; return 0; }