开发者

How to use unzOpenCurrentFilePassword?

Can someone help me port my code from void * uzFile = unzOpen("zip filename");

to use the unzOpenCurrentFilePassword fro开发者_如何学运维m minizip ? I want to protect my zip file with a password.

I tried many times but I failed using it. Thanks

extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, const char* password)); /* Open for reading data the current file in the zipfile. password is a crypting password If there is no error, the return value is UNZ_OK. */


Before you compile zlib, remove the definition of NOUNCRYPT in unzip.c. Then "unzOpenCurrentFilePassword will be enabled".

unzip.c Line 72:

#ifndef NOUNCRYPT
    //#define NOUNCRYPT Comment this line, so unzip protected files will be enabled
#endif

Why? Among other things, the definition of NOUNCRYPT causes an absurd return in unzOpenCurrentFilePassword function.

extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
                                        int* level, int raw, const char* password)
[...]

#   ifndef NOUNCRYPT
    char source[12];
#   else
    if (password != NULL)
        return UNZ_PARAMERROR;
#   endif
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