4.30 beta

This commit is contained in:
Igor Pavlov
2005-11-18 00:00:00 +00:00
committed by Kornel Lesiński
parent bcd1db2f5a
commit e18587ba51
214 changed files with 5385 additions and 2712 deletions

View File

@@ -114,10 +114,8 @@ void CApp::CreateOnePanel(int panelIndex, const UString &mainPath)
UString path;
if (mainPath.IsEmpty())
{
CSysString sysPath;
if (!::ReadPanelPath(panelIndex, sysPath))
sysPath.Empty();
path = GetUnicodeString(sysPath);
if (!::ReadPanelPath(panelIndex, path))
path.Empty();
}
else
path = mainPath;
@@ -165,8 +163,7 @@ struct CButtonInfo
UINT Bitmap2ResID;
UINT StringResID;
UINT32 LangID;
CSysString GetText()const
{ return LangLoadString(StringResID, LangID); };
UString GetText()const { return LangString(StringResID, LangID); };
};
static CButtonInfo g_StandardButtons[] =
@@ -184,7 +181,7 @@ static CButtonInfo g_ArchiveButtons[] =
{ kTestCommand , IDB_TEST, IDB_TEST2, IDS_TEST, 0x03020402}
};
bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, CSysString &s)
bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, UString &s)
{
for (int i = 0; i < numButtons; i++)
{
@@ -192,19 +189,19 @@ bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, CSysS
if (b.commandID == commandID)
{
s = b.GetText();
return true;
return true;
}
}
return false;
}
void SetButtonText(UINT32 commandID, CSysString &s)
void SetButtonText(UINT32 commandID, UString &s)
{
if (SetButtonText(commandID, g_StandardButtons, sizeof(g_StandardButtons) /
sizeof(g_StandardButtons[0]), s))
if (SetButtonText(commandID, g_StandardButtons,
sizeof(g_StandardButtons) / sizeof(g_StandardButtons[0]), s))
return;
SetButtonText(commandID, g_ArchiveButtons, sizeof(g_StandardButtons) /
sizeof(g_ArchiveButtons[0]), s);
SetButtonText(commandID, g_ArchiveButtons,
sizeof(g_ArchiveButtons) / sizeof(g_ArchiveButtons[0]), s);
}
static void AddButton(
@@ -223,10 +220,10 @@ static void AddButton(
;
but.dwData = 0;
CSysString s = butInfo.GetText();
UString s = butInfo.GetText();
but.iString = 0;
if (showText)
but.iString = (INT_PTR )(LPCTSTR)s;
but.iString = (INT_PTR)(LPCWSTR)s;
but.iBitmap = imageList.GetImageCount();
HBITMAP b = ::LoadBitmap(g_hInstance,
@@ -238,7 +235,11 @@ static void AddButton(
imageList.AddMasked(b, RGB(255, 0, 255));
::DeleteObject(b);
}
#ifdef _UNICODE
toolBar.AddButton(1, &but);
#else
toolBar.AddButtonW(1, &but);
#endif
}
static void AddBand(NControl::CReBar &reBar, NControl::CToolBar &toolBar)
@@ -402,7 +403,7 @@ void CApp::Save()
path = panel._currentFolderPrefix;
else
path = GetFolderPath(panel._parentFolders[0].ParentFolder);
SavePanelPath(i, GetSystemString(path));
SavePanelPath(i, path);
listMode.Panels[i] = panel.GetListViewMode();
}
SaveListMode(listMode);
@@ -473,7 +474,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
if (!srcPanel.DoesItSupportOperations())
{
srcPanel.MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
@@ -511,11 +512,11 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
copyDialog.Value = destPath;
copyDialog.Title = move ?
LangLoadStringW(IDS_MOVE, 0x03020202):
LangLoadStringW(IDS_COPY, 0x03020201);
LangString(IDS_MOVE, 0x03020202):
LangString(IDS_COPY, 0x03020201);
copyDialog.Static = move ?
LangLoadStringW(IDS_MOVE_TO, 0x03020204):
LangLoadStringW(IDS_COPY_TO, 0x03020203);
LangString(IDS_MOVE_TO, 0x03020204):
LangString(IDS_COPY_TO, 0x03020203);
if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
return;
@@ -526,7 +527,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
{
if (!srcPanel.IsFSFolder())
{
srcPanel.MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
destPath = srcPanel._currentFolderPrefix + destPath;
@@ -541,7 +542,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
{
if (NumPanels < 2 || destPath != destPanel._currentFolderPrefix || !destPanel.DoesItSupportOperations())
{
srcPanel.MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
useDestPanel = true;
@@ -556,7 +557,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
NDirectory::CreateComplexDirectory(prefix);
if (!CheckFolderPath(prefix))
{
srcPanel.MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
}
@@ -705,7 +706,8 @@ int CApp::GetFocusedPanelIndex() const
}
*/
static CSysString g_ToolTipBuffer;
static UString g_ToolTipBuffer;
static CSysString g_ToolTipBufferSys;
void CApp::OnNotify(int ctrlID, LPNMHDR pnmh)
{
@@ -729,8 +731,20 @@ void CApp::OnNotify(int ctrlID, LPNMHDR pnmh)
info->hinst = 0;
g_ToolTipBuffer.Empty();
SetButtonText(info->hdr.idFrom, g_ToolTipBuffer);
info->lpszText = (LPTSTR)(LPCTSTR)g_ToolTipBuffer;
g_ToolTipBufferSys = GetSystemString(g_ToolTipBuffer);
info->lpszText = (LPTSTR)(LPCTSTR)g_ToolTipBufferSys;
return;
}
#ifndef _UNICODE
if (pnmh->code == TTN_GETDISPINFOW)
{
LPNMTTDISPINFOW info = (LPNMTTDISPINFOW)pnmh;
info->hinst = 0;
g_ToolTipBuffer.Empty();
SetButtonText(info->hdr.idFrom, g_ToolTipBuffer);
info->lpszText = (LPWSTR)(LPCWSTR)g_ToolTipBuffer;
return;
}
#endif
}
}

View File

@@ -82,8 +82,6 @@ public:
#endif
private:
// CSysString _directoryPath;
// CSysString m_DiskFilePath;
// bool _extractMode;
UString _currentArchivePath;
bool _needWriteArchivePath;

View File

@@ -11,6 +11,9 @@
#include "Windows/Control/Toolbar.h"
#include "Windows/Error.h"
#include "Windows/COM.h"
#include "Windows/DLL.h"
#include "Windows/Security.h"
#include "Windows/MemoryLock.h"
#include "ViewSettings.h"
@@ -19,6 +22,7 @@
#include "MyLoadMenu.h"
#include "LangUtils.h"
#include "RegistryUtils.h"
using namespace NWindows;
@@ -28,6 +32,9 @@ using namespace NWindows;
#define MENU_HEIGHT 26
#ifndef _UNICODE
bool g_IsNT = false;
#endif
HINSTANCE g_hInstance;
HWND g_HWND;
static UString g_MainPath;
@@ -39,17 +46,17 @@ int kSplitterRateMax = 1 << 16;
// bool OnMenuCommand(HWND hWnd, int id);
static CSysString GetProgramPath()
static UString GetProgramPath()
{
TCHAR fullPath[MAX_PATH + 1];
::GetModuleFileName(g_hInstance, fullPath, MAX_PATH);
return fullPath;
UString s;
NDLL::MyGetModuleFileName(g_hInstance, s);
return s;
}
CSysString GetProgramFolderPrefix()
UString GetProgramFolderPrefix()
{
CSysString path = GetProgramPath();
int pos = path.ReverseFind(TEXT('\\'));
UString path = GetProgramPath();
int pos = path.ReverseFind(L'\\');
return path.Left(pos + 1);
}
@@ -117,12 +124,21 @@ void OnSize(HWND hWnd);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
// FUNCTION: InitInstance(HANDLE, int)
const wchar_t *kWindowClass = L"FM";
static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
// FUNCTION: InitInstance(HANDLE, int)
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd = NULL;
TCHAR windowClass[MAX_LOADSTRING]; // The window class name
lstrcpy(windowClass, TEXT("FM"));
CWindow wnd;
g_hInstance = hInstance;
@@ -131,7 +147,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
// LoadString(hInstance, IDS_CLASS, windowClass, MAX_LOADSTRING);
// LoadString(hInstance, IDS_APP_TITLE, title, MAX_LOADSTRING);
UString title = LangLoadStringW(IDS_APP_TITLE, 0x03000000);
UString title = LangString(IDS_APP_TITLE, 0x03000000);
/*
//If it is already running, then focus on the window
@@ -143,7 +159,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
}
*/
WNDCLASS wc;
WNDCLASSW wc;
// wc.style = CS_HREDRAW | CS_VREDRAW;
wc.style = 0;
@@ -158,10 +174,10 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
// wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wc.lpszMenuName = MAKEINTRESOURCE(IDM_MENU);
wc.lpszClassName = windowClass;
wc.lpszMenuName = MAKEINTRESOURCEW(IDM_MENU);
wc.lpszClassName = kWindowClass;
RegisterClass(&wc);
MyRegisterClass(&wc);
// RECT rect;
// GetClientRect(hWnd, &rect);
@@ -200,17 +216,14 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
g_App.NumPanels = numPanels;
g_App.LastFocusedPanel = currentPanel;
hWnd = CreateWindow(windowClass, GetSystemString(title), style,
x, y, xSize, ySize, NULL, NULL, hInstance, NULL);
if (!hWnd)
return FALSE;
g_HWND = hWnd;
CWindow window(hWnd);
if (!wnd.Create(kWindowClass, title, style,
x, y, xSize, ySize, NULL, NULL, hInstance, NULL))
return FALSE;
g_HWND = (HWND)wnd;
WINDOWPLACEMENT placement;
placement.length = sizeof(placement);
if (window.GetPlacement(&placement))
if (wnd.GetPlacement(&placement))
{
if (nCmdShow == SW_SHOWNORMAL || nCmdShow == SW_SHOW ||
nCmdShow == SW_SHOWDEFAULT)
@@ -224,11 +237,11 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
placement.showCmd = nCmdShow;
if (windowPosIsRead)
placement.rcNormalPosition = rect;
window.SetPlacement(&placement);
wnd.SetPlacement(&placement);
// window.Show(nCmdShow);
}
else
window.Show(nCmdShow);
wnd.Show(nCmdShow);
return TRUE;
}
@@ -295,11 +308,65 @@ DWORD GetDllVersion(LPCTSTR lpszDllName)
DWORD g_ComCtl32Version;
/*
#ifndef _WIN64
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
static bool IsWow64()
{
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(
GetModuleHandle("kernel32"), "IsWow64Process");
if (fnIsWow64Process == NULL)
return false;
BOOL isWow;
if (!fnIsWow64Process(GetCurrentProcess(),&isWow))
return false;
return isWow != FALSE;
}
#endif
*/
bool IsLargePageSupported()
{
#ifdef _WIN64
return true;
#else
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
if (versionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || versionInfo.dwMajorVersion < 5)
return false;
if (versionInfo.dwMajorVersion > 5)
return true;
if (versionInfo.dwMinorVersion < 1)
return false;
if (versionInfo.dwMinorVersion > 1)
return true;
// return IsWow64();
return false;
#endif
}
static void SetMemoryLock()
{
if (!IsLargePageSupported())
return;
// if (ReadLockMemoryAdd())
NSecurity::AddLockMemoryPrivilege();
if (ReadLockMemoryEnable())
NSecurity::EnableLockMemoryPrivilege();
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
#ifndef _UNICODE
g_IsNT = IsItWindowsNT();
#endif
InitCommonControls();
g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll"));
@@ -324,6 +391,7 @@ int WINAPI WinMain( HINSTANCE hInstance,
// MessageBoxW(0, paramString, L"", 0);
}
SetMemoryLock();
MSG msg;
if (!InitInstance (hInstance, nCmdShow))
@@ -331,19 +399,34 @@ int WINAPI WinMain( HINSTANCE hInstance,
MyLoadMenu(g_HWND);
HACCEL hAccels = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(g_HWND, hAccels, &msg))
{
// if (g_Hwnd != NULL || !IsDialogMessage(g_Hwnd, &msg))
// if (!IsDialogMessage(g_Hwnd, &msg))
{
#ifndef _UNICODE
if (g_IsNT)
{
HACCEL hAccels = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_ACCELERATOR1));
while (GetMessageW(&msg, NULL, 0, 0))
{
if (TranslateAcceleratorW(g_HWND, hAccels, &msg) == 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageW(&msg);
}
}
}
else
#endif
{
HACCEL hAccels = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
while (GetMessage(&msg, NULL, 0, 0))
{
if (TranslateAccelerator(g_HWND, hAccels, &msg) == 0)
{
// if (g_Hwnd != NULL || !IsDialogMessage(g_Hwnd, &msg))
// if (!IsDialogMessage(g_Hwnd, &msg))
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
g_HWND = 0;
OleUninitialize();
@@ -578,7 +661,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
*/
}
return DefWindowProc(hWnd, message, wParam, lParam);
#ifndef _UNICODE
if (g_IsNT)
return DefWindowProcW(hWnd, message, wParam, lParam);
else
#endif
return DefWindowProc(hWnd, message, wParam, lParam);
}
void OnSize(HWND hWnd)

View File

@@ -259,6 +259,14 @@ SOURCE=.\NetFolder.h
# End Source File
# Begin Source File
SOURCE=.\PhysDriveFolder.cpp
# End Source File
# Begin Source File
SOURCE=.\PhysDriveFolder.h
# End Source File
# Begin Source File
SOURCE=.\RootFolder.cpp
# End Source File
# Begin Source File
@@ -682,6 +690,14 @@ SOURCE=..\..\Windows\Control\Window2.h
# End Group
# Begin Source File
SOURCE=..\..\Windows\CommonDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Windows\CommonDialog.h
# End Source File
# Begin Source File
SOURCE=..\..\Windows\Defs.h
# End Source File
# Begin Source File
@@ -706,6 +722,14 @@ SOURCE=..\..\Windows\Error.h
# End Source File
# Begin Source File
SOURCE=..\..\Windows\FileDevice.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Windows\FileDevice.h
# End Source File
# Begin Source File
SOURCE=..\..\Windows\FileDir.cpp
# End Source File
# Begin Source File
@@ -758,6 +782,18 @@ SOURCE=..\..\Windows\Memory.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
@@ -806,6 +842,14 @@ SOURCE=..\..\Windows\ResourceString.h
# End Source File
# Begin Source File
SOURCE=..\..\Windows\Security.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Windows\Security.h
# End Source File
# Begin Source File
SOURCE=..\..\Windows\Shell.cpp
# End Source File
# Begin Source File

View File

@@ -15,6 +15,7 @@
#include "SysIconUtils.h"
#include "FSFolder.h"
#include "PhysDriveFolder.h"
#include "LangUtils.h"
using namespace NWindows;
@@ -44,30 +45,26 @@ static const wchar_t *kDriveTypes[] =
L"RAM disk"
};
static inline UINT GetCurrentFileCodePage()
{ return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
STDMETHODIMP CFSDrives::LoadItems()
{
UINT fileCodePage = GetCurrentFileCodePage();
_drives.Clear();
CSysStringVector driveStrings;
UStringVector driveStrings;
MyGetLogicalDriveStrings(driveStrings);
for (int i = 0; i < driveStrings.Size(); i++)
{
CDriveInfo driveInfo;
const CSysString &driveName = driveStrings[i];
const UString &driveName = driveStrings[i];
driveInfo.FullSystemName = GetUnicodeString(driveName, fileCodePage);
driveInfo.FullSystemName = driveName;
driveInfo.Name = driveInfo.FullSystemName.Left(
driveInfo.FullSystemName.Length() - 1);
driveInfo.ClusterSize = 0;
driveInfo.DriveSize = 0;
driveInfo.FreeSpace = 0;
UINT driveType = ::GetDriveType(driveName);
UINT driveType = NFile::NSystem::MyGetDriveType(driveName);
if (driveType < sizeof(kDriveTypes) / sizeof(kDriveTypes[0]))
{
driveInfo.Type = kDriveTypes[driveType];
@@ -87,14 +84,14 @@ STDMETHODIMP CFSDrives::LoadItems()
}
if (needRead)
{
CSysString volumeName, fileSystemName;
UString volumeName, fileSystemName;
DWORD volumeSerialNumber, maximumComponentLength, fileSystemFlags;
NFile::NSystem::MyGetVolumeInformation(driveName,
volumeName,
&volumeSerialNumber, &maximumComponentLength, &fileSystemFlags,
fileSystemName);
driveInfo.VolumeName = GetUnicodeString(volumeName, fileCodePage);
driveInfo.FileSystemName = GetUnicodeString(fileSystemName, fileCodePage);
driveInfo.VolumeName = volumeName;
driveInfo.FileSystemName = fileSystemName;
NFile::NSystem::MyGetDiskFreeSpace(driveName,
driveInfo.ClusterSize, driveInfo.DriveSize, driveInfo.FreeSpace);
@@ -105,15 +102,15 @@ STDMETHODIMP CFSDrives::LoadItems()
return S_OK;
}
STDMETHODIMP CFSDrives::GetNumberOfItems(UINT32 *numItems)
STDMETHODIMP CFSDrives::GetNumberOfItems(UInt32 *numItems)
{
*numItems = _drives.Size();
return S_OK;
}
STDMETHODIMP CFSDrives::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT *value)
STDMETHODIMP CFSDrives::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
if (itemIndex >= (UINT32)_drives.Size())
if (itemIndex >= (UInt32)_drives.Size())
return E_INVALIDARG;
NCOM::CPropVariant propVariant;
const CDriveInfo &driveInfo = _drives[itemIndex];
@@ -161,12 +158,22 @@ HRESULT CFSDrives::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultF
return S_OK;
}
STDMETHODIMP CFSDrives::BindToFolder(UINT32 index, IFolderFolder **resultFolder)
STDMETHODIMP CFSDrives::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
*resultFolder = 0;
if (index >= (UINT32)_drives.Size())
if (index >= (UInt32)_drives.Size())
return E_INVALIDARG;
return BindToFolderSpec(_drives[index].FullSystemName, resultFolder);
const CDriveInfo &driveInfo = _drives[index];
if (_volumeMode)
{
*resultFolder = 0;
CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
CMyComPtr<IFolderFolder> subFolder = folderSpec;
RINOK(folderSpec->Init(driveInfo.Name));
*resultFolder = subFolder.Detach();
return S_OK;
}
return BindToFolderSpec(driveInfo.FullSystemName, resultFolder);
}
STDMETHODIMP CFSDrives::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
@@ -185,13 +192,13 @@ STDMETHODIMP CFSDrives::GetName(BSTR *name)
return E_NOTIMPL;
}
STDMETHODIMP CFSDrives::GetNumberOfProperties(UINT32 *numProperties)
STDMETHODIMP CFSDrives::GetNumberOfProperties(UInt32 *numProperties)
{
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
return S_OK;
}
STDMETHODIMP CFSDrives::GetPropertyInfo(UINT32 index,
STDMETHODIMP CFSDrives::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -213,18 +220,17 @@ STDMETHODIMP CFSDrives::GetTypeID(BSTR *name)
STDMETHODIMP CFSDrives::GetPath(BSTR *path)
{
CMyComBSTR temp = (LangLoadStringW(IDS_COMPUTER, 0x03020300)) +
UString(L'\\');
CMyComBSTR temp = LangString(IDS_COMPUTER, 0x03020300) + UString(L'\\');
*path = temp.Detach();
return S_OK;
}
STDMETHODIMP CFSDrives::GetSystemIconIndex(UINT32 index, INT32 *iconIndex)
STDMETHODIMP CFSDrives::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
{
*iconIndex = 0;
const CDriveInfo &driveInfo = _drives[index];
int iconIndexTemp;
if (GetRealIconIndex(GetSystemString(driveInfo.FullSystemName), 0, iconIndexTemp) != 0)
if (GetRealIconIndex(driveInfo.FullSystemName, 0, iconIndexTemp) != 0)
{
*iconIndex = iconIndexTemp;
return S_OK;

View File

@@ -4,6 +4,7 @@
#define __FSDRIVES_H
#include "Common/String.h"
#include "Common/Types.h"
#include "Common/MyCom.h"
#include "Windows/FileFind.h"
#include "Windows/PropVariant.h"
@@ -15,9 +16,9 @@ struct CDriveInfo
UString Name;
UString FullSystemName;
bool KnownSizes;
UINT64 DriveSize;
UINT64 FreeSpace;
UINT64 ClusterSize;
UInt64 DriveSize;
UInt64 FreeSpace;
UInt64 ClusterSize;
UString Type;
UString VolumeName;
UString FileSystemName;
@@ -40,25 +41,26 @@ public:
)
STDMETHOD(LoadItems)();
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder);
STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder);
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder);
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder);
STDMETHOD(GetName)(BSTR *name);
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties);
STDMETHOD(GetPropertyInfo)(UINT32 index,
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType);
STDMETHOD(GetTypeID)(BSTR *name);
STDMETHOD(GetPath)(BSTR *path);
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex);
STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
private:
HRESULT BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder);
CObjectVector<CDriveInfo> _drives;
bool _volumeMode;
public:
void Init() {}
void Init() { _volumeMode = false;}
};
#endif

View File

