chore: initial commit (extracted from Launchers monorepo)

Plugin: ns7zip v2.0.0
Architectures: x86-ansi, x86-unicode, amd64-unicode
License: LGPL-2.1-or-later
This commit is contained in:
Simone
2026-04-29 14:07:51 +02:00
commit d074cc7c07
3848 changed files with 1076682 additions and 0 deletions
@@ -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>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,173 @@
// ContextMenu.h
#ifndef ZIP7_INC_CONTEXT_MENU_H
#define ZIP7_INC_CONTEXT_MENU_H
#include "../../../Windows/Shell.h"
#include "MyExplorerCommand.h"
#include "../FileManager/MyCom2.h"
#ifdef CMF_EXTENDEDVERBS
#define Z7_WIN_CMF_EXTENDEDVERBS CMF_EXTENDEDVERBS
#else
#define Z7_WIN_CMF_EXTENDEDVERBS 0x00000100
#endif
enum enum_CtxCommandType
{
CtxCommandType_Normal,
CtxCommandType_OpenRoot,
CtxCommandType_OpenChild,
CtxCommandType_CrcRoot,
CtxCommandType_CrcChild
};
class CZipContextMenu Z7_final:
public IContextMenu,
public IShellExtInit,
public IExplorerCommand,
public IEnumExplorerCommand,
public CMyUnknownImp
{
Z7_COM_UNKNOWN_IMP_4_MT(
IContextMenu,
IShellExtInit,
IExplorerCommand,
IEnumExplorerCommand
)
// IShellExtInit
STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder, LPDATAOBJECT dataObject, HKEY hkeyProgID) Z7_override;
// IContextMenu
STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) Z7_override;
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici) Z7_override;
STDMETHOD(GetCommandString)(
#ifdef Z7_OLD_WIN_SDK
UINT
#else
UINT_PTR
#endif
idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) Z7_override;
// IExplorerCommand
STDMETHOD (GetTitle) (IShellItemArray *psiItemArray, LPWSTR *ppszName) Z7_override;
STDMETHOD (GetIcon) (IShellItemArray *psiItemArray, LPWSTR *ppszIcon) Z7_override;
STDMETHOD (GetToolTip) (IShellItemArray *psiItemArray, LPWSTR *ppszInfotip) Z7_override;
STDMETHOD (GetCanonicalName) (GUID *pguidCommandName) Z7_override;
STDMETHOD (GetState) (IShellItemArray *psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE *pCmdState) Z7_override;
STDMETHOD (Invoke) (IShellItemArray *psiItemArray, IBindCtx *pbc) Z7_override;
STDMETHOD (GetFlags) (EXPCMDFLAGS *pFlags) Z7_override;
STDMETHOD (EnumSubCommands) (IEnumExplorerCommand **ppEnum) Z7_override;
// IEnumExplorerCommand
STDMETHOD (Next) (ULONG celt, IExplorerCommand **pUICommand, ULONG *pceltFetched) Z7_override;
STDMETHOD (Skip) (ULONG celt) Z7_override;
STDMETHOD (Reset) (void) Z7_override;
STDMETHOD (Clone) (IEnumExplorerCommand **ppenum) Z7_override;
public:
enum enum_CommandInternalID
{
kCommandNULL,
kOpen,
kExtract,
kExtractHere,
kExtractTo,
kTest,
kCompress,
kCompressEmail,
kCompressTo7z,
kCompressTo7zEmail,
kCompressToZip,
kCompressToZipEmail,
kHash_CRC32,
kHash_CRC64,
kHash_XXH64,
kHash_MD5,
kHash_SHA1,
kHash_SHA256,
kHash_SHA384,
kHash_SHA512,
kHash_SHA3_256,
kHash_BLAKE2SP,
kHash_All,
kHash_Generate_SHA256,
kHash_TestArc
};
public:
void Init_For_7zFM()
{
// _isMenuForFM = true;
// _fileNames_WereReduced = false;
}
void LoadItems(IShellItemArray *psiItemArray);
CZipContextMenu();
~CZipContextMenu();
struct CCommandMapItem
{
enum_CommandInternalID CommandInternalID;
UString Verb;
UString UserString;
// UString HelpString;
UString Folder;
UString ArcName;
UString ArcType;
bool IsPopup;
enum_CtxCommandType CtxCommandType;
CCommandMapItem():
IsPopup(false),
CtxCommandType(CtxCommandType_Normal)
{}
bool IsSubMenu() const
{
return
CtxCommandType == CtxCommandType_CrcRoot ||
CtxCommandType == CtxCommandType_OpenRoot;
}
};
UStringVector _fileNames;
NWindows::NShell::CFileAttribs _attribs;
private:
bool _isMenuForFM;
bool _fileNames_WereReduced; // = true, if only first 16 items were used in QueryContextMenu()
bool _dropMode;
UString _dropPath;
CObjectVector<CCommandMapItem> _commandMap;
CObjectVector<CCommandMapItem> _commandMap_Cur;
HBITMAP _bitmap;
UInt32 _writeZone;
CBoolPair _elimDup;
bool IsSeparator;
bool IsRoot;
CObjectVector< CMyComPtr<IExplorerCommand> > SubCommands;
unsigned CurrentSubCommand;
void Set_UserString_in_LastCommand(const UString &s)
{
_commandMap.Back().UserString = s;
}
int FindVerb(const UString &verb) const;
void FillCommand(enum_CommandInternalID id, UString &mainString, CCommandMapItem &cmi) const;
void AddCommand(enum_CommandInternalID id, UString &mainString, CCommandMapItem &cmi);
void AddMapItem_ForSubMenu(const char *ver);
HRESULT InvokeCommandCommon(const CCommandMapItem &cmi);
};
#endif
@@ -0,0 +1,27 @@
// ContextMenuFlags.h
#ifndef ZIP7_INC_CONTEXT_MENU_FLAGS_H
#define ZIP7_INC_CONTEXT_MENU_FLAGS_H
namespace NContextMenuFlags
{
const UInt32 kExtract = 1 << 0;
const UInt32 kExtractHere = 1 << 1;
const UInt32 kExtractTo = 1 << 2;
const UInt32 kTest = 1 << 4;
const UInt32 kOpen = 1 << 5;
const UInt32 kOpenAs = 1 << 6;
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;
const UInt32 kCRC_Cascaded = (UInt32)1 << 30;
const UInt32 kCRC = (UInt32)1 << 31;
}
#endif
@@ -0,0 +1,268 @@
// DLLExportsExplorer.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 "../../../Common/MyWindows.h"
#if defined(__clang__) && __clang_major__ >= 4
#pragma GCC diagnostic ignored "-Wnonportable-system-include-path"
#endif
// <olectl.h> : in new Windows Kit 10.0.2**** (NTDDI_WIN10_MN is defined)
// <OleCtl.h> : in another Windows Kit versions
#if defined(NTDDI_WIN10_MN) || defined(__MINGW32__) || defined(__MINGW64__)
#include <olectl.h>
#else
#include <OleCtl.h>
#endif
#if defined(__MINGW32__) || defined(__MINGW64__)
#include <shlguid.h>
#else
#include <ShlGuid.h>
#endif
#include "../../../Common/MyInitGuid.h"
#include "../../../Common/ComTry.h"
#include "../../../Windows/DLL.h"
#include "../../../Windows/ErrorMsg.h"
#include "../../../Windows/NtCheck.h"
#include "../../../Windows/Registry.h"
#include "../FileManager/IFolder.h"
#include "ContextMenu.h"
static LPCTSTR const k_ShellExtName = TEXT("7-Zip Shell Extension");
static LPCTSTR const k_Approved = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved");
// {23170F69-40C1-278A-1000-000100020000}
static LPCTSTR const k_Clsid = TEXT("{23170F69-40C1-278A-1000-000100020000}");
Z7_DEFINE_GUID(CLSID_CZipContextMenu,
k_7zip_GUID_Data1,
k_7zip_GUID_Data2,
k_7zip_GUID_Data3_Common,
0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
using namespace NWindows;
extern
HINSTANCE g_hInstance;
HINSTANCE g_hInstance = NULL;
extern
HWND g_HWND;
HWND g_HWND = NULL;
extern
LONG g_DllRefCount;
LONG g_DllRefCount = 0; // Reference count of this DLL.
extern
bool g_DisableUserQuestions;
bool g_DisableUserQuestions;
// #define ODS(sz) OutputDebugStringW(L#sz)
#define ODS(sz)
class CShellExtClassFactory Z7_final:
public IClassFactory,
public CMyUnknownImp
{
Z7_COM_UNKNOWN_IMP_1_MT(IClassFactory)
STDMETHOD(CreateInstance)(LPUNKNOWN, REFIID, void**) Z7_override Z7_final;
STDMETHOD(LockServer)(BOOL) Z7_override Z7_final;
public:
CShellExtClassFactory() { InterlockedIncrement(&g_DllRefCount); }
~CShellExtClassFactory() { InterlockedDecrement(&g_DllRefCount); }
};
Z7_COMWF_B CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter,
REFIID riid, void **ppvObj)
{
ODS("CShellExtClassFactory::CreateInstance()\r\n");
/*
char s[64];
ConvertUInt32ToHex(riid.Data1, s);
OutputDebugStringA(s);
*/
*ppvObj = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
CZipContextMenu *shellExt;
try
{
shellExt = new CZipContextMenu();
}
catch(...) { return E_OUTOFMEMORY; }
if (!shellExt)
return E_OUTOFMEMORY;
IContextMenu *ctxm = shellExt;
const HRESULT res = ctxm->QueryInterface(riid, ppvObj);
if (res != S_OK)
delete shellExt;
return res;
}
Z7_COMWF_B CShellExtClassFactory::LockServer(BOOL /* fLock */)
{
return S_OK; // Check it
}
#if defined(_UNICODE) && !defined(_WIN64) && !defined(UNDER_CE)
#define NT_CHECK_FAIL_ACTION return FALSE;
#endif
extern "C"
BOOL WINAPI DllMain(
#ifdef UNDER_CE
HANDLE hInstance
#else
HINSTANCE hInstance
#endif
, DWORD dwReason, LPVOID);
extern "C"
BOOL WINAPI DllMain(
#ifdef UNDER_CE
HANDLE hInstance
#else
HINSTANCE hInstance
#endif
, DWORD dwReason, LPVOID)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
g_hInstance = (HINSTANCE)hInstance;
ODS("In DLLMain, DLL_PROCESS_ATTACH\r\n");
NT_CHECK
}
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");
/*
if (g_DllRefCount == 0)
ODS( "g_DllRefCount == 0");
else
ODS( "g_DllRefCount != 0");
*/
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)
return E_OUTOFMEMORY;
IClassFactory *cf2 = cf;
const HRESULT res = cf2->QueryInterface(riid, ppv);
if (res != S_OK)
delete cf;
return res;
}
return CLASS_E_CLASSNOTAVAILABLE;
// return _Module.GetClassObject(rclsid, riid, ppv);
}
static BOOL RegisterServer()
{
ODS("RegisterServer\r\n");
FString modulePath;
if (!NDLL::MyGetModuleFileName(modulePath))
return FALSE;
const UString modulePathU = fs2us(modulePath);
CSysString s ("CLSID\\");
s += k_Clsid;
{
NRegistry::CKey key;
if (key.Create(HKEY_CLASSES_ROOT, s, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE) != NOERROR)
return FALSE;
key.SetValue(NULL, k_ShellExtName);
NRegistry::CKey keyInproc;
if (keyInproc.Create(key, TEXT("InprocServer32"), NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE) != NOERROR)
return FALSE;
keyInproc.SetValue(NULL, modulePathU);
keyInproc.SetValue(TEXT("ThreadingModel"), TEXT("Apartment"));
}
#if !defined(_WIN64) && !defined(UNDER_CE)
if (IsItWindowsNT())
#endif
{
NRegistry::CKey key;
if (key.Create(HKEY_LOCAL_MACHINE, k_Approved, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE) == NOERROR)
key.SetValue(k_Clsid, k_ShellExtName);
}
ODS("RegisterServer :: return TRUE");
return TRUE;
}
STDAPI DllRegisterServer(void)
{
return RegisterServer() ? S_OK: SELFREG_E_CLASS;
}
static BOOL UnregisterServer()
{
CSysString s ("CLSID\\");
s += k_Clsid;
RegDeleteKey(HKEY_CLASSES_ROOT, s + TEXT("\\InprocServer32"));
RegDeleteKey(HKEY_CLASSES_ROOT, s);
#if !defined(_WIN64) && !defined(UNDER_CE)
if (IsItWindowsNT())
#endif
{
HKEY hKey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, k_Approved, 0, KEY_SET_VALUE, &hKey) == NOERROR)
{
RegDeleteValue(hKey, k_Clsid);
RegCloseKey(hKey);
}
}
return TRUE;
}
STDAPI DllUnregisterServer(void)
{
return UnregisterServer() ? S_OK: SELFREG_E_CLASS;
}
@@ -0,0 +1,9 @@
; 7-zip.def
LIBRARY "7-zip"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
@@ -0,0 +1,620 @@
# 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 /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "Z7_LANG" /D "Z7_LONG_PATH" /FAcs /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:\Util\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 /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "Z7_LANG" /D "Z7_LONG_PATH" /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:\Util\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 "Z7_LANG" /D "_MBCS" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "Z7_LANG" /D "Z7_LONG_PATH" /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:\Util\7-Zip.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 "Z7_LANG" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MTd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "Z7_LANG" /D "Z7_LONG_PATH" /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:\Util\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=.\DllExportsExplorer.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\ArchiveName.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiveName.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\ExtractingFilePath.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ExtractingFilePath.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=.\MyExplorerCommand.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 "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\MyCom2.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\PropertyName.cpp
# End Source File
# Begin Source File
SOURCE=..\FileManager\PropertyName.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 "C"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\..\C\7zTypes.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\7zWindows.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Compiler.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# 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
# Begin Source File
SOURCE=..\..\..\..\C\Threads.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Threads.h
# End Source File
# End Group
# Begin Group "Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Common\Common.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\MyString.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyString.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyVector.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyVector.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyWindows.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\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\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\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\ListView.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\ListView.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\COM.h
# End Source File
# 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\ErrorMsg.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\ErrorMsg.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\MemoryGlobal.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\MemoryGlobal.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\MemoryLock.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\MemoryLock.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\ProcessUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\ProcessUtils.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\TimeUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\TimeUtils.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
# Begin Source File
SOURCE=".\7-zip.dll.manifest"
# End Source File
# Begin Source File
SOURCE=.\ContextMenuFlags.h
# End Source File
# Begin Source File
SOURCE=..\FileManager\FM.ico
# End Source File
# End Target
# End Project
@@ -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>
{{{
}}}
###############################################################################
Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

