From 02fd797cc4b1299e6bf9588710292c784a810fc4 Mon Sep 17 00:00:00 2001 From: sirakaba Date: Thu, 18 Feb 2010 02:09:09 +0000 Subject: [PATCH] =?utf8?q?=E3=81=84=E3=81=8F=E3=81=A4=E3=81=8B=E3=81=AE?= =?utf8?q?=E5=BD=A2=E5=BC=8F=E3=81=AE=E6=9B=B8=E5=BA=AB=E3=82=92=E8=AA=AD?= =?utf8?q?=E3=81=BF=E8=BE=BC=E3=82=81=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?utf8?q?=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@228 9df91469-1e22-0410-86e7-ea8537beb833 --- src/plugin/7zArc/7zArc.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/plugin/7zArc/7zArc.cpp b/src/plugin/7zArc/7zArc.cpp index 40bc38f..ff0f4c8 100644 --- a/src/plugin/7zArc/7zArc.cpp +++ b/src/plugin/7zArc/7zArc.cpp @@ -84,7 +84,7 @@ int GetFileInformation2(void * _hArchive, TPI_FILEINFO * _fiInfo, unsigned int n else { hArc->GetProperty(nIndex, kpidExtension, & prop); - _fiInfo->szStoredName = wxT("data.") + (prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : wxEmptyString); + _fiInfo->szStoredName = wxT("data.") + (prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString); } hArc->GetProperty(nIndex, kpidMethod, & prop); if (prop.vt == VT_BSTR) @@ -104,11 +104,26 @@ int GetFileInformation2(void * _hArchive, TPI_FILEINFO * _fiInfo, unsigned int n int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIndex) { + // Initialization. + _fiInfo->fArchive = true; + _fiInfo->fComment = false; + _fiInfo->fEncryptKeyFile = false; + _fiInfo->fEncryptPassword = false; + _fiInfo->fEncryptHeader = false; + _fiInfo->fMMOptimize = false; + _fiInfo->fMultiVolume = false; + _fiInfo->fSolid = false; + _fiInfo->sCompressLevelMin = 0; + _fiInfo->sCompressLevelMax = 0; + _fiInfo->sRecoveryRecordMin = 0; + _fiInfo->sRecoveryRecordMax = 0; + _fiInfo->szTypeName.Clear(); + _fiInfo->szSuffix.Clear(); _fiInfo->szEngineName = g_hLib.CanonicalizeName(wxT("7z")); _fiInfo->szTPIName = wxT("7zArc"); _fiInfo->llSupportedCommand = TPI_COMMAND_EXTRACT | TPI_COMMAND_TEST; _fiInfo->llTypeId = nIndex; - _fiInfo->fArchive = true; + _fiInfo->pCustomInfo = NULL; unsigned int nBase = nIndex++; if (guidList[nBase] == CLSID_CFormatZip) { @@ -124,10 +139,12 @@ int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIn else if (guidList[nBase] == CLSID_CFormatArj) { _fiInfo->szTypeName = wxT("Arj"); _fiInfo->szSuffix = wxT("arj"); _fiInfo->fEncryptPassword = true; + _fiInfo->fSFX = true; } else if (guidList[nBase] == CLSID_CFormatLzh) { _fiInfo->szTypeName = wxT("Lzh"); _fiInfo->szSuffix = wxT("lzh;lha;lzs"); + _fiInfo->fSFX = true; } #endif else if (guidList[nBase] == CLSID_CFormat7z) @@ -147,11 +164,13 @@ int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIn else if (guidList[nBase] == CLSID_CFormatCab) { _fiInfo->szTypeName = wxT("Cab"); _fiInfo->szSuffix = wxT("cab"); _fiInfo->fMultiVolume = true; + _fiInfo->fSFX = true; } #endif else if (guidList[nBase] == CLSID_CFormatNsis) { _fiInfo->szTypeName = wxT("NSIS"); _fiInfo->szSuffix = wxT("exe"); + _fiInfo->fSFX = true; } else if (guidList[nBase] == CLSID_CFormatMslz) { @@ -184,6 +203,7 @@ int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIn else if (guidList[nBase] == CLSID_CFormatCom) { _fiInfo->szTypeName = wxT("Compound");_fiInfo->szSuffix=wxT("msi"); + _fiInfo->fSFX = true; } else if (guidList[nBase] == CLSID_CFormatIso) { @@ -210,6 +230,7 @@ int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIn { _fiInfo->szTypeName = wxT("TAR"); _fiInfo->szSuffix = wxT("tar"); + _fiInfo->fSFX = true; _fiInfo->llSupportedCommand |= TPI_COMMAND_CREATE | TPI_COMMAND_ADD; } #endif @@ -722,7 +743,7 @@ int __stdcall OpenArchive { // 書庫形式を認識。 IInArchive * hArc; - for (unsigned int i = 0; i < sizeof(guidList) / sizeof(GUID); i++) + for (unsigned int i = 0; i < sizeof(guidList) / sizeof(GUID); ) { if (((unsigned int (__stdcall *)(const GUID *, const GUID *, void * *)) g_fpProc)(& guidList[i], & IID_IInArchive, (void **) & hArc) != S_OK) { @@ -737,14 +758,21 @@ int __stdcall OpenArchive return TPI_ERROR_IO_ARC_OPEN; } + // 形式の情報を取得。 + g_llEngineId = i; + TPI_FORMATINFO fiInfo; + GetFormatInformation2(& fiInfo, i); + // 書庫として開く。 CArchiveOpenCallback * openCallbackSpec = new CArchiveOpenCallback; CMyComPtr openCallback(openCallbackSpec); - wxULongLong_t nMax; - fileSpec->GetSize(& nMax); + wxULongLong_t nMax = 0; + if (fiInfo.fSFX) + { + fileSpec->GetSize(& nMax); + } if (hArc->Open(file, & nMax, openCallback) == S_OK) { - g_llEngineId = i; * _hArchive = hArc; return TPI_ERROR_SUCCESS; } -- 2.11.0