This commit is contained in:
Igor Pavlov
2015-01-03 00:00:00 +00:00
committed by Kornel Lesiński
parent 7e021179cd
commit 0713a3ab80
153 changed files with 2744 additions and 1485 deletions

View File

@@ -492,8 +492,8 @@ HRESULT CProxyArchive2::Load(const CArc &arc, IProgress *progress)
{
file.Name = (const wchar_t *)p;
file.NameSize = 0;
if (size >= 2)
file.NameSize = size / 2 - 1;
if (size >= sizeof(wchar_t))
file.NameSize = size / sizeof(wchar_t) - 1;
}
else
#endif

View File

@@ -0,0 +1,8 @@
// StdAfx.h
#ifndef __STDAFX_H
#define __STDAFX_H
#include "../../../Common/Common.h"
#endif

View File

@@ -236,8 +236,8 @@ static const int kCommandIndex = 0;
// static const char *kUserErrorMessage = "Incorrect command line";
static const char *kCannotFindListFile = "Cannot find listfile";
static const char *kIncorrectListFile = "Incorrect item in listfile.\nCheck charset encoding and -scs switch.";
static const char *kIncorrectWildcardInListFile = "Incorrect wildcard in listfile";
static const char *kIncorrectWildcardInCommandLine = "Incorrect wildcard in command line";
// static const char *kIncorrectWildcardInListFile = "Incorrect wildcard in listfile";
// static const char *kIncorrectWildcardInCommandLine = "Incorrect wildcard in command line";
static const char *kTerminalOutError = "I won't write compressed data to a terminal";
static const char *kSameTerminalError = "I won't write data and program's messages to same terminal";
static const char *kEmptyFilePath = "Empty file path";

View File

@@ -370,7 +370,7 @@ STDMETHODIMP CGetProp::GetProp(PROPID propID, PROPVARIANT *value)
if (propID == kpidName)
{
COM_TRY_BEGIN
NCOM::CPropVariant prop = Name;
NCOM::CPropVariant prop = Name.Ptr();
prop.Detach(value);
return S_OK;
COM_TRY_END
@@ -1059,7 +1059,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
SECURITY_INFORMATION securInfo = DACL_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION;
if (_saclEnabled)
securInfo |= SACL_SECURITY_INFORMATION;
::SetFileSecurityW(fs2us(_diskFilePath), securInfo, (void *)data);
::SetFileSecurityW(fs2us(_diskFilePath), securInfo, (PSECURITY_DESCRIPTOR)(void *)data);
}
}
}

View File

