mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 07:14:56 -06:00
9.17
This commit is contained in:
committed by
Kornel Lesiński
parent
044e4bb741
commit
2eb60a0598
@@ -1,8 +0,0 @@
|
||||
// CLSIDConst.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <initguid.h>
|
||||
|
||||
#include "../Agent/Agent.h"
|
||||
#include "../../IPassword.h"
|
||||
@@ -57,20 +57,21 @@ STDMETHODIMP CExtractCallBackImp::AskOverwrite(
|
||||
Int32 *answer)
|
||||
{
|
||||
NOverwriteDialog::CFileInfo oldFileInfo, newFileInfo;
|
||||
oldFileInfo.Time = *existTime;
|
||||
oldFileInfo.TimeIsDefined = (existTime != 0);
|
||||
if (oldFileInfo.TimeIsDefined)
|
||||
oldFileInfo.Time = *existTime;
|
||||
oldFileInfo.SizeIsDefined = (existSize != NULL);
|
||||
if (oldFileInfo.SizeIsDefined)
|
||||
oldFileInfo.Size = *existSize;
|
||||
oldFileInfo.Name = GetSystemString(existName, m_CodePage);
|
||||
oldFileInfo.Name = existName;
|
||||
|
||||
newFileInfo.TimeIsDefined = (newTime != 0);
|
||||
if (newFileInfo.TimeIsDefined)
|
||||
newFileInfo.Time = *newTime;
|
||||
|
||||
newFileInfo.SizeIsDefined = (newSize != NULL);
|
||||
if (newFileInfo.SizeIsDefined)
|
||||
newFileInfo.Size = *newSize;
|
||||
newFileInfo.Name = GetSystemString(newName, m_CodePage);
|
||||
newFileInfo.Name = newName;
|
||||
|
||||
NOverwriteDialog::NResult::EEnum result =
|
||||
NOverwriteDialog::Execute(oldFileInfo, newFileInfo);
|
||||
|
||||
@@ -1,20 +1,34 @@
|
||||
; 7-ZipFar.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "7-ZipFar"
|
||||
DESCRIPTION '7-ZipFar Windows Dynamic Link Library'
|
||||
|
||||
EXPORTS
|
||||
SetStartupInfo = _SetStartupInfo@4
|
||||
OpenPlugin = _OpenPlugin@8
|
||||
OpenFilePlugin = _OpenFilePlugin@12
|
||||
ClosePlugin = _ClosePlugin@4
|
||||
GetFindData = _GetFindData@16
|
||||
FreeFindData = _FreeFindData@12
|
||||
SetDirectory = _SetDirectory@12
|
||||
GetPluginInfo = _GetPluginInfo@4
|
||||
Configure = _Configure@4
|
||||
GetOpenPluginInfo = _GetOpenPluginInfo@8
|
||||
GetFiles = _GetFiles@24
|
||||
PutFiles = _PutFiles@20
|
||||
DeleteFiles = _DeleteFiles@16
|
||||
ProcessKey = _ProcessKey@12
|
||||
SetStartupInfo
|
||||
OpenPlugin
|
||||
OpenFilePlugin
|
||||
ClosePlugin
|
||||
GetFindData
|
||||
FreeFindData
|
||||
SetDirectory
|
||||
GetPluginInfo
|
||||
Configure
|
||||
GetOpenPluginInfo
|
||||
GetFiles
|
||||
PutFiles
|
||||
DeleteFiles
|
||||
ProcessKey
|
||||
|
||||
;SetStartupInfoW
|
||||
;OpenPluginW
|
||||
;OpenFilePluginW
|
||||
;ClosePluginW
|
||||
;GetFindDataW
|
||||
;FreeFindDataW
|
||||
;SetDirectoryW
|
||||
;GetPluginInfoW
|
||||
;ConfigureW
|
||||
;GetOpenPluginInfoW
|
||||
;GetFilesW
|
||||
;PutFilesW
|
||||
;DeleteFilesW
|
||||
;ProcessKeyW
|
||||
|
||||
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
||||
# 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 /nologo /dll /machine:I386 /out:"C:\Program Files\Far\Plugins\7-Zip\7-ZipFar.dll" /opt:NOWIN98
|
||||
# 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 /nologo /dll /machine:I386 /out:"C:\Program Files\Far2\Plugins\7-Zip\7-ZipFar.dll" /opt:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "Far - Win32 Debug"
|
||||
@@ -80,7 +80,7 @@ BSC32=bscmake.exe
|
||||
# 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 /nologo /dll /debug /machine:I386 /out:"C:\Program Files\Far\Plugins\7-Zip\7-ZipFar.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 /nologo /dll /debug /machine:I386 /out:"C:\Program Files\Far2\Plugins\7-Zip\7-ZipFar.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -93,10 +93,6 @@ LINK32=link.exe
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CLSIDConst.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Far.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -1,18 +1,37 @@
|
||||
// FarPlugin.h
|
||||
|
||||
#ifndef __FARPLUGIN_H
|
||||
#define __FARPLUGIN_H
|
||||
// #include "plugin.hpp"
|
||||
|
||||
const int kInfoPanelLineSize = 80;
|
||||
|
||||
// #define __FAR_PLUGIN_H
|
||||
|
||||
#ifdef UNDER_CE
|
||||
typedef struct _CHAR_INFO {
|
||||
union {
|
||||
WCHAR UnicodeChar;
|
||||
CHAR AsciiChar;
|
||||
} Char;
|
||||
WORD Attributes;
|
||||
} CHAR_INFO, *PCHAR_INFO;
|
||||
#endif
|
||||
|
||||
#ifndef __FAR_PLUGIN_H
|
||||
#define __FAR_PLUGIN_H
|
||||
|
||||
#ifndef _WIN64
|
||||
#if defined(__BORLANDC__) && (__BORLANDC <= 0x520)
|
||||
#pragma option -a1
|
||||
#elif defined(__GNUC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1100))
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _MSC_VER
|
||||
#define _export
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define NM 260
|
||||
|
||||
@@ -41,8 +60,9 @@ struct PluginPanelItem
|
||||
char *Owner;
|
||||
char **CustomColumnData;
|
||||
int CustomColumnNumber;
|
||||
DWORD UserData;
|
||||
DWORD Reserved[3];
|
||||
DWORD_PTR UserData;
|
||||
DWORD CRC32;
|
||||
DWORD_PTR Reserved[2];
|
||||
};
|
||||
|
||||
#define PPIF_PROCESSDESCR 0x80000000
|
||||
@@ -58,7 +78,7 @@ enum {
|
||||
|
||||
|
||||
typedef int (WINAPI *FARAPIMENU)(
|
||||
int PluginNumber,
|
||||
INT_PTR PluginNumber,
|
||||
int X,
|
||||
int Y,
|
||||
int MaxHeight,
|
||||
@@ -73,7 +93,7 @@ typedef int (WINAPI *FARAPIMENU)(
|
||||
);
|
||||
|
||||
typedef int (WINAPI *FARAPIDIALOG)(
|
||||
int PluginNumber,
|
||||
INT_PTR PluginNumber,
|
||||
int X1,
|
||||
int Y1,
|
||||
int X2,
|
||||
@@ -92,7 +112,7 @@ enum {
|
||||
};
|
||||
|
||||
typedef int (WINAPI *FARAPIMESSAGE)(
|
||||
int PluginNumber,
|
||||
INT_PTR PluginNumber,
|
||||
unsigned int Flags,
|
||||
char *HelpTopic,
|
||||
char **Items,
|
||||
@@ -101,7 +121,7 @@ typedef int (WINAPI *FARAPIMESSAGE)(
|
||||
);
|
||||
|
||||
typedef char* (WINAPI *FARAPIGETMSG)(
|
||||
int PluginNumber,
|
||||
INT_PTR PluginNumber,
|
||||
int MsgId
|
||||
);
|
||||
|
||||
@@ -194,7 +214,8 @@ struct PanelInfo
|
||||
char CurDir[NM];
|
||||
int ShortNames;
|
||||
int SortMode;
|
||||
DWORD Reserved[2];
|
||||
DWORD Flags;
|
||||
DWORD Reserved;
|
||||
};
|
||||
|
||||
|
||||
@@ -222,7 +243,7 @@ typedef int (WINAPI *FARAPIGETDIRLIST)(
|
||||
);
|
||||
|
||||
typedef int (WINAPI *FARAPIGETPLUGINDIRLIST)(
|
||||
int PluginNumber,
|
||||
INT_PTR PluginNumber,
|
||||
HANDLE hPlugin,
|
||||
char *Dir,
|
||||
struct PluginPanelItem **pPanelItem,
|
||||
@@ -294,126 +315,11 @@ typedef int (WINAPI *FARAPIEDITORCONTROL)(
|
||||
void *Param
|
||||
);
|
||||
|
||||
|
||||
enum EDITOR_EVENTS {
|
||||
EE_READ,EE_SAVE,EE_REDRAW,EE_CLOSE
|
||||
};
|
||||
|
||||
enum EDITOR_CONTROL_COMMANDS {
|
||||
ECTL_GETSTRING,ECTL_SETSTRING,ECTL_INSERTSTRING,ECTL_DELETESTRING,
|
||||
ECTL_DELETECHAR,ECTL_INSERTTEXT,ECTL_GETINFO,ECTL_SETPOSITION,
|
||||
ECTL_SELECT,ECTL_REDRAW,ECTL_EDITORTOOEM,ECTL_OEMTOEDITOR,
|
||||
ECTL_TABTOREAL,ECTL_REALTOTAB,ECTL_EXPANDTABS,ECTL_SETTITLE,
|
||||
ECTL_READINPUT,ECTL_PROCESSINPUT,ECTL_ADDCOLOR,ECTL_GETCOLOR
|
||||
};
|
||||
|
||||
|
||||
struct EditorGetString
|
||||
{
|
||||
int StringNumber;
|
||||
char *StringText;
|
||||
char *StringEOL;
|
||||
int StringLength;
|
||||
int SelStart;
|
||||
int SelEnd;
|
||||
};
|
||||
|
||||
|
||||
struct EditorSetString
|
||||
{
|
||||
int StringNumber;
|
||||
char *StringText;
|
||||
char *StringEOL;
|
||||
int StringLength;
|
||||
};
|
||||
|
||||
|
||||
enum EDITOR_OPTIONS {
|
||||
EOPT_EXPANDTABS=1,EOPT_PERSISTENTBLOCKS=2,EOPT_DELREMOVESBLOCKS=4,
|
||||
EOPT_AUTOINDENT=8,EOPT_SAVEFILEPOSITION=16,EOPT_AUTODETECTTABLE=32,
|
||||
EOPT_CURSORBEYONDEOL=64
|
||||
};
|
||||
|
||||
|
||||
enum EDITOR_BLOCK_TYPES {
|
||||
BTYPE_NONE,BTYPE_STREAM,BTYPE_COLUMN
|
||||
};
|
||||
|
||||
|
||||
struct EditorInfo
|
||||
{
|
||||
int EditorID;
|
||||
char *FileName;
|
||||
int WindowSizeX;
|
||||
int WindowSizeY;
|
||||
int TotalLines;
|
||||
int CurLine;
|
||||
int CurPos;
|
||||
int CurTabPos;
|
||||
int TopScreenLine;
|
||||
int LeftPos;
|
||||
int Overtype;
|
||||
int BlockType;
|
||||
int BlockStartLine;
|
||||
int AnsiMode;
|
||||
int TableNum;
|
||||
DWORD Options;
|
||||
int TabSize;
|
||||
DWORD Reserved[8];
|
||||
};
|
||||
|
||||
|
||||
struct EditorSetPosition
|
||||
{
|
||||
int CurLine;
|
||||
int CurPos;
|
||||
int CurTabPos;
|
||||
int TopScreenLine;
|
||||
int LeftPos;
|
||||
int Overtype;
|
||||
};
|
||||
|
||||
|
||||
struct EditorSelect
|
||||
{
|
||||
int BlockType;
|
||||
int BlockStartLine;
|
||||
int BlockStartPos;
|
||||
int BlockWidth;
|
||||
int BlockHeight;
|
||||
};
|
||||
|
||||
|
||||
struct EditorConvertText
|
||||
{
|
||||
char *Text;
|
||||
int TextLength;
|
||||
};
|
||||
|
||||
|
||||
struct EditorConvertPos
|
||||
{
|
||||
int StringNumber;
|
||||
int SrcPos;
|
||||
int DestPos;
|
||||
};
|
||||
|
||||
|
||||
struct EditorColor
|
||||
{
|
||||
int StringNumber;
|
||||
int ColorItem;
|
||||
int StartPos;
|
||||
int EndPos;
|
||||
int Color;
|
||||
};
|
||||
|
||||
|
||||
struct PluginStartupInfo
|
||||
{
|
||||
int StructSize;
|
||||
char ModuleName[NM];
|
||||
int ModuleNumber;
|
||||
INT_PTR ModuleNumber;
|
||||
char *RootKey;
|
||||
FARAPIMENU Menu;
|
||||
FARAPIDIALOG Dialog;
|
||||
@@ -456,8 +362,6 @@ struct PluginInfo
|
||||
char *CommandPrefix;
|
||||
};
|
||||
|
||||
const int kInfoPanelLineSize = 80;
|
||||
|
||||
struct InfoPanelLine
|
||||
{
|
||||
char Text[kInfoPanelLineSize];
|
||||
@@ -567,6 +471,7 @@ enum OPERATION_MODES {
|
||||
OPM_DESCR=32
|
||||
};
|
||||
|
||||
#ifndef _WIN64
|
||||
#if defined(__BORLANDC__) && (__BORLANDC <= 0x520)
|
||||
#pragma option -a.
|
||||
#elif defined(__GNUC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1100))
|
||||
@@ -574,5 +479,41 @@ enum OPERATION_MODES {
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
void WINAPI _export ClosePluginW(HANDLE hPlugin);
|
||||
int WINAPI _export CompareW(HANDLE hPlugin,const struct PluginPanelItem *Item1,const struct PluginPanelItem *Item2,unsigned int Mode);
|
||||
int WINAPI _export ConfigureW(int ItemNumber);
|
||||
int WINAPI _export DeleteFilesW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int OpMode);
|
||||
void WINAPI _export ExitFARW(void);
|
||||
void WINAPI _export FreeFindDataW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber);
|
||||
void WINAPI _export FreeVirtualFindDataW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber);
|
||||
int WINAPI _export GetFilesW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int Move,const wchar_t **DestPath,int OpMode);
|
||||
int WINAPI _export GetFindDataW(HANDLE hPlugin,struct PluginPanelItem **pPanelItem,int *pItemsNumber,int OpMode);
|
||||
int WINAPI _export GetMinFarVersionW(void);
|
||||
void WINAPI _export GetOpenPluginInfoW(HANDLE hPlugin,struct OpenPluginInfo *Info);
|
||||
void WINAPI _export GetPluginInfoW(struct PluginInfo *Info);
|
||||
int WINAPI _export GetVirtualFindDataW(HANDLE hPlugin,struct PluginPanelItem **pPanelItem,int *pItemsNumber,const wchar_t *Path);
|
||||
int WINAPI _export MakeDirectoryW(HANDLE hPlugin,const wchar_t **Name,int OpMode);
|
||||
HANDLE WINAPI _export OpenFilePluginW(const wchar_t *Name,const unsigned char *Data,int DataSize,int OpMode);
|
||||
HANDLE WINAPI _export OpenPluginW(int OpenFrom,INT_PTR Item);
|
||||
int WINAPI _export ProcessDialogEventW(int Event,void *Param);
|
||||
int WINAPI _export ProcessEditorEventW(int Event,void *Param);
|
||||
int WINAPI _export ProcessEditorInputW(const INPUT_RECORD *Rec);
|
||||
int WINAPI _export ProcessEventW(HANDLE hPlugin,int Event,void *Param);
|
||||
int WINAPI _export ProcessHostFileW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int OpMode);
|
||||
int WINAPI _export ProcessKeyW(HANDLE hPlugin,int Key,unsigned int ControlState);
|
||||
int WINAPI _export ProcessSynchroEventW(int Event,void *Param);
|
||||
int WINAPI _export ProcessViewerEventW(int Event,void *Param);
|
||||
int WINAPI _export PutFilesW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int Move,const wchar_t *SrcPath,int OpMode);
|
||||
int WINAPI _export SetDirectoryW(HANDLE hPlugin,const wchar_t *Dir,int OpMode);
|
||||
int WINAPI _export SetFindListW(HANDLE hPlugin,const struct PluginPanelItem *PanelItem,int ItemsNumber);
|
||||
void WINAPI _export SetStartupInfoW(const struct PluginStartupInfo *Info);
|
||||
|
||||
EXTERN_C_END
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#ifndef UNDER_CE
|
||||
#include "Windows/Console.h"
|
||||
#endif
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/Error.h"
|
||||
|
||||
#include "FarUtils.h"
|
||||
@@ -417,6 +420,9 @@ void PrintErrorMessage(const char *message, const wchar_t *text)
|
||||
|
||||
bool WasEscPressed()
|
||||
{
|
||||
#ifdef UNDER_CE
|
||||
return false;
|
||||
#else
|
||||
NConsole::CIn inConsole;
|
||||
HANDLE handle = ::GetStdHandle(STD_INPUT_HANDLE);
|
||||
if(handle == INVALID_HANDLE_VALUE)
|
||||
@@ -438,16 +444,16 @@ bool WasEscPressed()
|
||||
event.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShowErrorMessage(DWORD errorCode)
|
||||
{
|
||||
CSysString message;
|
||||
UString message;
|
||||
NError::MyFormatMessage(errorCode, message);
|
||||
message.Replace(TEXT("\x0D"), TEXT(""));
|
||||
message.Replace(TEXT("\x0A"), TEXT(" "));
|
||||
g_StartupInfo.ShowMessage(SystemStringToOemString(message));
|
||||
|
||||
message.Replace(L"\x0D", L"");
|
||||
message.Replace(L"\x0A", L" ");
|
||||
g_StartupInfo.ShowMessage(UnicodeStringToMultiByte(message, CP_OEMCP));
|
||||
}
|
||||
|
||||
void ShowLastErrorMessage()
|
||||
|
||||
@@ -21,8 +21,8 @@ using namespace NWindows;
|
||||
using namespace NFar;
|
||||
|
||||
static const char *kCommandPrefix = "7-zip";
|
||||
static const char *kRegisrtryMainKeyName = "";
|
||||
static const char *kRegisrtryValueNameEnabled = "UsedByDefault3";
|
||||
static const TCHAR *kRegisrtryMainKeyName = TEXT("");
|
||||
static const TCHAR *kRegisrtryValueNameEnabled = TEXT("UsedByDefault3");
|
||||
static const char *kHelpTopicConfig = "Config";
|
||||
static bool kPluginEnabledDefault = true;
|
||||
|
||||
@@ -30,11 +30,17 @@ HINSTANCE g_hInstance;
|
||||
|
||||
#define NT_CHECK_FAIL_ACTION return FALSE;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
|
||||
BOOL WINAPI DllMain(
|
||||
#ifdef UNDER_CE
|
||||
HANDLE
|
||||
#else
|
||||
HINSTANCE
|
||||
#endif
|
||||
hInstance, DWORD dwReason, LPVOID)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
g_hInstance = (HINSTANCE)hInstance;
|
||||
NT_CHECK
|
||||
}
|
||||
return TRUE;
|
||||
@@ -45,9 +51,9 @@ static struct COptions
|
||||
bool Enabled;
|
||||
} g_Options;
|
||||
|
||||
static const char *kPliginNameForRegestry = "7-ZIP";
|
||||
static const TCHAR *kPliginNameForRegestry = TEXT("7-ZIP");
|
||||
|
||||
EXTERN_C void WINAPI SetStartupInfo(struct PluginStartupInfo *info)
|
||||
EXTERN_C void WINAPI SetStartupInfo(const PluginStartupInfo *info)
|
||||
{
|
||||
MY_TRY_BEGIN;
|
||||
g_StartupInfo.Init(*info, kPliginNameForRegestry);
|
||||
@@ -325,11 +331,9 @@ HRESULT OpenArchive(const CSysString &fileName,
|
||||
}
|
||||
*/
|
||||
|
||||
static HANDLE MyOpenFilePlugin(const char *name)
|
||||
static HANDLE MyOpenFilePluginW(const wchar_t *name)
|
||||
{
|
||||
UINT codePage = ::AreFileApisANSI() ? CP_ACP : CP_OEMCP;
|
||||
|
||||
UString normalizedName = GetUnicodeString(name, codePage);
|
||||
UString normalizedName = name;
|
||||
normalizedName.Trim();
|
||||
UString fullName;
|
||||
int fileNamePartStartIndex;
|
||||
@@ -344,7 +348,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
|
||||
CMyComPtr<IInFolderArchive> archiveHandler;
|
||||
|
||||
// CArchiverInfo archiverInfoResult;
|
||||
// ::OutputDebugString("before OpenArchive\n");
|
||||
// ::OutputDebugStringA("before OpenArchive\n");
|
||||
|
||||
CScreenRestorer screenRestorer;
|
||||
{
|
||||
@@ -360,7 +364,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
|
||||
fullName.Left(fileNamePartStartIndex),
|
||||
fullName.Mid(fileNamePartStartIndex));
|
||||
|
||||
// ::OutputDebugString("before OpenArchive\n");
|
||||
// ::OutputDebugStringA("before OpenArchive\n");
|
||||
|
||||
archiveHandler = new CAgent;
|
||||
CMyComBSTR archiveType;
|
||||
@@ -377,7 +381,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
// ::OutputDebugString("after OpenArchive\n");
|
||||
// ::OutputDebugStringA("after OpenArchive\n");
|
||||
|
||||
CPlugin *plugin = new CPlugin(
|
||||
fullName,
|
||||
@@ -393,7 +397,18 @@ static HANDLE MyOpenFilePlugin(const char *name)
|
||||
return (HANDLE)(plugin);
|
||||
}
|
||||
|
||||
EXTERN_C HANDLE WINAPI OpenFilePlugin(char *name, const unsigned char * /* data */, unsigned int /* dataSize */)
|
||||
static HANDLE MyOpenFilePlugin(const char *name)
|
||||
{
|
||||
UINT codePage =
|
||||
#ifdef UNDER_CE
|
||||
CP_OEMCP;
|
||||
#else
|
||||
::AreFileApisANSI() ? CP_ACP : CP_OEMCP;
|
||||
#endif
|
||||
return MyOpenFilePluginW(GetUnicodeString(name, codePage));
|
||||
}
|
||||
|
||||
EXTERN_C HANDLE WINAPI OpenFilePlugin(char *name, const unsigned char * /* data */, int /* dataSize */)
|
||||
{
|
||||
MY_TRY_BEGIN;
|
||||
if (name == NULL || (!g_Options.Enabled))
|
||||
@@ -405,12 +420,27 @@ EXTERN_C HANDLE WINAPI OpenFilePlugin(char *name, const unsigned char * /* data
|
||||
MY_TRY_END2("OpenFilePlugin", INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, int item)
|
||||
/*
|
||||
EXTERN_C HANDLE WINAPI OpenFilePluginW(const wchar_t *name,const unsigned char *Data,int DataSize,int OpMode)
|
||||
{
|
||||
MY_TRY_BEGIN;
|
||||
if (name == NULL || (!g_Options.Enabled))
|
||||
{
|
||||
// if (!Opt.ProcessShiftF1)
|
||||
return(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
return MyOpenFilePluginW(name);
|
||||
::OutputDebugStringA("OpenFilePluginW\n");
|
||||
MY_TRY_END2("OpenFilePluginW", INVALID_HANDLE_VALUE);
|
||||
}
|
||||
*/
|
||||
|
||||
EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, INT_PTR item)
|
||||
{
|
||||
MY_TRY_BEGIN;
|
||||
if(openFrom == OPEN_COMMANDLINE)
|
||||
{
|
||||
CSysString fileName = (const char *)(UINT_PTR)item;
|
||||
AString fileName = (const char *)item;
|
||||
if(fileName.IsEmpty())
|
||||
return INVALID_HANDLE_VALUE;
|
||||
if (fileName.Length() >= 2 &&
|
||||
@@ -482,7 +512,7 @@ EXTERN_C int WINAPI GetFiles(HANDLE plugin, struct PluginPanelItem *panelItems,
|
||||
MY_TRY_END2("GetFiles", NFileOperationReturnCode::kError);
|
||||
}
|
||||
|
||||
EXTERN_C int WINAPI SetDirectory(HANDLE plugin, char *dir, int opMode)
|
||||
EXTERN_C int WINAPI SetDirectory(HANDLE plugin, const char *dir, int opMode)
|
||||
{
|
||||
MY_TRY_BEGIN;
|
||||
return(((CPlugin *)plugin)->SetDirectory(dir, opMode));
|
||||
|
||||
@@ -181,4 +181,4 @@ enum EEnum
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace NOverwriteDialog {
|
||||
|
||||
struct CFileInfoStrings
|
||||
{
|
||||
CSysString Size;
|
||||
CSysString Time;
|
||||
AString Size;
|
||||
AString Time;
|
||||
};
|
||||
|
||||
void SetFileInfoStrings(const CFileInfo &fileInfo,
|
||||
@@ -51,7 +51,7 @@ void SetFileInfoStrings(const CFileInfo &fileInfo,
|
||||
UString timeString = ConvertFileTimeToString(localFileTime);
|
||||
fileInfoStrings.Time = g_StartupInfo.GetMsgString(NMessageID::kOverwriteModifiedOn);
|
||||
fileInfoStrings.Time += " ";
|
||||
fileInfoStrings.Time += GetSystemString(timeString, CP_OEMCP);
|
||||
fileInfoStrings.Time += UnicodeStringToMultiByte(timeString, CP_OEMCP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,10 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf
|
||||
SetFileInfoStrings(oldFileInfo, oldFileInfoStrings);
|
||||
SetFileInfoStrings(newFileInfo, newFileInfoStrings);
|
||||
|
||||
struct CInitDialogItem anInitItems[]={
|
||||
AString oldName = UnicodeStringToMultiByte(oldFileInfo.Name, CP_OEMCP);
|
||||
AString newName = UnicodeStringToMultiByte(newFileInfo.Name, CP_OEMCP);
|
||||
|
||||
struct CInitDialogItem initItems[]={
|
||||
{ DI_DOUBLEBOX, 3, 1, kXSize - 4, kYSize - 2, false, false, 0, false, NMessageID::kOverwriteTitle, NULL, NULL },
|
||||
{ DI_TEXT, 5, 2, 0, 0, false, false, 0, false, NMessageID::kOverwriteMessage1, NULL, NULL },
|
||||
|
||||
@@ -74,13 +77,13 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf
|
||||
|
||||
{ DI_TEXT, 5, 4, 0, 0, false, false, 0, false, NMessageID::kOverwriteMessageWouldYouLike, NULL, NULL },
|
||||
|
||||
{ DI_TEXT, 7, 6, 0, 0, false, false, 0, false, -1, oldFileInfo.Name, NULL },
|
||||
{ DI_TEXT, 7, 6, 0, 0, false, false, 0, false, -1, oldName, NULL },
|
||||
{ DI_TEXT, 7, 7, 0, 0, false, false, 0, false, -1, oldFileInfoStrings.Size, NULL },
|
||||
{ DI_TEXT, 7, 8, 0, 0, false, false, 0, false, -1, oldFileInfoStrings.Time, NULL },
|
||||
|
||||
{ DI_TEXT, 5, 10, 0, 0, false, false, 0, false, NMessageID::kOverwriteMessageWithtTisOne, NULL, NULL },
|
||||
|
||||
{ DI_TEXT, 7, 12, 0, 0, false, false, 0, false, -1, newFileInfo.Name, NULL },
|
||||
{ DI_TEXT, 7, 12, 0, 0, false, false, 0, false, -1, newName, NULL },
|
||||
{ DI_TEXT, 7, 13, 0, 0, false, false, 0, false, -1, newFileInfoStrings.Size, NULL },
|
||||
{ DI_TEXT, 7, 14, 0, 0, false, false, 0, false, -1, newFileInfoStrings.Time, NULL },
|
||||
|
||||
@@ -94,9 +97,9 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf
|
||||
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kOverwriteCancel, NULL, NULL }
|
||||
};
|
||||
|
||||
const int kNumDialogItems = sizeof(anInitItems) / sizeof(anInitItems[0]);
|
||||
const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]);
|
||||
FarDialogItem aDialogItems[kNumDialogItems];
|
||||
g_StartupInfo.InitDialogItems(anInitItems, aDialogItems, kNumDialogItems);
|
||||
g_StartupInfo.InitDialogItems(initItems, aDialogItems, kNumDialogItems);
|
||||
int anAskCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
|
||||
NULL, aDialogItems, kNumDialogItems);
|
||||
const int kButtonStartPos = kNumDialogItems - 6;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#define OVERWRITEDIALOG_H
|
||||
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Types.h"
|
||||
|
||||
namespace NOverwriteDialog {
|
||||
|
||||
@@ -11,10 +12,11 @@ struct CFileInfo
|
||||
{
|
||||
bool SizeIsDefined;
|
||||
bool TimeIsDefined;
|
||||
UINT64 Size;
|
||||
UInt64 Size;
|
||||
FILETIME Time;
|
||||
CSysString Name;
|
||||
UString Name;
|
||||
};
|
||||
|
||||
namespace NResult
|
||||
{
|
||||
enum EEnum
|
||||
@@ -24,10 +26,11 @@ namespace NResult
|
||||
kNo,
|
||||
kNoToAll,
|
||||
kAutoRename,
|
||||
kCancel,
|
||||
kCancel
|
||||
};
|
||||
}
|
||||
NResult::EEnum Execute(const CFileInfo &anOldFileInfo, const CFileInfo &aNewFileInfo);
|
||||
|
||||
NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInfo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
|
||||
if (prop.vt != VT_BSTR)
|
||||
throw 272340;
|
||||
|
||||
CSysString oemString = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
|
||||
AString oemString = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
|
||||
if (oemString == "..")
|
||||
oemString = kDotsReplaceString;
|
||||
|
||||
@@ -133,9 +133,9 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
|
||||
panelItem.CustomColumnData = NULL;
|
||||
panelItem.CustomColumnNumber = 0;
|
||||
|
||||
panelItem.CRC32 = 0;
|
||||
panelItem.Reserved[0] = 0;
|
||||
panelItem.Reserved[1] = 0;
|
||||
panelItem.Reserved[2] = 0;
|
||||
}
|
||||
|
||||
int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int opMode)
|
||||
@@ -466,7 +466,7 @@ static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID)
|
||||
AString s;
|
||||
|
||||
if (prop.vt == VT_BSTR)
|
||||
s = GetSystemString(prop.bstrVal, CP_OEMCP);
|
||||
s = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
|
||||
else if (prop.vt == VT_BOOL)
|
||||
{
|
||||
int messageID = VARIANT_BOOLToBool(prop.boolVal) ?
|
||||
@@ -733,7 +733,7 @@ HRESULT CPlugin::ShowAttributesWindow()
|
||||
if (strcmp(pluginPanelItem.FindData.cFileName, "..") == 0 &&
|
||||
NFile::NFind::NAttributes::IsDir(pluginPanelItem.FindData.dwFileAttributes))
|
||||
return S_FALSE;
|
||||
int itemIndex = pluginPanelItem.UserData;
|
||||
int itemIndex = (int)pluginPanelItem.UserData;
|
||||
|
||||
CObjectVector<CArchiveItemProperty> properties;
|
||||
UInt32 numProps;
|
||||
@@ -781,7 +781,7 @@ HRESULT CPlugin::ShowAttributesWindow()
|
||||
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(_folder->GetProperty(itemIndex, property.ID, &prop));
|
||||
CSysString s = PropToString(prop, property.ID);
|
||||
AString s = PropToString(prop, property.ID);
|
||||
values.Add(s);
|
||||
|
||||
{
|
||||
|
||||
@@ -82,8 +82,8 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
|
||||
CRecordVector<UINT32> indices;
|
||||
indices.Reserve(numItems);
|
||||
int i;
|
||||
for(i = 0; i < numItems; i++)
|
||||
indices.Add(panelItems[i].UserData);
|
||||
for (i = 0; i < numItems; i++)
|
||||
indices.Add((UINT32)panelItems[i].UserData);
|
||||
|
||||
////////////////////////////
|
||||
// Save _folder;
|
||||
@@ -93,7 +93,7 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
|
||||
|
||||
CMyComPtr<IOutFolderArchive> outArchive;
|
||||
HRESULT result = m_ArchiveHandler.QueryInterface(IID_IOutFolderArchive, &outArchive);
|
||||
if(result != S_OK)
|
||||
if (result != S_OK)
|
||||
{
|
||||
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
|
||||
return FALSE;
|
||||
@@ -151,11 +151,11 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
|
||||
{
|
||||
CMyComPtr<IFolderFolder> newFolder;
|
||||
_folder->BindToFolder(pathVector[i], &newFolder);
|
||||
if(!newFolder )
|
||||
if (!newFolder)
|
||||
break;
|
||||
_folder = newFolder;
|
||||
}
|
||||
GetCurrentDir();
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -76,23 +76,25 @@ HRESULT CPlugin::ExtractFiles(
|
||||
}
|
||||
|
||||
NFileOperationReturnCode::EEnum CPlugin::GetFiles(struct PluginPanelItem *panelItems,
|
||||
int itemsNumber, int move, char *_aDestPath, int opMode)
|
||||
int itemsNumber, int move, char *destPath, int opMode)
|
||||
{
|
||||
return GetFilesReal(panelItems, itemsNumber, move,
|
||||
_aDestPath, opMode, (opMode & OPM_SILENT) == 0);
|
||||
destPath, opMode, (opMode & OPM_SILENT) == 0);
|
||||
}
|
||||
|
||||
NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *panelItems,
|
||||
int itemsNumber, int move, const char *_aDestPath, int opMode, bool showBox)
|
||||
int itemsNumber, int move, const char *destPathLoc, int opMode, bool showBox)
|
||||
{
|
||||
if(move != 0)
|
||||
if (move != 0)
|
||||
{
|
||||
g_StartupInfo.ShowMessage(NMessageID::kMoveIsNotSupported);
|
||||
return NFileOperationReturnCode::kError;
|
||||
}
|
||||
|
||||
CSysString destPath = _aDestPath;
|
||||
NFile::NName::NormalizeDirPathPrefix(destPath);
|
||||
AString destPath = destPathLoc;
|
||||
UString destPathU = GetUnicodeString(destPath, CP_OEMCP);
|
||||
NFile::NName::NormalizeDirPathPrefix(destPathU);
|
||||
destPath = UnicodeStringToMultiByte(destPathU, CP_OEMCP);
|
||||
|
||||
bool extractSelectedFiles = true;
|
||||
|
||||
@@ -185,17 +187,22 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
if (askCode != kOkButtonIndex)
|
||||
return NFileOperationReturnCode::kInterruptedByUser;
|
||||
destPath = dialogItems[kPathIndex].Data;
|
||||
destPath.Trim();
|
||||
if (destPath.IsEmpty())
|
||||
destPathU = GetUnicodeString(destPath, CP_OEMCP);
|
||||
destPathU.Trim();
|
||||
if (destPathU.IsEmpty())
|
||||
{
|
||||
if(!NFile::NDirectory::MyGetCurrentDirectory(destPath))
|
||||
#ifdef UNDER_CE
|
||||
destPathU = L"\\";
|
||||
#else
|
||||
if (!NFile::NDirectory::MyGetCurrentDirectory(destPathU))
|
||||
throw 318016;
|
||||
NFile::NName::NormalizeDirPathPrefix(destPath);
|
||||
NFile::NName::NormalizeDirPathPrefix(destPathU);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(destPath[destPath.Length() - 1] == kDirDelimiter)
|
||||
if (destPathU.Back() == kDirDelimiter)
|
||||
break;
|
||||
}
|
||||
g_StartupInfo.ShowMessage("You must specify directory path");
|
||||
@@ -244,7 +251,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
passwordIsDefined = !password.IsEmpty();
|
||||
}
|
||||
|
||||
NFile::NDirectory::CreateComplexDirectory(destPath);
|
||||
NFile::NDirectory::CreateComplexDirectory(destPathU);
|
||||
|
||||
/*
|
||||
vector<int> realIndices;
|
||||
@@ -254,11 +261,11 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
CRecordVector<UINT32> indices;
|
||||
indices.Reserve(itemsNumber);
|
||||
for (int i = 0; i < itemsNumber; i++)
|
||||
indices.Add(panelItems[i].UserData);
|
||||
indices.Add((UINT32)panelItems[i].UserData);
|
||||
|
||||
HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber,
|
||||
!showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode,
|
||||
MultiByteToUnicodeString(destPath, CP_OEMCP),
|
||||
destPathU,
|
||||
passwordIsDefined, password);
|
||||
// HRESULT result = ExtractFiles(decompressAllItems, realIndices, !showBox,
|
||||
// extractionInfo, destPath, passwordIsDefined, password);
|
||||
@@ -270,9 +277,9 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
|
||||
return NFileOperationReturnCode::kError;
|
||||
}
|
||||
|
||||
// if(move != 0)
|
||||
// if (move != 0)
|
||||
// {
|
||||
// if(DeleteFiles(panelItems, itemsNumber, opMode) == FALSE)
|
||||
// if (DeleteFiles(panelItems, itemsNumber, opMode) == FALSE)
|
||||
// return NFileOperationReturnCode::kError;
|
||||
// }
|
||||
return NFileOperationReturnCode::kSuccess;
|
||||
|
||||
@@ -412,16 +412,17 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
|
||||
for(i = 0; i < pluginPanelItems.Size(); i++)
|
||||
{
|
||||
const PluginPanelItem &panelItem = pluginPanelItems[i];
|
||||
CSysString fullName;
|
||||
UString fullName;
|
||||
if (strcmp(panelItem.FindData.cFileName, "..") == 0 &&
|
||||
NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes))
|
||||
return E_FAIL;
|
||||
if (strcmp(panelItem.FindData.cFileName, ".") == 0 &&
|
||||
NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes))
|
||||
return E_FAIL;
|
||||
if (!MyGetFullPathName(panelItem.FindData.cFileName, fullName))
|
||||
UString fileNameUnicode = MultiByteToUnicodeString(panelItem.FindData.cFileName, CP_OEMCP);
|
||||
if (!MyGetFullPathName(fileNameUnicode, fullName))
|
||||
return E_FAIL;
|
||||
fileNames.Add(MultiByteToUnicodeString(fullName, CP_OEMCP));
|
||||
fileNames.Add(fullName);
|
||||
}
|
||||
|
||||
NCompression::CInfo compressionInfo;
|
||||
@@ -496,7 +497,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
|
||||
const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex];
|
||||
|
||||
char updateAddToArchiveString[512];
|
||||
const AString s = GetSystemString(arcInfo.Name, CP_OEMCP);
|
||||
const AString s = UnicodeStringToMultiByte(arcInfo.Name, CP_OEMCP);
|
||||
|
||||
sprintf(updateAddToArchiveString,
|
||||
g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), (const char *)s);
|
||||
@@ -777,4 +778,3 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
PROG = 7-ZipFar.dll
|
||||
DEF_FILE = Far.def
|
||||
CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
-DWIN_LONG_PATH \
|
||||
-DEXTERNAL_CODECS
|
||||
|
||||
!IFNDEF UNDER_CE
|
||||
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH
|
||||
!ENDIF
|
||||
|
||||
FAR_OBJS = \
|
||||
$O\CLSIDConst.obj \
|
||||
$O\ExtractEngine.obj \
|
||||
$O\FarUtils.obj \
|
||||
$O\Main.obj \
|
||||
|
||||
Reference in New Issue
Block a user