4.60 beta

This commit is contained in:
Igor Pavlov
2008-08-19 00:00:00 +00:00
committed by Kornel Lesiński
parent 173c07e166
commit c10e6b16f6
107 changed files with 490 additions and 503 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/* 7zExtract.c -- Extracting from 7z archive /* 7zExtract.c -- Extracting from 7z archive
2008-08-05 2008-08-17
Igor Pavlov Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read 7zExtract.h for license options */ Read 7zExtract.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* 7zIn.c -- 7z Input functions /* 7zIn.c -- 7z Input functions
2008-08-05 2008-08-17
Igor Pavlov Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read 7zIn.h for license options */ Read 7zIn.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* 7zMain.c - Test application for 7z Decoder /* 7zMain.c - Test application for 7z Decoder
2008-08-05 2008-08-17
Igor Pavlov Igor Pavlov
Public domain */ Public domain */
+1 -1
View File
@@ -1,5 +1,5 @@
/* Bcj2.c -- Converter for x86 code (BCJ2) /* Bcj2.c -- Converter for x86 code (BCJ2)
2008-08-05 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read Bra.h for license options */ Read Bra.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* Bra.h -- Branch converters for executables /* Bra.h -- Branch converters for executables
2008-08-05 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read LzmaDec.h for license options */ Read LzmaDec.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* Bra86.c -- converter for x86 code (BCJ) /* Bra86.c -- converter for x86 code (BCJ)
2008-03-19 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read Bra.h for license options */ Read Bra.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* BwtSort.c -- BWT block sorting /* BwtSort.c -- BWT block sorting
2008-08-05 2008-08-17
Igor Pavlov Igor Pavlov
Public domain */ Public domain */
+1 -1
View File
@@ -1,5 +1,5 @@
/* LzFind.c -- Match finder for LZ algorithms /* LzFind.c -- Match finder for LZ algorithms
2008-08-05 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read LzFind.h for license options */ Read LzFind.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms /* LzFindMt.c -- multithreaded Match finder for LZ algorithms
2008-08-05 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read LzFind.h for license options */ Read LzFind.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* LzmaDec.c -- LZMA Decoder /* LzmaDec.c -- LZMA Decoder
2008-08-05 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read LzmaDec.h for license options */ Read LzmaDec.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* LzmaEnc.c -- LZMA Encoder /* LzmaEnc.c -- LZMA Encoder
2008-08-13 2008-08-17
Copyright (c) 1999-2008 Igor Pavlov Copyright (c) 1999-2008 Igor Pavlov
Read LzmaEnc.h for license options */ Read LzmaEnc.h for license options */
+1 -1
View File
@@ -1,5 +1,5 @@
/* Sort.c -- Sort functions /* Sort.c -- Sort functions
2008-03-13 2008-08-17
Igor Pavlov Igor Pavlov
Public domain */ Public domain */
+1 -1
View File
@@ -264,7 +264,7 @@ HRESULT CDecoder::Decode(
RINOK(getTextPassword->CryptoGetTextPassword(&passwordBSTR)); RINOK(getTextPassword->CryptoGetTextPassword(&passwordBSTR));
CByteBuffer buffer; CByteBuffer buffer;
passwordIsDefined = true; passwordIsDefined = true;
UString password = passwordBSTR; const UString password(passwordBSTR);
const UInt32 sizeInBytes = password.Length() * 2; const UInt32 sizeInBytes = password.Length() * 2;
buffer.SetCapacity(sizeInBytes); buffer.SetCapacity(sizeInBytes);
for (int i = 0; i < password.Length(); i++) for (int i = 0; i < password.Length(); i++)
+1 -1
View File
@@ -1,4 +1,4 @@
4// ElfHandler.cpp // ElfHandler.cpp
#include "StdAfx.h" #include "StdAfx.h"
+1 -1
View File
@@ -130,7 +130,7 @@ void CDebugEntry::Parse(const Byte *p)
Pa = Get32(p + 24); Pa = Get32(p + 24);
} }
static const kNumDirItemsMax = 16; static const UInt32 kNumDirItemsMax = 16;
struct COptHeader struct COptHeader
{ {
+2 -2
View File
@@ -68,7 +68,7 @@ STATPROPSTG kArcProps[] =
{ {
{ NULL, kpidSolid, VT_BOOL}, { NULL, kpidSolid, VT_BOOL},
{ NULL, kpidNumBlocks, VT_UI4}, { NULL, kpidNumBlocks, VT_UI4},
{ NULL, kpidEncrypted, VT_BOOL}, // { NULL, kpidEncrypted, VT_BOOL},
{ NULL, kpidIsVolume, VT_BOOL}, { NULL, kpidIsVolume, VT_BOOL},
{ NULL, kpidNumVolumes, VT_UI4}, { NULL, kpidNumVolumes, VT_UI4},
{ NULL, kpidPhySize, VT_UI8} { NULL, kpidPhySize, VT_UI8}
@@ -94,7 +94,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
switch(propID) switch(propID)
{ {
case kpidSolid: prop = _archiveInfo.IsSolid(); break; case kpidSolid: prop = _archiveInfo.IsSolid(); break;
case kpidEncrypted: prop = _archiveInfo.IsEncrypted(); break; // case kpidEncrypted: prop = _archiveInfo.IsEncrypted(); break; // it's for encrypted names.
case kpidIsVolume: prop = _archiveInfo.IsVolume(); break; case kpidIsVolume: prop = _archiveInfo.IsVolume(); break;
case kpidNumVolumes: prop = (UInt32)_archives.Size(); break; case kpidNumVolumes: prop = (UInt32)_archives.Size(); break;
case kpidOffset: if (_archiveInfo.StartPosition != 0) prop = _archiveInfo.StartPosition; break; case kpidOffset: if (_archiveInfo.StartPosition != 0) prop = _archiveInfo.StartPosition; break;
+16 -1
View File
@@ -236,6 +236,20 @@ STDMETHODIMP CUdfInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
const CFile &file = _archive->Files[ref.FileIndex]; const CFile &file = _archive->Files[ref.FileIndex];
const CItem &item = _archive->Items[file.ItemIndex]; const CItem &item = _archive->Items[file.ItemIndex];
HRESULT res = S_OK;
if (item.IsInline)
{
size_t rem = item.InlineData.GetCapacity() - _offsetInExtent;
if (rem == 0)
return S_OK;
if (rem > _rem)
rem = (size_t)_rem;
memcpy(data, (const Byte *)item.InlineData + _offsetInExtent, rem);
}
else
{
if (_extentIndex >= item.Extents.Size())
return S_OK;
const CMyExtent &extent = item.Extents[_extentIndex]; const CMyExtent &extent = item.Extents[_extentIndex];
UInt32 rem = extent.GetLen() - _offsetInExtent; UInt32 rem = extent.GetLen() - _offsetInExtent;
if (rem == 0) if (rem == 0)
@@ -254,7 +268,8 @@ STDMETHODIMP CUdfInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
(UInt64)logBlockNumber * vol.BlockSize + _offsetInExtent; (UInt64)logBlockNumber * vol.BlockSize + _offsetInExtent;
RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL)); RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL));
HRESULT res = _stream->Read(data, size, &size); res = _stream->Read(data, size, &size);
}
_offsetInExtent += size; _offsetInExtent += size;
_rem -= size; _rem -= size;
if (processedSize) if (processedSize)
+24 -3
View File
@@ -26,6 +26,7 @@ const int kNumFilesMax = 1 << 28;
const int kNumRefsMax = 1 << 28; const int kNumRefsMax = 1 << 28;
const UInt32 kNumExtentsMax = (UInt32)1 << 30; const UInt32 kNumExtentsMax = (UInt32)1 << 30;
const UInt64 kFileNameLengthTotalMax = (UInt64)1 << 33; const UInt64 kFileNameLengthTotalMax = (UInt64)1 << 33;
const UInt64 kInlineExtentsSizeMax = (UInt64)1 << 33;
void MY_FAST_CALL Crc16GenerateTable(void); void MY_FAST_CALL Crc16GenerateTable(void);
@@ -275,6 +276,11 @@ HRESULT CInArchive::ReadFromFile(int volIndex, const CItem &item, CByteBuffer &b
{ {
if (item.Size >= (UInt32)1 << 30) if (item.Size >= (UInt32)1 << 30)
return S_FALSE; return S_FALSE;
if (item.IsInline)
{
buf = item.InlineData;
return S_OK;
}
buf.SetCapacity((size_t)item.Size); buf.SetCapacity((size_t)item.Size);
size_t pos = 0; size_t pos = 0;
for (int i = 0; i < item.Extents.Size(); i++) for (int i = 0; i < item.Extents.Size(); i++)
@@ -448,11 +454,19 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
pos += extendedAttrLen; pos += extendedAttrLen;
int desctType = item.IcbTag.GetDescriptorType(); int desctType = item.IcbTag.GetDescriptorType();
// if (desctType == ICB_DESC_TYPE_INLINE || desctType == ICB_DESC_TYPE_EXTENDED)
if (desctType != ICB_DESC_TYPE_SHORT && desctType != ICB_DESC_TYPE_LONG)
return S_FALSE;
if (allocDescriptorsLen > size - pos) if (allocDescriptorsLen > size - pos)
return S_FALSE; return S_FALSE;
if (desctType == ICB_DESC_TYPE_INLINE)
{
item.IsInline = true;
item.InlineData.SetCapacity(allocDescriptorsLen);
memcpy(item.InlineData, p + pos, allocDescriptorsLen);
}
else
{
item.IsInline = false;
if (desctType != ICB_DESC_TYPE_SHORT && desctType != ICB_DESC_TYPE_LONG)
return S_FALSE;
for (UInt32 i = 0; i < allocDescriptorsLen;) for (UInt32 i = 0; i < allocDescriptorsLen;)
{ {
CMyExtent e; CMyExtent e;
@@ -480,6 +494,7 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
} }
item.Extents.Add(e); item.Extents.Add(e);
} }
}
if (item.IcbTag.IsDir()) if (item.IcbTag.IsDir())
{ {
@@ -489,6 +504,7 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
RINOK(ReadFromFile(volIndex, item, buf)); RINOK(ReadFromFile(volIndex, item, buf));
item.Size = 0; item.Size = 0;
item.Extents.ClearAndFree(); item.Extents.ClearAndFree();
item.InlineData.Free();
const Byte *p = buf; const Byte *p = buf;
size = buf.GetCapacity(); size = buf.GetCapacity();
@@ -524,6 +540,10 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
if ((UInt32)item.Extents.Size() > kNumExtentsMax - _numExtents) if ((UInt32)item.Extents.Size() > kNumExtentsMax - _numExtents)
return S_FALSE; return S_FALSE;
_numExtents += item.Extents.Size(); _numExtents += item.Extents.Size();
if (item.InlineData.GetCapacity() > kInlineExtentsSizeMax - _inlineExtentsSize)
return S_FALSE;
_inlineExtentsSize += item.InlineData.GetCapacity();
} }
return S_OK; return S_OK;
@@ -769,6 +789,7 @@ void CInArchive::Clear()
_fileNameLengthTotal = 0; _fileNameLengthTotal = 0;
_numRefs = 0; _numRefs = 0;
_numExtents = 0; _numExtents = 0;
_inlineExtentsSize = 0;
_processedProgressBytes = 0; _processedProgressBytes = 0;
} }
+7
View File
@@ -167,6 +167,8 @@ struct CPartitionMap
int PartitionIndex; int PartitionIndex;
}; };
// ECMA 4/14.6
enum EIcbFileType enum EIcbFileType
{ {
ICB_FILE_TYPE_DIR = 4, ICB_FILE_TYPE_DIR = 4,
@@ -243,6 +245,8 @@ struct CItem
// CRegId ImplId; // CRegId ImplId;
// UInt64 UniqueId; // UInt64 UniqueId;
bool IsInline;
CByteBuffer InlineData;
CRecordVector<CMyExtent> Extents; CRecordVector<CMyExtent> Extents;
CRecordVector<int> SubFiles; CRecordVector<int> SubFiles;
@@ -258,6 +262,8 @@ struct CItem
UInt64 GetChunksSumSize() const UInt64 GetChunksSumSize() const
{ {
if (IsInline)
return InlineData.GetCapacity();
UInt64 size = 0; UInt64 size = 0;
for (int i = 0; i < Extents.Size(); i++) for (int i = 0; i < Extents.Size(); i++)
size += Extents[i].GetLen(); size += Extents[i].GetLen();
@@ -343,6 +349,7 @@ class CInArchive
UInt64 _fileNameLengthTotal; UInt64 _fileNameLengthTotal;
int _numRefs; int _numRefs;
UInt32 _numExtents; UInt32 _numExtents;
UInt64 _inlineExtentsSize;
bool CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const; bool CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const;
public: public:
HRESULT Open(IInStream *inStream, CProgressVirt *progress); HRESULT Open(IInStream *inStream, CProgressVirt *progress);
+2 -2
View File
@@ -740,8 +740,8 @@ void CEcd64::Parse(const Byte *p)
cdStartOffset = Get64(p + 36); cdStartOffset = Get64(p + 36);
} }
#define COPY_ECD_ITEM_16(n) if (!isZip64 || ecd. ## n != 0xFFFF) ecd64. ## n = ecd. ## n; #define COPY_ECD_ITEM_16(n) if (!isZip64 || ecd. n != 0xFFFF) ecd64. n = ecd. n;
#define COPY_ECD_ITEM_32(n) if (!isZip64 || ecd. ## n != 0xFFFFFFFF) ecd64. ## n = ecd. ## n; #define COPY_ECD_ITEM_32(n) if (!isZip64 || ecd. n != 0xFFFFFFFF) ecd64. n = ecd. n;
HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress) HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress)
{ {
+2 -2
View File
@@ -168,7 +168,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
return 1; return 1;
} }
UString dirPrefix = L".\\"; UString dirPrefix = L"." WSTRING_PATH_SEPARATOR;
UString appLaunched; UString appLaunched;
bool showProgress = true; bool showProgress = true;
if (!config.IsEmpty()) if (!config.IsEmpty())
@@ -298,7 +298,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
{ {
UString s2 = tempDirPath; UString s2 = tempDirPath;
NFile::NName::NormalizeDirPathPrefix(s2); NFile::NName::NormalizeDirPathPrefix(s2);
appLaunched.Replace(L"%%T\\", s2); appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, s2);
} }
appLaunched.Replace(L"%%T", tempDirPath); appLaunched.Replace(L"%%T", tempDirPath);
+5 -5
View File
@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 4 #define MY_VER_MAJOR 4
#define MY_VER_MINOR 59 #define MY_VER_MINOR 60
#define MY_VER_BUILD 7 #define MY_VER_BUILD 0
#define MY_VERSION " 4.59 beta" #define MY_VERSION " 4.60 beta"
#define MY_7ZIP_VERSION "7-Zip 4.59 beta" #define MY_7ZIP_VERSION "7-Zip 4.60 beta"
#define MY_DATE "2008-08-13" #define MY_DATE "2008-08-19"
#define MY_COPYRIGHT "Copyright (c) 1999-2008 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2008 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
+3 -6
View File
@@ -96,7 +96,7 @@ UString CAgentFolder::GetPrefix(UInt32 index) const
UString path; UString path;
while (folder != _proxyFolderItem) while (folder != _proxyFolderItem)
{ {
path = folder->Name + UString(L"\\") + path; path = folder->Name + UString(WCHAR_PATH_SEPARATOR) + path;
folder = folder->Parent; folder = folder->Parent;
} }
return path; return path;
@@ -460,12 +460,9 @@ STDMETHODIMP CAgent::Open(
DefaultTime = fileInfo.MTime; DefaultTime = fileInfo.MTime;
DefaultAttrib = fileInfo.Attrib; DefaultAttrib = fileInfo.Attrib;
ArchiveType = ai.Name; ArchiveType = ai.Name;
if (archiveType != 0) if (archiveType == 0)
{
CMyComBSTR name = ArchiveType;
*archiveType = name.Detach();
}
return S_OK; return S_OK;
return StringToBstr(ArchiveType, archiveType);
COM_TRY_END COM_TRY_END
} }
+2 -4
View File
@@ -69,7 +69,7 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
for (int i = 0; i < pathParts.Size(); i++) for (int i = 0; i < pathParts.Size(); i++)
{ {
_archiveNamePrefix += pathParts[i]; _archiveNamePrefix += pathParts[i];
_archiveNamePrefix += L'\\'; _archiveNamePrefix += WCHAR_PATH_SEPARATOR;
} }
return S_OK; return S_OK;
} }
@@ -138,7 +138,7 @@ static HRESULT EnumerateArchiveItems(CAgent *agent,
ai.IndexInServer = dirItem.Index; ai.IndexInServer = dirItem.Index;
arcItems.Add(ai); arcItems.Add(ai);
} }
RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(L'\\'), arcItems)); RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(WCHAR_PATH_SEPARATOR), arcItems));
} }
return S_OK; return S_OK;
} }
@@ -537,5 +537,3 @@ STDMETHODIMP CAgent::SetProperties(const wchar_t **names,
} }
return S_OK; return S_OK;
} }
+2 -2
View File
@@ -98,7 +98,7 @@ UString CProxyFolder::GetFullPathPrefix() const
const CProxyFolder *current = this; const CProxyFolder *current = this;
while (current->Parent != NULL) while (current->Parent != NULL)
{ {
result = current->Name + UString(L'\\') + result; result = current->Name + UString(WCHAR_PATH_SEPARATOR) + result;
current = current->Parent; current = current->Parent;
} }
return result; return result;
@@ -252,7 +252,7 @@ HRESULT CProxyArchive::ReadObjects(IInArchive *archive, IProgress *progress)
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
{ {
wchar_t c = filePath[i]; wchar_t c = filePath[i];
if (c == '\\' || c == '/') if (c == WCHAR_PATH_SEPARATOR || c == L'/')
{ {
currentItem = currentItem->AddDirSubItem((UInt32)(Int32)-1, false, fileName); currentItem = currentItem->AddDirSubItem((UInt32)(Int32)-1, false, fileName);
fileName.Empty(); fileName.Empty();
+5 -12
View File
@@ -59,9 +59,8 @@ STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *ext
int formatIndex = FindFormat(type); int formatIndex = FindFormat(type);
if (formatIndex < 0) if (formatIndex < 0)
return E_INVALIDARG; return E_INVALIDARG;
CMyComBSTR valueTemp = _codecs.Formats[formatIndex].GetAllExtensions(); // Exts[0].Ext; // Exts[0].Ext;
*extensions = valueTemp.Detach(); return StringToBstr(_codecs.Formats[formatIndex].GetAllExtensions(), extensions);
return S_OK;
} }
*/ */
STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions) STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
@@ -79,9 +78,7 @@ STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
res += lib.IconPairs[j].Ext; res += lib.IconPairs[j].Ext;
} }
} }
CMyComBSTR valueTemp = res; return StringToBstr(res, extensions);
*extensions = valueTemp.Detach();
return S_OK;
} }
STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex) STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
@@ -95,10 +92,8 @@ STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPa
int ii = lib.FindIconIndex(ext); int ii = lib.FindIconIndex(ext);
if (ii >= 0) if (ii >= 0)
{ {
CMyComBSTR iconPathTemp = GetUnicodeString(lib.Path, GetCurrentFileCodePage());
*iconIndex = ii; *iconIndex = ii;
*iconPath = iconPathTemp.Detach(); return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath);
return S_OK;
} }
} }
return S_OK; return S_OK;
@@ -118,9 +113,7 @@ STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
typesStrings += L' '; typesStrings += L' ';
typesStrings += ai.Name; typesStrings += ai.Name;
} }
CMyComBSTR valueTemp = typesStrings; return StringToBstr(typesStrings, types);
*types = valueTemp.Detach();
return S_OK;
} }
STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type, STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
const wchar_t * filePath, IProgress progress) const wchar_t * filePath, IProgress progress)
+3 -9
View File
@@ -151,9 +151,7 @@ STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
PrintError("Password is not defined"); PrintError("Password is not defined");
return E_ABORT; return E_ABORT;
} }
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
@@ -420,9 +418,7 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
PrintError("Password is not defined"); PrintError("Password is not defined");
return E_ABORT; return E_ABORT;
} }
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
@@ -654,9 +650,7 @@ STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDef
} }
} }
*passwordIsDefined = BoolToInt(PasswordIsDefined); *passwordIsDefined = BoolToInt(PasswordIsDefined);
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
+1 -1
View File
@@ -16,7 +16,7 @@ UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix)) if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
{ {
if (dirPrefix.Length() > 0) if (dirPrefix.Length() > 0)
if (dirPrefix[dirPrefix.Length() - 1] == '\\') if (dirPrefix[dirPrefix.Length() - 1] == WCHAR_PATH_SEPARATOR)
{ {
dirPrefix.Delete(dirPrefix.Length() - 1); dirPrefix.Delete(dirPrefix.Length() - 1);
NFile::NFind::CFileInfoW fileInfo; NFile::NFind::CFileInfoW fileInfo;
+6 -3
View File
@@ -129,16 +129,19 @@ void CDirItems::EnumerateDirItems2(const UString &phyPrefix, const UString &logP
continue; continue;
} }
int delimiter = filePath.ReverseFind((wchar_t)kDirDelimiter); int delimiter = filePath.ReverseFind((wchar_t)kDirDelimiter);
UString phyPrefixCur;
int phyParentCur = phyParent; int phyParentCur = phyParent;
if (delimiter >= 0) if (delimiter >= 0)
phyParentCur = AddPrefix(phyParentCur, logParent, filePath.Left(delimiter + 1)); {
phyPrefixCur = filePath.Left(delimiter + 1);
phyParentCur = AddPrefix(phyParent, logParent, phyPrefixCur);
}
AddDirFileInfo(phyParentCur, logParent, fi, Items); AddDirFileInfo(phyParentCur, logParent, fi, Items);
if (fi.IsDir()) if (fi.IsDir())
{ {
const UString name2 = fi.Name + (wchar_t)kDirDelimiter; const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
int parent = AddPrefix(phyParentCur, logParent, name2); int parent = AddPrefix(phyParentCur, logParent, name2);
EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes); EnumerateDirectory(parent, parent, phyPrefix + phyPrefixCur + name2, errorPaths, errorCodes);
} }
} }
ReserveDown(); ReserveDown();
+2 -2
View File
@@ -50,7 +50,7 @@ static CSysString GetLibraryFolderPrefix()
static const TCHAR *kMainDll = TEXT("7z.dll"); static const TCHAR *kMainDll = TEXT("7z.dll");
#ifdef _WIN32 #ifdef _WIN32
static LPCTSTR kRegistryPath = TEXT("Software\\7-zip"); static LPCTSTR kRegistryPath = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-zip");
static LPCTSTR kProgramPathValue = TEXT("Path"); static LPCTSTR kProgramPathValue = TEXT("Path");
static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path) static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
{ {
@@ -446,7 +446,7 @@ HRESULT CCodecs::Load()
int CCodecs::FindFormatForArchiveName(const UString &arcPath) const int CCodecs::FindFormatForArchiveName(const UString &arcPath) const
{ {
int slashPos1 = arcPath.ReverseFind(L'\\'); int slashPos1 = arcPath.ReverseFind(WCHAR_PATH_SEPARATOR);
int slashPos2 = arcPath.ReverseFind(L'.'); int slashPos2 = arcPath.ReverseFind(L'.');
int dotPos = arcPath.ReverseFind(L'.'); int dotPos = arcPath.ReverseFind(L'.');
if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2) if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2)
+1 -1
View File
@@ -175,7 +175,7 @@ HRESULT OpenArchive(
processedSize--; processedSize--;
for (UInt32 pos = 0; pos < processedSize; pos++) for (UInt32 pos = 0; pos < processedSize; pos++)
{ {
for (; hash[buf[pos] | ((UInt32)buf[pos + 1] << 8)] == 0xFF && pos < processedSize; pos++); for (; pos < processedSize && hash[buf[pos] | ((UInt32)buf[pos + 1] << 8)] == 0xFF; pos++);
if (pos == processedSize) if (pos == processedSize)
break; break;
UInt32 v = buf[pos] | ((UInt32)buf[pos + 1] << 8); UInt32 v = buf[pos] | ((UInt32)buf[pos + 1] << 8);
@@ -152,9 +152,7 @@ STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
Password = GetPassword(OutStream); Password = GetPassword(OutStream);
PasswordIsDefined = true; PasswordIsDefined = true;
} }
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
#endif #endif
+1 -3
View File
@@ -35,9 +35,7 @@ HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
Password = GetPassword(OutStream); Password = GetPassword(OutStream);
PasswordIsDefined = true; PasswordIsDefined = true;
} }
CMyComBSTR temp(Password); return StringToBstr(Password, password);
*password = temp.Detach();
return S_OK;
} }
HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password) HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password)
@@ -199,8 +199,7 @@ HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined,
#ifdef _NO_CRYPTO #ifdef _NO_CRYPTO
*passwordIsDefined = false; *passwordIsDefined = false;
CMyComBSTR tempName(L""); return StringToBstr(L"", password);
*password = tempName.Detach();
#else #else
@@ -213,10 +212,8 @@ HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined,
} }
} }
*passwordIsDefined = BoolToInt(PasswordIsDefined); *passwordIsDefined = BoolToInt(PasswordIsDefined);
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
#endif #endif
return S_OK;
} }
+21 -17
View File
@@ -309,6 +309,16 @@ static UString GetReducedString(const UString &s)
return s.Left(kFirstPartSize) + UString(L" ... ") + s.Right(kMaxSize - kFirstPartSize); return s.Left(kFirstPartSize) + UString(L" ... ") + s.Right(kMaxSize - kFirstPartSize);
} }
static UString GetQuotedString(const UString &s)
{
return UString(L'\"') + s + UString(L'\"');
}
static UString GetQuotedReducedString(const UString &s)
{
return GetQuotedString(GetReducedString(s));
}
static const wchar_t *kExtractExludeExtensions[] = static const wchar_t *kExtractExludeExtensions[] =
{ {
L"txt", L"htm", L"html", L"xml", L"xsd", L"xsl", L"xslt", L"asp", L"aspx", L"css", L"shtml", L"txt", L"htm", L"html", L"xml", L"xsd", L"xsl", L"xslt", L"asp", L"aspx", L"css", L"shtml",
@@ -435,7 +445,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = _dropPath; commandMapItem.Folder = _dropPath;
else else
commandMapItem.Folder = folderPrefix; commandMapItem.Folder = folderPrefix;
commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(L'\\'); commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(WCHAR_PATH_SEPARATOR);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem); _commandMap.Add(commandMapItem);
} }
@@ -469,7 +479,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
else else
commandMapItem.Folder = folderPrefix; commandMapItem.Folder = folderPrefix;
commandMapItem.Folder += folder; commandMapItem.Folder += folder;
s = MyFormatNew(s, GetReducedString(UString(L"\"") + folder + UString(L"\\\""))); s = MyFormatNew(s, GetQuotedReducedString(folder + UString(WCHAR_PATH_SEPARATOR)));
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem); _commandMap.Add(commandMapItem);
} }
@@ -525,8 +535,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = archivePathPrefix; commandMapItem.Folder = archivePathPrefix;
commandMapItem.Archive = archiveName7z; commandMapItem.Archive = archiveName7z;
commandMapItem.ArchiveType = L"7z"; commandMapItem.ArchiveType = L"7z";
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\""); s = MyFormatNew(s, GetQuotedReducedString(archiveName7z));
s = MyFormatNew(s, t);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem); _commandMap.Add(commandMapItem);
} }
@@ -539,8 +548,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
FillCommand(kCompressTo7zEmail, s, commandMapItem); FillCommand(kCompressTo7zEmail, s, commandMapItem);
commandMapItem.Archive = archiveName7z; commandMapItem.Archive = archiveName7z;
commandMapItem.ArchiveType = L"7z"; commandMapItem.ArchiveType = L"7z";
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\""); s = MyFormatNew(s, GetQuotedReducedString(archiveName7z));
s = MyFormatNew(s, t);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem); _commandMap.Add(commandMapItem);
} }
@@ -557,8 +565,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = archivePathPrefix; commandMapItem.Folder = archivePathPrefix;
commandMapItem.Archive = archiveNameZip; commandMapItem.Archive = archiveNameZip;
commandMapItem.ArchiveType = L"zip"; commandMapItem.ArchiveType = L"zip";
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\""); s = MyFormatNew(s, GetQuotedReducedString(archiveNameZip));
s = MyFormatNew(s, t);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem); _commandMap.Add(commandMapItem);
} }
@@ -571,8 +578,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
FillCommand(kCompressToZipEmail, s, commandMapItem); FillCommand(kCompressToZipEmail, s, commandMapItem);
commandMapItem.Archive = archiveNameZip; commandMapItem.Archive = archiveNameZip;
commandMapItem.ArchiveType = L"zip"; commandMapItem.ArchiveType = L"zip";
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\""); s = MyFormatNew(s, GetQuotedReducedString(archiveNameZip));
s = MyFormatNew(s, t);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem); _commandMap.Add(commandMapItem);
} }
@@ -614,12 +620,11 @@ extern const char *kShellFolderClassIDString;
static UString GetProgramCommand() static UString GetProgramCommand()
{ {
UString path = L"\""; UString path;
UString folder; UString folder;
if (GetProgramFolderPath(folder)) if (GetProgramFolderPath(folder))
path += folder; path = folder;
path += L"7zFM.exe\""; return GetQuotedString(path + L"7zFM.exe");
return path;
} }
STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo) STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
@@ -658,9 +663,8 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
{ {
UString params; UString params;
params = GetProgramCommand(); params = GetProgramCommand();
params += L" \""; params += L' ';
params += _fileNames[0]; params += GetQuotedString(_fileNames[0]);
params += L"\"";
MyCreateProcess(params, 0, false, 0); MyCreateProcess(params, 0, false, 0);
break; break;
} }
+1 -4
View File
@@ -170,8 +170,5 @@ STDMETHODIMP CExtractCallBackImp::CryptoGetTextPassword(BSTR *password)
RINOK(GetPassword(m_Password)); RINOK(GetPassword(m_Password));
m_PasswordIsDefined = true; m_PasswordIsDefined = true;
} }
CMyComBSTR tempName = m_Password; return StringToBstr(m_Password, password);
*password = tempName.Detach();
return S_OK;
} }
+1 -3
View File
@@ -359,9 +359,7 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
RINOK(GetPassword(Password)); RINOK(GetPassword(Password));
PasswordIsDefined = true; PasswordIsDefined = true;
} }
CMyComBSTR temp = Password; return StringToBstr(Password, password);
*password = temp.Detach();
return S_OK;
} }
/* /*
+3 -3
View File
@@ -208,7 +208,7 @@ void CPlugin::EnterToDirectory(const UString &dirName)
int CPlugin::SetDirectory(const char *aszDir, int /* opMode */) int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
{ {
UString path = MultiByteToUnicodeString(aszDir, CP_OEMCP); UString path = MultiByteToUnicodeString(aszDir, CP_OEMCP);
if (path == L"\\") if (path == WSTRING_PATH_SEPARATOR)
{ {
_folder.Release(); _folder.Release();
m_ArchiveHandler->BindToRootFolder(&_folder); m_ArchiveHandler->BindToRootFolder(&_folder);
@@ -225,7 +225,7 @@ int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
EnterToDirectory(path); EnterToDirectory(path);
else else
{ {
if (path[0] == L'\\') if (path[0] == WCHAR_PATH_SEPARATOR)
{ {
_folder.Release(); _folder.Release();
m_ArchiveHandler->BindToRootFolder(&_folder); m_ArchiveHandler->BindToRootFolder(&_folder);
@@ -265,7 +265,7 @@ void CPlugin::GetCurrentDir()
GetPathParts(pathParts); GetPathParts(pathParts);
for (int i = 0; i < pathParts.Size(); i++) for (int i = 0; i < pathParts.Size(); i++)
{ {
m_CurrentDir += L'\\'; m_CurrentDir += WCHAR_PATH_SEPARATOR;
m_CurrentDir += pathParts[i]; m_CurrentDir += pathParts[i];
} }
} }
+12 -13
View File
@@ -443,7 +443,7 @@ static void ReducePathToRealFileSystemPath(UString &path)
NName::NormalizeDirPathPrefix(path); NName::NormalizeDirPathPrefix(path);
break; break;
} }
int pos = path.ReverseFind('\\'); int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0) if (pos < 0)
path.Empty(); path.Empty();
else else
@@ -453,8 +453,8 @@ static void ReducePathToRealFileSystemPath(UString &path)
break; break;
if (path.Length() > 2 && path[0] == '\\' && path[1] == '\\') if (path.Length() > 2 && path[0] == '\\' && path[1] == '\\')
{ {
int nextPos = path.Find('\\', 2); // pos after \\COMPNAME int nextPos = path.Find(WCHAR_PATH_SEPARATOR, 2); // pos after \\COMPNAME
if (nextPos > 0 && path.Find('\\', nextPos + 1) == pos) if (nextPos > 0 && path.Find(WCHAR_PATH_SEPARATOR, nextPos + 1) == pos)
break; break;
} }
path = path.Left(pos); path = path.Left(pos);
@@ -472,9 +472,12 @@ static bool CheckFolderPath(const UString &path)
static bool IsPathAbsolute(const UString &path) static bool IsPathAbsolute(const UString &path)
{ {
if ((path.Length() >= 1 && path[0] == L'\\') || if (path.Length() >= 1 && path[0] == WCHAR_PATH_SEPARATOR)
(path.Length() >= 3 && path[1] == L':' && path[2] == L'\\'))
return true; return true;
#ifdef _WIN32
if (path.Length() >= 3 && path[1] == L':' && path[2] == L'\\')
return true;
#endif
return false; return false;
} }
@@ -564,7 +567,7 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
int index = indices[i]; int index = indices[i];
info += GetItemRelPath(index); info += GetItemRelPath(index);
if (IsItemFolder(index)) if (IsItemFolder(index))
info += L'\\'; info += WCHAR_PATH_SEPARATOR;
} }
if (i != indices.Size()) if (i != indices.Size())
info += L"\n ..."; info += L"\n ...";
@@ -656,7 +659,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
return; return;
} }
if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind('\\') == destPath.Length() - 1) || if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind(WCHAR_PATH_SEPARATOR) == destPath.Length() - 1) ||
IsThereFolderOfPath(destPath)) IsThereFolderOfPath(destPath))
{ {
NDirectory::CreateComplexDirectory(destPath); NDirectory::CreateComplexDirectory(destPath);
@@ -673,7 +676,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
} }
else else
{ {
int pos = destPath.ReverseFind('\\'); int pos = destPath.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos >= 0) if (pos >= 0)
{ {
UString prefix = destPath.Left(pos + 1); UString prefix = destPath.Left(pos + 1);
@@ -789,12 +792,8 @@ void CApp::OnSetSubFolder(int srcPanelIndex)
if (!srcPanel.IsItemFolder(realIndex)) if (!srcPanel.IsItemFolder(realIndex))
return; return;
// destPanel.BindToFolder(srcPanel._currentFolderPrefix + srcPanel.GetItemName(realIndex) + WCHAR_PATH_SEPARATOR);
/*
UString string = srcPanel._currentFolderPrefix +
srcPanel.GetItemName(realIndex) + L'\\';
destPanel.BindToFolder(string);
*/
CMyComPtr<IFolderFolder> newFolder; CMyComPtr<IFolderFolder> newFolder;
if (realIndex == kParentIndex) if (realIndex == kParentIndex)
{ {
+7 -8
View File
@@ -51,6 +51,13 @@ class CFolderHistory
{ {
NWindows::NSynchronization::CCriticalSection _criticalSection; NWindows::NSynchronization::CCriticalSection _criticalSection;
UStringVector Strings; UStringVector Strings;
void Normalize()
{
const int kMaxSize = 100;
if (Strings.Size() > kMaxSize)
Strings.Delete(kMaxSize, Strings.Size() - kMaxSize);
}
public: public:
void GetList(UStringVector &foldersHistory) void GetList(UStringVector &foldersHistory)
@@ -59,14 +66,6 @@ public:
foldersHistory = Strings; foldersHistory = Strings;
} }
void Normalize()
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
const int kMaxSize = 100;
if (Strings.Size() > kMaxSize)
Strings.Delete(kMaxSize, Strings.Size() - kMaxSize);
}
void AddString(const UString &string) void AddString(const UString &string)
{ {
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+5 -12
View File
@@ -369,9 +369,7 @@ STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
Password = dialog.Password; Password = dialog.Password;
PasswordIsDefined = true; PasswordIsDefined = true;
} }
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
@@ -384,12 +382,9 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
Int32 *writeAnswer) Int32 *writeAnswer)
{ {
UString destPathResultTemp = destPath; UString destPathResultTemp = destPath;
/*
{ // RINOK(StringToBstr(destPath, destPathResult));
CMyComBSTR destPathResultBSTR = destPath;
*destPathResult = destPathResultBSTR.Detach();
}
*/
*destPathResult = 0; *destPathResult = 0;
*writeAnswer = BoolToInt(false); *writeAnswer = BoolToInt(false);
@@ -476,9 +471,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
return E_ABORT; return E_ABORT;
} }
} }
CMyComBSTR destPathResultBSTR(destPathResultTemp);
*destPathResult = destPathResultBSTR.Detach();
*writeAnswer = BoolToInt(true); *writeAnswer = BoolToInt(true);
return S_OK; return StringToBstr(destPathResultTemp, destPathResult);
} }
+1 -1
View File
@@ -67,7 +67,7 @@ static UString GetProgramPath()
UString GetProgramFolderPrefix() UString GetProgramFolderPrefix()
{ {
UString path = GetProgramPath(); UString path = GetProgramPath();
int pos = path.ReverseFind(L'\\'); int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
return path.Left(pos + 1); return path.Left(pos + 1);
} }
+4
View File
@@ -767,6 +767,10 @@ SOURCE=..\..\..\Windows\Clipboard.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\Windows\COM.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\CommonDialog.cpp SOURCE=..\..\..\Windows\CommonDialog.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+1 -1
View File
@@ -195,7 +195,7 @@ STDMETHODIMP CFSDrives::GetFolderProperty(PROPID propID, PROPVARIANT *value)
switch(propID) switch(propID)
{ {
case kpidType: prop = L"FSDrives"; break; case kpidType: prop = L"FSDrives"; break;
case kpidPath: prop = LangString(IDS_COMPUTER, 0x03020300) + UString(L'\\'); break; case kpidPath: prop = LangString(IDS_COMPUTER, 0x03020300) + UString(WCHAR_PATH_SEPARATOR); break;
} }
prop.Detach(value); prop.Detach(value);
return S_OK; return S_OK;
+10 -10
View File
@@ -75,14 +75,14 @@ HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles,
{ {
RINOK(progress->SetCompleted(NULL)); RINOK(progress->SetCompleted(NULL));
numFiles = numFolders = size = 0; numFiles = numFolders = size = 0;
CEnumeratorW enumerator(path + UString(L"\\*")); CEnumeratorW enumerator(path + UString(WSTRING_PATH_SEPARATOR L"*"));
CFileInfoW fileInfo; CFileInfoW fileInfo;
while (enumerator.Next(fileInfo)) while (enumerator.Next(fileInfo))
{ {
if (fileInfo.IsDir()) if (fileInfo.IsDir())
{ {
UInt64 subFolders, subFiles, subSize; UInt64 subFolders, subFiles, subSize;
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name, subFolders, subFiles, subSize, progress)); RINOK(GetFolderSize(path + UString(WCHAR_PATH_SEPARATOR) + fileInfo.Name, subFolders, subFiles, subSize, progress));
numFolders += subFolders; numFolders += subFolders;
numFolders++; numFolders++;
numFiles += subFiles; numFiles += subFiles;
@@ -125,7 +125,7 @@ HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path)
{ {
CDirItem &item = dirItem.Files[i]; CDirItem &item = dirItem.Files[i];
if (item.IsDir()) if (item.IsDir())
LoadSubItems(item, path + item.Name + L'\\'); LoadSubItems(item, path + item.Name + WCHAR_PATH_SEPARATOR);
} }
return S_OK; return S_OK;
} }
@@ -311,7 +311,7 @@ HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultF
*resultFolder = 0; *resultFolder = 0;
CFSFolder *folderSpec = new CFSFolder; CFSFolder *folderSpec = new CFSFolder;
CMyComPtr<IFolderFolder> subFolder = folderSpec; CMyComPtr<IFolderFolder> subFolder = folderSpec;
RINOK(folderSpec->Init(_path + name + UString(L'\\'), 0)); RINOK(folderSpec->Init(_path + name + UString(WCHAR_PATH_SEPARATOR), 0));
*resultFolder = subFolder.Detach(); *resultFolder = subFolder.Detach();
return S_OK; return S_OK;
} }
@@ -322,7 +322,7 @@ UString CFSFolder::GetPrefix(const CDirItem &item) const
CDirItem *cur = item.Parent; CDirItem *cur = item.Parent;
while (cur->Parent != 0) while (cur->Parent != 0)
{ {
path = cur->Name + UString('\\') + path; path = cur->Name + UString(WCHAR_PATH_SEPARATOR) + path;
cur = cur->Parent; cur = cur->Parent;
} }
return path; return path;
@@ -358,11 +358,11 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
} }
if (_path.IsEmpty()) if (_path.IsEmpty())
return E_INVALIDARG; return E_INVALIDARG;
int pos = _path.ReverseFind(L'\\'); int pos = _path.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0 || pos != _path.Length() - 1) if (pos < 0 || pos != _path.Length() - 1)
return E_FAIL; return E_FAIL;
UString parentPath = _path.Left(pos); UString parentPath = _path.Left(pos);
pos = parentPath.ReverseFind(L'\\'); pos = parentPath.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0) if (pos < 0)
{ {
parentPath.Empty(); parentPath.Empty();
@@ -374,10 +374,10 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
} }
UString parentPathReduced = parentPath.Left(pos); UString parentPathReduced = parentPath.Left(pos);
parentPath = parentPath.Left(pos + 1); parentPath = parentPath.Left(pos + 1);
pos = parentPathReduced.ReverseFind(L'\\'); pos = parentPathReduced.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos == 1) if (pos == 1)
{ {
if (parentPath[0] != L'\\') if (parentPath[0] != WCHAR_PATH_SEPARATOR)
return E_FAIL; return E_FAIL;
CNetFolder *netFolderSpec = new CNetFolder; CNetFolder *netFolderSpec = new CNetFolder;
CMyComPtr<IFolderFolder> netFolder = netFolderSpec; CMyComPtr<IFolderFolder> netFolder = netFolderSpec;
@@ -537,7 +537,7 @@ HRESULT CFSFolder::GetComplexName(const wchar_t *name, UString &resultPath)
resultPath = _path + newName; resultPath = _path + newName;
if (newName.Length() < 1) if (newName.Length() < 1)
return S_OK; return S_OK;
if (newName[0] == L'\\') if (newName[0] == WCHAR_PATH_SEPARATOR)
{ {
resultPath = newName; resultPath = newName;
return S_OK; return S_OK;
+40 -35
View File
@@ -216,6 +216,11 @@ static HRESULT MyCopyFile(
return callback->SetCompleted(&completedSize); return callback->SetCompleted(&completedSize);
} }
static UString CombinePath(const UString &folderPath, const UString &fileName)
{
return folderPath + UString(WCHAR_PATH_SEPARATOR) + fileName;
}
static HRESULT CopyFolder( static HRESULT CopyFolder(
const UString &srcPath, const UString &srcPath,
const UString &destPathSpec, const UString &destPathSpec,
@@ -224,11 +229,11 @@ static HRESULT CopyFolder(
{ {
RINOK(callback->SetCompleted(&completedSize)); RINOK(callback->SetCompleted(&completedSize));
UString destPath = destPathSpec; const UString destPath = destPathSpec;
int len = srcPath.Length(); int len = srcPath.Length();
if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0) if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
{ {
if (destPath.Length() == len || destPath[len] == L'\\') if (destPath.Length() == len || destPath[len] == WCHAR_PATH_SEPARATOR)
{ {
UString message = UString(L"can not copy folder \'") + UString message = UString(L"can not copy folder \'") +
destPath + UString(L"\' onto itself"); destPath + UString(L"\' onto itself");
@@ -243,19 +248,19 @@ static HRESULT CopyFolder(
RINOK(callback->ShowMessage(message)); RINOK(callback->ShowMessage(message));
return E_ABORT; return E_ABORT;
} }
CEnumeratorW enumerator(srcPath + UString(L"\\*")); CEnumeratorW enumerator(CombinePath(srcPath, L"*"));
CFileInfoEx fileInfo; CFileInfoEx fi;
while (enumerator.Next(fileInfo)) while (enumerator.Next(fi))
{ {
const UString srcPath2 = srcPath + UString(L"\\") + fileInfo.Name; const UString srcPath2 = CombinePath(srcPath, fi.Name);
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name; const UString destPath2 = CombinePath(destPath, fi.Name);
if (fileInfo.IsDir()) if (fi.IsDir())
{ {
RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize)); RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize))
} }
else else
{ {
RINOK(MyCopyFile(srcPath2, fileInfo, destPath2, callback, completedSize)); RINOK(MyCopyFile(srcPath2, fi, destPath2, callback, completedSize));
} }
} }
return S_OK; return S_OK;
@@ -275,7 +280,7 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
UString destPath = path; UString destPath = path;
if (destPath.IsEmpty()) if (destPath.IsEmpty())
return E_INVALIDARG; return E_INVALIDARG;
bool directName = (destPath[destPath.Length() - 1] != L'\\'); bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
if (directName) if (directName)
{ {
if (numItems > 1) if (numItems > 1)
@@ -298,18 +303,18 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
RINOK(callback->SetCompleted(&completedSize)); RINOK(callback->SetCompleted(&completedSize));
for (UInt32 i = 0; i < numItems; i++) for (UInt32 i = 0; i < numItems; i++)
{ {
const CDirItem &fileInfo = *_refs[indices[i]]; const CDirItem &fi = *_refs[indices[i]];
UString destPath2 = destPath; UString destPath2 = destPath;
if (!directName) if (!directName)
destPath2 += fileInfo.Name; destPath2 += fi.Name;
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name; UString srcPath = _path + GetPrefix(fi) + fi.Name;
if (fileInfo.IsDir()) if (fi.IsDir())
{ {
RINOK(CopyFolder(srcPath, destPath2, callback, completedSize)); RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
} }
else else
{ {
RINOK(MyCopyFile(srcPath, fileInfo, destPath2, callback, completedSize)); RINOK(MyCopyFile(srcPath, fi, destPath2, callback, completedSize));
} }
} }
return S_OK; return S_OK;
@@ -369,7 +374,7 @@ HRESULT MyMoveFolder(
int len = srcPath.Length(); int len = srcPath.Length();
if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0) if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
{ {
if (destPath.Length() == len || destPath[len] == L'\\') if (destPath.Length() == len || destPath[len] == WCHAR_PATH_SEPARATOR)
{ {
UString message = UString(L"can not move folder \'") + UString message = UString(L"can not move folder \'") +
destPath + UString(L"\' onto itself"); destPath + UString(L"\' onto itself");
@@ -388,19 +393,19 @@ HRESULT MyMoveFolder(
return E_ABORT; return E_ABORT;
} }
{ {
CEnumeratorW enumerator(srcPath + UString(L"\\*")); CEnumeratorW enumerator(CombinePath(srcPath, L"*"));
CFileInfoEx fileInfo; CFileInfoEx fi;
while (enumerator.Next(fileInfo)) while (enumerator.Next(fi))
{ {
const UString srcPath2 = srcPath + UString(L"\\") + fileInfo.Name; const UString srcPath2 = CombinePath(srcPath, fi.Name);
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name; const UString destPath2 = CombinePath(destPath, fi.Name);
if (fileInfo.IsDir()) if (fi.IsDir())
{ {
RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize)); RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize));
} }
else else
{ {
RINOK(MyMoveFile(srcPath2, fileInfo, destPath2, callback, completedSize)); RINOK(MyMoveFile(srcPath2, fi, destPath2, callback, completedSize));
} }
} }
} }
@@ -430,7 +435,7 @@ STDMETHODIMP CFSFolder::MoveTo(
UString destPath = path; UString destPath = path;
if (destPath.IsEmpty()) if (destPath.IsEmpty())
return E_INVALIDARG; return E_INVALIDARG;
bool directName = (destPath[destPath.Length() - 1] != L'\\'); bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
if (directName) if (directName)
{ {
if (numItems > 1) if (numItems > 1)
@@ -449,18 +454,18 @@ STDMETHODIMP CFSFolder::MoveTo(
RINOK(callback->SetCompleted(&completedSize)); RINOK(callback->SetCompleted(&completedSize));
for (UInt32 i = 0; i < numItems; i++) for (UInt32 i = 0; i < numItems; i++)
{ {
const CDirItem &fileInfo = *_refs[indices[i]]; const CDirItem &fi = *_refs[indices[i]];
UString destPath2 = destPath; UString destPath2 = destPath;
if (!directName) if (!directName)
destPath2 += fileInfo.Name; destPath2 += fi.Name;
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name; UString srcPath = _path + GetPrefix(fi) + fi.Name;
if (fileInfo.IsDir()) if (fi.IsDir())
{ {
RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize)); RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
} }
else else
{ {
RINOK(MyMoveFile(srcPath, fileInfo, destPath2, callback, completedSize)); RINOK(MyMoveFile(srcPath, fi, destPath2, callback, completedSize));
} }
} }
return S_OK; return S_OK;
@@ -477,13 +482,13 @@ STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
{ {
UString path = (UString)fromFolderPath + itemsPaths[i]; UString path = (UString)fromFolderPath + itemsPaths[i];
CFileInfoW fileInfo; CFileInfoW fi;
if (!FindFile(path, fileInfo)) if (!FindFile(path, fi))
return ::GetLastError(); return ::GetLastError();
if (fileInfo.IsDir()) if (fi.IsDir())
{ {
UInt64 subFolders, subFiles, subSize; UInt64 subFolders, subFiles, subSize;
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name, subFolders, subFiles, subSize, progress)); RINOK(GetFolderSize(CombinePath(path, fi.Name), subFolders, subFiles, subSize, progress));
numFolders += subFolders; numFolders += subFolders;
numFolders++; numFolders++;
numFiles += subFiles; numFiles += subFiles;
@@ -492,7 +497,7 @@ STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
else else
{ {
numFiles++; numFiles++;
totalSize += fileInfo.Size; totalSize += fi.Size;
} }
} }
RINOK(progress->SetTotal(totalSize)); RINOK(progress->SetTotal(totalSize));
@@ -74,7 +74,7 @@ HRESULT OpenFileFolderPlugin(
NFile::NName::SplitNameToPureNameAndExtension(name, pureName, dot, extension); NFile::NName::SplitNameToPureNameAndExtension(name, pureName, dot, extension);
int slashPos = path.ReverseFind(L'\\'); int slashPos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
UString dirPrefix; UString dirPrefix;
UString fileName; UString fileName;
if (slashPos >= 0) if (slashPos >= 0)
+9 -9
View File
@@ -75,7 +75,7 @@ void CNetFolder::Init(const NWindows::NNet::CResourceW *netResource,
_netResourcePointer = &_netResource; _netResourcePointer = &_netResource;
// if (_netResource.DisplayType == RESOURCEDISPLAYTYPE_SERVER) // if (_netResource.DisplayType == RESOURCEDISPLAYTYPE_SERVER)
_path = _netResource.RemoteName + L'\\'; _path = _netResource.RemoteName + WCHAR_PATH_SEPARATOR;
} }
_parentFolder = parentFolder; _parentFolder = parentFolder;
} }
@@ -113,11 +113,11 @@ STDMETHODIMP CNetFolder::LoadItems()
if (!resource.RemoteNameIsDefined) // For Win 98, I don't know what's wrong if (!resource.RemoteNameIsDefined) // For Win 98, I don't know what's wrong
resource.RemoteName = resource.Comment; resource.RemoteName = resource.Comment;
resource.Name = resource.RemoteName; resource.Name = resource.RemoteName;
int aPos = resource.Name.ReverseFind(L'\\'); int pos = resource.Name.ReverseFind(WCHAR_PATH_SEPARATOR);
if (aPos >= 0) if (pos >= 0)
{ {
// _path = resource.Name.Left(aPos + 1); // _path = resource.Name.Left(pos + 1);
resource.Name = resource.Name.Mid(aPos + 1); resource.Name = resource.Name.Mid(pos + 1);
} }
_items.Add(resource); _items.Add(resource);
} }
@@ -140,7 +140,7 @@ STDMETHODIMP CNetFolder::LoadItems()
NFile::NFind::CFindFile findFile; NFile::NFind::CFindFile findFile;
NFile::NFind::CFileInfoW fileInfo; NFile::NFind::CFileInfoW fileInfo;
if (!findFile.FindFirst(resource.RemoteName + UString(L"\\*"), fileInfo)) if (!findFile.FindFirst(resource.RemoteName + UString(WCHAR_PATH_SEPARATOR) + UString(L"*"), fileInfo))
continue; continue;
resource.Usage = RESOURCEUSAGE_CONNECTABLE; resource.Usage = RESOURCEUSAGE_CONNECTABLE;
resource.LocalNameIsDefined = false; resource.LocalNameIsDefined = false;
@@ -188,14 +188,14 @@ STDMETHODIMP CNetFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder
{ {
NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder; NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
CMyComPtr<IFolderFolder> subFolder = fsFolderSpec; CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
RINOK(fsFolderSpec->Init(resource.RemoteName + L'\\', this)); RINOK(fsFolderSpec->Init(resource.RemoteName + WCHAR_PATH_SEPARATOR, this));
*resultFolder = subFolder.Detach(); *resultFolder = subFolder.Detach();
} }
else else
{ {
CNetFolder *netFolder = new CNetFolder; CNetFolder *netFolder = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolder; CMyComPtr<IFolderFolder> subFolder = netFolder;
netFolder->Init(&resource, this, resource.Name + L'\\'); netFolder->Init(&resource, this, resource.Name + WCHAR_PATH_SEPARATOR);
*resultFolder = subFolder.Detach(); *resultFolder = subFolder.Detach();
} }
return S_OK; return S_OK;
@@ -226,7 +226,7 @@ STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder)
CNetFolder *netFolder = new CNetFolder; CNetFolder *netFolder = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolder; CMyComPtr<IFolderFolder> subFolder = netFolder;
netFolder->Init(&resourceParent, 0, L'\\'); netFolder->Init(&resourceParent, 0, WCHAR_PATH_SEPARATOR);
*resultFolder = subFolder.Detach(); *resultFolder = subFolder.Detach();
} }
return S_OK; return S_OK;
+1 -3
View File
@@ -120,7 +120,5 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
Password = dialog.Password; Password = dialog.Password;
PasswordIsDefined = true; PasswordIsDefined = true;
} }
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
+2 -2
View File
@@ -800,7 +800,7 @@ void CPanel::AddToArchive()
static UString GetSubFolderNameForExtract(const UString &archiveName) static UString GetSubFolderNameForExtract(const UString &archiveName)
{ {
int slashPos = archiveName.ReverseFind(L'\\'); int slashPos = archiveName.ReverseFind(WCHAR_PATH_SEPARATOR);
int dotPos = archiveName.ReverseFind(L'.'); int dotPos = archiveName.ReverseFind(L'.');
if (dotPos < 0 || slashPos > dotPos) if (dotPos < 0 || slashPos > dotPos)
return archiveName + UString(L"~"); return archiveName + UString(L"~");
@@ -846,7 +846,7 @@ void CPanel::ExtractArchives()
folderName = GetSubFolderNameForExtract(GetItemRelPath(indices[0])); folderName = GetSubFolderNameForExtract(GetItemRelPath(indices[0]));
else else
folderName = L"*"; folderName = L"*";
::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(L"\\"), true); ::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(WCHAR_PATH_SEPARATOR), true);
} }
struct CThreadTest struct CThreadTest
+1 -1
View File
@@ -64,7 +64,7 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr
if (Index >= FileNames.Size()) if (Index >= FileNames.Size())
return true; return true;
const UString &path = FileNames[Index]; const UString &path = FileNames[Index];
int pos = path.ReverseFind('\\'); int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
resPath.Empty(); resPath.Empty();
if (pos >= 0) if (pos >= 0)
resPath = path.Left(pos + 1); resPath = path.Left(pos + 1);
+3 -6
View File
@@ -570,7 +570,7 @@ bool CDropTarget::IsItSameDrive() const
return false; return false;
} }
else if (m_Panel->IsFSDrivesFolder() && m_SelectionIndex >= 0) else if (m_Panel->IsFSDrivesFolder() && m_SelectionIndex >= 0)
drive = m_SubFolderName + L'\\'; drive = m_SubFolderName + WCHAR_PATH_SEPARATOR;
else else
return false; return false;
@@ -591,10 +591,7 @@ DWORD CDropTarget::GetEffect(DWORD keyState, POINTL /* pt */, DWORD allowedEffec
if (!m_DropIsAllowed || !m_PanelDropIsAllowed) if (!m_DropIsAllowed || !m_PanelDropIsAllowed)
return DROPEFFECT_NONE; return DROPEFFECT_NONE;
if (!IsFsFolderPath()) if (!IsFsFolderPath() || !m_SetPathIsOK)
allowedEffect &= ~DROPEFFECT_MOVE;
if (!m_SetPathIsOK)
allowedEffect &= ~DROPEFFECT_MOVE; allowedEffect &= ~DROPEFFECT_MOVE;
DWORD effect = 0; DWORD effect = 0;
@@ -627,7 +624,7 @@ UString CDropTarget::GetTargetPath() const
if (m_SubFolderIndex >= 0 && !m_SubFolderName.IsEmpty()) if (m_SubFolderIndex >= 0 && !m_SubFolderName.IsEmpty())
{ {
path += m_SubFolderName; path += m_SubFolderName;
path += L"\\"; path += WCHAR_PATH_SEPARATOR;
} }
return path; return path;
} }
+13 -7
View File
@@ -73,7 +73,7 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool
{ {
if (FindFile(sysPath, fileInfo)) if (FindFile(sysPath, fileInfo))
break; break;
int pos = sysPath.ReverseFind(L'\\'); int pos = sysPath.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0) if (pos < 0)
sysPath.Empty(); sysPath.Empty();
else else
@@ -175,7 +175,7 @@ void CPanel::LoadFullPath()
const CFolderLink &folderLink = _parentFolders[i]; const CFolderLink &folderLink = _parentFolders[i];
_currentFolderPrefix += GetFolderPath(folderLink.ParentFolder); _currentFolderPrefix += GetFolderPath(folderLink.ParentFolder);
_currentFolderPrefix += folderLink.ItemName; _currentFolderPrefix += folderLink.ItemName;
_currentFolderPrefix += L'\\'; _currentFolderPrefix += WCHAR_PATH_SEPARATOR;
} }
if (_folder) if (_folder)
_currentFolderPrefix += GetFolderPath(_folder); _currentFolderPrefix += GetFolderPath(_folder);
@@ -199,7 +199,13 @@ void CPanel::LoadFullPathAndShow()
item.mask = 0; item.mask = 0;
UString path = _currentFolderPrefix; UString path = _currentFolderPrefix;
if (path.Length() > 3 && path[path.Length() - 1] == L'\\') if (path.Length() >
#ifdef _WIN32
3
#else
1
#endif
&& path[path.Length() - 1] == WCHAR_PATH_SEPARATOR)
path.Delete(path.Length() - 1); path.Delete(path.Length() - 1);
CFileInfoW info; CFileInfoW info;
@@ -334,12 +340,12 @@ bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
sumPass += name; sumPass += name;
UString curName = sumPass; UString curName = sumPass;
if (i == 0) if (i == 0)
curName += L"\\"; curName += WCHAR_PATH_SEPARATOR;
CFileInfoW info; CFileInfoW info;
DWORD attrib = FILE_ATTRIBUTE_DIRECTORY; DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
if (NFile::NFind::FindFile(sumPass, info)) if (NFile::NFind::FindFile(sumPass, info))
attrib = info.Attrib; attrib = info.Attrib;
sumPass += L"\\"; sumPass += WCHAR_PATH_SEPARATOR;
AddComboBoxItem(name, GetRealIconIndex(curName, attrib), i, false); AddComboBoxItem(name, GetRealIconIndex(curName, attrib), i, false);
ComboBoxPaths.Add(sumPass); ComboBoxPaths.Add(sumPass);
} }
@@ -357,7 +363,7 @@ bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
UString s = driveStrings[i]; UString s = driveStrings[i];
ComboBoxPaths.Add(s); ComboBoxPaths.Add(s);
int iconIndex = GetRealIconIndex(s, 0); int iconIndex = GetRealIconIndex(s, 0);
if (s.Length() > 0 && s[s.Length() - 1] == '\\') if (s.Length() > 0 && s[s.Length() - 1] == WCHAR_PATH_SEPARATOR)
s.Delete(s.Length() - 1); s.Delete(s.Length() - 1);
AddComboBoxItem(s, iconIndex, 1, false); AddComboBoxItem(s, iconIndex, 1, false);
} }
@@ -463,7 +469,7 @@ void CPanel::OpenParentFolder()
{ {
UString string = _currentFolderPrefix; UString string = _currentFolderPrefix;
string.Delete(string.Length() - 1); string.Delete(string.Length() - 1);
int pos = string.ReverseFind(L'\\'); int pos = string.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0) if (pos < 0)
pos = 0; pos = 0;
else else
+1 -1
View File
@@ -425,7 +425,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
if (_currentFolderPrefix.IsEmpty()) if (_currentFolderPrefix.IsEmpty())
{ {
int iconIndexTemp; int iconIndexTemp;
GetRealIconIndex(itemName + L"\\", attributes, iconIndexTemp); GetRealIconIndex(itemName + WCHAR_PATH_SEPARATOR, attributes, iconIndexTemp);
item.iImage = iconIndexTemp; item.iImage = iconIndexTemp;
} }
else else
+2 -2
View File
@@ -288,7 +288,7 @@ HRESULT CPanel::CreateShellContextMenu(
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
UString fileName = GetItemRelPath(operatedIndices[i]); UString fileName = GetItemRelPath(operatedIndices[i]);
if (IsFSDrivesFolder()) if (IsFSDrivesFolder())
fileName += L'\\'; fileName += WCHAR_PATH_SEPARATOR;
RINOK(parentFolder->ParseDisplayName(GetParent(), 0, RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
(wchar_t *)(const wchar_t *)fileName, &eaten, &pidl, 0)); (wchar_t *)(const wchar_t *)fileName, &eaten, &pidl, 0));
pidls.Add(pidl); pidls.Add(pidl);
@@ -301,7 +301,7 @@ HRESULT CPanel::CreateShellContextMenu(
/* /*
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
HRESULT result = parentFolder->ParseDisplayName(GetParent(), 0, HRESULT result = parentFolder->ParseDisplayName(GetParent(), 0,
L".\\", &eaten, &pidl, 0); L"." WSTRING_PATH_SEPARATOR, &eaten, &pidl, 0);
if (result != NOERROR) if (result != NOERROR)
return; return;
*/ */
+2 -2
View File
@@ -362,7 +362,7 @@ void CPanel::CreateFolder()
return; return;
} }
} }
int pos = newName.Find(L'\\'); int pos = newName.Find(WCHAR_PATH_SEPARATOR);
if (pos >= 0) if (pos >= 0)
newName = newName.Left(pos); newName = newName.Left(pos);
if (!_mySelectMode) if (!_mySelectMode)
@@ -397,7 +397,7 @@ void CPanel::CreateFile()
MessageBoxError(result, LangString(IDS_CREATE_FILE_ERROR, 0x03020243)); MessageBoxError(result, LangString(IDS_CREATE_FILE_ERROR, 0x03020243));
return; return;
} }
int pos = newName.Find(L'\\'); int pos = newName.Find(WCHAR_PATH_SEPARATOR);
if (pos >= 0) if (pos >= 0)
newName = newName.Left(pos); newName = newName.Left(pos);
if (!_mySelectMode) if (!_mySelectMode)
+1 -1
View File
@@ -237,7 +237,7 @@ STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numIt
UString destPath = path; UString destPath = path;
if (destPath.IsEmpty()) if (destPath.IsEmpty())
return E_INVALIDARG; return E_INVALIDARG;
bool directName = (destPath[destPath.Length() - 1] != L'\\'); bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
if (directName) if (directName)
{ {
if (numItems > 1) if (numItems > 1)
+7 -9
View File
@@ -118,9 +118,7 @@ STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
UString folder; UString folder;
if (!::GetProgramFolderPath(folder)) if (!::GetProgramFolderPath(folder))
return E_FAIL; return E_FAIL;
CMyComBSTR valueTemp = folder; return StringToBstr(folder, value);
*value = valueTemp.Detach();
return S_OK;
} }
static UString GetDefaultProgramName() static UString GetDefaultProgramName()
@@ -134,16 +132,16 @@ STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
UString folder; UString folder;
if (!::GetProgramFolderPath(folder)) if (!::GetProgramFolderPath(folder))
return E_FAIL; return E_FAIL;
CMyComBSTR valueTemp = folder + GetDefaultProgramName(); return StringToBstr(folder + GetDefaultProgramName(), value);
*value = valueTemp.Detach();
return S_OK;
} }
STDMETHODIMP CPluginOptionsCallback::GetRegistryCUPath(BSTR *value) STDMETHODIMP CPluginOptionsCallback::GetRegistryCUPath(BSTR *value)
{ {
CMyComBSTR valueTemp = UString(L"Software\\7-Zip\\FM\\Plugins\\") + _pluginName; return StringToBstr(UString(L"Software"
*value = valueTemp.Detach(); WSTRING_PATH_SEPARATOR L"7-Zip"
return S_OK; WSTRING_PATH_SEPARATOR L"FM"
WSTRING_PATH_SEPARATOR L"Plugins"
WSTRING_PATH_SEPARATOR) + _pluginName, value);
} }
void CPluginsPage::OnButtonOptions() void CPluginsPage::OnButtonOptions()
+1 -1
View File
@@ -15,7 +15,7 @@ bool GetProgramFolderPath(UString &folder)
{ {
if (!NDLL::MyGetModuleFileName(g_hInstance, folder)) if (!NDLL::MyGetModuleFileName(g_hInstance, folder))
return false; return false;
int pos = folder.ReverseFind(L'\\'); int pos = folder.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0) if (pos < 0)
return false; return false;
folder = folder.Left(pos + 1); folder = folder.Left(pos + 1);
+1 -1
View File
@@ -336,7 +336,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
ProgressSynch.GetCurrentFileName(fileName); ProgressSynch.GetCurrentFileName(fileName);
if (_prevFileName != fileName) if (_prevFileName != fileName)
{ {
int slashPos = fileName.ReverseFind(L'\\'); int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
UString s1, s2; UString s1, s2;
if (slashPos >= 0) if (slashPos >= 0)
{ {
@@ -23,22 +23,22 @@ namespace NRegistryAssociations {
static NSynchronization::CCriticalSection g_CriticalSection; static NSynchronization::CCriticalSection g_CriticalSection;
static const TCHAR *kCUKeyPath = TEXT("Software\\7-ZIP\\FM"); #define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
static const TCHAR *kAssociations = TEXT("Associations");
static const TCHAR *kCUKeyPath = REG_PATH_FM;
static const WCHAR *kExtPlugins = L"Plugins"; static const WCHAR *kExtPlugins = L"Plugins";
static const TCHAR *kExtEnabled = TEXT("Enabled"); static const TCHAR *kExtEnabled = TEXT("Enabled");
static CSysString GetAssociationsPath() #define kAssociations TEXT("Associations")
{ #define kAssociationsPath REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) kAssociations
return CSysString(kCUKeyPath) + CSysString('\\') + CSysString(kAssociations);
}
bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo) bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo)
{ {
NSynchronization::CCriticalSectionLock lock(g_CriticalSection); NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey key; CKey key;
if(key.Open(HKEY_CURRENT_USER, GetAssociationsPath() + CSysString('\\') + if (key.Open(HKEY_CURRENT_USER,
CSysString(GetSystemString(ext)), KEY_READ) != ERROR_SUCCESS) CSysString(kAssociationsPath TEXT(STRING_PATH_SEPARATOR)) +
GetSystemString(ext), KEY_READ) != ERROR_SUCCESS)
return false; return false;
UString pluginsString; UString pluginsString;
key.QueryValue(kExtPlugins, pluginsString); key.QueryValue(kExtPlugins, pluginsString);
@@ -51,7 +51,7 @@ void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
items.Clear(); items.Clear();
NSynchronization::CCriticalSectionLock lock(g_CriticalSection); NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey associationsKey; CKey associationsKey;
if(associationsKey.Open(HKEY_CURRENT_USER, GetAssociationsPath(), KEY_READ) != ERROR_SUCCESS) if (associationsKey.Open(HKEY_CURRENT_USER, kAssociationsPath, KEY_READ) != ERROR_SUCCESS)
return; return;
CSysStringVector extNames; CSysStringVector extNames;
associationsKey.EnumKeys(extNames); associationsKey.EnumKeys(extNames);
@@ -129,7 +129,7 @@ static bool CheckShellExtensionInfo2(const CSysString &extension, UString &iconP
if (programNameValue.CompareNoCase(extProgramKeyName) != 0) if (programNameValue.CompareNoCase(extProgramKeyName) != 0)
return false; return false;
CKey iconKey; CKey iconKey;
if (extKey.Open(HKEY_CLASSES_ROOT, extProgramKeyName + CSysString(TEXT('\\')) + kDefaultIconKeyName, KEY_READ) != ERROR_SUCCESS) if (extKey.Open(HKEY_CLASSES_ROOT, extProgramKeyName + CSysString(TEXT(CHAR_PATH_SEPARATOR)) + kDefaultIconKeyName, KEY_READ) != ERROR_SUCCESS)
return false; return false;
UString value; UString value;
if (extKey.QueryValue(NULL, value) == ERROR_SUCCESS) if (extKey.QueryValue(NULL, value) == ERROR_SUCCESS)
+1 -1
View File
@@ -110,7 +110,7 @@ void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
if (::ReadPluginInfo(pluginInfo)) if (::ReadPluginInfo(pluginInfo))
plugins.Add(pluginInfo); plugins.Add(pluginInfo);
} }
UString folderPath = baseFolderPrefix + L"Plugins\\"; UString folderPath = baseFolderPrefix + L"Plugins" WSTRING_PATH_SEPARATOR;
NFind::CEnumeratorW enumerator(folderPath + L"*"); NFind::CEnumeratorW enumerator(folderPath + L"*");
NFind::CFileInfoW fileInfo; NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo)) while (enumerator.Next(fileInfo))
+5 -3
View File
@@ -8,9 +8,11 @@
using namespace NWindows; using namespace NWindows;
using namespace NRegistry; using namespace NRegistry;
static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP"); #define REG_PATH_7Z TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP")
static const TCHAR *kCU_FMPath = TEXT("Software\\7-ZIP\\FM");
// static const TCHAR *kLM_Path = TEXT("Software\\7-ZIP\\FM"); static const TCHAR *kCUBasePath = REG_PATH_7Z;
static const TCHAR *kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
// static const TCHAR *kLM_Path = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
static const WCHAR *kLangValueName = L"Lang"; static const WCHAR *kLangValueName = L"Lang";
static const WCHAR *kEditor = L"Editor"; static const WCHAR *kEditor = L"Editor";
+8 -12
View File
@@ -95,8 +95,8 @@ UString GetMyDocsPath()
us = GetUnicodeString(s2); us = GetUnicodeString(s2);
} }
#endif #endif
if (us.Length() > 0 && us[us.Length() - 1] != L'\\') if (us.Length() > 0 && us[us.Length() - 1] != WCHAR_PATH_SEPARATOR)
us += L'\\'; us += WCHAR_PATH_SEPARATOR;
return us; return us;
} }
@@ -113,7 +113,7 @@ STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolde
{ {
CNetFolder *netFolderSpec = new CNetFolder; CNetFolder *netFolderSpec = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolderSpec; CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + L'\\'); netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + WCHAR_PATH_SEPARATOR);
*resultFolder = subFolder.Detach(); *resultFolder = subFolder.Detach();
} }
else if (index == ROOT_INDEX_DOCUMENTS) else if (index == ROOT_INDEX_DOCUMENTS)
@@ -134,7 +134,7 @@ STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolde
static bool AreEqualNames(const UString &name1, const UString &name2) static bool AreEqualNames(const UString &name1, const UString &name2)
{ {
return (name1 == name2 || name1 == (name2 + UString(L'\\'))); return (name1 == name2 || name1 == (name2 + UString(WCHAR_PATH_SEPARATOR)));
} }
STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder) STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
@@ -159,7 +159,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
if (AreEqualNames(name2, L"My Computer") || if (AreEqualNames(name2, L"My Computer") ||
AreEqualNames(name2, L"Computer")) AreEqualNames(name2, L"Computer"))
return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder); return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder);
if (name2 == UString(L'\\')) if (name2 == UString(WCHAR_PATH_SEPARATOR))
{ {
CMyComPtr<IFolderFolder> subFolder = this; CMyComPtr<IFolderFolder> subFolder = this;
*resultFolder = subFolder.Detach(); *resultFolder = subFolder.Detach();
@@ -179,13 +179,13 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
} }
else else
{ {
if (name2[name2.Length () - 1] != L'\\') if (name2[name2.Length () - 1] != WCHAR_PATH_SEPARATOR)
name2 += L'\\'; name2 += WCHAR_PATH_SEPARATOR;
NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder; NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
subFolder = fsFolderSpec; subFolder = fsFolderSpec;
if (fsFolderSpec->Init(name2, 0) != S_OK) if (fsFolderSpec->Init(name2, 0) != S_OK)
{ {
if (name2[0] == L'\\') if (name2[0] == WCHAR_PATH_SEPARATOR)
{ {
CNetFolder *netFolderSpec = new CNetFolder; CNetFolder *netFolderSpec = new CNetFolder;
subFolder = netFolderSpec; subFolder = netFolderSpec;
@@ -240,7 +240,3 @@ STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
*iconIndex = _iconIndices[index]; *iconIndex = _iconIndices[index];
return S_OK; return S_OK;
} }
@@ -93,9 +93,7 @@ STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefi
*/ */
} }
*passwordIsDefined = BoolToInt(_passwordIsDefined); *passwordIsDefined = BoolToInt(_passwordIsDefined);
CMyComBSTR tempName = _password; return StringToBstr(_password, password);
*password = tempName.Detach();
return S_OK;
} }
STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */) STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
@@ -112,8 +110,5 @@ STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
{ {
if (!_passwordIsDefined) if (!_passwordIsDefined)
return S_FALSE; return S_FALSE;
CMyComBSTR tempName = _password; return StringToBstr(_password, password);
*password = tempName.Detach();
return S_OK;
} }
+5 -10
View File
@@ -12,9 +12,10 @@
using namespace NWindows; using namespace NWindows;
using namespace NRegistry; using namespace NRegistry;
static const TCHAR *kCUBasePath = TEXT("Software\\7-Zip\\FM"); #define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
static const TCHAR *kCulumnsKeyName = TEXT("Columns"); static const TCHAR *kCUBasePath = REG_PATH_FM;
static const TCHAR *kCulumnsKeyName = REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) TEXT("Columns");
static const TCHAR *kPositionValueName = TEXT("Position"); static const TCHAR *kPositionValueName = TEXT("Position");
static const TCHAR *kPanelsInfoValueName = TEXT("Panels"); static const TCHAR *kPanelsInfoValueName = TEXT("Panels");
@@ -126,11 +127,8 @@ void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo)
} }
{ {
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection); NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CSysString keyName = kCUBasePath;
keyName += kKeyNameDelimiter;
keyName += kCulumnsKeyName;
CKey key; CKey key;
key.Create(HKEY_CURRENT_USER, keyName); key.Create(HKEY_CURRENT_USER, kCulumnsKeyName);
key.SetValue(GetSystemString(id), (const Byte *)buffer, dataSize); key.SetValue(GetSystemString(id), (const Byte *)buffer, dataSize);
} }
} }
@@ -143,11 +141,8 @@ void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo)
UInt32 size; UInt32 size;
{ {
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection); NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CSysString keyName = kCUBasePath;
keyName += kKeyNameDelimiter;
keyName += kCulumnsKeyName;
CKey key; CKey key;
if(key.Open(HKEY_CURRENT_USER, keyName, KEY_READ) != ERROR_SUCCESS) if(key.Open(HKEY_CURRENT_USER, kCulumnsKeyName, KEY_READ) != ERROR_SUCCESS)
return; return;
if (key.QueryValue(GetSystemString(id), buffer, size) != ERROR_SUCCESS) if (key.QueryValue(GetSystemString(id), buffer, size) != ERROR_SUCCESS)
return; return;
+2 -2
View File
@@ -426,7 +426,7 @@ void CCompressDialog::OnButtonSFX()
UString fileName; UString fileName;
m_ArchivePath.GetText(fileName); m_ArchivePath.GetText(fileName);
int dotPos = fileName.ReverseFind(L'.'); int dotPos = fileName.ReverseFind(L'.');
int slashPos = fileName.ReverseFind(L'\\'); int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
if (dotPos < 0 || dotPos <= slashPos) if (dotPos < 0 || dotPos <= slashPos)
dotPos = -1; dotPos = -1;
bool isSFX = IsSFX(); bool isSFX = IsSFX();
@@ -707,7 +707,7 @@ void CCompressDialog::SetArchiveName(const UString &name)
if (!Info.KeepName) if (!Info.KeepName)
{ {
int dotPos = fileName.ReverseFind('.'); int dotPos = fileName.ReverseFind('.');
int slashPos = MyMax(fileName.ReverseFind('\\'), fileName.ReverseFind('/')); int slashPos = MyMax(fileName.ReverseFind(WCHAR_PATH_SEPARATOR), fileName.ReverseFind('/'));
if (dotPos >= 0 && dotPos > slashPos + 1) if (dotPos >= 0 && dotPos > slashPos + 1)
fileName = fileName.Left(dotPos); fileName = fileName.Left(dotPos);
} }
+2 -6
View File
@@ -167,9 +167,7 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST
} }
} }
*passwordIsDefined = BoolToInt(PasswordIsDefined); *passwordIsDefined = BoolToInt(PasswordIsDefined);
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
/* /*
@@ -211,9 +209,7 @@ HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
Password = dialog.Password; Password = dialog.Password;
PasswordIsDefined = true; PasswordIsDefined = true;
} }
CMyComBSTR tempName(Password); return StringToBstr(Password, password);
*password = tempName.Detach();
return S_OK;
} }
HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password) HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password)
+1 -1
View File
@@ -239,7 +239,7 @@ static HRESULT ShowDialog(
for (int i = 0; i < item.PathParts.Size(); i++) for (int i = 0; i < item.PathParts.Size(); i++)
{ {
if (i > 0) if (i > 0)
name += L'\\'; name += WCHAR_PATH_SEPARATOR;
name += item.PathParts[i]; name += item.PathParts[i];
} }
if (NFind::FindFile(name, fileInfo)) if (NFind::FindFile(name, fileInfo))
+13 -6
View File
@@ -78,12 +78,18 @@ public:
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
inline HRESULT StringToBstr(LPCOLESTR src, BSTR *bstr)
{
*bstr = ::SysAllocString(src);
return (*bstr != 0) ? S_OK : E_OUTOFMEMORY;
}
class CMyComBSTR class CMyComBSTR
{ {
public: public:
BSTR m_str; BSTR m_str;
CMyComBSTR() { m_str = NULL; } CMyComBSTR(): m_str(NULL) {}
CMyComBSTR(LPCOLESTR pSrc) { m_str = ::SysAllocString(pSrc); } CMyComBSTR(LPCOLESTR src) { m_str = ::SysAllocString(src); }
// CMyComBSTR(int nSize) { m_str = ::SysAllocStringLen(NULL, nSize); } // CMyComBSTR(int nSize) { m_str = ::SysAllocStringLen(NULL, nSize); }
// CMyComBSTR(int nSize, LPCOLESTR sz) { m_str = ::SysAllocStringLen(sz, nSize); } // CMyComBSTR(int nSize, LPCOLESTR sz) { m_str = ::SysAllocStringLen(sz, nSize); }
CMyComBSTR(const CMyComBSTR& src) { m_str = src.MyCopy(); } CMyComBSTR(const CMyComBSTR& src) { m_str = src.MyCopy(); }
@@ -107,10 +113,10 @@ public:
} }
return *this; return *this;
} }
CMyComBSTR& operator=(LPCOLESTR pSrc) CMyComBSTR& operator=(LPCOLESTR src)
{ {
::SysFreeString(m_str); ::SysFreeString(m_str);
m_str = ::SysAllocString(pSrc); m_str = ::SysAllocString(src);
return *this; return *this;
} }
unsigned int Length() const { return ::SysStringLen(m_str); } unsigned int Length() const { return ::SysStringLen(m_str); }
@@ -120,9 +126,10 @@ public:
{ {
int byteLen = ::SysStringByteLen(m_str); int byteLen = ::SysStringByteLen(m_str);
BSTR res = ::SysAllocStringByteLen(NULL, byteLen); BSTR res = ::SysAllocStringByteLen(NULL, byteLen);
memmove(res, m_str, byteLen); memcpy(res, m_str, byteLen);
return res; return res;
} }
/*
void Attach(BSTR src) { m_str = src; } void Attach(BSTR src) { m_str = src; }
BSTR Detach() BSTR Detach()
{ {
@@ -130,6 +137,7 @@ public:
m_str = NULL; m_str = NULL;
return s; return s;
} }
*/
void Empty() void Empty()
{ {
::SysFreeString(m_str); ::SysFreeString(m_str);
@@ -138,7 +146,6 @@ public:
bool operator!() const { return (m_str == NULL); } bool operator!() const { return (m_str == NULL); }
}; };
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
class CMyUnknownImp class CMyUnknownImp
+4 -8
View File
@@ -94,14 +94,10 @@ HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src)
LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2) LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2)
{ {
if(ft1->dwHighDateTime < ft2->dwHighDateTime) if (ft1->dwHighDateTime < ft2->dwHighDateTime) return -1;
return -1; if (ft1->dwHighDateTime > ft2->dwHighDateTime) return 1;
if(ft1->dwHighDateTime > ft2->dwHighDateTime) if (ft1->dwLowDateTime < ft2->dwLowDateTime) return -1;
return 1; if (ft1->dwLowDateTime > ft2->dwLowDateTime) return 1;
if(ft1->dwLowDateTime < ft2->dwLowDateTime)
return -1;
if(ft1->dwLowDateTime > ft2->dwLowDateTime)
return 1;
return 0; return 0;
} }
-4
View File
@@ -27,8 +27,6 @@ void NormalizeDirPathPrefix(UString &dirPath)
} }
#endif #endif
#ifdef _WIN32
const wchar_t kExtensionDelimiter = L'.'; const wchar_t kExtensionDelimiter = L'.';
void SplitNameToPureNameAndExtension(const UString &fullName, void SplitNameToPureNameAndExtension(const UString &fullName,
@@ -49,6 +47,4 @@ void SplitNameToPureNameAndExtension(const UString &fullName,
} }
} }
#endif
}}} }}}
-2
View File
@@ -17,10 +17,8 @@ void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with
void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\' void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\'
#endif #endif
#ifdef _WIN32
void SplitNameToPureNameAndExtension(const UString &fullName, void SplitNameToPureNameAndExtension(const UString &fullName,
UString &pureName, UString &extensionDelimiter, UString &extension); UString &pureName, UString &extensionDelimiter, UString &extension);
#endif
}}} }}}
-11
View File
@@ -2,8 +2,6 @@
#include "StdAfx.h" #include "StdAfx.h"
// #include <stdio.h>
#include "PropVariantConversions.h" #include "PropVariantConversions.h"
#include "Windows/Defs.h" #include "Windows/Defs.h"
@@ -63,15 +61,6 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
if (includeSeconds) if (includeSeconds)
UIntToStringSpec(':', st.wSecond, s, 2); UIntToStringSpec(':', st.wSecond, s, 2);
} }
/*
sprintf(s, "%04d-%02d-%02d", st.wYear, st.wMonth, st.wDay);
if (includeTime)
{
sprintf(s + strlen(s), " %02d:%02d", st.wHour, st.wMinute);
if (includeSeconds)
sprintf(s + strlen(s), ":%02d", st.wSecond);
}
*/
return true; return true;
} }
-2
View File
@@ -10,8 +10,6 @@
namespace NWindows { namespace NWindows {
namespace NRegistry { namespace NRegistry {
const TCHAR kKeyNameDelimiter = TEXT('\\');
LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value); LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value);
class CKey class CKey
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?define VerMajor = "4" ?> <?define VerMajor = "4" ?>
<?define VerMinor = "59" ?> <?define VerMinor = "60" ?>
<?define VerBuild = "07" ?> <?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?> <?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?> <?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
<?define MmmmVer = "$(var.MmVer).$(var.VerBuild).0" ?> <?define MmmmVer = "$(var.MmVer).$(var.VerBuild).0" ?>
+1 -1
View File
@@ -1,4 +1,4 @@
LZMA SDK 4.59 beta LZMA SDK 4.60 beta
------------------ ------------------
LZMA SDK Copyright (C) 1999-2008 Igor Pavlov LZMA SDK Copyright (C) 1999-2008 Igor Pavlov