64,685
社区成员
发帖
与我相关
我的任务
分享
unsigned int flag = revert_two_bytes(decodedStr.substr(8, 2));
unsigned int filename_len = revert_two_bytes(decodedStr.substr(26, 2));
unsigned int ext_len = revert_two_bytes(decodedStr.substr(28, 2));
unsigned int compressed_data_len = revert_four_bytes(decodedStr.substr(18, 4));
unsigned int uncompressed_data_len = revert_four_bytes(decodedStr.substr(22, 4));
Bytef* uncompress_buf = new Bytef[uncompressed_data_len];
Bytef* compress_buf = new Bytef[compressed_data_len];
stringstream ss;
ss<<decodedStr.substr(30 + filename_len + ext_len, compressed_data_len);
//decompress
z_stream zInfo ={0};
zInfo.total_in = zInfo.avail_in = compressed_data_len;
zInfo.total_out = zInfo.avail_out = uncompressed_data_len;
zInfo.next_in = compress_buf;
zInfo.next_out = uncompress_buf;
int nErr;
nErr= inflateInit2( &zInfo, 15 ); // zlib function
if ( nErr == Z_OK ) {
nErr= inflate( &zInfo, Z_FINISH ); // zlib function
cout<<nErr<<endl;
}
deflateEnd( &zInfo ); // zlib function
delete uncompress_buf;