@@ -37,14 +37,10 @@ static STATPROPSTG kProperties[] =
{ NULL, kpidComment, VT_BSTR}
};
static inline UINT GetCurrentFileCodePage()
{ return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
{
_parentFolder = parentFolder;
_path = path;
_fileCodePage = GetCurrentFileCodePage();
if (_findChangeNotification.FindFirst(_path, false,
FILE_NOTIFY_CHANGE_FILE_NAME |
@@ -70,7 +66,7 @@ HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
return S_OK;
}
static HRESULT GetFolderSize(const UString &path, UINT64 &size, IProgress *progress)
static HRESULT GetFolderSize(const UString &path, UInt64 &size, IProgress *progress)
{
RINOK(progress->SetCompleted(NULL));
size = 0;
@@ -80,7 +76,7 @@ static HRESULT GetFolderSize(const UString &path, UINT64 &size, IProgress *progr
{
if (fileInfo.IsDirectory())
{
UINT64 subSize;
UInt64 subSize;
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name,
subSize, progress));
size += subSize;
@@ -137,7 +133,7 @@ bool CFSFolder::LoadComments()
return false;
AString s;
char *p = s.GetBuffer((size_t)length + 1);
UINT32 processedSize;
UInt32 processedSize;
file.Read(p, (UInt32)length, processedSize);
p[length] = 0;
s.ReleaseBuffer();
@@ -168,7 +164,7 @@ bool CFSFolder::SaveComments()
_comments.SaveToString(unicodeString);
AString utfString;
ConvertUnicodeToUTF8(unicodeString, utfString);
UINT32 processedSize;
UInt32 processedSize;
if (!IsAscii(unicodeString))
{
Byte bom [] = { 0xEF, 0xBB, 0xBF, 0x0D, 0x0A };
@@ -180,28 +176,28 @@ bool CFSFolder::SaveComments()
return true;
}
STDMETHODIMP CFSFolder::GetNumberOfItems(UINT32 *numItems)
STDMETHODIMP CFSFolder::GetNumberOfItems(UInt32 *numItems)
{
*numItems = _files.Size();
return S_OK;
}
/*
STDMETHODIMP CFSFolder::GetNumberOfSubFolders(UINT32 *aNumSubFolders)
STDMETHODIMP CFSFolder::GetNumberOfSubFolders(UInt32 *numSubFolders)
{
UINT32 aNumSubFoldersLoc = 0;
UInt32 numSubFoldersLoc = 0;
for (int i = 0; i < _files.Size(); i++)
if (_files[i].IsDirectory())
aNumSubFoldersLoc++;
*aNumSubFolders = aNumSubFoldersLoc;
numSubFoldersLoc++;
*numSubFolders = numSubFoldersLoc;
return S_OK;
}
*/
STDMETHODIMP CFSFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT *value)
STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant propVariant;
if (itemIndex >= (UINT32)_files.Size())
if (itemIndex >= (UInt32)_files.Size())
return E_INVALIDARG;
CFileInfoEx &fileInfo = _files[itemIndex];
switch(propID)
@@ -210,7 +206,7 @@ STDMETHODIMP CFSFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT
propVariant = fileInfo.IsDirectory();
break;
case kpidName:
propVariant = GetUnicodeString(fileInfo.Name);
propVariant = fileInfo.Name;
break;
case kpidSize:
propVariant = fileInfo.Size;
@@ -227,7 +223,7 @@ STDMETHODIMP CFSFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT
propVariant = fileInfo.CompressedSize;
break;
case kpidAttributes:
propVariant = (UINT32)fileInfo.Attributes;
propVariant = (UInt32)fileInfo.Attributes;
break;
case kpidCreationTime:
propVariant = fileInfo.CreationTime;
@@ -241,7 +237,7 @@ STDMETHODIMP CFSFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT
case kpidComment:
LoadComments();
UString comment;
if (_comments.GetValue(GetUnicodeString(fileInfo.Name), comment))
if (_comments.GetValue(fileInfo.Name, comment))
propVariant = comment;
break;
}
@@ -260,7 +256,7 @@ HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultF
}
STDMETHODIMP CFSFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolder)
STDMETHODIMP CFSFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
*resultFolder = 0;
const NFind::CFileInfoW &fileInfo = _files[index];
@@ -285,11 +281,11 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
}
if (_path.IsEmpty())
return E_INVALIDARG;
int pos = _path.ReverseFind(TEXT('\\'));
int pos = _path.ReverseFind(L'\\');
if (pos < 0 || pos != _path.Length() - 1)
return E_FAIL;
UString parentPath = _path.Left(pos);
pos = parentPath.ReverseFind(TEXT('\\'));
pos = parentPath.ReverseFind(L'\\');
if (pos < 0)
{
parentPath.Empty();
@@ -301,14 +297,14 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
}
UString parentPathReduced = parentPath.Left(pos);
parentPath = parentPath.Left(pos + 1);
pos = parentPathReduced.ReverseFind(TEXT('\\'));
pos = parentPathReduced.ReverseFind(L'\\');
if (pos == 1)
{
if (parentPath[0] != TEXT('\\'))
if (parentPath[0] != L'\\')
return E_FAIL;
CNetFolder *netFolderSpec = new CNetFolder;
CMyComPtr<IFolderFolder> netFolder = netFolderSpec;
netFolderSpec->Init(GetUnicodeString(parentPath));
netFolderSpec->Init(parentPath);
*resultFolder = netFolder.Detach();
return S_OK;
}
@@ -329,13 +325,13 @@ STDMETHODIMP CFSFolder::GetName(BSTR *name)
*/
}
STDMETHODIMP CFSFolder::GetNumberOfProperties(UINT32 *numProperties)
STDMETHODIMP CFSFolder::GetNumberOfProperties(UInt32 *numProperties)
{
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
return S_OK;
}
STDMETHODIMP CFSFolder::GetPropertyInfo(UINT32 index,
STDMETHODIMP CFSFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -357,7 +353,7 @@ STDMETHODIMP CFSFolder::GetTypeID(BSTR *name)
STDMETHODIMP CFSFolder::GetPath(BSTR *path)
{
CMyComBSTR temp = GetUnicodeString(_path, _fileCodePage);
CMyComBSTR temp = _path;
*path = temp.Detach();
return S_OK;
}
@@ -397,7 +393,7 @@ STDMETHODIMP CFSFolder::Clone(IFolderFolder **resultFolder)
return S_OK;
}
HRESULT CFSFolder::GetItemFullSize(int index, UINT64 &size, IProgress *progress)
HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
{
const CFileInfoW &fileInfo = _files[index];
if (fileInfo.IsDirectory())
@@ -408,13 +404,13 @@ HRESULT CFSFolder::GetItemFullSize(int index, UINT64 &size, IProgress *progress)
CMyComPtr<IFolderReload> aFolderReload;
subFolder.QueryInterface(&aFolderReload);
aFolderReload->Reload();
UINT32 numItems;
UInt32 numItems;
RINOK(subFolder->GetNumberOfItems(&numItems));
CMyComPtr<IFolderGetItemFullSize> aGetItemFullSize;
subFolder.QueryInterface(&aGetItemFullSize);
for (UINT32 i = 0; i < numItems; i++)
for (UInt32 i = 0; i < numItems; i++)
{
UINT64 size;
UInt64 size;
RINOK(aGetItemFullSize->GetItemFullSize(i, &size));
*totalSize += size;
}
@@ -425,12 +421,12 @@ HRESULT CFSFolder::GetItemFullSize(int index, UINT64 &size, IProgress *progress)
return S_OK;
}
STDMETHODIMP CFSFolder::GetItemFullSize(UINT32 index, PROPVARIANT *value, IProgress *progress)
STDMETHODIMP CFSFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
{
NCOM::CPropVariant propVariant;
if (index >= (UINT32)_files.Size())
if (index >= (UInt32)_files.Size())
return E_INVALIDARG;
UINT64 size = 0;
UInt64 size = 0;
HRESULT result = GetItemFullSize(index, size, progress);
propVariant = size;
propVariant.Detach(value);
@@ -478,7 +474,7 @@ STDMETHODIMP CFSFolder::CreateFile(const wchar_t *name, IProgress *progress)
return S_OK;
}
STDMETHODIMP CFSFolder::Rename(UINT32 index, const wchar_t *newName, IProgress *progress)
STDMETHODIMP CFSFolder::Rename(UInt32 index, const wchar_t *newName, IProgress *progress)
{
const CFileInfoW &fileInfo = _files[index];
if (!NDirectory::MyMoveFile(_path + fileInfo.Name, _path + newName))
@@ -486,11 +482,11 @@ STDMETHODIMP CFSFolder::Rename(UINT32 index, const wchar_t *newName, IProgress *
return S_OK;
}
STDMETHODIMP CFSFolder::Delete(const UINT32 *indices, UINT32 numItems,
STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,
IProgress *progress)
{
RINOK(progress->SetTotal(numItems));
for (UINT32 i = 0; i < numItems; i++)
for (UInt32 i = 0; i < numItems; i++)
{
int index = indices[i];
const CFileInfoW &fileInfo = _files[indices[i]];
@@ -502,57 +498,23 @@ STDMETHODIMP CFSFolder::Delete(const UINT32 *indices, UINT32 numItems,
result = NDirectory::DeleteFileAlways(fullPath);
if (!result)
return GetLastError();
UINT64 completed = i;
UInt64 completed = i;
RINOK(progress->SetCompleted(&completed));
}
return S_OK;
}
/*
STDMETHODIMP CFSFolder::DeleteToRecycleBin(const UINT32 *indices, UINT32 numItems,
IProgress *progress)
{
RINOK(progress->SetTotal(numItems));
for (UINT32 i = 0; i < numItems; i++)
{
int index = indices[i];
const CFileInfoW &fileInfo = _files[indices[i]];
const UString fullPath = _path + fileInfo.Name;
CBuffer<TCHAR> buffer;
const CSysString fullPathSys = GetSystemString(fullPath);
buffer.SetCapacity(fullPathSys.Length() + 2);
memmove((TCHAR *)buffer, (const TCHAR *)fullPathSys, (fullPathSys.Length() + 1) * sizeof(TCHAR));
((TCHAR *)buffer)[fullPathSys.Length() + 1] = 0;
SHFILEOPSTRUCT fo;
fo.hwnd = 0;
fo.wFunc = FO_DELETE;
fo.pFrom = (const TCHAR *)buffer;
fo.pTo = 0;
fo.fFlags = FOF_ALLOWUNDO;
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = SHFileOperation(&fo);
if (fo.fAnyOperationsAborted)
return E_ABORT;
UINT64 completed = i;
RINOK(progress->SetCompleted(&completed));
}
return S_OK;
}
*/
STDMETHODIMP CFSFolder::SetProperty(UINT32 index, PROPID propID,
STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
const PROPVARIANT *value, IProgress *progress)
{
if (index >= (UINT32)_files.Size())
if (index >= (UInt32)_files.Size())
return E_INVALIDARG;
CFileInfoEx &fileInfo = _files[index];
switch(propID)
{
case kpidComment:
{
UString filename = GetUnicodeString(fileInfo.Name);
UString filename = fileInfo.Name;
filename.Trim();
if (value->vt == VT_EMPTY)
_comments.DeletePair(filename);
@@ -579,15 +541,14 @@ STDMETHODIMP CFSFolder::SetProperty(UINT32 index, PROPID propID,
return S_OK;
}
STDMETHODIMP CFSFolder::GetSystemIconIndex(UINT32 index, INT32 *iconIndex)
STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
{
if (index >= (UINT32)_files.Size())
if (index >= (UInt32)_files.Size())
return E_INVALIDARG;
const CFileInfoEx &fileInfo = _files[index];
*iconIndex = 0;
int iconIndexTemp;
if (GetRealIconIndex(GetSystemString(_path + fileInfo.Name),
fileInfo.Attributes, iconIndexTemp) != 0)
if (GetRealIconIndex(_path + fileInfo.Name, fileInfo.Attributes, iconIndexTemp) != 0)
{
*iconIndex = iconIndexTemp;
return S_OK;

View File

@@ -17,7 +17,7 @@ class CFSFolder;
struct CFileInfoEx: public NWindows::NFile::NFind::CFileInfoW
{
bool CompressedSizeIsDefined;
UINT64 CompressedSize;
UInt64 CompressedSize;
};
@@ -34,7 +34,7 @@ class CFSFolder:
public IFolderGetSystemIconIndex,
public CMyUnknownImp
{
UINT64 GetSizeOfItem(int anIndex) const;
UInt64 GetSizeOfItem(int anIndex) const;
public:
MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(IEnumProperties)
@@ -51,41 +51,38 @@ public:
STDMETHOD(LoadItems)();
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder);
STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder);
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder);
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder);
STDMETHOD(GetName)(BSTR *name);
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties);
STDMETHOD(GetPropertyInfo)(UINT32 index,
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType);
STDMETHOD(GetTypeID)(BSTR *name);
STDMETHOD(GetPath)(BSTR *path);
STDMETHOD(WasChanged)(INT32 *wasChanged);
STDMETHOD(Clone)(IFolderFolder **resultFolder);
STDMETHOD(GetItemFullSize)(UINT32 index, PROPVARIANT *value, IProgress *progress);
STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress);
// IFolderOperations
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress);
STDMETHOD(CreateFile)(const wchar_t *name, IProgress *progress);
STDMETHOD(Rename)(UINT32 index, const wchar_t *newName, IProgress *progress);
STDMETHOD(Delete)(const UINT32 *indices, UINT32 numItems, IProgress *progress);
STDMETHOD(CopyTo)(const UINT32 *indices, UINT32 numItems,
STDMETHOD(Rename)(UInt32 index, const wchar_t *newName, IProgress *progress);
STDMETHOD(Delete)(const UInt32 *indices, UInt32 numItems, IProgress *progress);
STDMETHOD(CopyTo)(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback);
STDMETHOD(MoveTo)(const UINT32 *indices, UINT32 numItems,
STDMETHOD(MoveTo)(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback);
STDMETHOD(CopyFrom)(const wchar_t *fromFolderPath,
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress);
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress);
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex);
// STDMETHOD(DeleteToRecycleBin)(const UINT32 *indices, UINT32 numItems, IProgress *progress);
const wchar_t **itemsPaths, UInt32 numItems, IProgress *progress);
STDMETHOD(SetProperty)(UInt32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress);
STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
private:
UINT _fileCodePage;
UString _path;
CObjectVector<CFileInfoEx> _files;
CMyComPtr<IFolderFolder> _parentFolder;
@@ -97,7 +94,7 @@ private:
NWindows::NFile::NFind::CFindChangeNotification _findChangeNotification;
HRESULT GetItemFullSize(int index, UINT64 &size, IProgress *progress);
HRESULT GetItemFullSize(int index, UInt64 &size, IProgress *progress);
HRESULT GetComplexName(const wchar_t *name, UString &resultPath);
HRESULT BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder);

View File

