mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 16:07:06 -06:00
4.44 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
804edc5756
commit
d9666cf046
1
CPP/7zip/UI/Explorer/7-zip.dll.manifest
Executable file
1
CPP/7zip/UI/Explorer/7-zip.dll.manifest
Executable file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7-zip" type="win32"/><description>7-Zip Extension.</description><dependency> <dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly>
|
||||
682
CPP/7zip/UI/Explorer/ContextMenu.cpp
Executable file
682
CPP/7zip/UI/Explorer/ContextMenu.cpp
Executable file
@@ -0,0 +1,682 @@
|
||||
// ContextMenu.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ContextMenu.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/MyCom.h"
|
||||
|
||||
#include "Windows/Shell.h"
|
||||
#include "Windows/Memory.h"
|
||||
#include "Windows/COM.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/Thread.h"
|
||||
#include "Windows/Window.h"
|
||||
|
||||
#include "Windows/Menu.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#include "../../FileManager/FormatUtils.h"
|
||||
#include "../../FileManager/ProgramLocation.h"
|
||||
|
||||
#include "../Common/ZipRegistry.h"
|
||||
#include "../Common/ArchiveName.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "../../FileManager/LangUtils.h"
|
||||
#endif
|
||||
|
||||
#include "resource.h"
|
||||
#include "ContextMenuFlags.h"
|
||||
|
||||
// #include "ExtractEngine.h"
|
||||
// #include "TestEngine.h"
|
||||
// #include "CompressEngine.h"
|
||||
#include "MyMessages.h"
|
||||
|
||||
#include "../Resource/Extract/resource.h"
|
||||
#include "../Common/CompressCall.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static LPCTSTR kFileClassIDString = TEXT("SevenZip");
|
||||
|
||||
///////////////////////////////
|
||||
// IShellExtInit
|
||||
|
||||
extern LONG g_DllRefCount;
|
||||
|
||||
CZipContextMenu::CZipContextMenu() { InterlockedIncrement(&g_DllRefCount); }
|
||||
CZipContextMenu::~CZipContextMenu() { InterlockedDecrement(&g_DllRefCount); }
|
||||
|
||||
HRESULT CZipContextMenu::GetFileNames(LPDATAOBJECT dataObject, UStringVector &fileNames)
|
||||
{
|
||||
fileNames.Clear();
|
||||
if(dataObject == NULL)
|
||||
return E_FAIL;
|
||||
FORMATETC fmte = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
|
||||
NCOM::CStgMedium stgMedium;
|
||||
HRESULT result = dataObject->GetData(&fmte, &stgMedium);
|
||||
if (result != S_OK)
|
||||
return result;
|
||||
stgMedium._mustBeReleased = true;
|
||||
|
||||
NShell::CDrop drop(false);
|
||||
NMemory::CGlobalLock globalLock(stgMedium->hGlobal);
|
||||
drop.Attach((HDROP)globalLock.GetPointer());
|
||||
drop.QueryFileNames(fileNames);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CZipContextMenu::Initialize(LPCITEMIDLIST pidlFolder,
|
||||
LPDATAOBJECT dataObject, HKEY /* hkeyProgID */)
|
||||
{
|
||||
// OutputDebugString(TEXT("::Initialize\r\n"));
|
||||
_dropMode = false;
|
||||
_dropPath.Empty();
|
||||
if (pidlFolder != 0)
|
||||
{
|
||||
if (NShell::GetPathFromIDList(pidlFolder, _dropPath))
|
||||
{
|
||||
// OutputDebugString(path);
|
||||
// OutputDebugString(TEXT("\r\n"));
|
||||
NFile::NName::NormalizeDirPathPrefix(_dropPath);
|
||||
_dropMode = !_dropPath.IsEmpty();
|
||||
}
|
||||
else
|
||||
_dropPath.Empty();
|
||||
}
|
||||
|
||||
/*
|
||||
m_IsFolder = false;
|
||||
if (pidlFolder == 0)
|
||||
*/
|
||||
// pidlFolder is NULL :(
|
||||
return GetFileNames(dataObject, _fileNames);
|
||||
}
|
||||
|
||||
STDMETHODIMP CZipContextMenu::InitContextMenu(const wchar_t * /* folder */,
|
||||
const wchar_t **names, UINT32 numFiles)
|
||||
{
|
||||
_fileNames.Clear();
|
||||
for (UINT32 i = 0; i < numFiles; i++)
|
||||
_fileNames.Add(names[i]);
|
||||
_dropMode = false;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// IContextMenu
|
||||
|
||||
static LPCWSTR kMainVerb = L"SevenZip";
|
||||
|
||||
/*
|
||||
static LPCTSTR kOpenVerb = TEXT("SevenOpen");
|
||||
static LPCTSTR kExtractVerb = TEXT("SevenExtract");
|
||||
static LPCTSTR kExtractHereVerb = TEXT("SevenExtractHere");
|
||||
static LPCTSTR kExtractToVerb = TEXT("SevenExtractTo");
|
||||
static LPCTSTR kTestVerb = TEXT("SevenTest");
|
||||
static LPCTSTR kCompressVerb = TEXT("SevenCompress");
|
||||
static LPCTSTR kCompressToVerb = TEXT("SevenCompressTo");
|
||||
static LPCTSTR kCompressEmailVerb = TEXT("SevenCompressEmail");
|
||||
static LPCTSTR kCompressToEmailVerb = TEXT("SevenCompressToEmail");
|
||||
*/
|
||||
|
||||
struct CContextMenuCommand
|
||||
{
|
||||
UINT32 flag;
|
||||
CZipContextMenu::ECommandInternalID CommandInternalID;
|
||||
LPCWSTR Verb;
|
||||
UINT ResourceID;
|
||||
UINT ResourceHelpID;
|
||||
UINT32 LangID;
|
||||
};
|
||||
|
||||
static CContextMenuCommand g_Commands[] =
|
||||
{
|
||||
{
|
||||
NContextMenuFlags::kOpen,
|
||||
CZipContextMenu::kOpen,
|
||||
L"Open",
|
||||
IDS_CONTEXT_OPEN,
|
||||
IDS_CONTEXT_OPEN_HELP,
|
||||
0x02000103
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kExtract,
|
||||
CZipContextMenu::kExtract,
|
||||
L"Extract",
|
||||
IDS_CONTEXT_EXTRACT,
|
||||
IDS_CONTEXT_EXTRACT_HELP,
|
||||
0x02000105
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kExtractHere,
|
||||
CZipContextMenu::kExtractHere,
|
||||
L"ExtractHere",
|
||||
IDS_CONTEXT_EXTRACT_HERE,
|
||||
IDS_CONTEXT_EXTRACT_HERE_HELP,
|
||||
0x0200010B
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kExtractTo,
|
||||
CZipContextMenu::kExtractTo,
|
||||
L"ExtractTo",
|
||||
IDS_CONTEXT_EXTRACT_TO,
|
||||
IDS_CONTEXT_EXTRACT_TO_HELP,
|
||||
0x0200010D
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kTest,
|
||||
CZipContextMenu::kTest,
|
||||
L"Test",
|
||||
IDS_CONTEXT_TEST,
|
||||
IDS_CONTEXT_TEST_HELP,
|
||||
0x02000109
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kCompress,
|
||||
CZipContextMenu::kCompress,
|
||||
L"Compress",
|
||||
IDS_CONTEXT_COMPRESS,
|
||||
IDS_CONTEXT_COMPRESS_HELP,
|
||||
0x02000107,
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kCompressEmail,
|
||||
CZipContextMenu::kCompressEmail,
|
||||
L"CompressEmail",
|
||||
IDS_CONTEXT_COMPRESS_EMAIL,
|
||||
IDS_CONTEXT_COMPRESS_EMAIL_HELP,
|
||||
0x02000111
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kCompressTo7z,
|
||||
CZipContextMenu::kCompressTo7z,
|
||||
L"CompressTo7z",
|
||||
IDS_CONTEXT_COMPRESS_TO,
|
||||
IDS_CONTEXT_COMPRESS_TO_HELP,
|
||||
0x0200010F
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kCompressTo7zEmail,
|
||||
CZipContextMenu::kCompressTo7zEmail,
|
||||
L"CompressTo7zEmail",
|
||||
IDS_CONTEXT_COMPRESS_TO_EMAIL,
|
||||
IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP,
|
||||
0x02000113
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kCompressToZip,
|
||||
CZipContextMenu::kCompressToZip,
|
||||
L"CompressToZip",
|
||||
IDS_CONTEXT_COMPRESS_TO,
|
||||
IDS_CONTEXT_COMPRESS_TO_HELP,
|
||||
0x0200010F
|
||||
},
|
||||
{
|
||||
NContextMenuFlags::kCompressToZipEmail,
|
||||
CZipContextMenu::kCompressToZipEmail,
|
||||
L"CompressToZipEmail",
|
||||
IDS_CONTEXT_COMPRESS_TO_EMAIL,
|
||||
IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP,
|
||||
0x02000113
|
||||
}
|
||||
};
|
||||
|
||||
int FindCommand(CZipContextMenu::ECommandInternalID &id)
|
||||
{
|
||||
for (int i = 0; i < sizeof(g_Commands) / sizeof(g_Commands[0]); i++)
|
||||
if (g_Commands[i].CommandInternalID == id)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CZipContextMenu::FillCommand(ECommandInternalID id,
|
||||
UString &mainString, CCommandMapItem &commandMapItem)
|
||||
{
|
||||
int i = FindCommand(id);
|
||||
if (i < 0)
|
||||
return;
|
||||
const CContextMenuCommand &command = g_Commands[i];
|
||||
commandMapItem.CommandInternalID = command.CommandInternalID;
|
||||
commandMapItem.Verb = (UString)kMainVerb + (UString)command.Verb;
|
||||
commandMapItem.HelpString = LangString(command.ResourceHelpID, command.LangID + 1);
|
||||
mainString = LangString(command.ResourceID, command.LangID);
|
||||
}
|
||||
|
||||
static bool MyInsertMenu(CMenu &menu, int pos, UINT id, const UString &s)
|
||||
{
|
||||
CMenuItem menuItem;
|
||||
menuItem.fType = MFT_STRING;
|
||||
menuItem.fMask = MIIM_TYPE | MIIM_ID;
|
||||
menuItem.wID = id;
|
||||
menuItem.StringValue = s;
|
||||
return menu.InsertItem(pos, true, menuItem);
|
||||
}
|
||||
|
||||
static UString GetSubFolderNameForExtract(const UString &archiveName)
|
||||
{
|
||||
int dotPos = archiveName.ReverseFind(L'.');
|
||||
if (dotPos < 0)
|
||||
return archiveName + UString(L"~");
|
||||
UString res = archiveName.Left(dotPos);
|
||||
res.TrimRight();
|
||||
return res;
|
||||
}
|
||||
|
||||
static UString GetReducedString(const UString &s)
|
||||
{
|
||||
const int kMaxSize = 64;
|
||||
if (s.Length() < kMaxSize)
|
||||
return s;
|
||||
const int kFirstPartSize = kMaxSize / 2;
|
||||
return s.Left(kFirstPartSize) + UString(L" ... ") + s.Right(kMaxSize - kFirstPartSize);
|
||||
}
|
||||
|
||||
STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
UINT commandIDFirst, UINT commandIDLast, UINT flags)
|
||||
{
|
||||
LoadLangOneTime();
|
||||
if(_fileNames.Size() == 0)
|
||||
return E_FAIL;
|
||||
UINT currentCommandID = commandIDFirst;
|
||||
if ((flags & 0x000F) != CMF_NORMAL &&
|
||||
(flags & CMF_VERBSONLY) == 0 &&
|
||||
(flags & CMF_EXPLORE) == 0)
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID);
|
||||
|
||||
_commandMap.Clear();
|
||||
|
||||
CMenu popupMenu;
|
||||
CMenuDestroyer menuDestroyer;
|
||||
|
||||
bool cascadedMenu = ReadCascadedMenu();
|
||||
MENUITEMINFO menuItem;
|
||||
UINT subIndex = indexMenu;
|
||||
if (cascadedMenu)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
if(!popupMenu.CreatePopup())
|
||||
throw 210503;
|
||||
menuDestroyer.Attach(popupMenu);
|
||||
commandMapItem.CommandInternalID = kCommandNULL;
|
||||
commandMapItem.Verb = kMainVerb;
|
||||
commandMapItem.HelpString = LangString(IDS_CONTEXT_CAPTION_HELP, 0x02000102);
|
||||
_commandMap.Add(commandMapItem);
|
||||
|
||||
menuItem.wID = currentCommandID++;
|
||||
subIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
popupMenu.Attach(hMenu);
|
||||
}
|
||||
|
||||
UINT32 contextMenuFlags;
|
||||
if (!ReadContextMenuStatus(contextMenuFlags))
|
||||
contextMenuFlags = NContextMenuFlags::GetDefaultFlags();
|
||||
|
||||
UString mainString;
|
||||
if(_fileNames.Size() == 1 && currentCommandID + 6 <= commandIDLast)
|
||||
{
|
||||
const UString &fileName = _fileNames.Front();
|
||||
UString folderPrefix;
|
||||
NFile::NDirectory::GetOnlyDirPrefix(fileName, folderPrefix);
|
||||
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
if (!NFile::NFind::FindFile(fileName, fileInfo))
|
||||
return E_FAIL;
|
||||
if (!fileInfo.IsDirectory())
|
||||
{
|
||||
// Open
|
||||
if ((contextMenuFlags & NContextMenuFlags::kOpen) != 0)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
FillCommand(kOpen, mainString, commandMapItem);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(_fileNames.Size() > 0 && currentCommandID + 10 <= commandIDLast)
|
||||
{
|
||||
bool thereAreFolders = false;
|
||||
for(int i = 0; i < _fileNames.Size(); i++)
|
||||
{
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
if (!NFile::NFind::FindFile(_fileNames[i], fileInfo))
|
||||
return E_FAIL;
|
||||
if (fileInfo.IsDirectory())
|
||||
thereAreFolders = true;
|
||||
}
|
||||
const UString &fileName = _fileNames.Front();
|
||||
if (!thereAreFolders)
|
||||
{
|
||||
UString folderPrefix;
|
||||
NFile::NDirectory::GetOnlyDirPrefix(fileName, folderPrefix);
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
if (!NFile::NFind::FindFile(fileName, fileInfo))
|
||||
return E_FAIL;
|
||||
// Extract
|
||||
if ((contextMenuFlags & NContextMenuFlags::kExtract) != 0)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
FillCommand(kExtract, mainString, commandMapItem);
|
||||
if (_dropMode)
|
||||
commandMapItem.Folder = _dropPath;
|
||||
else
|
||||
commandMapItem.Folder = folderPrefix;
|
||||
commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(L'\\');
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
// Extract Here
|
||||
if ((contextMenuFlags & NContextMenuFlags::kExtractHere) != 0)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
FillCommand(kExtractHere, mainString, commandMapItem);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
if (_dropMode)
|
||||
commandMapItem.Folder = _dropPath;
|
||||
else
|
||||
commandMapItem.Folder = folderPrefix;
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
// Extract To
|
||||
if ((contextMenuFlags & NContextMenuFlags::kExtractTo) != 0)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
UString s;
|
||||
FillCommand(kExtractTo, s, commandMapItem);
|
||||
UString folder;
|
||||
if (_fileNames.Size() == 1)
|
||||
folder = GetSubFolderNameForExtract(fileInfo.Name);
|
||||
else
|
||||
folder = L'*';
|
||||
if (_dropMode)
|
||||
commandMapItem.Folder = _dropPath;
|
||||
else
|
||||
commandMapItem.Folder = folderPrefix;
|
||||
commandMapItem.Folder += folder;
|
||||
s = MyFormatNew(s, GetReducedString(UString(L"\"") + folder + UString(L"\\\"")));
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
// Test
|
||||
if ((contextMenuFlags & NContextMenuFlags::kTest) != 0)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
FillCommand(kTest, mainString, commandMapItem);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
}
|
||||
UString archiveName = CreateArchiveName(fileName, _fileNames.Size() > 1, false);
|
||||
UString archiveName7z = archiveName + L".7z";
|
||||
UString archiveNameZip = archiveName + L".zip";
|
||||
UString archivePathPrefix;
|
||||
NFile::NDirectory::GetOnlyDirPrefix(fileName, archivePathPrefix);
|
||||
|
||||
// Compress
|
||||
if ((contextMenuFlags & NContextMenuFlags::kCompress) != 0)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
if (_dropMode)
|
||||
commandMapItem.Folder = _dropPath;
|
||||
else
|
||||
commandMapItem.Folder = archivePathPrefix;
|
||||
commandMapItem.Archive = archiveName;
|
||||
FillCommand(kCompress, mainString, commandMapItem);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
|
||||
// CompressEmail
|
||||
if ((contextMenuFlags & NContextMenuFlags::kCompressEmail) != 0 && !_dropMode)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
commandMapItem.Archive = archiveName;
|
||||
FillCommand(kCompressEmail, mainString, commandMapItem);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
// CompressTo7z
|
||||
if (contextMenuFlags & NContextMenuFlags::kCompressTo7z)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
UString s;
|
||||
FillCommand(kCompressTo7z, s, commandMapItem);
|
||||
if (_dropMode)
|
||||
commandMapItem.Folder = _dropPath;
|
||||
else
|
||||
commandMapItem.Folder = archivePathPrefix;
|
||||
commandMapItem.Archive = archiveName7z;
|
||||
commandMapItem.ArchiveType = L"7z";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
// CompressTo7zEmail
|
||||
if ((contextMenuFlags & NContextMenuFlags::kCompressTo7zEmail) != 0 && !_dropMode)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
UString s;
|
||||
FillCommand(kCompressTo7zEmail, s, commandMapItem);
|
||||
commandMapItem.Archive = archiveName7z;
|
||||
commandMapItem.ArchiveType = L"7z";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
// CompressToZip
|
||||
if (contextMenuFlags & NContextMenuFlags::kCompressToZip)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
UString s;
|
||||
FillCommand(kCompressToZip, s, commandMapItem);
|
||||
if (_dropMode)
|
||||
commandMapItem.Folder = _dropPath;
|
||||
else
|
||||
commandMapItem.Folder = archivePathPrefix;
|
||||
commandMapItem.Archive = archiveNameZip;
|
||||
commandMapItem.ArchiveType = L"zip";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
|
||||
// CompressToZipEmail
|
||||
if ((contextMenuFlags & NContextMenuFlags::kCompressToZipEmail) != 0 && !_dropMode)
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
UString s;
|
||||
FillCommand(kCompressToZipEmail, s, commandMapItem);
|
||||
commandMapItem.Archive = archiveNameZip;
|
||||
commandMapItem.ArchiveType = L"zip";
|
||||
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\"");
|
||||
s = MyFormatNew(s, t);
|
||||
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
|
||||
_commandMap.Add(commandMapItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// don't use InsertMenu: See MSDN:
|
||||
// PRB: Duplicate Menu Items In the File Menu For a Shell Context Menu Extension
|
||||
// ID: Q214477
|
||||
|
||||
if (cascadedMenu)
|
||||
{
|
||||
CMenuItem menuItem;
|
||||
menuItem.fType = MFT_STRING;
|
||||
menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
|
||||
menuItem.wID = currentCommandID++;
|
||||
menuItem.hSubMenu = popupMenu.Detach();
|
||||
menuDestroyer.Disable();
|
||||
menuItem.StringValue = LangString(IDS_CONTEXT_POPUP_CAPTION, 0x02000101);
|
||||
CMenu menu;
|
||||
menu.Attach(hMenu);
|
||||
menu.InsertItem(indexMenu++, true, menuItem);
|
||||
}
|
||||
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID - commandIDFirst);
|
||||
}
|
||||
|
||||
|
||||
int CZipContextMenu::FindVerb(const UString &verb)
|
||||
{
|
||||
for(int i = 0; i < _commandMap.Size(); i++)
|
||||
if(_commandMap[i].Verb.Compare(verb) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern const char *kShellFolderClassIDString;
|
||||
|
||||
|
||||
static UString GetProgramCommand()
|
||||
{
|
||||
UString path = L"\"";
|
||||
UString folder;
|
||||
if (GetProgramFolderPath(folder))
|
||||
path += folder;
|
||||
path += L"7zFM.exe\"";
|
||||
return path;
|
||||
}
|
||||
|
||||
STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
|
||||
{
|
||||
// ::OutputDebugStringA("1");
|
||||
int commandOffset;
|
||||
|
||||
// It's fix for bug: crashing in XP. See example in MSDN: "Creating Context Menu Handlers".
|
||||
|
||||
if (commandInfo->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
|
||||
(commandInfo->fMask & CMIC_MASK_UNICODE) != 0)
|
||||
{
|
||||
LPCMINVOKECOMMANDINFOEX commandInfoEx = (LPCMINVOKECOMMANDINFOEX)commandInfo;
|
||||
if(HIWORD(commandInfoEx->lpVerbW) == 0)
|
||||
commandOffset = LOWORD(commandInfo->lpVerb);
|
||||
else
|
||||
commandOffset = FindVerb(commandInfoEx->lpVerbW);
|
||||
}
|
||||
else
|
||||
if(HIWORD(commandInfo->lpVerb) == 0)
|
||||
commandOffset = LOWORD(commandInfo->lpVerb);
|
||||
else
|
||||
commandOffset = FindVerb(GetUnicodeString(commandInfo->lpVerb));
|
||||
|
||||
if(commandOffset < 0 || commandOffset >= _commandMap.Size())
|
||||
return E_FAIL;
|
||||
|
||||
const CCommandMapItem commandMapItem = _commandMap[commandOffset];
|
||||
ECommandInternalID commandInternalID = commandMapItem.CommandInternalID;
|
||||
|
||||
try
|
||||
{
|
||||
switch(commandInternalID)
|
||||
{
|
||||
case kOpen:
|
||||
{
|
||||
UString params;
|
||||
params = GetProgramCommand();
|
||||
params += L" \"";
|
||||
params += _fileNames[0];
|
||||
params += L"\"";
|
||||
MyCreateProcess(params, 0, false, 0);
|
||||
break;
|
||||
}
|
||||
case kExtract:
|
||||
case kExtractHere:
|
||||
case kExtractTo:
|
||||
{
|
||||
ExtractArchives(_fileNames, commandMapItem.Folder,
|
||||
(commandInternalID == kExtract));
|
||||
break;
|
||||
}
|
||||
case kTest:
|
||||
{
|
||||
TestArchives(_fileNames);
|
||||
break;
|
||||
}
|
||||
case kCompress:
|
||||
case kCompressEmail:
|
||||
case kCompressTo7z:
|
||||
case kCompressTo7zEmail:
|
||||
case kCompressToZip:
|
||||
case kCompressToZipEmail:
|
||||
{
|
||||
bool email =
|
||||
(commandInternalID == kCompressEmail) ||
|
||||
(commandInternalID == kCompressTo7zEmail) ||
|
||||
(commandInternalID == kCompressToZipEmail);
|
||||
bool showDialog =
|
||||
(commandInternalID == kCompress) ||
|
||||
(commandInternalID == kCompressEmail);
|
||||
CompressFiles(commandMapItem.Folder,
|
||||
commandMapItem.Archive, commandMapItem.ArchiveType,
|
||||
_fileNames, email, showDialog, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
MyMessageBox(IDS_ERROR, 0x02000605);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void MyCopyString(void *dest, const wchar_t *src, bool writeInUnicode)
|
||||
{
|
||||
if(writeInUnicode)
|
||||
{
|
||||
MyStringCopy((wchar_t *)dest, src);
|
||||
}
|
||||
else
|
||||
lstrcpyA((char *)dest, GetAnsiString(src));
|
||||
}
|
||||
|
||||
STDMETHODIMP CZipContextMenu::GetCommandString(UINT_PTR commandOffset, UINT uType,
|
||||
UINT * /* pwReserved */ , LPSTR pszName, UINT /* cchMax */)
|
||||
{
|
||||
int cmdOffset = (int)commandOffset;
|
||||
switch(uType)
|
||||
{
|
||||
case GCS_VALIDATEA:
|
||||
case GCS_VALIDATEW:
|
||||
if(cmdOffset < 0 || cmdOffset >= _commandMap.Size())
|
||||
return S_FALSE;
|
||||
else
|
||||
return S_OK;
|
||||
}
|
||||
if(cmdOffset < 0 || cmdOffset >= _commandMap.Size())
|
||||
return E_FAIL;
|
||||
if(uType == GCS_HELPTEXTA || uType == GCS_HELPTEXTW)
|
||||
{
|
||||
MyCopyString(pszName, _commandMap[cmdOffset].HelpString, uType == GCS_HELPTEXTW);
|
||||
return NO_ERROR;
|
||||
}
|
||||
if(uType == GCS_VERBA || uType == GCS_VERBW)
|
||||
{
|
||||
MyCopyString(pszName, _commandMap[cmdOffset].Verb, uType == GCS_VERBW);
|
||||
return NO_ERROR;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
86
CPP/7zip/UI/Explorer/ContextMenu.h
Executable file
86
CPP/7zip/UI/Explorer/ContextMenu.h
Executable file
@@ -0,0 +1,86 @@
|
||||
// ContextMenu.h
|
||||
|
||||
#ifndef __CONTEXTMENU_H
|
||||
#define __CONTEXTMENU_H
|
||||
|
||||
// {23170F69-40C1-278A-1000-000100020000}
|
||||
DEFINE_GUID(CLSID_CZipContextMenu,
|
||||
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
#include "../../FileManager/PluginInterface.h"
|
||||
#include "../../FileManager/MyCom2.h"
|
||||
|
||||
|
||||
class CZipContextMenu:
|
||||
public IContextMenu,
|
||||
public IShellExtInit,
|
||||
public IInitContextMenu,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
enum ECommandInternalID
|
||||
{
|
||||
kCommandNULL,
|
||||
kOpen,
|
||||
kExtract,
|
||||
kExtractHere,
|
||||
kExtractTo,
|
||||
kTest,
|
||||
kCompress,
|
||||
kCompressEmail,
|
||||
kCompressTo7z,
|
||||
kCompressTo7zEmail,
|
||||
kCompressToZip,
|
||||
kCompressToZipEmail
|
||||
};
|
||||
|
||||
struct CCommandMapItem
|
||||
{
|
||||
ECommandInternalID CommandInternalID;
|
||||
UString Verb;
|
||||
UString HelpString;
|
||||
UString Folder;
|
||||
UString Archive;
|
||||
UString ArchiveType;
|
||||
};
|
||||
|
||||
MY_UNKNOWN_IMP3_MT(IContextMenu, IShellExtInit, IInitContextMenu)
|
||||
|
||||
///////////////////////////////
|
||||
// IShellExtInit
|
||||
|
||||
STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,
|
||||
LPDATAOBJECT dataObject, HKEY hkeyProgID);
|
||||
|
||||
/////////////////////////////
|
||||
// IContextMenu
|
||||
|
||||
STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu,
|
||||
UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
|
||||
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
|
||||
STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved,
|
||||
LPSTR pszName, UINT cchMax);
|
||||
|
||||
|
||||
// IInitContextMenu
|
||||
STDMETHOD(InitContextMenu)(const wchar_t *folder, const wchar_t **names, UINT32 numFiles);
|
||||
private:
|
||||
UStringVector _fileNames;
|
||||
bool _dropMode;
|
||||
UString _dropPath;
|
||||
CObjectVector<CCommandMapItem> _commandMap;
|
||||
HRESULT GetFileNames(LPDATAOBJECT dataObject, UStringVector &fileNames);
|
||||
int FindVerb(const UString &verb);
|
||||
|
||||
void FillCommand(ECommandInternalID id, UString &mainString,
|
||||
CCommandMapItem &commandMapItem);
|
||||
public:
|
||||
CZipContextMenu();
|
||||
~CZipContextMenu();
|
||||
};
|
||||
|
||||
#endif
|
||||
34
CPP/7zip/UI/Explorer/ContextMenuFlags.h
Executable file
34
CPP/7zip/UI/Explorer/ContextMenuFlags.h
Executable file
@@ -0,0 +1,34 @@
|
||||
// ContextMenuFlags.h
|
||||
|
||||
#ifndef __SEVENZIP_CONTEXTMENUFLAGS_H
|
||||
#define __SEVENZIP_CONTEXTMENUFLAGS_H
|
||||
|
||||
namespace NContextMenuFlags
|
||||
{
|
||||
const UINT32 kExtract = 1 << 0;
|
||||
const UINT32 kExtractHere = 1 << 1;
|
||||
const UINT32 kExtractTo = 1 << 2;
|
||||
// const UINT32 kExtractEach = 1 << 3;
|
||||
|
||||
const UINT32 kTest = 1 << 4;
|
||||
|
||||
const UINT32 kOpen = 1 << 5;
|
||||
|
||||
const UINT32 kCompress = 1 << 8;
|
||||
const UINT32 kCompressTo7z = 1 << 9;
|
||||
const UINT32 kCompressEmail = 1 << 10;
|
||||
const UINT32 kCompressTo7zEmail = 1 << 11;
|
||||
|
||||
const UINT32 kCompressToZip = 1 << 12;
|
||||
const UINT32 kCompressToZipEmail = 1 << 13;
|
||||
|
||||
inline UINT32 GetDefaultFlags() {
|
||||
return
|
||||
kOpen | kTest |
|
||||
kExtract | kExtractHere | kExtractTo |
|
||||
kCompress | kCompressEmail |
|
||||
kCompressTo7z | kCompressTo7zEmail |
|
||||
kCompressToZip | kCompressToZipEmail; }
|
||||
}
|
||||
|
||||
#endif
|
||||
315
CPP/7zip/UI/Explorer/DllExports.cpp
Executable file
315
CPP/7zip/UI/Explorer/DllExports.cpp
Executable file
@@ -0,0 +1,315 @@
|
||||
// DLLExports.cpp
|
||||
//
|
||||
// Notes:
|
||||
// Win2000:
|
||||
// If I register at HKCR\Folder\ShellEx then DLL is locked.
|
||||
// otherwise it unloads after explorer closing.
|
||||
// but if I call menu for desktop items it's locked all the time
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
// #include <locale.h>
|
||||
|
||||
#include <initguid.h>
|
||||
#include <windows.h>
|
||||
#include <ShlGuid.h>
|
||||
#include <OleCtl.h>
|
||||
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/DLL.h"
|
||||
#include "Windows/Registry.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
#include "../../FileManager/LangUtils.h"
|
||||
#include "../Agent/Agent.h"
|
||||
|
||||
#include "ContextMenu.h"
|
||||
#include "OptionsDialog.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
bool g_IsNT = false;
|
||||
#endif
|
||||
|
||||
LONG g_DllRefCount = 0; // Reference count of this DLL.
|
||||
|
||||
static LPCWSTR kShellExtName = L"7-Zip Shell Extension";
|
||||
static LPCTSTR kClsidMask = TEXT("CLSID\\%s");
|
||||
static LPCTSTR kClsidInprocMask = TEXT("CLSID\\%s\\InprocServer32");
|
||||
static LPCTSTR kApprovedKeyPath = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved");
|
||||
|
||||
// #define ODS(sz) OutputDebugString(L#sz)
|
||||
|
||||
class CShellExtClassFactory:
|
||||
public IClassFactory,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
public:
|
||||
CShellExtClassFactory() { InterlockedIncrement(&g_DllRefCount); }
|
||||
~CShellExtClassFactory() { InterlockedDecrement(&g_DllRefCount); }
|
||||
|
||||
|
||||
MY_UNKNOWN_IMP1_MT(IClassFactory)
|
||||
|
||||
STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, void**);
|
||||
STDMETHODIMP LockServer(BOOL);
|
||||
};
|
||||
|
||||
STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter,
|
||||
REFIID riid, void **ppvObj)
|
||||
{
|
||||
// ODS("CShellExtClassFactory::CreateInstance()\r\n");
|
||||
*ppvObj = NULL;
|
||||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
CZipContextMenu *shellExt;
|
||||
try
|
||||
{
|
||||
shellExt = new CZipContextMenu();
|
||||
}
|
||||
catch(...) { return E_OUTOFMEMORY; }
|
||||
if (shellExt == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HRESULT res = shellExt->QueryInterface(riid, ppvObj);
|
||||
if (res != S_OK)
|
||||
delete shellExt;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CShellExtClassFactory::LockServer(BOOL /* fLock */)
|
||||
{
|
||||
return S_OK; // Check it
|
||||
}
|
||||
|
||||
static bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
|
||||
{
|
||||
// setlocale(LC_COLLATE, ".ACP");
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
// ODS("In DLLMain, DLL_PROCESS_ATTACH\r\n");
|
||||
#ifdef _UNICODE
|
||||
if (!IsItWindowsNT())
|
||||
return FALSE;
|
||||
#else
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
// ODS("In DLLMain, DLL_PROCESS_DETACH\r\n");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Used to determine whether the DLL can be unloaded by OLE
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
// ODS("In DLLCanUnloadNow\r\n");
|
||||
return (g_DllRefCount == 0 ? S_OK : S_FALSE);
|
||||
}
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
// ODS("In DllGetClassObject\r\n");
|
||||
*ppv = NULL;
|
||||
if (IsEqualIID(rclsid, CLSID_CZipContextMenu))
|
||||
{
|
||||
CShellExtClassFactory *cf;
|
||||
try
|
||||
{
|
||||
cf = new CShellExtClassFactory;
|
||||
}
|
||||
catch(...) { return E_OUTOFMEMORY; }
|
||||
if (cf == 0)
|
||||
return E_OUTOFMEMORY;
|
||||
HRESULT res = cf->QueryInterface(riid, ppv);
|
||||
if (res != S_OK)
|
||||
delete cf;
|
||||
return res;
|
||||
}
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
// return _Module.GetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
static BOOL GetStringFromIID(CLSID clsid, LPTSTR s, int size)
|
||||
{
|
||||
LPWSTR pwsz;
|
||||
if (StringFromIID(clsid, &pwsz) != S_OK)
|
||||
return FALSE;
|
||||
if(!pwsz)
|
||||
return FALSE;
|
||||
#ifdef UNICODE
|
||||
lstrcpyn(s, pwsz, size);
|
||||
#else
|
||||
WideCharToMultiByte(CP_ACP, 0, pwsz, -1, s, size, NULL, NULL);
|
||||
#endif
|
||||
CoTaskMemFree(pwsz);
|
||||
s[size - 1] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HKEY hRootKey;
|
||||
LPCTSTR SubKey;
|
||||
LPCWSTR ValueName;
|
||||
LPCWSTR Data;
|
||||
} CRegItem;
|
||||
|
||||
static BOOL RegisterServer(CLSID clsid, LPCWSTR title)
|
||||
{
|
||||
TCHAR clsidString[MAX_PATH];
|
||||
if (!GetStringFromIID(clsid, clsidString, MAX_PATH))
|
||||
return FALSE;
|
||||
|
||||
UString modulePath;
|
||||
if (!NDLL::MyGetModuleFileName(g_hInstance, modulePath))
|
||||
return FALSE;
|
||||
|
||||
CRegItem clsidEntries[] =
|
||||
{
|
||||
HKEY_CLASSES_ROOT, kClsidMask, NULL, title,
|
||||
HKEY_CLASSES_ROOT, kClsidInprocMask, NULL, modulePath,
|
||||
HKEY_CLASSES_ROOT, kClsidInprocMask, L"ThreadingModel", L"Apartment",
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
//register the CLSID entries
|
||||
for(int i = 0; clsidEntries[i].hRootKey; i++)
|
||||
{
|
||||
TCHAR subKey[MAX_PATH];
|
||||
wsprintf(subKey, clsidEntries[i].SubKey, clsidString);
|
||||
NRegistry::CKey key;
|
||||
if (key.Create(clsidEntries[i].hRootKey, subKey, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_WRITE) != NOERROR)
|
||||
return FALSE;
|
||||
key.SetValue(clsidEntries[i].ValueName, clsidEntries[i].Data);
|
||||
}
|
||||
|
||||
if(IsItWindowsNT())
|
||||
{
|
||||
NRegistry::CKey key;
|
||||
if (key.Create(HKEY_LOCAL_MACHINE, kApprovedKeyPath, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_WRITE) == NOERROR)
|
||||
key.SetValue(GetUnicodeString(clsidString), title);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
return RegisterServer(CLSID_CZipContextMenu, kShellExtName) ? S_OK: SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
static BOOL UnregisterServer(CLSID clsid)
|
||||
{
|
||||
TCHAR clsidString[MAX_PATH];
|
||||
if (!GetStringFromIID(clsid, clsidString, MAX_PATH))
|
||||
return FALSE;
|
||||
|
||||
TCHAR subKey[MAX_PATH];
|
||||
wsprintf(subKey, kClsidInprocMask, clsidString);
|
||||
RegDeleteKey(HKEY_CLASSES_ROOT, subKey);
|
||||
|
||||
wsprintf (subKey, kClsidMask, clsidString);
|
||||
RegDeleteKey(HKEY_CLASSES_ROOT, subKey);
|
||||
|
||||
if(IsItWindowsNT())
|
||||
{
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, kApprovedKeyPath, 0, KEY_SET_VALUE, &hKey) == NOERROR)
|
||||
{
|
||||
RegDeleteValue(hKey, clsidString);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
return UnregisterServer(CLSID_CZipContextMenu) ? S_OK: SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
STDAPI CreateObject(
|
||||
const GUID *classID,
|
||||
const GUID *interfaceID,
|
||||
void **outObject)
|
||||
{
|
||||
LoadLangOneTime();
|
||||
COM_TRY_BEGIN
|
||||
*outObject = 0;
|
||||
if (*classID == CLSID_CAgentArchiveHandler)
|
||||
{
|
||||
if (*interfaceID == IID_IFolderManager)
|
||||
{
|
||||
CMyComPtr<IFolderManager> manager = new CArchiveFolderManager;
|
||||
*outObject = manager.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
if (*classID == CLSID_CSevenZipOptions)
|
||||
{
|
||||
if (*interfaceID == IID_IPluginOptions)
|
||||
{
|
||||
CMyComPtr<IPluginOptions> options = new CSevenZipOptions;
|
||||
*outObject = options.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
STDAPI GetPluginProperty(PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
::VariantClear((tagVARIANT *)value);
|
||||
switch(propID)
|
||||
{
|
||||
case NPlugin::kName:
|
||||
if ((value->bstrVal = ::SysAllocString(L"7-Zip")) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
case NPlugin::kClassID:
|
||||
{
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CAgentArchiveHandler, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
case NPlugin::kOptionsClassID:
|
||||
{
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CSevenZipOptions, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
/*
|
||||
case NArchive::kType:
|
||||
propVariant = UINT32(0);
|
||||
break;
|
||||
*/
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
12
CPP/7zip/UI/Explorer/Explorer.def
Executable file
12
CPP/7zip/UI/Explorer/Explorer.def
Executable file
@@ -0,0 +1,12 @@
|
||||
; 7-zip.def
|
||||
|
||||
LIBRARY "7-zip"
|
||||
|
||||
EXPORTS
|
||||
DllCanUnloadNow PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
|
||||
CreateObject PRIVATE
|
||||
GetPluginProperty PRIVATE
|
||||
818
CPP/7zip/UI/Explorer/Explorer.dsp
Executable file
818
CPP/7zip/UI/Explorer/Explorer.dsp
Executable file
@@ -0,0 +1,818 @@
|
||||
# Microsoft Developer Studio Project File - Name="Explorer" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=Explorer - Win32 DebugU
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Explorer.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Explorer.mak" CFG="Explorer - Win32 DebugU"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Explorer - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "Explorer - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "Explorer - Win32 ReleaseU" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "Explorer - Win32 DebugU" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Explorer - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||
# ADD RSC /l 0x419 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-ZIP\7-Zip.dll" /opt:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "Explorer - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-ZIP\7-Zip.dll" /pdbtype:sept
|
||||
|
||||
!ELSEIF "$(CFG)" == "Explorer - Win32 ReleaseU"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseU"
|
||||
# PROP BASE Intermediate_Dir "ReleaseU"
|
||||
# PROP BASE Ignore_Export_Lib 1
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ReleaseU"
|
||||
# PROP Intermediate_Dir "ReleaseU"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "_MBCS" /Yu"StdAfx.h" /FD /c
|
||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-ZIP\7-Zip.dll" /opt:NOWIN98
|
||||
# SUBTRACT BASE LINK32 /pdb:none
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-ZIP\7-Zipn.dll" /opt:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "Explorer - Win32 DebugU"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugU"
|
||||
# PROP BASE Intermediate_Dir "DebugU"
|
||||
# PROP BASE Ignore_Export_Lib 1
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugU"
|
||||
# PROP Intermediate_Dir "DebugU"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-ZIP\7-Zip.dll" /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-ZIP\7-Zip.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Explorer - Win32 Release"
|
||||
# Name "Explorer - Win32 Debug"
|
||||
# Name "Explorer - Win32 ReleaseU"
|
||||
# Name "Explorer - Win32 DebugU"
|
||||
# Begin Group "Spec"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DllExports.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Explorer.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"StdAfx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "UI Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiveExtractCallback.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiveExtractCallback.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiveName.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiveName.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiveOpenCallback.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiveOpenCallback.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiverInfo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ArchiverInfo.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CompressCall.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CompressCall.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\DefaultName.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\DefaultName.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\EnumDirItems.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\EnumDirItems.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ExtractingFilePath.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ExtractingFilePath.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\HandlerLoader.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\OpenArchive.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\OpenArchive.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\PropIDUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\PropIDUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\SortUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\SortUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateAction.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateAction.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateCallback.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateCallback.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdatePair.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdatePair.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateProduce.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateProduce.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\WorkDir.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\WorkDir.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ZipRegistry.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ZipRegistry.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Engine"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ContextMenu.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ContextMenu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MyMessages.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MyMessages.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Dialogs"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "Options"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "SystemPage"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SystemPage\SystemPage.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SystemPage\SystemPage.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "FoldersPage"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FoldersPage\FoldersPage.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FoldersPage\FoldersPage.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "Agent"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\Agent.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\Agent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\AgentOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\AgentProxy.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\AgentProxy.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveFolder.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveFolderOpen.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveFolderOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\IFileExtractCallback.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\IFolderArchive.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\UpdateCallbackAgent.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\UpdateCallbackAgent.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "FileManager"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\FormatUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\FormatUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\HelpUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\HelpUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\IFolder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\LangUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\LangUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\ProgramLocation.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\ProgramLocation.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\RegistryUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\RegistryUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "SDK"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Lang.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Lang.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyCom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Random.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Random.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StdInStream.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StdInStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringToInt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
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
|
||||
|
||||
SOURCE=..\..\..\Common\UTFConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\UTFConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Windows"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "Control"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Control\Dialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Control\Dialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Control\PropertyPage.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Control\PropertyPage.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\DLL.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\DLL.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Error.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Error.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileDir.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileDir.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileFind.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileFind.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileIO.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileIO.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileMapping.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileName.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileName.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Memory.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Memory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Menu.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Menu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariant.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariant.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariantConversions.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariantConversions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Registry.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Registry.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\ResourceString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\ResourceString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Shell.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Shell.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Window.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Window.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "7-zip common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\FilePathAutoRename.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\FilePathAutoRename.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\FileStreams.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\FileStreams.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Compress\Copy\CopyCoder.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "C"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Sort.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Sort.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\7-zip.dll.manifest"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ContextMenuFlags.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\OptionsDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\OptionsDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\RegistryContextMenu.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\RegistryContextMenu.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
CPP/7zip/UI/Explorer/Explorer.dsw
Executable file
29
CPP/7zip/UI/Explorer/Explorer.dsw
Executable file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Explorer"=".\Explorer.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
157
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.cpp
Executable file
157
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.cpp
Executable file
@@ -0,0 +1,157 @@
|
||||
// FoldersPage.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "resource.h"
|
||||
#include "FoldersPage.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/Shell.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#include "../../../FileManager/HelpUtils.h"
|
||||
#include "../../Common/ZipRegistry.h"
|
||||
|
||||
#include "../../../FileManager/LangUtils.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static CIDLangPair kIDLangPairs[] =
|
||||
{
|
||||
{ IDC_FOLDERS_STATIC_WORKING_FOLDER, 0x01000210 },
|
||||
{ IDC_FOLDERS_WORK_RADIO_SYSTEM, 0x01000211 },
|
||||
{ IDC_FOLDERS_WORK_RADIO_CURRENT, 0x01000212 },
|
||||
{ IDC_FOLDERS_WORK_RADIO_SPECIFIED, 0x01000213 },
|
||||
{ IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, 0x01000214 }
|
||||
};
|
||||
|
||||
static const int kWorkModeButtons[] =
|
||||
{
|
||||
IDC_FOLDERS_WORK_RADIO_SYSTEM,
|
||||
IDC_FOLDERS_WORK_RADIO_CURRENT,
|
||||
IDC_FOLDERS_WORK_RADIO_SPECIFIED
|
||||
};
|
||||
|
||||
static const int kNumWorkModeButtons = sizeof(kWorkModeButtons) / sizeof(kWorkModeButtons[0]);
|
||||
|
||||
bool CFoldersPage::OnInit()
|
||||
{
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
ReadWorkDirInfo(m_WorkDirInfo);
|
||||
|
||||
CheckButton(IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, m_WorkDirInfo.ForRemovableOnly);
|
||||
|
||||
CheckRadioButton(kWorkModeButtons[0], kWorkModeButtons[kNumWorkModeButtons - 1],
|
||||
kWorkModeButtons[m_WorkDirInfo.Mode]);
|
||||
|
||||
m_WorkPath.Init(*this, IDC_FOLDERS_WORK_EDIT_PATH);
|
||||
m_ButtonSetWorkPath.Init(*this, IDC_FOLDERS_WORK_BUTTON_PATH);
|
||||
|
||||
m_WorkPath.SetText(m_WorkDirInfo.Path);
|
||||
|
||||
MyEnableControls();
|
||||
|
||||
return CPropertyPage::OnInit();
|
||||
}
|
||||
|
||||
int CFoldersPage::GetWorkMode() const
|
||||
{
|
||||
for (int i = 0; i < kNumWorkModeButtons; i++)
|
||||
if(IsButtonCheckedBool(kWorkModeButtons[i]))
|
||||
return i;
|
||||
throw 0;
|
||||
}
|
||||
|
||||
void CFoldersPage::MyEnableControls()
|
||||
{
|
||||
bool enablePath = (GetWorkMode() == NWorkDir::NMode::kSpecified);
|
||||
m_WorkPath.Enable(enablePath);
|
||||
m_ButtonSetWorkPath.Enable(enablePath);
|
||||
}
|
||||
|
||||
void CFoldersPage::GetWorkDir(NWorkDir::CInfo &workDirInfo)
|
||||
{
|
||||
m_WorkPath.GetText(workDirInfo.Path);
|
||||
workDirInfo.ForRemovableOnly = IsButtonCheckedBool(IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE);
|
||||
workDirInfo.Mode = NWorkDir::NMode::EEnum(GetWorkMode());
|
||||
}
|
||||
|
||||
/*
|
||||
bool CFoldersPage::WasChanged()
|
||||
{
|
||||
NWorkDir::CInfo workDirInfo;
|
||||
GetWorkDir(workDirInfo);
|
||||
return (workDirInfo.Mode != m_WorkDirInfo.Mode ||
|
||||
workDirInfo.ForRemovableOnly != m_WorkDirInfo.ForRemovableOnly ||
|
||||
workDirInfo.Path.Compare(m_WorkDirInfo.Path) != 0);
|
||||
}
|
||||
*/
|
||||
|
||||
void CFoldersPage::ModifiedEvent()
|
||||
{
|
||||
Changed();
|
||||
/*
|
||||
if (WasChanged())
|
||||
Changed();
|
||||
else
|
||||
UnChanged();
|
||||
*/
|
||||
}
|
||||
|
||||
bool CFoldersPage::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
for (int i = 0; i < kNumWorkModeButtons; i++)
|
||||
if (buttonID == kWorkModeButtons[i])
|
||||
{
|
||||
MyEnableControls();
|
||||
ModifiedEvent();
|
||||
return true;
|
||||
}
|
||||
switch(buttonID)
|
||||
{
|
||||
case IDC_FOLDERS_WORK_BUTTON_PATH:
|
||||
OnFoldersWorkButtonPath();
|
||||
break;
|
||||
case IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE:
|
||||
break;
|
||||
default:
|
||||
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
ModifiedEvent();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFoldersPage::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
{
|
||||
if (code == EN_CHANGE && itemID == IDC_FOLDERS_WORK_EDIT_PATH)
|
||||
{
|
||||
ModifiedEvent();
|
||||
return true;
|
||||
}
|
||||
return CPropertyPage::OnCommand(code, itemID, lParam);
|
||||
}
|
||||
|
||||
void CFoldersPage::OnFoldersWorkButtonPath()
|
||||
{
|
||||
UString currentPath;
|
||||
m_WorkPath.GetText(currentPath);
|
||||
UString title = LangString(IDS_FOLDERS_SET_WORK_PATH_TITLE, 0x01000281);
|
||||
UString resultPath;
|
||||
if (NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
|
||||
m_WorkPath.SetText(resultPath);
|
||||
}
|
||||
|
||||
LONG CFoldersPage::OnApply()
|
||||
{
|
||||
GetWorkDir(m_WorkDirInfo);
|
||||
SaveWorkDirInfo(m_WorkDirInfo);
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
static LPCWSTR kFoldersTopic = L"fm/plugins/7-zip/options.htm#folders";
|
||||
|
||||
void CFoldersPage::OnNotifyHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kFoldersTopic);
|
||||
}
|
||||
30
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.h
Executable file
30
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.h
Executable file
@@ -0,0 +1,30 @@
|
||||
// FoldersPage.h
|
||||
|
||||
#ifndef __FOLDERSPAGE_H
|
||||
#define __FOLDERSPAGE_H
|
||||
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
|
||||
#include "../../Common/ZipRegistry.h"
|
||||
|
||||
class CFoldersPage : public NWindows::NControl::CPropertyPage
|
||||
{
|
||||
NWorkDir::CInfo m_WorkDirInfo;
|
||||
|
||||
void MyEnableControls();
|
||||
void ModifiedEvent();
|
||||
NWindows::NControl::CDialogChildControl m_WorkPath;
|
||||
NWindows::NControl::CDialogChildControl m_ButtonSetWorkPath;
|
||||
void OnFoldersWorkButtonPath();
|
||||
int GetWorkMode() const;
|
||||
void GetWorkDir(NWorkDir::CInfo &workDirInfo);
|
||||
// bool WasChanged();
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
|
||||
virtual void OnNotifyHelp();
|
||||
virtual LONG OnApply();
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
};
|
||||
|
||||
#endif
|
||||
12
CPP/7zip/UI/Explorer/FoldersPage/resource.h
Executable file
12
CPP/7zip/UI/Explorer/FoldersPage/resource.h
Executable file
@@ -0,0 +1,12 @@
|
||||
#define IDD_FOLDERS 900
|
||||
|
||||
#define IDS_FOLDERS_SET_WORK_PATH_TITLE 103
|
||||
|
||||
#define IDC_FOLDERS_STATIC_WORKING_FOLDER 1001
|
||||
|
||||
#define IDC_FOLDERS_WORK_RADIO_SYSTEM 1011
|
||||
#define IDC_FOLDERS_WORK_RADIO_CURRENT 1012
|
||||
#define IDC_FOLDERS_WORK_RADIO_SPECIFIED 1013
|
||||
#define IDC_FOLDERS_WORK_EDIT_PATH 1014
|
||||
#define IDC_FOLDERS_WORK_BUTTON_PATH 1015
|
||||
#define IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE 1017
|
||||
36
CPP/7zip/UI/Explorer/FoldersPage/resource.rc
Executable file
36
CPP/7zip/UI/Explorer/FoldersPage/resource.rc
Executable file
@@ -0,0 +1,36 @@
|
||||
#include "resource.h"
|
||||
#include "../../../GuiCommon.rc"
|
||||
|
||||
#define xSize2 196
|
||||
#define ySize2 140
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
#define ySize (ySize2 + marg + marg)
|
||||
|
||||
#define marg2 marg
|
||||
#define marg3 10
|
||||
#define gPos (marg + marg2)
|
||||
#define gSize (xSize2 - marg2 - marg2)
|
||||
#define gPos2 (gPos + marg3)
|
||||
|
||||
|
||||
IDD_FOLDERS DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
|
||||
CAPTION "Folders"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
GROUPBOX "&Working folder", IDC_FOLDERS_STATIC_WORKING_FOLDER, marg, marg, xSize2, 98
|
||||
CONTROL "&System temp folder", IDC_FOLDERS_WORK_RADIO_SYSTEM, "Button", BS_AUTORADIOBUTTON | WS_GROUP,
|
||||
gPos, 20, gSize, 10
|
||||
CONTROL "&Current", IDC_FOLDERS_WORK_RADIO_CURRENT, "Button", BS_AUTORADIOBUTTON,
|
||||
gPos, 34, gSize, 10
|
||||
CONTROL "Specified:", IDC_FOLDERS_WORK_RADIO_SPECIFIED, "Button", BS_AUTORADIOBUTTON,
|
||||
gPos, 48, gSize, 10
|
||||
EDITTEXT IDC_FOLDERS_WORK_EDIT_PATH, gPos2, 63, gSize - marg3 - bDotsSize - 10, 14, ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...", IDC_FOLDERS_WORK_BUTTON_PATH, xSize - marg - marg2 - bDotsSize, 63, bDotsSize, bYSize
|
||||
CONTROL "Use for removable drives only", IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
gPos, 87, gSize, 10
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_FOLDERS_SET_WORK_PATH_TITLE "Specify a location for temporary archive files."
|
||||
END
|
||||
58
CPP/7zip/UI/Explorer/MyMessages.cpp
Executable file
58
CPP/7zip/UI/Explorer/MyMessages.cpp
Executable file
@@ -0,0 +1,58 @@
|
||||
// MyMessages.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "MyMessages.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Error.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "../../FileManager/LangUtils.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
void MyMessageBox(HWND window, LPCWSTR message)
|
||||
{
|
||||
::MessageBoxW(window, message, L"7-Zip", 0);
|
||||
}
|
||||
|
||||
void MyMessageBoxResource(HWND window, UINT32 id
|
||||
#ifdef LANG
|
||||
,UINT32 langID
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef LANG
|
||||
MyMessageBox(window, LangString(id, langID));
|
||||
#else
|
||||
MyMessageBox(window, MyLoadStringW(id));
|
||||
#endif
|
||||
}
|
||||
|
||||
void MyMessageBox(UINT32 id
|
||||
#ifdef LANG
|
||||
,UINT32 langID
|
||||
#endif
|
||||
)
|
||||
{
|
||||
MyMessageBoxResource(0, id
|
||||
#ifdef LANG
|
||||
, langID
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void ShowErrorMessage(HWND window, DWORD message)
|
||||
{
|
||||
MyMessageBox(window, NError::MyFormatMessageW(message));
|
||||
}
|
||||
|
||||
void ShowLastErrorMessage(HWND window)
|
||||
{
|
||||
ShowErrorMessage(window, ::GetLastError());
|
||||
}
|
||||
|
||||
30
CPP/7zip/UI/Explorer/MyMessages.h
Executable file
30
CPP/7zip/UI/Explorer/MyMessages.h
Executable file
@@ -0,0 +1,30 @@
|
||||
// MyMessages.h
|
||||
|
||||
#ifndef __MYMESSAGES_H
|
||||
#define __MYMESSAGES_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
void MyMessageBox(HWND window, LPCWSTR message);
|
||||
|
||||
inline void MyMessageBox(LPCWSTR message)
|
||||
{ MyMessageBox(0, message); }
|
||||
|
||||
void MyMessageBoxResource(HWND window, UINT32 id
|
||||
#ifdef LANG
|
||||
,UINT32 langID
|
||||
#endif
|
||||
);
|
||||
|
||||
void MyMessageBox(UINT32 id
|
||||
#ifdef LANG
|
||||
,UINT32 langID
|
||||
#endif
|
||||
);
|
||||
|
||||
void ShowErrorMessage(HWND window, DWORD errorMessage);
|
||||
inline void ShowErrorMessage(DWORD errorMessage)
|
||||
{ ShowErrorMessage(0, errorMessage); }
|
||||
void ShowLastErrorMessage(HWND window = 0);
|
||||
|
||||
#endif
|
||||
71
CPP/7zip/UI/Explorer/OptionsDialog.cpp
Executable file
71
CPP/7zip/UI/Explorer/OptionsDialog.cpp
Executable file
@@ -0,0 +1,71 @@
|
||||
// OptionsDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "OptionsDialog.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
|
||||
#include "../../FileManager/LangUtils.h"
|
||||
#include "FoldersPage/FoldersPage.h"
|
||||
#include "FoldersPage/resource.h"
|
||||
#include "SystemPage/SystemPage.h"
|
||||
#include "SystemPage/resource.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static INT_PTR OptionsDialog(HWND hwndOwner)
|
||||
{
|
||||
CSystemPage systemPage;
|
||||
CFoldersPage foldersPage;
|
||||
UINT32 langIDs[] = { 0x01000300, 0x01000200};
|
||||
UINT pageIDs[] = { IDD_SYSTEM, IDD_FOLDERS};
|
||||
NControl::CPropertyPage *pagePinters[] = { &systemPage, &foldersPage };
|
||||
CObjectVector<NControl::CPageInfo> pages;
|
||||
const int kNumPages = sizeof(langIDs) / sizeof(langIDs[0]);
|
||||
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;
|
||||
RETUEN_IF_NOT_S_OK(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;
|
||||
}
|
||||
|
||||
|
||||
23
CPP/7zip/UI/Explorer/OptionsDialog.h
Executable file
23
CPP/7zip/UI/Explorer/OptionsDialog.h
Executable file
@@ -0,0 +1,23 @@
|
||||
// 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
|
||||
128
CPP/7zip/UI/Explorer/RegistryContextMenu.cpp
Executable file
128
CPP/7zip/UI/Explorer/RegistryContextMenu.cpp
Executable file
@@ -0,0 +1,128 @@
|
||||
// RegistryContextMenu.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "RegistryContextMenu.h"
|
||||
#include "Windows/COM.h"
|
||||
#include "Windows/Synchronization.h"
|
||||
#include "Windows/Registry.h"
|
||||
#include "Windows/FileName.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NCOM;
|
||||
using namespace NRegistry;
|
||||
|
||||
namespace NZipRootRegistry {
|
||||
|
||||
static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
|
||||
|
||||
///////////////////////////
|
||||
// ContextMenu
|
||||
|
||||
static const TCHAR *kContextMenuKeyName = TEXT("\\shellex\\ContextMenuHandlers\\7-ZIP");
|
||||
static const TCHAR *kDragDropMenuKeyName = TEXT("\\shellex\\DragDropHandlers\\7-ZIP");
|
||||
|
||||
static const TCHAR *kExtensionCLSID = TEXT("{23170F69-40C1-278A-1000-000100020000}");
|
||||
|
||||
static const TCHAR *kRootKeyNameForFile = TEXT("*");
|
||||
static const TCHAR *kRootKeyNameForFolder = TEXT("Folder");
|
||||
static const TCHAR *kRootKeyNameForDirectory = TEXT("Directory");
|
||||
static const TCHAR *kRootKeyNameForDrive = TEXT("Drive");
|
||||
|
||||
static CSysString GetFullContextMenuKeyName(const CSysString &keyName)
|
||||
{ return (keyName + kContextMenuKeyName); }
|
||||
|
||||
static CSysString GetFullDragDropMenuKeyName(const CSysString &keyName)
|
||||
{ return (keyName + kDragDropMenuKeyName); }
|
||||
|
||||
static bool CheckContextMenuHandlerCommon(const CSysString &keyName)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey key;
|
||||
if (key.Open(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(keyName), KEY_READ)
|
||||
!= ERROR_SUCCESS)
|
||||
return false;
|
||||
CSysString value;
|
||||
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
|
||||
return false;
|
||||
return (value.CompareNoCase(kExtensionCLSID) == 0);
|
||||
}
|
||||
|
||||
static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey key;
|
||||
if (key.Open(HKEY_CLASSES_ROOT, GetFullDragDropMenuKeyName(keyName), KEY_READ) != ERROR_SUCCESS)
|
||||
return false;
|
||||
CSysString value;
|
||||
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
|
||||
return false;
|
||||
return (value.CompareNoCase(kExtensionCLSID) == 0);
|
||||
}
|
||||
|
||||
bool CheckContextMenuHandler()
|
||||
{
|
||||
return CheckContextMenuHandlerCommon(kRootKeyNameForFile) &&
|
||||
// CheckContextMenuHandlerCommon(kRootKeyNameForFolder) &&
|
||||
CheckContextMenuHandlerCommon(kRootKeyNameForDirectory) &&
|
||||
CheckDragDropMenuHandlerCommon(kRootKeyNameForDirectory) &&
|
||||
CheckDragDropMenuHandlerCommon(kRootKeyNameForDrive);
|
||||
}
|
||||
|
||||
static void DeleteContextMenuHandlerCommon(const CSysString &keyName)
|
||||
{
|
||||
CKey rootKey;
|
||||
rootKey.Attach(HKEY_CLASSES_ROOT);
|
||||
rootKey.RecurseDeleteKey(GetFullContextMenuKeyName(keyName));
|
||||
rootKey.Detach();
|
||||
}
|
||||
|
||||
static void DeleteDragDropMenuHandlerCommon(const CSysString &keyName)
|
||||
{
|
||||
CKey rootKey;
|
||||
rootKey.Attach(HKEY_CLASSES_ROOT);
|
||||
rootKey.RecurseDeleteKey(GetFullDragDropMenuKeyName(keyName));
|
||||
rootKey.Detach();
|
||||
}
|
||||
|
||||
void DeleteContextMenuHandler()
|
||||
{
|
||||
DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
|
||||
DeleteContextMenuHandlerCommon(kRootKeyNameForFolder);
|
||||
DeleteContextMenuHandlerCommon(kRootKeyNameForDirectory);
|
||||
DeleteContextMenuHandlerCommon(kRootKeyNameForDrive);
|
||||
DeleteDragDropMenuHandlerCommon(kRootKeyNameForFile);
|
||||
DeleteDragDropMenuHandlerCommon(kRootKeyNameForFolder);
|
||||
DeleteDragDropMenuHandlerCommon(kRootKeyNameForDirectory);
|
||||
DeleteDragDropMenuHandlerCommon(kRootKeyNameForDrive);
|
||||
}
|
||||
|
||||
static void AddContextMenuHandlerCommon(const CSysString &keyName)
|
||||
{
|
||||
DeleteContextMenuHandlerCommon(keyName);
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey key;
|
||||
key.Create(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(keyName));
|
||||
key.SetValue(NULL, kExtensionCLSID);
|
||||
}
|
||||
|
||||
static void AddDragDropMenuHandlerCommon(const CSysString &keyName)
|
||||
{
|
||||
DeleteDragDropMenuHandlerCommon(keyName);
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey key;
|
||||
key.Create(HKEY_CLASSES_ROOT, GetFullDragDropMenuKeyName(keyName));
|
||||
key.SetValue(NULL, kExtensionCLSID);
|
||||
}
|
||||
|
||||
void AddContextMenuHandler()
|
||||
{
|
||||
AddContextMenuHandlerCommon(kRootKeyNameForFile);
|
||||
// AddContextMenuHandlerCommon(kRootKeyNameForFolder);
|
||||
AddContextMenuHandlerCommon(kRootKeyNameForDirectory);
|
||||
|
||||
AddDragDropMenuHandlerCommon(kRootKeyNameForDirectory);
|
||||
AddDragDropMenuHandlerCommon(kRootKeyNameForDrive);
|
||||
}
|
||||
|
||||
}
|
||||
13
CPP/7zip/UI/Explorer/RegistryContextMenu.h
Executable file
13
CPP/7zip/UI/Explorer/RegistryContextMenu.h
Executable file
@@ -0,0 +1,13 @@
|
||||
// RegistryContextMenu.h
|
||||
|
||||
#ifndef __REGISTRYCONTEXTMENU_H
|
||||
#define __REGISTRYCONTEXTMENU_H
|
||||
|
||||
namespace NZipRootRegistry {
|
||||
|
||||
bool CheckContextMenuHandler();
|
||||
void AddContextMenuHandler();
|
||||
void DeleteContextMenuHandler();
|
||||
}
|
||||
|
||||
#endif
|
||||
3
CPP/7zip/UI/Explorer/StdAfx.cpp
Executable file
3
CPP/7zip/UI/Explorer/StdAfx.cpp
Executable file
@@ -0,0 +1,3 @@
|
||||
// StdAfx.cpp
|
||||
|
||||
#include "stdafx.h"
|
||||
26
CPP/7zip/UI/Explorer/StdAfx.h
Executable file
26
CPP/7zip/UI/Explorer/StdAfx.h
Executable file
@@ -0,0 +1,26 @@
|
||||
// StdAfx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#define _WIN32_WINNT 0x0400
|
||||
// it's hack for Windows NT supporting
|
||||
#define WINVER 0x0400
|
||||
|
||||
// #define _WIN32_IE 0x0500
|
||||
#include <windows.h>
|
||||
#include <CommCtrl.h>
|
||||
#include <shlobj.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <mbstring.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <shlguid.h>
|
||||
#include <regstr.h>
|
||||
|
||||
#include "Common/NewHandler.h"
|
||||
|
||||
#endif
|
||||
212
CPP/7zip/UI/Explorer/SystemPage/SystemPage.cpp
Executable file
212
CPP/7zip/UI/Explorer/SystemPage/SystemPage.cpp
Executable file
@@ -0,0 +1,212 @@
|
||||
// SystemPage.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "resource.h"
|
||||
#include "../resource.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/Control/ListView.h"
|
||||
|
||||
#include "SystemPage.h"
|
||||
|
||||
#include "../../Common/ZipRegistry.h"
|
||||
#include "../RegistryContextMenu.h"
|
||||
#include "../ContextMenuFlags.h"
|
||||
|
||||
#include "../../../FileManager/HelpUtils.h"
|
||||
#include "../../../FileManager/LangUtils.h"
|
||||
#include "../../../FileManager/FormatUtils.h"
|
||||
|
||||
using namespace NContextMenuFlags;
|
||||
|
||||
static CIDLangPair kIDLangPairs[] =
|
||||
{
|
||||
{ IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, 0x01000301},
|
||||
{ IDC_SYSTEM_CASCADED_MENU, 0x01000302},
|
||||
{ IDC_SYSTEM_STATIC_CONTEXT_MENU_ITEMS, 0x01000310}
|
||||
};
|
||||
|
||||
static LPCWSTR kSystemTopic = L"fm/plugins/7-zip/options.htm#system";
|
||||
|
||||
struct CContextMenuItem
|
||||
{
|
||||
int ControlID;
|
||||
UINT32 LangID;
|
||||
UINT32 Flag;
|
||||
};
|
||||
|
||||
static CContextMenuItem kMenuItems[] =
|
||||
{
|
||||
{ IDS_CONTEXT_OPEN, 0x02000103, kOpen},
|
||||
{ IDS_CONTEXT_EXTRACT, 0x02000105, kExtract},
|
||||
{ IDS_CONTEXT_EXTRACT_HERE, 0x0200010B, kExtractHere },
|
||||
{ IDS_CONTEXT_EXTRACT_TO, 0x0200010D, kExtractTo },
|
||||
|
||||
{ IDS_CONTEXT_TEST, 0x02000109, kTest},
|
||||
|
||||
{ IDS_CONTEXT_COMPRESS, 0x02000107, kCompress },
|
||||
{ IDS_CONTEXT_COMPRESS_EMAIL, 0x02000111, kCompressEmail },
|
||||
{ IDS_CONTEXT_COMPRESS_TO, 0x0200010F, kCompressTo7z },
|
||||
{ IDS_CONTEXT_COMPRESS_TO_EMAIL, 0x02000113, kCompressTo7zEmail},
|
||||
{ IDS_CONTEXT_COMPRESS_TO, 0x0200010F, kCompressToZip },
|
||||
{ IDS_CONTEXT_COMPRESS_TO_EMAIL, 0x02000113, kCompressToZipEmail},
|
||||
};
|
||||
|
||||
const int kNumMenuItems = sizeof(kMenuItems) / sizeof(kMenuItems[0]);
|
||||
|
||||
bool CSystemPage::OnInit()
|
||||
{
|
||||
_initMode = true;
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
|
||||
CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
|
||||
NZipRootRegistry::CheckContextMenuHandler());
|
||||
|
||||
CheckButton(IDC_SYSTEM_CASCADED_MENU, ReadCascadedMenu());
|
||||
|
||||
UINT32 contextMenuFlags;
|
||||
if (!ReadContextMenuStatus(contextMenuFlags))
|
||||
contextMenuFlags = NContextMenuFlags::GetDefaultFlags();
|
||||
|
||||
m_ListView.Attach(GetItem(IDC_SYSTEM_OPTIONS_LIST));
|
||||
|
||||
/*
|
||||
CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
|
||||
NRegistryAssociations::CheckContextMenuHandler());
|
||||
*/
|
||||
|
||||
UINT32 newFlags = LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT;
|
||||
m_ListView.SetExtendedListViewStyle(newFlags, newFlags);
|
||||
|
||||
UString s; // = TEXT("Items"); // LangLoadString(IDS_PROPERTY_EXTENSION, 0x02000205);
|
||||
LVCOLUMNW column;
|
||||
column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
|
||||
column.cx = 270;
|
||||
column.fmt = LVCFMT_LEFT;
|
||||
column.pszText = (LPWSTR)(LPCWSTR)s;
|
||||
column.iSubItem = 0;
|
||||
m_ListView.InsertColumn(0, &column);
|
||||
|
||||
for (int i = 0; i < kNumMenuItems; i++)
|
||||
{
|
||||
CContextMenuItem &menuItem = kMenuItems[i];
|
||||
LVITEMW item;
|
||||
item.iItem = i;
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
item.lParam = i;
|
||||
|
||||
UString s = LangString(menuItem.ControlID, menuItem.LangID);
|
||||
|
||||
switch(menuItem.ControlID)
|
||||
{
|
||||
case IDS_CONTEXT_EXTRACT_TO:
|
||||
{
|
||||
s = MyFormatNew(s, LangString(IDS_CONTEXT_FOLDER, 0x02000140));
|
||||
break;
|
||||
}
|
||||
case IDS_CONTEXT_COMPRESS_TO:
|
||||
case IDS_CONTEXT_COMPRESS_TO_EMAIL:
|
||||
{
|
||||
UString s2 = LangString(IDS_CONTEXT_ARCHIVE, 0x02000141);
|
||||
switch(menuItem.Flag)
|
||||
{
|
||||
case kCompressTo7z:
|
||||
case kCompressTo7zEmail:
|
||||
s2 += L".7z";
|
||||
break;
|
||||
case kCompressToZip:
|
||||
case kCompressToZipEmail:
|
||||
s2 += L".zip";
|
||||
break;
|
||||
}
|
||||
s = MyFormatNew(s, s2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// UString MyFormatNew(const UString &format, const UString &argument);
|
||||
|
||||
item.pszText = (LPWSTR)(LPCWSTR)s;
|
||||
item.iSubItem = 0;
|
||||
int itemIndex = m_ListView.InsertItem(&item);
|
||||
m_ListView.SetCheckState(itemIndex, ((contextMenuFlags & menuItem.Flag) != 0));
|
||||
}
|
||||
|
||||
_initMode = false;
|
||||
return CPropertyPage::OnInit();
|
||||
}
|
||||
|
||||
STDAPI DllRegisterServer(void);
|
||||
STDAPI DllUnregisterServer(void);
|
||||
|
||||
LONG CSystemPage::OnApply()
|
||||
{
|
||||
if (IsButtonCheckedBool(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU))
|
||||
{
|
||||
DllRegisterServer();
|
||||
NZipRootRegistry::AddContextMenuHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
DllUnregisterServer();
|
||||
NZipRootRegistry::DeleteContextMenuHandler();
|
||||
}
|
||||
SaveCascadedMenu(IsButtonCheckedBool(IDC_SYSTEM_CASCADED_MENU));
|
||||
|
||||
UINT32 flags = 0;
|
||||
for (int i = 0; i < kNumMenuItems; i++)
|
||||
if (m_ListView.GetCheckState(i))
|
||||
flags |= kMenuItems[i].Flag;
|
||||
SaveContextMenuStatus(flags);
|
||||
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
void CSystemPage::OnNotifyHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kSystemTopic);
|
||||
}
|
||||
|
||||
bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch(buttonID)
|
||||
{
|
||||
case IDC_SYSTEM_CASCADED_MENU:
|
||||
case IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU:
|
||||
Changed();
|
||||
return true;
|
||||
}
|
||||
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
|
||||
|
||||
}
|
||||
|
||||
bool CSystemPage::OnNotify(UINT aControlID, LPNMHDR lParam)
|
||||
{
|
||||
if (lParam->hwndFrom == HWND(m_ListView))
|
||||
{
|
||||
switch(lParam->code)
|
||||
{
|
||||
case (LVN_ITEMCHANGED):
|
||||
return OnItemChanged((const NMLISTVIEW *)lParam);
|
||||
}
|
||||
}
|
||||
return CPropertyPage::OnNotify(aControlID, lParam);
|
||||
}
|
||||
|
||||
|
||||
bool CSystemPage::OnItemChanged(const NMLISTVIEW *info)
|
||||
{
|
||||
if (_initMode)
|
||||
return true;
|
||||
if ((info->uChanged & LVIF_STATE) != 0)
|
||||
{
|
||||
UINT oldState = info->uOldState & LVIS_STATEIMAGEMASK;
|
||||
UINT newState = info->uNewState & LVIS_STATEIMAGEMASK;
|
||||
if (oldState != newState)
|
||||
Changed();
|
||||
}
|
||||
// PostMessage(kRefreshpluginsListMessage, 0);
|
||||
// RefreshPluginsList();
|
||||
return true;
|
||||
}
|
||||
25
CPP/7zip/UI/Explorer/SystemPage/SystemPage.h
Executable file
25
CPP/7zip/UI/Explorer/SystemPage/SystemPage.h
Executable file
@@ -0,0 +1,25 @@
|
||||
// SystemPage.h
|
||||
|
||||
#ifndef __SYSTEMPAGE_H
|
||||
#define __SYSTEMPAGE_H
|
||||
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
#include "Windows/Control/ListView.h"
|
||||
|
||||
#include "../../Common/ArchiverInfo.h"
|
||||
|
||||
class CSystemPage: public NWindows::NControl::CPropertyPage
|
||||
{
|
||||
bool _initMode;
|
||||
CObjectVector<CArchiverInfo> m_Archivers;
|
||||
NWindows::NControl::CListView m_ListView;
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
virtual void OnNotifyHelp();
|
||||
virtual bool OnNotify(UINT aControlID, LPNMHDR lParam);
|
||||
virtual bool OnItemChanged(const NMLISTVIEW *info);
|
||||
virtual LONG OnApply();
|
||||
virtual bool OnButtonClicked(int aButtonID, HWND aButtonHWND);
|
||||
};
|
||||
|
||||
#endif
|
||||
6
CPP/7zip/UI/Explorer/SystemPage/resource.h
Executable file
6
CPP/7zip/UI/Explorer/SystemPage/resource.h
Executable file
@@ -0,0 +1,6 @@
|
||||
#define IDD_SYSTEM 102
|
||||
|
||||
#define IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU 1010
|
||||
#define IDC_SYSTEM_CASCADED_MENU 1011
|
||||
#define IDC_SYSTEM_STATIC_CONTEXT_MENU_ITEMS 1020
|
||||
#define IDC_SYSTEM_OPTIONS_LIST 1022
|
||||
24
CPP/7zip/UI/Explorer/SystemPage/resource.rc
Executable file
24
CPP/7zip/UI/Explorer/SystemPage/resource.rc
Executable file
@@ -0,0 +1,24 @@
|
||||
#include "resource.h"
|
||||
#include "../../../GuiCommon.rc"
|
||||
|
||||
#define xSize2 196
|
||||
#define ySize2 164
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
#define ySize (ySize2 + marg + marg)
|
||||
|
||||
IDD_SYSTEM DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
|
||||
CAPTION "System"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
CONTROL "Integrate 7-Zip to shell context menu", IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
|
||||
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
marg, marg, xSize2, 10
|
||||
CONTROL "Cascaded context menu", IDC_SYSTEM_CASCADED_MENU,
|
||||
"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
marg, 21, xSize2, 10
|
||||
LTEXT "Context menu items:", IDC_SYSTEM_STATIC_CONTEXT_MENU_ITEMS,
|
||||
marg, 37, xSize2, 8
|
||||
CONTROL "List1", IDC_SYSTEM_OPTIONS_LIST, "SysListView32",
|
||||
LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,
|
||||
marg, 50, xSize2, ySize - marg - 50
|
||||
END
|
||||
137
CPP/7zip/UI/Explorer/makefile
Executable file
137
CPP/7zip/UI/Explorer/makefile
Executable file
@@ -0,0 +1,137 @@
|
||||
PROG = 7-zip.dll
|
||||
DEF_FILE = Explorer.def
|
||||
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib htmlhelp.lib shell32.lib comctl32.lib ole32.lib comdlg32.lib
|
||||
CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
-DLANG \
|
||||
-DNEW_FOLDER_INTERFACE \
|
||||
-DWIN_LONG_PATH
|
||||
|
||||
EXPLORER_OBJS = \
|
||||
$O\DllExports.obj \
|
||||
$O\ContextMenu.obj \
|
||||
$O\MyMessages.obj \
|
||||
$O\OptionsDialog.obj \
|
||||
$O\RegistryContextMenu.obj \
|
||||
|
||||
COMMON_OBJS = \
|
||||
$O\Alloc.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\Lang.obj \
|
||||
$O\ListFileUtils.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\Random.obj \
|
||||
$O\StdInStream.obj \
|
||||
$O\String.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\TextConfig.obj \
|
||||
$O\UTFConvert.obj \
|
||||
$O\Vector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\DLL.obj \
|
||||
$O\Error.obj \
|
||||
$O\FileDir.obj \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\FileName.obj \
|
||||
$O\Menu.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\PropVariantConversions.obj \
|
||||
$O\Registry.obj \
|
||||
$O\ResourceString.obj \
|
||||
$O\Shell.obj \
|
||||
$O\Synchronization.obj \
|
||||
$O\Window.obj \
|
||||
|
||||
WIN_CTRL_OBJS = \
|
||||
$O\Dialog.obj \
|
||||
$O\PropertyPage.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\FilePathAutoRename.obj \
|
||||
$O\FileStreams.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveExtractCallback.obj \
|
||||
$O\ArchiveName.obj \
|
||||
$O\ArchiveOpenCallback.obj \
|
||||
$O\ArchiverInfo.obj \
|
||||
$O\CompressCall.obj \
|
||||
$O\DefaultName.obj \
|
||||
$O\EnumDirItems.obj \
|
||||
$O\ExtractingFilePath.obj \
|
||||
$O\OpenArchive.obj \
|
||||
$O\PropIDUtils.obj \
|
||||
$O\SortUtils.obj \
|
||||
$O\UpdateAction.obj \
|
||||
$O\UpdateCallback.obj \
|
||||
$O\UpdatePair.obj \
|
||||
$O\UpdateProduce.obj \
|
||||
$O\WorkDir.obj \
|
||||
$O\ZipRegistry.obj \
|
||||
|
||||
AGENT_OBJS = \
|
||||
$O\Agent.obj \
|
||||
$O\AgentOut.obj \
|
||||
$O\AgentProxy.obj \
|
||||
$O\ArchiveFolder.obj \
|
||||
$O\ArchiveFolderOpen.obj \
|
||||
$O\ArchiveFolderOut.obj \
|
||||
$O\UpdateCallbackAgent.obj \
|
||||
|
||||
|
||||
FM_COMMON_OBJS = \
|
||||
$O\FormatUtils.obj \
|
||||
$O\HelpUtils.obj \
|
||||
$O\LangUtils.obj \
|
||||
$O\ProgramLocation.obj \
|
||||
$O\RegistryUtils.obj \
|
||||
|
||||
C_OBJS = \
|
||||
$O\Sort.obj \
|
||||
|
||||
OBJS = \
|
||||
$O\StdAfx.obj \
|
||||
$(EXPLORER_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
$(WIN_OBJS) \
|
||||
$(WIN_CTRL_OBJS) \
|
||||
$(7ZIP_COMMON_OBJS) \
|
||||
$(UI_COMMON_OBJS) \
|
||||
$(AGENT_OBJS) \
|
||||
$(FM_COMMON_OBJS)\
|
||||
$(C_OBJS) \
|
||||
$O\SystemPage.obj \
|
||||
$O\FoldersPage.obj \
|
||||
$O\CopyCoder.obj \
|
||||
$O\resource.res
|
||||
|
||||
!include "../../../Build.mak"
|
||||
|
||||
$(EXPLORER_OBJS): $(*B).cpp
|
||||
$(COMPL)
|
||||
$(COMMON_OBJS): ../../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_OBJS): ../../../Windows/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_CTRL_OBJS): ../../../Windows/Control/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(UI_COMMON_OBJS): ../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(AGENT_OBJS): ../Agent/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(FM_COMMON_OBJS): ../../FileManager/$(*B).cpp
|
||||
$(COMPL)
|
||||
$O\SystemPage.obj: SystemPage/$(*B).cpp
|
||||
$(COMPL)
|
||||
$O\FoldersPage.obj: FoldersPage/$(*B).cpp
|
||||
$(COMPL)
|
||||
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(C_OBJS): ../../../../C/$(*B).c
|
||||
$(COMPL_O2)
|
||||
31
CPP/7zip/UI/Explorer/resource.h
Executable file
31
CPP/7zip/UI/Explorer/resource.h
Executable file
@@ -0,0 +1,31 @@
|
||||
#define IDS_CONTEXT_EXTRACT 42
|
||||
#define IDS_CONTEXT_EXTRACT_HELP 43
|
||||
#define IDS_CONTEXT_COMPRESS 44
|
||||
#define IDS_CONTEXT_COMPRESS_HELP 45
|
||||
#define IDS_CONTEXT_OPEN 46
|
||||
#define IDS_CONTEXT_OPEN_HELP 47
|
||||
#define IDS_CONTEXT_TEST 48
|
||||
#define IDS_CONTEXT_TEST_HELP 49
|
||||
#define IDS_CONTEXT_CAPTION_HELP 50
|
||||
#define IDS_CONTEXT_POPUP_CAPTION 51
|
||||
|
||||
#define IDS_CONTEXT_EXTRACT_HERE 52
|
||||
#define IDS_CONTEXT_EXTRACT_HERE_HELP 53
|
||||
|
||||
#define IDS_CONTEXT_EXTRACT_TO 54
|
||||
#define IDS_CONTEXT_EXTRACT_TO_HELP 55
|
||||
|
||||
#define IDS_CONTEXT_COMPRESS_TO 56
|
||||
#define IDS_CONTEXT_COMPRESS_TO_HELP 57
|
||||
|
||||
#define IDS_CONTEXT_COMPRESS_EMAIL 58
|
||||
#define IDS_CONTEXT_COMPRESS_EMAIL_HELP 59
|
||||
|
||||
#define IDS_CONTEXT_COMPRESS_TO_EMAIL 60
|
||||
#define IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP 61
|
||||
|
||||
#define IDS_CONTEXT_FOLDER 70
|
||||
#define IDS_CONTEXT_ARCHIVE 71
|
||||
|
||||
#define IDS_ERROR 100
|
||||
#define IDS_CONFIG_DIALOG_CAPTION 102
|
||||
38
CPP/7zip/UI/Explorer/resource.rc
Executable file
38
CPP/7zip/UI/Explorer/resource.rc
Executable file
@@ -0,0 +1,38 @@
|
||||
#include "../../MyVersionInfo.rc"
|
||||
#include "resource.h"
|
||||
|
||||
MY_VERSION_INFO_DLL("7-Zip Shell Extension", "7-zip")
|
||||
|
||||
1 24 "7-zip.dll.manifest"
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CONTEXT_EXTRACT "Extract files..."
|
||||
IDS_CONTEXT_EXTRACT_HELP "Extracts files from the selected archive."
|
||||
IDS_CONTEXT_COMPRESS "Add to archive..."
|
||||
IDS_CONTEXT_COMPRESS_HELP "Adds the selected items to archive."
|
||||
IDS_CONTEXT_OPEN "Open archive"
|
||||
IDS_CONTEXT_OPEN_HELP "Opens the selected archive."
|
||||
IDS_CONTEXT_TEST "Test archive"
|
||||
IDS_CONTEXT_TEST_HELP "Tests integrity of the selected archive."
|
||||
IDS_CONTEXT_CAPTION_HELP "7-Zip commands"
|
||||
IDS_CONTEXT_POPUP_CAPTION "7-Zip"
|
||||
IDS_CONTEXT_EXTRACT_HERE "Extract Here"
|
||||
IDS_CONTEXT_EXTRACT_HERE_HELP "Extracts files from the selected archive to current folder."
|
||||
IDS_CONTEXT_EXTRACT_TO "Extract to {0}"
|
||||
IDS_CONTEXT_EXTRACT_TO_HELP "Extracts files to subfolder."
|
||||
IDS_CONTEXT_COMPRESS_TO "Add to {0}"
|
||||
IDS_CONTEXT_COMPRESS_TO_HELP "Adds the selected items to archive."
|
||||
IDS_CONTEXT_COMPRESS_EMAIL "Compress and email..."
|
||||
IDS_CONTEXT_COMPRESS_EMAIL_HELP "Compresses the selected items to archive and sends archive via email."
|
||||
IDS_CONTEXT_COMPRESS_TO_EMAIL "Compress to {0} and email"
|
||||
IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP "Compresses the selected items to archive and sends archive via email."
|
||||
IDS_CONTEXT_FOLDER "<Folder>"
|
||||
IDS_CONTEXT_ARCHIVE "<Archive>"
|
||||
IDS_ERROR "Error"
|
||||
IDS_CONFIG_DIALOG_CAPTION "7-Zip Options"
|
||||
END
|
||||
|
||||
#include "FoldersPage/resource.rc"
|
||||
#include "SystemPage/resource.rc"
|
||||
|
||||
Reference in New Issue
Block a user