{
CStringW m_Filename;
CStringW m_Directory;
+ bool m_DirectoryChanged;
unzFile uf;
public:
CZipExtract(PCWSTR Filename)
- :uf(NULL)
+ :m_DirectoryChanged(false)
+ ,uf(NULL)
{
m_Filename = Filename;
m_Directory = m_Filename;
int OnSetActive()
{
SetDlgItemTextW(IDC_DIRECTORY, m_pExtract->m_Directory);
+ m_pExtract->m_DirectoryChanged = false;
::EnableWindow(GetDlgItem(IDC_PASSWORD), FALSE); /* Not supported for now */
GetParent().CenterWindow(::GetDesktopWindow());
return 0;
::EnableWindow(GetDlgItem(IDC_DIRECTORY), FALSE);
::EnableWindow(GetDlgItem(IDC_PASSWORD), FALSE);
+ if (m_pExtract->m_DirectoryChanged)
+ UpdateDirectory();
+
if (!m_pExtract->Extract(m_hWnd, GetDlgItem(IDC_PROGRESS)))
{
/* Extraction failed, do not go to the next page */
CStringW title(MAKEINTRESOURCEW(IDS_WIZ_BROWSE_TITLE));
bi.lpszTitle = title;
+ if (m_pExtract->m_DirectoryChanged)
+ UpdateDirectory();
+
browse_info info = { m_hWnd, m_pExtract->m_Directory.GetString() };
bi.lParam = (LPARAM)&info;
{
m_pExtract->m_Directory = tmpPath;
SetDlgItemTextW(IDC_DIRECTORY, m_pExtract->m_Directory);
+ m_pExtract->m_DirectoryChanged = false;
}
return 0;
}
+ LRESULT OnEnChangeDirectory(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+ {
+ m_pExtract->m_DirectoryChanged = true;
+ return 0;
+ }
+
LRESULT OnPassword(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
return 0;
}
+ void UpdateDirectory()
+ {
+ GetDlgItemText(IDC_DIRECTORY, m_pExtract->m_Directory);
+ m_pExtract->m_DirectoryChanged = false;
+ }
+
public:
enum { IDD = IDD_PROPPAGEDESTINATION };
BEGIN_MSG_MAP(CCompleteSettingsPage)
COMMAND_ID_HANDLER(IDC_BROWSE, OnBrowse)
COMMAND_ID_HANDLER(IDC_PASSWORD, OnPassword)
+ COMMAND_HANDLER(IDC_DIRECTORY, EN_CHANGE, OnEnChangeDirectory)
CHAIN_MSG_MAP(CPropertyPageImpl<CExtractSettingsPage>)
END_MSG_MAP()
};
if (err != UNZ_OK)
{
DPRINT1("ERROR, unzGetGlobalInfo64: 0x%x\n", err);
+ Close();
return false;
}
if (!zipEnum.initialize(this))
{
DPRINT1("ERROR, zipEnum.initialize\n");
+ Close();
return false;
}
HRESULT hr = SHPathPrepareForWriteA(hDlg, NULL, FullPath, dwFlags);
if (FAILED_UNEXPECTEDLY(hr))
{
+ Close();
return false;
}
CurrentFile++;
if (err != UNZ_OK)
{
DPRINT1("ERROR, unzOpenCurrentFilePassword: 0x%x\n", err);
+ Close();
return false;
}
case CConfirmReplace::No:
break;
case CConfirmReplace::Cancel:
+ unzCloseCurrentFile(uf);
+ Close();
return false;
}
}
{
unzCloseCurrentFile(uf);
DPRINT1("ERROR, CreateFileA: 0x%x (%s)\n", dwErr, bOverwriteAll ? "Y" : "N");
+ Close();
return false;
}
}
{
unzCloseCurrentFile(uf);
DPRINT1("ERROR, unzReadCurrentFile2: 0x%x\n", err);
+ Close();
return false;
}
else
case 2: /* Compressed size */
case 4: /* Size */
{
+ if (isDir)
+ return SHSetStrRet(&psd->str, L"");
+
ULONG64 Size = iColumn == 2 ? zipEntry->CompressedSize : zipEntry->UncompressedSize;
if (!StrFormatByteSizeW(Size, Buffer, _countof(Buffer)))
return E_FAIL;
return SHSetStrRet(&psd->str, _AtlBaseModule.GetResourceInstance(), zipEntry->Password ? IDS_YES : IDS_NO);
case 5: /* Ratio */
{
+ if (isDir)
+ return SHSetStrRet(&psd->str, L"");
+
int ratio = 0;
- if (zipEntry->UncompressedSize && !isDir)
+ if (zipEntry->UncompressedSize)
ratio = 100 - (int)((zipEntry->CompressedSize*100)/zipEntry->UncompressedSize);
StringCchPrintfW(Buffer, _countof(Buffer), L"%d%%", ratio);
return SHSetStrRet(&psd->str, Buffer);