@@ -16,17 +16,9 @@ using namespace NWindows;
using namespace NFile;
using namespace NFind;
static inline UINT GetCurrentCodePage()
{ return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#ifndef _UNICODE
extern bool g_IsNT;
#endif
static bool IsItWindows2000orHigher()
{
@@ -81,47 +73,48 @@ typedef BOOL (WINAPI * CopyFileExPointerW)(
IN DWORD dwCopyFlags
);
#ifndef _UNICODE
static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
static CSysString GetSysPath(LPCWSTR sysPath)
{ return UnicodeStringToMultiByte(sysPath, GetCurrentCodePage()); }
#endif
static bool MyCopyFile(LPCWSTR existingFile, LPCWSTR newFile,
IProgress *progress, UINT64 &completedSize)
{
// if (IsItWindowsNT())
// {
CProgressInfo progressInfo;
progressInfo.Progress = progress;
progressInfo.StartPos = completedSize;
BOOL CancelFlag = FALSE;
CProgressInfo progressInfo;
progressInfo.Progress = progress;
progressInfo.StartPos = completedSize;
BOOL CancelFlag = FALSE;
#ifndef _UNICODE
if (g_IsNT)
#endif
{
CopyFileExPointerW copyFunctionW = (CopyFileExPointerW)
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"),
"CopyFileExW");
if (copyFunctionW != 0)
{
if (copyFunctionW(existingFile, newFile, CopyProgressRoutine,
&progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS))
return true;
if (::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return false;
}
if (copyFunctionW == 0)
return false;
return BOOLToBool(copyFunctionW(existingFile, newFile, CopyProgressRoutine,
&progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS));
}
#ifndef _UNICODE
else
{
CopyFileExPointer copyFunction = (CopyFileExPointer)
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
::GetProcAddress(::GetModuleHandleA("kernel32.dll"),
"CopyFileExA");
UINT codePage = GetCurrentCodePage();
if (copyFunction != 0)
{
if (copyFunction(
UnicodeStringToMultiByte(existingFile, codePage),
UnicodeStringToMultiByte(newFile, codePage),
CopyProgressRoutine,
&progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS))
if (copyFunction(GetSysPath(existingFile), GetSysPath(newFile),
CopyProgressRoutine,&progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS))
return true;
if (::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return false;
}
// }
return BOOLToBool(::CopyFile(
GetSystemString(existingFile, codePage),
GetSystemString(newFile, codePage),
TRUE));
return BOOLToBool(::CopyFile(GetSysPath(existingFile), GetSysPath(newFile), TRUE));
}
#endif
}
typedef BOOL (WINAPI * MoveFileWithProgressPointer)(
@@ -167,14 +160,12 @@ static HRESULT MyCopyFile(
const CFileInfoW &srcFileInfo,
const UString &destPathSpec,
IFolderOperationsExtractCallback *callback,
UINT fileCodePage,
UINT64 &completedSize)
{
UString destPath = destPathSpec;
if (destPath.CompareNoCase(srcPath) == 0)
{
UString message = UString(L"can not move file \'") +
GetUnicodeString(destPath, fileCodePage) + UString(L"\' onto itself");
UString message = UString(L"can not move file \'") + destPath + UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
@@ -182,10 +173,10 @@ static HRESULT MyCopyFile(
INT32 writeAskResult;
CMyComBSTR destPathResult;
RINOK(callback->AskWrite(
GetUnicodeString(srcPath, fileCodePage),
srcPath,
BoolToInt(false),
&srcFileInfo.LastWriteTime, &srcFileInfo.Size,
GetUnicodeString(destPath, fileCodePage),
destPath,
&destPathResult,
&writeAskResult));
if (IntToBool(writeAskResult))
@@ -194,9 +185,9 @@ static HRESULT MyCopyFile(
RINOK(callback->SetCurrentFilePath(srcPath));
if (!::MyCopyFile(srcPath, destPathNew, callback, completedSize))
{
UString message = GetUnicodeString(NError::MyFormatMessage(GetLastError())) +
UString message = NError::MyFormatMessageW(GetLastError()) +
UString(L" \'") +
GetUnicodeString(destPathNew, fileCodePage)+
UString(destPathNew) +
UString(L"\'");
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -210,7 +201,6 @@ static HRESULT CopyFolder(
const UString &srcPath,
const UString &destPathSpec,
IFolderOperationsExtractCallback *callback,
UINT fileCodePage,
UINT64 &completedSize)
{
RINOK(callback->SetCompleted(&completedSize));
@@ -222,7 +212,7 @@ static HRESULT CopyFolder(
if (destPath.Length() == len || destPath[len] == L'\\')
{
UString message = UString(L"can not copy folder \'") +
GetUnicodeString(destPath, fileCodePage) + UString(L"\' onto itself");
destPath + UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
@@ -230,8 +220,7 @@ static HRESULT CopyFolder(
if (!NDirectory::CreateComplexDirectory(destPath))
{
UString message = UString(L"can not create folder ") +
GetUnicodeString(destPath, fileCodePage);
UString message = UString(L"can not create folder ") + destPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
@@ -243,25 +232,23 @@ static HRESULT CopyFolder(
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name;
if (fileInfo.IsDirectory())
{
RINOK(CopyFolder(srcPath2, destPath2,
callback, fileCodePage, completedSize));
RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize));
}
else
{
RINOK(MyCopyFile(srcPath2, fileInfo, destPath2,
callback, fileCodePage, completedSize));
RINOK(MyCopyFile(srcPath2, fileInfo, destPath2, callback, completedSize));
}
}
return S_OK;
}
STDMETHODIMP CFSFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
if (numItems == 0)
return S_OK;
UINT64 totalSize = 0;
UINT32 i;
UInt32 i;
for (i = 0; i < numItems; i++)
{
int index = indices[i];
@@ -285,7 +272,7 @@ STDMETHODIMP CFSFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
/*
// doesn't work in network
else
if (!NDirectory::CreateComplexDirectory(GetSystemString(destPath, _fileCodePage)))
if (!NDirectory::CreateComplexDirectory(destPath)))
{
DWORD lastError = ::GetLastError();
UString message = UString(L"can not create folder ") +
@@ -306,13 +293,11 @@ STDMETHODIMP CFSFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
UString srcPath = _path + fileInfo.Name;
if (fileInfo.IsDirectory())
{
RINOK(CopyFolder(srcPath, destPath2, callback,
_fileCodePage, completedSize));
RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
}
else
{
RINOK(MyCopyFile(srcPath, fileInfo, destPath2,
callback, _fileCodePage, completedSize));
RINOK(MyCopyFile(srcPath, fileInfo, destPath2, callback, completedSize));
}
}
return S_OK;
@@ -326,14 +311,13 @@ HRESULT MyMoveFile(
const CFileInfoW &srcFileInfo,
const UString &destPathSpec,
IFolderOperationsExtractCallback *callback,
UINT fileCodePage,
UINT64 &completedSize)
{
UString destPath = destPathSpec;
if (destPath.CompareNoCase(srcPath) == 0)
{
UString message = UString(L"can not move file \'")
+ GetUnicodeString(destPath, fileCodePage) +
+ destPath +
UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -342,10 +326,10 @@ HRESULT MyMoveFile(
INT32 writeAskResult;
CMyComBSTR destPathResult;
RINOK(callback->AskWrite(
GetUnicodeString(srcPath, fileCodePage),
srcPath,
BoolToInt(false),
&srcFileInfo.LastWriteTime, &srcFileInfo.Size,
GetUnicodeString(destPath, fileCodePage),
destPath,
&destPathResult,
&writeAskResult));
if (IntToBool(writeAskResult))
@@ -354,8 +338,7 @@ HRESULT MyMoveFile(
RINOK(callback->SetCurrentFilePath(srcPath));
if (!MyMoveFile(srcPath, destPathNew, callback, completedSize))
{
UString message = UString(L"can not move to file ") +
GetUnicodeString(destPathNew, fileCodePage);
UString message = UString(L"can not move to file ") + destPathNew;
RINOK(callback->ShowMessage(message));
}
}
@@ -368,7 +351,6 @@ HRESULT MyMoveFolder(
const UString &srcPath,
const UString &destPathSpec,
IFolderOperationsExtractCallback *callback,
UINT fileCodePage,
UINT64 &completedSize)
{
UString destPath = destPathSpec;
@@ -377,9 +359,8 @@ HRESULT MyMoveFolder(
{
if (destPath.Length() == len || destPath[len] == L'\\')
{
UString message = UString(L"can not move folder \'")
+ GetUnicodeString(destPath, fileCodePage) +
UString(L"\' onto itself");
UString message = UString(L"can not move folder \'") +
destPath + UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
@@ -390,8 +371,7 @@ HRESULT MyMoveFolder(
if (!NDirectory::CreateComplexDirectory(destPath))
{
UString message = UString(L"can not create folder ") +
GetUnicodeString(destPath, fileCodePage);
UString message = UString(L"can not create folder ") + destPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
@@ -404,20 +384,17 @@ HRESULT MyMoveFolder(
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name;
if (fileInfo.IsDirectory())
{
RINOK(MyMoveFolder(srcPath2, destPath2,
callback, fileCodePage, completedSize));
RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize));
}
else
{
RINOK(MyMoveFile(srcPath2, fileInfo, destPath2,
callback, fileCodePage, completedSize));
RINOK(MyMoveFile(srcPath2, fileInfo, destPath2, callback, completedSize));
}
}
}
if (!NDirectory::MyRemoveDirectory(srcPath))
{
UString message = UString(L"can not remove folder") +
GetUnicodeString(srcPath, fileCodePage);
UString message = UString(L"can not remove folder") + srcPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
@@ -425,8 +402,8 @@ HRESULT MyMoveFolder(
}
STDMETHODIMP CFSFolder::MoveTo(
const UINT32 *indices,
UINT32 numItems,
const UInt32 *indices,
UInt32 numItems,
const wchar_t *path,
IFolderOperationsExtractCallback *callback)
{
@@ -434,7 +411,7 @@ STDMETHODIMP CFSFolder::MoveTo(
return S_OK;
UINT64 totalSize = 0;
UINT32 i;
UInt32 i;
for (i = 0; i < numItems; i++)
{
int index = indices[i];
@@ -456,7 +433,7 @@ STDMETHODIMP CFSFolder::MoveTo(
return E_INVALIDARG;
}
else
if (!NDirectory::CreateComplexDirectory(GetSystemString(destPath, _fileCodePage)))
if (!NDirectory::CreateComplexDirectory(destPath))
{
UString message = UString(L"can not create folder ") +
destPath;
@@ -475,13 +452,11 @@ STDMETHODIMP CFSFolder::MoveTo(
UString srcPath = _path + fileInfo.Name;
if (fileInfo.IsDirectory())
{
RINOK(MyMoveFolder(srcPath, destPath2, callback,
_fileCodePage, completedSize));
RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
}
else
{
RINOK(MyMoveFile(srcPath, fileInfo, destPath2,
callback, _fileCodePage, completedSize));
RINOK(MyMoveFile(srcPath, fileInfo, destPath2, callback, completedSize));
}
}
return S_OK;
@@ -489,7 +464,7 @@ STDMETHODIMP CFSFolder::MoveTo(
STDMETHODIMP CFSFolder::CopyFrom(
const wchar_t *fromFolderPath,
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress)
const wchar_t **itemsPaths, UInt32 numItems, IProgress *progress)
{
return E_NOTIMPL;
}

View File

@@ -3,49 +3,14 @@
#include "StdAfx.h"
#include "FormatUtils.h"
#include "Windows/ResourceString.h"
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
#include "Windows/ResourceString.h"
#ifdef LANG
#include "LangUtils.h"
#endif
/*
CSysString MyFormat(const CSysString &format, const CSysString &argument)
{
CSysString result;
_stprintf(result.GetBuffer(format.Length() + argument.Length() + 2),
format, argument);
result.ReleaseBuffer();
return result;
}
CSysString MyFormat(UINT32 resourceID,
#ifdef LANG
UINT32 aLangID,
#endif
const CSysString &argument)
{
return MyFormat(
#ifdef LANG
LangLoadString(resourceID, aLangID),
#else
NWindows::MyLoadString(resourceID),
#endif
argument);
}
*/
CSysString NumberToString(UINT64 number)
{
TCHAR temp[32];
ConvertUInt64ToString(number, temp);
return temp;
}
UString NumberToStringW(UINT64 number)
UString NumberToString(UInt64 number)
{
wchar_t numberString[32];
ConvertUInt64ToString(number, numberString);
@@ -59,16 +24,15 @@ UString MyFormatNew(const UString &format, const UString &argument)
return result;
}
UString MyFormatNew(UINT32 resourceID,
UString MyFormatNew(UINT resourceID,
#ifdef LANG
UINT32 aLangID,
UInt32 langID,
#endif
const UString &argument)
{
return MyFormatNew(
#ifdef LANG
LangLoadStringW(resourceID, aLangID),
LangString(resourceID, langID),
#else
NWindows::MyLoadStringW(resourceID),
#endif

View File

@@ -3,18 +3,15 @@
#ifndef __FORMATUTILS_H
#define __FORMATUTILS_H
#include "Common/Types.h"
#include "Common/String.h"
// CSysString MyFormat(const CSysString &format, const CSysString &argument);
// CSysString NumberToString(UINT64 number);
UString NumberToStringW(UINT64 number);
UString NumberToString(UInt64 number);
UString MyFormatNew(const UString &format, const UString &argument);
UString MyFormatNew(UINT32 resourceID,
UString MyFormatNew(UINT resourceID,
#ifdef LANG
UINT32 aLangID,
UInt32 langID,
#endif
const UString &argument);

View File

@@ -14,10 +14,7 @@ void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
{
UString path;
if (!::GetProgramFolderPath(path))
{
// AfxMessageBox(TEXT("App Path Registry Item not found"));
return;
}
path += kHelpFileName;
path += topicFile;
HtmlHelp(hwnd, GetSystemString(path), HH_DISPLAY_TOPIC, NULL);

View File

@@ -28,10 +28,10 @@ namespace NPlugin
FOLDER_INTERFACE(IFolderFolder, 0x00)
{
STDMETHOD(LoadItems)() PURE;
STDMETHOD(GetNumberOfItems)(UINT32 *numItems) PURE;
// STDMETHOD(GetNumberOfSubFolders)(UINT32 *numSubFolders) PURE;
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder) PURE;
STDMETHOD(GetNumberOfItems)(UInt32 *numItems) PURE;
// STDMETHOD(GetNumberOfSubFolders)(UInt32 *numSubFolders) PURE;
STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder) PURE;
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder) PURE;
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder) PURE;
STDMETHOD(GetName)(BSTR *name) PURE;
@@ -40,8 +40,8 @@ FOLDER_INTERFACE(IFolderFolder, 0x00)
FOLDER_INTERFACE(IEnumProperties, 0x01)
{
// STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator) PURE;
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties) PURE;
STDMETHOD(GetPropertyInfo)(UINT32 index,
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) PURE;
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType) PURE;
};
@@ -57,7 +57,7 @@ FOLDER_INTERFACE(IFolderGetPath, 0x03)
FOLDER_INTERFACE(IFolderWasChanged, 0x04)
{
STDMETHOD(WasChanged)(INT32 *wasChanged) PURE;
STDMETHOD(WasChanged)(Int32 *wasChanged) PURE;
};
/*
@@ -71,12 +71,12 @@ FOLDER_INTERFACE_SUB(IFolderOperationsExtractCallback, IProgress, 0x06, 0x01)
{
STDMETHOD(AskWrite)(
const wchar_t *srcPath,
INT32 srcIsFolder,
Int32 srcIsFolder,
const FILETIME *srcTime,
const UINT64 *srcSize,
const UInt64 *srcSize,
const wchar_t *destPathRequest,
BSTR *destPathResult,
INT32 *writeAnswer) PURE;
Int32 *writeAnswer) PURE;
STDMETHOD(ShowMessage)(const wchar_t *message) PURE;
STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath) PURE;
};
@@ -86,13 +86,13 @@ FOLDER_INTERFACE_SUB(IFolderOperationsUpdateCallback, IProgress, 0x06, 0x02)
{
STDMETHOD(AskOverwrite)(
const wchar_t *srcPath,
INT32 destIsFolder,
Int32 destIsFolder,
const FILETIME *destTime,
const UINT64 *destSize,
const UInt64 *destSize,
const wchar_t *aDestPathRequest,
const wchar_t *aDestName,
BSTR *aDestPathResult,
INT32 *aResult);
Int32 *aResult);
};
*/
@@ -100,32 +100,32 @@ FOLDER_INTERFACE(IFolderOperations, 0x06)
{
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress) PURE;
STDMETHOD(CreateFile)(const wchar_t *name, IProgress *progress) PURE;
STDMETHOD(Rename)(UINT32 index, const wchar_t *newName, IProgress *progress) PURE;
STDMETHOD(Delete)(const UINT32 *indices, UINT32 numItems, IProgress *progress) PURE;
STDMETHOD(CopyTo)(const UINT32 *indices, UINT32 numItems,
STDMETHOD(Rename)(UInt32 index, const wchar_t *newName, IProgress *progress) PURE;
STDMETHOD(Delete)(const UInt32 *indices, UInt32 numItems, IProgress *progress) PURE;
STDMETHOD(CopyTo)(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback) PURE;
STDMETHOD(MoveTo)(const UINT32 *indices, UINT32 numItems,
STDMETHOD(MoveTo)(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback) PURE;
STDMETHOD(CopyFrom)(const wchar_t *fromFolderPath,
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress) PURE;
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress) PURE;
const wchar_t **itemsPaths, UInt32 numItems, IProgress *progress) PURE;
STDMETHOD(SetProperty)(UInt32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress) PURE;
};
/*
FOLDER_INTERFACE2(IFolderOperationsDeleteToRecycleBin, 0x06, 0x03)
{
STDMETHOD(DeleteToRecycleBin)(const UINT32 *indices, UINT32 numItems, IProgress *progress) PURE;
STDMETHOD(DeleteToRecycleBin)(const UInt32 *indices, UInt32 numItems, IProgress *progress) PURE;
};
*/
FOLDER_INTERFACE(IFolderGetSystemIconIndex, 0x07)
{
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex) PURE;
STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex) PURE;
};
FOLDER_INTERFACE(IFolderGetItemFullSize, 0x08)
{
STDMETHOD(GetItemFullSize)(UINT32 index, PROPVARIANT *value, IProgress *progress) PURE;
STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress) PURE;
};
FOLDER_INTERFACE(IFolderClone, 0x09)

View File

@@ -5,7 +5,6 @@
#include "LangUtils.h"
#include "Common/StringConvert.h"
#include "Common/StringToInt.h"
#include "Windows/ResourceString.h"
#include "Windows/Synchronization.h"
#include "Windows/Window.h"
#include "Windows/FileFind.h"
@@ -15,24 +14,28 @@
using namespace NWindows;
static CLang g_Lang;
CSysString g_LangID;
UString g_LangID;
#ifndef _UNICODE
extern bool g_IsNT;
#endif
void ReloadLang()
{
ReadRegLang(g_LangID);
g_Lang.Clear();
if (!g_LangID.IsEmpty() && g_LangID != TEXT("-"))
if (!g_LangID.IsEmpty() && g_LangID != L"-")
{
CSysString langPath = g_LangID;
UString langPath = g_LangID;
if (langPath.Find('\\') < 0)
{
if (langPath.Find('.') < 0)
langPath += TEXT(".txt");
langPath += L".txt";
UString folderPath;
if (GetProgramFolderPath(folderPath))
langPath = GetSystemString(folderPath) + CSysString(TEXT("Lang\\")) + langPath;
langPath = folderPath + UString(L"Lang\\") + langPath;
}
g_Lang.Open(langPath);
g_Lang.Open(GetSystemString(langPath));
}
}
@@ -48,14 +51,6 @@ void LoadLangOneTime()
ReloadLang();
}
/*
class CLangLoader
{
public:
CLangLoader() { ReloadLang(); }
} g_LangLoader;
*/
void LangSetDlgItemsText(HWND dialogWindow, CIDLangPair *idLangPairs, int numItems)
{
for (int i = 0; i < numItems; i++)
@@ -74,10 +69,10 @@ void LangSetWindowText(HWND window, UInt32 langID)
{
UString message;
if (g_Lang.GetMessage(langID, message))
SetWindowText(window, GetSystemString(message));
MySetWindowText(window, message);
}
UString LangLoadString(UInt32 langID)
UString LangString(UInt32 langID)
{
UString message;
if (g_Lang.GetMessage(langID, message))
@@ -85,15 +80,7 @@ UString LangLoadString(UInt32 langID)
return UString();
}
CSysString LangLoadString(UINT resourceID, UInt32 langID)
{
UString message;
if (g_Lang.GetMessage(langID, message))
return GetSystemString(message);
return NWindows::MyLoadString(resourceID);
}
UString LangLoadStringW(UINT resourceID, UInt32 langID)
UString LangString(UINT resourceID, UInt32 langID)
{
UString message;
if (g_Lang.GetMessage(langID, message))
@@ -180,16 +167,19 @@ void FindMatchLang(UString &shortName)
void ReloadLangSmart()
{
#ifdef _UNICODE
ReadRegLang(g_LangID);
if (g_LangID.IsEmpty())
{
UString shortName;
FindMatchLang(shortName);
if (shortName.IsEmpty())
shortName = L"-";
SaveRegLang(GetSystemString(shortName));
}
#ifndef _UNICODE
if (g_IsNT)
#endif
{
ReadRegLang(g_LangID);
if (g_LangID.IsEmpty())
{
UString shortName;
FindMatchLang(shortName);
if (shortName.IsEmpty())
shortName = L"-";
SaveRegLang(shortName);
}
}
ReloadLang();
}

View File

@@ -4,8 +4,9 @@
#define __LANGUTILS_H
#include "Common/Lang.h"
#include "Windows/ResourceString.h"
extern CSysString g_LangID;
extern UString g_LangID;
struct CIDLangPair
{
@@ -28,9 +29,13 @@ void LoadLangs(CObjectVector<CLangEx> &langs);
void LangSetDlgItemsText(HWND dialogWindow, CIDLangPair *idLangPairs, int numItems);
void LangSetWindowText(HWND window, UInt32 langID);
UString LangLoadString(UInt32 langID);
CSysString LangLoadString(UINT resourceID, UInt32 langID);
UString LangLoadStringW(UINT resourceID, UInt32 langID);
UString LangString(UInt32 langID);
UString LangString(UINT resourceID, UInt32 langID);
#ifdef LANG
#define LangStringSpec(resourceID, langID) LangString(resourceID, langID)
#else
#define LangStringSpec(resourceID, langID) NWindows::MyLoadStringW(resourceID)
#endif
#endif

View File

@@ -135,61 +135,6 @@ static int FindLangItem(int ControlID)
return -1;
}
/*
void MyChangeMenu(HMENU menuLoc, int baseIndex = -1)
{
CMenu menu;
menu.Attach(menuLoc);
for (int i = 0; i < menu.GetItemCount(); i++)
{
HMENU subMenu = menu.GetSubMenu(i);
CSysString menuString;
menu.GetMenuString(i, MF_BYPOSITION, menuString);
// if (menu.GetItemInfo(i, true, &menuInfo))
{
CSysString newString;
if (subMenu)
{
MyChangeMenu(subMenu);
if (baseIndex >= 0 && baseIndex < sizeof(kStringLangPairs) /
sizeof(kStringLangPairs[0]))
newString = LangLoadString(kStringLangPairs[baseIndex++].LangID);
else
continue;
if (newString.IsEmpty())
continue;
// int langPos = FindStringLangItem(GetUnicodeString(menuInfo.dwTypeData));
// if (langPos >= 0)
// newString = LangLoadString(kStringLangPairs[langPos].LangID);
// else
// newString = menuInfo.dwTypeData;
}
else
{
UINT id = menu.GetItemID(i);
int langPos = FindLangItem(id);
if (langPos < 0)
continue;
newString = LangLoadString(kIDLangPairs[langPos].LangID);
if (newString.IsEmpty())
continue;
int tabPos = menuString.ReverseFind(wchar_t('\t'));
if (tabPos >= 0)
newString += menuString.Mid(tabPos);
}
MENUITEMINFO menuInfo;
menuInfo.cbSize = sizeof(menuInfo);
menuInfo.fType = MFT_STRING;
menuInfo.fMask = MIIM_TYPE;
menuInfo.dwTypeData = (LPTSTR)(LPCTSTR)newString;
menu.SetItemInfo(i, true, &menuInfo);
// HMENU subMenu = menu.GetSubMenu(i);
}
}
}
*/
/*
static bool g_IsNew_fMask = true;
@@ -241,70 +186,62 @@ static UINT Get_fMaskForFTypeAndString()
return MIIM_TYPE;
}
static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
{
CMenu menu;
menu.Attach(menuLoc);
for (int i = 0; i < menu.GetItemCount(); i++)
{
MENUITEMINFO menuInfo;
ZeroMemory(&menuInfo, sizeof(menuInfo));
menuInfo.cbSize = sizeof(menuInfo);
menuInfo.fMask = Get_fMaskForString() | MIIM_SUBMENU | MIIM_ID;
menuInfo.fType = MFT_STRING;
const int kBufferSize = 1024;
TCHAR buffer[kBufferSize + 1];
menuInfo.dwTypeData = buffer;
menuInfo.cch = kBufferSize;
if (menu.GetItemInfo(i, true, &menuInfo))
CMenuItem item;
item.fMask = Get_fMaskForString() | MIIM_SUBMENU | MIIM_ID;
item.fType = MFT_STRING;
if (menu.GetItem(i, true, item))
{
CSysString newString;
if (menuInfo.hSubMenu)
UString newString;
if (item.hSubMenu)
{
if (level == 1 && menuIndex == kBookmarksMenuIndex)
newString = GetSystemString(LangLoadString(kAddToFavoritesLangID));
newString = LangString(kAddToFavoritesLangID);
else
{
MyChangeMenu(menuInfo.hSubMenu, level + 1, i);
MyChangeMenu(item.hSubMenu, level + 1, i);
if (level == 1 && menuIndex == kViewMenuIndex)
{
newString = GetSystemString(LangLoadString(kToolbarsLangID));
newString = LangString(kToolbarsLangID);
}
else
{
if (level == 0 && i < sizeof(kStringLangPairs) /
sizeof(kStringLangPairs[0]))
newString = GetSystemString(LangLoadString(kStringLangPairs[i].LangID));
newString = LangString(kStringLangPairs[i].LangID);
else
continue;
}
}
if (newString.IsEmpty())
continue;
// int langPos = FindStringLangItem(GetUnicodeString(menuInfo.dwTypeData));
// if (langPos >= 0)
// newString = LangLoadString(kStringLangPairs[langPos].LangID);
// else
// newString = menuInfo.dwTypeData;
}
else
{
int langPos = FindLangItem(menuInfo.wID);
int langPos = FindLangItem(item.wID);
if (langPos < 0)
continue;
newString = GetSystemString(LangLoadString(kIDLangPairs[langPos].LangID));
newString = LangString(kIDLangPairs[langPos].LangID);
if (newString.IsEmpty())
continue;
CSysString shorcutString = menuInfo.dwTypeData;
UString shorcutString = item.StringValue;
int tabPos = shorcutString.ReverseFind(wchar_t('\t'));
if (tabPos >= 0)
newString += shorcutString.Mid(tabPos);
}
menuInfo.dwTypeData = (LPTSTR)(LPCTSTR)newString;
menuInfo.fMask = Get_fMaskForString();
menuInfo.fType = MFT_STRING;
menu.SetItemInfo(i, true, &menuInfo);
{
item.StringValue = newString;
item.fMask = Get_fMaskForString();
item.fType = MFT_STRING;
menu.SetItem(i, true, item);
}
}
}
}
@@ -353,20 +290,12 @@ static void CopyMenu(HMENU srcMenuSpec, HMENU destMenuSpec)
int startPos = 0;
for (int i = 0; i < srcMenu.GetItemCount(); i++)
{
MENUITEMINFO menuInfo;
ZeroMemory(&menuInfo, sizeof(menuInfo));
menuInfo.cbSize = sizeof(menuInfo);
menuInfo.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
menuInfo.fType = MFT_STRING;
const int kBufferSize = 1024;
TCHAR buffer[kBufferSize + 1];
menuInfo.dwTypeData = buffer;
menuInfo.cch = kBufferSize;
if (srcMenu.GetItemInfo(i, true, &menuInfo))
{
if (destMenu.InsertItem(startPos, true, &menuInfo))
CMenuItem item;
item.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
item.fType = MFT_STRING;
if (srcMenu.GetItem(i, true, item))
if (destMenu.InsertItem(startPos, true, item))
startPos++;
}
}
}
@@ -422,14 +351,13 @@ void OnMenuActivating(HWND hWnd, HMENU hMenu, int position)
int i;
for (i = 0; i < 10; i++)
{
UString s = LangLoadStringW(IDS_BOOKMARK, 0x03000720);
UString s = LangString(IDS_BOOKMARK, 0x03000720);
s += L" ";
wchar_t c = L'0' + i;
s += c;
s += L"\tAlt+Shift+";
s += c;
subMenu.AppendItem(MF_STRING, kSetBookmarkMenuID + i,
GetSystemString(s));
subMenu.AppendItem(MF_STRING, kSetBookmarkMenuID + i, s);
}
while (menu.GetItemCount() > 2)
@@ -445,15 +373,13 @@ void OnMenuActivating(HWND hWnd, HMENU hMenu, int position)
path = path.Left(kFirstPartSize) + UString(L" ... ") +
path.Right(kMaxSize - kFirstPartSize);
}
CSysString s = GetSystemString(path);
UString s = path;
if (s.IsEmpty())
s = TEXT("-");
s += TEXT("\tAlt+");
s += ('0' + i);
s = L"-";
s += L"\tAlt+";
s += (L'0' + i);
menu.AppendItem(MF_STRING, kOpenBookmarkMenuID + i, s);
}
// menu.AppendItem(MF_STRING, 100, TEXT("Test2\tAlt+2"));
}
}
@@ -490,47 +416,17 @@ void LoadFileMenu(HMENU hMenu, int startPos, bool forFileMode,
for (int i = 0; i < g_FileMenu.GetItemCount(); i++)
{
MENUITEMINFO menuInfo;
ZeroMemory(&menuInfo, sizeof(menuInfo));
menuInfo.cbSize = sizeof(menuInfo);
CMenuItem item;
/*
menuInfo.fMask = MIIM_STATE | MIIM_ID | MIIM_TYPE;
menuInfo.fType = MFT_STRING;
if (!srcMenu.GetItemInfo(i, true, &menuInfo))
{
// MessageBox(0, NError::MyFormatMessage(GetLastError()), "Error", 0);
continue;
}
// menuInfo.wID = srcMenu.GetItemID(i);
// menuInfo.fState = srcMenu.GetItemState(i, MF_BYPOSITION);
// menuInfo.hSubMenu = srcMenu.GetSubMenu(i);
CSysString menuString;
if (menuInfo.fType == MFT_STRING)
{
srcMenu.GetMenuString(i, MF_BYPOSITION, menuString);
menuInfo.dwTypeData = (LPTSTR)(LPCTSTR)menuString;
}
menuInfo.dwTypeData = (LPTSTR)(LPCTSTR)menuString;
*/
menuInfo.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
menuInfo.fType = MFT_STRING;
const int kBufferSize = 1024;
TCHAR buffer[kBufferSize + 1];
menuInfo.dwTypeData = buffer;
menuInfo.cch = kBufferSize;
if (g_FileMenu.GetItemInfo(i, true, &menuInfo))
item.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
item.fType = MFT_STRING;
if (g_FileMenu.GetItem(i, true, item))
{
if (!programMenu)
if (menuInfo.wID == IDCLOSE)
if (item.wID == IDCLOSE)
continue;
/*
bool createItem = (menuInfo.wID == IDM_CREATE_FOLDER ||
menuInfo.wID == IDM_CREATE_FILE);
bool createItem = (item.wID == IDM_CREATE_FOLDER || item.wID == IDM_CREATE_FILE);
if (forFileMode)
{
if (createItem)
@@ -542,21 +438,20 @@ void LoadFileMenu(HMENU hMenu, int startPos, bool forFileMode,
continue;
}
*/
if (destMenu.InsertItem(startPos, true, &menuInfo))
if (destMenu.InsertItem(startPos, true, item))
startPos++;
}
}
while (destMenu.GetItemCount() > 0)
{
MENUITEMINFO menuInfo;
ZeroMemory(&menuInfo, sizeof(menuInfo));
menuInfo.cbSize = sizeof(menuInfo);
menuInfo.fMask = MIIM_TYPE;
menuInfo.dwTypeData = 0;
CMenuItem item;
item.fMask = MIIM_TYPE;
item.fType = 0;
// item.dwTypeData = 0;
int lastIndex = destMenu.GetItemCount() - 1;
if (!destMenu.GetItemInfo(lastIndex, true, &menuInfo))
if (!destMenu.GetItem(lastIndex, true, item))
break;
if(menuInfo.fType != MFT_SEPARATOR)
if(item.fType != MFT_SEPARATOR)
break;
if (!destMenu.RemoveItem(lastIndex, MF_BYPOSITION))
break;

View File

@@ -43,9 +43,9 @@ void CNetFolder::Init(const UString &path)
}
Init(0, 0 , L"");
*/
CResource resource;
CResourceW resource;
resource.RemoteNameIsDefined = true;
resource.RemoteName = GetSystemString(path.Left(path.Length() - 1));
resource.RemoteName = path.Left(path.Length() - 1);
resource.ProviderIsDefined = false;
resource.LocalNameIsDefined = false;
resource.CommentIsDefined = false;
@@ -53,18 +53,17 @@ void CNetFolder::Init(const UString &path)
resource.Scope = RESOURCE_GLOBALNET;
resource.Usage = 0;
resource.DisplayType = 0;
CResource aDestResource;
CSysString aSystemPathPart;
DWORD result = GetResourceInformation(resource, aDestResource,
aSystemPathPart);
CResourceW destResource;
UString systemPathPart;
DWORD result = GetResourceInformation(resource, destResource, systemPathPart);
if (result == NO_ERROR)
Init(&aDestResource, 0, path);
Init(&destResource, 0, path);
else
Init(0, 0 , L"");
return;
}
void CNetFolder::Init(const NWindows::NNet::CResource *netResource,
void CNetFolder::Init(const NWindows::NNet::CResourceW *netResource,
IFolderFolder *parentFolder, const UString &path)
{
_path = path;
@@ -76,7 +75,7 @@ void CNetFolder::Init(const NWindows::NNet::CResource *netResource,
_netResourcePointer = &_netResource;
// if (_netResource.DisplayType == RESOURCEDISPLAYTYPE_SERVER)
_path = GetUnicodeString(_netResource.RemoteName) + L'\\';
_path = _netResource.RemoteName + L'\\';
}
_parentFolder = parentFolder;
}
@@ -113,7 +112,7 @@ STDMETHODIMP CNetFolder::LoadItems()
{
if (!resource.RemoteNameIsDefined) // For Win 98, I don't know what's wrong
resource.RemoteName = resource.Comment;
resource.Name = GetUnicodeString(resource.RemoteName);
resource.Name = resource.RemoteName;
int aPos = resource.Name.ReverseFind(L'\\');
if (aPos >= 0)
{
@@ -128,6 +127,8 @@ STDMETHODIMP CNetFolder::LoadItems()
return result;
}
/*
It's too slow for some systems.
if (_netResourcePointer && _netResource.DisplayType == RESOURCEDISPLAYTYPE_SERVER)
{
for (char c = 'a'; c <= 'z'; c++)
@@ -135,11 +136,11 @@ STDMETHODIMP CNetFolder::LoadItems()
CResourceEx resource;
resource.Name = UString(wchar_t(c)) + L'$';
resource.RemoteNameIsDefined = true;
resource.RemoteName = GetSystemString(_path + resource.Name);
resource.RemoteName = _path + resource.Name;
NFile::NFind::CFindFile aFindFile;
NFile::NFind::CFileInfo aFileInfo;
if (!aFindFile.FindFirst(resource.RemoteName + CSysString(TEXT("\\*")), aFileInfo))
NFile::NFind::CFindFile findFile;
NFile::NFind::CFileInfoW fileInfo;
if (!findFile.FindFirst(resource.RemoteName + UString(L"\\*"), fileInfo))
continue;
resource.Usage = RESOURCEUSAGE_CONNECTABLE;
resource.LocalNameIsDefined = false;
@@ -148,17 +149,18 @@ STDMETHODIMP CNetFolder::LoadItems()
_items.Add(resource);
}
}
*/
return S_OK;
}
STDMETHODIMP CNetFolder::GetNumberOfItems(UINT32 *numItems)
STDMETHODIMP CNetFolder::GetNumberOfItems(UInt32 *numItems)
{
*numItems = _items.Size();
return S_OK;
}
STDMETHODIMP CNetFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT *value)
STDMETHODIMP CNetFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant propVariant;
const CResourceEx &item = _items[itemIndex];
@@ -173,25 +175,22 @@ STDMETHODIMP CNetFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIAN
break;
case kpidLocalName:
if (item.LocalNameIsDefined)
propVariant = GetUnicodeString(item.LocalName);
propVariant = item.LocalName;
break;
case kpidComment:
if (item.CommentIsDefined)
propVariant = GetUnicodeString(item.Comment);
propVariant = item.Comment;
break;
case kpidProvider:
if (item.ProviderIsDefined)
propVariant = GetUnicodeString(item.Provider);
propVariant = item.Provider;
break;
}
propVariant.Detach(value);
return S_OK;
}
static inline UINT GetCurrentCodePage()
{ return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
STDMETHODIMP CNetFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolder)
STDMETHODIMP CNetFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
*resultFolder = 0;
const CResourceEx &resource = _items[index];
@@ -200,16 +199,14 @@ STDMETHODIMP CNetFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolder
{
CFSFolder *fsFolderSpec = new CFSFolder;
CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
RINOK(fsFolderSpec->Init(
GetUnicodeString(resource.RemoteName, GetCurrentCodePage())
+ L'\\', this));
RINOK(fsFolderSpec->Init(resource.RemoteName + L'\\', this));
*resultFolder = subFolder.Detach();
}
else
{
CNetFolder *netFolder = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolder;
netFolder->Init(&resource, this, GetUnicodeString(resource.Name) + L'\\');
netFolder->Init(&resource, this, resource.Name + L'\\');
*resultFolder = subFolder.Detach();
}
return S_OK;
@@ -231,7 +228,7 @@ STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder)
}
if (_netResourcePointer != 0)
{
CResource resourceParent;
CResourceW resourceParent;
DWORD result = GetResourceParent(_netResource, resourceParent);
if (result != NO_ERROR)
return result;
@@ -257,13 +254,13 @@ STDMETHODIMP CNetFolder::GetName(BSTR *name)
*/
}
STDMETHODIMP CNetFolder::GetNumberOfProperties(UINT32 *numProperties)
STDMETHODIMP CNetFolder::GetNumberOfProperties(UInt32 *numProperties)
{
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
return S_OK;
}
STDMETHODIMP CNetFolder::GetPropertyInfo(UINT32 index,
STDMETHODIMP CNetFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -289,12 +286,12 @@ STDMETHODIMP CNetFolder::GetPath(BSTR *path)
return S_OK;
}
STDMETHODIMP CNetFolder::GetSystemIconIndex(UINT32 index, INT32 *iconIndex)
STDMETHODIMP CNetFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
{
if (index >= (UINT32)_items.Size())
if (index >= (UInt32)_items.Size())
return E_INVALIDARG;
*iconIndex = 0;
const CResource &resource = _items[index];
const CResourceW &resource = _items[index];
int iconIndexTemp;
if (resource.DisplayType == RESOURCEDISPLAYTYPE_SERVER ||
resource.Usage == RESOURCEUSAGE_CONNECTABLE)

View File

@@ -11,7 +11,7 @@
#include "IFolder.h"
struct CResourceEx: public NWindows::NNet::CResource
struct CResourceEx: public NWindows::NNet::CResourceW
{
UString Name;
};
@@ -33,23 +33,23 @@ public:
)
STDMETHOD(LoadItems)();
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder);
STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder);
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder);
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder);
STDMETHOD(GetName)(BSTR *name);
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties);
STDMETHOD(GetPropertyInfo)(UINT32 index,
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType);
STDMETHOD(GetTypeID)(BSTR *name);
STDMETHOD(GetPath)(BSTR *path);
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex);
STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
private:
NWindows::NNet::CResource _netResource;
NWindows::NNet::CResource *_netResourcePointer;
NWindows::NNet::CResourceW _netResource;
NWindows::NNet::CResourceW *_netResourcePointer;
CObjectVector<CResourceEx> _items;
@@ -58,7 +58,7 @@ private:
public:
void Init(const UString &path);
void Init(const NWindows::NNet::CResource *netResource,
void Init(const NWindows::NNet::CResourceW *netResource,
IFolderFolder *parentFolder, const UString &path);
CNetFolder(): _netResourcePointer(0) {}
};

View File