@@ -1316,9 +1316,8 @@ UInt32 g_BenchCpuFreqTemp = 1;
#define YY7 YY5 YY5 YY5 YY5
static const UInt32 kNumFreqCommands = 128;
static UInt32 CountCpuFreq(UInt32 num, UInt32 val)
static UInt32 CountCpuFreq(UInt32 sum, UInt32 num, UInt32 val)
{
UInt32 sum = 0;
for (UInt32 i = 0; i < num; i++)
{
YY7
@@ -1354,7 +1353,7 @@ static THREAD_FUNC_DECL FreqThreadFunction(void *param)
p->CallbackRes = p->Callback->CheckBreak();
if (p->CallbackRes != S_OK)
return 0;
sum = CountCpuFreq(p->Size, sum);
sum = CountCpuFreq(sum, p->Size, g_BenchCpuFreqTemp);
}
p->ValRes = sum;
return 0;
@@ -1653,7 +1652,7 @@ static void PrintRequirements(IBenchPrintCallback &f, const char *sizeString, UI
{
f.Print("RAM ");
f.Print(sizeString);
PrintNumber(f, (size >> 20), 5);
PrintNumber(f, (size >> 20), 6);
f.Print(" MB, # ");
f.Print(threadsString);
PrintNumber(f, numThreads, 3);
@@ -1858,7 +1857,7 @@ static HRESULT FreqBench(
for (UInt64 k = numIterations; k > 0; k--)
{
RINOK(_file->CheckBreak());
sum = CountCpuFreq(bufferSize, sum);
sum = CountCpuFreq(sum, bufferSize, g_BenchCpuFreqTemp);
}
res += sum;
}
@@ -2164,17 +2163,17 @@ HRESULT Bench(
{
UInt64 start = ::GetTimeCount();
UInt32 sum = (UInt32)start;
sum += CountCpuFreq((UInt32)(numMilCommands * 1000000 / kNumFreqCommands), g_BenchCpuFreqTemp);
sum = CountCpuFreq(sum, (UInt32)(numMilCommands * 1000000 / kNumFreqCommands), g_BenchCpuFreqTemp);
start = ::GetTimeCount() - start;
if (start == 0)
start = 1;
UInt64 freq = GetFreq();
UInt64 mips = numMilCommands * freq / start;
UInt64 mipsVal = numMilCommands * freq / start;
if (printCallback)
PrintNumber(*printCallback, mips, 5 + ((sum >> 31) & 1));
PrintNumber(*printCallback, mipsVal, 5 + ((sum >> 31) & 1));
if (jj >= 3)
{
SetComplexCommands(testTime, mips * 1000000, complexInCommands);
SetComplexCommands(testTime, mipsVal * 1000000, complexInCommands);
if (jj >= 8 || start >= freq)
break;
// break; // change it

View File

@@ -124,7 +124,7 @@ void CDirItems::AddSecurityItem(const FString &path, int &secureIndex)
DWORD errorCode = 0;
DWORD secureSize;
BOOL res = ::GetFileSecurityW(fs2us(path), securInfo, TempSecureBuf, (DWORD)TempSecureBuf.Size(), &secureSize);
BOOL res = ::GetFileSecurityW(fs2us(path), securInfo, (PSECURITY_DESCRIPTOR)(Byte *)TempSecureBuf, (DWORD)TempSecureBuf.Size(), &secureSize);
if (res)
{
if (secureSize == 0)
@@ -142,7 +142,7 @@ void CDirItems::AddSecurityItem(const FString &path, int &secureIndex)
else
{
TempSecureBuf.Alloc(secureSize);
res = ::GetFileSecurityW(fs2us(path), securInfo, TempSecureBuf, (DWORD)TempSecureBuf.Size(), &secureSize);
res = ::GetFileSecurityW(fs2us(path), securInfo, (PSECURITY_DESCRIPTOR)(Byte *)TempSecureBuf, (DWORD)TempSecureBuf.Size(), &secureSize);
if (res)
{
if (secureSize != TempSecureBuf.Size())

View File

@@ -169,7 +169,7 @@ static HRESULT DecompressArchive(
}
else
result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, ecs);
if (result == S_OK)
if (result == S_OK && !options.StdInMode)
result = ecs->SetDirsTimes();
return callback->ExtractResult(result);
}

View File

@@ -81,7 +81,7 @@ static const unsigned kNumArcsMax = 48;
static unsigned g_NumArcs = 0;
static const CArcInfo *g_Arcs[kNumArcsMax];
void RegisterArc(const CArcInfo *arcInfo)
void RegisterArc(const CArcInfo *arcInfo) throw()
{
if (g_NumArcs < kNumArcsMax)
{

View File

@@ -446,7 +446,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
#endif
HRESULT Archive_GetItemBoolProp(IInArchive *arc, UInt32 index, PROPID propID, bool &result)
HRESULT Archive_GetItemBoolProp(IInArchive *arc, UInt32 index, PROPID propID, bool &result) throw()
{
NCOM::CPropVariant prop;
result = false;
@@ -458,22 +458,22 @@ HRESULT Archive_GetItemBoolProp(IInArchive *arc, UInt32 index, PROPID propID, bo
return S_OK;
}
HRESULT Archive_IsItem_Folder(IInArchive *arc, UInt32 index, bool &result)
HRESULT Archive_IsItem_Folder(IInArchive *arc, UInt32 index, bool &result) throw()
{
return Archive_GetItemBoolProp(arc, index, kpidIsDir, result);
}
HRESULT Archive_IsItem_Aux(IInArchive *arc, UInt32 index, bool &result)
HRESULT Archive_IsItem_Aux(IInArchive *arc, UInt32 index, bool &result) throw()
{
return Archive_GetItemBoolProp(arc, index, kpidIsAux, result);
}
HRESULT Archive_IsItem_AltStream(IInArchive *arc, UInt32 index, bool &result)
HRESULT Archive_IsItem_AltStream(IInArchive *arc, UInt32 index, bool &result) throw()
{
return Archive_GetItemBoolProp(arc, index, kpidIsAltStream, result);
}
HRESULT Archive_IsItem_Deleted(IInArchive *arc, UInt32 index, bool &result)
HRESULT Archive_IsItem_Deleted(IInArchive *arc, UInt32 index, bool &result) throw()
{
return Archive_GetItemBoolProp(arc, index, kpidIsDeleted, result);
}
@@ -590,12 +590,15 @@ HRESULT CArc::GetItemPath(UInt32 index, UString &result) const
{
wchar_t c = GetUi16(p);
p = (const void *)((const Byte *)p + 2);
if (c == '/')
#if WCHAR_PATH_SEPARATOR != L'/'
if (c == L'/')
c = WCHAR_PATH_SEPARATOR;
#endif
*s++ = c;
}
result.ReleaseBuffer(len);
return S_OK;
if (len != 0)
return S_OK;
}
}
/*
@@ -2633,6 +2636,8 @@ HRESULT CArc::OpenStream(const COpenOptions &op)
return S_OK;
}
#ifdef _SFX
#ifdef _WIN32
static const wchar_t *k_ExeExt = L".exe";
static const unsigned k_ExeExt_Len = 4;
@@ -2641,6 +2646,8 @@ HRESULT CArc::OpenStream(const COpenOptions &op)
static const unsigned k_ExeExt_Len = 0;
#endif
#endif
HRESULT CArc::OpenStreamOrFile(COpenOptions &op)
{
CMyComPtr<IInStream> fileStream;

View File

@@ -52,7 +52,7 @@ void ConvertWinAttribToString(char *s, UInt32 wa)
static const char kPosixTypes[16] = { '0', 'p', 'c', '3', 'd', '5', 'b', '7', '-', '9', 'l', 'B', 's', 'D', 'E', 'F' };
#define MY_ATTR_CHAR(a, n, c) ((a) & (1 << (n))) ? c : '-';
void ConvertPropertyToShortString(char *dest, const PROPVARIANT &prop, PROPID propID, bool full)
void ConvertPropertyToShortString(char *dest, const PROPVARIANT &prop, PROPID propID, bool full) throw()
{
*dest = 0;
if (prop.vt == VT_FILETIME)
@@ -204,7 +204,7 @@ static const char *sidNames[] =
struct CSecID2Name
{
UInt32 n;
char *sz;
const char *sz;
};
const CSecID2Name sid_32_Names[] =
@@ -255,12 +255,12 @@ static const CSecID2Name sid_21_Names[] =
struct CServicesToName
{
UInt32 n[5];
char *sz;
const char *sz;
};
static const CServicesToName services_to_name[] =
{
{ { 956008885, 3418522649, 1831038044, 1853292631, 2271478464 } , "TrustedInstaller" }
{ { 0x38FB89B5, 0xCBC28419, 0x6D236C5C, 0x6E770057, 0x876402C0 } , "TrustedInstaller" }
};
static void ParseSid(AString &s, const Byte *p, UInt32 lim, UInt32 &sidSize)

View File

@@ -1103,10 +1103,12 @@ HRESULT UpdateArchive(
CDirItem parentDirItem;
CDirItem *parentDirItem_Ptr = NULL;
/*
FStringVector requestedPaths;
FStringVector *requestedPaths_Ptr = NULL;
if (options.DeleteAfterCompressing)
requestedPaths_Ptr = &requestedPaths;
*/
if (options.StdInMode)
{
@@ -1421,7 +1423,7 @@ HRESULT UpdateArchive(
m.lpRecips = &rec;
}
sendMail(NULL, 0, &m, MAPI_DIALOG, 0);
sendMail((LHANDLE)0, 0, &m, MAPI_DIALOG, 0);
}
}
#endif

View File

@@ -328,7 +328,6 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
const CDirItem &di = DirItems->Items[up.DirIndex];
// if (di.IsDir())
{
di.ReparseData;
CReparseAttr attr;
if (attr.Parse(di.ReparseData, di.ReparseData.Size()))
{

View File

@@ -29,7 +29,16 @@ struct CUpdatePair2
bool ExistOnDisk() const { return DirIndex != -1; }
bool ExistInArchive() const { return ArcIndex != -1; }
CUpdatePair2(): IsAnti(false), UseArcProps(false), DirIndex(-1), ArcIndex(-1), NewNameIndex(-1) {}
CUpdatePair2():
NewData(false),
NewProps(false),
UseArcProps(false),
IsAnti(false),
DirIndex(-1),
ArcIndex(-1),
NewNameIndex(-1),
IsMainRenameItem(false)
{}
};
struct IUpdateProduceCallback

View File

@@ -187,7 +187,7 @@ static const CFieldInfoInit kStandardFieldTable[] =
};
const int kNumSpacesMax = 32; // it must be larger than max CFieldInfoInit.Width
static char *g_Spaces =
static const char *g_Spaces =
" " ;
static void PrintSpaces(int numSpaces)

View File

@@ -820,7 +820,7 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
// It's fix for bug: crashing in XP. See example in MSDN: "Creating Context Menu Handlers".
#ifndef UNDER_CE
#if !defined(UNDER_CE) && defined(_MSC_VER)
if (commandInfo->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
(commandInfo->fMask & CMIC_MASK_UNICODE) != 0)
{

View File

@@ -367,14 +367,6 @@ SOURCE=..\..\..\Common\StringToInt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\TextConfig.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\TextConfig.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Types.h
# End Source File
# Begin Source File

View File

@@ -1,71 +0,0 @@
// OptionsDialog.cpp
#include "StdAfx.h"
#include "Windows/Control/PropertyPage.h"
#include "../FileManager/DialogSize.h"
#include "../FileManager/LangUtils.h"
#include "FoldersPage.h"
#include "FoldersPageRes.h"
#include "OptionsDialog.h"
#include "MenuPage.h"
#include "MenuPageRes.h"
#include "resource.h"
using namespace NWindows;
static INT_PTR OptionsDialog(HWND hwndOwner)
{
CMenuPage systemPage;
CFoldersPage foldersPage;
UINT32 langIDs[] = { 0x01000300, 0x01000200};
BIG_DIALOG_SIZE(200, 200);
UINT pageIDs[] = { SIZED_DIALOG(IDD_MENU), SIZED_DIALOG(IDD_FOLDERS) };
NControl::CPropertyPage *pagePinters[] = { &systemPage, &foldersPage };
CObjectVector<NControl::CPageInfo> pages;
const int kNumPages = ARRAY_SIZE(langIDs);
for (int i = 0; i < kNumPages; i++)
{
NControl::CPageInfo page;
page.Title = LangString(langIDs[i]);
page.ID = pageIDs[i];
page.Page = pagePinters[i];
pages.Add(page);
}
return NControl::MyPropertySheet(pages, hwndOwner,
LangString(IDS_CONFIG_DIALOG_CAPTION, 0x01000000));
}
STDMETHODIMP CSevenZipOptions::PluginOptions(HWND hWnd,
IPluginOptionsCallback * /* callback */)
{
/*
CComBSTR programPath;
RINOK(callback->GetProgramPath(programName)));
*/
OptionsDialog(hWnd);
return S_OK;
}
STDMETHODIMP CSevenZipOptions::GetFileExtensions(BSTR * /* extensions */)
{
/*
UString extStrings;
CObjectVector<NZipRootRegistry::CArchiverInfo> formats;
NZipRootRegistry::ReadArchiverInfoList(formats);
for(int i = 0; i < formats.Size(); i++)
{
if (i != 0)
extStrings += L' ';
extStrings += formats[i].Extension;
}
CComBSTR valueTemp = extStrings;
*extensions = valueTemp.Detach();
return S_OK;
*/
return E_NOTIMPL;
}

View File

@@ -1,23 +0,0 @@
// OptionsDialog.h
#ifndef __SEVENZIP_OPTIONSDIALOG_H
#define __SEVENZIP_OPTIONSDIALOG_H
#include "../FileManager/PluginInterface.h"
#include "Common/MyCom.h"
// {23170F69-40C1-278D-1000-000100020000}
DEFINE_GUID(CLSID_CSevenZipOptions,
0x23170F69, 0x40C1, 0x278D, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
class CSevenZipOptions:
public IPluginOptions,
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP
STDMETHOD(PluginOptions)(HWND hWnd, IPluginOptionsCallback *callback);
STDMETHOD(GetFileExtensions)(BSTR *extensions);
};
#endif

View File

@@ -25,7 +25,6 @@ COMMON_OBJS = \
$O\Random.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\TextConfig.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj \

View File

@@ -1004,7 +1004,7 @@ STDMETHODIMP CFSFolder::Rename(UInt32 index, const wchar_t *newName, IProgress *
STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress *progress)
{
RINOK(progress->SetTotal(numItems));
int prevDeletedFileIndex = -1;
// int prevDeletedFileIndex = -1;
for (UInt32 i = 0; i < numItems; i++)
{
// Sleep(200);
@@ -1025,7 +1025,7 @@ STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress
{
const CDirItem &fi = Files[index];
const FString fullPath = _path + GetRelPath(fi);
prevDeletedFileIndex = index;
// prevDeletedFileIndex = index;
if (fi.IsDir())
result = RemoveDirWithSubItems(fullPath);
else

View File

@@ -260,7 +260,7 @@ static HRESULT FsCopyFile(
&writeAskResult));
if (IntToBool(writeAskResult))
{
FString destPathNew = us2fs(destPathResult);
FString destPathNew = us2fs((const wchar_t *)(BSTR)destPathResult);
RINOK(callback->SetCurrentFilePath(fs2us(srcPath)));
if (!FsCopyFile(srcPath, destPathNew, callback, completedSize))
{
@@ -351,7 +351,7 @@ static HRESULT FsMoveFile(
&writeAskResult));
if (IntToBool(writeAskResult))
{
FString destPathNew = us2fs(destPathResult);
FString destPathNew = us2fs((const wchar_t *)(BSTR)destPathResult);
RINOK(callback->SetCurrentFilePath(fs2us(srcPath)));
if (!FsMoveFile(srcPath, destPathNew, callback, completedSize))
{

View File

@@ -2,24 +2,28 @@
#include "StdAfx.h"
#include "HelpUtils.h"
#if defined(UNDER_CE) || !defined(_WIN32)
void ShowHelpWindow(HWND, LPCWSTR)
{
}
#else
#include <HtmlHelp.h>
#include "../../../Common/StringConvert.h"
#include "../../../Windows/DLL.h"
#include "HelpUtils.h"
static LPCWSTR kHelpFileName = L"7-zip.chm::/";
#ifdef UNDER_CE
void ShowHelpWindow(HWND, LPCWSTR)
{
}
#else
void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
{
FString path = NWindows::NDLL::GetModuleDirPrefix();
HtmlHelp(hwnd, GetSystemString(fs2us(path) + kHelpFileName + topicFile), HH_DISPLAY_TOPIC, NULL);
HtmlHelp(hwnd, GetSystemString(fs2us(path) + kHelpFileName + topicFile), HH_DISPLAY_TOPIC, 0);
}
#endif

View File

@@ -3,6 +3,8 @@
#ifndef __MY_WINDOWS_NEW_H
#define __MY_WINDOWS_NEW_H
#ifdef _MSC_VER
#include <ShObjIdl.h>
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
@@ -70,3 +72,5 @@ struct ITaskbarList3: public ITaskbarList2
#endif
#endif
#endif

View File

@@ -577,6 +577,10 @@ public:
bool _processTimerMem;
CPanel &_panel;
CDisableTimerProcessing(const CDisableTimerProcessing &);
CDisableTimerProcessing& operator=(const CDisableTimerProcessing &);
public:
CDisableTimerProcessing(CPanel &panel): _panel(panel) { Disable(); }
@@ -590,7 +594,6 @@ public:
{
_panel._processTimer = _processTimerMem;
}
CDisableTimerProcessing& operator=(const CDisableTimerProcessing &) {; }
};
class CDisableNotify
@@ -599,6 +602,10 @@ public:
bool _processStatusBarMem;
CPanel &_panel;
CDisableNotify(const CDisableNotify &);
CDisableNotify& operator=(const CDisableNotify &);
public:
CDisableNotify(CPanel &panel): _panel(panel) { Disable(); }
@@ -620,7 +627,6 @@ public:
_panel._processNotify = _processNotifyMem;
_panel._processStatusBar = _processStatusBarMem;
}
CDisableNotify& operator=(const CDisableNotify &) {; }
};
// bool _passwordIsDefined;

View File

@@ -1137,11 +1137,11 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
return;
CProcess process;
HRESULT res;
/* HRESULT res; */
if (editMode)
res = StartEditApplication(fs2us(tempFilePath), useEditor, (HWND)*this, process);
/* res = */ StartEditApplication(fs2us(tempFilePath), useEditor, (HWND)*this, process);
else
res = StartApplication(fs2us(tempDirNorm), fs2us(tempFilePath), (HWND)*this, process);
/* res = */ StartApplication(fs2us(tempDirNorm), fs2us(tempFilePath), (HWND)*this, process);
if ((HANDLE)process == 0)
return;

View File

@@ -91,12 +91,12 @@ HRESULT CPanel::InitColumns()
ReadListViewInfo();
PROPID sortID;
// PROPID sortID;
/*
if (_listViewInfo.SortIndex >= 0)
sortID = _listViewInfo.Columns[_listViewInfo.SortIndex].PropID;
*/
sortID = _listViewInfo.SortID;
// sortID = _listViewInfo.SortID;
_ascending = _listViewInfo.Ascending;

View File

@@ -640,6 +640,10 @@ bool CPanel::InvokePluginCommand(int id)
return InvokePluginCommand(id, _sevenZipContextMenu, _systemContextMenu);
}
#if defined(_MSC_VER) && !defined(UNDER_CE)
#define use_CMINVOKECOMMANDINFOEX
#endif
bool CPanel::InvokePluginCommand(int id,
IContextMenu *sevenZipContextMenu, IContextMenu *systemContextMenu)
{
@@ -650,7 +654,7 @@ bool CPanel::InvokePluginCommand(int id,
else
offset = id - kSevenZipStartMenuID;
#ifdef UNDER_CE
#ifndef use_CMINVOKECOMMANDINFOEXR
CMINVOKECOMMANDINFO
#else
CMINVOKECOMMANDINFOEX
@@ -659,7 +663,7 @@ bool CPanel::InvokePluginCommand(int id,
memset(&commandInfo, 0, sizeof(commandInfo));
commandInfo.cbSize = sizeof(commandInfo);
commandInfo.fMask = 0
#ifndef UNDER_CE
#ifdef use_CMINVOKECOMMANDINFOEXR
| CMIC_MASK_UNICODE
#endif
;
@@ -669,7 +673,7 @@ bool CPanel::InvokePluginCommand(int id,
CSysString currentFolderSys = GetSystemString(_currentFolderPrefix);
commandInfo.lpDirectory = (LPCSTR)(LPCTSTR)(currentFolderSys);
commandInfo.nShow = SW_SHOW;
#ifndef UNDER_CE
#ifdef use_CMINVOKECOMMANDINFOEXR
commandInfo.lpParametersW = NULL;
commandInfo.lpTitle = "";
commandInfo.lpVerbW = (LPCWSTR)(MAKEINTRESOURCEW(offset));

View File

@@ -194,15 +194,15 @@ void CPanel::DeleteItems(bool NON_CE_VAR(toRecycleBin))
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res;
// int res;
#ifdef _UNICODE
res = ::SHFileOperationW(&fo);
/* res = */ ::SHFileOperationW(&fo);
#else
SHFileOperationWP shFileOperationW = (SHFileOperationWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
if (shFileOperationW == 0)
return;
res = shFileOperationW(&fo);
/* res = */ shFileOperationW(&fo);
#endif
}
}
@@ -529,7 +529,7 @@ void CPanel::ChangeComment()
LangString(IDS_COMMENT2, dlg.Static);
if (dlg.Create(GetParent()) != IDOK)
return;
NCOM::CPropVariant propVariant = dlg.Value;
NCOM::CPropVariant propVariant = (const wchar_t *)dlg.Value;
CDisableNotify disableNotify(*this);
HRESULT result = folderOperations->SetProperty(realIndex, kpidComment, &propVariant, NULL);

View File

@@ -97,7 +97,7 @@ void CPanel::SetSortRawStatus()
int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
if (lpData == NULL)
if (lpData == 0)
return 0;
CPanel *panel = (CPanel*)lpData;
@@ -189,7 +189,7 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
if (lpData == NULL) return 0;
if (lpData == 0) return 0;
if (lParam1 == kParentIndex) return -1;
if (lParam2 == kParentIndex) return 1;

View File

@@ -1,207 +0,0 @@
// PluginsPage.cpp
#include "StdAfx.h"
#include "Common/MyCom.h"
#include "Windows/DLL.h"
#include "HelpUtils.h"
#include "LangUtils.h"
#include "PluginsPage.h"
#include "PluginsPageRes.h"
#include "ProgramLocation.h"
#include "PluginInterface.h"
static const UInt32 kLangIDs[] =
{
IDT_PLUGINS_PLUGINS,
IDB_PLUGINS_OPTIONS
};
static LPCWSTR kPluginsTopic = L"FM/options.htm#plugins";
bool CPluginsPage::OnInit()
{
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
_listView.Attach(GetItem(IDL_PLUGINS));
UINT32 newFlags = /* LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
_listView.SetExtendedListViewStyle(newFlags, newFlags);
_listView.InsertColumn(0, L"Plugins", 50);
ReadFileFolderPluginInfoList(_plugins);
_listView.SetRedraw(false);
// _listView.DeleteAllItems();
for (int i = 0; i < _plugins.Size(); i++)
{
const CPluginInfo &p = _plugins[i];
if (!p.OptionsClassIDDefined)
continue;
LVITEMW item;
item.iItem = i;
item.mask = LVIF_TEXT | LVIF_STATE;
UString pluginName = p.Name;
item.pszText = (WCHAR *)(const WCHAR *)pluginName;
item.state = 0;
item.stateMask = UINT(-1);
item.iSubItem = 0;
_listView.InsertItem(&item);
_listView.SetCheckState(i, true);
}
_listView.SetRedraw(true);
if (_listView.GetItemCount() > 0)
{
UINT state = LVIS_SELECTED | LVIS_FOCUSED;
_listView.SetItemState(0, state, state);
}
_listView.SetColumnWidthAuto(0);
return CPropertyPage::OnInit();
}
LONG CPluginsPage::OnApply()
{
/*
int selectedIndex = m_Lang.GetCurSel();
int aPathIndex = m_Lang.GetItemData(selectedIndex);
SaveRegLang(m_Paths[aPathIndex]);
ReloadLang();
*/
return PSNRET_NOERROR;
}
void CPluginsPage::OnNotifyHelp()
{
ShowHelpWindow(NULL, kPluginsTopic);
}
bool CPluginsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
{
case IDB_PLUGINS_OPTIONS:
OnButtonOptions();
break;
default:
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
}
return true;
}
class CPluginOptionsCallback:
public IPluginOptionsCallback,
public CMyUnknownImp
{
UString _pluginName;
public:
MY_UNKNOWN_IMP
STDMETHOD(GetProgramFolderPath)(BSTR *value);
STDMETHOD(GetProgramPath)(BSTR *Value);
STDMETHOD(GetRegistryCUPath)(BSTR *Value);
void Init(const UString &pluginName)
{ _pluginName = pluginName; }
};
STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
{
*value = 0;
UString folder;
if (!::GetProgramFolderPath(folder))
return E_FAIL;
return StringToBstr(folder, value);
}
static UString GetDefaultProgramName()
{
return L"7zFM.exe";
}
STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
{
*value = 0;
UString folder;
if (!::GetProgramFolderPath(folder))
return E_FAIL;
return StringToBstr(folder + GetDefaultProgramName(), value);
}
STDMETHODIMP CPluginOptionsCallback::GetRegistryCUPath(BSTR *value)
{
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()
{
int index = _listView.GetSelectionMark();
if (index < 0)
return;
CPluginInfo pluginInfo = _plugins[index];
if (!pluginInfo.OptionsClassIDDefined)
{
MessageBoxW(*this, L"There are no options", L"7-Zip", 0);
return;
}
NWindows::NDLL::CLibrary lib;
CMyComPtr<IPluginOptions> pluginOptions;
if (!lib.Load(pluginInfo.FilePath))
{
MessageBoxW(*this, L"Can't load plugin", L"7-Zip", 0);
return;
}
typedef UINT32 (WINAPI * CreateObjectPointer)(const GUID *clsID, const GUID *interfaceID, void **outObject);
CreateObjectPointer createObject = (CreateObjectPointer)lib.GetProc("CreateObject");
if (createObject == NULL)
{
MessageBoxW(*this, L"Incorrect plugin", L"7-Zip", 0);
return;
}
if (createObject(&pluginInfo.OptionsClassID, &IID_IPluginOptions, (void **)&pluginOptions) != S_OK)
{
MessageBoxW(*this, L"There are no options", L"7-Zip", 0);
return;
}
CPluginOptionsCallback *callbackSpec = new CPluginOptionsCallback;
CMyComPtr<IPluginOptionsCallback> callback(callbackSpec);
callbackSpec->Init(pluginInfo.Name);
pluginOptions->PluginOptions(*this, callback);
}
bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
{
if (lParam->hwndFrom == HWND(_listView) && lParam->code == LVN_ITEMCHANGED)
{
const NMLISTVIEW *aNMListView = (const NMLISTVIEW *)lParam;
if ((aNMListView->uChanged & LVIF_STATE) != 0)
{
UINT oldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
UINT newState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
if (oldState != newState)
Changed();
}
return true;
}
return CPropertyPage::OnNotify(controlID, lParam);
}
/*
bool CPluginsPage::OnCommand(int code, int itemID, LPARAM lParam)
{
if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
{
Changed();
return true;
}
return CPropertyPage::OnCommand(code, itemID, lParam);
}
*/

View File

@@ -1,26 +0,0 @@
// PluginsPage.h
#include "Windows/Control/ListView.h"
#ifndef __PLUGINSPAGE_H
#define __PLUGINSPAGE_H
#include "Windows/Control/PropertyPage.h"
#include "Windows/Control/ComboBox.h"
#include "RegistryPlugins.h"
class CPluginsPage: public NWindows::NControl::CPropertyPage
{
NWindows::NControl::CListView _listView;
CObjectVector<CPluginInfo> _plugins;
public:
virtual bool OnInit();
virtual void OnNotifyHelp();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnButtonOptions();
virtual LONG OnApply();
virtual bool OnNotify(UINT controlID, LPNMHDR lParam);
};
#endif

View File

@@ -1,15 +0,0 @@
#include "PluginsPageRes.h"
#include "../../GuiCommon.rc"
#define xc 96
#define yc 80
IDD_PLUGINS MY_PAGE
CAPTION "Plugins"
BEGIN
LTEXT "&Plugins:", IDC_PLUGINS_STATIC_PLUGINS, m, m, xc, 8
CONTROL "List1", IDC_PLUGINS_LIST, "SysListView32",
LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
m, 20, xc, 40
PUSHBUTTON "Options...", IDC_PLUGINS_BUTTON_OPTIONS, m, by, bxs, bys
END

View File

@@ -1,4 +0,0 @@
#define IDD_PLUGINS 999
#define IDT_PLUGINS_PLUGINS 999
#define IDL_PLUGINS 999
#define IDB_PLUGINS_OPTIONS 999

View File

@@ -54,7 +54,7 @@ bool CProgressDialog::OnInit()
_dialogCreatedEvent.Set();
#ifdef LANG
LangSetDlgItemsText(*this, NULL, 0);
LangSetDlgItems(*this, NULL, 0);
#endif
m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));

View File

@@ -238,16 +238,20 @@ CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true), MainWindow
throw 1334987;
if (_createDialogEvent.Create() != S_OK)
throw 1334987;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&_taskbarList);
if (_taskbarList)
_taskbarList->HrInit();
#endif
}
#ifndef _SFX
CProgressDialog::~CProgressDialog()
{
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
SetTaskbarProgressState(TBPF_NOPROGRESS);
#endif
AddToTitle(L"");
}
void CProgressDialog::AddToTitle(LPCWSTR s)
@@ -264,6 +268,7 @@ void CProgressDialog::AddToTitle(LPCWSTR s)
void CProgressDialog::SetTaskbarProgressState()
{
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
if (_taskbarList && _hwndForTaskbar)
{
TBPFLAG tbpFlags;
@@ -273,6 +278,7 @@ void CProgressDialog::SetTaskbarProgressState()
tbpFlags = _errorsWereDisplayed ? TBPF_ERROR: TBPF_NORMAL;
SetTaskbarProgressState(tbpFlags);
}
#endif
}
static const unsigned kTitleFileNameSizeLimit = 36;
@@ -543,8 +549,10 @@ void CProgressDialog::SetProgressPos(UInt64 pos)
pos - _progressBar_Pos >= (_progressBar_Range >> 10))
{
m_ProgressBar.SetPos(_progressConv.Count(pos));
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
if (_taskbarList && _hwndForTaskbar)
_taskbarList->SetProgressValue(_hwndForTaskbar, pos, _progressBar_Range);
#endif
_progressBar_Pos = pos;
}
}
@@ -935,7 +943,9 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread,
bool CProgressDialog::OnExternalCloseMessage()
{
// it doesn't work if there is MessageBox.
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
SetTaskbarProgressState(TBPF_NOPROGRESS);
#endif
// AddToTitle(L"Finished ");
// SetText(L"Finished2 ");

View File

@@ -152,7 +152,9 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
int _numMessages;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
CMyComPtr<ITaskbarList3> _taskbarList;
#endif
HWND _hwndForTaskbar;
UInt32 _prevTime;
@@ -190,11 +192,13 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
bool _externalCloseMessageWasReceived;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
void SetTaskbarProgressState(TBPFLAG tbpFlags)
{
if (_taskbarList && _hwndForTaskbar)
_taskbarList->SetProgressState(_hwndForTaskbar, tbpFlags);
}
#endif
void SetTaskbarProgressState();
void UpdateStatInfo(bool showAll);

View File

@@ -165,7 +165,7 @@ bool CSystemPage::OnInit()
#if NUM_EXT_GROUPS > 1
{
ci.iSubItem = 2;
ci.pszText = TEXT("All Users");
ci.pszText = (LPTSTR)TEXT("All Users");
_listView.InsertColumn(2, &ci);
}
#endif