如何使用unzOpenCurrentFilePassword?

Rom*_*meo 1 unzip

有人可以帮助我移植我的代码 void * uzFile = unzOpen("zip filename");

使用minizip的unzOpenCurrentFilePassword?我想用密码保护我的zip文件.

我尝试了很多次,但我没有使用它.谢谢

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. */

Ziz*_*aco 8

在编译zlib之前,请在unzip.c中删除NOUNCRYPT的定义.然后"unzOpenCurrentFilePassword将被启用".

unzip.c第72行:

#ifndef NOUNCRYPT
    //#define NOUNCRYPT Comment this line, so unzip protected files will be enabled
#endif
Run Code Online (Sandbox Code Playgroud)

为什么?除其他外,NOUNCRYPT的定义在unzOpenCurrentFilePassword函数中导致荒谬的返回.

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
Run Code Online (Sandbox Code Playgroud)