@@ -46,7 +46,7 @@ STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value
switch(propID)
{
case kpidName:
propVariant = GetUnicodeString(_fileInfo.Name);
propVariant = _fileInfo.Name;
break;
case kpidIsFolder:
propVariant = _fileInfo.IsDirectory();

View File

@@ -24,33 +24,7 @@
#include "MyLoadMenu.h"
#include "App.h"
void FillInPropertyPage(PROPSHEETPAGE* page, HINSTANCE instance, int dialogID,
NWindows::NControl::CPropertyPage *propertyPage, const CSysString &title)
{
page->dwSize = sizeof(PROPSHEETPAGE);
// page->dwSize = sizeof(PROPSHEETPAGEW_V1_SIZE);
page->dwFlags = PSP_HASHELP;
page->hInstance = instance;
page->pszTemplate = MAKEINTRESOURCE(dialogID);
page->pszIcon = NULL;
page->pfnDlgProc = NWindows::NControl::ProperyPageProcedure;
if (title.IsEmpty())
page->pszTitle = NULL;
else
{
page->dwFlags |= PSP_USETITLE;
page->pszTitle = title;
}
page->lParam = LPARAM(propertyPage);
page->pfnCallback = NULL;
// page->dwFlags = 0;
// page->pszTitle = NULL;
// page->lParam = 0;
}
using namespace NWindows;
void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance)
{
@@ -60,54 +34,32 @@ void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance)
CSettingsPage settingsPage;
CLangPage langPage;
CSysStringVector titles;
CObjectVector<NControl::CPageInfo> pages;
UINT32 langIDs[] = { 0x03010300, 0x03010100, 0x03010200, 0x03010400, 0x01000400};
UINT pageIDs[] = { IDD_SYSTEM, IDD_PLUGINS, IDD_EDIT, IDD_SETTINGS, IDD_LANG};
NControl::CPropertyPage *pagePinters[] = { &systemPage, &pluginsPage, &editPage, &settingsPage, &langPage };
const int kNumPages = sizeof(langIDs) / sizeof(langIDs[0]);
for (int i = 0; i < kNumPages; i++)
titles.Add(GetSystemString(LangLoadString(langIDs[i])));
PROPSHEETPAGE pages[kNumPages];
{
NControl::CPageInfo page;
page.Title = LangString(langIDs[i]);
page.ID = pageIDs[i];
page.Page = pagePinters[i];
pages.Add(page);
}
FillInPropertyPage(&pages[0], hInstance, IDD_SYSTEM, &systemPage, titles[0]);
FillInPropertyPage(&pages[1], hInstance, IDD_PLUGINS, &pluginsPage, titles[1]);
FillInPropertyPage(&pages[2], hInstance, IDD_EDIT, &editPage, titles[2]);
FillInPropertyPage(&pages[3], hInstance, IDD_SETTINGS, &settingsPage, titles[3]);
FillInPropertyPage(&pages[4], hInstance, IDD_LANG, &langPage, titles[4]);
PROPSHEETHEADER sheet;
// sheet.dwSize = sizeof(PROPSHEETHEADER_V1_SIZE);
sheet.dwSize = sizeof(PROPSHEETHEADER);
sheet.dwFlags = PSH_PROPSHEETPAGE;
sheet.hwndParent = hwndOwner;
sheet.hInstance = hInstance;
CSysString title = LangLoadString(IDS_OPTIONS, 0x03010000);
sheet.pszCaption = title;
sheet.nPages = sizeof(pages) / sizeof(PROPSHEETPAGE);
sheet.nStartPage = 0;
sheet.ppsp = pages;
sheet.pfnCallback = NULL;
if (::PropertySheet(&sheet) != -1)
int res = NControl::MyPropertySheet(pages, hwndOwner, LangString(IDS_OPTIONS, 0x03010000));
if (res != -1 && res != 0)
{
if (langPage._langWasChanged)
{
g_App._window.SetText(LangLoadStringW(IDS_APP_TITLE, 0x03000000));
g_App._window.SetText(LangString(IDS_APP_TITLE, 0x03000000));
MyLoadMenu();
}
g_App.SetListSettings();
g_App.SetShowSystemMenu();
g_App.RefreshAllPanels();
g_App.ReloadToolbars();
// ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
// ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
}
/*
else
MessageBox(0, NWindows::NError::MyFormatMessage(GetLastError()), TEXT("PropertySheet"), 0);
*/
}

View File

@@ -22,6 +22,10 @@
using namespace NWindows;
#ifndef _UNICODE
extern bool g_IsNT;
#endif
static const UINT_PTR kTimerID = 1;
static const UINT kTimerElapse = 1000;
@@ -49,7 +53,7 @@ CPanel::~CPanel()
CloseOpenFolders();
}
static LPCTSTR kClassName = TEXT("7-Zip::Panel");
static LPCWSTR kClassName = L"7-Zip::Panel";
LRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
@@ -196,7 +200,12 @@ LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
_panel->_lastFocusedIsList = true;
_panel->_panelCallback->PanelWasFocused();
}
return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
#ifndef _UNICODE
if (g_IsNT)
return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
else
#endif
return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
}
/*
@@ -278,7 +287,12 @@ LRESULT CMyComboBoxEdit::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return 0;
}
}
return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
#ifndef _UNICODE
if (g_IsNT)
return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
else
#endif
return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
}
bool CPanel::OnCreate(CREATESTRUCT *createStruct)
@@ -318,11 +332,19 @@ bool CPanel::OnCreate(CREATESTRUCT *createStruct)
HWND(*this), (HMENU)_baseID + 1, g_hInstance, NULL))
return false;
_listView.SetUnicodeFormat(true);
_listView.SetUserDataLongPtr(LONG_PTR(&_listView));
_listView._panel = this;
_listView._origWindowProc = (WNDPROC)_listView.SetLongPtr(GWLP_WNDPROC,
LONG_PTR(ListViewSubclassProc));
#ifndef _UNICODE
if(g_IsNT)
_listView._origWindowProc =
(WNDPROC)_listView.SetLongPtrW(GWLP_WNDPROC, LONG_PTR(ListViewSubclassProc));
else
#endif
_listView._origWindowProc =
(WNDPROC)_listView.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ListViewSubclassProc));
SHFILEINFO shellInfo;
HIMAGELIST imageList = (HIMAGELIST)SHGetFileInfo(TEXT(""),
@@ -401,8 +423,6 @@ bool CPanel::OnCreate(CREATESTRUCT *createStruct)
;
}
_headerToolBar.Attach(::CreateToolbarEx ((*this), toolbarStyle,
_baseID + 2, 11,
(HINSTANCE)HINST_COMMCTRL,
@@ -414,12 +434,15 @@ bool CPanel::OnCreate(CREATESTRUCT *createStruct)
icex.dwICC = ICC_USEREX_CLASSES;
InitCommonControlsEx(&icex);
_headerComboBox.CreateEx(0, WC_COMBOBOXEX, NULL,
_headerComboBox.CreateEx(0, WC_COMBOBOXEXW, NULL,
WS_BORDER | WS_VISIBLE |WS_CHILD | CBS_DROPDOWN | CBS_AUTOHSCROLL,
0, 0, 100, 20,
((_headerReBar == 0) ? HWND(*this) : _headerToolBar),
(HMENU)(_comboBoxID),
g_hInstance, NULL);
// _headerComboBox.SendMessage(CBEM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
_headerComboBox.SetExtendedStyle(CBES_EX_PATHWORDBREAKPROC, CBES_EX_PATHWORDBREAKPROC);
/*
@@ -430,11 +453,20 @@ bool CPanel::OnCreate(CREATESTRUCT *createStruct)
LONG_PTR(ComboBoxSubclassProc));
*/
_comboBoxEdit.Attach(_headerComboBox.GetEditControl());
// _comboBoxEdit.SendMessage(CCM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
_comboBoxEdit.SetUserDataLongPtr(LONG_PTR(&_comboBoxEdit));
_comboBoxEdit._panel = this;
_comboBoxEdit._origWindowProc =
(WNDPROC)_comboBoxEdit.SetLongPtr(GWLP_WNDPROC,
LONG_PTR(ComboBoxEditSubclassProc));
#ifndef _UNICODE
if(g_IsNT)
_comboBoxEdit._origWindowProc =
(WNDPROC)_comboBoxEdit.SetLongPtrW(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
else
#endif
_comboBoxEdit._origWindowProc =
(WNDPROC)_comboBoxEdit.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
if (_headerReBar)
@@ -472,8 +504,8 @@ bool CPanel::OnCreate(CREATESTRUCT *createStruct)
// _headerReBar.MaximizeBand(1, false);
}
_statusBar.Create(WS_CHILD | WS_VISIBLE, TEXT("Status"), (*this), _statusBarID);
// _statusBar2.Create(WS_CHILD | WS_VISIBLE, TEXT("Status"), (*this), _statusBarID + 1);
_statusBar.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID);
// _statusBar2.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID + 1);
int sizes[] = {150, 200, 250, -1};
_statusBar.SetParts(4, sizes);
@@ -607,7 +639,7 @@ void CPanel::MessageBox(LPCWSTR message)
void CPanel::MessageBoxMyError(LPCWSTR message)
{ MessageBox(message, L"Error"); }
void CPanel::MessageBoxError(HRESULT errorCode, LPCWSTR caption)
{ MessageBox(GetUnicodeString(NError::MyFormatMessage(errorCode)), caption); }
{ MessageBox(NError::MyFormatMessageW(errorCode), caption); }
void CPanel::MessageBoxError(HRESULT errorCode)
{ MessageBoxError(errorCode, L"7-Zip"); }
void CPanel::MessageBoxLastError(LPCWSTR caption)
@@ -629,11 +661,6 @@ void CPanel::SetFocusToLastRememberedItem()
_headerComboBox.SetFocus();
}
CSysString CPanel::GetFileType(UINT32 index)
{
return TEXT("Test type");
}
UString CPanel::GetFolderTypeID() const
{
CMyComPtr<IFolderGetTypeID> folderGetTypeID;

View File

@@ -159,15 +159,18 @@ class CPanel:public NWindows::NControl::CWindow2
virtual void OnDestroy();
virtual bool OnNotify(UINT controlID, LPNMHDR lParam, LRESULT &result);
void OnComboBoxCommand(UINT code, LPARAM &aParam);
bool OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result);
#ifndef _UNICODE
bool OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result);
#endif
bool OnNotifyReBar(LPNMHDR lParam, LRESULT &result);
bool OnNotifyComboBox(LPNMHDR lParam, LRESULT &result);
void OnItemChanged(NMLISTVIEW *item);
bool OnNotifyList(LPNMHDR lParam, LRESULT &result);
void OnDrag(LPNMLISTVIEW nmListView);
bool OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result);
BOOL OnBeginLabelEdit(LV_DISPINFO * lpnmh);
BOOL OnEndLabelEdit(LV_DISPINFO * lpnmh);
BOOL OnBeginLabelEdit(LV_DISPINFOW * lpnmh);
BOOL OnEndLabelEdit(LV_DISPINFOW * lpnmh);
void OnColumnClick(LPNMLISTVIEW info);
bool OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result);
@@ -204,8 +207,8 @@ public:
void InvertSelection();
private:
CSysString GetFileType(UInt32 index);
LRESULT SetItemText(LVITEM &item);
// UString GetFileType(UInt32 index);
LRESULT SetItemText(LVITEMW &item);
// CRecordVector<PROPID> m_ColumnsPropIDs;
@@ -231,7 +234,7 @@ public:
UString _focusedName;
UInt32 GetRealIndex(const LVITEM &item) const
UInt32 GetRealIndex(const LVITEMW &item) const
{
/*
if (_virtualMode)
@@ -326,7 +329,7 @@ public:
bool _needSaveInfo;
CSysString _typeIDString;
UString _typeIDString;
CListViewInfo _listViewInfo;
CItemProperties _properties;
CItemProperties _visibleProperties;

View File

@@ -55,7 +55,7 @@ HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &fold
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
UString errorMessage = LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
UString errorMessage = LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
if (showErrorMessages)
MessageBox(errorMessage);
else if (messages != 0)
@@ -71,9 +71,9 @@ HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &fold
extracter.ExtractCallbackSpec->ShowMessages = showErrorMessages;
UString title = moveMode ?
LangLoadStringW(IDS_MOVING, 0x03020206):
LangLoadStringW(IDS_COPYING, 0x03020205);
UString progressWindowTitle = LangLoadStringW(IDS_APP_TITLE, 0x03000000);
LangString(IDS_MOVING, 0x03020206):
LangString(IDS_COPYING, 0x03020205);
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
extracter.ExtractCallbackSpec->ProgressDialog.MainWindow = GetParent();
extracter.ExtractCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
@@ -133,7 +133,7 @@ HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &fileP
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
UString errorMessage = LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
UString errorMessage = LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
if (showErrorMessages)
MessageBox(errorMessage);
else if (messages != 0)
@@ -145,8 +145,8 @@ HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &fileP
updater.UpdateCallbackSpec = new CUpdateCallback100Imp;
updater.UpdateCallback = updater.UpdateCallbackSpec;
UString title = LangLoadStringW(IDS_COPYING, 0x03020205);
UString progressWindowTitle = LangLoadStringW(IDS_APP_TITLE, 0x03000000);
UString title = LangString(IDS_COPYING, 0x03020205);
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
updater.UpdateCallbackSpec->ProgressDialog.MainWindow = GetParent();
updater.UpdateCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
@@ -176,8 +176,8 @@ HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &fileP
void CPanel::CopyFrom(const UStringVector &filePaths)
{
UString title = LangLoadStringW(IDS_CONFIRM_FILE_COPY, 0x03020222);
UString message = LangLoadStringW(IDS_WANT_TO_COPY_FILES, 0x03020223);
UString title = LangString(IDS_CONFIRM_FILE_COPY, 0x03020222);
UString message = LangString(IDS_WANT_TO_COPY_FILES, 0x03020223);
message += L"\n\'";
message += _currentFolderPrefix;
message += L"\' ?";

View File

@@ -2,21 +2,26 @@
#include "StdAfx.h"
#include "Common/StringConvert.h"
#include "Windows/Memory.h"
#include "Windows/FileDir.h"
#include "Windows/Shell.h"
#include "Common/StringConvert.h"
#include "../UI/Common/ArchiveName.h"
#include "../UI/Common/CompressCall.h"
#include "Resource/MessagesDialog/MessagesDialog.h"
using namespace NWindows;
#include "App.h"
#include "EnumFormatEtc.h"
using namespace NWindows;
#ifndef _UNICODE
extern bool g_IsNT;
#endif
static wchar_t *kTempDirPrefix = L"7zE";
static LPCTSTR kSvenZipSetFolderFormat = TEXT("7-Zip::SetTargetFolder");
@@ -212,39 +217,73 @@ STDMETHODIMP CDropSource::GiveFeedback(DWORD effect)
return DRAGDROP_S_USEDEFAULTCURSORS;
}
static bool CopyNamesToHGlobal(NMemory::CGlobal &hgDrop, const CSysStringVector &names)
static bool CopyNamesToHGlobal(NMemory::CGlobal &hgDrop, const UStringVector &names)
{
size_t totalLength = 1;
int i;
for (i = 0; i < names.Size(); i++)
totalLength += names[i].Length() + 1;
if (!hgDrop.Alloc(GHND | GMEM_SHARE, totalLength * sizeof(TCHAR) + sizeof(DROPFILES)))
return false;
NMemory::CGlobalLock dropLock(hgDrop);
DROPFILES* dropFiles = (DROPFILES*)dropLock.GetPointer();
if (dropFiles == 0)
return false;
dropFiles->fNC = FALSE;
dropFiles->pt.x = 0;
dropFiles->pt.y = 0;
dropFiles->pFiles = sizeof(DROPFILES);
#ifdef _UNICODE
dropFiles->fWide = TRUE;
#else
dropFiles->fWide = FALSE;
#endif
TCHAR *p = (TCHAR *)((BYTE *)dropFiles + sizeof(DROPFILES));
for (i = 0; i < names.Size(); i++)
#ifndef _UNICODE
if (!g_IsNT)
{
const CSysString &s = names[i];
int fullLength = s.Length() + 1;
lstrcpy(p, s);
p += fullLength;
totalLength -= fullLength;
AStringVector namesA;
int i;
for (i = 0; i < names.Size(); i++)
namesA.Add(GetSystemString(names[i]));
for (i = 0; i < names.Size(); i++)
totalLength += namesA[i].Length() + 1;
if (!hgDrop.Alloc(GHND | GMEM_SHARE, totalLength * sizeof(CHAR) + sizeof(DROPFILES)))
return false;
NMemory::CGlobalLock dropLock(hgDrop);
DROPFILES* dropFiles = (DROPFILES*)dropLock.GetPointer();
if (dropFiles == 0)
return false;
dropFiles->fNC = FALSE;
dropFiles->pt.x = 0;
dropFiles->pt.y = 0;
dropFiles->pFiles = sizeof(DROPFILES);
dropFiles->fWide = FALSE;
CHAR *p = (CHAR *)((BYTE *)dropFiles + sizeof(DROPFILES));
for (i = 0; i < names.Size(); i++)
{
const AString &s = namesA[i];
int fullLength = s.Length() + 1;
strcpy(p, s);
p += fullLength;
totalLength -= fullLength;
}
*p = 0;
}
else
#endif
{
int i;
for (i = 0; i < names.Size(); i++)
totalLength += names[i].Length() + 1;
if (!hgDrop.Alloc(GHND | GMEM_SHARE, totalLength * sizeof(WCHAR) + sizeof(DROPFILES)))
return false;
NMemory::CGlobalLock dropLock(hgDrop);
DROPFILES* dropFiles = (DROPFILES*)dropLock.GetPointer();
if (dropFiles == 0)
return false;
dropFiles->fNC = FALSE;
dropFiles->pt.x = 0;
dropFiles->pt.y = 0;
dropFiles->pFiles = sizeof(DROPFILES);
dropFiles->fWide = TRUE;
WCHAR *p = (WCHAR *)((BYTE *)dropFiles + sizeof(DROPFILES));
for (i = 0; i < names.Size(); i++)
{
const UString &s = names[i];
int fullLength = s.Length() + 1;
wcscpy(p, s);
p += fullLength;
totalLength -= fullLength;
}
*p = 0;
}
*p = 0;
return true;
}
@@ -278,9 +317,9 @@ void CPanel::OnDrag(LPNMLISTVIEW nmListView)
CMyComPtr<IDataObject> dataObject = dataObjectSpec;
{
CSysStringVector names;
UStringVector names;
for (int i = 0; i < indices.Size(); i++)
names.Add(GetSystemString(dirPrefix + GetItemName(indices[i])));
names.Add(dirPrefix + GetItemName(indices[i]));
if (!CopyNamesToHGlobal(dataObjectSpec->hGlobal, names))
return;
}
@@ -686,15 +725,12 @@ void CPanel::DropObject(IDataObject *dataObject, const UString &folderPath)
/*
void CPanel::CompressDropFiles(HDROP dr)
{
CSysStringVector fileNames;
UStringVector fileNames;
{
NShell::CDrop drop(true);
drop.Attach(dr);
drop.QueryFileNames(fileNames);
}
UStringVector fileNamesUnicode;
for (int i = 0; i < fileNames.Size(); i++)
fileNamesUnicode.Add(GetUnicodeString(fileNames[i]));
CompressDropFiles(fileNamesUnicode);
}
*/

View File

@@ -141,12 +141,12 @@ void CPanel::LoadFullPathAndShow()
_appState->FolderHistory.AddString(_currentFolderPrefix);
// _headerComboBox.SendMessage(CB_RESETCONTENT, 0, 0);
_headerComboBox.SetText(GetSystemString(_currentFolderPrefix));
_headerComboBox.SetText(_currentFolderPrefix);
/*
for (int i = 0; i < g_Folders.m_Strings.Size(); i++)
{
CSysString string = GetSystemString(g_Folders.m_Strings[i]);
UString string = g_Folders.m_Strings[i];
COMBOBOXEXITEM item;
item.mask = CBEIF_TEXT;
item.iItem = i;
@@ -156,11 +156,41 @@ void CPanel::LoadFullPathAndShow()
*/
}
bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result)
{
if (info->iWhy == CBENF_ESCAPE)
{
_headerComboBox.SetText(_currentFolderPrefix);
PostMessage(kSetFocusToListView);
result = FALSE;
return true;
}
if (info->iWhy == CBENF_DROPDOWN)
{
result = FALSE;
return true;
}
if (info->iWhy == CBENF_RETURN)
{
if (BindToPathAndRefresh(info->szText) != S_OK)
{
result = TRUE;
return true;
}
result = FALSE;
PostMessage(kSetFocusToListView);
return true;
}
return false;
}
#ifndef _UNICODE
bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result)
{
if (info->iWhy == CBENF_ESCAPE)
{
_headerComboBox.SetText(GetSystemString(_currentFolderPrefix));
_headerComboBox.SetText(_currentFolderPrefix);
PostMessage(kSetFocusToListView);
result = FALSE;
return true;
@@ -175,7 +205,6 @@ bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result)
{
if (BindToPathAndRefresh(GetUnicodeString(info->szText)) != S_OK)
{
// MessageBeep((UINT)-1);
result = TRUE;
return true;
}
@@ -185,24 +214,22 @@ bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result)
}
return false;
}
#endif
void CPanel::OnComboBoxCommand(UINT code, LPARAM &param)
{
/*
if (code == CBN_SELENDOK)
{
CSysString path;
UString path;
if (!_headerComboBox.GetText(path))
return;
CRootFolder *rootFolderSpec = new CRootFolder;
CMyComPtr<IFolderFolder> rootFolder = rootFolderSpec;
rootFolderSpec->Init();
CMyComPtr<IFolderFolder> newFolder;
if (rootFolder->BindToFolder(GetUnicodeString(path),
&newFolder) != S_OK)
{
if (rootFolder->BindToFolder(path, &newFolder) != S_OK)
return;
}
_folder = newFolder;
SetCurrentPathText();
RefreshListCtrl(UString(), -1, UStringVector());
@@ -220,10 +247,16 @@ bool CPanel::OnNotifyComboBox(LPNMHDR header, LRESULT &result)
_lastFocusedIsList = false;
_panelCallback->PanelWasFocused();
}
#ifndef _UNICODE
case CBEN_ENDEDIT:
{
return OnNotifyComboBoxEndEdit((PNMCBEENDEDIT)header, result);
}
#endif
case CBEN_ENDEDITW:
{
return OnNotifyComboBoxEndEdit((PNMCBEENDEDITW)header, result);
}
}
return false;
}
@@ -233,28 +266,23 @@ void CPanel::FoldersHistory()
{
CListViewDialog listViewDialog;
listViewDialog.DeleteIsAllowed = true;
// listViewDialog.m_Value = TEXT("*");
listViewDialog.Title = LangLoadStringW(IDS_FOLDERS_HISTORY, 0x03020260);
UStringVector strings;
_appState->FolderHistory.GetList(strings);
int i;
for(i = 0; i < strings.Size(); i++)
listViewDialog.Strings.Add(GetSystemString(strings[i]));
listViewDialog.Title = LangString(IDS_FOLDERS_HISTORY, 0x03020260);
_appState->FolderHistory.GetList(listViewDialog.Strings);
if (listViewDialog.Create(GetParent()) == IDCANCEL)
return;
UString selectString;
if (listViewDialog.StringsWereChanged)
{
_appState->FolderHistory.RemoveAll();
for (i = listViewDialog.Strings.Size() - 1; i >= 0; i--)
_appState->FolderHistory.AddString(GetUnicodeString(listViewDialog.Strings[i]));
for (int i = listViewDialog.Strings.Size() - 1; i >= 0; i--)
_appState->FolderHistory.AddString(listViewDialog.Strings[i]);
if (listViewDialog.FocusedItemIndex >= 0)
selectString = GetUnicodeString(listViewDialog.Strings[listViewDialog.FocusedItemIndex]);
selectString = listViewDialog.Strings[listViewDialog.FocusedItemIndex];
}
else
{
if (listViewDialog.FocusedItemIndex >= 0)
selectString = strings[listViewDialog.FocusedItemIndex];
selectString = listViewDialog.Strings[listViewDialog.FocusedItemIndex];
}
if (listViewDialog.FocusedItemIndex >= 0)
BindToPathAndRefresh(selectString);
@@ -273,7 +301,7 @@ void CPanel::OpenParentFolder()
pos = 0;
else
pos++;
focucedName = GetUnicodeString(string.Mid(pos));
focucedName = string.Mid(pos);
}
CDisableTimerProcessing disableTimerProcessing1(*this);
@@ -309,7 +337,7 @@ void CPanel::OpenParentFolder()
selectedItems.Add(focucedName);
*/
LoadFullPath();
::SetCurrentDirectory(::GetSystemString(_currentFolderPrefix));
// ::SetCurrentDirectory(::_currentFolderPrefix);
RefreshListCtrl(focucedName, -1, true, selectedItems);
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
RefreshStatusBar();
@@ -337,13 +365,13 @@ void CPanel::OpenRootFolder()
_parentFolders.Clear();
SetToRootFolder();
RefreshListCtrl(UString(), -1, true, UStringVector());
// ::SetCurrentDirectory(::GetSystemString(_currentFolderPrefix));
// ::SetCurrentDirectory(::_currentFolderPrefix);
/*
BeforeChangeFolder();
_currentFolderPrefix.Empty();
AfterChangeFolder();
SetCurrentPathText();
RefreshListCtrl(CSysString(), 0, CSysStringVector());
RefreshListCtrl(UString(), 0, UStringVector());
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
*/
}
@@ -370,7 +398,7 @@ void CPanel::OpenFolder(int index)
return;
_folder = newFolder;
LoadFullPath();
::SetCurrentDirectory(::GetSystemString(_currentFolderPrefix));
// ::SetCurrentDirectory(::_currentFolderPrefix);
RefreshListCtrl();
UINT state = LVIS_SELECTED;
_listView.SetItemState(_listView.GetFocusedItem(), state, state);

View File