@@ -0,0 +1,217 @@
// MyExplorerCommand.h
#ifndef ZIP7_INC_MY_EXPLORER_COMMAND_H
#define ZIP7_INC_MY_EXPLORER_COMMAND_H
#if _MSC_VER >= 1910
#define USE_SYS_shobjidl_core
#endif
#ifdef USE_SYS_shobjidl_core
// #include <shobjidl_core.h>
#else
/* IShellItem is defined:
ShObjIdl.h : old Windows SDK
ShObjIdl_core.h : new Windows 10 SDK */
#ifndef Z7_OLD_WIN_SDK
#include <ShObjIdl.h>
#endif
#ifndef __IShellItem_INTERFACE_DEFINED__
#define __IShellItem_INTERFACE_DEFINED__
// For MINGW we define IShellItem
// #error Stop_Compiling__NOT_DEFINED__IShellItem_INTERFACE_DEFINED__
typedef
enum
{ SIGDN_NORMALDISPLAY = 0,
SIGDN_PARENTRELATIVEPARSING = 0x80018001,
SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8001c001,
SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000,
SIGDN_PARENTRELATIVEEDITING = 0x80031001,
SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000,
SIGDN_FILESYSPATH = 0x80058000,
SIGDN_URL = 0x80068000
} SIGDN;
typedef DWORD SICHINTF;
typedef ULONG SFGAOF;
struct IShellItem : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE BindToHandler(IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) = 0;
virtual HRESULT STDMETHODCALLTYPE GetParent(IShellItem **ppsi) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDisplayName(SIGDN sigdnName, LPOLESTR *ppszName) = 0;
virtual HRESULT STDMETHODCALLTYPE GetAttributes(SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) = 0;
virtual HRESULT STDMETHODCALLTYPE Compare(IShellItem *psi, SICHINTF hint, int *piOrder) = 0;
};
#endif // __IShellItem_INTERFACE_DEFINED__
#ifndef __IShellItemArray_INTERFACE_DEFINED__
#define __IShellItemArray_INTERFACE_DEFINED__
// propsys.h
typedef /* [v1_enum] */
enum GETPROPERTYSTOREFLAGS
{
GPS_DEFAULT = 0,
GPS_HANDLERPROPERTIESONLY = 0x1,
GPS_READWRITE = 0x2,
GPS_TEMPORARY = 0x4,
GPS_FASTPROPERTIESONLY = 0x8,
GPS_OPENSLOWITEM = 0x10,
GPS_DELAYCREATION = 0x20,
GPS_BESTEFFORT = 0x40,
GPS_NO_OPLOCK = 0x80,
GPS_PREFERQUERYPROPERTIES = 0x100,
GPS_EXTRINSICPROPERTIES = 0x200,
GPS_EXTRINSICPROPERTIESONLY = 0x400,
GPS_VOLATILEPROPERTIES = 0x800,
GPS_VOLATILEPROPERTIESONLY = 0x1000,
GPS_MASK_VALID = 0x1fff
} GETPROPERTYSTOREFLAGS;
// DEFINE_ENUM_FLAG_OPERATORS(GETPROPERTYSTOREFLAGS)
#ifndef PROPERTYKEY_DEFINED
#define PROPERTYKEY_DEFINED
typedef
struct
{
GUID fmtid;
DWORD pid;
} PROPERTYKEY;
#endif // PROPERTYKEY_DEFINED
// propkeydef.h
#define REFPROPERTYKEY const PROPERTYKEY &
#ifdef INITGUID
#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid }
#else
#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name
#endif // INITGUID
// <shobjidl_core.h>
typedef /* [v1_enum] */
enum SIATTRIBFLAGS
{
SIATTRIBFLAGS_AND = 0x1,
SIATTRIBFLAGS_OR = 0x2,
SIATTRIBFLAGS_APPCOMPAT = 0x3,
SIATTRIBFLAGS_MASK = 0x3,
SIATTRIBFLAGS_ALLITEMS = 0x4000
} SIATTRIBFLAGS;
// DEFINE_ENUM_FLAG_OPERATORS(SIATTRIBFLAGS)
// MIDL_INTERFACE("70629033-e363-4a28-a567-0db78006e6d7")
DEFINE_GUID(IID_IEnumShellItems, 0x70629033, 0xe363, 0xe363, 0xa5, 0x67, 0x0d, 0xb7, 0x80, 0x06, 0xe6, 0xd7);
struct IEnumShellItems : public IUnknown
{
STDMETHOD (Next) (ULONG celt, IShellItem **rgelt, ULONG *pceltFetched) = 0;
STDMETHOD (Skip) (ULONG celt) = 0;
STDMETHOD (Reset) (void) = 0;
STDMETHOD (Clone) (IEnumShellItems **ppenum) = 0;
};
// MIDL_INTERFACE("b63ea76d-1f85-456f-a19c-48159efa858b")
DEFINE_GUID(IID_IShellItemArray, 0xb63ea76d, 0x1f85, 0x456f, 0xa1, 0x9c, 0x48, 0x15, 0x9e, 0xfa, 0x85, 0x8b);
struct IShellItemArray : public IUnknown
{
STDMETHOD (BindToHandler) (IBindCtx *pbc, REFGUID bhid, REFIID riid, void **ppvOut) = 0;
STDMETHOD (GetPropertyStore) (GETPROPERTYSTOREFLAGS flags, REFIID riid, void **ppv) = 0;
STDMETHOD (GetPropertyDescriptionList) (REFPROPERTYKEY keyType, REFIID riid, void **ppv) = 0;
STDMETHOD (GetAttributes) ( SIATTRIBFLAGS AttribFlags, SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) = 0;
STDMETHOD (GetCount) (DWORD *pdwNumItems) = 0;
STDMETHOD (GetItemAt) (DWORD dwIndex, IShellItem **ppsi) = 0;
STDMETHOD (EnumItems) (IEnumShellItems **ppenumShellItems) = 0;
};
#ifndef __IEnumExplorerCommand_INTERFACE_DEFINED__
#define __IEnumExplorerCommand_INTERFACE_DEFINED__
struct IExplorerCommand;
// MIDL_INTERFACE("a88826f8-186f-4987-aade-ea0cef8fbfe8")
DEFINE_GUID(IID_IEnumExplorerCommand , 0xa88826f8, 0x186f, 0x4987, 0xaa, 0xde, 0xea, 0x0c, 0xef, 0x8f, 0xbf, 0xe8);
struct IEnumExplorerCommand : public IUnknown
{
STDMETHOD (Next) (ULONG celt, IExplorerCommand **pUICommand, ULONG *pceltFetched) = 0;
STDMETHOD (Skip) (ULONG celt) = 0;
STDMETHOD (Reset) (void) = 0;
STDMETHOD (Clone) (IEnumExplorerCommand **ppenum) = 0;
};
enum _EXPCMDSTATE
{
ECS_ENABLED = 0,
ECS_DISABLED = 0x1,
ECS_HIDDEN = 0x2,
ECS_CHECKBOX = 0x4,
ECS_CHECKED = 0x8,
ECS_RADIOCHECK = 0x10
};
typedef DWORD EXPCMDSTATE;
/* [v1_enum] */
enum _EXPCMDFLAGS
{
ECF_DEFAULT = 0,
ECF_HASSUBCOMMANDS = 0x1,
ECF_HASSPLITBUTTON = 0x2,
ECF_HIDELABEL = 0x4,
ECF_ISSEPARATOR = 0x8,
ECF_HASLUASHIELD = 0x10,
ECF_SEPARATORBEFORE = 0x20,
ECF_SEPARATORAFTER = 0x40,
ECF_ISDROPDOWN = 0x80,
ECF_TOGGLEABLE = 0x100,
ECF_AUTOMENUICONS = 0x200
};
typedef DWORD EXPCMDFLAGS;
// MIDL_INTERFACE("a08ce4d0-fa25-44ab-b57c-c7b1c323e0b9")
DEFINE_GUID(IID_IExplorerCommand, 0xa08ce4d0, 0xfa25, 0x44ab, 0xb5, 0x7c, 0xc7, 0xb1, 0xc3, 0x23, 0xe0, 0xb9);
struct IExplorerCommand : public IUnknown
{
STDMETHOD (GetTitle) (IShellItemArray *psiItemArray, LPWSTR *ppszName) = 0;
STDMETHOD (GetIcon) (IShellItemArray *psiItemArray, LPWSTR *ppszIcon) = 0;
STDMETHOD (GetToolTip) (IShellItemArray *psiItemArray, LPWSTR *ppszInfotip) = 0;
STDMETHOD (GetCanonicalName) (GUID *pguidCommandName) = 0;
STDMETHOD (GetState) (IShellItemArray *psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE *pCmdState) = 0;
STDMETHOD (Invoke) (IShellItemArray *psiItemArray, IBindCtx *pbc) = 0;
STDMETHOD (GetFlags) (EXPCMDFLAGS *pFlags) = 0;
STDMETHOD (EnumSubCommands) (IEnumExplorerCommand **ppEnum) = 0;
};
#endif // IShellItemArray
#endif // __IEnumExplorerCommand_INTERFACE_DEFINED__
#endif // USE_SYS_shobjidl_core
#endif // __MY_EXPLORER_COMMAND_H
@@ -0,0 +1,43 @@
// MyMessages.cpp
#include "StdAfx.h"
#include "MyMessages.h"
#include "../../../Windows/ErrorMsg.h"
#include "../../../Windows/ResourceString.h"
#include "../FileManager/LangUtils.h"
using namespace NWindows;
extern bool g_DisableUserQuestions;
void ShowErrorMessage(HWND window, LPCWSTR message)
{
if (!g_DisableUserQuestions)
::MessageBoxW(window, message, L"7-Zip", MB_OK | MB_ICONSTOP);
}
void ShowErrorMessageHwndRes(HWND window, UInt32 resID)
{
UString s = LangString(resID);
if (s.IsEmpty())
s.Add_UInt32(resID);
ShowErrorMessage(window, s);
}
void ShowErrorMessageRes(UInt32 resID)
{
ShowErrorMessageHwndRes(NULL, resID);
}
static void ShowErrorMessageDWORD(HWND window, DWORD errorCode)
{
ShowErrorMessage(window, NError::MyFormatMessage(errorCode));
}
void ShowLastErrorMessage(HWND window)
{
ShowErrorMessageDWORD(window, ::GetLastError());
}
@@ -0,0 +1,16 @@
// MyMessages.h
#ifndef ZIP7_INC_MY_MESSAGES_H
#define ZIP7_INC_MY_MESSAGES_H
#include "../../../Common/MyString.h"
void ShowErrorMessage(HWND window, LPCWSTR message);
inline void ShowErrorMessage(LPCWSTR message) { ShowErrorMessage(NULL, message); }
void ShowErrorMessageHwndRes(HWND window, UInt32 langID);
void ShowErrorMessageRes(UInt32 langID);
void ShowLastErrorMessage(HWND window = NULL);
#endif
@@ -0,0 +1,225 @@
// RegistryContextMenu.cpp
#include "StdAfx.h"
#include "../../../Common/StringConvert.h"
#include "../../../Windows/Registry.h"
#include "RegistryContextMenu.h"
using namespace NWindows;
using namespace NRegistry;
#ifndef UNDER_CE
// does extension can work, if Approved is removed ?
// CLISID (and Approved ?) items are separated for 32-bit and 64-bit code.
// shellex items shared by 32-bit and 64-bit code?
#define k_Clsid_A "{23170F69-40C1-278A-1000-000100020000}"
static LPCTSTR const k_Clsid = TEXT(k_Clsid_A);
static LPCTSTR const k_ShellExtName = TEXT("7-Zip Shell Extension");
static LPCTSTR const k_Approved = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved");
static LPCTSTR const k_Inproc = TEXT("InprocServer32");
static LPCSTR const k_KeyPostfix_ContextMenu = "\\shellex\\ContextMenuHandlers\\7-Zip";
static LPCSTR const k_KeyPostfix_DragDrop = "\\shellex\\DragDropHandlers\\7-Zip";
static LPCSTR const k_KeyName_File = "*";
static LPCSTR const k_KeyName_Folder = "Folder";
static LPCSTR const k_KeyName_Directory = "Directory";
static LPCSTR const k_KeyName_Drive = "Drive";
static LPCSTR const k_shellex_Prefixes[] =
{
k_KeyName_File,
k_KeyName_Folder,
k_KeyName_Directory,
k_KeyName_Drive
};
static const bool k_shellex_Statuses[2][4] =
{
{ true, true, true, false },
{ false, false, true, true }
};
// RegDeleteKeyExW is supported starting from win2003sp1/xp-pro-x64
// Z7_WIN32_WINNT_MIN < 0x0600 // Vista
#if !defined(Z7_WIN32_WINNT_MIN) \
|| Z7_WIN32_WINNT_MIN < 0x0502 /* < win2003 */ \
|| Z7_WIN32_WINNT_MIN == 0x0502 && !defined(_M_AMD64)
#define Z7_USE_DYN_RegDeleteKeyExW
#endif
#ifdef Z7_USE_DYN_RegDeleteKeyExW
Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
typedef
// WINADVAPI
LONG (APIENTRY *Func_RegDeleteKeyExW)(HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired, DWORD Reserved);
static Func_RegDeleteKeyExW func_RegDeleteKeyExW;
static void Init_RegDeleteKeyExW()
{
if (!func_RegDeleteKeyExW)
func_RegDeleteKeyExW = Z7_GET_PROC_ADDRESS(
Func_RegDeleteKeyExW, GetModuleHandleW(L"advapi32.dll"),
"RegDeleteKeyExW");
}
#define INIT_REG_WOW if (wow != 0) Init_RegDeleteKeyExW();
#else
#define INIT_REG_WOW
#endif
static LONG MyRegistry_DeleteKey(HKEY parentKey, LPCTSTR name, UInt32 wow)
{
if (wow == 0)
return RegDeleteKey(parentKey, name);
#ifdef Z7_USE_DYN_RegDeleteKeyExW
if (!func_RegDeleteKeyExW)
return E_NOTIMPL;
return func_RegDeleteKeyExW
#else
return RegDeleteKeyExW
#endif
(parentKey, GetUnicodeString(name), wow, 0);
}
static LONG MyRegistry_DeleteKey_HKCR(LPCTSTR name, UInt32 wow)
{
return MyRegistry_DeleteKey(HKEY_CLASSES_ROOT, name, wow);
}
// static NSynchronization::CCriticalSection g_CS;
static AString Get_ContextMenuHandler_KeyName(LPCSTR keyName)
{ return (AString)keyName + k_KeyPostfix_ContextMenu; }
/*
static CSysString Get_DragDropHandler_KeyName(LPCTSTR keyName)
{ return (AString)keyName + k_KeyPostfix_DragDrop); }
*/
static bool CheckHandlerCommon(const AString &keyName, UInt32 wow)
{
CKey key;
if (key.Open(HKEY_CLASSES_ROOT, (CSysString)keyName, KEY_READ | wow) != ERROR_SUCCESS)
return false;
CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false;
return StringsAreEqualNoCase_Ascii(value, k_Clsid_A);
}
bool CheckContextMenuHandler(const UString &path, UInt32 wow)
{
// NSynchronization::CCriticalSectionLock lock(g_CS);
CSysString s ("CLSID\\");
s += k_Clsid_A;
s += "\\InprocServer32";
{
NRegistry::CKey key;
if (key.Open(HKEY_CLASSES_ROOT, s, KEY_READ | wow) != ERROR_SUCCESS)
return false;
UString regPath;
if (key.QueryValue(NULL, regPath) != ERROR_SUCCESS)
return false;
if (!path.IsEqualTo_NoCase(regPath))
return false;
}
return
CheckHandlerCommon(Get_ContextMenuHandler_KeyName(k_KeyName_File), wow);
/*
&& CheckHandlerCommon(Get_ContextMenuHandler_KeyName(k_KeyName_Directory), wow)
// && CheckHandlerCommon(Get_ContextMenuHandler_KeyName(k_KeyName_Folder))
&& CheckHandlerCommon(Get_DragDropHandler_KeyName(k_KeyName_Directory), wow)
&& CheckHandlerCommon(Get_DragDropHandler_KeyName(k_KeyName_Drive), wow);
*/
}
static LONG MyCreateKey(CKey &key, HKEY parentKey, LPCTSTR keyName, UInt32 wow)
{
return key.Create(parentKey, keyName, REG_NONE,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | wow);
}
LONG SetContextMenuHandler(bool setMode, const UString &path, UInt32 wow)
{
// NSynchronization::CCriticalSectionLock lock(g_CS);
INIT_REG_WOW
LONG res;
{
CSysString s ("CLSID\\");
s += k_Clsid_A;
if (setMode)
{
{
CKey key;
res = MyCreateKey(key, HKEY_CLASSES_ROOT, s, wow);
if (res == ERROR_SUCCESS)
{
key.SetValue(NULL, k_ShellExtName);
CKey keyInproc;
res = MyCreateKey(keyInproc, key, k_Inproc, wow);
if (res == ERROR_SUCCESS)
{
res = keyInproc.SetValue(NULL, path);
keyInproc.SetValue(TEXT("ThreadingModel"), TEXT("Apartment"));
}
}
}
{
CKey key;
if (MyCreateKey(key, HKEY_LOCAL_MACHINE, k_Approved, wow) == ERROR_SUCCESS)
key.SetValue(k_Clsid, k_ShellExtName);
}
}
else
{
CSysString s2 (s);
s2 += "\\InprocServer32";
MyRegistry_DeleteKey_HKCR(s2, wow);
res = MyRegistry_DeleteKey_HKCR(s, wow);
}
}
// shellex items probably are shared beween 32-bit and 64-bit apps. So we don't delete items for delete operation.
if (setMode)
for (unsigned i = 0; i < 2; i++)
{
for (unsigned k = 0; k < Z7_ARRAY_SIZE(k_shellex_Prefixes); k++)
{
CSysString s (k_shellex_Prefixes[k]);
s += (i == 0 ? k_KeyPostfix_ContextMenu : k_KeyPostfix_DragDrop);
if (k_shellex_Statuses[i][k])
{
CKey key;
MyCreateKey(key, HKEY_CLASSES_ROOT, s, wow);
key.SetValue(NULL, k_Clsid);
}
else
MyRegistry_DeleteKey_HKCR(s, wow);
}
}
return res;
}
#endif
@@ -0,0 +1,13 @@
// RegistryContextMenu.h
#ifndef ZIP7_INC_REGISTRY_CONTEXT_MENU_H
#define ZIP7_INC_REGISTRY_CONTEXT_MENU_H
#ifndef UNDER_CE
bool CheckContextMenuHandler(const UString &path, UInt32 wow = 0);
LONG SetContextMenuHandler(bool setMode, const UString &path, UInt32 wow = 0);
#endif
#endif
@@ -0,0 +1,3 @@
// StdAfx.cpp
#include "StdAfx.h"
@@ -0,0 +1,6 @@
// StdAfx.h
#if _MSC_VER >= 1800
#pragma warning(disable : 4464) // relative include path contains '..'
#endif
#include "../FileManager/StdAfx.h"
@@ -0,0 +1,78 @@
PROG = 7-zip.dll
DEF_FILE = Explorer.def
CFLAGS = $(CFLAGS) \
-DZ7_LANG \
!IFDEF UNDER_CE
LIBS = $(LIBS) Commctrl.lib
!ELSE
LIBS = $(LIBS) htmlhelp.lib comdlg32.lib Mpr.lib Gdi32.lib
# CFLAGS = $(CFLAGS) -DZ7_LONG_PATH
# -DZ7_NO_LARGE_PAGES
!ENDIF
EXPLORER_OBJS = \
$O\DllExportsExplorer.obj \
$O\ContextMenu.obj \
$O\MyMessages.obj \
COMMON_OBJS = \
$O\IntToString.obj \
$O\Lang.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\Random.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\TimeUtils.obj \
$O\Window.obj \
!IFDEF UNDER_CE
WIN_OBJS = $(WIN_OBJS) \
$O\CommonDialog.obj \
!ENDIF
WIN_CTRL_OBJS = \
$O\Dialog.obj \
$O\ListView.obj \
UI_COMMON_OBJS = \
$O\ArchiveName.obj \
$O\CompressCall.obj \
$O\ExtractingFilePath.obj \
$O\ZipRegistry.obj \
FM_OBJS = \
$O\FormatUtils.obj \
$O\HelpUtils.obj \
$O\LangUtils.obj \
$O\ProgramLocation.obj \
$O\PropertyName.obj \
$O\RegistryUtils.obj \
C_OBJS = \
$O\CpuArch.obj \
$O\Threads.obj \
!include "../../Sort.mak"
!include "../../7zip.mak"
@@ -0,0 +1,15 @@
#define IDS_CONTEXT_FOLDER 2320
#define IDS_CONTEXT_ARCHIVE 2321
#define IDS_CONTEXT_OPEN 2322
#define IDS_CONTEXT_EXTRACT 2323
#define IDS_CONTEXT_COMPRESS 2324
#define IDS_CONTEXT_TEST 2325
#define IDS_CONTEXT_EXTRACT_HERE 2326
#define IDS_CONTEXT_EXTRACT_TO 2327
#define IDS_CONTEXT_COMPRESS_TO 2328
#define IDS_CONTEXT_COMPRESS_EMAIL 2329
#define IDS_CONTEXT_COMPRESS_TO_EMAIL 2330
#define IDS_SELECT_FILES 3015
#define IDB_MENU_LOGO 190
@@ -0,0 +1,10 @@
#include "../../MyVersionInfo.rc"
#include "resource2.rc"
MY_VERSION_INFO_DLL("7-Zip Shell Extension", "7-zip")
#ifndef UNDER_CE
1 24 MOVEABLE PURE "7-zip.dll.manifest"
#endif
IDI_ICON ICON "../FileManager/FM.ico"
@@ -0,0 +1,19 @@
#include "resource.h"
STRINGTABLE
BEGIN
IDS_CONTEXT_FOLDER "<Folder>"
IDS_CONTEXT_ARCHIVE "<Archive>"
IDS_CONTEXT_OPEN "Open archive"
IDS_CONTEXT_EXTRACT "Extract files..."
IDS_CONTEXT_COMPRESS "Add to archive..."
IDS_CONTEXT_TEST "Test archive"
IDS_CONTEXT_EXTRACT_HERE "Extract Here"
IDS_CONTEXT_EXTRACT_TO "Extract to {0}"
IDS_CONTEXT_COMPRESS_TO "Add to {0}"
IDS_CONTEXT_COMPRESS_EMAIL "Compress and email..."
IDS_CONTEXT_COMPRESS_TO_EMAIL "Compress to {0} and email"
IDS_SELECT_FILES "You must select one or more files"
END
IDB_MENU_LOGO BITMAP "../../UI/Explorer/MenuLogo.bmp"