Skip to content

Commit

Permalink
SkinInstaller: Fix installing and creating .rmskin files with Unicode…
Browse files Browse the repository at this point in the history
… characters path

This also cherry-picks
madler/zlib@89e335a
  • Loading branch information
poiru committed Jul 27, 2017
1 parent 555b1a8 commit 0f53b90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Library/DialogInstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "System.h"
#include "../Version.h"

#include "iowin32.h"

#define WM_DELAYED_CLOSE WM_APP + 0

extern GlobalData g_Data;
Expand Down Expand Up @@ -374,7 +376,9 @@ bool DialogInstall::ReadPackage()
return false;
}

m_PackageUnzFile = unzOpen(StringUtil::Narrow(fileName).c_str());
zlib_filefunc64_def zlibFileFunc;
fill_win32_filefunc64W(&zlibFileFunc);
m_PackageUnzFile = unzOpen2_64(fileName, &zlibFileFunc);
if (!m_PackageUnzFile)
{
return false;
Expand Down
6 changes: 5 additions & 1 deletion Library/DialogPackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "resource.h"
#include "../Version.h"

#include "iowin32.h"

#define WM_DELAYED_CLOSE WM_APP + 0

extern GlobalData g_Data;
Expand Down Expand Up @@ -255,7 +257,9 @@ bool DialogPackage::CreatePackage()
m_AllowNonAsciiFilenames = DialogInstall::CompareVersions(m_MinimumRainmeter, L"3.0.1") != -1;

// Create archive and add options file and header bitmap
m_ZipFile = zipOpen(StringUtil::Narrow(m_TargetFile.c_str()).c_str(), APPEND_STATUS_CREATE);
zlib_filefunc64_def zlibFileFunc;
fill_win32_filefunc64W(&zlibFileFunc);
m_ZipFile = zipOpen2_64(m_TargetFile.c_str(), APPEND_STATUS_CREATE, nullptr, &zlibFileFunc);

auto cleanup = [&]()->bool
{
Expand Down
4 changes: 2 additions & 2 deletions Library/zlib/minizip/iowin32.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n
return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
#else
LONG lHigh = pos.HighPart;
DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, FILE_CURRENT);
DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod);
BOOL fOk = TRUE;
if (dwNewPos == 0xFFFFFFFF)
if (GetLastError() != NO_ERROR)
Expand Down Expand Up @@ -370,7 +370,7 @@ long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T off
{
LARGE_INTEGER pos;
pos.QuadPart = offset;
if (!MySetFilePointerEx(hFile, pos, NULL, FILE_CURRENT))
if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod))
{
DWORD dwErr = GetLastError();
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
Expand Down

0 comments on commit 0f53b90

Please sign in to comment.