@@ -29,9 +29,9 @@ using namespace NFile;
using namespace NDirectory;
extern HWND g_HWND;
static inline UINT GetCurrentFileCodePage()
{ return AreFileApisANSI() ? CP_ACP : CP_OEMCP;}
#ifndef _UNICODE
extern bool g_IsNT;
#endif
static wchar_t *kTempDirPrefix = L"7zO";
@@ -81,8 +81,7 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name,
// _password.Empty();
NDLL::CLibrary library;
RINOK(OpenFileFolderPlugin(GetUnicodeString(filePath),
&library, &newFolder, GetParent()));
RINOK(OpenFileFolderPlugin(filePath, &library, &newFolder, GetParent()));
folderLink.ParentFolder = _folder;
folderLink.ItemName = name;
@@ -130,7 +129,7 @@ HRESULT CPanel::OpenParentArchiveFolder()
if (OnOpenItemChanged(folderLink.FolderPath, folderLink.ItemName) != S_OK)
{
::MessageBoxW(HWND(*this), MyFormatNew(IDS_CANNOT_UPDATE_FILE,
0x03020281, GetUnicodeString(folderLink.FilePath)), L"7-Zip", MB_OK | MB_ICONSTOP);
0x03020281, folderLink.FilePath), L"7-Zip", MB_OK | MB_ICONSTOP);
return S_OK;
}
}
@@ -151,69 +150,114 @@ static bool DoItemAlwaysStart(const UString &name)
static HANDLE StartEditApplication(const UString &path, HWND window)
{
CSysString command;
UString command;
ReadRegEditor(command);
if (command.IsEmpty())
{
if (!MyGetWindowsDirectory(command))
return 0;
NFile::NName::NormalizeDirPathPrefix(command);
command += TEXT("notepad.exe");
command += L"notepad.exe";
}
command = CSysString(TEXT("\"")) + command + CSysString(TEXT("\""));
command += TEXT(" \"");
command += GetSystemString(path);
command += TEXT("\"");
command = UString(L"\"") + command + UString(L"\"");
command += L" \"";
command += UString(path);
command += L"\"";
STARTUPINFO startupInfo;
startupInfo.cb = sizeof(startupInfo);
startupInfo.lpReserved = 0;
startupInfo.lpDesktop = 0;
startupInfo.lpTitle = 0;
startupInfo.dwFlags = 0;
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
PROCESS_INFORMATION processInformation;
BOOL result = ::CreateProcess(NULL, (TCHAR *)(const TCHAR *)command,
BOOL result;
#ifndef _UNICODE
if (!g_IsNT)
{
STARTUPINFOA startupInfo;
startupInfo.cb = sizeof(startupInfo);
startupInfo.lpReserved = 0;
startupInfo.lpDesktop = 0;
startupInfo.lpTitle = 0;
startupInfo.dwFlags = 0;
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
result = ::CreateProcessA(NULL, (CHAR *)(const CHAR *)GetSystemString(command),
NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation);
}
else
#endif
{
STARTUPINFOW startupInfo;
startupInfo.cb = sizeof(startupInfo);
startupInfo.lpReserved = 0;
startupInfo.lpDesktop = 0;
startupInfo.lpTitle = 0;
startupInfo.dwFlags = 0;
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
result = ::CreateProcessW(NULL, (WCHAR *)(const WCHAR *)command,
NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation);
}
if (result != FALSE)
{
::CloseHandle(processInformation.hThread);
return processInformation.hProcess;
}
::MessageBoxW(window, LangLoadStringW(IDS_CANNOT_START_EDITOR, 0x03020282),
::MessageBoxW(window, LangString(IDS_CANNOT_START_EDITOR, 0x03020282),
L"7-Zip", MB_OK | MB_ICONSTOP);
return 0;
}
static HANDLE StartApplication(const UString &path, HWND window)
{
SHELLEXECUTEINFO execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
const CSysString sysPath = GetSystemString(path);
execInfo.lpFile = sysPath;
execInfo.lpParameters = NULL;
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
bool success = BOOLToBool(::ShellExecuteEx(&execInfo));
UINT32 result = (UINT32)execInfo.hInstApp;
UINT32 result;
HANDLE hProcess;
#ifndef _UNICODE
if (g_IsNT)
{
SHELLEXECUTEINFOW execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
execInfo.lpFile = path;
execInfo.lpParameters = NULL;
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
::ShellExecuteExW(&execInfo);
result = (UINT32)execInfo.hInstApp;
hProcess = execInfo.hProcess;
}
else
#endif
{
SHELLEXECUTEINFO execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
const CSysString sysPath = GetSystemString(path);
execInfo.lpFile = sysPath;
execInfo.lpParameters = NULL;
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
::ShellExecuteEx(&execInfo);
result = (UINT32)execInfo.hInstApp;
hProcess = execInfo.hProcess;
}
if(result <= 32)
{
switch(result)
{
case SE_ERR_NOASSOC:
::MessageBox(window,
NError::MyFormatMessage(::GetLastError()),
// TEXT("There is no application associated with the given file name extension"),
TEXT("7-Zip"), MB_OK | MB_ICONSTOP);
::MessageBoxW(window,
NError::MyFormatMessageW(::GetLastError()),
// L"There is no application associated with the given file name extension",
L"7-Zip", MB_OK | MB_ICONSTOP);
}
}
return execInfo.hProcess;
return hProcess;
}
void CPanel::EditItem(int index)
@@ -268,7 +312,7 @@ LRESULT CPanel::OnOpenItemChanged(const UString &folderPath, const UString &item
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return E_FAIL;
}
UStringVector fileNames;
@@ -342,7 +386,7 @@ static DWORD WINAPI MyThreadFunction(void *param)
if (SendMessage(tmpProcessInfo->Window, kOpenItemChanged, 0, (LONG_PTR)tmpProcessInfo) != 1)
{
::MessageBoxW(g_HWND, MyFormatNew(IDS_CANNOT_UPDATE_FILE,
0x03020281, GetUnicodeString(tmpProcessInfo->FilePath)), L"7-Zip", MB_OK | MB_ICONSTOP);
0x03020281, tmpProcessInfo->FilePath), L"7-Zip", MB_OK | MB_ICONSTOP);
return 0;
}
}
@@ -365,7 +409,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
@@ -443,7 +487,7 @@ static bool CheckDeleteItem(UINT64 currentFileTime, UINT64 folderFileTime)
void DeleteOldTempFiles()
{
CSysString tempPath;
UString tempPath;
if(!NFile::NDirectory::MyGetTempPath(tempPath))
throw 1;
@@ -452,10 +496,10 @@ void DeleteOldTempFiles()
UINT64 currentFileTime;
if(!::SystemTimeToFileTime(&systemTime, (FILETIME *)&currentFileTime))
throw 2;
CSysString searchWildCard = tempPath + kTempDirPrefix + TEXT("*.tmp");
searchWildCard += TCHAR(NName::kAnyStringWildcard);
NFind::CEnumerator enumerator(searchWildCard);
NFind::CFileInfo fileInfo;
UString searchWildCard = tempPath + kTempDirPrefix + L"*.tmp";
searchWildCard += WCHAR(NName::kAnyStringWildcard);
NFind::CEnumeratorW enumerator(searchWildCard);
NFind::CFileInfoW fileInfo;
while(enumerator.Next(fileInfo))
{
if (!fileInfo.IsDirectory())

View File

@@ -186,10 +186,8 @@ void CPanel::InitColumns()
void CPanel::InsertColumn(int index)
{
const CItemProperty &property = _visibleProperties[index];
LV_COLUMN column;
LV_COLUMNW column;
column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER;
TCHAR string[1024];
column.pszText = string;
column.cx = property.Width;
column.fmt = GetColumnAlign(property.ID, property.Type);
column.iOrder = property.Order;
@@ -197,7 +195,7 @@ void CPanel::InsertColumn(int index)
UString propertyName = GetNameOfProperty(property.ID);
if (propertyName.IsEmpty())
propertyName = property.Name;
lstrcpy(string, GetSystemString(propertyName));
column.pszText = (wchar_t *)(const wchar_t *)propertyName;
_listView.InsertColumn(index, &column);
}
@@ -223,8 +221,8 @@ void CPanel::GetSelectedNames(UStringVector &selectedNames)
for (int i = 0; i < _listView.GetItemCount(); i++)
{
const int kSize = 1024;
TCHAR name[kSize + 1];
LVITEM item;
WCHAR name[kSize + 1];
LVITEMW item;
item.iItem = i;
item.pszText = name;
item.cchTextMax = kSize;
@@ -236,7 +234,7 @@ void CPanel::GetSelectedNames(UStringVector &selectedNames)
if (realIndex == kParentIndex)
continue;
if (_selectedStatusVector[realIndex])
selectedNames.Add(GetUnicodeString(item.pszText));
selectedNames.Add(item.pszText);
}
*/
selectedNames.Sort();
@@ -262,15 +260,15 @@ void CPanel::SaveSelectedState(CSelectedState &s)
s.FocusedName = GetItemName(realIndex);
/*
const int kSize = 1024;
TCHAR name[kSize + 1];
LVITEM item;
WCHAR name[kSize + 1];
LVITEMW item;
item.iItem = focusedItem;
item.pszText = name;
item.cchTextMax = kSize;
item.iSubItem = 0;
item.mask = LVIF_TEXT;
if (_listView.GetItem(&item))
focusedName = GetUnicodeString(item.pszText);
focusedName = item.pszText;
*/
}
}
@@ -320,7 +318,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
_listView.SetRedraw(false);
// m_RedrawEnabled = false;
LVITEM item;
LVITEMW item;
ZeroMemory(&item, sizeof(item));
_listView.DeleteAllItems();
@@ -373,13 +371,9 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
int subItem = 0;
item.iSubItem = subItem++;
item.lParam = kParentIndex;
const int kMaxNameSize = MAX_PATH * 2;
TCHAR string[kMaxNameSize];
lstrcpyn(string, GetSystemString(itemName), kMaxNameSize);
item.pszText = string;
item.pszText = (wchar_t *)(const wchar_t *)itemName;
UINT32 attributes = FILE_ATTRIBUTE_DIRECTORY;
item.iImage = _extToIconMap.GetIconIndex(attributes,
GetSystemString(itemName));
item.iImage = _extToIconMap.GetIconIndex(attributes, itemName);
if (item.iImage < 0)
item.iImage = 0;
if(_listView.InsertItem(&item) == -1)
@@ -413,11 +407,9 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
item.iSubItem = subItem++;
item.lParam = i;
const int kMaxNameSize = MAX_PATH * 2;
TCHAR string[kMaxNameSize + 1];
UString correctedName;
if (itemName.Find(L" ") >= 0)
{
UString correctedName;
int pos = 0;
while (true)
{
@@ -432,11 +424,10 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
pos = posNew;
while (itemName[++pos] == ' ');
}
lstrcpyn(string, GetSystemString(correctedName), kMaxNameSize);
item.pszText = (wchar_t *)(const wchar_t *)correctedName;
}
else
lstrcpyn(string, GetSystemString(itemName), kMaxNameSize);
item.pszText = string;
item.pszText = (wchar_t *)(const wchar_t *)itemName;
NCOM::CPropVariant propVariant;
_folder->GetProperty(i, kpidAttributes, &propVariant);
@@ -461,13 +452,12 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
if (_currentFolderPrefix.IsEmpty())
{
int iconIndexTemp;
GetRealIconIndex(GetSystemString(itemName + L"\\"), attributes, iconIndexTemp);
GetRealIconIndex(itemName + L"\\", attributes, iconIndexTemp);
item.iImage = iconIndexTemp;
}
else
{
item.iImage = _extToIconMap.GetIconIndex(attributes,
GetSystemString(itemName));
item.iImage = _extToIconMap.GetIconIndex(attributes, itemName);
}
}
if (item.iImage < 0)
@@ -585,7 +575,7 @@ void CPanel::OpenSelectedItems(bool tryInternal)
GetOperatedItemIndices(indices);
if (indices.Size() > 20)
{
MessageBox(LangLoadStringW(IDS_TOO_MANY_ITEMS, 0x02000606));
MessageBox(LangString(IDS_TOO_MANY_ITEMS, 0x02000606));
return;
}
@@ -667,7 +657,7 @@ void CPanel::ReadListViewInfo()
return;
CMyComBSTR typeID;
folderGetTypeID->GetTypeID(&typeID);
_typeIDString = GetSystemString((const wchar_t *)typeID);
_typeIDString = typeID;
::ReadListViewInfo(_typeIDString, _listViewInfo);
}

View File

@@ -8,7 +8,7 @@
#include "../PropID.h"
#include "App.h"
// static LPCTSTR kHelpTopic = _T("FM/index.htm");
// static LPCWSTR kHelpTopic = L"FM/index.htm";
struct CVKeyPropIDPair
{

View File

@@ -41,7 +41,7 @@ static UString ConvertSizeToString(UINT64 value)
return UString(s) + L" G";
}
LRESULT CPanel::SetItemText(LVITEM &item)
LRESULT CPanel::SetItemText(LVITEMW &item)
{
UINT32 realIndex = GetRealIndex(item);
/*
@@ -84,7 +84,7 @@ LRESULT CPanel::SetItemText(LVITEM &item)
if (realIndex == kParentIndex)
return 0;
UString string;
UString s;
UINT32 subItemIndex = item.iSubItem;
PROPID propID = _visibleProperties[subItemIndex].ID;
/*
@@ -120,6 +120,7 @@ LRESULT CPanel::SetItemText(LVITEM &item)
}
if (needRead)
*/
if (_folder->GetProperty(realIndex, propID, &propVariant) != S_OK)
throw 2723407;
@@ -128,20 +129,16 @@ LRESULT CPanel::SetItemText(LVITEM &item)
propID == kpidClusterSize)
&&
(propVariant.vt == VT_UI8 || propVariant.vt == VT_UI4))
{
string = ConvertSizeToString(ConvertPropVariantToUInt64(propVariant));
}
s = ConvertSizeToString(ConvertPropVariantToUInt64(propVariant));
else
{
string = ConvertPropertyToString(propVariant, propID, false);
}
s = ConvertPropertyToString(propVariant, propID, false);
int size = item.cchTextMax;
if(size > 0)
{
if(string.Length() + 1 > size)
string = string.Left(size - 1);
lstrcpy(item.pszText, GetSystemString(string));
if(s.Length() + 1 > size)
s = s.Left(size - 1);
wcscpy(item.pszText, s);
}
return 0;
}
@@ -185,9 +182,9 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
}
*/
case LVN_GETDISPINFO:
case LVN_GETDISPINFOW:
{
LV_DISPINFO *dispInfo = (LV_DISPINFO *)header;
LV_DISPINFOW *dispInfo = (LV_DISPINFOW *)header;
//is the sub-item information being requested?
@@ -268,11 +265,11 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
OnLeftClick((LPNMITEMACTIVATE)header);
return false;
}
case LVN_BEGINLABELEDIT:
result = OnBeginLabelEdit((LV_DISPINFO *)header);
case LVN_BEGINLABELEDITW:
result = OnBeginLabelEdit((LV_DISPINFOW *)header);
return true;
case LVN_ENDLABELEDIT:
result = OnEndLabelEdit((LV_DISPINFO *)header);
case LVN_ENDLABELEDITW:
result = OnEndLabelEdit((LV_DISPINFOW *)header);
return true;
case NM_CUSTOMDRAW:
@@ -354,8 +351,7 @@ void CPanel::OnRefreshStatusBar()
CRecordVector<UINT32> indices;
GetOperatedItemIndices(indices);
_statusBar.SetText(0, GetSystemString(MyFormatNew(IDS_N_SELECTED_ITEMS,
0x02000301, NumberToStringW(indices.Size()))));
_statusBar.SetText(0, MyFormatNew(IDS_N_SELECTED_ITEMS, 0x02000301, NumberToString(indices.Size())));
UString selectSizeString;
@@ -366,12 +362,11 @@ void CPanel::OnRefreshStatusBar()
totalSize += GetItemSize(indices[i]);
selectSizeString = ConvertSizeToString(totalSize);
}
_statusBar.SetText(1, GetSystemString(selectSizeString));
_statusBar.SetText(1, selectSizeString);
int focusedItem = _listView.GetFocusedItem();
UString sizeString;
UString dateString;
// CSysString nameString;
if (focusedItem >= 0 && _listView.GetSelectedCount() > 0)
{
int realIndex = GetRealItemIndex(focusedItem);
@@ -382,16 +377,9 @@ void CPanel::OnRefreshStatusBar()
if (_folder->GetProperty(realIndex, kpidLastWriteTime, &propVariant) == S_OK)
dateString = ConvertPropertyToString(propVariant, kpidLastWriteTime, false);
}
// nameString = GetSystemString(GetItemName(realIndex));
}
_statusBar.SetText(2, GetSystemString(sizeString));
_statusBar.SetText(3, GetSystemString(dateString));
_statusBar.SetText(2, sizeString);
_statusBar.SetText(3, dateString);
// _statusBar.SetText(4, nameString);
/*
_statusBar2.SetText(1, GetSystemString(MyFormatNew(L"{0} bytes",
NumberToStringW(totalSize))));
*/
// _statusBar.SetText(L"yyy"));
// _statusBar2.SetText(1, MyFormatNew(L"{0} bytes", NumberToStringW(totalSize)));
}

View File

@@ -198,17 +198,17 @@ void CPanel::CreateSystemMenu(HMENU menuSpec,
systemContextMenu->QueryContextMenu(hMenu, 0, kSystemStartMenuID, 0x7FFF, Flags);
MENUITEMINFO menuItem;
menuItem.cbSize = sizeof(menuItem);
menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
menuItem.fType = MFT_STRING;
menuItem.hSubMenu = popupMenu.Detach();
// menuDestroyer.Disable();
CSysString popupMenuCaption = LangLoadString(IDS_SYSTEM, 0x030202A0);
menuItem.dwTypeData = (LPTSTR)(LPCTSTR)popupMenuCaption;
InsertMenuItem(menuSpec, 0, TRUE, &menuItem);
{
CMenu menu;
menu.Attach(menuSpec);
CMenuItem menuItem;
menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
menuItem.fType = MFT_STRING;
menuItem.hSubMenu = popupMenu.Detach();
// menuDestroyer.Disable();
menuItem.StringValue = LangString(IDS_SYSTEM, 0x030202A0);
menu.InsertItem(0, true, menuItem);
}
/*
if (Cmd < 100 && Cmd != 0)
{
@@ -302,7 +302,7 @@ void CPanel::CreateFileMenu(HMENU menuSpec,
CreateSystemMenu(menu, operatedIndices, systemContextMenu);
if (menu.GetItemCount() > 0)
menu.AppendItem(MF_SEPARATOR, 0, 0);
menu.AppendItem(MF_SEPARATOR, 0, (LPCTSTR)0);
LoadFileMenu(menu, menu.GetItemCount(), !operatedIndices.IsEmpty(), programMenu);
}

View File

@@ -24,6 +24,10 @@
using namespace NWindows;
using namespace NFile;
#ifndef _UNICODE
extern bool g_IsNT;
#endif
struct CThreadDelete
{
CMyComPtr<IFolderOperations> FolderOperations;
@@ -58,37 +62,68 @@ void CPanel::DeleteItems(bool toRecycleBin)
SaveSelectedState(state);
if (IsFSFolder())
{
CDynamicBuffer<TCHAR> buffer;
size_t size = 0;
for (int i = 0; i < indices.Size(); i++)
#ifndef _UNICODE
if (!g_IsNT)
{
const CSysString path = GetSystemString(GetFsPath() + GetItemName(indices[i]));
buffer.EnsureCapacity(size + path.Length() + 1);
memmove(((TCHAR *)buffer) + size, (const TCHAR *)path, (path.Length() + 1) * sizeof(TCHAR));
size += path.Length() + 1;
CDynamicBuffer<CHAR> buffer;
size_t size = 0;
for (int i = 0; i < indices.Size(); i++)
{
const AString path = GetSystemString(GetFsPath() + GetItemName(indices[i]));
buffer.EnsureCapacity(size + path.Length() + 1);
memmove(((CHAR *)buffer) + size, (const CHAR *)path, (path.Length() + 1) * sizeof(CHAR));
size += path.Length() + 1;
}
buffer.EnsureCapacity(size + 1);
((CHAR *)buffer)[size] = 0;
SHFILEOPSTRUCTA fo;
fo.hwnd = GetParent();
fo.wFunc = FO_DELETE;
fo.pFrom = (const CHAR *)buffer;
fo.pTo = 0;
fo.fFlags = 0;
if (toRecycleBin)
fo.fFlags |= FOF_ALLOWUNDO;
// fo.fFlags |= FOF_NOCONFIRMATION;
// fo.fFlags |= FOF_NOERRORUI;
// fo.fFlags |= FOF_SILENT;
// fo.fFlags |= FOF_WANTNUKEWARNING;
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = ::SHFileOperationA(&fo);
}
else
#endif
{
CDynamicBuffer<WCHAR> buffer;
size_t size = 0;
for (int i = 0; i < indices.Size(); i++)
{
const UString path = GetFsPath() + GetItemName(indices[i]);
buffer.EnsureCapacity(size + path.Length() + 1);
memmove(((WCHAR *)buffer) + size, (const WCHAR *)path, (path.Length() + 1) * sizeof(WCHAR));
size += path.Length() + 1;
}
buffer.EnsureCapacity(size + 1);
((WCHAR *)buffer)[size] = 0;
SHFILEOPSTRUCTW fo;
fo.hwnd = GetParent();
fo.wFunc = FO_DELETE;
fo.pFrom = (const WCHAR *)buffer;
fo.pTo = 0;
fo.fFlags = 0;
if (toRecycleBin)
fo.fFlags |= FOF_ALLOWUNDO;
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = ::SHFileOperationW(&fo);
}
buffer.EnsureCapacity(size + 1);
((TCHAR *)buffer)[size] = 0;
SHFILEOPSTRUCT fo;
fo.hwnd = GetParent();
fo.wFunc = FO_DELETE;
fo.pFrom = (const TCHAR *)buffer;
fo.pTo = 0;
fo.fFlags = 0;
if (toRecycleBin)
fo.fFlags |= FOF_ALLOWUNDO;
// fo.fFlags |= FOF_NOCONFIRMATION;
// fo.fFlags |= FOF_NOERRORUI;
// fo.fFlags |= FOF_SILENT;
// fo.fFlags |= FOF_WANTNUKEWARNING;
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = SHFileOperation(&fo);
/*
if (fo.fAnyOperationsAborted)
{
MessageBoxError(result, LangLoadStringW(IDS_ERROR_DELETING, 0x03020217));
MessageBoxError(result, LangString(IDS_ERROR_DELETING, 0x03020217));
}
*/
/*
@@ -102,7 +137,7 @@ void CPanel::DeleteItems(bool toRecycleBin)
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
@@ -114,20 +149,20 @@ void CPanel::DeleteItems(bool toRecycleBin)
const UString itemName = GetItemName(index);
if (IsItemFolder(index))
{
title = LangLoadStringW(IDS_CONFIRM_FOLDER_DELETE, 0x03020211);
title = LangString(IDS_CONFIRM_FOLDER_DELETE, 0x03020211);
message = MyFormatNew(IDS_WANT_TO_DELETE_FOLDER, 0x03020214, itemName);
}
else
{
title = LangLoadStringW(IDS_CONFIRM_FILE_DELETE, 0x03020210);
title = LangString(IDS_CONFIRM_FILE_DELETE, 0x03020210);
message = MyFormatNew(IDS_WANT_TO_DELETE_FILE, 0x03020213, itemName);
}
}
else
{
title = LangLoadStringW(IDS_CONFIRM_ITEMS_DELETE, 0x03020212);
title = LangString(IDS_CONFIRM_ITEMS_DELETE, 0x03020212);
message = MyFormatNew(IDS_WANT_TO_DELETE_ITEMS, 0x03020215,
NumberToStringW(indices.Size()));
NumberToString(indices.Size()));
}
if (::MessageBoxW(GetParent(), message, title, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
return;
@@ -137,10 +172,10 @@ void CPanel::DeleteItems(bool toRecycleBin)
deleter.UpdateCallback = deleter.UpdateCallbackSpec;
deleter.UpdateCallbackSpec->Init(GetParent(), false, L"");
UString progressTitle = LangLoadStringW(IDS_DELETING, 0x03020216);
UString progressTitle = LangString(IDS_DELETING, 0x03020216);
deleter.UpdateCallbackSpec->ProgressDialog.MainWindow = _mainWindow;
deleter.UpdateCallbackSpec->ProgressDialog.MainTitle = LangLoadStringW(IDS_APP_TITLE, 0x03000000);
deleter.UpdateCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
deleter.UpdateCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
deleter.FolderOperations = folderOperations;
@@ -153,13 +188,13 @@ void CPanel::DeleteItems(bool toRecycleBin)
HRESULT result = deleter.Result;
if (result != S_OK)
MessageBoxError(result, LangLoadStringW(IDS_ERROR_DELETING, 0x03020217));
MessageBoxError(result, LangString(IDS_ERROR_DELETING, 0x03020217));
}
RefreshListCtrl(state);
}
BOOL CPanel::OnBeginLabelEdit(LV_DISPINFO * lpnmh)
BOOL CPanel::OnBeginLabelEdit(LV_DISPINFOW * lpnmh)
{
int realIndex = GetRealIndex(lpnmh->item);
if (realIndex == kParentIndex)
@@ -170,7 +205,7 @@ BOOL CPanel::OnBeginLabelEdit(LV_DISPINFO * lpnmh)
return FALSE;
}
BOOL CPanel::OnEndLabelEdit(LV_DISPINFO * lpnmh)
BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
{
if (lpnmh->item.pszText == NULL)
return FALSE;
@@ -180,7 +215,7 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFO * lpnmh)
MessageBoxMyError(L"Renaming is not supported");
return FALSE;
}
UString newName = GetUnicodeString(lpnmh->item.pszText);
UString newName = lpnmh->item.pszText;
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
int realIndex = GetRealIndex(lpnmh->item);
@@ -189,7 +224,7 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFO * lpnmh)
HRESULT result = folderOperations->Rename(realIndex, newName, 0);
if (result != S_OK)
{
MessageBoxError(result, LangLoadStringW(IDS_ERROR_RENAMING, 0x03020221));
MessageBoxError(result, LangString(IDS_ERROR_RENAMING, 0x03020221));
return FALSE;
}
// Can't use RefreshListCtrl here.
@@ -209,26 +244,26 @@ void CPanel::CreateFolder()
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
CSelectedState state;
SaveSelectedState(state);
CComboDialog comboDialog;
comboDialog.Title = LangLoadStringW(IDS_CREATE_FOLDER, 0x03020230);
comboDialog.Static = LangLoadStringW(IDS_CREATE_FOLDER_NAME, 0x03020231);
comboDialog.Value = LangLoadStringW(IDS_CREATE_FOLDER_DEFAULT_NAME, /*0x03020232*/ (UInt32)-1);
comboDialog.Title = LangString(IDS_CREATE_FOLDER, 0x03020230);
comboDialog.Static = LangString(IDS_CREATE_FOLDER_NAME, 0x03020231);
comboDialog.Value = LangString(IDS_CREATE_FOLDER_DEFAULT_NAME, /*0x03020232*/ (UInt32)-1);
if (comboDialog.Create(GetParent()) == IDCANCEL)
return;
UString newName = GetUnicodeString(comboDialog.Value);
UString newName = comboDialog.Value;
HRESULT result = folderOperations->CreateFolder(newName, 0);
if (result != S_OK)
{
MessageBoxError(result, LangLoadStringW(IDS_CREATE_FOLDER_ERROR, 0x03020233));
MessageBoxError(result, LangString(IDS_CREATE_FOLDER_ERROR, 0x03020233));
return;
}
int pos = newName.Find(TEXT('\\'));
int pos = newName.Find(L'\\');
if (pos >= 0)
newName = newName.Left(pos);
if (!_mySelectMode)
@@ -243,26 +278,26 @@ void CPanel::CreateFile()
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
CSelectedState state;
SaveSelectedState(state);
CComboDialog comboDialog;
comboDialog.Title = LangLoadStringW(IDS_CREATE_FILE, 0x03020240);
comboDialog.Static = LangLoadStringW(IDS_CREATE_FILE_NAME, 0x03020241);
comboDialog.Value = LangLoadStringW(IDS_CREATE_FILE_DEFAULT_NAME, /*0x03020242*/ (UInt32)-1);
comboDialog.Title = LangString(IDS_CREATE_FILE, 0x03020240);
comboDialog.Static = LangString(IDS_CREATE_FILE_NAME, 0x03020241);
comboDialog.Value = LangString(IDS_CREATE_FILE_DEFAULT_NAME, /*0x03020242*/ (UInt32)-1);
if (comboDialog.Create(GetParent()) == IDCANCEL)
return;
UString newName = GetUnicodeString(comboDialog.Value);
UString newName = comboDialog.Value;
HRESULT result = folderOperations->CreateFile(newName, 0);
if (result != S_OK)
{
MessageBoxError(result, LangLoadStringW(IDS_CREATE_FILE_ERROR, 0x03020243));
MessageBoxError(result, LangString(IDS_CREATE_FILE_ERROR, 0x03020243));
return;
}
int pos = newName.Find(TEXT('\\'));
int pos = newName.Find(L'\\');
if (pos >= 0)
newName = newName.Left(pos);
if (!_mySelectMode)
@@ -293,7 +328,7 @@ void CPanel::ChangeComment()
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
@@ -309,12 +344,12 @@ void CPanel::ChangeComment()
}
UString name = GetItemName(realIndex);
CComboDialog comboDialog;
comboDialog.Title = name + L" " + LangLoadStringW(IDS_COMMENT, 0x03020290);
comboDialog.Title = name + L" " + LangString(IDS_COMMENT, 0x03020290);
comboDialog.Value = comment;
comboDialog.Static = LangLoadStringW(IDS_COMMENT2, 0x03020291);
comboDialog.Static = LangString(IDS_COMMENT2, 0x03020291);
if (comboDialog.Create(GetParent()) == IDCANCEL)
return;
NCOM::CPropVariant propVariant = GetUnicodeString(comboDialog.Value);
NCOM::CPropVariant propVariant = comboDialog.Value;
HRESULT result = folderOperations->SetProperty(realIndex, kpidComment, &propVariant, NULL);
if (result != S_OK)

