Windows unzip.cpp解压文件乱码

1780阅读 0评论2020-09-07 zhanggf8220
分类:C/C++

CP_ACP 指示 API 使用当前设置默认的 Windows ANSI 代码页
修改unzip.cpp
MultiByteToWideChar(CP_UTF8,0,fn,-1,tfn,MAX_PATH);

MultiByteToWideChar(CP_ACP,0,fn,-1,tfn,MAX_PATH);

bool CommonFunction::Unzip(const std::wstring & zipFile, const std::wstring & folder)
{
bool result = true;
SetCurrentDirectory(folder.c_str());
HZIP hz = OpenZip(zipFile.c_str(), 0);
ZIPENTRY ze;
GetZipItem(hz, -1, &ze);
int numitems = ze.index;
for (int i = 0; i < numitems; i++)
{
GetZipItem(hz, i, &ze);
ZRESULT rst = UnzipItem(hz, i, ze.name);
if (wcscmp(ze.name, L"HwasstHelper.exe") == 0 ||
wcscmp(ze.name, L"HwasstService.exe") == 0 ||
wcscmp(ze.name, L"HwasstTool.exe") == 0)
{
result = (result && (rst == ZR_OK));
LOG_TRACE(0, "%ls %d", ze.name, rst);
}
}
CloseZip(hz);


return result;
}

上一篇:QT 解决主线程卡顿问题
下一篇:Linux TCP RST情况