mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 01:15:00 -06:00
4.60 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
173c07e166
commit
c10e6b16f6
@@ -264,7 +264,7 @@ HRESULT CDecoder::Decode(
|
||||
RINOK(getTextPassword->CryptoGetTextPassword(&passwordBSTR));
|
||||
CByteBuffer buffer;
|
||||
passwordIsDefined = true;
|
||||
UString password = passwordBSTR;
|
||||
const UString password(passwordBSTR);
|
||||
const UInt32 sizeInBytes = password.Length() * 2;
|
||||
buffer.SetCapacity(sizeInBytes);
|
||||
for (int i = 0; i < password.Length(); i++)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
4// ElfHandler.cpp
|
||||
// ElfHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ void CDebugEntry::Parse(const Byte *p)
|
||||
Pa = Get32(p + 24);
|
||||
}
|
||||
|
||||
static const kNumDirItemsMax = 16;
|
||||
static const UInt32 kNumDirItemsMax = 16;
|
||||
|
||||
struct COptHeader
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ STATPROPSTG kArcProps[] =
|
||||
{
|
||||
{ NULL, kpidSolid, VT_BOOL},
|
||||
{ NULL, kpidNumBlocks, VT_UI4},
|
||||
{ NULL, kpidEncrypted, VT_BOOL},
|
||||
// { NULL, kpidEncrypted, VT_BOOL},
|
||||
{ NULL, kpidIsVolume, VT_BOOL},
|
||||
{ NULL, kpidNumVolumes, VT_UI4},
|
||||
{ NULL, kpidPhySize, VT_UI8}
|
||||
@@ -94,7 +94,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
switch(propID)
|
||||
{
|
||||
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 kpidNumVolumes: prop = (UInt32)_archives.Size(); break;
|
||||
case kpidOffset: if (_archiveInfo.StartPosition != 0) prop = _archiveInfo.StartPosition; break;
|
||||
|
||||
@@ -236,25 +236,40 @@ STDMETHODIMP CUdfInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
const CFile &file = _archive->Files[ref.FileIndex];
|
||||
const CItem &item = _archive->Items[file.ItemIndex];
|
||||
|
||||
const CMyExtent &extent = item.Extents[_extentIndex];
|
||||
UInt32 rem = extent.GetLen() - _offsetInExtent;
|
||||
if (rem == 0)
|
||||
HRESULT res = S_OK;
|
||||
if (item.IsInline)
|
||||
{
|
||||
_extentIndex++;
|
||||
_offsetInExtent = 0;
|
||||
continue;
|
||||
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);
|
||||
}
|
||||
if (size > rem)
|
||||
size = rem;
|
||||
|
||||
int partitionIndex = vol.PartitionMaps[extent.PartitionRef].PartitionIndex;
|
||||
UInt32 logBlockNumber = extent.Pos;
|
||||
const CPartition &partition = _archive->Partitions[partitionIndex];
|
||||
UInt64 offset = ((UInt64)partition.Pos << _archive->SecLogSize) +
|
||||
else
|
||||
{
|
||||
if (_extentIndex >= item.Extents.Size())
|
||||
return S_OK;
|
||||
const CMyExtent &extent = item.Extents[_extentIndex];
|
||||
UInt32 rem = extent.GetLen() - _offsetInExtent;
|
||||
if (rem == 0)
|
||||
{
|
||||
_extentIndex++;
|
||||
_offsetInExtent = 0;
|
||||
continue;
|
||||
}
|
||||
if (size > rem)
|
||||
size = rem;
|
||||
|
||||
int partitionIndex = vol.PartitionMaps[extent.PartitionRef].PartitionIndex;
|
||||
UInt32 logBlockNumber = extent.Pos;
|
||||
const CPartition &partition = _archive->Partitions[partitionIndex];
|
||||
UInt64 offset = ((UInt64)partition.Pos << _archive->SecLogSize) +
|
||||
(UInt64)logBlockNumber * vol.BlockSize + _offsetInExtent;
|
||||
|
||||
RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL));
|
||||
HRESULT res = _stream->Read(data, size, &size);
|
||||
|
||||
RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL));
|
||||
res = _stream->Read(data, size, &size);
|
||||
}
|
||||
_offsetInExtent += size;
|
||||
_rem -= size;
|
||||
if (processedSize)
|
||||
|
||||
@@ -26,6 +26,7 @@ const int kNumFilesMax = 1 << 28;
|
||||
const int kNumRefsMax = 1 << 28;
|
||||
const UInt32 kNumExtentsMax = (UInt32)1 << 30;
|
||||
const UInt64 kFileNameLengthTotalMax = (UInt64)1 << 33;
|
||||
const UInt64 kInlineExtentsSizeMax = (UInt64)1 << 33;
|
||||
|
||||
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)
|
||||
return S_FALSE;
|
||||
if (item.IsInline)
|
||||
{
|
||||
buf = item.InlineData;
|
||||
return S_OK;
|
||||
}
|
||||
buf.SetCapacity((size_t)item.Size);
|
||||
size_t pos = 0;
|
||||
for (int i = 0; i < item.Extents.Size(); i++)
|
||||
@@ -448,37 +454,46 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
|
||||
pos += extendedAttrLen;
|
||||
|
||||
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)
|
||||
return S_FALSE;
|
||||
for (UInt32 i = 0; i < allocDescriptorsLen;)
|
||||
if (desctType == ICB_DESC_TYPE_INLINE)
|
||||
{
|
||||
CMyExtent e;
|
||||
if (desctType == ICB_DESC_TYPE_SHORT)
|
||||
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;)
|
||||
{
|
||||
if (i + 8 > allocDescriptorsLen)
|
||||
return S_FALSE;
|
||||
CShortAllocDesc sad;
|
||||
sad.Parse(p + pos + i);
|
||||
e.Pos = sad.Pos;
|
||||
e.Len = sad.Len;
|
||||
e.PartitionRef = lad.Location.PartitionRef;
|
||||
i += 8;
|
||||
CMyExtent e;
|
||||
if (desctType == ICB_DESC_TYPE_SHORT)
|
||||
{
|
||||
if (i + 8 > allocDescriptorsLen)
|
||||
return S_FALSE;
|
||||
CShortAllocDesc sad;
|
||||
sad.Parse(p + pos + i);
|
||||
e.Pos = sad.Pos;
|
||||
e.Len = sad.Len;
|
||||
e.PartitionRef = lad.Location.PartitionRef;
|
||||
i += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i + 16 > allocDescriptorsLen)
|
||||
return S_FALSE;
|
||||
CLongAllocDesc ladNew;
|
||||
ladNew.Parse(p + pos + i);
|
||||
e.Pos = ladNew.Location.Pos;
|
||||
e.PartitionRef = ladNew.Location.PartitionRef;
|
||||
e.Len = ladNew.Len;
|
||||
i += 16;
|
||||
}
|
||||
item.Extents.Add(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i + 16 > allocDescriptorsLen)
|
||||
return S_FALSE;
|
||||
CLongAllocDesc ladNew;
|
||||
ladNew.Parse(p + pos + i);
|
||||
e.Pos = ladNew.Location.Pos;
|
||||
e.PartitionRef = ladNew.Location.PartitionRef;
|
||||
e.Len = ladNew.Len;
|
||||
i += 16;
|
||||
}
|
||||
item.Extents.Add(e);
|
||||
}
|
||||
|
||||
if (item.IcbTag.IsDir())
|
||||
@@ -489,6 +504,7 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
|
||||
RINOK(ReadFromFile(volIndex, item, buf));
|
||||
item.Size = 0;
|
||||
item.Extents.ClearAndFree();
|
||||
item.InlineData.Free();
|
||||
|
||||
const Byte *p = buf;
|
||||
size = buf.GetCapacity();
|
||||
@@ -524,6 +540,10 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la
|
||||
if ((UInt32)item.Extents.Size() > kNumExtentsMax - _numExtents)
|
||||
return S_FALSE;
|
||||
_numExtents += item.Extents.Size();
|
||||
|
||||
if (item.InlineData.GetCapacity() > kInlineExtentsSizeMax - _inlineExtentsSize)
|
||||
return S_FALSE;
|
||||
_inlineExtentsSize += item.InlineData.GetCapacity();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@@ -769,6 +789,7 @@ void CInArchive::Clear()
|
||||
_fileNameLengthTotal = 0;
|
||||
_numRefs = 0;
|
||||
_numExtents = 0;
|
||||
_inlineExtentsSize = 0;
|
||||
_processedProgressBytes = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,8 @@ struct CPartitionMap
|
||||
int PartitionIndex;
|
||||
};
|
||||
|
||||
// ECMA 4/14.6
|
||||
|
||||
enum EIcbFileType
|
||||
{
|
||||
ICB_FILE_TYPE_DIR = 4,
|
||||
@@ -243,6 +245,8 @@ struct CItem
|
||||
// CRegId ImplId;
|
||||
// UInt64 UniqueId;
|
||||
|
||||
bool IsInline;
|
||||
CByteBuffer InlineData;
|
||||
CRecordVector<CMyExtent> Extents;
|
||||
CRecordVector<int> SubFiles;
|
||||
|
||||
@@ -258,6 +262,8 @@ struct CItem
|
||||
|
||||
UInt64 GetChunksSumSize() const
|
||||
{
|
||||
if (IsInline)
|
||||
return InlineData.GetCapacity();
|
||||
UInt64 size = 0;
|
||||
for (int i = 0; i < Extents.Size(); i++)
|
||||
size += Extents[i].GetLen();
|
||||
@@ -343,6 +349,7 @@ class CInArchive
|
||||
UInt64 _fileNameLengthTotal;
|
||||
int _numRefs;
|
||||
UInt32 _numExtents;
|
||||
UInt64 _inlineExtentsSize;
|
||||
bool CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const;
|
||||
public:
|
||||
HRESULT Open(IInStream *inStream, CProgressVirt *progress);
|
||||
|
||||
@@ -740,8 +740,8 @@ void CEcd64::Parse(const Byte *p)
|
||||
cdStartOffset = Get64(p + 36);
|
||||
}
|
||||
|
||||
#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_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;
|
||||
|
||||
HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress)
|
||||
{
|
||||
|
||||
@@ -168,7 +168,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
|
||||
return 1;
|
||||
}
|
||||
|
||||
UString dirPrefix = L".\\";
|
||||
UString dirPrefix = L"." WSTRING_PATH_SEPARATOR;
|
||||
UString appLaunched;
|
||||
bool showProgress = true;
|
||||
if (!config.IsEmpty())
|
||||
@@ -298,7 +298,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
|
||||
{
|
||||
UString s2 = tempDirPath;
|
||||
NFile::NName::NormalizeDirPathPrefix(s2);
|
||||
appLaunched.Replace(L"%%T\\", s2);
|
||||
appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, s2);
|
||||
}
|
||||
|
||||
appLaunched.Replace(L"%%T", tempDirPath);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#define MY_VER_MAJOR 4
|
||||
#define MY_VER_MINOR 59
|
||||
#define MY_VER_BUILD 7
|
||||
#define MY_VERSION " 4.59 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.59 beta"
|
||||
#define MY_DATE "2008-08-13"
|
||||
#define MY_VER_MINOR 60
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION " 4.60 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.60 beta"
|
||||
#define MY_DATE "2008-08-19"
|
||||
#define MY_COPYRIGHT "Copyright (c) 1999-2008 Igor Pavlov"
|
||||
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
||||
|
||||
@@ -94,9 +94,9 @@ UString CAgentFolder::GetPrefix(UInt32 index) const
|
||||
const CProxyItem &item = _items[index];
|
||||
const CProxyFolder *folder = item.Folder;
|
||||
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;
|
||||
}
|
||||
return path;
|
||||
@@ -460,12 +460,9 @@ STDMETHODIMP CAgent::Open(
|
||||
DefaultTime = fileInfo.MTime;
|
||||
DefaultAttrib = fileInfo.Attrib;
|
||||
ArchiveType = ai.Name;
|
||||
if (archiveType != 0)
|
||||
{
|
||||
CMyComBSTR name = ArchiveType;
|
||||
*archiveType = name.Detach();
|
||||
}
|
||||
return S_OK;
|
||||
if (archiveType == 0)
|
||||
return S_OK;
|
||||
return StringToBstr(ArchiveType, archiveType);
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
|
||||
folderItem = newFolder;
|
||||
}
|
||||
|
||||
for(int i = 0; i < pathParts.Size(); i++)
|
||||
for (int i = 0; i < pathParts.Size(); i++)
|
||||
{
|
||||
_archiveNamePrefix += pathParts[i];
|
||||
_archiveNamePrefix += L'\\';
|
||||
_archiveNamePrefix += WCHAR_PATH_SEPARATOR;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ static HRESULT EnumerateArchiveItems(CAgent *agent,
|
||||
ai.IndexInServer = dirItem.Index;
|
||||
arcItems.Add(ai);
|
||||
}
|
||||
RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(L'\\'), arcItems));
|
||||
RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(WCHAR_PATH_SEPARATOR), arcItems));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -537,5 +537,3 @@ STDMETHODIMP CAgent::SetProperties(const wchar_t **names,
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ UString CProxyFolder::GetFullPathPrefix() const
|
||||
const CProxyFolder *current = this;
|
||||
while (current->Parent != NULL)
|
||||
{
|
||||
result = current->Name + UString(L'\\') + result;
|
||||
result = current->Name + UString(WCHAR_PATH_SEPARATOR) + result;
|
||||
current = current->Parent;
|
||||
}
|
||||
return result;
|
||||
@@ -252,7 +252,7 @@ HRESULT CProxyArchive::ReadObjects(IInArchive *archive, IProgress *progress)
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = filePath[i];
|
||||
if (c == '\\' || c == '/')
|
||||
if (c == WCHAR_PATH_SEPARATOR || c == L'/')
|
||||
{
|
||||
currentItem = currentItem->AddDirSubItem((UInt32)(Int32)-1, false, fileName);
|
||||
fileName.Empty();
|
||||
|
||||
@@ -59,9 +59,8 @@ STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *ext
|
||||
int formatIndex = FindFormat(type);
|
||||
if (formatIndex < 0)
|
||||
return E_INVALIDARG;
|
||||
CMyComBSTR valueTemp = _codecs.Formats[formatIndex].GetAllExtensions(); // Exts[0].Ext;
|
||||
*extensions = valueTemp.Detach();
|
||||
return S_OK;
|
||||
// Exts[0].Ext;
|
||||
return StringToBstr(_codecs.Formats[formatIndex].GetAllExtensions(), extensions);
|
||||
}
|
||||
*/
|
||||
STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
|
||||
@@ -79,9 +78,7 @@ STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
|
||||
res += lib.IconPairs[j].Ext;
|
||||
}
|
||||
}
|
||||
CMyComBSTR valueTemp = res;
|
||||
*extensions = valueTemp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(res, extensions);
|
||||
}
|
||||
|
||||
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);
|
||||
if (ii >= 0)
|
||||
{
|
||||
CMyComBSTR iconPathTemp = GetUnicodeString(lib.Path, GetCurrentFileCodePage());
|
||||
*iconIndex = ii;
|
||||
*iconPath = iconPathTemp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
@@ -118,9 +113,7 @@ STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
|
||||
typesStrings += L' ';
|
||||
typesStrings += ai.Name;
|
||||
}
|
||||
CMyComBSTR valueTemp = typesStrings;
|
||||
*types = valueTemp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(typesStrings, types);
|
||||
}
|
||||
STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
|
||||
const wchar_t * filePath, IProgress progress)
|
||||
|
||||
@@ -151,9 +151,7 @@ STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
|
||||
PrintError("Password is not defined");
|
||||
return E_ABORT;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
|
||||
@@ -420,9 +418,7 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
|
||||
PrintError("Password is not defined");
|
||||
return E_ABORT;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
|
||||
@@ -654,9 +650,7 @@ STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDef
|
||||
}
|
||||
}
|
||||
*passwordIsDefined = BoolToInt(PasswordIsDefined);
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
|
||||
if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
|
||||
{
|
||||
if (dirPrefix.Length() > 0)
|
||||
if (dirPrefix[dirPrefix.Length() - 1] == '\\')
|
||||
if (dirPrefix[dirPrefix.Length() - 1] == WCHAR_PATH_SEPARATOR)
|
||||
{
|
||||
dirPrefix.Delete(dirPrefix.Length() - 1);
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
|
||||
@@ -129,16 +129,19 @@ void CDirItems::EnumerateDirItems2(const UString &phyPrefix, const UString &logP
|
||||
continue;
|
||||
}
|
||||
int delimiter = filePath.ReverseFind((wchar_t)kDirDelimiter);
|
||||
|
||||
UString phyPrefixCur;
|
||||
int phyParentCur = phyParent;
|
||||
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);
|
||||
if (fi.IsDir())
|
||||
{
|
||||
const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
|
||||
int parent = AddPrefix(phyParentCur, logParent, name2);
|
||||
EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes);
|
||||
EnumerateDirectory(parent, parent, phyPrefix + phyPrefixCur + name2, errorPaths, errorCodes);
|
||||
}
|
||||
}
|
||||
ReserveDown();
|
||||
|
||||
@@ -50,7 +50,7 @@ static CSysString GetLibraryFolderPrefix()
|
||||
static const TCHAR *kMainDll = TEXT("7z.dll");
|
||||
|
||||
#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 bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
|
||||
{
|
||||
@@ -446,7 +446,7 @@ HRESULT CCodecs::Load()
|
||||
|
||||
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 dotPos = arcPath.ReverseFind(L'.');
|
||||
if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2)
|
||||
|
||||
@@ -175,7 +175,7 @@ HRESULT OpenArchive(
|
||||
processedSize--;
|
||||
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)
|
||||
break;
|
||||
UInt32 v = buf[pos] | ((UInt32)buf[pos + 1] << 8);
|
||||
|
||||
@@ -152,9 +152,7 @@ STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
|
||||
Password = GetPassword(OutStream);
|
||||
PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,9 +35,7 @@ HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
|
||||
Password = GetPassword(OutStream);
|
||||
PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR temp(Password);
|
||||
*password = temp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password)
|
||||
|
||||
@@ -199,8 +199,7 @@ HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined,
|
||||
#ifdef _NO_CRYPTO
|
||||
|
||||
*passwordIsDefined = false;
|
||||
CMyComBSTR tempName(L"");
|
||||
*password = tempName.Detach();
|
||||
return StringToBstr(L"", password);
|
||||
|
||||
#else
|
||||
|
||||
@@ -213,10 +212,8 @@ HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined,
|
||||
}
|
||||
}
|
||||
*passwordIsDefined = BoolToInt(PasswordIsDefined);
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return StringToBstr(Password, password);
|
||||
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -309,6 +309,16 @@ static UString GetReducedString(const UString &s)
|
||||
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[] =
|
||||
{
|
||||
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;
|
||||
else
|
||||
commandMapItem.Folder = folderPrefix;
|
||||
commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(L'\\');
|
||||
commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(WCHAR_PATH_SEPARATOR);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
@@ -469,7 +479,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
else
|
||||
commandMapItem.Folder = folderPrefix;
|
||||
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);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
@@ -525,8 +535,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
commandMapItem.Folder = archivePathPrefix;
|
||||
commandMapItem.Archive = archiveName7z;
|
||||
commandMapItem.ArchiveType = L"7z";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
s = MyFormatNew(s, GetQuotedReducedString(archiveName7z));
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
@@ -539,8 +548,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
FillCommand(kCompressTo7zEmail, s, commandMapItem);
|
||||
commandMapItem.Archive = archiveName7z;
|
||||
commandMapItem.ArchiveType = L"7z";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
s = MyFormatNew(s, GetQuotedReducedString(archiveName7z));
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
@@ -557,8 +565,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
commandMapItem.Folder = archivePathPrefix;
|
||||
commandMapItem.Archive = archiveNameZip;
|
||||
commandMapItem.ArchiveType = L"zip";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
s = MyFormatNew(s, GetQuotedReducedString(archiveNameZip));
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
@@ -571,8 +578,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
FillCommand(kCompressToZipEmail, s, commandMapItem);
|
||||
commandMapItem.Archive = archiveNameZip;
|
||||
commandMapItem.ArchiveType = L"zip";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
s = MyFormatNew(s, GetQuotedReducedString(archiveNameZip));
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
@@ -614,12 +620,11 @@ extern const char *kShellFolderClassIDString;
|
||||
|
||||
static UString GetProgramCommand()
|
||||
{
|
||||
UString path = L"\"";
|
||||
UString path;
|
||||
UString folder;
|
||||
if (GetProgramFolderPath(folder))
|
||||
path += folder;
|
||||
path += L"7zFM.exe\"";
|
||||
return path;
|
||||
path = folder;
|
||||
return GetQuotedString(path + L"7zFM.exe");
|
||||
}
|
||||
|
||||
STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
|
||||
@@ -658,9 +663,8 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
|
||||
{
|
||||
UString params;
|
||||
params = GetProgramCommand();
|
||||
params += L" \"";
|
||||
params += _fileNames[0];
|
||||
params += L"\"";
|
||||
params += L' ';
|
||||
params += GetQuotedString(_fileNames[0]);
|
||||
MyCreateProcess(params, 0, false, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -170,8 +170,5 @@ STDMETHODIMP CExtractCallBackImp::CryptoGetTextPassword(BSTR *password)
|
||||
RINOK(GetPassword(m_Password));
|
||||
m_PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR tempName = m_Password;
|
||||
*password = tempName.Detach();
|
||||
|
||||
return S_OK;
|
||||
return StringToBstr(m_Password, password);
|
||||
}
|
||||
|
||||
@@ -359,9 +359,7 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
|
||||
RINOK(GetPassword(Password));
|
||||
PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR temp = Password;
|
||||
*password = temp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -208,7 +208,7 @@ void CPlugin::EnterToDirectory(const UString &dirName)
|
||||
int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
|
||||
{
|
||||
UString path = MultiByteToUnicodeString(aszDir, CP_OEMCP);
|
||||
if (path == L"\\")
|
||||
if (path == WSTRING_PATH_SEPARATOR)
|
||||
{
|
||||
_folder.Release();
|
||||
m_ArchiveHandler->BindToRootFolder(&_folder);
|
||||
@@ -225,7 +225,7 @@ int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
|
||||
EnterToDirectory(path);
|
||||
else
|
||||
{
|
||||
if (path[0] == L'\\')
|
||||
if (path[0] == WCHAR_PATH_SEPARATOR)
|
||||
{
|
||||
_folder.Release();
|
||||
m_ArchiveHandler->BindToRootFolder(&_folder);
|
||||
@@ -265,7 +265,7 @@ void CPlugin::GetCurrentDir()
|
||||
GetPathParts(pathParts);
|
||||
for (int i = 0; i < pathParts.Size(); i++)
|
||||
{
|
||||
m_CurrentDir += L'\\';
|
||||
m_CurrentDir += WCHAR_PATH_SEPARATOR;
|
||||
m_CurrentDir += pathParts[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ void CApp::ReloadToolbars()
|
||||
return;
|
||||
HWND parent = _rebar;
|
||||
|
||||
while(_rebar.GetBandCount() > 0)
|
||||
while (_rebar.GetBandCount() > 0)
|
||||
_rebar.DeleteBand(0);
|
||||
|
||||
_archiveToolBar.Destroy();
|
||||
@@ -436,14 +436,14 @@ static bool IsThereFolderOfPath(const UString &path)
|
||||
// reduces path to part that exists on disk
|
||||
static void ReducePathToRealFileSystemPath(UString &path)
|
||||
{
|
||||
while(!path.IsEmpty())
|
||||
while (!path.IsEmpty())
|
||||
{
|
||||
if (IsThereFolderOfPath(path))
|
||||
{
|
||||
NName::NormalizeDirPathPrefix(path);
|
||||
break;
|
||||
}
|
||||
int pos = path.ReverseFind('\\');
|
||||
int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos < 0)
|
||||
path.Empty();
|
||||
else
|
||||
@@ -453,8 +453,8 @@ static void ReducePathToRealFileSystemPath(UString &path)
|
||||
break;
|
||||
if (path.Length() > 2 && path[0] == '\\' && path[1] == '\\')
|
||||
{
|
||||
int nextPos = path.Find('\\', 2); // pos after \\COMPNAME
|
||||
if (nextPos > 0 && path.Find('\\', nextPos + 1) == pos)
|
||||
int nextPos = path.Find(WCHAR_PATH_SEPARATOR, 2); // pos after \\COMPNAME
|
||||
if (nextPos > 0 && path.Find(WCHAR_PATH_SEPARATOR, nextPos + 1) == pos)
|
||||
break;
|
||||
}
|
||||
path = path.Left(pos);
|
||||
@@ -472,9 +472,12 @@ static bool CheckFolderPath(const UString &path)
|
||||
|
||||
static bool IsPathAbsolute(const UString &path)
|
||||
{
|
||||
if ((path.Length() >= 1 && path[0] == L'\\') ||
|
||||
(path.Length() >= 3 && path[1] == L':' && path[2] == L'\\'))
|
||||
if (path.Length() >= 1 && path[0] == WCHAR_PATH_SEPARATOR)
|
||||
return true;
|
||||
#ifdef _WIN32
|
||||
if (path.Length() >= 3 && path[1] == L':' && path[2] == L'\\')
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -564,7 +567,7 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
|
||||
int index = indices[i];
|
||||
info += GetItemRelPath(index);
|
||||
if (IsItemFolder(index))
|
||||
info += L'\\';
|
||||
info += WCHAR_PATH_SEPARATOR;
|
||||
}
|
||||
if (i != indices.Size())
|
||||
info += L"\n ...";
|
||||
@@ -656,7 +659,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
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))
|
||||
{
|
||||
NDirectory::CreateComplexDirectory(destPath);
|
||||
@@ -673,7 +676,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = destPath.ReverseFind('\\');
|
||||
int pos = destPath.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos >= 0)
|
||||
{
|
||||
UString prefix = destPath.Left(pos + 1);
|
||||
@@ -734,7 +737,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
else
|
||||
folderPrefix = srcPanel._currentFolderPrefix;
|
||||
filePaths.Reserve(indices.Size());
|
||||
for(int i = 0; i < indices.Size(); i++)
|
||||
for (int i = 0; i < indices.Size(); i++)
|
||||
filePaths.Add(srcPanel.GetItemRelPath(indices[i]));
|
||||
|
||||
result = destPanel.CopyFrom(folderPrefix, filePaths, true, 0);
|
||||
@@ -789,12 +792,8 @@ void CApp::OnSetSubFolder(int srcPanelIndex)
|
||||
if (!srcPanel.IsItemFolder(realIndex))
|
||||
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;
|
||||
if (realIndex == kParentIndex)
|
||||
{
|
||||
|
||||
@@ -51,6 +51,13 @@ class CFolderHistory
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSection _criticalSection;
|
||||
UStringVector Strings;
|
||||
void Normalize()
|
||||
{
|
||||
const int kMaxSize = 100;
|
||||
if (Strings.Size() > kMaxSize)
|
||||
Strings.Delete(kMaxSize, Strings.Size() - kMaxSize);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void GetList(UStringVector &foldersHistory)
|
||||
@@ -59,14 +66,6 @@ public:
|
||||
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)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
|
||||
|
||||
@@ -369,9 +369,7 @@ STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
|
||||
Password = dialog.Password;
|
||||
PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
|
||||
@@ -384,12 +382,9 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
|
||||
Int32 *writeAnswer)
|
||||
{
|
||||
UString destPathResultTemp = destPath;
|
||||
/*
|
||||
{
|
||||
CMyComBSTR destPathResultBSTR = destPath;
|
||||
*destPathResult = destPathResultBSTR.Detach();
|
||||
}
|
||||
*/
|
||||
|
||||
// RINOK(StringToBstr(destPath, destPathResult));
|
||||
|
||||
*destPathResult = 0;
|
||||
*writeAnswer = BoolToInt(false);
|
||||
|
||||
@@ -476,9 +471,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
|
||||
return E_ABORT;
|
||||
}
|
||||
}
|
||||
CMyComBSTR destPathResultBSTR(destPathResultTemp);
|
||||
*destPathResult = destPathResultBSTR.Detach();
|
||||
*writeAnswer = BoolToInt(true);
|
||||
return S_OK;
|
||||
return StringToBstr(destPathResultTemp, destPathResult);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ static UString GetProgramPath()
|
||||
UString GetProgramFolderPrefix()
|
||||
{
|
||||
UString path = GetProgramPath();
|
||||
int pos = path.ReverseFind(L'\\');
|
||||
int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
return path.Left(pos + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -767,6 +767,10 @@ SOURCE=..\..\..\Windows\Clipboard.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\COM.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\CommonDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -195,7 +195,7 @@ STDMETHODIMP CFSDrives::GetFolderProperty(PROPID propID, PROPVARIANT *value)
|
||||
switch(propID)
|
||||
{
|
||||
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);
|
||||
return S_OK;
|
||||
|
||||
@@ -75,14 +75,14 @@ HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles,
|
||||
{
|
||||
RINOK(progress->SetCompleted(NULL));
|
||||
numFiles = numFolders = size = 0;
|
||||
CEnumeratorW enumerator(path + UString(L"\\*"));
|
||||
CEnumeratorW enumerator(path + UString(WSTRING_PATH_SEPARATOR L"*"));
|
||||
CFileInfoW fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
{
|
||||
if (fileInfo.IsDir())
|
||||
{
|
||||
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++;
|
||||
numFiles += subFiles;
|
||||
@@ -125,7 +125,7 @@ HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path)
|
||||
{
|
||||
CDirItem &item = dirItem.Files[i];
|
||||
if (item.IsDir())
|
||||
LoadSubItems(item, path + item.Name + L'\\');
|
||||
LoadSubItems(item, path + item.Name + WCHAR_PATH_SEPARATOR);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultF
|
||||
*resultFolder = 0;
|
||||
CFSFolder *folderSpec = new CFSFolder;
|
||||
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();
|
||||
return S_OK;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ UString CFSFolder::GetPrefix(const CDirItem &item) const
|
||||
CDirItem *cur = item.Parent;
|
||||
while (cur->Parent != 0)
|
||||
{
|
||||
path = cur->Name + UString('\\') + path;
|
||||
path = cur->Name + UString(WCHAR_PATH_SEPARATOR) + path;
|
||||
cur = cur->Parent;
|
||||
}
|
||||
return path;
|
||||
@@ -358,11 +358,11 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
|
||||
}
|
||||
if (_path.IsEmpty())
|
||||
return E_INVALIDARG;
|
||||
int pos = _path.ReverseFind(L'\\');
|
||||
int pos = _path.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos < 0 || pos != _path.Length() - 1)
|
||||
return E_FAIL;
|
||||
UString parentPath = _path.Left(pos);
|
||||
pos = parentPath.ReverseFind(L'\\');
|
||||
pos = parentPath.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos < 0)
|
||||
{
|
||||
parentPath.Empty();
|
||||
@@ -374,10 +374,10 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
|
||||
}
|
||||
UString parentPathReduced = parentPath.Left(pos);
|
||||
parentPath = parentPath.Left(pos + 1);
|
||||
pos = parentPathReduced.ReverseFind(L'\\');
|
||||
pos = parentPathReduced.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos == 1)
|
||||
{
|
||||
if (parentPath[0] != L'\\')
|
||||
if (parentPath[0] != WCHAR_PATH_SEPARATOR)
|
||||
return E_FAIL;
|
||||
CNetFolder *netFolderSpec = new CNetFolder;
|
||||
CMyComPtr<IFolderFolder> netFolder = netFolderSpec;
|
||||
@@ -537,7 +537,7 @@ HRESULT CFSFolder::GetComplexName(const wchar_t *name, UString &resultPath)
|
||||
resultPath = _path + newName;
|
||||
if (newName.Length() < 1)
|
||||
return S_OK;
|
||||
if (newName[0] == L'\\')
|
||||
if (newName[0] == WCHAR_PATH_SEPARATOR)
|
||||
{
|
||||
resultPath = newName;
|
||||
return S_OK;
|
||||
|
||||
@@ -216,6 +216,11 @@ static HRESULT MyCopyFile(
|
||||
return callback->SetCompleted(&completedSize);
|
||||
}
|
||||
|
||||
static UString CombinePath(const UString &folderPath, const UString &fileName)
|
||||
{
|
||||
return folderPath + UString(WCHAR_PATH_SEPARATOR) + fileName;
|
||||
}
|
||||
|
||||
static HRESULT CopyFolder(
|
||||
const UString &srcPath,
|
||||
const UString &destPathSpec,
|
||||
@@ -224,11 +229,11 @@ static HRESULT CopyFolder(
|
||||
{
|
||||
RINOK(callback->SetCompleted(&completedSize));
|
||||
|
||||
UString destPath = destPathSpec;
|
||||
const UString destPath = destPathSpec;
|
||||
int len = srcPath.Length();
|
||||
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 \'") +
|
||||
destPath + UString(L"\' onto itself");
|
||||
@@ -243,19 +248,19 @@ static HRESULT CopyFolder(
|
||||
RINOK(callback->ShowMessage(message));
|
||||
return E_ABORT;
|
||||
}
|
||||
CEnumeratorW enumerator(srcPath + UString(L"\\*"));
|
||||
CFileInfoEx fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
CEnumeratorW enumerator(CombinePath(srcPath, L"*"));
|
||||
CFileInfoEx fi;
|
||||
while (enumerator.Next(fi))
|
||||
{
|
||||
const UString srcPath2 = srcPath + UString(L"\\") + fileInfo.Name;
|
||||
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name;
|
||||
if (fileInfo.IsDir())
|
||||
const UString srcPath2 = CombinePath(srcPath, fi.Name);
|
||||
const UString destPath2 = CombinePath(destPath, fi.Name);
|
||||
if (fi.IsDir())
|
||||
{
|
||||
RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize));
|
||||
RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize))
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(MyCopyFile(srcPath2, fileInfo, destPath2, callback, completedSize));
|
||||
RINOK(MyCopyFile(srcPath2, fi, destPath2, callback, completedSize));
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
@@ -275,7 +280,7 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
|
||||
UString destPath = path;
|
||||
if (destPath.IsEmpty())
|
||||
return E_INVALIDARG;
|
||||
bool directName = (destPath[destPath.Length() - 1] != L'\\');
|
||||
bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
|
||||
if (directName)
|
||||
{
|
||||
if (numItems > 1)
|
||||
@@ -298,18 +303,18 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
|
||||
RINOK(callback->SetCompleted(&completedSize));
|
||||
for (UInt32 i = 0; i < numItems; i++)
|
||||
{
|
||||
const CDirItem &fileInfo = *_refs[indices[i]];
|
||||
const CDirItem &fi = *_refs[indices[i]];
|
||||
UString destPath2 = destPath;
|
||||
if (!directName)
|
||||
destPath2 += fileInfo.Name;
|
||||
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
|
||||
if (fileInfo.IsDir())
|
||||
destPath2 += fi.Name;
|
||||
UString srcPath = _path + GetPrefix(fi) + fi.Name;
|
||||
if (fi.IsDir())
|
||||
{
|
||||
RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(MyCopyFile(srcPath, fileInfo, destPath2, callback, completedSize));
|
||||
RINOK(MyCopyFile(srcPath, fi, destPath2, callback, completedSize));
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
@@ -369,7 +374,7 @@ HRESULT MyMoveFolder(
|
||||
int len = srcPath.Length();
|
||||
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 \'") +
|
||||
destPath + UString(L"\' onto itself");
|
||||
@@ -388,19 +393,19 @@ HRESULT MyMoveFolder(
|
||||
return E_ABORT;
|
||||
}
|
||||
{
|
||||
CEnumeratorW enumerator(srcPath + UString(L"\\*"));
|
||||
CFileInfoEx fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
CEnumeratorW enumerator(CombinePath(srcPath, L"*"));
|
||||
CFileInfoEx fi;
|
||||
while (enumerator.Next(fi))
|
||||
{
|
||||
const UString srcPath2 = srcPath + UString(L"\\") + fileInfo.Name;
|
||||
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name;
|
||||
if (fileInfo.IsDir())
|
||||
const UString srcPath2 = CombinePath(srcPath, fi.Name);
|
||||
const UString destPath2 = CombinePath(destPath, fi.Name);
|
||||
if (fi.IsDir())
|
||||
{
|
||||
RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize));
|
||||
}
|
||||
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;
|
||||
if (destPath.IsEmpty())
|
||||
return E_INVALIDARG;
|
||||
bool directName = (destPath[destPath.Length() - 1] != L'\\');
|
||||
bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
|
||||
if (directName)
|
||||
{
|
||||
if (numItems > 1)
|
||||
@@ -449,18 +454,18 @@ STDMETHODIMP CFSFolder::MoveTo(
|
||||
RINOK(callback->SetCompleted(&completedSize));
|
||||
for (UInt32 i = 0; i < numItems; i++)
|
||||
{
|
||||
const CDirItem &fileInfo = *_refs[indices[i]];
|
||||
const CDirItem &fi = *_refs[indices[i]];
|
||||
UString destPath2 = destPath;
|
||||
if (!directName)
|
||||
destPath2 += fileInfo.Name;
|
||||
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
|
||||
if (fileInfo.IsDir())
|
||||
destPath2 += fi.Name;
|
||||
UString srcPath = _path + GetPrefix(fi) + fi.Name;
|
||||
if (fi.IsDir())
|
||||
{
|
||||
RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(MyMoveFile(srcPath, fileInfo, destPath2, callback, completedSize));
|
||||
RINOK(MyMoveFile(srcPath, fi, destPath2, callback, completedSize));
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
@@ -477,13 +482,13 @@ STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
|
||||
{
|
||||
UString path = (UString)fromFolderPath + itemsPaths[i];
|
||||
|
||||
CFileInfoW fileInfo;
|
||||
if (!FindFile(path, fileInfo))
|
||||
CFileInfoW fi;
|
||||
if (!FindFile(path, fi))
|
||||
return ::GetLastError();
|
||||
if (fileInfo.IsDir())
|
||||
if (fi.IsDir())
|
||||
{
|
||||
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++;
|
||||
numFiles += subFiles;
|
||||
@@ -492,7 +497,7 @@ STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
|
||||
else
|
||||
{
|
||||
numFiles++;
|
||||
totalSize += fileInfo.Size;
|
||||
totalSize += fi.Size;
|
||||
}
|
||||
}
|
||||
RINOK(progress->SetTotal(totalSize));
|
||||
|
||||
@@ -74,7 +74,7 @@ HRESULT OpenFileFolderPlugin(
|
||||
NFile::NName::SplitNameToPureNameAndExtension(name, pureName, dot, extension);
|
||||
|
||||
|
||||
int slashPos = path.ReverseFind(L'\\');
|
||||
int slashPos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
UString dirPrefix;
|
||||
UString fileName;
|
||||
if (slashPos >= 0)
|
||||
|
||||
@@ -75,7 +75,7 @@ void CNetFolder::Init(const NWindows::NNet::CResourceW *netResource,
|
||||
_netResourcePointer = &_netResource;
|
||||
|
||||
// if (_netResource.DisplayType == RESOURCEDISPLAYTYPE_SERVER)
|
||||
_path = _netResource.RemoteName + L'\\';
|
||||
_path = _netResource.RemoteName + WCHAR_PATH_SEPARATOR;
|
||||
}
|
||||
_parentFolder = parentFolder;
|
||||
}
|
||||
@@ -113,11 +113,11 @@ STDMETHODIMP CNetFolder::LoadItems()
|
||||
if (!resource.RemoteNameIsDefined) // For Win 98, I don't know what's wrong
|
||||
resource.RemoteName = resource.Comment;
|
||||
resource.Name = resource.RemoteName;
|
||||
int aPos = resource.Name.ReverseFind(L'\\');
|
||||
if (aPos >= 0)
|
||||
int pos = resource.Name.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos >= 0)
|
||||
{
|
||||
// _path = resource.Name.Left(aPos + 1);
|
||||
resource.Name = resource.Name.Mid(aPos + 1);
|
||||
// _path = resource.Name.Left(pos + 1);
|
||||
resource.Name = resource.Name.Mid(pos + 1);
|
||||
}
|
||||
_items.Add(resource);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ STDMETHODIMP CNetFolder::LoadItems()
|
||||
|
||||
NFile::NFind::CFindFile findFile;
|
||||
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;
|
||||
resource.Usage = RESOURCEUSAGE_CONNECTABLE;
|
||||
resource.LocalNameIsDefined = false;
|
||||
@@ -188,14 +188,14 @@ STDMETHODIMP CNetFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder
|
||||
{
|
||||
NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
|
||||
CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
|
||||
RINOK(fsFolderSpec->Init(resource.RemoteName + L'\\', this));
|
||||
RINOK(fsFolderSpec->Init(resource.RemoteName + WCHAR_PATH_SEPARATOR, this));
|
||||
*resultFolder = subFolder.Detach();
|
||||
}
|
||||
else
|
||||
{
|
||||
CNetFolder *netFolder = new CNetFolder;
|
||||
CMyComPtr<IFolderFolder> subFolder = netFolder;
|
||||
netFolder->Init(&resource, this, resource.Name + L'\\');
|
||||
netFolder->Init(&resource, this, resource.Name + WCHAR_PATH_SEPARATOR);
|
||||
*resultFolder = subFolder.Detach();
|
||||
}
|
||||
return S_OK;
|
||||
@@ -226,7 +226,7 @@ STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder)
|
||||
|
||||
CNetFolder *netFolder = new CNetFolder;
|
||||
CMyComPtr<IFolderFolder> subFolder = netFolder;
|
||||
netFolder->Init(&resourceParent, 0, L'\\');
|
||||
netFolder->Init(&resourceParent, 0, WCHAR_PATH_SEPARATOR);
|
||||
*resultFolder = subFolder.Detach();
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
@@ -120,7 +120,5 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
|
||||
Password = dialog.Password;
|
||||
PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
@@ -800,7 +800,7 @@ void CPanel::AddToArchive()
|
||||
|
||||
static UString GetSubFolderNameForExtract(const UString &archiveName)
|
||||
{
|
||||
int slashPos = archiveName.ReverseFind(L'\\');
|
||||
int slashPos = archiveName.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
int dotPos = archiveName.ReverseFind(L'.');
|
||||
if (dotPos < 0 || slashPos > dotPos)
|
||||
return archiveName + UString(L"~");
|
||||
@@ -846,7 +846,7 @@ void CPanel::ExtractArchives()
|
||||
folderName = GetSubFolderNameForExtract(GetItemRelPath(indices[0]));
|
||||
else
|
||||
folderName = L"*";
|
||||
::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(L"\\"), true);
|
||||
::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(WCHAR_PATH_SEPARATOR), true);
|
||||
}
|
||||
|
||||
struct CThreadTest
|
||||
|
||||
@@ -64,7 +64,7 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr
|
||||
if (Index >= FileNames.Size())
|
||||
return true;
|
||||
const UString &path = FileNames[Index];
|
||||
int pos = path.ReverseFind('\\');
|
||||
int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
resPath.Empty();
|
||||
if (pos >= 0)
|
||||
resPath = path.Left(pos + 1);
|
||||
|
||||
@@ -149,7 +149,7 @@ STDMETHODIMP CDataObject::QueryGetData(LPFORMATETC etc)
|
||||
|
||||
STDMETHODIMP CDataObject::EnumFormatEtc(DWORD direction, LPENUMFORMATETC FAR* enumFormatEtc)
|
||||
{
|
||||
if(direction != DATADIR_GET)
|
||||
if (direction != DATADIR_GET)
|
||||
return E_NOTIMPL;
|
||||
return CreateEnumFormatEtc(1, &m_Etc, enumFormatEtc);
|
||||
}
|
||||
@@ -183,9 +183,9 @@ public:
|
||||
|
||||
STDMETHODIMP CDropSource::QueryContinueDrag(BOOL escapePressed, DWORD keyState)
|
||||
{
|
||||
if(escapePressed == TRUE)
|
||||
if (escapePressed == TRUE)
|
||||
return DRAGDROP_S_CANCEL;
|
||||
if((keyState & MK_LBUTTON) == 0)
|
||||
if ((keyState & MK_LBUTTON) == 0)
|
||||
{
|
||||
if (m_Effect == DROPEFFECT_NONE)
|
||||
return DRAGDROP_S_CANCEL;
|
||||
@@ -570,7 +570,7 @@ bool CDropTarget::IsItSameDrive() const
|
||||
return false;
|
||||
}
|
||||
else if (m_Panel->IsFSDrivesFolder() && m_SelectionIndex >= 0)
|
||||
drive = m_SubFolderName + L'\\';
|
||||
drive = m_SubFolderName + WCHAR_PATH_SEPARATOR;
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -591,10 +591,7 @@ DWORD CDropTarget::GetEffect(DWORD keyState, POINTL /* pt */, DWORD allowedEffec
|
||||
if (!m_DropIsAllowed || !m_PanelDropIsAllowed)
|
||||
return DROPEFFECT_NONE;
|
||||
|
||||
if (!IsFsFolderPath())
|
||||
allowedEffect &= ~DROPEFFECT_MOVE;
|
||||
|
||||
if (!m_SetPathIsOK)
|
||||
if (!IsFsFolderPath() || !m_SetPathIsOK)
|
||||
allowedEffect &= ~DROPEFFECT_MOVE;
|
||||
|
||||
DWORD effect = 0;
|
||||
@@ -602,17 +599,17 @@ DWORD CDropTarget::GetEffect(DWORD keyState, POINTL /* pt */, DWORD allowedEffec
|
||||
effect = allowedEffect & DROPEFFECT_COPY;
|
||||
else if (keyState & MK_SHIFT)
|
||||
effect = allowedEffect & DROPEFFECT_MOVE;
|
||||
if(effect == 0)
|
||||
if (effect == 0)
|
||||
{
|
||||
if(allowedEffect & DROPEFFECT_COPY)
|
||||
if (allowedEffect & DROPEFFECT_COPY)
|
||||
effect = DROPEFFECT_COPY;
|
||||
if(allowedEffect & DROPEFFECT_MOVE)
|
||||
if (allowedEffect & DROPEFFECT_MOVE)
|
||||
{
|
||||
if (IsItSameDrive())
|
||||
effect = DROPEFFECT_MOVE;
|
||||
}
|
||||
}
|
||||
if(effect == 0)
|
||||
if (effect == 0)
|
||||
return DROPEFFECT_NONE;
|
||||
return effect;
|
||||
}
|
||||
@@ -627,7 +624,7 @@ UString CDropTarget::GetTargetPath() const
|
||||
if (m_SubFolderIndex >= 0 && !m_SubFolderName.IsEmpty())
|
||||
{
|
||||
path += m_SubFolderName;
|
||||
path += L"\\";
|
||||
path += WCHAR_PATH_SEPARATOR;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
@@ -703,11 +700,11 @@ STDMETHODIMP CDropTarget::Drop(IDataObject *dataObject, DWORD keyState,
|
||||
PositionCursor(pt);
|
||||
m_DataObject = dataObject;
|
||||
bool needDrop = true;
|
||||
if(m_DropIsAllowed && m_PanelDropIsAllowed)
|
||||
if (m_DropIsAllowed && m_PanelDropIsAllowed)
|
||||
if (IsFsFolderPath())
|
||||
needDrop = !SetPath();
|
||||
*effect = GetEffect(keyState, pt, *effect);
|
||||
if(m_DropIsAllowed && m_PanelDropIsAllowed)
|
||||
if (m_DropIsAllowed && m_PanelDropIsAllowed)
|
||||
{
|
||||
if (needDrop)
|
||||
{
|
||||
|
||||
@@ -69,11 +69,11 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool
|
||||
UString sysPath = fullPath;
|
||||
CFileInfoW fileInfo;
|
||||
UStringVector reducedParts;
|
||||
while(!sysPath.IsEmpty())
|
||||
while (!sysPath.IsEmpty())
|
||||
{
|
||||
if (FindFile(sysPath, fileInfo))
|
||||
break;
|
||||
int pos = sysPath.ReverseFind(L'\\');
|
||||
int pos = sysPath.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos < 0)
|
||||
sysPath.Empty();
|
||||
else
|
||||
@@ -175,7 +175,7 @@ void CPanel::LoadFullPath()
|
||||
const CFolderLink &folderLink = _parentFolders[i];
|
||||
_currentFolderPrefix += GetFolderPath(folderLink.ParentFolder);
|
||||
_currentFolderPrefix += folderLink.ItemName;
|
||||
_currentFolderPrefix += L'\\';
|
||||
_currentFolderPrefix += WCHAR_PATH_SEPARATOR;
|
||||
}
|
||||
if (_folder)
|
||||
_currentFolderPrefix += GetFolderPath(_folder);
|
||||
@@ -199,7 +199,13 @@ void CPanel::LoadFullPathAndShow()
|
||||
item.mask = 0;
|
||||
|
||||
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);
|
||||
|
||||
CFileInfoW info;
|
||||
@@ -334,12 +340,12 @@ bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
|
||||
sumPass += name;
|
||||
UString curName = sumPass;
|
||||
if (i == 0)
|
||||
curName += L"\\";
|
||||
curName += WCHAR_PATH_SEPARATOR;
|
||||
CFileInfoW info;
|
||||
DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
|
||||
if (NFile::NFind::FindFile(sumPass, info))
|
||||
attrib = info.Attrib;
|
||||
sumPass += L"\\";
|
||||
sumPass += WCHAR_PATH_SEPARATOR;
|
||||
AddComboBoxItem(name, GetRealIconIndex(curName, attrib), i, false);
|
||||
ComboBoxPaths.Add(sumPass);
|
||||
}
|
||||
@@ -357,7 +363,7 @@ bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
|
||||
UString s = driveStrings[i];
|
||||
ComboBoxPaths.Add(s);
|
||||
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);
|
||||
AddComboBoxItem(s, iconIndex, 1, false);
|
||||
}
|
||||
@@ -463,7 +469,7 @@ void CPanel::OpenParentFolder()
|
||||
{
|
||||
UString string = _currentFolderPrefix;
|
||||
string.Delete(string.Length() - 1);
|
||||
int pos = string.ReverseFind(L'\\');
|
||||
int pos = string.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos < 0)
|
||||
pos = 0;
|
||||
else
|
||||
@@ -512,7 +518,7 @@ void CPanel::OpenParentFolder()
|
||||
|
||||
void CPanel::CloseOpenFolders()
|
||||
{
|
||||
while(_parentFolders.Size() > 0)
|
||||
while (_parentFolders.Size() > 0)
|
||||
{
|
||||
_folder.Release();
|
||||
_library.Free();
|
||||
|
||||
@@ -425,7 +425,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
|
||||
if (_currentFolderPrefix.IsEmpty())
|
||||
{
|
||||
int iconIndexTemp;
|
||||
GetRealIconIndex(itemName + L"\\", attributes, iconIndexTemp);
|
||||
GetRealIconIndex(itemName + WCHAR_PATH_SEPARATOR, attributes, iconIndexTemp);
|
||||
item.iImage = iconIndexTemp;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -288,7 +288,7 @@ HRESULT CPanel::CreateShellContextMenu(
|
||||
LPITEMIDLIST pidl;
|
||||
UString fileName = GetItemRelPath(operatedIndices[i]);
|
||||
if (IsFSDrivesFolder())
|
||||
fileName += L'\\';
|
||||
fileName += WCHAR_PATH_SEPARATOR;
|
||||
RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
|
||||
(wchar_t *)(const wchar_t *)fileName, &eaten, &pidl, 0));
|
||||
pidls.Add(pidl);
|
||||
@@ -301,7 +301,7 @@ HRESULT CPanel::CreateShellContextMenu(
|
||||
/*
|
||||
LPITEMIDLIST pidl;
|
||||
HRESULT result = parentFolder->ParseDisplayName(GetParent(), 0,
|
||||
L".\\", &eaten, &pidl, 0);
|
||||
L"." WSTRING_PATH_SEPARATOR, &eaten, &pidl, 0);
|
||||
if (result != NOERROR)
|
||||
return;
|
||||
*/
|
||||
|
||||
@@ -362,7 +362,7 @@ void CPanel::CreateFolder()
|
||||
return;
|
||||
}
|
||||
}
|
||||
int pos = newName.Find(L'\\');
|
||||
int pos = newName.Find(WCHAR_PATH_SEPARATOR);
|
||||
if (pos >= 0)
|
||||
newName = newName.Left(pos);
|
||||
if (!_mySelectMode)
|
||||
@@ -397,7 +397,7 @@ void CPanel::CreateFile()
|
||||
MessageBoxError(result, LangString(IDS_CREATE_FILE_ERROR, 0x03020243));
|
||||
return;
|
||||
}
|
||||
int pos = newName.Find(L'\\');
|
||||
int pos = newName.Find(WCHAR_PATH_SEPARATOR);
|
||||
if (pos >= 0)
|
||||
newName = newName.Left(pos);
|
||||
if (!_mySelectMode)
|
||||
|
||||
@@ -237,7 +237,7 @@ STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numIt
|
||||
UString destPath = path;
|
||||
if (destPath.IsEmpty())
|
||||
return E_INVALIDARG;
|
||||
bool directName = (destPath[destPath.Length() - 1] != L'\\');
|
||||
bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
|
||||
if (directName)
|
||||
{
|
||||
if (numItems > 1)
|
||||
|
||||
@@ -118,9 +118,7 @@ STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
|
||||
UString folder;
|
||||
if (!::GetProgramFolderPath(folder))
|
||||
return E_FAIL;
|
||||
CMyComBSTR valueTemp = folder;
|
||||
*value = valueTemp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(folder, value);
|
||||
}
|
||||
|
||||
static UString GetDefaultProgramName()
|
||||
@@ -134,16 +132,16 @@ STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
|
||||
UString folder;
|
||||
if (!::GetProgramFolderPath(folder))
|
||||
return E_FAIL;
|
||||
CMyComBSTR valueTemp = folder + GetDefaultProgramName();
|
||||
*value = valueTemp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(folder + GetDefaultProgramName(), value);
|
||||
}
|
||||
|
||||
STDMETHODIMP CPluginOptionsCallback::GetRegistryCUPath(BSTR *value)
|
||||
{
|
||||
CMyComBSTR valueTemp = UString(L"Software\\7-Zip\\FM\\Plugins\\") + _pluginName;
|
||||
*value = valueTemp.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(UString(L"Software"
|
||||
WSTRING_PATH_SEPARATOR L"7-Zip"
|
||||
WSTRING_PATH_SEPARATOR L"FM"
|
||||
WSTRING_PATH_SEPARATOR L"Plugins"
|
||||
WSTRING_PATH_SEPARATOR) + _pluginName, value);
|
||||
}
|
||||
|
||||
void CPluginsPage::OnButtonOptions()
|
||||
|
||||
@@ -15,7 +15,7 @@ bool GetProgramFolderPath(UString &folder)
|
||||
{
|
||||
if (!NDLL::MyGetModuleFileName(g_hInstance, folder))
|
||||
return false;
|
||||
int pos = folder.ReverseFind(L'\\');
|
||||
int pos = folder.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (pos < 0)
|
||||
return false;
|
||||
folder = folder.Left(pos + 1);
|
||||
|
||||
@@ -336,7 +336,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
|
||||
ProgressSynch.GetCurrentFileName(fileName);
|
||||
if (_prevFileName != fileName)
|
||||
{
|
||||
int slashPos = fileName.ReverseFind(L'\\');
|
||||
int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
UString s1, s2;
|
||||
if (slashPos >= 0)
|
||||
{
|
||||
|
||||
@@ -23,22 +23,22 @@ namespace NRegistryAssociations {
|
||||
|
||||
static NSynchronization::CCriticalSection g_CriticalSection;
|
||||
|
||||
static const TCHAR *kCUKeyPath = TEXT("Software\\7-ZIP\\FM");
|
||||
static const TCHAR *kAssociations = TEXT("Associations");
|
||||
#define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
|
||||
|
||||
static const TCHAR *kCUKeyPath = REG_PATH_FM;
|
||||
static const WCHAR *kExtPlugins = L"Plugins";
|
||||
static const TCHAR *kExtEnabled = TEXT("Enabled");
|
||||
|
||||
static CSysString GetAssociationsPath()
|
||||
{
|
||||
return CSysString(kCUKeyPath) + CSysString('\\') + CSysString(kAssociations);
|
||||
}
|
||||
#define kAssociations TEXT("Associations")
|
||||
#define kAssociationsPath REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) kAssociations
|
||||
|
||||
bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
|
||||
CKey key;
|
||||
if(key.Open(HKEY_CURRENT_USER, GetAssociationsPath() + CSysString('\\') +
|
||||
CSysString(GetSystemString(ext)), KEY_READ) != ERROR_SUCCESS)
|
||||
if (key.Open(HKEY_CURRENT_USER,
|
||||
CSysString(kAssociationsPath TEXT(STRING_PATH_SEPARATOR)) +
|
||||
GetSystemString(ext), KEY_READ) != ERROR_SUCCESS)
|
||||
return false;
|
||||
UString pluginsString;
|
||||
key.QueryValue(kExtPlugins, pluginsString);
|
||||
@@ -51,7 +51,7 @@ void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
|
||||
items.Clear();
|
||||
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
|
||||
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;
|
||||
CSysStringVector extNames;
|
||||
associationsKey.EnumKeys(extNames);
|
||||
@@ -62,7 +62,7 @@ void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
|
||||
// extInfo.Enabled = false;
|
||||
extInfo.Ext = GetUnicodeString(extName);
|
||||
CKey key;
|
||||
if(key.Open(associationsKey, extName, KEY_READ) != ERROR_SUCCESS)
|
||||
if (key.Open(associationsKey, extName, KEY_READ) != ERROR_SUCCESS)
|
||||
return;
|
||||
UString pluginsString;
|
||||
key.QueryValue(kExtPlugins, pluginsString);
|
||||
@@ -129,7 +129,7 @@ static bool CheckShellExtensionInfo2(const CSysString &extension, UString &iconP
|
||||
if (programNameValue.CompareNoCase(extProgramKeyName) != 0)
|
||||
return false;
|
||||
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;
|
||||
UString value;
|
||||
if (extKey.QueryValue(NULL, value) == ERROR_SUCCESS)
|
||||
|
||||
@@ -110,7 +110,7 @@ void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
|
||||
if (::ReadPluginInfo(pluginInfo))
|
||||
plugins.Add(pluginInfo);
|
||||
}
|
||||
UString folderPath = baseFolderPrefix + L"Plugins\\";
|
||||
UString folderPath = baseFolderPrefix + L"Plugins" WSTRING_PATH_SEPARATOR;
|
||||
NFind::CEnumeratorW enumerator(folderPath + L"*");
|
||||
NFind::CFileInfoW fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
using namespace NWindows;
|
||||
using namespace NRegistry;
|
||||
|
||||
static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP");
|
||||
static const TCHAR *kCU_FMPath = TEXT("Software\\7-ZIP\\FM");
|
||||
// static const TCHAR *kLM_Path = TEXT("Software\\7-ZIP\\FM");
|
||||
#define REG_PATH_7Z TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP")
|
||||
|
||||
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 *kEditor = L"Editor";
|
||||
|
||||
@@ -95,8 +95,8 @@ UString GetMyDocsPath()
|
||||
us = GetUnicodeString(s2);
|
||||
}
|
||||
#endif
|
||||
if (us.Length() > 0 && us[us.Length() - 1] != L'\\')
|
||||
us += L'\\';
|
||||
if (us.Length() > 0 && us[us.Length() - 1] != WCHAR_PATH_SEPARATOR)
|
||||
us += WCHAR_PATH_SEPARATOR;
|
||||
return us;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolde
|
||||
{
|
||||
CNetFolder *netFolderSpec = new CNetFolder;
|
||||
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();
|
||||
}
|
||||
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)
|
||||
{
|
||||
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)
|
||||
@@ -159,7 +159,7 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
|
||||
if (AreEqualNames(name2, L"My Computer") ||
|
||||
AreEqualNames(name2, L"Computer"))
|
||||
return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder);
|
||||
if (name2 == UString(L'\\'))
|
||||
if (name2 == UString(WCHAR_PATH_SEPARATOR))
|
||||
{
|
||||
CMyComPtr<IFolderFolder> subFolder = this;
|
||||
*resultFolder = subFolder.Detach();
|
||||
@@ -179,13 +179,13 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
|
||||
}
|
||||
else
|
||||
{
|
||||
if (name2[name2.Length () - 1] != L'\\')
|
||||
name2 += L'\\';
|
||||
if (name2[name2.Length () - 1] != WCHAR_PATH_SEPARATOR)
|
||||
name2 += WCHAR_PATH_SEPARATOR;
|
||||
NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
|
||||
subFolder = fsFolderSpec;
|
||||
if (fsFolderSpec->Init(name2, 0) != S_OK)
|
||||
{
|
||||
if (name2[0] == L'\\')
|
||||
if (name2[0] == WCHAR_PATH_SEPARATOR)
|
||||
{
|
||||
CNetFolder *netFolderSpec = new CNetFolder;
|
||||
subFolder = netFolderSpec;
|
||||
@@ -240,7 +240,3 @@ STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
|
||||
*iconIndex = _iconIndices[index];
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,9 +93,7 @@ STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefi
|
||||
*/
|
||||
}
|
||||
*passwordIsDefined = BoolToInt(_passwordIsDefined);
|
||||
CMyComBSTR tempName = _password;
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(_password, password);
|
||||
}
|
||||
|
||||
STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
|
||||
@@ -112,8 +110,5 @@ STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
|
||||
{
|
||||
if (!_passwordIsDefined)
|
||||
return S_FALSE;
|
||||
CMyComBSTR tempName = _password;
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(_password, password);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
using namespace NWindows;
|
||||
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 *kPanelsInfoValueName = TEXT("Panels");
|
||||
@@ -126,11 +127,8 @@ void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo)
|
||||
}
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CSysString keyName = kCUBasePath;
|
||||
keyName += kKeyNameDelimiter;
|
||||
keyName += kCulumnsKeyName;
|
||||
CKey key;
|
||||
key.Create(HKEY_CURRENT_USER, keyName);
|
||||
key.Create(HKEY_CURRENT_USER, kCulumnsKeyName);
|
||||
key.SetValue(GetSystemString(id), (const Byte *)buffer, dataSize);
|
||||
}
|
||||
}
|
||||
@@ -143,11 +141,8 @@ void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo)
|
||||
UInt32 size;
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CSysString keyName = kCUBasePath;
|
||||
keyName += kKeyNameDelimiter;
|
||||
keyName += kCulumnsKeyName;
|
||||
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;
|
||||
if (key.QueryValue(GetSystemString(id), buffer, size) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
@@ -426,7 +426,7 @@ void CCompressDialog::OnButtonSFX()
|
||||
UString fileName;
|
||||
m_ArchivePath.GetText(fileName);
|
||||
int dotPos = fileName.ReverseFind(L'.');
|
||||
int slashPos = fileName.ReverseFind(L'\\');
|
||||
int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||
if (dotPos < 0 || dotPos <= slashPos)
|
||||
dotPos = -1;
|
||||
bool isSFX = IsSFX();
|
||||
@@ -707,7 +707,7 @@ void CCompressDialog::SetArchiveName(const UString &name)
|
||||
if (!Info.KeepName)
|
||||
{
|
||||
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)
|
||||
fileName = fileName.Left(dotPos);
|
||||
}
|
||||
|
||||
@@ -167,9 +167,7 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST
|
||||
}
|
||||
}
|
||||
*passwordIsDefined = BoolToInt(PasswordIsDefined);
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -211,9 +209,7 @@ HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
|
||||
Password = dialog.Password;
|
||||
PasswordIsDefined = true;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
*password = tempName.Detach();
|
||||
return S_OK;
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password)
|
||||
|
||||
@@ -239,7 +239,7 @@ static HRESULT ShowDialog(
|
||||
for (int i = 0; i < item.PathParts.Size(); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
name += L'\\';
|
||||
name += WCHAR_PATH_SEPARATOR;
|
||||
name += item.PathParts[i];
|
||||
}
|
||||
if (NFind::FindFile(name, fileInfo))
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
if (newCapacity > 0)
|
||||
{
|
||||
newBuffer = new T[newCapacity];
|
||||
if(_capacity > 0)
|
||||
if (_capacity > 0)
|
||||
memmove(newBuffer, _items, MyMin(_capacity, newCapacity) * sizeof(T));
|
||||
}
|
||||
else
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
CBuffer& operator=(const CBuffer &buffer)
|
||||
{
|
||||
Free();
|
||||
if(buffer._capacity > 0)
|
||||
if (buffer._capacity > 0)
|
||||
{
|
||||
SetCapacity(buffer._capacity);
|
||||
memmove(_items, buffer._items, buffer._capacity * sizeof(T));
|
||||
|
||||
@@ -21,7 +21,7 @@ bool CFileBase::OpenBinary(const char *name, int flags)
|
||||
|
||||
bool CFileBase::Close()
|
||||
{
|
||||
if(_handle == -1)
|
||||
if (_handle == -1)
|
||||
return true;
|
||||
if (close(_handle) != 0)
|
||||
return false;
|
||||
|
||||
@@ -99,14 +99,14 @@ bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
|
||||
int pos = 0;
|
||||
if (!IsItSwitchChar(s[pos]))
|
||||
return false;
|
||||
while(pos < len)
|
||||
while (pos < len)
|
||||
{
|
||||
if (IsItSwitchChar(s[pos]))
|
||||
pos++;
|
||||
const int kNoLen = -1;
|
||||
int matchedSwitchIndex = 0; // GCC Warning
|
||||
int maxLen = kNoLen;
|
||||
for(int switchIndex = 0; switchIndex < _numSwitches; switchIndex++)
|
||||
for (int switchIndex = 0; switchIndex < _numSwitches; switchIndex++)
|
||||
{
|
||||
int switchLen = MyStringLen(switchForms[switchIndex].IDString);
|
||||
if (switchLen <= maxLen || pos + switchLen > len)
|
||||
@@ -114,8 +114,8 @@ bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
|
||||
|
||||
UString temp = s + pos;
|
||||
temp = temp.Left(switchLen);
|
||||
if(temp.CompareNoCase(switchForms[switchIndex].IDString) == 0)
|
||||
// if(_strnicmp(switchForms[switchIndex].IDString, LPCSTR(s) + pos, switchLen) == 0)
|
||||
if (temp.CompareNoCase(switchForms[switchIndex].IDString) == 0)
|
||||
// if (_strnicmp(switchForms[switchIndex].IDString, LPCSTR(s) + pos, switchLen) == 0)
|
||||
{
|
||||
matchedSwitchIndex = switchIndex;
|
||||
maxLen = switchLen;
|
||||
@@ -180,7 +180,7 @@ bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
|
||||
int maxLen = switchForm.MaxLen;
|
||||
UString stringSwitch = s.Mid(pos, minLen);
|
||||
pos += minLen;
|
||||
for(int i = minLen; i < maxLen && pos < len; i++, pos++)
|
||||
for (int i = minLen; i < maxLen && pos < len; i++, pos++)
|
||||
{
|
||||
wchar_t c = s[pos];
|
||||
if (IsItSwitchChar(c))
|
||||
@@ -208,12 +208,12 @@ const CSwitchResult& CParser::operator[](size_t index) const
|
||||
int ParseCommand(int numCommandForms, const CCommandForm *commandForms,
|
||||
const UString &commandString, UString &postString)
|
||||
{
|
||||
for(int i = 0; i < numCommandForms; i++)
|
||||
for (int i = 0; i < numCommandForms; i++)
|
||||
{
|
||||
const UString id = commandForms[i].IDString;
|
||||
if (commandForms[i].PostStringMode)
|
||||
{
|
||||
if(commandString.Find(id) == 0)
|
||||
if (commandString.Find(id) == 0)
|
||||
{
|
||||
postString = commandString.Mid(id.Length());
|
||||
return i;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
CDynamicBuffer& operator=(const CDynamicBuffer &buffer)
|
||||
{
|
||||
this->Free();
|
||||
if(buffer._capacity > 0)
|
||||
if (buffer._capacity > 0)
|
||||
{
|
||||
SetCapacity(buffer._capacity);
|
||||
memmove(this->_items, buffer._items, buffer._capacity * sizeof(T));
|
||||
|
||||
@@ -22,7 +22,7 @@ void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base)
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while(pos > 0);
|
||||
while (pos > 0);
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void ConvertUInt64ToString(UInt64 value, wchar_t *s)
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while(pos > 0);
|
||||
while (pos > 0);
|
||||
*s = L'\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &resultStrings, UINT
|
||||
}
|
||||
|
||||
UString t;
|
||||
for(int i = 0; i < u.Length(); i++)
|
||||
for (int i = 0; i < u.Length(); i++)
|
||||
{
|
||||
wchar_t c = u[i];
|
||||
if (c == L'\n' || c == 0xD)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "MyWindows.h"
|
||||
|
||||
#ifndef RINOK
|
||||
#define RINOK(x) { HRESULT __result_ = (x); if(__result_ != S_OK) return __result_; }
|
||||
#define RINOK(x) { HRESULT __result_ = (x); if (__result_ != S_OK) return __result_; }
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
@@ -78,12 +78,18 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
inline HRESULT StringToBstr(LPCOLESTR src, BSTR *bstr)
|
||||
{
|
||||
*bstr = ::SysAllocString(src);
|
||||
return (*bstr != 0) ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
class CMyComBSTR
|
||||
{
|
||||
public:
|
||||
BSTR m_str;
|
||||
CMyComBSTR() { m_str = NULL; }
|
||||
CMyComBSTR(LPCOLESTR pSrc) { m_str = ::SysAllocString(pSrc); }
|
||||
CMyComBSTR(): m_str(NULL) {}
|
||||
CMyComBSTR(LPCOLESTR src) { m_str = ::SysAllocString(src); }
|
||||
// CMyComBSTR(int nSize) { m_str = ::SysAllocStringLen(NULL, nSize); }
|
||||
// CMyComBSTR(int nSize, LPCOLESTR sz) { m_str = ::SysAllocStringLen(sz, nSize); }
|
||||
CMyComBSTR(const CMyComBSTR& src) { m_str = src.MyCopy(); }
|
||||
@@ -107,10 +113,10 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
CMyComBSTR& operator=(LPCOLESTR pSrc)
|
||||
CMyComBSTR& operator=(LPCOLESTR src)
|
||||
{
|
||||
::SysFreeString(m_str);
|
||||
m_str = ::SysAllocString(pSrc);
|
||||
m_str = ::SysAllocString(src);
|
||||
return *this;
|
||||
}
|
||||
unsigned int Length() const { return ::SysStringLen(m_str); }
|
||||
@@ -120,16 +126,18 @@ public:
|
||||
{
|
||||
int byteLen = ::SysStringByteLen(m_str);
|
||||
BSTR res = ::SysAllocStringByteLen(NULL, byteLen);
|
||||
memmove(res, m_str, byteLen);
|
||||
memcpy(res, m_str, byteLen);
|
||||
return res;
|
||||
}
|
||||
void Attach(BSTR src) { m_str = src; }
|
||||
/*
|
||||
void Attach(BSTR src) { m_str = src; }
|
||||
BSTR Detach()
|
||||
{
|
||||
BSTR s = m_str;
|
||||
m_str = NULL;
|
||||
return s;
|
||||
}
|
||||
*/
|
||||
void Empty()
|
||||
{
|
||||
::SysFreeString(m_str);
|
||||
@@ -138,7 +146,6 @@ public:
|
||||
bool operator!() const { return (m_str == NULL); }
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
class CMyUnknownImp
|
||||
|
||||
@@ -24,7 +24,7 @@ template <class T>
|
||||
inline T * MyStringCopy(T *dest, const T *src)
|
||||
{
|
||||
T *destStart = dest;
|
||||
while((*dest++ = *src++) != 0);
|
||||
while ((*dest++ = *src++) != 0);
|
||||
return destStart;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class CStringBase
|
||||
pLast = NULL;
|
||||
p = GetNextCharPointer(p);
|
||||
}
|
||||
if(pLast != NULL)
|
||||
if (pLast != NULL)
|
||||
{
|
||||
int i = (int)(pLast - _chars);
|
||||
Delete(i, _length - i);
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
/*
|
||||
const int kMaxStringSize = 0x20000000;
|
||||
#ifndef _WIN32_WCE
|
||||
if(newCapacity > kMaxStringSize || newCapacity < _length)
|
||||
if (newCapacity > kMaxStringSize || newCapacity < _length)
|
||||
throw 1052337;
|
||||
#endif
|
||||
*/
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
{
|
||||
/*
|
||||
#ifndef _WIN32_WCE
|
||||
if(newLength >= _capacity)
|
||||
if (newLength >= _capacity)
|
||||
throw 282217;
|
||||
#endif
|
||||
*/
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
}
|
||||
CStringBase& operator=(const CStringBase& s)
|
||||
{
|
||||
if(&s == this)
|
||||
if (&s == this)
|
||||
return *this;
|
||||
Empty();
|
||||
SetCapacity(s._length);
|
||||
@@ -414,7 +414,7 @@ public:
|
||||
}
|
||||
int FindOneOf(const CStringBase &s) const
|
||||
{
|
||||
for(int i = 0; i < _length; i++)
|
||||
for (int i = 0; i < _length; i++)
|
||||
if (s.Find(_chars[i]) >= 0)
|
||||
return i;
|
||||
return -1;
|
||||
@@ -461,7 +461,7 @@ public:
|
||||
pLast = NULL;
|
||||
p = GetNextCharPointer(p);
|
||||
}
|
||||
if(pLast != NULL)
|
||||
if (pLast != NULL)
|
||||
{
|
||||
int i = pLast - _chars;
|
||||
Delete(i, _length - i);
|
||||
@@ -487,7 +487,7 @@ public:
|
||||
return _length;
|
||||
int numInsertChars = s.Length();
|
||||
InsertSpace(index, numInsertChars);
|
||||
for(int i = 0; i < numInsertChars; i++)
|
||||
for (int i = 0; i < numInsertChars; i++)
|
||||
_chars[index + i] = s[i];
|
||||
_length += numInsertChars;
|
||||
return _length;
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
{
|
||||
int size = v.Size();
|
||||
Reserve(Size() + size);
|
||||
for(int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
Add(v[i]);
|
||||
return *this;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
int i = size / 2;
|
||||
do
|
||||
SortRefDown(p, i, size, compare, param);
|
||||
while(--i != 0);
|
||||
while (--i != 0);
|
||||
}
|
||||
do
|
||||
{
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
{
|
||||
int size = v.Size();
|
||||
Reserve(Size() + size);
|
||||
for(int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
Add(v[i]);
|
||||
return *this;
|
||||
}
|
||||
@@ -191,13 +191,13 @@ public:
|
||||
virtual void Delete(int index, int num = 1)
|
||||
{
|
||||
TestIndexAndCorrectNum(index, num);
|
||||
for(int i = 0; i < num; i++)
|
||||
for (int i = 0; i < num; i++)
|
||||
delete (T *)(((void **)_items)[index + i]);
|
||||
CPointerVector::Delete(index, num);
|
||||
}
|
||||
int Find(const T& item) const
|
||||
{
|
||||
for(int i = 0; i < Size(); i++)
|
||||
for (int i = 0; i < Size(); i++)
|
||||
if (item == (*this)[i])
|
||||
return i;
|
||||
return -1;
|
||||
|
||||
@@ -94,14 +94,10 @@ HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src)
|
||||
|
||||
LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2)
|
||||
{
|
||||
if(ft1->dwHighDateTime < ft2->dwHighDateTime)
|
||||
return -1;
|
||||
if(ft1->dwHighDateTime > ft2->dwHighDateTime)
|
||||
return 1;
|
||||
if(ft1->dwLowDateTime < ft2->dwLowDateTime)
|
||||
return -1;
|
||||
if(ft1->dwLowDateTime > ft2->dwLowDateTime)
|
||||
return 1;
|
||||
if (ft1->dwHighDateTime < ft2->dwHighDateTime) return -1;
|
||||
if (ft1->dwHighDateTime > ft2->dwHighDateTime) return 1;
|
||||
if (ft1->dwLowDateTime < ft2->dwLowDateTime) return -1;
|
||||
if (ft1->dwLowDateTime > ft2->dwLowDateTime) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ bool CStdInStream::Open(LPCTSTR fileName)
|
||||
|
||||
bool CStdInStream::Close()
|
||||
{
|
||||
if(!_streamIsOpen)
|
||||
if (!_streamIsOpen)
|
||||
return true;
|
||||
_streamIsOpen = (fclose(_stream) != 0);
|
||||
return !_streamIsOpen;
|
||||
@@ -48,12 +48,12 @@ AString CStdInStream::ScanStringUntilNewLine()
|
||||
for (;;)
|
||||
{
|
||||
int intChar = GetChar();
|
||||
if(intChar == EOF)
|
||||
if (intChar == EOF)
|
||||
throw kEOFMessage;
|
||||
char c = char(intChar);
|
||||
if (c == kIllegalChar)
|
||||
throw kIllegalCharMessage;
|
||||
if(c == kNewLineChar)
|
||||
if (c == kNewLineChar)
|
||||
break;
|
||||
s += c;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void CStdInStream::ReadToString(AString &resultString)
|
||||
{
|
||||
resultString.Empty();
|
||||
int c;
|
||||
while((c = GetChar()) != EOF)
|
||||
while ((c = GetChar()) != EOF)
|
||||
resultString += char(c);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool CStdInStream::Eof()
|
||||
int CStdInStream::GetChar()
|
||||
{
|
||||
int c = fgetc(_stream); // getc() doesn't work in BeOS?
|
||||
if(c == EOF && !Eof())
|
||||
if (c == EOF && !Eof())
|
||||
throw kReadErrorMessage;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool CStdOutStream::Open(const char *fileName)
|
||||
|
||||
bool CStdOutStream::Close()
|
||||
{
|
||||
if(!_streamIsOpen)
|
||||
if (!_streamIsOpen)
|
||||
return true;
|
||||
if (fclose(_stream) != 0)
|
||||
return false;
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
|
||||
{
|
||||
UString resultString;
|
||||
if(!srcString.IsEmpty())
|
||||
if (!srcString.IsEmpty())
|
||||
{
|
||||
int numChars = MultiByteToWideChar(codePage, 0, srcString,
|
||||
srcString.Length(), resultString.GetBuffer(srcString.Length()),
|
||||
srcString.Length() + 1);
|
||||
#ifndef _WIN32_WCE
|
||||
if(numChars == 0)
|
||||
if (numChars == 0)
|
||||
throw 282228;
|
||||
#endif
|
||||
resultString.ReleaseBuffer(numChars);
|
||||
@@ -39,7 +39,7 @@ AString UnicodeStringToMultiByte(const UString &s, UINT codePage, char defaultCh
|
||||
&defaultChar, &defUsed);
|
||||
defaultCharWasUsed = (defUsed != FALSE);
|
||||
#ifndef _WIN32_WCE
|
||||
if(numChars == 0)
|
||||
if (numChars == 0)
|
||||
throw 282229;
|
||||
#endif
|
||||
dest.ReleaseBuffer(numChars);
|
||||
@@ -71,7 +71,7 @@ UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
|
||||
for (int i = 0; i < srcString.Length(); i++)
|
||||
resultString += wchar_t(srcString[i]);
|
||||
/*
|
||||
if(!srcString.IsEmpty())
|
||||
if (!srcString.IsEmpty())
|
||||
{
|
||||
int numChars = mbstowcs(resultString.GetBuffer(srcString.Length()), srcString, srcString.Length() + 1);
|
||||
if (numChars < 0) throw "Your environment does not support UNICODE";
|
||||
@@ -87,7 +87,7 @@ AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
|
||||
for (int i = 0; i < srcString.Length(); i++)
|
||||
resultString += char(srcString[i]);
|
||||
/*
|
||||
if(!srcString.IsEmpty())
|
||||
if (!srcString.IsEmpty())
|
||||
{
|
||||
int numRequiredBytes = srcString.Length() * 6 + 1;
|
||||
int numChars = wcstombs(resultString.GetBuffer(numRequiredBytes), srcString, numRequiredBytes);
|
||||
|
||||
@@ -106,8 +106,8 @@ void SplitPathToParts(const UString &path, UStringVector &pathParts)
|
||||
void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name)
|
||||
{
|
||||
int i;
|
||||
for(i = path.Length() - 1; i >= 0; i--)
|
||||
if(IsCharDirLimiter(path[i]))
|
||||
for (i = path.Length() - 1; i >= 0; i--)
|
||||
if (IsCharDirLimiter(path[i]))
|
||||
break;
|
||||
dirPrefix = path.Left(i + 1);
|
||||
name = path.Mid(i + 1);
|
||||
@@ -116,8 +116,8 @@ void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name)
|
||||
UString ExtractDirPrefixFromPath(const UString &path)
|
||||
{
|
||||
int i;
|
||||
for(i = path.Length() - 1; i >= 0; i--)
|
||||
if(IsCharDirLimiter(path[i]))
|
||||
for (i = path.Length() - 1; i >= 0; i--)
|
||||
if (IsCharDirLimiter(path[i]))
|
||||
break;
|
||||
return path.Left(i + 1);
|
||||
}
|
||||
@@ -125,8 +125,8 @@ UString ExtractDirPrefixFromPath(const UString &path)
|
||||
UString ExtractFileNameFromPath(const UString &path)
|
||||
{
|
||||
int i;
|
||||
for(i = path.Length() - 1; i >= 0; i--)
|
||||
if(IsCharDirLimiter(path[i]))
|
||||
for (i = path.Length() - 1; i >= 0; i--)
|
||||
if (IsCharDirLimiter(path[i]))
|
||||
break;
|
||||
return path.Mid(i + 1);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ bool CCensorNode::CheckPath(const UString &path, bool isFile, bool &include) con
|
||||
bool CCensorNode::CheckPath(const UString &path, bool isFile) const
|
||||
{
|
||||
bool include;
|
||||
if(CheckPath(path, isFile, include))
|
||||
if (CheckPath(path, isFile, include))
|
||||
return include;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
~CStgMedium() { Free(); }
|
||||
void Free()
|
||||
{
|
||||
if(_mustBeReleased)
|
||||
if (_mustBeReleased)
|
||||
ReleaseStgMedium(&_object);
|
||||
_mustBeReleased = false;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
CImageList(): m_Object(NULL) {}
|
||||
bool Attach(HIMAGELIST imageList)
|
||||
{
|
||||
if(imageList == NULL)
|
||||
if (imageList == NULL)
|
||||
return false;
|
||||
m_Object = imageList;
|
||||
return true;
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
{
|
||||
HIMAGELIST a = ImageList_Create(width, height, flags,
|
||||
initialNumber, grow);
|
||||
if(a == NULL)
|
||||
if (a == NULL)
|
||||
return false;
|
||||
return Attach(a);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className,
|
||||
HINSTANCE instance)
|
||||
{
|
||||
WNDCLASS windowClass;
|
||||
if(!::GetClassInfo(instance, className, &windowClass))
|
||||
if (!::GetClassInfo(instance, className, &windowClass))
|
||||
{
|
||||
// windowClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
windowClass.style = 0;
|
||||
@@ -80,7 +80,7 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className,
|
||||
HINSTANCE instance)
|
||||
{
|
||||
bool needRegister;
|
||||
if(g_IsNT)
|
||||
if (g_IsNT)
|
||||
{
|
||||
WNDCLASSW windowClass;
|
||||
needRegister = ::GetClassInfoW(instance, className, &windowClass) == 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ bool CLibrary::LoadOperations(HMODULE newModule)
|
||||
{
|
||||
if (newModule == NULL)
|
||||
return false;
|
||||
if(!Free())
|
||||
if (!Free())
|
||||
return false;
|
||||
_module = newModule;
|
||||
return true;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace NError {
|
||||
bool MyFormatMessage(DWORD messageID, CSysString &message)
|
||||
{
|
||||
LPVOID msgBuf;
|
||||
if(::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,messageID, 0, (LPTSTR) &msgBuf,0, NULL) == 0)
|
||||
return false;
|
||||
@@ -32,7 +32,7 @@ bool MyFormatMessage(DWORD messageID, UString &message)
|
||||
if (g_IsNT)
|
||||
{
|
||||
LPVOID msgBuf;
|
||||
if(::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, messageID, 0, (LPWSTR) &msgBuf, 0, NULL) == 0)
|
||||
return false;
|
||||
|
||||
@@ -250,12 +250,12 @@ bool CreateComplexDirectory(LPCTSTR pathName)
|
||||
path.ParsePath(pathName);
|
||||
CSysString fullPath = path.Prefix;
|
||||
DWORD errorCode = ERROR_SUCCESS;
|
||||
for(int i = 0; i < path.PathParts.Size(); i++)
|
||||
for (int i = 0; i < path.PathParts.Size(); i++)
|
||||
{
|
||||
const CSysString &string = path.PathParts[i];
|
||||
if(string.IsEmpty())
|
||||
if (string.IsEmpty())
|
||||
{
|
||||
if(i != path.PathParts.Size() - 1)
|
||||
if (i != path.PathParts.Size() - 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ bool CreateComplexDirectory(LPCTSTR pathName)
|
||||
if (!MyCreateDirectory(fullPath))
|
||||
{
|
||||
DWORD errorCode = GetLastError();
|
||||
if(errorCode != ERROR_ALREADY_EXISTS)
|
||||
if (errorCode != ERROR_ALREADY_EXISTS)
|
||||
return false;
|
||||
}
|
||||
fullPath += NName::kDirDelimiter;
|
||||
@@ -286,7 +286,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
|
||||
pos = pathName.Length();
|
||||
for (;;)
|
||||
{
|
||||
if(MyCreateDirectory(pathName))
|
||||
if (MyCreateDirectory(pathName))
|
||||
break;
|
||||
if (::GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
@@ -305,7 +305,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
|
||||
pathName = pathName.Left(pos);
|
||||
}
|
||||
pathName = pathName2;
|
||||
while(pos < pathName.Length())
|
||||
while (pos < pathName.Length())
|
||||
{
|
||||
pos = pathName.Find(TEXT(CHAR_PATH_SEPARATOR), pos + 1);
|
||||
if (pos < 0)
|
||||
@@ -332,7 +332,7 @@ bool CreateComplexDirectory(LPCWSTR _aPathName)
|
||||
pos = pathName.Length();
|
||||
for (;;)
|
||||
{
|
||||
if(MyCreateDirectory(pathName))
|
||||
if (MyCreateDirectory(pathName))
|
||||
break;
|
||||
if (::GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
@@ -351,7 +351,7 @@ bool CreateComplexDirectory(LPCWSTR _aPathName)
|
||||
pathName = pathName.Left(pos);
|
||||
}
|
||||
pathName = pathName2;
|
||||
while(pos < pathName.Length())
|
||||
while (pos < pathName.Length())
|
||||
{
|
||||
pos = pathName.Find(WCHAR_PATH_SEPARATOR, pos + 1);
|
||||
if (pos < 0)
|
||||
@@ -398,7 +398,7 @@ bool DeleteFileAlways(LPCWSTR name)
|
||||
|
||||
static bool RemoveDirectorySubItems2(const CSysString pathPrefix, const NFind::CFileInfo &fileInfo)
|
||||
{
|
||||
if(fileInfo.IsDir())
|
||||
if (fileInfo.IsDir())
|
||||
return RemoveDirectoryWithSubItems(pathPrefix + fileInfo.Name);
|
||||
return DeleteFileAlways(pathPrefix + fileInfo.Name);
|
||||
}
|
||||
@@ -409,7 +409,7 @@ bool RemoveDirectoryWithSubItems(const CSysString &path)
|
||||
CSysString pathPrefix = path + NName::kDirDelimiter;
|
||||
{
|
||||
NFind::CEnumerator enumerator(pathPrefix + TCHAR(NName::kAnyStringWildcard));
|
||||
while(enumerator.Next(fileInfo))
|
||||
while (enumerator.Next(fileInfo))
|
||||
if (!RemoveDirectorySubItems2(pathPrefix, fileInfo))
|
||||
return false;
|
||||
}
|
||||
@@ -421,7 +421,7 @@ bool RemoveDirectoryWithSubItems(const CSysString &path)
|
||||
#ifndef _UNICODE
|
||||
static bool RemoveDirectorySubItems2(const UString pathPrefix, const NFind::CFileInfoW &fileInfo)
|
||||
{
|
||||
if(fileInfo.IsDir())
|
||||
if (fileInfo.IsDir())
|
||||
return RemoveDirectoryWithSubItems(pathPrefix + fileInfo.Name);
|
||||
return DeleteFileAlways(pathPrefix + fileInfo.Name);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ bool RemoveDirectoryWithSubItems(const UString &path)
|
||||
UString pathPrefix = path + UString(NName::kDirDelimiter);
|
||||
{
|
||||
NFind::CEnumeratorW enumerator(pathPrefix + UString(NName::kAnyStringWildcard));
|
||||
while(enumerator.Next(fileInfo))
|
||||
while (enumerator.Next(fileInfo))
|
||||
if (!RemoveDirectorySubItems2(pathPrefix, fileInfo))
|
||||
return false;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ UINT CTempFile::Create(LPCTSTR dirPath, LPCTSTR prefix, CSysString &resultPath)
|
||||
{
|
||||
Remove();
|
||||
UINT number = MyGetTempFileName(dirPath, prefix, resultPath);
|
||||
if(number != 0)
|
||||
if (number != 0)
|
||||
{
|
||||
_fileName = resultPath;
|
||||
_mustBeDeleted = true;
|
||||
@@ -734,7 +734,7 @@ UINT CTempFileW::Create(LPCWSTR dirPath, LPCWSTR prefix, UString &resultPath)
|
||||
{
|
||||
Remove();
|
||||
UINT number = MyGetTempFileName(dirPath, prefix, resultPath);
|
||||
if(number != 0)
|
||||
if (number != 0)
|
||||
{
|
||||
_fileName = resultPath;
|
||||
_mustBeDeleted = true;
|
||||
@@ -784,7 +784,7 @@ bool CreateTempDirectory(LPCTSTR prefix, CSysString &dirName)
|
||||
_stprintf(randomNumberString, _T("%04X"), randomNumber);
|
||||
dirName = prefix + randomNumberString;
|
||||
*/
|
||||
if(NFind::DoesFileExist(dirName))
|
||||
if (NFind::DoesFileExist(dirName))
|
||||
continue;
|
||||
if (MyCreateDirectory(dirName))
|
||||
return true;
|
||||
@@ -821,7 +821,7 @@ bool CreateTempDirectory(LPCWSTR prefix, UString &dirName)
|
||||
_stprintf(randomNumberString, _T("%04X"), randomNumber);
|
||||
dirName = prefix + randomNumberString;
|
||||
*/
|
||||
if(NFind::DoesFileExist(dirName))
|
||||
if (NFind::DoesFileExist(dirName))
|
||||
continue;
|
||||
if (MyCreateDirectory(dirName))
|
||||
return true;
|
||||
|
||||
@@ -344,7 +344,7 @@ bool MyGetLogicalDriveStrings(CSysStringVector &driveStrings)
|
||||
if (newSize > size)
|
||||
return false;
|
||||
CSysString string;
|
||||
for(UINT32 i = 0; i < newSize; i++)
|
||||
for (UINT32 i = 0; i < newSize; i++)
|
||||
{
|
||||
TCHAR c = buffer[i];
|
||||
if (c == TEXT('\0'))
|
||||
@@ -376,7 +376,7 @@ bool MyGetLogicalDriveStrings(UStringVector &driveStrings)
|
||||
if (newSize > size)
|
||||
return false;
|
||||
UString string;
|
||||
for(UINT32 i = 0; i < newSize; i++)
|
||||
for (UINT32 i = 0; i < newSize; i++)
|
||||
{
|
||||
WCHAR c = buffer[i];
|
||||
if (c == L'\0')
|
||||
|
||||
@@ -126,8 +126,8 @@ bool CFileBase::GetLength(UInt64 &length) const
|
||||
{
|
||||
DWORD sizeHigh;
|
||||
DWORD sizeLow = ::GetFileSize(_handle, &sizeHigh);
|
||||
if(sizeLow == 0xFFFFFFFF)
|
||||
if(::GetLastError() != NO_ERROR)
|
||||
if (sizeLow == 0xFFFFFFFF)
|
||||
if (::GetLastError() != NO_ERROR)
|
||||
return false;
|
||||
length = (((UInt64)sizeHigh) << 32) + sizeLow;
|
||||
return true;
|
||||
@@ -139,7 +139,7 @@ bool CFileBase::Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition
|
||||
value.QuadPart = distanceToMove;
|
||||
value.LowPart = ::SetFilePointer(_handle, value.LowPart, &value.HighPart, moveMethod);
|
||||
if (value.LowPart == 0xFFFFFFFF)
|
||||
if(::GetLastError() != NO_ERROR)
|
||||
if (::GetLastError() != NO_ERROR)
|
||||
return false;
|
||||
newPosition = value.QuadPart;
|
||||
return true;
|
||||
@@ -307,9 +307,9 @@ bool COutFile::SetEndOfFile() { return BOOLToBool(::SetEndOfFile(_handle)); }
|
||||
bool COutFile::SetLength(UInt64 length)
|
||||
{
|
||||
UInt64 newPosition;
|
||||
if(!Seek(length, newPosition))
|
||||
if (!Seek(length, newPosition))
|
||||
return false;
|
||||
if(newPosition != length)
|
||||
if (newPosition != length)
|
||||
return false;
|
||||
return SetEndOfFile();
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ void NormalizeDirPathPrefix(UString &dirPath)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
const wchar_t kExtensionDelimiter = L'.';
|
||||
|
||||
void SplitNameToPureNameAndExtension(const UString &fullName,
|
||||
@@ -49,6 +47,4 @@ void SplitNameToPureNameAndExtension(const UString &fullName,
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
@@ -17,10 +17,8 @@ void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with
|
||||
void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\'
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
void SplitNameToPureNameAndExtension(const UString &fullName,
|
||||
UString &pureName, UString &extensionDelimiter, UString &extension);
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
};
|
||||
~CGlobalLock()
|
||||
{
|
||||
if(m_Pointer != NULL)
|
||||
if (m_Pointer != NULL)
|
||||
::GlobalUnlock(m_Global);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ bool enable)
|
||||
bool EnableLockMemoryPrivilege(bool enable)
|
||||
{
|
||||
HMODULE hModule = LoadLibrary(TEXT("Advapi32.dll"));
|
||||
if(hModule == NULL)
|
||||
if (hModule == NULL)
|
||||
return false;
|
||||
bool res = EnableLockMemoryPrivilege2(hModule, enable);
|
||||
::FreeLibrary(hModule);
|
||||
|
||||
@@ -83,7 +83,7 @@ bool CMenu::GetItem(UINT itemIndex, bool byPosition, CMenuItem &item)
|
||||
si.cch = kMaxSize;
|
||||
si.dwTypeData = s;
|
||||
}
|
||||
if(GetItemInfo(itemIndex, byPosition, &si))
|
||||
if (GetItemInfo(itemIndex, byPosition, &si))
|
||||
{
|
||||
ConvertItemToMyForm(si, item);
|
||||
if (item.IsString())
|
||||
@@ -102,7 +102,7 @@ bool CMenu::GetItem(UINT itemIndex, bool byPosition, CMenuItem &item)
|
||||
si.cch = kMaxSize;
|
||||
si.dwTypeData = s;
|
||||
}
|
||||
if(GetItemInfo(itemIndex, byPosition, &si))
|
||||
if (GetItemInfo(itemIndex, byPosition, &si))
|
||||
{
|
||||
ConvertItemToMyForm(si, item);
|
||||
if (item.IsString())
|
||||
|
||||
@@ -13,7 +13,7 @@ bool MyGetTimeFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
|
||||
{
|
||||
resultString.Empty();
|
||||
int numChars = ::GetTimeFormat(locale, flags, time, format, NULL, 0);
|
||||
if(numChars == 0)
|
||||
if (numChars == 0)
|
||||
return false;
|
||||
numChars = ::GetTimeFormat(locale, flags, time, format,
|
||||
resultString.GetBuffer(numChars), numChars + 1);
|
||||
@@ -26,7 +26,7 @@ bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
|
||||
{
|
||||
resultString.Empty();
|
||||
int numChars = ::GetDateFormat(locale, flags, time, format, NULL, 0);
|
||||
if(numChars == 0)
|
||||
if (numChars == 0)
|
||||
return false;
|
||||
numChars = ::GetDateFormat(locale, flags, time, format,
|
||||
resultString.GetBuffer(numChars), numChars + 1);
|
||||
|
||||
@@ -181,7 +181,7 @@ DWORD CEnum::Open(DWORD scope, DWORD type, DWORD usage, const CResourceW *resour
|
||||
|
||||
DWORD CEnum::Close()
|
||||
{
|
||||
if(!_handleAllocated)
|
||||
if (!_handleAllocated)
|
||||
return NO_ERROR;
|
||||
DWORD result = ::WNetCloseEnum(_handle);
|
||||
_handleAllocated = (result != NO_ERROR);
|
||||
|
||||
@@ -259,7 +259,7 @@ void CPropVariant::InternalCopy(const PROPVARIANT* pSrc)
|
||||
|
||||
int CPropVariant::Compare(const CPropVariant &a)
|
||||
{
|
||||
if(vt != a.vt)
|
||||
if (vt != a.vt)
|
||||
return 0; // it's mean some bug
|
||||
switch (vt)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
// #include <stdio.h>
|
||||
|
||||
#include "PropVariantConversions.h"
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
@@ -51,7 +49,7 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
|
||||
{
|
||||
s[0] = '\0';
|
||||
SYSTEMTIME st;
|
||||
if(!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
|
||||
if (!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
|
||||
return false;
|
||||
s = UIntToStringSpec(0, st.wYear, s, 4);
|
||||
s = UIntToStringSpec('-', st.wMonth, s, 2);
|
||||
@@ -63,15 +61,6 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
|
||||
if (includeSeconds)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ LONG CKey::EnumKeys(CSysStringVector &keyNames)
|
||||
{
|
||||
keyNames.Clear();
|
||||
CSysString keyName;
|
||||
for(UInt32 index = 0; ; index++)
|
||||
for (UInt32 index = 0; ; index++)
|
||||
{
|
||||
const UInt32 kBufferSize = MAX_PATH + 1; // 256 in ATL
|
||||
FILETIME lastWriteTime;
|
||||
@@ -312,9 +312,9 @@ LONG CKey::EnumKeys(CSysStringVector &keyNames)
|
||||
LONG result = ::RegEnumKeyEx(_object, index, keyName.GetBuffer(kBufferSize),
|
||||
(DWORD *)&nameSize, NULL, NULL, NULL, &lastWriteTime);
|
||||
keyName.ReleaseBuffer();
|
||||
if(result == ERROR_NO_MORE_ITEMS)
|
||||
if (result == ERROR_NO_MORE_ITEMS)
|
||||
break;
|
||||
if(result != ERROR_SUCCESS)
|
||||
if (result != ERROR_SUCCESS)
|
||||
return result;
|
||||
keyNames.Add(keyName);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
namespace NWindows {
|
||||
namespace NRegistry {
|
||||
|
||||
const TCHAR kKeyNameDelimiter = TEXT('\\');
|
||||
|
||||
LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value);
|
||||
|
||||
class CKey
|
||||
|
||||
@@ -86,7 +86,7 @@ static PSID GetSid(LPWSTR accountName)
|
||||
#endif
|
||||
(NULL, accountName, NULL, &sidLen, NULL, &domainLen, &sidNameUse))
|
||||
{
|
||||
if(::GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
PSID pSid = ::HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sidLen);
|
||||
LPWSTR domainName = (LPWSTR)::HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (domainLen + 1) * sizeof(WCHAR));
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace NShell {
|
||||
|
||||
void CItemIDList::Free()
|
||||
{
|
||||
if(m_Object == NULL)
|
||||
if (m_Object == NULL)
|
||||
return;
|
||||
CMyComPtr<IMalloc> shellMalloc;
|
||||
if(::SHGetMalloc(&shellMalloc) != NOERROR)
|
||||
if (::SHGetMalloc(&shellMalloc) != NOERROR)
|
||||
throw 41099;
|
||||
shellMalloc->Free(m_Object);
|
||||
m_Object = NULL;
|
||||
@@ -43,7 +43,7 @@ CItemIDList& CItemIDList::operator=(LPCITEMIDLIST object)
|
||||
{
|
||||
UINT32 size = GetSize(object);
|
||||
m_Object = (LPITEMIDLIST)CoTaskMemAlloc(size);
|
||||
if(m_Object != NULL)
|
||||
if (m_Object != NULL)
|
||||
MoveMemory(m_Object, object, size);
|
||||
}
|
||||
return *this;
|
||||
@@ -52,11 +52,11 @@ CItemIDList& CItemIDList::operator=(LPCITEMIDLIST object)
|
||||
CItemIDList& CItemIDList::operator=(const CItemIDList &object)
|
||||
{
|
||||
Free();
|
||||
if(object.m_Object != NULL)
|
||||
if (object.m_Object != NULL)
|
||||
{
|
||||
UINT32 size = GetSize(object.m_Object);
|
||||
m_Object = (LPITEMIDLIST)CoTaskMemAlloc(size);
|
||||
if(m_Object != NULL)
|
||||
if (m_Object != NULL)
|
||||
MoveMemory(m_Object, object.m_Object, size);
|
||||
}
|
||||
return *this;
|
||||
@@ -74,7 +74,7 @@ void CDrop::Attach(HDROP object)
|
||||
|
||||
void CDrop::Free()
|
||||
{
|
||||
if(m_MustBeFinished && m_Assigned)
|
||||
if (m_MustBeFinished && m_Assigned)
|
||||
Finish();
|
||||
m_Assigned = false;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ void CDrop::QueryFileNames(UStringVector &fileNames)
|
||||
fileNames.Clear();
|
||||
UINT numFiles = QueryCountOfFiles();
|
||||
fileNames.Reserve(numFiles);
|
||||
for(UINT i = 0; i < numFiles; i++)
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
fileNames.Add(QueryFileName(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
if (_window == NULL)
|
||||
return true;
|
||||
bool result = BOOLToBool(::DestroyWindow(_window));
|
||||
if(result)
|
||||
if (result)
|
||||
_window = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user