View File

@@ -152,9 +152,9 @@ void CPanel::SelectSpec(bool selectMode)
{
CComboDialog comboDialog;
comboDialog.Title = selectMode ?
LangLoadStringW(IDS_SELECT, 0x03020250):
LangLoadStringW(IDS_DESELECT, 0x03020251);
comboDialog.Static = LangLoadStringW(IDS_SELECT_MASK, 0x03020252);
LangString(IDS_SELECT, 0x03020250):
LangString(IDS_DESELECT, 0x03020251);
comboDialog.Static = LangString(IDS_SELECT_MASK, 0x03020252);
comboDialog.Value = L"*";
if (comboDialog.Create(GetParent()) == IDCANCEL)
return;

View File

@@ -31,10 +31,10 @@ public:
{
if (_data != 0)
return false;
_data = BigAlloc(size);
_data = ::MidAlloc(size);
return _data != 0;
}
~CMyBuffer() { BigFree(_data); }
~CMyBuffer() { ::MidFree(_data); }
};
struct CVolSeqName
@@ -184,7 +184,7 @@ void CApp::Split()
CPanel &srcPanel = Panels[srcPanelIndex];
if (!srcPanel.IsFSFolder())
{
srcPanel.MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
CRecordVector<UInt32> indices;
@@ -223,8 +223,8 @@ void CApp::Split()
CProgressDialog progressDialog;
spliter.ProgressDialog = &progressDialog;
UString progressWindowTitle = LangLoadStringW(IDS_APP_TITLE, 0x03000000);
UString title = LangLoadStringW(IDS_SPLITTING, 0x03020510);
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
UString title = LangString(IDS_SPLITTING, 0x03020510);
progressDialog.MainWindow = _window;
progressDialog.MainTitle = progressWindowTitle;
@@ -392,7 +392,7 @@ void CApp::Combine()
CPanel &srcPanel = Panels[srcPanelIndex];
if (!srcPanel.IsFSFolder())
{
srcPanel.MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
CRecordVector<UInt32> indices;
@@ -421,11 +421,11 @@ void CApp::Combine()
path = destPanel._currentFolderPrefix;
CCopyDialog copyDialog;
copyDialog.Value = path;
copyDialog.Title = LangLoadStringW(IDS_COMBINE, 0x03020600);
copyDialog.Title = LangString(IDS_COMBINE, 0x03020600);
copyDialog.Title += ' ';
copyDialog.Title += itemName;
copyDialog.Static = LangLoadStringW(IDS_COMBINE_TO, 0x03020601);;
copyDialog.Static = LangString(IDS_COMBINE_TO, 0x03020601);;
if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
return;
@@ -435,8 +435,8 @@ void CApp::Combine()
CProgressDialog progressDialog;
combiner.ProgressDialog = &progressDialog;
UString progressWindowTitle = LangLoadStringW(IDS_APP_TITLE, 0x03000000);
UString title = LangLoadStringW(IDS_COMBINING, 0x03020610);
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
UString title = LangString(IDS_COMBINING, 0x03020610);
progressDialog.MainWindow = _window;
progressDialog.MainTitle = progressWindowTitle;

View File

@@ -0,0 +1,274 @@
// PhysDriveFolder.cpp
#include "StdAfx.h"
#include "PhysDriveFolder.h"
#include "Common/Alloc.h"
#include "Windows/PropVariant.h"
#include "Windows/FileDevice.h"
#include "Windows/FileSystem.h"
#include "../PropID.h"
using namespace NWindows;
static const UInt32 kBufferSize = (4 << 20);
static STATPROPSTG kProperties[] =
{
{ NULL, kpidName, VT_BSTR},
{ NULL, kpidSize, VT_UI8}
};
CPhysDriveFolder::~CPhysDriveFolder()
{
if (_buffer != 0)
MyFree(_buffer);
}
HRESULT CPhysDriveFolder::Init(const UString &path)
{
_prefix = L"\\\\.\\";
_path = path;
NFile::NDevice::CInFile inFile;
if (!inFile.Open(GetFullPath()))
return GetLastError();
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::LoadItems()
{
_driveType = NFile::NSystem::MyGetDriveType(_path + L"\\");
_name = _path.Left(1);
_name += L'.';
if (_driveType == DRIVE_CDROM)
_name += L"iso";
else
_name += L"img";
Int32 dummy;
WasChanged(&dummy);
return GetLength(_length);
}
STDMETHODIMP CPhysDriveFolder::GetNumberOfItems(UInt32 *numItems)
{
*numItems = 1;
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant propVariant;
if (itemIndex >= 1)
return E_INVALIDARG;
switch(propID)
{
case kpidIsFolder:
propVariant = false;
break;
case kpidName:
propVariant = _name;
break;
case kpidSize:
propVariant = _length;
break;
}
propVariant.Detach(value);
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
*resultFolder = 0;
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::GetName(BSTR *name)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::GetNumberOfProperties(UInt32 *numProperties)
{
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
return E_INVALIDARG;
const STATPROPSTG &prop = kProperties[index];
*propID = prop.propid;
*varType = prop.vt;
*name = 0;
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::GetTypeID(BSTR *name)
{
CMyComBSTR temp = L"PhysDrive";
*name = temp.Detach();
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::GetPath(BSTR *path)
{
UString tempPath = GetFullPath() + L"\\";
CMyComBSTR temp = tempPath;
*path = temp.Detach();
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::WasChanged(Int32 *wasChanged)
{
bool wasChangedMain = false;
*wasChanged = BoolToInt(wasChangedMain);
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::Clone(IFolderFolder **resultFolder)
{
CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
CMyComPtr<IFolderFolder> folderNew = folderSpec;
folderSpec->Init(_path);
*resultFolder = folderNew.Detach();
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
{
NCOM::CPropVariant propVariant;
if (index >= 1)
return E_INVALIDARG;
UInt64 size = 0;
HRESULT result = GetLength(size);
propVariant = size;
propVariant.Detach(value);
return result;
}
STDMETHODIMP CPhysDriveFolder::CreateFolder(const wchar_t *name, IProgress *progress)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::CreateFile(const wchar_t *name, IProgress *progress)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::Rename(UInt32 index, const wchar_t *newName, IProgress *progress)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::Delete(const UInt32 *indices, UInt32 numItems, IProgress *progress)
{ return E_NOTIMPL; }
STDMETHODIMP CPhysDriveFolder::SetProperty(UInt32 index, PROPID propID,
const PROPVARIANT *value, IProgress *progress)
{
if (index >= 1)
return E_INVALIDARG;
return E_NOTIMPL;
}
HRESULT CPhysDriveFolder::GetLength(UInt64 &length) const
{
NFile::NDevice::CInFile inFile;
if (!inFile.Open(GetFullPath()))
return GetLastError();
if (!inFile.GetLengthSmart(length))
return GetLastError();
return S_OK;
}
STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
if (numItems == 0)
return S_OK;
UString destPath = path;
if (destPath.IsEmpty())
return E_INVALIDARG;
bool directName = (destPath[destPath.Length() - 1] != L'\\');
if (directName)
{
if (numItems > 1)
return E_INVALIDARG;
}
else
destPath += _name;
UInt64 fileSize;
if (GetLength(fileSize) == S_OK)
{
RINOK(callback->SetTotal(fileSize));
}
Int32 writeAskResult;
CMyComBSTR destPathResult;
RINOK(callback->AskWrite(GetFullPath(), BoolToInt(false), NULL, &fileSize,
destPath, &destPathResult, &writeAskResult));
if (!IntToBool(writeAskResult))
return S_OK;
RINOK(callback->SetCurrentFilePath(GetFullPathWithName()));
NFile::NDevice::CInFile inFile;
if (!inFile.Open(GetFullPath()))
return GetLastError();
NFile::NIO::COutFile outFile;
if (!outFile.Create(destPathResult, true))
return GetLastError();
if (_buffer == 0)
{
_buffer = MyAlloc(kBufferSize);
if (_buffer == 0)
return E_OUTOFMEMORY;
}
UInt64 pos = 0;
UInt32 bufferSize = kBufferSize;
if (_driveType == DRIVE_REMOVABLE)
bufferSize = (18 << 10) * 4;
pos = 0;
while(pos < fileSize)
{
RINOK(callback->SetCompleted(&pos));
UInt32 curSize = (UInt32)MyMin(fileSize - pos, (UInt64)bufferSize);
UInt32 processedSize;
if (!inFile.Read(_buffer, curSize, processedSize))
return GetLastError();
if (processedSize == 0)
break;
curSize = processedSize;
if (!outFile.Write(_buffer, curSize, processedSize))
return GetLastError();
if (curSize != processedSize)
return E_FAIL;
pos += curSize;
}
return S_OK;
}
/////////////////////////////////////////////////
// Move Operations
STDMETHODIMP CPhysDriveFolder::MoveTo(
const UInt32 *indices,
UInt32 numItems,
const wchar_t *path,
IFolderOperationsExtractCallback *callback)
{
return E_NOTIMPL;
}
STDMETHODIMP CPhysDriveFolder::CopyFrom(
const wchar_t *fromFolderPath,
const wchar_t **itemsPaths, UInt32 numItems, IProgress *progress)
{
return E_NOTIMPL;
}

View File

@@ -0,0 +1,89 @@
// PhysDriveFolder.h
#ifndef __PHYSDRIVEFOLDER_H
#define __PHYSDRIVEFOLDER_H
#include "Common/String.h"
#include "Common/MyCom.h"
#include "IFolder.h"
class CPhysDriveFolder:
public IFolderFolder,
public IEnumProperties,
public IFolderGetTypeID,
public IFolderGetPath,
public IFolderWasChanged,
public IFolderOperations,
public IFolderGetItemFullSize,
public IFolderClone,
// public IFolderGetSystemIconIndex,
public CMyUnknownImp
{
UInt64 GetSizeOfItem(int anIndex) const;
public:
MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(IEnumProperties)
MY_QUERYINTERFACE_ENTRY(IFolderGetTypeID)
MY_QUERYINTERFACE_ENTRY(IFolderGetPath)
MY_QUERYINTERFACE_ENTRY(IFolderWasChanged)
MY_QUERYINTERFACE_ENTRY(IFolderOperations)
MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize)
MY_QUERYINTERFACE_ENTRY(IFolderClone)
// MY_QUERYINTERFACE_ENTRY(IFolderGetSystemIconIndex)
MY_QUERYINTERFACE_END
MY_ADDREF_RELEASE
STDMETHOD(LoadItems)();
STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder);
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder);
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder);
STDMETHOD(GetName)(BSTR *name);
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType);
STDMETHOD(GetTypeID)(BSTR *name);
STDMETHOD(GetPath)(BSTR *path);
STDMETHOD(WasChanged)(INT32 *wasChanged);
STDMETHOD(Clone)(IFolderFolder **resultFolder);
STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress);
// IFolderOperations
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress);
STDMETHOD(CreateFile)(const wchar_t *name, IProgress *progress);
STDMETHOD(Rename)(UInt32 index, const wchar_t *newName, IProgress *progress);
STDMETHOD(Delete)(const UInt32 *indices, UInt32 numItems, IProgress *progress);
STDMETHOD(CopyTo)(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback);
STDMETHOD(MoveTo)(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback);
STDMETHOD(CopyFrom)(const wchar_t *fromFolderPath,
const wchar_t **itemsPaths, UInt32 numItems, IProgress *progress);
STDMETHOD(SetProperty)(UInt32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress);
// STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
private:
UString _name;
UString _prefix;
UString _path;
UString GetFullPath() const { return _prefix + _path; }
UString GetFullPathWithName() const { return GetFullPath() + L'\\' + _name; }
CMyComPtr<IFolderFolder> _parentFolder;
void *_buffer;
UINT _driveType;
DISK_GEOMETRY geom;
UInt64 _length;
public:
HRESULT Init(const UString &path);
HRESULT GetLength(UInt64 &size) const;
CPhysDriveFolder(): _buffer(0) {}
~CPhysDriveFolder();
};
#endif

View File

@@ -21,7 +21,7 @@ public:
return GetLastError();
return createObject(&clsID, &IID_IFolderManager, (void **)manager);
}
HRESULT LoadAndCreateManager(LPCTSTR filePath, REFGUID clsID, IFolderManager **manager)
HRESULT LoadAndCreateManager(LPCWSTR filePath, REFGUID clsID, IFolderManager **manager)
{
if (!Load(filePath))
return GetLastError();

View File

@@ -69,5 +69,5 @@ UString GetNameOfProperty(PROPID propID)
if (index < 0)
return UString();
const CPropertyIDNamePair &pair = kPropertyIDNamePairs[index];
return LangLoadStringW(pair.ResourceID, pair.LangID);
return LangString(pair.ResourceID, pair.LangID);
}

View File

@@ -25,21 +25,24 @@ static NSynchronization::CCriticalSection g_CriticalSection;
static const TCHAR *kCUKeyPath = TEXT("Software\\7-ZIP\\FM");
static const TCHAR *kAssociations = TEXT("Associations");
static const TCHAR *kExtPlugins = TEXT("Plugins");
static const WCHAR *kExtPlugins = L"Plugins";
static const TCHAR *kExtEnabled = TEXT("Enabled");
static CSysString GetAssociationsPath()
{
return CSysString(kCUKeyPath) + CSysString('\\') + CSysString(kAssociations);
}
bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo)
{
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey key;
if(key.Open(HKEY_CURRENT_USER, CSysString(kCUKeyPath)
+ CSysString('\\') + CSysString(kAssociations)
+ CSysString('\\') + CSysString(GetSystemString(ext)),
KEY_READ) != ERROR_SUCCESS)
if(key.Open(HKEY_CURRENT_USER, GetAssociationsPath() + CSysString('\\') +
CSysString(GetSystemString(ext)), KEY_READ) != ERROR_SUCCESS)
return false;
CSysString pluginsString;
UString pluginsString;
key.QueryValue(kExtPlugins, pluginsString);
SplitString(GetUnicodeString(pluginsString), extInfo.Plugins);
SplitString(pluginsString, extInfo.Plugins);
return true;
}
@@ -48,8 +51,7 @@ void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
items.Clear();
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey associationsKey;
if(associationsKey.Open(HKEY_CURRENT_USER, CSysString(kCUKeyPath)
+ CSysString('\\') + CSysString(kAssociations), KEY_READ) != ERROR_SUCCESS)
if(associationsKey.Open(HKEY_CURRENT_USER, GetAssociationsPath(), KEY_READ) != ERROR_SUCCESS)
return;
CSysStringVector extNames;
associationsKey.EnumKeys(extNames);
@@ -62,9 +64,9 @@ void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
CKey key;
if(key.Open(associationsKey, extName, KEY_READ) != ERROR_SUCCESS)
return;
CSysString pluginsString;
UString pluginsString;
key.QueryValue(kExtPlugins, pluginsString);
SplitString(GetUnicodeString(pluginsString), extInfo.Plugins);
SplitString(pluginsString, extInfo.Plugins);
/*
if (key.QueryValue(kExtEnabled, extInfo.Enabled) != ERROR_SUCCESS)
extInfo.Enabled = false;
@@ -86,7 +88,7 @@ void WriteInternalAssociations(const CObjectVector<CExtInfo> &items)
const CExtInfo &extInfo = items[i];
CKey key;
key.Create(associationsKey, GetSystemString(extInfo.Ext));
key.SetValue(kExtPlugins, GetSystemString(JoinStrings(extInfo.Plugins)));
key.SetValue(kExtPlugins, JoinStrings(extInfo.Plugins));
// key.SetValue(kExtEnabled, extInfo.Enabled);
}
}
@@ -160,9 +162,9 @@ void DeleteShellExtensionInfo(const CSysString &extension)
}
void AddShellExtensionInfo(const CSysString &extension,
const CSysString &programTitle,
const CSysString &programOpenCommand,
const CSysString &iconPath,
const UString &programTitle,
const UString &programOpenCommand,
const UString &iconPath,
const void *shellNewData, int shellNewDataSize)
{
DeleteShellExtensionKey(extension);
@@ -200,18 +202,7 @@ void AddShellExtensionInfo(const CSysString &extension,
CKey commandKey;
commandKey.Create(openKey, kCommandKeyName);
CSysString params;
/*
if (!NSystem::MyGetWindowsDirectory(aParams))
{
aParams.Empty();
// return;
}
else
NFile::NName::NormalizeDirPathPrefix(aParams);
*/
// aParams += kOpenCommandValue;
HRESULT result = commandKey.SetValue(NULL, programOpenCommand);
commandKey.SetValue(NULL, programOpenCommand);
}
///////////////////////////

View File

@@ -24,9 +24,9 @@ namespace NRegistryAssociations {
void DeleteShellExtensionInfo(const CSysString &extension);
void AddShellExtensionInfo(const CSysString &extension,
const CSysString &programTitle,
const CSysString &programOpenCommand,
const CSysString &iconPath,
const UString &programTitle,
const UString &programOpenCommand,
const UString &iconPath,
const void *shellNewData, int shellNewDataSize);

View File

@@ -92,40 +92,22 @@ static bool ReadPluginInfo(CPluginInfo &pluginInfo)
return true;
}
CSysString GetProgramFolderPrefix();
#ifndef _WIN64
static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#endif
UString GetProgramFolderPrefix();
void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
{
plugins.Clear();
CSysString baseFolderPrefix = GetProgramFolderPrefix();
UString baseFolderPrefix = GetProgramFolderPrefix();
{
CSysString path = baseFolderPrefix + TEXT("7-zip");
#ifndef _WIN64
if (IsItWindowsNT())
path += TEXT("n");
#endif
path += TEXT(".dll");
CPluginInfo pluginInfo;
pluginInfo.FilePath = path;
pluginInfo.FilePath = baseFolderPrefix + L"7-zip.dll";
if (::ReadPluginInfo(pluginInfo))
plugins.Add(pluginInfo);
}
CSysString folderPath = baseFolderPrefix + TEXT("Plugins\\");
NFind::CEnumerator enumerator(folderPath + TEXT("*"));
NFind::CFileInfo fileInfo;
UString folderPath = baseFolderPrefix + L"Plugins\\";
NFind::CEnumeratorW enumerator(folderPath + L"*");
NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
{
if (fileInfo.IsDirectory())

View File

@@ -13,7 +13,7 @@ enum EPluginType
struct CPluginInfo
{
CSysString FilePath;
UString FilePath;
EPluginType Type;
UString Name;
CLSID ClassID;

View File

@@ -10,9 +10,10 @@ using namespace NRegistry;
static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP");
static const TCHAR *kCU_FMPath = TEXT("Software\\7-ZIP\\FM");
static const TCHAR *kLM_Path = TEXT("Software\\7-ZIP\\FM");
static const TCHAR *kLangValueName = TEXT("Lang");
static const TCHAR *kEditor = TEXT("Editor");
static const WCHAR *kLangValueName = L"Lang";
static const WCHAR *kEditor = L"Editor";
static const TCHAR *kShowDots = TEXT("ShowDots");
static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons");
static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu");
@@ -20,58 +21,96 @@ static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu");
static const TCHAR *kFullRow = TEXT("FullRow");
static const TCHAR *kShowGrid = TEXT("ShowGrid");
static const TCHAR *kAlternativeSelection = TEXT("AlternativeSelection");
static const TCHAR *kLockMemoryAdd = TEXT("LockMemoryAdd");
static const TCHAR *kLargePagesEnable = TEXT("LargePages");
// static const TCHAR *kSingleClick = TEXT("SingleClick");
// static const TCHAR *kUnderline = TEXT("Underline");
void SaveRegLang(const CSysString &langFile)
void SaveRegLang(const UString &langFile)
{
CKey cuKey;
cuKey.Create(HKEY_CURRENT_USER, kCUBasePath);
cuKey.SetValue(kLangValueName, langFile);
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(kLangValueName, langFile);
}
void ReadRegLang(CSysString &langFile)
void ReadRegLang(UString &langFile)
{
langFile.Empty();
CKey cuKey;
cuKey.Create(HKEY_CURRENT_USER, kCUBasePath);
cuKey.QueryValue(kLangValueName, langFile);
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
key.QueryValue(kLangValueName, langFile);
}
void SaveRegEditor(const CSysString &editorPath)
void SaveRegEditor(const UString &editorPath)
{
CKey cuKey;
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
cuKey.SetValue(kEditor, editorPath);
CKey key;
key.Create(HKEY_CURRENT_USER, kCU_FMPath);
key.SetValue(kEditor, editorPath);
}
void ReadRegEditor(CSysString &editorPath)
void ReadRegEditor(UString &editorPath)
{
editorPath.Empty();
CKey cuKey;
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
cuKey.QueryValue(kEditor, editorPath);
/*
if (editorPath.IsEmpty())
editorPath = TEXT("notepad.exe");
*/
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS)
key.QueryValue(kEditor, editorPath);
}
static void Save7ZipOption(const TCHAR *value, bool enabled)
{
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(value, enabled);
}
static void SaveOption(const TCHAR *value, bool enabled)
{
CKey cuKey;
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
cuKey.SetValue(value, enabled);
CKey key;
key.Create(HKEY_CURRENT_USER, kCU_FMPath);
key.SetValue(value, enabled);
}
static bool Read7ZipOption(const TCHAR *value, bool defaultValue)
{
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
{
bool enabled;
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
return enabled;
}
return defaultValue;
}
static bool ReadOption(const TCHAR *value, bool defaultValue)
{
CKey cuKey;
cuKey.Create(HKEY_CURRENT_USER, kCU_FMPath);
bool enabled;
if (cuKey.QueryValue(value, enabled) != ERROR_SUCCESS)
return defaultValue;
return enabled;
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS)
{
bool enabled;
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
return enabled;
}
return defaultValue;
}
static void SaveLmOption(const TCHAR *value, bool enabled)
{
CKey key;
key.Create(HKEY_LOCAL_MACHINE, kLM_Path);
key.SetValue(value, enabled);
}
static bool ReadLmOption(const TCHAR *value, bool defaultValue)
{
CKey key;
if (key.Open(HKEY_LOCAL_MACHINE, kLM_Path, KEY_READ) == ERROR_SUCCESS)
{
bool enabled;
if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
return enabled;
}
return defaultValue;
}
void SaveShowDots(bool showDots) { SaveOption(kShowDots, showDots); }
@@ -98,4 +137,12 @@ bool ReadSingleClick(){ return ReadOption(kSingleClick, false); }
void SaveUnderline(bool enable) { SaveOption(kUnderline, enable); }
bool ReadUnderline(){ return ReadOption(kUnderline, false); }
*/
*/
// void SaveLockMemoryAdd(bool enable) { SaveLmOption(kLockMemoryAdd, enable); }
// bool ReadLockMemoryAdd() { return ReadLmOption(kLockMemoryAdd, true); }
void SaveLockMemoryEnable(bool enable) { Save7ZipOption(kLargePagesEnable, enable); }
bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); }

View File

@@ -5,11 +5,11 @@
#ifndef __REGISTRYUTILS_H
#define __REGISTRYUTILS_H
void SaveRegLang(const CSysString &langFile);
void ReadRegLang(CSysString &langFile);
void SaveRegLang(const UString &langFile);
void ReadRegLang(UString &langFile);
void SaveRegEditor(const CSysString &langFile);
void ReadRegEditor(CSysString &langFile);
void SaveRegEditor(const UString &editorPath);
void ReadRegEditor(UString &editorPath);
void SaveShowDots(bool showDots);
bool ReadShowDots();
@@ -29,6 +29,12 @@ bool ReadShowGrid();
void SaveAlternativeSelection(bool enable);
bool ReadAlternativeSelection();
// void SaveLockMemoryAdd(bool enable);
// bool ReadLockMemoryAdd();
bool ReadLockMemoryEnable();
void SaveLockMemoryEnable(bool enable);
/*
void SaveSingleClick(bool enable);
bool ReadSingleClick();

View File

@@ -12,8 +12,7 @@ public:
virtual bool OnInit();
virtual void OnHelp();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
INT_PTR Create(HWND aWndParent = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_ABOUT), aWndParent); }
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_ABOUT, wndParent); }
};
#endif

View File

@@ -5,6 +5,7 @@
#include "Common/IntToString.h"
#include "Common/StringToInt.h"
#include "Common/Exception.h"
#include "Common/Alloc.h"
#include "Windows/Thread.h"
#include "Windows/PropVariant.h"
#include "Windows/Error.h"
@@ -140,15 +141,22 @@ public:
UInt32 BufferSize;
Byte *Buffer;
CBenchRandomGenerator(): Buffer(0) {}
~CBenchRandomGenerator() { delete []Buffer; }
void Init() { RG.Init(); }
void Set(UInt32 bufferSize)
{
delete []Buffer;
~CBenchRandomGenerator() { Free(); }
void Free()
{
::MidFree(Buffer);
Buffer = 0;
Buffer = new Byte[bufferSize];
}
void Init() { RG.Init(); }
bool Alloc(UInt32 bufferSize)
{
if (Buffer != 0 && BufferSize == bufferSize)
return true;
Free();
Buffer = (Byte *)::MidAlloc(bufferSize);
Pos = 0;
BufferSize = bufferSize;
return (Buffer != 0);
}
UInt32 GetRndBit() { return RG.GetRnd(1); }
/*
@@ -525,15 +533,29 @@ public:
UInt32 Pos;
Byte *Buffer;
CBenchmarkOutStream(): Buffer(0) {}
~CBenchmarkOutStream() { delete []Buffer; }
void Init(UInt32 bufferSize)
{
delete []Buffer;
~CBenchmarkOutStream() { Free(); }
void Free()
{
::MidFree(Buffer);
Buffer = 0;
Buffer = new Byte[bufferSize];
Pos = 0;
BufferSize = bufferSize;
}
bool Alloc(UInt32 bufferSize)
{
if (Buffer != 0 && BufferSize == bufferSize)
return true;
Free();
Buffer = (Byte *)::MidAlloc(bufferSize);
Init();
BufferSize = bufferSize;
return (Buffer != 0);
}
void Init()
{
Pos = 0;
}
MY_UNKNOWN_IMP
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
};
@@ -691,7 +713,9 @@ DWORD CThreadBenchmark::Process()
writeCoderProperties->WriteCoderProperties(propStream);
}
randomGenerator.Set(kBufferSize);
if (!randomGenerator.Alloc(kBufferSize))
return E_OUTOFMEMORY;
randomGenerator.Generate();
CCRC crc;
@@ -705,11 +729,22 @@ DWORD CThreadBenchmark::Process()
}
CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
inStreamSpec->Init(randomGenerator.Buffer, randomGenerator.BufferSize);
CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
CBenchmarkOutStream *outStreamSpec = new CBenchmarkOutStream;
outStreamSpec->Init(kCompressedBufferSize);
CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
if (!outStreamSpec->Alloc(kCompressedBufferSize))
return E_OUTOFMEMORY;
{
// this code is for reducing time of memory allocationg
inStreamSpec->Init(randomGenerator.Buffer, MyMin((UInt32)1, randomGenerator.BufferSize));
outStreamSpec->Init();
HRESULT result = Encoder->Code(inStream, outStream, 0, 0, NULL);
}
inStreamSpec->Init(randomGenerator.Buffer, randomGenerator.BufferSize);
outStreamSpec->Init();
_approvedStart = dictionarySize;
_startTime = ::GetTimeCount();
HRESULT result = Encoder->Code(inStream, outStream, 0, 0, this);

View File

@@ -128,11 +128,7 @@ public:
CProgressSyncInfo _syncInfo;
CBenchmarkDialog(): _timer(0) {}
INT_PTR Create(HWND wndParent = 0)
{
return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_BENCHMARK), wndParent);
}
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
};
void Benchmark(HWND hwnd);

View File

@@ -17,10 +17,9 @@ public:
UString Title;
UString Static;
UString Value;
CSysStringVector Strings;
UStringVector Strings;
// CComboDialog(): Sorted(false) {};
INT_PTR Create(HWND parentWindow = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_COMBO), parentWindow); }
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COMBO, parentWindow); }
};
#endif

View File

@@ -35,7 +35,7 @@ bool CCopyDialog::OnInit()
staticContol.Attach(GetItem(IDC_COPY_STATIC));
staticContol.SetText(Static);
for(int i = 0; i < Strings.Size(); i++)
_path.AddString(GetSystemString(Strings[i]));
_path.AddString(Strings[i]);
_path.SetText(Value);
return CModalDialog::OnInit();
}
@@ -53,19 +53,19 @@ bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
void CCopyDialog::OnButtonSetPath()
{
CSysString currentPath;
UString currentPath;
_path.GetText(currentPath);
/*
#ifdef LANG
CSysString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
UString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
#else
CSysString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
UString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
#endif
*/
CSysString title = TEXT("Specify a location for output folder");
UString title = L"Specify a location for output folder";
CSysString resultPath;
UString resultPath;
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
return;
NFile::NName::NormalizeDirPathPrefix(resultPath);

View File

@@ -20,8 +20,7 @@ public:
UString Value;
UStringVector Strings;
INT_PTR Create(HWND parentWindow = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_COPY), parentWindow); }
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COPY, parentWindow); }
};
#endif

View File

@@ -7,6 +7,7 @@
#include "Common/StringConvert.h"
#include "Windows/Defs.h"
#include "Windows/CommonDialog.h"
// #include "Windows/FileFind.h"
// #include "Windows/FileDir.h"
@@ -29,7 +30,7 @@ bool CEditPage::OnInit()
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
_editorEdit.Attach(GetItem(IDC_EDIT_EDIT_EDITOR));
CSysString editorPath;
UString editorPath;
ReadRegEditor(editorPath);
_editorEdit.SetText(editorPath);
return CPropertyPage::OnInit();
@@ -40,7 +41,7 @@ LONG CEditPage::OnApply()
// int selectedIndex = _langCombo.GetCurSel();
// int pathIndex = _langCombo.GetItemData(selectedIndex);
// ReloadLang();
CSysString editorPath;
UString editorPath;
_editorEdit.GetText(editorPath);
SaveRegEditor(editorPath);
return PSNRET_NOERROR;
@@ -66,85 +67,14 @@ bool CEditPage::OnButtonClicked(int aButtonID, HWND aButtonHWND)
return CPropertyPage::OnButtonClicked(aButtonID, aButtonHWND);
}
class CDoubleZeroStringList
{
CRecordVector<int> _indexes;
CSysString _string;
public:
void Add(LPCTSTR string);
void SetForBuffer(LPTSTR buffer);
};
const TCHAR kDelimiterSymbol = TEXT(' ');
void CDoubleZeroStringList::Add(LPCTSTR string)
{
_string += string;
_indexes.Add(_string.Length());
_string += kDelimiterSymbol;
}
void CDoubleZeroStringList::SetForBuffer(LPTSTR buffer)
{
lstrcpy(buffer, _string);
for (int i = 0; i < _indexes.Size(); i++)
buffer[_indexes[i]] = TEXT('\0');
}
void CEditPage::OnSetEditorButton()
{
OPENFILENAME info;
info.lStructSize = sizeof(info);
info.hwndOwner = HWND(*this);
info.hInstance = 0;
const int kBufferSize = MAX_PATH * 2;
TCHAR buffer[kBufferSize + 1];
CSysString editorPath;
UString editorPath;
_editorEdit.GetText(editorPath);
lstrcpy(buffer, editorPath);
const int kFilterBufferSize = MAX_PATH;
TCHAR filterBuffer[kFilterBufferSize];
CDoubleZeroStringList doubleZeroStringList;
CSysString string = TEXT("*.exe");
doubleZeroStringList.Add(string);
doubleZeroStringList.Add(string);
doubleZeroStringList.SetForBuffer(filterBuffer);
info.lpstrFilter = filterBuffer;
info.lpstrCustomFilter = NULL;
info.nMaxCustFilter = 0;
info.nFilterIndex = 0;
info.lpstrFile = buffer;
info.nMaxFile = kBufferSize;
info.lpstrFileTitle = NULL;
info.nMaxFileTitle = 0;
info.lpstrInitialDir= NULL;
/*
CSysString title = "Open";
LangLoadString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
info.lpstrTitle = title;
*/
info.lpstrTitle = 0;
info.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
info.nFileOffset = 0;
info.nFileExtension = 0;
info.lpstrDefExt = NULL;
info.lCustData = 0;
info.lpfnHook = NULL;
info.lpTemplateName = NULL;
if(!GetOpenFileName(&info))
UString resPath;
if(!MyGetOpenFileName(HWND(*this), 0, editorPath, L"*.exe", resPath))
return;
_editorEdit.SetText(buffer);
_editorEdit.SetText(resPath);
// Changed();
}

View File

@@ -26,13 +26,13 @@ bool CLangPage::OnInit()
_langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG));
CSysString s = NWindows::MyLoadString(IDS_LANG_ENGLISH);
s += TEXT(" (");
s += NWindows::MyLoadString(IDS_LANG_NATIVE);
s += TEXT(")");
UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH);
s += L" (";
s += NWindows::MyLoadStringW(IDS_LANG_NATIVE);
s += L")";
int index = _langCombo.AddString(s);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(TEXT("-"));
_paths.Add(L"-");
_langCombo.SetCurSel(0);
CObjectVector<CLangEx> langs;
@@ -55,10 +55,10 @@ bool CLangPage::OnInit()
name += L")";
}
}
index = _langCombo.AddString(GetSystemString(name));
index = _langCombo.AddString(name);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(GetSystemString(lang.ShortName));
if (g_LangID.CompareNoCase(GetSystemString(lang.ShortName)) == 0)
_paths.Add(lang.ShortName);
if (g_LangID.CompareNoCase(lang.ShortName) == 0)
_langCombo.SetCurSel(index);
}
return CPropertyPage::OnInit();

View File

@@ -9,7 +9,7 @@
class CLangPage: public NWindows::NControl::CPropertyPage
{
NWindows::NControl::CComboBox _langCombo;
CSysStringVector _paths;
UStringVector _paths;
public:
bool _langWasChanged;
virtual bool OnInit();

View File

@@ -32,10 +32,10 @@ bool CListViewDialog::OnInit()
for(int i = 0; i < Strings.Size(); i++)
{
LVITEM item;
LVITEMW item;
item.mask = LVIF_TEXT;
item.iItem = i;
item.pszText = (LPTSTR)(LPCTSTR)Strings[i];
item.pszText = (LPWSTR)(LPCWSTR)Strings[i];
item.iSubItem = 0;
_listView.InsertItem(&item);
}

View File

@@ -17,12 +17,11 @@ class CListViewDialog: public NWindows::NControl::CModalDialog
public:
UString Title;
bool DeleteIsAllowed;
CSysStringVector Strings;
UStringVector Strings;
bool StringsWereChanged;
int FocusedItemIndex;
INT_PTR Create(HWND wndParent = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_LISTVIEW), wndParent); }
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_LISTVIEW, wndParent); }
CListViewDialog(): DeleteIsAllowed(false) {}

View File

@@ -3,6 +3,7 @@
#include "StdAfx.h"
#include "MessagesDialog.h"
#include "Common/StringConvert.h"
#include "Common/IntToString.h"
#include "Windows/ResourceString.h"
#ifdef LANG
@@ -18,24 +19,21 @@ static CIDLangPair kIDLangPairs[] =
};
#endif
void CMessagesDialog::AddMessageDirect(LPCTSTR message)
void CMessagesDialog::AddMessageDirect(LPCWSTR message)
{
int itemIndex = _messageList.GetItemCount();
LVITEM item;
LVITEMW item;
item.mask = LVIF_TEXT;
item.iItem = itemIndex;
CSysString stringNumber;
TCHAR sz[32];
wsprintf(sz, TEXT("%d"), itemIndex);
stringNumber = sz;
wchar_t sz[32];
ConvertInt64ToString(itemIndex, sz);
item.pszText = (LPTSTR)(LPCTSTR)stringNumber;
item.pszText = sz;
item.iSubItem = 0;
_messageList.InsertItem(&item);
item.mask = LVIF_TEXT;
item.pszText = (LPTSTR)message;
item.pszText = (LPWSTR)message;
item.iSubItem = 1;
_messageList.SetItem(&item);
}
@@ -48,10 +46,10 @@ void CMessagesDialog::AddMessage(LPCWSTR message)
int pos = s.Find(L'\n');
if (pos < 0)
break;
AddMessageDirect(GetSystemString(s.Left(pos)));
AddMessageDirect(s.Left(pos));
s.Delete(0, pos + 1);
}
AddMessageDirect(GetSystemString(s));
AddMessageDirect(s);
}
bool CMessagesDialog::OnInit()
@@ -61,11 +59,12 @@ bool CMessagesDialog::OnInit()
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_messageList.Attach(GetItem(IDC_MESSAGE_LIST));
_messageList.SetUnicodeFormat(true);
LVCOLUMN columnInfo;
LVCOLUMNW columnInfo;
columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
columnInfo.fmt = LVCFMT_LEFT;
columnInfo.pszText = TEXT("#");
columnInfo.pszText = L"#";
columnInfo.iSubItem = 0;
columnInfo.cx = 30;
@@ -74,13 +73,14 @@ bool CMessagesDialog::OnInit()
columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
columnInfo.fmt = LVCFMT_LEFT;
#ifdef LANG
CSysString s = LangLoadString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
UString s =
#ifdef LANG
LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
#else
CSysString s = MyLoadString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
#endif
columnInfo.pszText = (LPTSTR)(LPCTSTR)s;
columnInfo.pszText = (LPWSTR)(LPCWSTR)s;
columnInfo.iSubItem = 1;
columnInfo.cx = 450;

View File

@@ -11,13 +11,12 @@
class CMessagesDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CListView _messageList;
void AddMessageDirect(LPCTSTR message);
void AddMessageDirect(LPCWSTR message);
void AddMessage(LPCWSTR message);
virtual bool OnInit();
public:
const UStringVector *Messages;
INT_PTR Create(HWND parentWindow = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_MESSAGES), parentWindow); }
INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_MESSAGES, parent); }
};
#endif

View File

@@ -45,7 +45,7 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
#ifdef LANG
0x02000982,
#endif
NumberToStringW(fileInfo.Size));
NumberToString(fileInfo.Size));
UString reducedName;
const int kLineSize = 88;
@@ -70,11 +70,12 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
timeString = ConvertFileTimeToString(localFileTime);
fullString +=
#ifdef LANG
LangLoadStringW(IDS_FILE_MODIFIED, 0x02000983);
#ifdef LANG
LangString(IDS_FILE_MODIFIED, 0x02000983);
#else
MyLoadStringW(IDS_FILE_MODIFIED);
#endif
fullString += L" ";
fullString += timeString;
}

View File

@@ -25,8 +25,7 @@ class COverwriteDialog: public NWindows::NControl::CModalDialog
virtual bool OnInit();
bool OnButtonClicked(int buttonID, HWND buttonHWND);
public:
INT_PTR Create(HWND parent = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_OVERWRITE), parent); }
INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_OVERWRITE, parent); }
NOverwriteDialog::CFileInfo OldFileInfo;
NOverwriteDialog::CFileInfo NewFileInfo;

View File

@@ -35,7 +35,7 @@ bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
_passwordControl.SetPasswordChar((IsButtonChecked(
IDC_CHECK_PASSWORD_SHOW) == BST_CHECKED) ? 0: TEXT('*'));
CSysString password;
UString password;
_passwordControl.GetText(password);
_passwordControl.SetText(password);
return true;

View File

@@ -15,8 +15,7 @@ class CPasswordDialog: public NWindows::NControl::CModalDialog
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
public:
UString Password;
INT_PTR Create(HWND parentWindow = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_PASSWORD), parentWindow); }
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_PASSWORD, parentWindow); }
};
#endif

View File

@@ -33,18 +33,17 @@ bool CPluginsPage::OnInit()
_listView.Attach(GetItem(IDC_PLUGINS_LIST));
UINT32 aNewFlags = /*LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
_listView.SetExtendedListViewStyle(aNewFlags, aNewFlags);
UINT32 newFlags = /*LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
_listView.SetExtendedListViewStyle(newFlags, newFlags);
// CSysString aString = LangLoadString(IDS_COLUMN_TITLE, 0x02000E81);
CSysString aString = TEXT("Plugins");
LVCOLUMN aColumn;
aColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
aColumn.cx = 160;
aColumn.fmt = LVCFMT_LEFT;
aColumn.pszText = (LPTSTR)(LPCTSTR)aString;
aColumn.iSubItem = 0;
_listView.InsertColumn(0, &aColumn);
UString title = L"Plugins";
LVCOLUMNW column;
column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
column.cx = 160;
column.fmt = LVCFMT_LEFT;
column.pszText = (LPWSTR)(LPCWSTR)title;
column.iSubItem = 0;
_listView.InsertColumn(0, &column);
ReadFileFolderPluginInfoList(_plugins);
@@ -52,22 +51,22 @@ bool CPluginsPage::OnInit()
// _listView.DeleteAllItems();
for(int i = 0; i < _plugins.Size(); i++)
{
LVITEM anItem;
anItem.iItem = i;
anItem.mask = LVIF_TEXT | LVIF_STATE;
CSysString pluginName = GetSystemString(_plugins[i].Name);
anItem.pszText = (TCHAR *)(const TCHAR *)pluginName;
anItem.state = 0;
anItem.stateMask = UINT(-1);
anItem.iSubItem = 0;
_listView.InsertItem(&anItem);
LVITEMW item;
item.iItem = i;
item.mask = LVIF_TEXT | LVIF_STATE;
UString pluginName = _plugins[i].Name;
item.pszText = (WCHAR *)(const WCHAR *)pluginName;
item.state = 0;
item.stateMask = UINT(-1);
item.iSubItem = 0;
_listView.InsertItem(&item);
_listView.SetCheckState(i, true);
}
_listView.SetRedraw(true);
if(_listView.GetItemCount() > 0)
{
UINT aState = LVIS_SELECTED | LVIS_FOCUSED;
_listView.SetItemState(0, aState, aState);
UINT state = LVIS_SELECTED | LVIS_FOCUSED;
_listView.SetItemState(0, state, state);
}
return CPropertyPage::OnInit();
@@ -76,8 +75,8 @@ bool CPluginsPage::OnInit()
LONG CPluginsPage::OnApply()
{
/*
int aSelectedIndex = m_Lang.GetCurSel();
int aPathIndex = m_Lang.GetItemData(aSelectedIndex);
int selectedIndex = m_Lang.GetCurSel();
int aPathIndex = m_Lang.GetItemData(selectedIndex);
SaveRegLang(m_Paths[aPathIndex]);
ReloadLang();
*/
@@ -123,31 +122,14 @@ STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
UString folder;
if (!::GetProgramFolderPath(folder))
return E_FAIL;
CMyComBSTR valueTemp = GetUnicodeString(folder);
CMyComBSTR valueTemp = folder;
*value = valueTemp.Detach();
return S_OK;
}
#ifndef _WIN64
static bool IsItWindowsNT()
{
OSVERSIONINFO aVersionInfo;
aVersionInfo.dwOSVersionInfoSize = sizeof(aVersionInfo);
if (!::GetVersionEx(&aVersionInfo))
return false;
return (aVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#endif
static UString GetDefaultProgramName()
{
UString name;
name += L"7zFM";
#ifndef _WIN64
if (IsItWindowsNT())
name += L"n";
#endif
return name + L".exe";
return L"7zFM.exe";
}
STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
@@ -214,9 +196,9 @@ bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
const NMLISTVIEW *aNMListView = (const NMLISTVIEW *)lParam;
if ((aNMListView->uChanged & LVIF_STATE) != 0)
{
UINT anOldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
UINT aNewState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
if (anOldState != aNewState)
UINT oldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
UINT newState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
if (oldState != newState)
Changed();
}
return true;
@@ -225,14 +207,14 @@ bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
}
/*
bool CPluginsPage::OnCommand(int aCode, int anItemID, LPARAM lParam)
bool CPluginsPage::OnCommand(int code, int itemID, LPARAM lParam)
{
if (aCode == CBN_SELCHANGE && anItemID == IDC_LANG_COMBO_LANG)
if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
{
Changed();
return true;
}
return CPropertyPage::OnCommand(aCode, anItemID, lParam);
return CPropertyPage::OnCommand(code, itemID, lParam);
}
*/

View File

@@ -17,7 +17,6 @@ class CPluginsPage: public NWindows::NControl::CPropertyPage
public:
virtual bool OnInit();
virtual void OnNotifyHelp();
// virtual bool OnCommand(int aCode, int anItemID, LPARAM lParam);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnButtonOptions();
virtual LONG OnApply();

View File

@@ -27,10 +27,10 @@ CProgressDialog::~CProgressDialog()
{
AddToTitle(TEXT(""));
}
void CProgressDialog::AddToTitle(LPCTSTR s)
void CProgressDialog::AddToTitle(LPCWSTR s)
{
if (MainWindow != 0)
::SetWindowText(MainWindow, s + UString(MainTitle));
::MySetWindowText(MainWindow, UString(s) + MainTitle);
}
#endif

View File

@@ -88,7 +88,7 @@ private:
virtual void OnCancel();
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
#ifndef _SFX
void AddToTitle(LPCTSTR string);
void AddToTitle(LPCWSTR string);
#endif
bool OnButtonClicked(int buttonID, HWND buttonHWND);
public:
@@ -110,10 +110,10 @@ public:
void WaitCreating() { _dialogCreatedEvent.Lock(); }
INT_PTR Create(const UString &title, HWND aWndParent = 0)
INT_PTR Create(const UString &title, HWND wndParent = 0)
{
_title = title;
return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_PROGRESS), aWndParent);
return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
}
static const UINT kCloseMessage;

View File

@@ -69,7 +69,7 @@ static void ReduceString(UString &s, int size)
bool CProgressDialog::OnInit()
{
_range = UInt64(-1);
_range = (UInt64)(Int64)(-1);
_prevPercentValue = UInt32(-1);
_prevElapsedSec = UInt32(-1);
_prevRemainingSec = UInt32(-1);
@@ -93,9 +93,9 @@ bool CProgressDialog::OnInit()
window = GetItem(IDC_BUTTON_PAUSE);
window.GetText(pauseString);
foregroundString = LangLoadStringW(IDS_PROGRESS_FOREGROUND, 0x02000C11);
continueString = LangLoadStringW(IDS_PROGRESS_CONTINUE, 0x02000C13);
pausedString = LangLoadStringW(IDS_PROGRESS_PAUSED, 0x02000C20);
foregroundString = LangString(IDS_PROGRESS_FOREGROUND, 0x02000C11);
continueString = LangString(IDS_PROGRESS_CONTINUE, 0x02000C13);
pausedString = LangString(IDS_PROGRESS_PAUSED, 0x02000C20);
m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
_timer = SetTimer(kTimerID, kTimerElapse);
@@ -113,27 +113,19 @@ void CProgressDialog::OnCancel()
static void ConvertSizeToString(UInt64 value, wchar_t *s)
{
if (value < (UInt64(10000) << 0))
{
ConvertUInt64ToString(value, s);
lstrcatW(s, L" B");
return;
}
if (value < (UInt64(10000) << 10))
{
ConvertUInt64ToString((value >> 10), s);
lstrcatW(s, L" KB");
return;
}
if (value < (UInt64(10000) << 20))
{
ConvertUInt64ToString((value >> 20), s);
lstrcatW(s, L" MB");
return;
}
ConvertUInt64ToString((value >> 30), s);
lstrcatW(s, L" GB");
return;
const wchar_t *kModif = L" KMGTP";
for (int i = 0; true; i++)
if (i == 5 || value < (UInt64(10000) << (i * 10)))
{
ConvertUInt64ToString(value >> (i * 10), s);
s += wcslen(s);
*s++ = ' ';
if (i != 0)
*s++ = kModif[i];
*s++ = L'B';
*s++ = L'\0';
return;
}
}
void CProgressDialog::SetRange(UInt64 range)
@@ -182,7 +174,13 @@ bool CProgressDialog::OnTimer(WPARAM timerID, LPARAM callback)
if (total != _range)
SetRange(total);
SetPos(completed);
if (total == (UInt64)(Int64)-1)
{
SetPos(0);
SetRange(completed);
}
else
SetPos(completed);
_elapsedTime += (curTime - _prevTime);
_prevTime = curTime;
@@ -201,16 +199,23 @@ bool CProgressDialog::OnTimer(WPARAM timerID, LPARAM callback)
if (completed != 0 && elapsedChanged)
{
UInt64 remainingTime = 0;
if (completed < total)
remainingTime = _elapsedTime * (total - completed) / completed;
UInt64 remainingSec = remainingTime / 1000;
if (remainingSec != _prevRemainingSec)
if (total == (UInt64)(Int64)-1)
{
TCHAR s[40];
GetTimeString(remainingSec, s);
SetItemText(IDC_PROGRESS_REMAINING_VALUE, s);
_prevRemainingSec = remainingSec;
SetItemText(IDC_PROGRESS_REMAINING_VALUE, L"");
}
else
{
UInt64 remainingTime = 0;
if (completed < total)
remainingTime = _elapsedTime * (total - completed) / completed;
UInt64 remainingSec = remainingTime / 1000;
if (remainingSec != _prevRemainingSec)
{
TCHAR s[40];
GetTimeString(remainingSec, s);
SetItemText(IDC_PROGRESS_REMAINING_VALUE, s);
_prevRemainingSec = remainingSec;
}
}
// if (elapsedChanged)
{
@@ -405,7 +410,7 @@ bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
if (!paused)
OnPauseButton();
int res = ::MessageBoxW(HWND(*this),
LangLoadStringW(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
LangString(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
_title, MB_YESNOCANCEL);
// ProgressSynch.SetPaused(paused);
if (!paused)

View File

@@ -21,7 +21,7 @@ class CProgressSynch
UString TitleFileName;
UString CurrentFileName;
public:
CProgressSynch(): _stopped(false), _paused(false), _total(1), _completed(0) {}
CProgressSynch(): _stopped(false), _paused(false), _total((UInt64)(Int64)-1), _completed(0) {}
bool GetStopped()
{
@@ -168,10 +168,10 @@ public:
void WaitCreating() { _dialogCreatedEvent.Lock(); }
INT_PTR Create(const UString &title, HWND aWndParent = 0)
INT_PTR Create(const UString &title, HWND wndParent = 0)
{
_title = title;
return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_PROGRESS), aWndParent);
return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
}
static const UINT kCloseMessage;

View File

@@ -7,6 +7,7 @@
#include "Common/StringConvert.h"
#include "Windows/Defs.h"
#include "Windows/MemoryLock.h"
#include "../../RegistryUtils.h"
#include "../../HelpUtils.h"
@@ -23,12 +24,15 @@ static CIDLangPair kIDLangPairs[] =
{ IDC_SETTINGS_FULL_ROW, 0x03010420},
{ IDC_SETTINGS_SHOW_GRID, 0x03010421},
{ IDC_SETTINGS_ALTERNATIVE_SELECTION, 0x03010430},
{ IDC_SETTINGS_LARGE_PAGES, 0x03010440}
// { IDC_SETTINGS_SINGLE_CLICK, 0x03010422},
// { IDC_SETTINGS_UNDERLINE, 0x03010423}
};
static LPCWSTR kEditTopic = L"FM/options.htm#settings";
extern bool IsLargePageSupported();
bool CSettingsPage::OnInit()
{
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
@@ -40,6 +44,10 @@ bool CSettingsPage::OnInit()
CheckButton(IDC_SETTINGS_FULL_ROW, ReadFullRow());
CheckButton(IDC_SETTINGS_SHOW_GRID, ReadShowGrid());
CheckButton(IDC_SETTINGS_ALTERNATIVE_SELECTION, ReadAlternativeSelection());
if (IsLargePageSupported())
CheckButton(IDC_SETTINGS_LARGE_PAGES, ReadLockMemoryEnable());
else
EnableItem(IDC_SETTINGS_LARGE_PAGES, false);
// CheckButton(IDC_SETTINGS_SINGLE_CLICK, ReadSingleClick());
// CheckButton(IDC_SETTINGS_UNDERLINE, ReadUnderline());
@@ -64,6 +72,12 @@ LONG CSettingsPage::OnApply()
SaveFullRow(IsButtonCheckedBool(IDC_SETTINGS_FULL_ROW));
SaveShowGrid(IsButtonCheckedBool(IDC_SETTINGS_SHOW_GRID));
SaveAlternativeSelection(IsButtonCheckedBool(IDC_SETTINGS_ALTERNATIVE_SELECTION));
if (IsLargePageSupported())
{
bool enable = IsButtonCheckedBool(IDC_SETTINGS_LARGE_PAGES);
NSecurity::EnableLockMemoryPrivilege(enable);
SaveLockMemoryEnable(enable);
}
// SaveSingleClick(IsButtonCheckedBool(IDC_SETTINGS_SINGLE_CLICK));
// SaveUnderline(IsButtonCheckedBool(IDC_SETTINGS_UNDERLINE));
@@ -91,6 +105,7 @@ bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
case IDC_SETTINGS_FULL_ROW:
case IDC_SETTINGS_SHOW_GRID:
case IDC_SETTINGS_ALTERNATIVE_SELECTION:
case IDC_SETTINGS_LARGE_PAGES:
Changed();
return true;
}

View File

@@ -8,3 +8,4 @@
#define IDC_SETTINGS_SINGLE_CLICK 1014
#define IDC_SETTINGS_UNDERLINE 1015
#define IDC_SETTINGS_ALTERNATIVE_SELECTION 1016
#define IDC_SETTINGS_LARGE_PAGES 1017

View File

@@ -29,4 +29,7 @@ BEGIN
CONTROL "&Alternative selection mode", IDC_SETTINGS_ALTERNATIVE_SELECTION, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 122, xSize2, 10
CONTROL "Use &large memory pages", IDC_SETTINGS_LARGE_PAGES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 142, xSize2, 10
END

View File

@@ -36,7 +36,7 @@ bool CSplitDialog::OnInit()
{
UString title;
GetText(title);
title += ' ';
title += L' ';
title += FilePath;
SetText(title);
}
@@ -59,10 +59,10 @@ bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
void CSplitDialog::OnButtonSetPath()
{
CSysString currentPath;
UString currentPath;
_pathCombo.GetText(currentPath);
CSysString title = TEXT("Specify a location for output folder");
CSysString resultPath;
UString title = L"Specify a location for output folder";
UString resultPath;
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
return;
NFile::NName::NormalizeDirPathPrefix(resultPath);
@@ -78,7 +78,7 @@ void CSplitDialog::OnOK()
volumeString.Trim();
if (!ParseVolumeSizes(volumeString, VolumeSizes))
{
MessageBox((HWND)*this, TEXT("Incorrect volume size"), TEXT("7-Zip"), MB_ICONERROR);
MessageBoxW((HWND)*this, L"Incorrect volume size", L"7-Zip", MB_ICONERROR);
return;
}
CModalDialog::OnOK();

View File

@@ -21,7 +21,7 @@ public:
UString Path;
CRecordVector<UInt64> VolumeSizes;
INT_PTR Create(HWND parentWindow = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_SPLIT), parentWindow); }
{ return CModalDialog::Create(IDD_DIALOG_SPLIT, parentWindow); }
};
#endif

View File

@@ -50,24 +50,24 @@ bool CSystemPage::OnInit()
_listViewExt.SetExtendedListViewStyle(newFlags, newFlags);
_listViewPlugins.SetExtendedListViewStyle(newFlags, newFlags);
CSysString s = LangLoadString(IDS_PROPERTY_EXTENSION, 0x02000205);
LVCOLUMN column;
UString s = LangString(IDS_PROPERTY_EXTENSION, 0x02000205);
LVCOLUMNW column;
column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
column.cx = 70;
column.fmt = LVCFMT_LEFT;
column.pszText = (LPTSTR)(LPCTSTR)s;
column.pszText = (LPWSTR)(LPCWSTR)s;
column.iSubItem = 0;
_listViewExt.InsertColumn(0, &column);
s = LangLoadString(IDS_PLUGIN, 0x03010310);
s = LangString(IDS_PLUGIN, 0x03010310);
column.cx = 70;
column.pszText = (LPTSTR)(LPCTSTR)s;
column.pszText = (LPWSTR)(LPCWSTR)s;
column.iSubItem = 1;
_listViewExt.InsertColumn(1, &column);
s = LangLoadString(IDS_PLUGIN, 0x03010310);
s = LangString(IDS_PLUGIN, 0x03010310);
column.cx = 70;
column.pszText = (LPTSTR)(LPCTSTR)s;
column.pszText = (LPWSTR)(LPCWSTR)s;
column.iSubItem = 0;
_listViewPlugins.InsertColumn(0, &column);
@@ -77,12 +77,11 @@ bool CSystemPage::OnInit()
{
CExtInfoBig &extInfo = _extDatabase.ExtBigItems[i];
LVITEM item;
LVITEMW item;
item.iItem = i;
item.mask = LVIF_TEXT | LVIF_PARAM;
item.lParam = i;
CSysString ext = GetSystemString(extInfo.Ext);
item.pszText = (LPTSTR)(LPCTSTR)ext;
item.pszText = (LPWSTR)(LPCWSTR)extInfo.Ext;
item.iSubItem = 0;
int itemIndex = _listViewExt.InsertItem(&item);
@@ -106,53 +105,36 @@ bool CSystemPage::OnInit()
void CSystemPage::SetMainPluginText(int itemIndex, int indexInDatabase)
{
LVITEM item;
LVITEMW item;
item.iItem = itemIndex;
item.mask = LVIF_TEXT;
CSysString mainPlugin = GetSystemString(
_extDatabase.GetMainPluginNameForExtItem(indexInDatabase));
item.pszText = (TCHAR *)(const TCHAR *)mainPlugin;
UString mainPlugin = _extDatabase.GetMainPluginNameForExtItem(indexInDatabase);
item.pszText = (WCHAR *)(const WCHAR *)mainPlugin;
item.iSubItem = 1;
_listViewExt.SetItem(&item);
}
#ifndef _WIN64
static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#endif
static UString GetProgramCommand()
{
UString path = L"\"";
UString folder;
if (GetProgramFolderPath(folder))
path += folder;
path += L"7zFM";
#ifndef _WIN64
if (IsItWindowsNT())
path += L"n";
#endif
path += L".exe\" \"%1\"";
path += L"7zFM.exe\" \"%1\"";
return path;
}
static CSysString GetIconPath(const CSysString &filePath,
static UString GetIconPath(const UString &filePath,
const CLSID &clsID, const UString &extension)
{
CPluginLibrary library;
CMyComPtr<IFolderManager> folderManager;
CMyComPtr<IFolderFolder> folder;
if (library.LoadAndCreateManager(filePath, clsID, &folderManager) != S_OK)
return CSysString();
return UString();
CMyComBSTR typesString;
if (folderManager->GetTypes(&typesString) != S_OK)
return CSysString();
return UString();
UStringVector types;
SplitString((const wchar_t *)typesString, types);
for (int typeIndex = 0; typeIndex < types.Size(); typeIndex++)
@@ -164,16 +146,15 @@ static CSysString GetIconPath(const CSysString &filePath,
if (extension.CompareNoCase((const wchar_t *)extTemp) == 0)
{
CMyComPtr<IFolderManagerGetIconPath> getIconPath;
if (folderManager.QueryInterface(
IID_IFolderManagerGetIconPath, &getIconPath) != S_OK)
return CSysString();
if (folderManager.QueryInterface(IID_IFolderManagerGetIconPath, &getIconPath) != S_OK)
break;
CMyComBSTR iconPathTemp;
if (getIconPath->GetIconPath(type, &iconPathTemp) != S_OK)
return CSysString();
return GetSystemString((const wchar_t *)iconPathTemp);
break;
return (const wchar_t *)iconPathTemp;
}
}
return CSysString();
return UString();
}
LONG CSystemPage::OnApply()
@@ -189,7 +170,7 @@ LONG CSystemPage::OnApply()
{
UString title = extInfo.Ext + UString(L" Archive");
UString command = GetProgramCommand();
CSysString iconPath;
UString iconPath;
if (!extInfo.PluginsPairs.IsEmpty())
{
const CPluginInfo &plugin = _extDatabase.Plugins[extInfo.PluginsPairs[0].Index];
@@ -197,8 +178,8 @@ LONG CSystemPage::OnApply()
}
NRegistryAssociations::AddShellExtensionInfo(
GetSystemString(extInfo.Ext),
GetSystemString(title),
GetSystemString(command),
title,
command,
iconPath, NULL, 0);
}
else
@@ -210,7 +191,7 @@ LONG CSystemPage::OnApply()
else
NRegistryAssociations::DeleteContextMenuHandler();
*/
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
return PSNRET_NOERROR;
}
@@ -411,12 +392,12 @@ void CSystemPage::RefreshPluginsList(int selectIndex)
for (int i = 0; i < extInfo.PluginsPairs.Size(); i++)
{
CPluginEnabledPair pluginPair = extInfo.PluginsPairs[i];
CSysString pluginName = GetSystemString(_extDatabase.Plugins[pluginPair.Index].Name);
LVITEM item;
UString pluginName = _extDatabase.Plugins[pluginPair.Index].Name;
LVITEMW item;
item.iItem = i;
item.mask = LVIF_TEXT | LVIF_PARAM;
item.lParam = i;
item.pszText = (LPTSTR)(LPCTSTR)pluginName;
item.pszText = (LPWSTR)(LPCWSTR)pluginName;
item.iSubItem = 0;
int itemIndex = _listViewPlugins.InsertItem(&item);
_listViewPlugins.SetCheckState(itemIndex, pluginPair.Enabled);
@@ -434,9 +415,6 @@ void CSystemPage::RefreshPluginsList(int selectIndex)
/*
static LPCTSTR kZIPExtension = TEXT("zip");
static LPCTSTR kRARExtension = TEXT("rar");
static BYTE kZipShellNewData[] =
{ 0x50-1, 0x4B, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0 };

View File

@@ -12,6 +12,7 @@
#include "Windows/PropVariant.h"
#include "FSDrives.h"
#include "PhysDriveFolder.h"
#include "NetFolder.h"
#include "SysIconUtils.h"
#include "LangUtils.h"
@@ -29,8 +30,8 @@ static const STATPROPSTG kProperties[] =
void CRootFolder::Init()
{
_computerName = LangLoadStringW(IDS_COMPUTER, 0x03020300);
_networkName = LangLoadStringW(IDS_NETWORK, 0x03020301);
_computerName = LangString(IDS_COMPUTER, 0x03020300);
_networkName = LangString(IDS_NETWORK, 0x03020301);
};
STDMETHODIMP CRootFolder::LoadItems()
@@ -39,13 +40,13 @@ STDMETHODIMP CRootFolder::LoadItems()
return S_OK;
}
STDMETHODIMP CRootFolder::GetNumberOfItems(UINT32 *numItems)
STDMETHODIMP CRootFolder::GetNumberOfItems(UInt32 *numItems)
{
*numItems = 2;
return S_OK;
}
STDMETHODIMP CRootFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIANT *value)
STDMETHODIMP CRootFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant propVariant;
switch(propID)
@@ -56,7 +57,7 @@ STDMETHODIMP CRootFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIA
case kpidName:
if (itemIndex == 0)
propVariant = _computerName;
else
else if (itemIndex == 1)
propVariant = _networkName;
break;
}
@@ -64,7 +65,7 @@ STDMETHODIMP CRootFolder::GetProperty(UINT32 itemIndex, PROPID propID, PROPVARIA
return S_OK;
}
STDMETHODIMP CRootFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolder)
STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
if (index == 0)
{
@@ -73,13 +74,15 @@ STDMETHODIMP CRootFolder::BindToFolder(UINT32 index, IFolderFolder **resultFolde
fsDrivesSpec->Init();
*resultFolder = subFolder.Detach();
}
else
else if (index == 1)
{
CNetFolder *netFolderSpec = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
netFolderSpec->Init(0, 0, _networkName + L'\\');
*resultFolder = subFolder.Detach();
}
else
return E_INVALIDARG;
return S_OK;
}
@@ -98,10 +101,10 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
}
if (name2 == _computerName ||
name2 == (_computerName + UString(L'\\')))
return BindToFolder(UINT32(0), resultFolder);
return BindToFolder(UInt32(0), resultFolder);
if (name2 == _networkName ||
name2 == (_networkName + UString(L'\\')))
return BindToFolder(UINT32(1), resultFolder);
return BindToFolder(UInt32(1), resultFolder);
if (name2 == UString(L'\\'))
{
CMyComPtr<IFolderFolder> subFolder = this;
@@ -112,24 +115,34 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
if (name2.Length () < 2)
return E_INVALIDARG;
if (name2[name2.Length () - 1] != L'\\')
name2 += L'\\';
CFSFolder *fsFolderSpec = new CFSFolder;
CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
if (fsFolderSpec->Init(name2, 0) == S_OK)
CMyComPtr<IFolderFolder> subFolder;
if (name2.Left(4) == L"\\\\.\\")
{
*resultFolder = subFolder.Detach();
return S_OK;
CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
subFolder = folderSpec;
RINOK(folderSpec->Init(name2.Mid(4, 2)));
}
if (name2[0] == L'\\')
else
{
CNetFolder *netFolderSpec = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
netFolderSpec->Init(name2);
*resultFolder = subFolder.Detach();
return S_OK;
if (name2[name2.Length () - 1] != L'\\')
name2 += L'\\';
CFSFolder *fsFolderSpec = new CFSFolder;
subFolder = fsFolderSpec;
if (fsFolderSpec->Init(name2, 0) != S_OK)
{
if (name2[0] == L'\\')
{
CNetFolder *netFolderSpec = new CNetFolder;
subFolder = netFolderSpec;
netFolderSpec->Init(name2);
}
else
return E_INVALIDARG;
}
}
return E_INVALIDARG;
*resultFolder = subFolder.Detach();
return S_OK;
}
STDMETHODIMP CRootFolder::BindToParentFolder(IFolderFolder **resultFolder)
@@ -143,13 +156,13 @@ STDMETHODIMP CRootFolder::GetName(BSTR *name)
return E_NOTIMPL;
}
STDMETHODIMP CRootFolder::GetNumberOfProperties(UINT32 *numProperties)
STDMETHODIMP CRootFolder::GetNumberOfProperties(UInt32 *numProperties)
{
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
return S_OK;
}
STDMETHODIMP CRootFolder::GetPropertyInfo(UINT32 index,
STDMETHODIMP CRootFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -175,7 +188,7 @@ STDMETHODIMP CRootFolder::GetPath(BSTR *path)
return S_OK;
}
STDMETHODIMP CRootFolder::GetSystemIconIndex(UINT32 index, INT32 *iconIndex)
STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
{
int aCSIDL;
if (index == 0)

View File

@@ -26,19 +26,19 @@ public:
)
STDMETHOD(LoadItems)();
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder);
STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value);
STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder);
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder);
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder);
STDMETHOD(GetName)(BSTR *name);
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties);
STDMETHOD(GetPropertyInfo)(UINT32 index,
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType);
STDMETHOD(GetTypeID)(BSTR *name);
STDMETHOD(GetPath)(BSTR *path);
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex);
STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
void Init();
private:

View File

@@ -66,13 +66,3 @@ UString JoinStrings(const UStringVector &srcStrings)
return destString;
}
/*
void SplitString(const CSysString &srcString, CSysStringVector &destStrings)
{
destStrings.Clear();
UStringVector destStringsTemp;
SplitString(GetUnicodeString(srcString), destStringsTemp);
for (int i = 0; i < destStringsTemp.Size(); i++);
destStrings.Add(GetSysUnicodeString
}
*/

View File

@@ -7,6 +7,10 @@
#include "Common/StringConvert.h"
#endif
#ifndef _UNICODE
extern bool g_IsNT;
#endif
int GetIconIndexForCSIDL(int aCSIDL)
{
LPITEMIDLIST pidlMyComputer = 0;
@@ -39,39 +43,57 @@ DWORD_PTR GetRealIconIndex(LPCTSTR path, UINT32 attributes, int &iconIndex)
}
#ifndef _UNICODE
static inline UINT GetCurrentCodePage()
{ return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
// static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
{
SHFILEINFOW shellInfo;
DWORD_PTR res = ::SHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
if(g_IsNT)
{
SHFILEINFOW shellInfo;
DWORD_PTR res = ::SHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
if (res == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
return GetRealIconIndex(UnicodeStringToMultiByte(path, GetCurrentCodePage()), attributes, iconIndex);
iconIndex = shellInfo.iIcon;
return res;
iconIndex = shellInfo.iIcon;
return res;
}
else
return GetRealIconIndex(UnicodeStringToMultiByte(path), attributes, iconIndex);
}
#endif
DWORD_PTR GetRealIconIndex(const CSysString &fileName, UINT32 attributes,
int &iconIndex, CSysString &typeName)
DWORD_PTR GetRealIconIndex(const UString &fileName, UINT32 attributes,
int &iconIndex, UString &typeName)
{
SHFILEINFO shellInfo;
DWORD_PTR res = ::SHGetFileInfo(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
#ifndef _UNICODE
if(!g_IsNT)
{
SHFILEINFO shellInfo;
shellInfo.szTypeName[0] = 0;
DWORD_PTR res = ::SHGetFileInfoA(GetSystemString(fileName), FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
| SHGFI_TYPENAME);
typeName = shellInfo.szTypeName;
iconIndex = shellInfo.iIcon;
return res;
typeName = GetUnicodeString(shellInfo.szTypeName);
iconIndex = shellInfo.iIcon;
return res;
}
else
#endif
{
SHFILEINFOW shellInfo;
shellInfo.szTypeName[0] = 0;
DWORD_PTR res = ::SHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
| SHGFI_TYPENAME);
typeName = shellInfo.szTypeName;
iconIndex = shellInfo.iIcon;
return res;
}
}
int CExtToIconMap::GetIconIndex(UINT32 attributes, const CSysString &fileNameSpec,
CSysString &typeName)
int CExtToIconMap::GetIconIndex(UINT32 attributes, const UString &fileNameSpec, UString &typeName)
{
CSysString fileName = fileNameSpec;
UString fileName = fileNameSpec;
if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
fileName = TEXT("__Fldr__");
fileName = L"__Fldr__";
if (_dirIconIndex < 0)
GetRealIconIndex(fileName, attributes, _dirIconIndex, _dirTypeName);
typeName = _dirTypeName;
@@ -80,7 +102,7 @@ int CExtToIconMap::GetIconIndex(UINT32 attributes, const CSysString &fileNameSpe
int dotPos = fileName.ReverseFind('.');
if (dotPos < 0)
{
fileName = TEXT("__File__");
fileName = L"__File__";
if (_noExtIconIndex < 0)
{
int iconIndexTemp;
@@ -101,8 +123,8 @@ int CExtToIconMap::GetIconIndex(UINT32 attributes, const CSysString &fileNameSpe
return extIconPair.IconIndex;
}
int CExtToIconMap::GetIconIndex(UINT32 attributes, const CSysString &fileName)
int CExtToIconMap::GetIconIndex(UINT32 attributes, const UString &fileName)
{
CSysString typeName;
UString typeName;
return GetIconIndex(attributes, fileName, typeName);
}

View File

@@ -7,9 +7,9 @@
struct CExtIconPair
{
CSysString Ext;
UString Ext;
int IconIndex;
CSysString TypeName;
UString TypeName;
};
@@ -26,9 +26,9 @@ inline bool operator<(const CExtIconPair &a1, const CExtIconPair &a2)
class CExtToIconMap
{
int _dirIconIndex;
CSysString _dirTypeName;
UString _dirTypeName;
int _noExtIconIndex;
CSysString _noExtTypeName;
UString _noExtTypeName;
CObjectVector<CExtIconPair> _map;
public:
CExtToIconMap(): _dirIconIndex(-1), _noExtIconIndex(-1) {}
@@ -38,16 +38,14 @@ public:
_noExtIconIndex = -1;
_map.Clear();
}
int GetIconIndex(UINT32 attributes, const CSysString &fileName,
CSysString &typeName);
int GetIconIndex(UINT32 attributes, const CSysString &fileName);
int GetIconIndex(UINT32 attributes, const UString &fileName, UString &typeName);
int GetIconIndex(UINT32 attributes, const UString &fileName);
};
DWORD_PTR GetRealIconIndex(LPCTSTR path, UINT32 attributes, int &iconIndex);
#ifndef _UNICODE
// DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex);
DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex);
#endif
DWORD_PTR GetRealIconIndex(const CSysString &fileName, UINT32 attributes, int &iconIndex, CSysString &typeName);
int GetIconIndexForCSIDL(int aCSIDL);
#endif

View File

@@ -81,7 +81,7 @@ STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(INT32 *passwordIsDefi
CPasswordDialog dialog;
if (dialog.Create(_parentWindow) == IDCANCEL)
return E_ABORT;
_password = GetUnicodeString((LPCTSTR)dialog._password);
_password = dialog._password;
_passwordIsDefined = true;
*/
}

View File

@@ -3,6 +3,7 @@
#include "StdAfx.h"
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
#include "ViewSettings.h"
#include "Windows/Registry.h"
@@ -19,7 +20,7 @@ static const TCHAR *kPositionValueName = TEXT("Position");
static const TCHAR *kPanelsInfoValueName = TEXT("Panels");
static const TCHAR *kToolbars = TEXT("Toolbars");
static const TCHAR *kPanelPathValueName = TEXT("PanelPath");
static const WCHAR *kPanelPathValueName = L"PanelPath";
static const TCHAR *kListMode = TEXT("ListMode");
static const TCHAR *kFolderHistoryValueName = TEXT("FolderHistory");
static const TCHAR *kFastFoldersValueName = TEXT("FolderShortcuts");
@@ -106,7 +107,7 @@ public:
}
};
void SaveListViewInfo(const CSysString &id, const CListViewInfo &viewInfo)
void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo)
{
const CObjectVector<CColumnInfo> &columns = viewInfo.Columns;
CTempOutBufferSpec buffer;
@@ -130,11 +131,11 @@ void SaveListViewInfo(const CSysString &id, const CListViewInfo &viewInfo)
keyName += kCulumnsKeyName;
CKey key;
key.Create(HKEY_CURRENT_USER, keyName);
key.SetValue(id, (const Byte *)buffer, dataSize);
key.SetValue(GetSystemString(id), (const Byte *)buffer, dataSize);
}
}
void ReadListViewInfo(const CSysString &id, CListViewInfo &viewInfo)
void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo)
{
viewInfo.Clear();
CObjectVector<CColumnInfo> &columns = viewInfo.Columns;
@@ -148,7 +149,7 @@ void ReadListViewInfo(const CSysString &id, CListViewInfo &viewInfo)
CKey key;
if(key.Open(HKEY_CURRENT_USER, keyName, KEY_READ) != ERROR_SUCCESS)
return;
if (key.QueryValue(id, buffer, size) != ERROR_SUCCESS)
if (key.QueryValue(GetSystemString(id), buffer, size) != ERROR_SUCCESS)
return;
}
if (size < kColumnHeaderSize)
@@ -299,15 +300,15 @@ UInt32 ReadToolbarsMask()
}
static CSysString GetPanelPathName(UInt32 panelIndex)
static UString GetPanelPathName(UInt32 panelIndex)
{
TCHAR panelString[32];
WCHAR panelString[32];
ConvertUInt64ToString(panelIndex, panelString);
return CSysString(kPanelPathValueName) + panelString;
return UString(kPanelPathValueName) + panelString;
}
void SavePanelPath(UInt32 panel, const CSysString &path)
void SavePanelPath(UInt32 panel, const UString &path)
{
CKey key;
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
@@ -315,7 +316,7 @@ void SavePanelPath(UInt32 panel, const CSysString &path)
key.SetValue(GetPanelPathName(panel), path);
}
bool ReadPanelPath(UInt32 panel, CSysString &path)
bool ReadPanelPath(UInt32 panel, UString &path)
{
CKey key;
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);

View File

@@ -59,8 +59,8 @@ struct CListViewInfo
}
};
void SaveListViewInfo(const CSysString &anID, const CListViewInfo &viewInfo);
void ReadListViewInfo(const CSysString &anID, CListViewInfo &viewInfo);
void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo);
void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo);
void SaveWindowSize(const RECT &rect, bool maximized);
bool ReadWindowSize(RECT &rect, bool &maximized);
@@ -71,8 +71,8 @@ bool ReadPanelsInfo(UInt32 &numPanels, UInt32 &currentPanel, UInt32 &splitterPos
void SaveToolbarsMask(UInt32 toolbarMask);
UInt32 ReadToolbarsMask();
void SavePanelPath(UInt32 panel, const CSysString &path);
bool ReadPanelPath(UInt32 panel, CSysString &path);
void SavePanelPath(UInt32 panel, const UString &path);
bool ReadPanelPath(UInt32 panel, UString &path);
struct CListMode
{

View File

@@ -33,6 +33,7 @@ FM_OBJS = \
$O\PanelSelect.obj \
$O\PanelSort.obj \
$O\PanelSplitFile.obj \
$O\PhysDriveFolder.obj \
$O\ProgramLocation.obj \
$O\PropertyName.obj \
$O\RegistryAssociations.obj \
@@ -65,19 +66,24 @@ COMMON_OBJS = \
$O\Wildcard.obj \
WIN_OBJS = \
$O\CommonDialog.obj \
$O\DLL.obj \
$O\Error.obj \
$O\FileDevice.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\Memory.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\Net.obj \
$O\PropVariant.obj \
$O\PropVariantConversions.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Security.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\Window.obj \