summaryrefslogtreecommitdiffstats
path: root/src/libs/7zip/win/CPP/Windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/7zip/win/CPP/Windows')
-rw-r--r--src/libs/7zip/win/CPP/Windows/COM.cpp37
-rw-r--r--src/libs/7zip/win/CPP/Windows/COM.h69
-rw-r--r--src/libs/7zip/win/CPP/Windows/Clipboard.cpp135
-rw-r--r--src/libs/7zip/win/CPP/Windows/Clipboard.h28
-rw-r--r--src/libs/7zip/win/CPP/Windows/CommonDialog.cpp184
-rw-r--r--src/libs/7zip/win/CPP/Windows/CommonDialog.h19
-rw-r--r--src/libs/7zip/win/CPP/Windows/Console.cpp10
-rw-r--r--src/libs/7zip/win/CPP/Windows/Console.h52
-rw-r--r--src/libs/7zip/win/CPP/Windows/FileSystem.cpp126
-rw-r--r--src/libs/7zip/win/CPP/Windows/FileSystem.h51
-rw-r--r--src/libs/7zip/win/CPP/Windows/Memory.cpp36
-rw-r--r--src/libs/7zip/win/CPP/Windows/Memory.h53
-rw-r--r--src/libs/7zip/win/CPP/Windows/Menu.cpp191
-rw-r--r--src/libs/7zip/win/CPP/Windows/Menu.h153
-rw-r--r--src/libs/7zip/win/CPP/Windows/NationalTime.cpp37
-rw-r--r--src/libs/7zip/win/CPP/Windows/NationalTime.h20
-rw-r--r--src/libs/7zip/win/CPP/Windows/Net.cpp380
-rw-r--r--src/libs/7zip/win/CPP/Windows/Net.h87
-rw-r--r--src/libs/7zip/win/CPP/Windows/Process.cpp81
-rw-r--r--src/libs/7zip/win/CPP/Windows/Process.h100
-rw-r--r--src/libs/7zip/win/CPP/Windows/ProcessMessages.cpp22
-rw-r--r--src/libs/7zip/win/CPP/Windows/ProcessMessages.h14
-rw-r--r--src/libs/7zip/win/CPP/Windows/PropVariantUtils.cpp78
-rw-r--r--src/libs/7zip/win/CPP/Windows/PropVariantUtils.h28
-rw-r--r--src/libs/7zip/win/CPP/Windows/ResourceString.cpp64
-rw-r--r--src/libs/7zip/win/CPP/Windows/ResourceString.h22
-rw-r--r--src/libs/7zip/win/CPP/Windows/Security.cpp179
-rw-r--r--src/libs/7zip/win/CPP/Windows/Security.h167
-rw-r--r--src/libs/7zip/win/CPP/Windows/Shell.cpp335
-rw-r--r--src/libs/7zip/win/CPP/Windows/Shell.h93
-rw-r--r--src/libs/7zip/win/CPP/Windows/Window.cpp169
-rw-r--r--src/libs/7zip/win/CPP/Windows/Window.h261
32 files changed, 0 insertions, 3281 deletions
diff --git a/src/libs/7zip/win/CPP/Windows/COM.cpp b/src/libs/7zip/win/CPP/Windows/COM.cpp
deleted file mode 100644
index a746de12b..000000000
--- a/src/libs/7zip/win/CPP/Windows/COM.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Windows/COM.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/COM.h"
-#include "Common/StringConvert.h"
-
-namespace NWindows {
-namespace NCOM {
-
-// CoInitialize (NULL); must be called!
-
-UString GUIDToStringW(REFGUID guid)
-{
- UString string;
- const int kStringSize = 48;
- StringFromGUID2(guid, string.GetBuffer(kStringSize), kStringSize);
- string.ReleaseBuffer();
- return string;
-}
-
-AString GUIDToStringA(REFGUID guid)
-{
- return UnicodeStringToMultiByte(GUIDToStringW(guid));
-}
-
-HRESULT StringToGUIDW(const wchar_t *string, GUID &classID)
-{
- return CLSIDFromString((wchar_t *)string, &classID);
-}
-
-HRESULT StringToGUIDA(const char *string, GUID &classID)
-{
- return StringToGUIDW(MultiByteToUnicodeString(string), classID);
-}
-
-}}
diff --git a/src/libs/7zip/win/CPP/Windows/COM.h b/src/libs/7zip/win/CPP/Windows/COM.h
deleted file mode 100644
index 506bbbc64..000000000
--- a/src/libs/7zip/win/CPP/Windows/COM.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Windows/COM.h
-
-#ifndef __WINDOWS_COM_H
-#define __WINDOWS_COM_H
-
-#include "Common/MyString.h"
-
-namespace NWindows {
-namespace NCOM {
-
-#ifdef _WIN32
-
-class CComInitializer
-{
-public:
- CComInitializer()
- {
- #ifdef UNDER_CE
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
- #else
- // it's single thread. Do we need multithread?
- CoInitialize(NULL);
- #endif
- };
- ~CComInitializer() { CoUninitialize(); };
-};
-
-class CStgMedium
-{
- STGMEDIUM _object;
-public:
- bool _mustBeReleased;
- CStgMedium(): _mustBeReleased(false) {}
- ~CStgMedium() { Free(); }
- void Free()
- {
- if (_mustBeReleased)
- ReleaseStgMedium(&_object);
- _mustBeReleased = false;
- }
- const STGMEDIUM* operator->() const { return &_object;}
- STGMEDIUM* operator->() { return &_object;}
- STGMEDIUM* operator&() { return &_object; }
-};
-
-#endif
-
-//////////////////////////////////
-// GUID <--> String Conversions
-UString GUIDToStringW(REFGUID guid);
-AString GUIDToStringA(REFGUID guid);
-#ifdef UNICODE
- #define GUIDToString GUIDToStringW
-#else
- #define GUIDToString GUIDToStringA
-#endif
-
-HRESULT StringToGUIDW(const wchar_t *string, GUID &classID);
-HRESULT StringToGUIDA(const char *string, GUID &classID);
-#ifdef UNICODE
- #define StringToGUID StringToGUIDW
-#else
- #define StringToGUID StringToGUIDA
-#endif
-
-
-}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Clipboard.cpp b/src/libs/7zip/win/CPP/Windows/Clipboard.cpp
deleted file mode 100644
index e1ff62be2..000000000
--- a/src/libs/7zip/win/CPP/Windows/Clipboard.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// Windows/Clipboard.cpp
-
-#include "StdAfx.h"
-
-#ifdef UNDER_CE
-#include <winuserm.h>
-#endif
-
-#include "Windows/Clipboard.h"
-#include "Windows/Defs.h"
-#include "Windows/Memory.h"
-#include "Windows/Shell.h"
-#include "Windows/Memory.h"
-
-#include "Common/StringConvert.h"
-
-namespace NWindows {
-
-bool CClipboard::Open(HWND wndNewOwner)
-{
- m_Open = BOOLToBool(::OpenClipboard(wndNewOwner));
- return m_Open;
-}
-
-CClipboard::~CClipboard()
-{
- Close();
-}
-
-bool CClipboard::Close()
-{
- if (!m_Open)
- return true;
- m_Open = !BOOLToBool(CloseClipboard());
- return !m_Open;
-}
-
-bool ClipboardIsFormatAvailableHDROP()
-{
- return BOOLToBool(IsClipboardFormatAvailable(CF_HDROP));
-}
-
-/*
-bool ClipboardGetTextString(AString &s)
-{
- s.Empty();
- if (!IsClipboardFormatAvailable(CF_TEXT))
- return false;
- CClipboard clipboard;
-
- if (!clipboard.Open(NULL))
- return false;
-
- HGLOBAL h = ::GetClipboardData(CF_TEXT);
- if (h != NULL)
- {
- NMemory::CGlobalLock globalLock(h);
- const char *p = (const char *)globalLock.GetPointer();
- if (p != NULL)
- {
- s = p;
- return true;
- }
- }
- return false;
-}
-*/
-
-/*
-bool ClipboardGetFileNames(UStringVector &names)
-{
- names.Clear();
- if (!IsClipboardFormatAvailable(CF_HDROP))
- return false;
- CClipboard clipboard;
-
- if (!clipboard.Open(NULL))
- return false;
-
- HGLOBAL h = ::GetClipboardData(CF_HDROP);
- if (h != NULL)
- {
- NMemory::CGlobalLock globalLock(h);
- void *p = (void *)globalLock.GetPointer();
- if (p != NULL)
- {
- NShell::CDrop drop(false);
- drop.Attach((HDROP)p);
- drop.QueryFileNames(names);
- return true;
- }
- }
- return false;
-}
-*/
-
-static bool ClipboardSetData(UINT uFormat, const void *data, size_t size)
-{
- NMemory::CGlobal global;
- if (!global.Alloc(GMEM_DDESHARE | GMEM_MOVEABLE, size))
- return false;
- {
- NMemory::CGlobalLock globalLock(global);
- LPVOID p = globalLock.GetPointer();
- if (p == NULL)
- return false;
- memcpy(p, data, size);
- }
- if (::SetClipboardData(uFormat, global) == NULL)
- return false;
- global.Detach();
- return true;
-}
-
-bool ClipboardSetText(HWND owner, const UString &s)
-{
- CClipboard clipboard;
- if (!clipboard.Open(owner))
- return false;
- if (!::EmptyClipboard())
- return false;
-
- bool res;
- res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t));
- #ifndef _UNICODE
- AString a;
- a = UnicodeStringToMultiByte(s, CP_ACP);
- res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
- a = UnicodeStringToMultiByte(s, CP_OEMCP);
- res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
- #endif
- return res;
-}
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/Clipboard.h b/src/libs/7zip/win/CPP/Windows/Clipboard.h
deleted file mode 100644
index c80ba5ea7..000000000
--- a/src/libs/7zip/win/CPP/Windows/Clipboard.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Windows/Clipboard.h
-
-#ifndef __CLIPBOARD_H
-#define __CLIPBOARD_H
-
-#include "Common/MyString.h"
-
-namespace NWindows {
-
-class CClipboard
-{
- bool m_Open;
-public:
- CClipboard(): m_Open(false) {};
- ~CClipboard();
- bool Open(HWND wndNewOwner);
- bool Close();
-};
-
-bool ClipboardIsFormatAvailableHDROP();
-
-// bool ClipboardGetFileNames(UStringVector &names);
-// bool ClipboardGetTextString(AString &s);
-bool ClipboardSetText(HWND owner, const UString &s);
-
-}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/CommonDialog.cpp b/src/libs/7zip/win/CPP/Windows/CommonDialog.cpp
deleted file mode 100644
index 4ee7412d0..000000000
--- a/src/libs/7zip/win/CPP/Windows/CommonDialog.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-// Windows/CommonDialog.cpp
-
-#include "StdAfx.h"
-
-#ifdef UNDER_CE
-#include <commdlg.h>
-#endif
-
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-#include "Common/MyCom.h"
-
-#include "Windows/Defs.h"
-
-#include "CommonDialog.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows{
-
-#ifndef _UNICODE
-class CDoubleZeroStringListA
-{
- CRecordVector<int> m_Indexes;
- AString m_String;
-public:
- void Add(LPCSTR s);
- void SetForBuffer(LPSTR buffer);
-};
-
-void CDoubleZeroStringListA::Add(LPCSTR s)
-{
- m_String += s;
- m_Indexes.Add(m_String.Length());
- m_String += ' ';
-}
-
-void CDoubleZeroStringListA::SetForBuffer(LPSTR buffer)
-{
- MyStringCopy(buffer, (const char *)m_String);
- for (int i = 0; i < m_Indexes.Size(); i++)
- buffer[m_Indexes[i]] = '\0';
-}
-#endif
-
-class CDoubleZeroStringListW
-{
- CRecordVector<int> m_Indexes;
- UString m_String;
-public:
- void Add(LPCWSTR s);
- void SetForBuffer(LPWSTR buffer);
-};
-
-void CDoubleZeroStringListW::Add(LPCWSTR s)
-{
- m_String += s;
- m_Indexes.Add(m_String.Length());
- m_String += L' ';
-}
-
-void CDoubleZeroStringListW::SetForBuffer(LPWSTR buffer)
-{
- MyStringCopy(buffer, (const wchar_t *)m_String);
- for (int i = 0; i < m_Indexes.Size(); i++)
- buffer[m_Indexes[i]] = L'\0';
-}
-
-#define MY_OFN_PROJECT 0x00400000
-#define MY_OFN_SHOW_ALL 0x01000000
-
-bool MyGetOpenFileName(HWND hwnd, LPCWSTR title, LPCWSTR fullFileName,
- LPCWSTR s, UString &resPath
- #ifdef UNDER_CE
- , bool openFolder
- #endif
- )
-{
- const int kBufferSize = MAX_PATH * 2;
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- CHAR buffer[kBufferSize];
- MyStringCopy(buffer, (const char *)GetSystemString(fullFileName));
- OPENFILENAME info;
- info.lStructSize = sizeof(info);
- info.hwndOwner = hwnd;
- info.hInstance = 0;
- const int kFilterBufferSize = MAX_PATH;
- CHAR filterBuffer[kFilterBufferSize];
- CDoubleZeroStringListA doubleZeroStringList;
- doubleZeroStringList.Add(GetSystemString(s));
- doubleZeroStringList.Add("*.*");
- 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;
-
- info.lpstrTitle = 0;
- AString titleA;
- if (title != 0)
- {
- titleA = GetSystemString(title);
- info.lpstrTitle = titleA;
- }
-
- info.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
- info.nFileOffset = 0;
- info.nFileExtension = 0;
- info.lpstrDefExt = NULL;
-
- info.lCustData = 0;
- info.lpfnHook = NULL;
- info.lpTemplateName = NULL;
-
- bool res = BOOLToBool(::GetOpenFileNameA(&info));
- resPath = GetUnicodeString(buffer);
- return res;
- }
- else
- #endif
- {
- WCHAR buffer[kBufferSize];
- MyStringCopy(buffer, fullFileName);
- OPENFILENAMEW info;
- info.lStructSize = sizeof(info);
- info.hwndOwner = hwnd;
- info.hInstance = 0;
- const int kFilterBufferSize = MAX_PATH;
- WCHAR filterBuffer[kFilterBufferSize];
- CDoubleZeroStringListW doubleZeroStringList;
- doubleZeroStringList.Add(s);
- doubleZeroStringList.Add(L"*.*");
- 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;
-
- info.lpstrTitle = title;
-
- info.Flags = OFN_EXPLORER | OFN_HIDEREADONLY
- #ifdef UNDER_CE
- | (openFolder ? (MY_OFN_PROJECT | MY_OFN_SHOW_ALL) : 0)
- #endif
- ;
-
- info.nFileOffset = 0;
- info.nFileExtension = 0;
- info.lpstrDefExt = NULL;
-
- info.lCustData = 0;
- info.lpfnHook = NULL;
- info.lpTemplateName = NULL;
-
- bool res = BOOLToBool(::GetOpenFileNameW(&info));
- resPath = buffer;
- return res;
- }
-}
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/CommonDialog.h b/src/libs/7zip/win/CPP/Windows/CommonDialog.h
deleted file mode 100644
index f24bb5b24..000000000
--- a/src/libs/7zip/win/CPP/Windows/CommonDialog.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Windows/CommonDialog.h
-
-#ifndef __WINDOWS_COMMON_DIALOG_H
-#define __WINDOWS_COMMON_DIALOG_H
-
-#include "Common/MyString.h"
-
-namespace NWindows{
-
-bool MyGetOpenFileName(HWND hwnd, LPCWSTR title, LPCWSTR fullFileName,
- LPCWSTR s, UString &resPath
- #ifdef UNDER_CE
- , bool openFolder = false
- #endif
-);
-
-}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Console.cpp b/src/libs/7zip/win/CPP/Windows/Console.cpp
deleted file mode 100644
index 7773fee22..000000000
--- a/src/libs/7zip/win/CPP/Windows/Console.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Windows/Console.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/Console.h"
-
-namespace NWindows{
-namespace NConsole{
-
-}}
diff --git a/src/libs/7zip/win/CPP/Windows/Console.h b/src/libs/7zip/win/CPP/Windows/Console.h
deleted file mode 100644
index 99ae90f1a..000000000
--- a/src/libs/7zip/win/CPP/Windows/Console.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Windows/Console.h
-
-#ifndef __WINDOWS_CONSOLE_H
-#define __WINDOWS_CONSOLE_H
-
-#include "Windows/Defs.h"
-
-namespace NWindows{
-namespace NConsole{
-
-class CBase
-{
-protected:
- HANDLE m_Object;
-public:
- void Attach(HANDLE aHandle) { m_Object = aHandle; };
- bool GetMode(DWORD &aMode)
- { return BOOLToBool(::GetConsoleMode(m_Object, &aMode)); }
- bool SetMode(DWORD aMode)
- { return BOOLToBool(::SetConsoleMode(m_Object, aMode)); }
-};
-
-class CIn: public CBase
-{
-public:
- bool PeekEvents(PINPUT_RECORD anEvents, DWORD aNumEvents, DWORD &aNumEventsRead)
- { return BOOLToBool(::PeekConsoleInput(m_Object, anEvents, aNumEvents, &aNumEventsRead)); }
- bool PeekEvent(INPUT_RECORD &anEvent, DWORD &aNumEventsRead)
- { return PeekEvents(&anEvent, 1, aNumEventsRead); }
- bool ReadEvents(PINPUT_RECORD anEvents, DWORD aNumEvents, DWORD &aNumEventsRead)
- { return BOOLToBool(::ReadConsoleInput(m_Object, anEvents, aNumEvents, &aNumEventsRead)); }
- bool ReadEvent(INPUT_RECORD &anEvent, DWORD &aNumEventsRead)
- { return ReadEvents(&anEvent, 1, aNumEventsRead); }
- bool GetNumberOfEvents(DWORD &aNumberOfEvents)
- { return BOOLToBool(::GetNumberOfConsoleInputEvents(m_Object, &aNumberOfEvents)); }
-
- bool WriteEvents(const INPUT_RECORD *anEvents, DWORD aNumEvents, DWORD &aNumEventsWritten)
- { return BOOLToBool(::WriteConsoleInput(m_Object, anEvents, aNumEvents, &aNumEventsWritten)); }
- bool WriteEvent(const INPUT_RECORD &anEvent, DWORD &aNumEventsWritten)
- { return WriteEvents(&anEvent, 1, aNumEventsWritten); }
-
- bool Read(LPVOID aBuffer, DWORD aNumberOfCharsToRead, DWORD &aNumberOfCharsRead)
- { return BOOLToBool(::ReadConsole(m_Object, aBuffer, aNumberOfCharsToRead, &aNumberOfCharsRead, NULL)); }
-
- bool Flush()
- { return BOOLToBool(::FlushConsoleInputBuffer(m_Object)); }
-
-};
-
-}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/FileSystem.cpp b/src/libs/7zip/win/CPP/Windows/FileSystem.cpp
deleted file mode 100644
index 3ebfb7523..000000000
--- a/src/libs/7zip/win/CPP/Windows/FileSystem.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-// Windows/FileSystem.cpp
-
-#include "StdAfx.h"
-
-#include "FileSystem.h"
-#include "Defs.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NFile {
-namespace NSystem {
-
-bool MyGetVolumeInformation(
- LPCTSTR rootPathName,
- CSysString &volumeName,
- LPDWORD volumeSerialNumber,
- LPDWORD maximumComponentLength,
- LPDWORD fileSystemFlags,
- CSysString &fileSystemName)
-{
- bool result = BOOLToBool(GetVolumeInformation(
- rootPathName,
- volumeName.GetBuffer(MAX_PATH), MAX_PATH,
- volumeSerialNumber,
- maximumComponentLength,
- fileSystemFlags,
- fileSystemName.GetBuffer(MAX_PATH), MAX_PATH));
- volumeName.ReleaseBuffer();
- fileSystemName.ReleaseBuffer();
- return result;
-}
-
-
-#ifndef _UNICODE
-bool MyGetVolumeInformation(
- LPCWSTR rootPathName,
- UString &volumeName,
- LPDWORD volumeSerialNumber,
- LPDWORD maximumComponentLength,
- LPDWORD fileSystemFlags,
- UString &fileSystemName)
-{
- if (g_IsNT)
- {
- bool result = BOOLToBool(GetVolumeInformationW(
- rootPathName,
- volumeName.GetBuffer(MAX_PATH), MAX_PATH,
- volumeSerialNumber,
- maximumComponentLength,
- fileSystemFlags,
- fileSystemName.GetBuffer(MAX_PATH), MAX_PATH));
- volumeName.ReleaseBuffer();
- fileSystemName.ReleaseBuffer();
- return result;
- }
- AString volumeNameA, fileSystemNameA;
- bool result = MyGetVolumeInformation(GetSystemString(rootPathName), volumeNameA,
- volumeSerialNumber, maximumComponentLength, fileSystemFlags,fileSystemNameA);
- if (result)
- {
- volumeName = GetUnicodeString(volumeNameA);
- fileSystemName = GetUnicodeString(fileSystemNameA);
- }
- return result;
-}
-#endif
-
-typedef BOOL (WINAPI * GetDiskFreeSpaceExPointer)(
- LPCTSTR lpDirectoryName, // directory name
- PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
- PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
- PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk
-);
-
-bool MyGetDiskFreeSpace(LPCTSTR rootPathName,
- UInt64 &clusterSize, UInt64 &totalSize, UInt64 &freeSize)
-{
- GetDiskFreeSpaceExPointer pGetDiskFreeSpaceEx =
- (GetDiskFreeSpaceExPointer)GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")), "GetDiskFreeSpaceExA");
-
- bool sizeIsDetected = false;
- if (pGetDiskFreeSpaceEx)
- {
- ULARGE_INTEGER i64FreeBytesToCaller, totalSize2, freeSize2;
- sizeIsDetected = BOOLToBool(pGetDiskFreeSpaceEx(rootPathName,
- &i64FreeBytesToCaller,
- &totalSize2,
- &freeSize2));
- totalSize = totalSize2.QuadPart;
- freeSize = freeSize2.QuadPart;
- }
-
- DWORD numSectorsPerCluster;
- DWORD bytesPerSector;
- DWORD numberOfFreeClusters;
- DWORD totalNumberOfClusters;
-
- if (!::GetDiskFreeSpace(rootPathName,
- &numSectorsPerCluster,
- &bytesPerSector,
- &numberOfFreeClusters,
- &totalNumberOfClusters))
- return false;
-
- clusterSize = (UInt64)bytesPerSector * (UInt64)numSectorsPerCluster;
- if (!sizeIsDetected)
- {
- totalSize = clusterSize * (UInt64)totalNumberOfClusters;
- freeSize = clusterSize * (UInt64)numberOfFreeClusters;
- }
- return true;
-}
-
-#ifndef _UNICODE
-bool MyGetDiskFreeSpace(LPCWSTR rootPathName,
- UInt64 &clusterSize, UInt64 &totalSize, UInt64 &freeSize)
-{
- return MyGetDiskFreeSpace(GetSystemString(rootPathName), clusterSize, totalSize, freeSize);
-}
-#endif
-
-}}}
diff --git a/src/libs/7zip/win/CPP/Windows/FileSystem.h b/src/libs/7zip/win/CPP/Windows/FileSystem.h
deleted file mode 100644
index 727497bbd..000000000
--- a/src/libs/7zip/win/CPP/Windows/FileSystem.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Windows/FileSystem.h
-
-#ifndef __WINDOWS_FILESYSTEM_H
-#define __WINDOWS_FILESYSTEM_H
-
-#include "../Common/MyString.h"
-#include "../Common/Types.h"
-
-#ifndef _UNICODE
-#include "../Common/StringConvert.h"
-#endif
-
-namespace NWindows {
-namespace NFile {
-namespace NSystem {
-
-bool MyGetVolumeInformation(
- LPCTSTR rootPathName,
- CSysString &volumeName,
- LPDWORD volumeSerialNumber,
- LPDWORD maximumComponentLength,
- LPDWORD fileSystemFlags,
- CSysString &fileSystemName);
-
-#ifndef _UNICODE
-bool MyGetVolumeInformation(
- LPCWSTR rootPathName,
- UString &volumeName,
- LPDWORD volumeSerialNumber,
- LPDWORD maximumComponentLength,
- LPDWORD fileSystemFlags,
- UString &fileSystemName);
-#endif
-
-inline UINT MyGetDriveType(LPCTSTR pathName) { return GetDriveType(pathName); }
-#ifndef _UNICODE
-inline UINT MyGetDriveType(LPCWSTR pathName) { return GetDriveType(GetSystemString(pathName)); }
-#endif
-
-bool MyGetDiskFreeSpace(LPCTSTR rootPathName,
- UInt64 &clusterSize, UInt64 &totalSize, UInt64 &freeSize);
-
-#ifndef _UNICODE
-bool MyGetDiskFreeSpace(LPCWSTR rootPathName,
- UInt64 &clusterSize, UInt64 &totalSize, UInt64 &freeSize);
-#endif
-
-}}}
-
-#endif
-
diff --git a/src/libs/7zip/win/CPP/Windows/Memory.cpp b/src/libs/7zip/win/CPP/Windows/Memory.cpp
deleted file mode 100644
index 4c23205e1..000000000
--- a/src/libs/7zip/win/CPP/Windows/Memory.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Windows/Memory.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/Memory.h"
-
-namespace NWindows {
-namespace NMemory {
-
-bool CGlobal::Alloc(UINT flags, SIZE_T size)
-{
- HGLOBAL newBlock = ::GlobalAlloc(flags, size);
- if (newBlock == NULL)
- return false;
- m_MemoryHandle = newBlock;
- return true;
-}
-
-bool CGlobal::Free()
-{
- if (m_MemoryHandle == NULL)
- return true;
- m_MemoryHandle = ::GlobalFree(m_MemoryHandle);
- return (m_MemoryHandle == NULL);
-}
-
-bool CGlobal::ReAlloc(SIZE_T size)
-{
- HGLOBAL newBlock = ::GlobalReAlloc(m_MemoryHandle, size, GMEM_MOVEABLE);
- if (newBlock == NULL)
- return false;
- m_MemoryHandle = newBlock;
- return true;
-}
-
-}}
diff --git a/src/libs/7zip/win/CPP/Windows/Memory.h b/src/libs/7zip/win/CPP/Windows/Memory.h
deleted file mode 100644
index 1984baf6a..000000000
--- a/src/libs/7zip/win/CPP/Windows/Memory.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Windows/Memory.h
-
-#ifndef __WINDOWS_MEMORY_H
-#define __WINDOWS_MEMORY_H
-
-namespace NWindows {
-namespace NMemory {
-
-class CGlobal
-{
- HGLOBAL m_MemoryHandle;
-public:
- CGlobal(): m_MemoryHandle(NULL){};
- ~CGlobal() { Free(); }
- operator HGLOBAL() const { return m_MemoryHandle; };
- void Attach(HGLOBAL hGlobal)
- {
- Free();
- m_MemoryHandle = hGlobal;
- }
- HGLOBAL Detach()
- {
- HGLOBAL h = m_MemoryHandle;
- m_MemoryHandle = NULL;
- return h;
- }
- bool Alloc(UINT flags, SIZE_T size);
- bool Free();
- LPVOID Lock() const { return GlobalLock(m_MemoryHandle); }
- void Unlock() const { GlobalUnlock(m_MemoryHandle); }
- bool ReAlloc(SIZE_T size);
-};
-
-class CGlobalLock
-{
- HGLOBAL m_Global;
- LPVOID m_Pointer;
-public:
- LPVOID GetPointer() const { return m_Pointer; }
- CGlobalLock(HGLOBAL hGlobal): m_Global(hGlobal)
- {
- m_Pointer = GlobalLock(hGlobal);
- };
- ~CGlobalLock()
- {
- if (m_Pointer != NULL)
- GlobalUnlock(m_Global);
- }
-};
-
-}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Menu.cpp b/src/libs/7zip/win/CPP/Windows/Menu.cpp
deleted file mode 100644
index 675f86237..000000000
--- a/src/libs/7zip/win/CPP/Windows/Menu.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-// Windows/Menu.cpp
-
-#include "StdAfx.h"
-
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-#include "Windows/Menu.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-
-static void ConvertItemToSysForm(const CMenuItem &item, MENUITEMINFOW &si)
-{
- ZeroMemory(&si, sizeof(si));
- si.cbSize = sizeof(si);
- si.fMask = item.fMask;
- si.fType = item.fType;
- si.fState = item.fState;
- si.wID = item.wID;
- si.hSubMenu = item.hSubMenu;
- si.hbmpChecked = item.hbmpChecked;
- si.hbmpUnchecked = item.hbmpUnchecked;
- si.dwItemData = item.dwItemData;
-}
-
-#ifndef _UNICODE
-static void ConvertItemToSysForm(const CMenuItem &item, MENUITEMINFOA &si)
-{
- ZeroMemory(&si, sizeof(si));
- si.cbSize = sizeof(si);
- si.fMask = item.fMask;
- si.fType = item.fType;
- si.fState = item.fState;
- si.wID = item.wID;
- si.hSubMenu = item.hSubMenu;
- si.hbmpChecked = item.hbmpChecked;
- si.hbmpUnchecked = item.hbmpUnchecked;
- si.dwItemData = item.dwItemData;
-}
-#endif
-
-static void ConvertItemToMyForm(const MENUITEMINFOW &si, CMenuItem &item)
-{
- item.fMask = si.fMask;
- item.fType = si.fType;
- item.fState = si.fState;
- item.wID = si.wID;
- item.hSubMenu = si.hSubMenu;
- item.hbmpChecked = si.hbmpChecked;
- item.hbmpUnchecked = si.hbmpUnchecked;
- item.dwItemData = si.dwItemData;
-}
-
-#ifndef _UNICODE
-static void ConvertItemToMyForm(const MENUITEMINFOA &si, CMenuItem &item)
-{
- item.fMask = si.fMask;
- item.fType = si.fType;
- item.fState = si.fState;
- item.wID = si.wID;
- item.hSubMenu = si.hSubMenu;
- item.hbmpChecked = si.hbmpChecked;
- item.hbmpUnchecked = si.hbmpUnchecked;
- item.dwItemData = si.dwItemData;
-}
-#endif
-
-bool CMenu::GetItem(UINT itemIndex, bool byPosition, CMenuItem &item)
-{
- const UINT kMaxSize = 512;
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- CHAR s[kMaxSize + 1];
- MENUITEMINFOA si;
- ConvertItemToSysForm(item, si);
- if (item.IsString())
- {
- si.cch = kMaxSize;
- si.dwTypeData = s;
- }
- if (GetItemInfo(itemIndex, byPosition, &si))
- {
- ConvertItemToMyForm(si, item);
- if (item.IsString())
- item.StringValue = GetUnicodeString(s);
- return true;
- }
- }
- else
- #endif
- {
- wchar_t s[kMaxSize + 1];
- MENUITEMINFOW si;
- ConvertItemToSysForm(item, si);
- if (item.IsString())
- {
- si.cch = kMaxSize;
- si.dwTypeData = s;
- }
- if (GetItemInfo(itemIndex, byPosition, &si))
- {
- ConvertItemToMyForm(si, item);
- if (item.IsString())
- item.StringValue = s;
- return true;
- }
- }
- return false;
-}
-
-bool CMenu::SetItem(UINT itemIndex, bool byPosition, const CMenuItem &item)
-{
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- MENUITEMINFOA si;
- ConvertItemToSysForm(item, si);
- AString s;
- if (item.IsString())
- {
- s = GetSystemString(item.StringValue);
- si.dwTypeData = (LPTSTR)(LPCTSTR)s;
- }
- return SetItemInfo(itemIndex, byPosition, &si);
- }
- else
- #endif
- {
- MENUITEMINFOW si;
- ConvertItemToSysForm(item, si);
- if (item.IsString())
- si.dwTypeData = (LPWSTR)(LPCWSTR)item.StringValue;
- return SetItemInfo(itemIndex, byPosition, &si);
- }
-}
-
-bool CMenu::InsertItem(UINT itemIndex, bool byPosition, const CMenuItem &item)
-{
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- MENUITEMINFOA si;
- ConvertItemToSysForm(item, si);
- AString s;
- if (item.IsString())
- {
- s = GetSystemString(item.StringValue);
- si.dwTypeData = (LPTSTR)(LPCTSTR)s;
- }
- return InsertItem(itemIndex, byPosition, &si);
- }
- else
- #endif
- {
- MENUITEMINFOW si;
- ConvertItemToSysForm(item, si);
- if (item.IsString())
- si.dwTypeData = (LPWSTR)(LPCWSTR)item.StringValue;
- #ifdef UNDER_CE
- UINT flags = (item.fType & MFT_SEPARATOR) ? MF_SEPARATOR : MF_STRING;
- UINT id = item.wID;
- if ((item.fMask & MIIM_SUBMENU) != 0)
- {
- flags |= MF_POPUP;
- id = (UINT)item.hSubMenu;
- }
- if (!Insert(itemIndex, flags | (byPosition ? MF_BYPOSITION : MF_BYCOMMAND), id, item.StringValue))
- return false;
- return SetItemInfo(itemIndex, byPosition, &si);
- #else
- return InsertItem(itemIndex, byPosition, &si);
- #endif
- }
-}
-
-#ifndef _UNICODE
-bool CMenu::AppendItem(UINT flags, UINT_PTR newItemID, LPCWSTR newItem)
-{
- if (g_IsNT)
- return BOOLToBool(::AppendMenuW(_menu, flags, newItemID, newItem));
- else
- return AppendItem(flags, newItemID, GetSystemString(newItem));
-}
-#endif
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/Menu.h b/src/libs/7zip/win/CPP/Windows/Menu.h
deleted file mode 100644
index 2563b9117..000000000
--- a/src/libs/7zip/win/CPP/Windows/Menu.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// Windows/Menu.h
-
-#ifndef __WINDOWS_MENU_H
-#define __WINDOWS_MENU_H
-
-#include "Common/MyString.h"
-#include "Windows/Defs.h"
-
-namespace NWindows {
-
-struct CMenuItem
-{
- UString StringValue;
- UINT fMask;
- UINT fType;
- UINT fState;
- UINT wID;
- HMENU hSubMenu;
- HBITMAP hbmpChecked;
- HBITMAP hbmpUnchecked;
- ULONG_PTR dwItemData;
- // LPTSTR dwTypeData;
- // UINT cch;
- // HBITMAP hbmpItem;
- bool IsString() const // change it MIIM_STRING
- { return ((fMask & MIIM_TYPE) != 0 && (fType == MFT_STRING)); }
- bool IsSeparator() const { return (fType == MFT_SEPARATOR); }
- CMenuItem(): fMask(0), fType(0), fState(0), wID(0), hSubMenu(0), hbmpChecked(0),
- hbmpUnchecked(0), dwItemData(0) {}
-};
-
-class CMenu
-{
- HMENU _menu;
-public:
- CMenu(): _menu(NULL) {};
- operator HMENU() const { return _menu; }
- void Attach(HMENU menu) { _menu = menu; }
-
- HMENU Detach()
- {
- HMENU menu = _menu;
- _menu = NULL;
- return menu;
- }
-
- bool Create()
- {
- _menu = ::CreateMenu();
- return (_menu != NULL);
- }
-
- bool CreatePopup()
- {
- _menu = ::CreatePopupMenu();
- return (_menu != NULL);
- }
-
- bool Destroy()
- {
- if (_menu == NULL)
- return false;
- return BOOLToBool(::DestroyMenu(Detach()));
- }
-
- int GetItemCount()
- {
- #ifdef UNDER_CE
- for (int i = 0;; i++)
- {
- CMenuItem item;
- item.fMask = MIIM_STATE;
- if (!GetItem(i, true, item))
- return i;
- }
- #else
- return GetMenuItemCount(_menu);
- #endif
- }
-
- HMENU GetSubMenu(int pos) { return ::GetSubMenu(_menu, pos); }
- #ifndef UNDER_CE
- bool GetItemString(UINT idItem, UINT flag, CSysString &result)
- {
- result.Empty();
- int len = ::GetMenuString(_menu, idItem, 0, 0, flag);
- len = ::GetMenuString(_menu, idItem, result.GetBuffer(len + 2), len + 1, flag);
- result.ReleaseBuffer();
- return (len != 0);
- }
- UINT GetItemID(int pos) { return ::GetMenuItemID(_menu, pos); }
- UINT GetItemState(UINT id, UINT flags) { return ::GetMenuState(_menu, id, flags); }
- #endif
-
- bool GetItemInfo(UINT itemIndex, bool byPosition, LPMENUITEMINFO itemInfo)
- { return BOOLToBool(::GetMenuItemInfo(_menu, itemIndex, BoolToBOOL(byPosition), itemInfo)); }
- bool SetItemInfo(UINT itemIndex, bool byPosition, LPMENUITEMINFO itemInfo)
- { return BOOLToBool(::SetMenuItemInfo(_menu, itemIndex, BoolToBOOL(byPosition), itemInfo)); }
-
- bool AppendItem(UINT flags, UINT_PTR newItemID, LPCTSTR newItem)
- { return BOOLToBool(::AppendMenu(_menu, flags, newItemID, newItem)); }
-
- bool Insert(UINT position, UINT flags, UINT_PTR idNewItem, LPCTSTR newItem)
- { return BOOLToBool(::InsertMenu(_menu, position, flags, idNewItem, newItem)); }
-
- #ifndef UNDER_CE
- bool InsertItem(UINT itemIndex, bool byPosition, LPCMENUITEMINFO itemInfo)
- { return BOOLToBool(::InsertMenuItem(_menu, itemIndex, BoolToBOOL(byPosition), itemInfo)); }
- #endif
-
- bool RemoveItem(UINT item, UINT flags) { return BOOLToBool(::RemoveMenu(_menu, item, flags)); }
- void RemoveAllItemsFrom(UINT index) { while (RemoveItem(index, MF_BYPOSITION)); }
- void RemoveAllItems() { RemoveAllItemsFrom(0); }
-
- #ifndef _UNICODE
- bool GetItemInfo(UINT itemIndex, bool byPosition, LPMENUITEMINFOW itemInfo)
- { return BOOLToBool(::GetMenuItemInfoW(_menu, itemIndex, BoolToBOOL(byPosition), itemInfo)); }
- bool InsertItem(UINT itemIndex, bool byPosition, LPMENUITEMINFOW itemInfo)
- { return BOOLToBool(::InsertMenuItemW(_menu, itemIndex, BoolToBOOL(byPosition), itemInfo)); }
- bool SetItemInfo(UINT itemIndex, bool byPosition, LPMENUITEMINFOW itemInfo)
- { return BOOLToBool(::SetMenuItemInfoW(_menu, itemIndex, BoolToBOOL(byPosition), itemInfo)); }
- bool AppendItem(UINT flags, UINT_PTR newItemID, LPCWSTR newItem);
- #endif
-
- bool GetItem(UINT itemIndex, bool byPosition, CMenuItem &item);
- bool SetItem(UINT itemIndex, bool byPosition, const CMenuItem &item);
- bool InsertItem(UINT itemIndex, bool byPosition, const CMenuItem &item);
-
- int Track(UINT flags, int x, int y, HWND hWnd) { return ::TrackPopupMenuEx(_menu, flags, x, y, hWnd, NULL); }
-
- bool CheckRadioItem(UINT idFirst, UINT idLast, UINT idCheck, UINT flags)
- { return BOOLToBool(::CheckMenuRadioItem(_menu, idFirst, idLast, idCheck, flags)); }
-
- DWORD CheckItem(UINT id, UINT uCheck) { return ::CheckMenuItem(_menu, id, uCheck); }
- DWORD CheckItemByID(UINT id, bool check) { return CheckItem(id, MF_BYCOMMAND | (check ? MF_CHECKED : MF_UNCHECKED)); }
-
- BOOL EnableItem(UINT uIDEnableItem, UINT uEnable) { return EnableMenuItem(_menu, uIDEnableItem, uEnable); }
-};
-
-class CMenuDestroyer
-{
- CMenu *_menu;
-public:
- CMenuDestroyer(CMenu &menu): _menu(&menu) {}
- CMenuDestroyer(): _menu(0) {}
- ~CMenuDestroyer() { if (_menu) _menu->Destroy(); }
- void Attach(CMenu &menu) { _menu = &menu; }
- void Disable() { _menu = 0; }
-};
-
-}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/NationalTime.cpp b/src/libs/7zip/win/CPP/Windows/NationalTime.cpp
deleted file mode 100644
index c231d3ced..000000000
--- a/src/libs/7zip/win/CPP/Windows/NationalTime.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Windows/NationalTime.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/NationalTime.h"
-
-namespace NWindows {
-namespace NNational {
-namespace NTime {
-
-bool MyGetTimeFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
- LPCTSTR format, CSysString &resultString)
-{
- resultString.Empty();
- int numChars = ::GetTimeFormat(locale, flags, time, format, NULL, 0);
- if (numChars == 0)
- return false;
- numChars = ::GetTimeFormat(locale, flags, time, format,
- resultString.GetBuffer(numChars), numChars + 1);
- resultString.ReleaseBuffer();
- return (numChars != 0);
-}
-
-bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
- LPCTSTR format, CSysString &resultString)
-{
- resultString.Empty();
- int numChars = ::GetDateFormat(locale, flags, time, format, NULL, 0);
- if (numChars == 0)
- return false;
- numChars = ::GetDateFormat(locale, flags, time, format,
- resultString.GetBuffer(numChars), numChars + 1);
- resultString.ReleaseBuffer();
- return (numChars != 0);
-}
-
-}}}
diff --git a/src/libs/7zip/win/CPP/Windows/NationalTime.h b/src/libs/7zip/win/CPP/Windows/NationalTime.h
deleted file mode 100644
index 86e014bf9..000000000
--- a/src/libs/7zip/win/CPP/Windows/NationalTime.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Windows/NationalTime.h
-
-#ifndef __WINDOWS_NATIONALTIME_H
-#define __WINDOWS_NATIONALTIME_H
-
-#include "Common/String.h"
-
-namespace NWindows {
-namespace NNational {
-namespace NTime {
-
-bool MyGetTimeFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
- LPCTSTR format, CSysString &resultString);
-
-bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
- LPCTSTR format, CSysString &resultString);
-
-}}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Net.cpp b/src/libs/7zip/win/CPP/Windows/Net.cpp
deleted file mode 100644
index b0a18732a..000000000
--- a/src/libs/7zip/win/CPP/Windows/Net.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-// Windows/Net.cpp
-
-#include "StdAfx.h"
-
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-
-#include "Windows/Net.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NNet {
-
-DWORD CEnum::Open(DWORD scope, DWORD type, DWORD usage, LPNETRESOURCE netResource)
-{
- Close();
- DWORD result = ::WNetOpenEnum(scope, type, usage, netResource, &_handle);
- _handleAllocated = (result == NO_ERROR);
- return result;
-}
-
-#ifndef _UNICODE
-DWORD CEnum::Open(DWORD scope, DWORD type, DWORD usage, LPNETRESOURCEW netResource)
-{
- Close();
- DWORD result = ::WNetOpenEnumW(scope, type, usage, netResource, &_handle);
- _handleAllocated = (result == NO_ERROR);
- return result;
-}
-#endif
-
-static void SetComplexString(bool &defined, CSysString &destString, LPCTSTR srsString)
-{
- defined = (srsString != 0);
- if (defined)
- destString = srsString;
- else
- destString.Empty();
-}
-
-static void ConvertNETRESOURCEToCResource(const NETRESOURCE &netResource, CResource &resource)
-{
- resource.Scope = netResource.dwScope;
- resource.Type = netResource.dwType;
- resource.DisplayType = netResource.dwDisplayType;
- resource.Usage = netResource.dwUsage;
- SetComplexString(resource.LocalNameIsDefined, resource.LocalName, netResource.lpLocalName);
- SetComplexString(resource.RemoteNameIsDefined, resource.RemoteName, netResource.lpRemoteName);
- SetComplexString(resource.CommentIsDefined, resource.Comment, netResource.lpComment);
- SetComplexString(resource.ProviderIsDefined, resource.Provider, netResource.lpProvider);
-}
-
-static void SetComplexString2(LPTSTR *destString, bool defined, const CSysString &srcString)
-{
- if (defined)
- *destString = (TCHAR *)(const TCHAR *)srcString;
- else
- *destString = 0;
-}
-
-static void ConvertCResourceToNETRESOURCE(const CResource &resource, NETRESOURCE &netResource)
-{
- netResource.dwScope = resource.Scope;
- netResource.dwType = resource.Type;
- netResource.dwDisplayType = resource.DisplayType;
- netResource.dwUsage = resource.Usage;
- SetComplexString2(&netResource.lpLocalName, resource.LocalNameIsDefined, resource.LocalName);
- SetComplexString2(&netResource.lpRemoteName, resource.RemoteNameIsDefined, resource.RemoteName);
- SetComplexString2(&netResource.lpComment, resource.CommentIsDefined, resource.Comment);
- SetComplexString2(&netResource.lpProvider, resource.ProviderIsDefined, resource.Provider);
-}
-
-#ifndef _UNICODE
-
-static void SetComplexString(bool &defined, UString &destString, LPCWSTR srsString)
-{
- defined = (srsString != 0);
- if (defined)
- destString = srsString;
- else
- destString.Empty();
-}
-
-static void ConvertNETRESOURCEToCResource(const NETRESOURCEW &netResource, CResourceW &resource)
-{
- resource.Scope = netResource.dwScope;
- resource.Type = netResource.dwType;
- resource.DisplayType = netResource.dwDisplayType;
- resource.Usage = netResource.dwUsage;
- SetComplexString(resource.LocalNameIsDefined, resource.LocalName, netResource.lpLocalName);
- SetComplexString(resource.RemoteNameIsDefined, resource.RemoteName, netResource.lpRemoteName);
- SetComplexString(resource.CommentIsDefined, resource.Comment, netResource.lpComment);
- SetComplexString(resource.ProviderIsDefined, resource.Provider, netResource.lpProvider);
-}
-
-static void SetComplexString2(LPWSTR *destString, bool defined, const UString &srcString)
-{
- if (defined)
- *destString = (WCHAR *)(const WCHAR *)srcString;
- else
- *destString = 0;
-}
-
-static void ConvertCResourceToNETRESOURCE(const CResourceW &resource, NETRESOURCEW &netResource)
-{
- netResource.dwScope = resource.Scope;
- netResource.dwType = resource.Type;
- netResource.dwDisplayType = resource.DisplayType;
- netResource.dwUsage = resource.Usage;
- SetComplexString2(&netResource.lpLocalName, resource.LocalNameIsDefined, resource.LocalName);
- SetComplexString2(&netResource.lpRemoteName, resource.RemoteNameIsDefined, resource.RemoteName);
- SetComplexString2(&netResource.lpComment, resource.CommentIsDefined, resource.Comment);
- SetComplexString2(&netResource.lpProvider, resource.ProviderIsDefined, resource.Provider);
-}
-
-static void ConvertResourceWToResource(const CResourceW &resourceW, CResource &resource)
-{
- *(CResourceBase *)&resource = *(CResourceBase *)&resourceW;
- resource.LocalName = GetSystemString(resourceW.LocalName);
- resource.RemoteName = GetSystemString(resourceW.RemoteName);
- resource.Comment = GetSystemString(resourceW.Comment);
- resource.Provider = GetSystemString(resourceW.Provider);
-}
-
-static void ConvertResourceToResourceW(const CResource &resource, CResourceW &resourceW)
-{
- *(CResourceBase *)&resourceW = *(CResourceBase *)&resource;
- resourceW.LocalName = GetUnicodeString(resource.LocalName);
- resourceW.RemoteName = GetUnicodeString(resource.RemoteName);
- resourceW.Comment = GetUnicodeString(resource.Comment);
- resourceW.Provider = GetUnicodeString(resource.Provider);
-}
-#endif
-
-DWORD CEnum::Open(DWORD scope, DWORD type, DWORD usage, const CResource *resource)
-{
- NETRESOURCE netResource;
- LPNETRESOURCE pointer;
- if (resource == 0)
- pointer = 0;
- else
- {
- ConvertCResourceToNETRESOURCE(*resource, netResource);
- pointer = &netResource;
- }
- return Open(scope, type, usage, pointer);
-}
-
-#ifndef _UNICODE
-DWORD CEnum::Open(DWORD scope, DWORD type, DWORD usage, const CResourceW *resource)
-{
- if (g_IsNT)
- {
- NETRESOURCEW netResource;
- LPNETRESOURCEW pointer;
- if (resource == 0)
- pointer = 0;
- else
- {
- ConvertCResourceToNETRESOURCE(*resource, netResource);
- pointer = &netResource;
- }
- return Open(scope, type, usage, pointer);
- }
- CResource *pointer;
- CResource resourceA;
- if (resource == 0)
- pointer = 0;
- else
- {
- ConvertResourceWToResource(*resource, resourceA);
- pointer = &resourceA;
- }
- return Open(scope, type, usage, pointer);
-}
-#endif
-
-DWORD CEnum::Close()
-{
- if (!_handleAllocated)
- return NO_ERROR;
- DWORD result = ::WNetCloseEnum(_handle);
- _handleAllocated = (result != NO_ERROR);
- return result;
-}
-
-DWORD CEnum::Next(LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
-{
- return ::WNetEnumResource(_handle, lpcCount, lpBuffer, lpBufferSize);
-}
-
-#ifndef _UNICODE
-DWORD CEnum::NextW(LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
-{
- return ::WNetEnumResourceW(_handle, lpcCount, lpBuffer, lpBufferSize);
-}
-#endif
-
-DWORD CEnum::Next(CResource &resource)
-{
- CByteBuffer byteBuffer;
- const DWORD kBufferSize = 16384;
- byteBuffer.SetCapacity(kBufferSize);
- LPNETRESOURCE lpnrLocal = (LPNETRESOURCE) (BYTE *)(byteBuffer);
- ZeroMemory(lpnrLocal, kBufferSize);
- DWORD bufferSize = kBufferSize;
- DWORD numEntries = 1;
- DWORD result = Next(&numEntries, lpnrLocal, &bufferSize);
- if (result != NO_ERROR)
- return result;
- if (numEntries != 1)
- return (DWORD)E_FAIL;
- ConvertNETRESOURCEToCResource(lpnrLocal[0], resource);
- return result;
-}
-
-#ifndef _UNICODE
-DWORD CEnum::Next(CResourceW &resource)
-{
- if (g_IsNT)
- {
- CByteBuffer byteBuffer;
- const DWORD kBufferSize = 16384;
- byteBuffer.SetCapacity(kBufferSize);
- LPNETRESOURCEW lpnrLocal = (LPNETRESOURCEW) (BYTE *)(byteBuffer);
- ZeroMemory(lpnrLocal, kBufferSize);
- DWORD bufferSize = kBufferSize;
- DWORD numEntries = 1;
- DWORD result = NextW(&numEntries, lpnrLocal, &bufferSize);
- if (result != NO_ERROR)
- return result;
- if (numEntries != 1)
- return (DWORD)E_FAIL;
- ConvertNETRESOURCEToCResource(lpnrLocal[0], resource);
- return result;
- }
- CResource resourceA;
- DWORD result = Next(resourceA);
- ConvertResourceToResourceW(resourceA, resource);
- return result;
-}
-#endif
-
-
-DWORD GetResourceParent(const CResource &resource, CResource &parentResource)
-{
- CByteBuffer byteBuffer;
- const DWORD kBufferSize = 16384;
- byteBuffer.SetCapacity(kBufferSize);
- LPNETRESOURCE lpnrLocal = (LPNETRESOURCE) (BYTE *)(byteBuffer);
- ZeroMemory(lpnrLocal, kBufferSize);
- DWORD bufferSize = kBufferSize;
- NETRESOURCE netResource;
- ConvertCResourceToNETRESOURCE(resource, netResource);
- DWORD result = ::WNetGetResourceParent(&netResource, lpnrLocal, &bufferSize);
- if (result != NO_ERROR)
- return result;
- ConvertNETRESOURCEToCResource(lpnrLocal[0], parentResource);
- return result;
-}
-
-#ifndef _UNICODE
-DWORD GetResourceParent(const CResourceW &resource, CResourceW &parentResource)
-{
- if (g_IsNT)
- {
- CByteBuffer byteBuffer;
- const DWORD kBufferSize = 16384;
- byteBuffer.SetCapacity(kBufferSize);
- LPNETRESOURCEW lpnrLocal = (LPNETRESOURCEW) (BYTE *)(byteBuffer);
- ZeroMemory(lpnrLocal, kBufferSize);
- DWORD bufferSize = kBufferSize;
- NETRESOURCEW netResource;
- ConvertCResourceToNETRESOURCE(resource, netResource);
- DWORD result = ::WNetGetResourceParentW(&netResource, lpnrLocal, &bufferSize);
- if (result != NO_ERROR)
- return result;
- ConvertNETRESOURCEToCResource(lpnrLocal[0], parentResource);
- return result;
- }
- CResource resourceA, parentResourceA;
- ConvertResourceWToResource(resource, resourceA);
- DWORD result = GetResourceParent(resourceA, parentResourceA);
- ConvertResourceToResourceW(parentResourceA, parentResource);
- return result;
-}
-#endif
-
-DWORD GetResourceInformation(const CResource &resource,
- CResource &destResource, CSysString &systemPathPart)
-{
- CByteBuffer byteBuffer;
- const DWORD kBufferSize = 16384;
- byteBuffer.SetCapacity(kBufferSize);
- LPNETRESOURCE lpnrLocal = (LPNETRESOURCE) (BYTE *)(byteBuffer);
- ZeroMemory(lpnrLocal, kBufferSize);
- DWORD bufferSize = kBufferSize;
- NETRESOURCE netResource;
- ConvertCResourceToNETRESOURCE(resource, netResource);
- LPTSTR lplpSystem;
- DWORD result = ::WNetGetResourceInformation(&netResource,
- lpnrLocal, &bufferSize, &lplpSystem);
- if (result != NO_ERROR)
- return result;
- if (lplpSystem != 0)
- systemPathPart = lplpSystem;
- ConvertNETRESOURCEToCResource(lpnrLocal[0], destResource);
- return result;
-}
-
-#ifndef _UNICODE
-DWORD GetResourceInformation(const CResourceW &resource,
- CResourceW &destResource, UString &systemPathPart)
-{
- if (g_IsNT)
- {
- CByteBuffer byteBuffer;
- const DWORD kBufferSize = 16384;
- byteBuffer.SetCapacity(kBufferSize);
- LPNETRESOURCEW lpnrLocal = (LPNETRESOURCEW) (BYTE *)(byteBuffer);
- ZeroMemory(lpnrLocal, kBufferSize);
- DWORD bufferSize = kBufferSize;
- NETRESOURCEW netResource;
- ConvertCResourceToNETRESOURCE(resource, netResource);
- LPWSTR lplpSystem;
- DWORD result = ::WNetGetResourceInformationW(&netResource,
- lpnrLocal, &bufferSize, &lplpSystem);
- if (result != NO_ERROR)
- return result;
- if (lplpSystem != 0)
- systemPathPart = lplpSystem;
- ConvertNETRESOURCEToCResource(lpnrLocal[0], destResource);
- return result;
- }
- CResource resourceA, destResourceA;
- ConvertResourceWToResource(resource, resourceA);
- AString systemPathPartA;
- DWORD result = GetResourceInformation(resourceA, destResourceA, systemPathPartA);
- ConvertResourceToResourceW(destResourceA, destResource);
- systemPathPart = GetUnicodeString(systemPathPartA);
- return result;
-}
-#endif
-
-DWORD AddConnection2(const CResource &resource,
- LPCTSTR password, LPCTSTR userName, DWORD flags)
-{
- NETRESOURCE netResource;
- ConvertCResourceToNETRESOURCE(resource, netResource);
- return ::WNetAddConnection2(&netResource,
- password, userName, flags);
-}
-
-DWORD AddConnection2(const CResource &resource, LPCTSTR password, LPCTSTR userName, DWORD flags);
-
-#ifndef _UNICODE
-DWORD AddConnection2(const CResourceW &resource, LPCWSTR password, LPCWSTR userName, DWORD flags)
-{
- if (g_IsNT)
- {
- NETRESOURCEW netResource;
- ConvertCResourceToNETRESOURCE(resource, netResource);
- return ::WNetAddConnection2W(&netResource,password, userName, flags);
- }
- CResource resourceA;
- ConvertResourceWToResource(resource, resourceA);
- CSysString passwordA = GetSystemString(password);
- CSysString userNameA = GetSystemString(userName);
- return AddConnection2(resourceA,
- password ? (LPCTSTR)passwordA: 0,
- userName ? (LPCTSTR)userNameA: 0,
- flags);
-}
-#endif
-
-}}
diff --git a/src/libs/7zip/win/CPP/Windows/Net.h b/src/libs/7zip/win/CPP/Windows/Net.h
deleted file mode 100644
index c88b61130..000000000
--- a/src/libs/7zip/win/CPP/Windows/Net.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Windows/Net.h
-
-#ifndef __WINDOWS_NET_H
-#define __WINDOWS_NET_H
-
-#include "Common/Buffer.h"
-#include "Common/MyString.h"
-
-namespace NWindows {
-namespace NNet {
-
-struct CResourceBase
-{
- DWORD Scope;
- DWORD Type;
- DWORD DisplayType;
- DWORD Usage;
- bool LocalNameIsDefined;
- bool RemoteNameIsDefined;
- bool CommentIsDefined;
- bool ProviderIsDefined;
-};
-
-struct CResource: public CResourceBase
-{
- CSysString LocalName;
- CSysString RemoteName;
- CSysString Comment;
- CSysString Provider;
-};
-
-#ifdef _UNICODE
-typedef CResource CResourceW;
-#else
-struct CResourceW: public CResourceBase
-{
- UString LocalName;
- UString RemoteName;
- UString Comment;
- UString Provider;
-};
-#endif
-
-class CEnum
-{
- HANDLE _handle;
- bool _handleAllocated;
- DWORD Open(DWORD scope, DWORD type, DWORD usage, LPNETRESOURCE netResource);
- DWORD Next(LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize);
- #ifndef _UNICODE
- DWORD Open(DWORD scope, DWORD type, DWORD usage, LPNETRESOURCEW netResource);
- DWORD NextW(LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize);
- #endif
-protected:
- bool IsHandleAllocated() const { return _handleAllocated; }
-public:
- CEnum(): _handleAllocated(false) {}
- ~CEnum() { Close(); }
- DWORD Close();
- DWORD Open(DWORD scope, DWORD type, DWORD usage, const CResource *resource);
- DWORD Next(CResource &resource);
- #ifndef _UNICODE
- DWORD Open(DWORD scope, DWORD type, DWORD usage, const CResourceW *resource);
- DWORD Next(CResourceW &resource);
- #endif
-};
-
-DWORD GetResourceParent(const CResource &resource, CResource &parentResource);
-#ifndef _UNICODE
-DWORD GetResourceParent(const CResourceW &resource, CResourceW &parentResource);
-#endif
-
-DWORD GetResourceInformation(const CResource &resource,
- CResource &destResource, CSysString &systemPathPart);
-#ifndef _UNICODE
-DWORD GetResourceInformation(const CResourceW &resource,
- CResourceW &destResource, UString &systemPathPart);
-#endif
-
-DWORD AddConnection2(const CResource &resource, LPCTSTR password, LPCTSTR userName, DWORD flags);
-#ifndef _UNICODE
-DWORD AddConnection2(const CResourceW &resource, LPCWSTR password, LPCWSTR userName, DWORD flags);
-#endif
-
-}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Process.cpp b/src/libs/7zip/win/CPP/Windows/Process.cpp
deleted file mode 100644
index 9bcee7d5a..000000000
--- a/src/libs/7zip/win/CPP/Windows/Process.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// Process.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/StringConvert.h"
-
-#include "Process.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-
-static UString GetQuotedString(const UString &s)
-{
- return UString(L'\"') + s + UString(L'\"');
-}
-
-WRes CProcess::Create(LPCWSTR imageName, const UString &params, LPCWSTR curDir)
-{
- Close();
- const UString params2 =
- #ifndef UNDER_CE
- GetQuotedString(imageName) + L' ' +
- #endif
- params;
- #ifdef UNDER_CE
- curDir = 0;
- #else
- imageName = 0;
- #endif
- PROCESS_INFORMATION pi;
- BOOL result;
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- STARTUPINFOA si;
- si.cb = sizeof(si);
- si.lpReserved = 0;
- si.lpDesktop = 0;
- si.lpTitle = 0;
- si.dwFlags = 0;
- si.cbReserved2 = 0;
- si.lpReserved2 = 0;
-
- CSysString curDirA;
- if (curDir != 0)
- curDirA = GetSystemString(curDir);
- result = ::CreateProcessA(NULL, (LPSTR)(LPCSTR)GetSystemString(params2),
- NULL, NULL, FALSE, 0, NULL, ((curDir != 0) ? (LPCSTR)curDirA: 0), &si, &pi);
- }
- else
- #endif
- {
- STARTUPINFOW si;
- si.cb = sizeof(si);
- si.lpReserved = 0;
- si.lpDesktop = 0;
- si.lpTitle = 0;
- si.dwFlags = 0;
- si.cbReserved2 = 0;
- si.lpReserved2 = 0;
-
- result = CreateProcessW(imageName, (LPWSTR)(LPCWSTR)params2,
- NULL, NULL, FALSE, 0, NULL, (LPWSTR)curDir, &si, &pi);
- }
- if (result == 0)
- return ::GetLastError();
- ::CloseHandle(pi.hThread);
- _handle = pi.hProcess;
- return 0;
-}
-
-WRes MyCreateProcess(LPCWSTR imageName, const UString &params)
-{
- CProcess process;
- return process.Create(imageName, params, 0);
-}
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/Process.h b/src/libs/7zip/win/CPP/Windows/Process.h
deleted file mode 100644
index 5b01c377a..000000000
--- a/src/libs/7zip/win/CPP/Windows/Process.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Windows/Process.h
-
-#ifndef __WINDOWS_PROCESS_H
-#define __WINDOWS_PROCESS_H
-
-#include <psapi.h>
-
-#include "../Common/MyString.h"
-
-#include "Defs.h"
-#include "Handle.h"
-
-namespace NWindows {
-
-class CProcess: public CHandle
-{
-public:
- bool Open(DWORD desiredAccess, bool inheritHandle, DWORD processId)
- {
- _handle = ::OpenProcess(desiredAccess, inheritHandle, processId);
- return (_handle != 0);
- }
-
- #ifndef UNDER_CE
-
- bool GetExitCodeProcess(LPDWORD lpExitCode) { return BOOLToBool(::GetExitCodeProcess(_handle, lpExitCode)); }
- bool Terminate(UINT exitCode) { return BOOLToBool(::TerminateProcess(_handle, exitCode)); }
- #if(WINVER >= 0x0500)
- DWORD GetGuiResources (DWORD uiFlags) { return ::GetGuiResources(_handle, uiFlags); }
- #endif
- bool SetPriorityClass(DWORD dwPriorityClass) { return BOOLToBool(::SetPriorityClass(_handle, dwPriorityClass)); }
- DWORD GetPriorityClass() { return ::GetPriorityClass(_handle); }
- bool GetIoCounters(PIO_COUNTERS lpIoCounters ) { return BOOLToBool(::GetProcessIoCounters(_handle, lpIoCounters )); }
-
- bool GetTimes(LPFILETIME creationTime, LPFILETIME exitTime, LPFILETIME kernelTime, LPFILETIME userTime)
- { return BOOLToBool(::GetProcessTimes(_handle, creationTime, exitTime, kernelTime, userTime)); }
-
- DWORD WaitForInputIdle(DWORD milliseconds) { return ::WaitForInputIdle(_handle, milliseconds); }
-
- // Debug
-
- bool ReadMemory(LPCVOID baseAddress, LPVOID buffer, SIZE_T size, SIZE_T* numberOfBytesRead)
- { return BOOLToBool(::ReadProcessMemory(_handle, baseAddress, buffer, size, numberOfBytesRead)); }
-
- bool WriteMemory(LPVOID baseAddress, LPCVOID buffer, SIZE_T size, SIZE_T* numberOfBytesWritten)
- { return BOOLToBool(::WriteProcessMemory(_handle, baseAddress, buffer, size, numberOfBytesWritten)); }
-
- bool FlushInstructionCache(LPCVOID baseAddress = 0, SIZE_T size = 0)
- { return BOOLToBool(::FlushInstructionCache(_handle, baseAddress, size)); }
-
- LPVOID VirtualAlloc(LPVOID address, SIZE_T size, DWORD allocationType, DWORD protect)
- { return VirtualAllocEx(_handle, address, size, allocationType, protect); }
-
- bool VirtualFree(LPVOID address, SIZE_T size, DWORD freeType)
- { return BOOLToBool(::VirtualFreeEx(_handle, address, size, freeType)); }
-
- // Process Status API (PSAPI)
-
- bool EmptyWorkingSet()
- { return BOOLToBool(::EmptyWorkingSet(_handle)); }
- bool EnumModules(HMODULE *hModules, DWORD arraySizeInBytes, LPDWORD receivedBytes)
- { return BOOLToBool(::EnumProcessModules(_handle, hModules, arraySizeInBytes, receivedBytes)); }
-
- DWORD MyGetModuleBaseName(HMODULE hModule, LPTSTR baseName, DWORD size)
- { return ::GetModuleBaseName(_handle, hModule, baseName, size); }
- bool MyGetModuleBaseName(HMODULE hModule, CSysString &name)
- {
- const int length = 1000;
- DWORD resultLen = MyGetModuleBaseName(hModule, name.GetBuffer(length), length);
- name.ReleaseBuffer();
- return (resultLen != 0);
- }
-
- DWORD MyGetModuleFileNameEx(HMODULE hModule, LPTSTR baseName, DWORD size)
- { return ::GetModuleFileNameEx(_handle, hModule, baseName, size); }
- bool MyGetModuleFileNameEx(HMODULE hModule, CSysString &name)
- {
- const int length = MAX_PATH + 100;
- DWORD resultLen = MyGetModuleFileNameEx(hModule, name.GetBuffer(length), length);
- name.ReleaseBuffer();
- return (resultLen != 0);
- }
-
- bool GetModuleInformation(HMODULE hModule, LPMODULEINFO moduleInfo)
- { return BOOLToBool(::GetModuleInformation(_handle, hModule, moduleInfo, sizeof(MODULEINFO))); }
- bool GetMemoryInfo(PPROCESS_MEMORY_COUNTERS memCounters)
- { return BOOLToBool(::GetProcessMemoryInfo(_handle, memCounters, sizeof(PROCESS_MEMORY_COUNTERS))); }
-
- #endif
-
- WRes Create(LPCWSTR imageName, const UString &params, LPCWSTR curDir);
-
- DWORD Wait() { return ::WaitForSingleObject(_handle, INFINITE); }
-};
-
-WRes MyCreateProcess(LPCWSTR imageName, const UString &params);
-
-}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/ProcessMessages.cpp b/src/libs/7zip/win/CPP/Windows/ProcessMessages.cpp
deleted file mode 100644
index 0f48aee25..000000000
--- a/src/libs/7zip/win/CPP/Windows/ProcessMessages.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Windows/ProcessMessages.cpp
-
-#include "StdAfx.h"
-
-#include "ProcessMessages.h"
-
-namespace NWindows {
-
-void ProcessMessages(HWND window)
-{
- MSG msg;
- while (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
- {
- if (window == (HWND) NULL || !IsDialogMessage(window, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
-}
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/ProcessMessages.h b/src/libs/7zip/win/CPP/Windows/ProcessMessages.h
deleted file mode 100644
index 63f8ec8a0..000000000
--- a/src/libs/7zip/win/CPP/Windows/ProcessMessages.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Windows/ProcessMessages.h
-
-#ifndef __WINDOWS_PROCESSMESSAGES_H
-#define __WINDOWS_PROCESSMESSAGES_H
-
-namespace NWindows {
-
-void ProcessMessages(HWND window);
-
-}
-
-#endif
-
-
diff --git a/src/libs/7zip/win/CPP/Windows/PropVariantUtils.cpp b/src/libs/7zip/win/CPP/Windows/PropVariantUtils.cpp
deleted file mode 100644
index 0a9cfab7f..000000000
--- a/src/libs/7zip/win/CPP/Windows/PropVariantUtils.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// PropVariantUtils.cpp
-
-#include "StdAfx.h"
-
-#include "PropVariantUtils.h"
-#include "Common/StringConvert.h"
-#include "Common/IntToString.h"
-
-using namespace NWindows;
-
-static AString GetHex(UInt32 v)
-{
- char sz[32] = { '0', 'x' };
- ConvertUInt64ToString(v, sz + 2, 16);
- return sz;
-}
-
-void StringToProp(const AString &s, NCOM::CPropVariant &prop)
-{
- prop = MultiByteToUnicodeString(s);
-}
-
-void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NCOM::CPropVariant &prop)
-{
- AString s;
- for (unsigned i = 0; i < num; i++)
- {
- const CUInt32PCharPair &p = pairs[i];
- if (p.Value == value)
- s = p.Name;
- }
- if (s.IsEmpty())
- s = GetHex(value);
- StringToProp(s, prop);
-}
-
-AString TypeToString(const char *table[], unsigned num, UInt32 value)
-{
- if (value < num)
- return table[value];
- return GetHex(value);
-}
-
-void TypeToProp(const char *table[], unsigned num, UInt32 value, NCOM::CPropVariant &prop)
-{
- StringToProp(TypeToString(table, num, value), prop);
-}
-
-
-AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags)
-{
- AString s;
- for (unsigned i = 0; i < num; i++)
- {
- const CUInt32PCharPair &p = pairs[i];
- UInt32 flag = (UInt32)1 << (unsigned)p.Value;
- if ((flags & flag) != 0)
- {
- if (!s.IsEmpty())
- s += ' ';
- s += p.Name;
- }
- flags &= ~flag;
- }
- if (flags != 0)
- {
- if (!s.IsEmpty())
- s += ' ';
- s += GetHex(flags);
- }
- return s;
-}
-
-void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NCOM::CPropVariant &prop)
-{
- StringToProp(FlagsToString(pairs, num, flags), prop);
-}
-
diff --git a/src/libs/7zip/win/CPP/Windows/PropVariantUtils.h b/src/libs/7zip/win/CPP/Windows/PropVariantUtils.h
deleted file mode 100644
index 5aaf65cb9..000000000
--- a/src/libs/7zip/win/CPP/Windows/PropVariantUtils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Windows/PropVariantUtils.h
-
-#ifndef __PROP_VARIANT_UTILS_H
-#define __PROP_VARIANT_UTILS_H
-
-#include "Common/MyString.h"
-#include "PropVariant.h"
-
-struct CUInt32PCharPair
-{
- UInt32 Value;
- const char *Name;
-};
-
-void StringToProp(const AString &s, NWindows::NCOM::CPropVariant &prop);
-void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop);
-
-AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags);
-void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NWindows::NCOM::CPropVariant &prop);
-
-AString TypeToString(const char *table[], unsigned num, UInt32 value);
-void TypeToProp(const char *table[], unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop);
-
-#define PAIR_TO_PROP(pairs, value, prop) PairToProp(pairs, sizeof(pairs) / sizeof(pairs[0]), value, prop)
-#define FLAGS_TO_PROP(pairs, value, prop) FlagsToProp(pairs, sizeof(pairs) / sizeof(pairs[0]), value, prop)
-#define TYPE_TO_PROP(table, value, prop) TypeToProp(table, sizeof(table) / sizeof(table[0]), value, prop)
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/ResourceString.cpp b/src/libs/7zip/win/CPP/Windows/ResourceString.cpp
deleted file mode 100644
index 781f03b33..000000000
--- a/src/libs/7zip/win/CPP/Windows/ResourceString.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Windows/ResourceString.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/ResourceString.h"
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-
-extern HINSTANCE g_hInstance;
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-
-CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID)
-{
- CSysString s;
- int size = 256;
- int len;
- do
- {
- size += 256;
- len = ::LoadString(hInstance, resourceID, s.GetBuffer(size - 1), size);
- }
- while (size - len <= 1);
- s.ReleaseBuffer();
- return s;
-}
-
-CSysString MyLoadString(UINT resourceID)
-{
- return MyLoadString(g_hInstance, resourceID);
-}
-
-#ifndef _UNICODE
-UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID)
-{
- if (g_IsNT)
- {
- UString s;
- int size = 256;
- int len;
- do
- {
- size += 256;
- len = ::LoadStringW(hInstance, resourceID, s.GetBuffer(size - 1), size);
- }
- while (size - len <= 1);
- s.ReleaseBuffer();
- return s;
- }
- return GetUnicodeString(MyLoadString(hInstance, resourceID));
-}
-
-UString MyLoadStringW(UINT resourceID)
-{
- return MyLoadStringW(g_hInstance, resourceID);
-}
-
-#endif
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/ResourceString.h b/src/libs/7zip/win/CPP/Windows/ResourceString.h
deleted file mode 100644
index ac9c5cd5d..000000000
--- a/src/libs/7zip/win/CPP/Windows/ResourceString.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Windows/ResourceString.h
-
-#ifndef __WINDOWS_RESOURCESTRING_H
-#define __WINDOWS_RESOURCESTRING_H
-
-#include "Common/MyString.h"
-
-namespace NWindows {
-
-CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID);
-CSysString MyLoadString(UINT resourceID);
-#ifdef _UNICODE
-inline UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID) { return MyLoadString(hInstance, resourceID); }
-inline UString MyLoadStringW(UINT resourceID) { return MyLoadString(resourceID); }
-#else
-UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID);
-UString MyLoadStringW(UINT resourceID);
-#endif
-
-}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Security.cpp b/src/libs/7zip/win/CPP/Windows/Security.cpp
deleted file mode 100644
index 6f5bcad35..000000000
--- a/src/libs/7zip/win/CPP/Windows/Security.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-// Windows/Security.cpp
-
-#include "StdAfx.h"
-
-#include "Security.h"
-
-namespace NWindows {
-namespace NSecurity {
-
-/*
-bool MyLookupAccountSid(LPCTSTR systemName, PSID sid,
- CSysString &accountName, CSysString &domainName, PSID_NAME_USE sidNameUse)
-{
- DWORD accountNameSize = 0, domainNameSize = 0;
-
- if (!::LookupAccountSid(systemName, sid,
- accountName.GetBuffer(0), &accountNameSize,
- domainName.GetBuffer(0), &domainNameSize, sidNameUse))
- {
- if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER)
- return false;
- }
- bool result = BOOLToBool(::LookupAccountSid(systemName, sid,
- accountName.GetBuffer(accountNameSize), &accountNameSize,
- domainName.GetBuffer(domainNameSize), &domainNameSize, sidNameUse));
- accountName.ReleaseBuffer();
- domainName.ReleaseBuffer();
- return result;
-}
-*/
-
-static void SetLsaString(LPWSTR src, PLSA_UNICODE_STRING dest)
-{
- int len = (int)wcslen(src);
- dest->Length = (USHORT)(len * sizeof(WCHAR));
- dest->MaximumLength = (USHORT)((len + 1) * sizeof(WCHAR));
- dest->Buffer = src;
-}
-
-/*
-static void MyLookupSids(CPolicy &policy, PSID ps)
-{
- LSA_REFERENCED_DOMAIN_LIST *referencedDomains = NULL;
- LSA_TRANSLATED_NAME *names = NULL;
- NTSTATUS nts = policy.LookupSids(1, &ps, &referencedDomains, &names);
- int res = LsaNtStatusToWinError(nts);
- LsaFreeMemory(referencedDomains);
- LsaFreeMemory(names);
-}
-*/
-
-#ifndef _UNICODE
-typedef BOOL (WINAPI * LookupAccountNameWP)(
- LPCWSTR lpSystemName,
- LPCWSTR lpAccountName,
- PSID Sid,
- LPDWORD cbSid,
- LPWSTR ReferencedDomainName,
- LPDWORD cchReferencedDomainName,
- PSID_NAME_USE peUse
- );
-#endif
-
-static PSID GetSid(LPWSTR accountName)
-{
- #ifndef _UNICODE
- HMODULE hModule = GetModuleHandle(TEXT("Advapi32.dll"));
- if (hModule == NULL)
- return NULL;
- LookupAccountNameWP lookupAccountNameW = (LookupAccountNameWP)GetProcAddress(hModule, "LookupAccountNameW");
- if (lookupAccountNameW == NULL)
- return NULL;
- #endif
-
- DWORD sidLen = 0, domainLen = 0;
- SID_NAME_USE sidNameUse;
- if (!
- #ifdef _UNICODE
- ::LookupAccountNameW
- #else
- lookupAccountNameW
- #endif
- (NULL, accountName, NULL, &sidLen, NULL, &domainLen, &sidNameUse))
- {
- if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER)
- {
- PSID pSid = ::HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sidLen);
- LPWSTR domainName = (LPWSTR)::HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (domainLen + 1) * sizeof(WCHAR));
- BOOL res =
- #ifdef _UNICODE
- ::LookupAccountNameW
- #else
- lookupAccountNameW
- #endif
- (NULL, accountName, pSid, &sidLen, domainName, &domainLen, &sidNameUse);
- ::HeapFree(GetProcessHeap(), 0, domainName);
- if (res)
- return pSid;
- }
- }
- return NULL;
-}
-
-#define MY__SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege"
-
-bool AddLockMemoryPrivilege()
-{
- CPolicy policy;
- LSA_OBJECT_ATTRIBUTES attr;
- attr.Length = sizeof(attr);
- attr.RootDirectory = NULL;
- attr.ObjectName = NULL;
- attr.Attributes = 0;
- attr.SecurityDescriptor = NULL;
- attr.SecurityQualityOfService = NULL;
- if (policy.Open(NULL, &attr,
- // GENERIC_WRITE)
- POLICY_ALL_ACCESS)
- // STANDARD_RIGHTS_REQUIRED,
- // GENERIC_READ | GENERIC_EXECUTE | POLICY_VIEW_LOCAL_INFORMATION | POLICY_LOOKUP_NAMES)
- != 0)
- return false;
- LSA_UNICODE_STRING userRights;
- wchar_t s[128] = MY__SE_LOCK_MEMORY_NAME;
- SetLsaString(s, &userRights);
- WCHAR userName[256 + 2];
- DWORD size = 256;
- if (!GetUserNameW(userName, &size))
- return false;
- PSID psid = GetSid(userName);
- if (psid == NULL)
- return false;
- bool res = false;
-
- /*
- PLSA_UNICODE_STRING userRightsArray;
- ULONG countOfRights;
- NTSTATUS status = policy.EnumerateAccountRights(psid, &userRightsArray, &countOfRights);
- if (status != 0)
- return false;
- bool finded = false;
- for (ULONG i = 0; i < countOfRights; i++)
- {
- LSA_UNICODE_STRING &ur = userRightsArray[i];
- if (ur.Length != s.Length() * sizeof(WCHAR))
- continue;
- if (wcsncmp(ur.Buffer, s, s.Length()) != 0)
- continue;
- finded = true;
- res = true;
- break;
- }
- if (!finded)
- */
- {
- /*
- LSA_ENUMERATION_INFORMATION *enums;
- ULONG countReturned;
- NTSTATUS status = policy.EnumerateAccountsWithUserRight(&userRights, &enums, &countReturned);
- if (status == 0)
- {
- for (ULONG i = 0; i < countReturned; i++)
- MyLookupSids(policy, enums[i].Sid);
- if (enums)
- ::LsaFreeMemory(enums);
- res = true;
- }
- */
- NTSTATUS status = policy.AddAccountRights(psid, &userRights);
- if (status == 0)
- res = true;
- // ULONG res = LsaNtStatusToWinError(status);
- }
- HeapFree(GetProcessHeap(), 0, psid);
- return res;
-}
-
-}}
-
diff --git a/src/libs/7zip/win/CPP/Windows/Security.h b/src/libs/7zip/win/CPP/Windows/Security.h
deleted file mode 100644
index ba66de445..000000000
--- a/src/libs/7zip/win/CPP/Windows/Security.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Windows/Security.h
-
-#ifndef __WINDOWS_SECURITY_H
-#define __WINDOWS_SECURITY_H
-
-#include <NTSecAPI.h>
-
-#include "Defs.h"
-
-namespace NWindows {
-namespace NSecurity {
-
-class CAccessToken
-{
- HANDLE _handle;
-public:
- CAccessToken(): _handle(NULL) {};
- ~CAccessToken() { Close(); }
- bool Close()
- {
- if (_handle == NULL)
- return true;
- bool res = BOOLToBool(::CloseHandle(_handle));
- if (res)
- _handle = NULL;
- return res;
- }
-
- bool OpenProcessToken(HANDLE processHandle, DWORD desiredAccess)
- {
- Close();
- return BOOLToBool(::OpenProcessToken(processHandle, desiredAccess, &_handle));
- }
-
- /*
- bool OpenThreadToken(HANDLE threadHandle, DWORD desiredAccess, bool openAsSelf)
- {
- Close();
- return BOOLToBool(::OpenTreadToken(threadHandle, desiredAccess, BoolToBOOL(anOpenAsSelf), &_handle));
- }
- */
-
- bool AdjustPrivileges(bool disableAllPrivileges, PTOKEN_PRIVILEGES newState,
- DWORD bufferLength, PTOKEN_PRIVILEGES previousState, PDWORD returnLength)
- { return BOOLToBool(::AdjustTokenPrivileges(_handle, BoolToBOOL(disableAllPrivileges),
- newState, bufferLength, previousState, returnLength)); }
-
- bool AdjustPrivileges(bool disableAllPrivileges, PTOKEN_PRIVILEGES newState)
- { return AdjustPrivileges(disableAllPrivileges, newState, 0, NULL, NULL); }
-
- bool AdjustPrivileges(PTOKEN_PRIVILEGES newState)
- { return AdjustPrivileges(false, newState); }
-
-};
-
-#ifndef _UNICODE
-typedef NTSTATUS (NTAPI *LsaOpenPolicyP)(PLSA_UNICODE_STRING SystemName,
- PLSA_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, PLSA_HANDLE PolicyHandle);
-typedef NTSTATUS (NTAPI *LsaCloseP)(LSA_HANDLE ObjectHandle);
-typedef NTSTATUS (NTAPI *LsaAddAccountRightsP)(LSA_HANDLE PolicyHandle,
- PSID AccountSid, PLSA_UNICODE_STRING UserRights, ULONG CountOfRights );
-#define MY_STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002L)
-#endif
-
-struct CPolicy
-{
-protected:
- LSA_HANDLE _handle;
- #ifndef _UNICODE
- HMODULE hModule;
- #endif
-public:
- operator LSA_HANDLE() const { return _handle; }
- CPolicy(): _handle(NULL)
- {
- #ifndef _UNICODE
- hModule = GetModuleHandle(TEXT("Advapi32.dll"));
- #endif
- };
- ~CPolicy() { Close(); }
-
- NTSTATUS Open(PLSA_UNICODE_STRING systemName, PLSA_OBJECT_ATTRIBUTES objectAttributes,
- ACCESS_MASK desiredAccess)
- {
- #ifndef _UNICODE
- if (hModule == NULL)
- return MY_STATUS_NOT_IMPLEMENTED;
- LsaOpenPolicyP lsaOpenPolicy = (LsaOpenPolicyP)GetProcAddress(hModule, "LsaOpenPolicy");
- if (lsaOpenPolicy == NULL)
- return MY_STATUS_NOT_IMPLEMENTED;
- #endif
-
- Close();
- return
- #ifdef _UNICODE
- ::LsaOpenPolicy
- #else
- lsaOpenPolicy
- #endif
- (systemName, objectAttributes, desiredAccess, &_handle);
- }
-
- NTSTATUS Close()
- {
- if (_handle == NULL)
- return 0;
-
- #ifndef _UNICODE
- if (hModule == NULL)
- return MY_STATUS_NOT_IMPLEMENTED;
- LsaCloseP lsaClose = (LsaCloseP)GetProcAddress(hModule, "LsaClose");
- if (lsaClose == NULL)
- return MY_STATUS_NOT_IMPLEMENTED;
- #endif
-
- NTSTATUS res =
- #ifdef _UNICODE
- ::LsaClose
- #else
- lsaClose
- #endif
- (_handle);
- _handle = NULL;
- return res;
- }
-
- NTSTATUS EnumerateAccountsWithUserRight(PLSA_UNICODE_STRING userRights,
- PLSA_ENUMERATION_INFORMATION *enumerationBuffer, PULONG countReturned)
- { return LsaEnumerateAccountsWithUserRight(_handle, userRights, (void **)enumerationBuffer, countReturned); }
-
- NTSTATUS EnumerateAccountRights(PSID sid, PLSA_UNICODE_STRING* userRights, PULONG countOfRights)
- { return ::LsaEnumerateAccountRights(_handle, sid, userRights, countOfRights); }
-
- NTSTATUS LookupSids(ULONG count, PSID* sids,
- PLSA_REFERENCED_DOMAIN_LIST* referencedDomains, PLSA_TRANSLATED_NAME* names)
- { return LsaLookupSids(_handle, count, sids, referencedDomains, names); }
-
- NTSTATUS AddAccountRights(PSID accountSid, PLSA_UNICODE_STRING userRights, ULONG countOfRights)
- {
- #ifndef _UNICODE
- if (hModule == NULL)
- return MY_STATUS_NOT_IMPLEMENTED;
- LsaAddAccountRightsP lsaAddAccountRights = (LsaAddAccountRightsP)GetProcAddress(hModule, "LsaAddAccountRights");
- if (lsaAddAccountRights == NULL)
- return MY_STATUS_NOT_IMPLEMENTED;
- #endif
-
- return
- #ifdef _UNICODE
- ::LsaAddAccountRights
- #else
- lsaAddAccountRights
- #endif
- (_handle, accountSid, userRights, countOfRights);
- }
- NTSTATUS AddAccountRights(PSID accountSid, PLSA_UNICODE_STRING userRights)
- { return AddAccountRights(accountSid, userRights, 1); }
-
- NTSTATUS RemoveAccountRights(PSID accountSid, bool allRights, PLSA_UNICODE_STRING userRights, ULONG countOfRights)
- { return LsaRemoveAccountRights(_handle, accountSid, (BOOLEAN)(allRights ? TRUE : FALSE), userRights, countOfRights); }
-};
-
-bool AddLockMemoryPrivilege();
-
-}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Shell.cpp b/src/libs/7zip/win/CPP/Windows/Shell.cpp
deleted file mode 100644
index 010449fb4..000000000
--- a/src/libs/7zip/win/CPP/Windows/Shell.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-// Windows/Shell.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyCom.h"
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-
-#include "Windows/COM.h"
-#include "Windows/Shell.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NShell {
-
-#ifndef UNDER_CE
-
-// SHGetMalloc is unsupported in Windows Mobile?
-
-void CItemIDList::Free()
-{
- if (m_Object == NULL)
- return;
- CMyComPtr<IMalloc> shellMalloc;
- if (::SHGetMalloc(&shellMalloc) != NOERROR)
- throw 41099;
- shellMalloc->Free(m_Object);
- m_Object = NULL;
-}
-
-/*
-CItemIDList::(LPCITEMIDLIST itemIDList): m_Object(NULL)
- { *this = itemIDList; }
-CItemIDList::(const CItemIDList& itemIDList): m_Object(NULL)
- { *this = itemIDList; }
-
-CItemIDList& CItemIDList::operator=(LPCITEMIDLIST object)
-{
- Free();
- if (object != 0)
- {
- UINT32 size = GetSize(object);
- m_Object = (LPITEMIDLIST)CoTaskMemAlloc(size);
- if (m_Object != NULL)
- MoveMemory(m_Object, object, size);
- }
- return *this;
-}
-
-CItemIDList& CItemIDList::operator=(const CItemIDList &object)
-{
- Free();
- if (object.m_Object != NULL)
- {
- UINT32 size = GetSize(object.m_Object);
- m_Object = (LPITEMIDLIST)CoTaskMemAlloc(size);
- if (m_Object != NULL)
- MoveMemory(m_Object, object.m_Object, size);
- }
- return *this;
-}
-*/
-
-/////////////////////////////
-// CDrop
-
-void CDrop::Attach(HDROP object)
-{
- Free();
- m_Object = object;
- m_Assigned = true;
-}
-
-void CDrop::Free()
-{
- if (m_MustBeFinished && m_Assigned)
- Finish();
- m_Assigned = false;
-}
-
-UINT CDrop::QueryCountOfFiles()
-{
- return QueryFile(0xFFFFFFFF, (LPTSTR)NULL, 0);
-}
-
-UString CDrop::QueryFileName(UINT fileIndex)
-{
- UString fileName;
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- AString fileNameA;
- UINT bufferSize = QueryFile(fileIndex, (LPTSTR)NULL, 0);
- QueryFile(fileIndex, fileNameA.GetBuffer(bufferSize + 2), bufferSize + 1);
- fileNameA.ReleaseBuffer();
- fileName = GetUnicodeString(fileNameA);
- }
- else
- #endif
- {
- UINT bufferSize = QueryFile(fileIndex, (LPWSTR)NULL, 0);
- QueryFile(fileIndex, fileName.GetBuffer(bufferSize + 2), bufferSize + 1);
- fileName.ReleaseBuffer();
- }
- return fileName;
-}
-
-void CDrop::QueryFileNames(UStringVector &fileNames)
-{
- fileNames.Clear();
- UINT numFiles = QueryCountOfFiles();
- fileNames.Reserve(numFiles);
- for (UINT i = 0; i < numFiles; i++)
- fileNames.Add(QueryFileName(i));
-}
-
-
-bool GetPathFromIDList(LPCITEMIDLIST itemIDList, CSysString &path)
-{
- bool result = BOOLToBool(::SHGetPathFromIDList(itemIDList, path.GetBuffer(MAX_PATH * 2)));
- path.ReleaseBuffer();
- return result;
-}
-
-#endif
-
-#ifdef UNDER_CE
-
-bool BrowseForFolder(LPBROWSEINFO, CSysString)
-{
- return false;
-}
-
-bool BrowseForFolder(HWND, LPCTSTR, UINT, LPCTSTR, CSysString &)
-{
- return false;
-}
-
-bool BrowseForFolder(HWND owner, LPCTSTR title,
- LPCTSTR initialFolder, CSysString &resultPath)
-{
- /*
- // SHBrowseForFolder doesn't work before CE 6.0 ?
- if (GetProcAddress(LoadLibrary(L"ceshell.dll", L"SHBrowseForFolder") == 0)
- MessageBoxW(0, L"no", L"", 0);
- else
- MessageBoxW(0, L"yes", L"", 0);
- */
- /*
- UString s = L"all files";
- s += L" (*.*)";
- return MyGetOpenFileName(owner, title, initialFolder, s, resultPath, true);
- */
- return false;
-}
-
-#else
-
-bool BrowseForFolder(LPBROWSEINFO browseInfo, CSysString &resultPath)
-{
- NWindows::NCOM::CComInitializer comInitializer;
- LPITEMIDLIST itemIDList = ::SHBrowseForFolder(browseInfo);
- if (itemIDList == NULL)
- return false;
- CItemIDList itemIDListHolder;
- itemIDListHolder.Attach(itemIDList);
- return GetPathFromIDList(itemIDList, resultPath);
-}
-
-
-int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM /* lp */, LPARAM data)
-{
- #ifndef UNDER_CE
- switch(uMsg)
- {
- case BFFM_INITIALIZED:
- {
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, data);
- break;
- }
- /*
- case BFFM_SELCHANGED:
- {
- TCHAR dir[MAX_PATH];
- if (::SHGetPathFromIDList((LPITEMIDLIST) lp , dir))
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)dir);
- else
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)TEXT(""));
- break;
- }
- */
- default:
- break;
- }
- #endif
- return 0;
-}
-
-
-bool BrowseForFolder(HWND owner, LPCTSTR title, UINT ulFlags,
- LPCTSTR initialFolder, CSysString &resultPath)
-{
- CSysString displayName;
- BROWSEINFO browseInfo;
- browseInfo.hwndOwner = owner;
- browseInfo.pidlRoot = NULL;
-
- // there are Unicode/astring problems in WinCE SDK!!!
- #ifdef UNDER_CE
- browseInfo.pszDisplayName = (LPSTR)displayName.GetBuffer(MAX_PATH);
- browseInfo.lpszTitle = (LPCSTR)title;
- #else
- browseInfo.pszDisplayName = displayName.GetBuffer(MAX_PATH);
- browseInfo.lpszTitle = title;
- #endif
- browseInfo.ulFlags = ulFlags;
- browseInfo.lpfn = (initialFolder != NULL) ? BrowseCallbackProc : NULL;
- browseInfo.lParam = (LPARAM)initialFolder;
- return BrowseForFolder(&browseInfo, resultPath);
-}
-
-bool BrowseForFolder(HWND owner, LPCTSTR title,
- LPCTSTR initialFolder, CSysString &resultPath)
-{
- return BrowseForFolder(owner, title,
- #ifndef UNDER_CE
- BIF_NEWDIALOGSTYLE |
- #endif
- BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT, initialFolder, resultPath);
- // BIF_STATUSTEXT; BIF_USENEWUI (Version 5.0)
-}
-
-#ifndef _UNICODE
-
-typedef BOOL (WINAPI * SHGetPathFromIDListWP)(LPCITEMIDLIST pidl, LPWSTR pszPath);
-
-bool GetPathFromIDList(LPCITEMIDLIST itemIDList, UString &path)
-{
- path.Empty();
- SHGetPathFromIDListWP shGetPathFromIDListW = (SHGetPathFromIDListWP)
- ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetPathFromIDListW");
- if (shGetPathFromIDListW == 0)
- return false;
- bool result = BOOLToBool(shGetPathFromIDListW(itemIDList, path.GetBuffer(MAX_PATH * 2)));
- path.ReleaseBuffer();
- return result;
-}
-
-typedef LPITEMIDLIST (WINAPI * SHBrowseForFolderWP)(LPBROWSEINFOW lpbi);
-
-bool BrowseForFolder(LPBROWSEINFOW browseInfo, UString &resultPath)
-{
- NWindows::NCOM::CComInitializer comInitializer;
- SHBrowseForFolderWP shBrowseForFolderW = (SHBrowseForFolderWP)
- ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHBrowseForFolderW");
- if (shBrowseForFolderW == 0)
- return false;
- LPITEMIDLIST itemIDList = shBrowseForFolderW(browseInfo);
- if (itemIDList == NULL)
- return false;
- CItemIDList itemIDListHolder;
- itemIDListHolder.Attach(itemIDList);
- return GetPathFromIDList(itemIDList, resultPath);
-}
-
-
-int CALLBACK BrowseCallbackProc2(HWND hwnd, UINT uMsg, LPARAM /* lp */, LPARAM data)
-{
- switch(uMsg)
- {
- case BFFM_INITIALIZED:
- {
- SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE, data);
- break;
- }
- /*
- case BFFM_SELCHANGED:
- {
- wchar_t dir[MAX_PATH * 2];
-
- if (shGetPathFromIDListW((LPITEMIDLIST)lp , dir))
- SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM)dir);
- else
- SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM)L"");
- break;
- }
- */
- default:
- break;
- }
- return 0;
-}
-
-
-static bool BrowseForFolder(HWND owner, LPCWSTR title, UINT ulFlags,
- LPCWSTR initialFolder, UString &resultPath)
-{
- UString displayName;
- BROWSEINFOW browseInfo;
- browseInfo.hwndOwner = owner;
- browseInfo.pidlRoot = NULL;
- browseInfo.pszDisplayName = displayName.GetBuffer(MAX_PATH);
- browseInfo.lpszTitle = title;
- browseInfo.ulFlags = ulFlags;
- browseInfo.lpfn = (initialFolder != NULL) ? BrowseCallbackProc2 : NULL;
- browseInfo.lParam = (LPARAM)initialFolder;
- return BrowseForFolder(&browseInfo, resultPath);
-}
-
-bool BrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR initialFolder, UString &resultPath)
-{
- if (g_IsNT)
- return BrowseForFolder(owner, title,
- BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS
- // | BIF_STATUSTEXT // This flag is not supported when BIF_NEWDIALOGSTYLE is specified.
- , initialFolder, resultPath);
- // BIF_STATUSTEXT; BIF_USENEWUI (Version 5.0)
- CSysString s;
- bool res = BrowseForFolder(owner, GetSystemString(title),
- BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS
- // | BIF_STATUSTEXT // This flag is not supported when BIF_NEWDIALOGSTYLE is specified.
- , GetSystemString(initialFolder), s);
- resultPath = GetUnicodeString(s);
- return res;
-}
-
-#endif
-
-#endif
-
-}}
diff --git a/src/libs/7zip/win/CPP/Windows/Shell.h b/src/libs/7zip/win/CPP/Windows/Shell.h
deleted file mode 100644
index d2b39acfe..000000000
--- a/src/libs/7zip/win/CPP/Windows/Shell.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Windows/Shell.h
-
-#ifndef __WINDOWS_SHELL_H
-#define __WINDOWS_SHELL_H
-
-#include <windows.h>
-#include <shlobj.h>
-
-#include "Common/MyString.h"
-#include "Windows/Defs.h"
-
-namespace NWindows{
-namespace NShell{
-
-/////////////////////////
-// CItemIDList
-#ifndef UNDER_CE
-
-class CItemIDList
-{
- LPITEMIDLIST m_Object;
-public:
- CItemIDList(): m_Object(NULL) {}
- // CItemIDList(LPCITEMIDLIST itemIDList);
- // CItemIDList(const CItemIDList& itemIDList);
- ~CItemIDList() { Free(); }
- void Free();
- void Attach(LPITEMIDLIST object)
- {
- Free();
- m_Object = object;
- }
- LPITEMIDLIST Detach()
- {
- LPITEMIDLIST object = m_Object;
- m_Object = NULL;
- return object;
- }
- operator LPITEMIDLIST() { return m_Object;}
- operator LPCITEMIDLIST() const { return m_Object;}
- LPITEMIDLIST* operator&() { return &m_Object; }
- LPITEMIDLIST operator->() { return m_Object; }
-
- // CItemIDList& operator=(LPCITEMIDLIST object);
- // CItemIDList& operator=(const CItemIDList &object);
-};
-
-/////////////////////////////
-// CDrop
-
-class CDrop
-{
- HDROP m_Object;
- bool m_MustBeFinished;
- bool m_Assigned;
- void Free();
-public:
- CDrop(bool mustBeFinished) : m_MustBeFinished(mustBeFinished), m_Assigned(false) {}
- ~CDrop() { Free(); }
-
- void Attach(HDROP object);
- operator HDROP() { return m_Object;}
- bool QueryPoint(LPPOINT point)
- { return BOOLToBool(::DragQueryPoint(m_Object, point)); }
- void Finish() { ::DragFinish(m_Object); }
- UINT QueryFile(UINT fileIndex, LPTSTR fileName, UINT fileNameSize)
- { return ::DragQueryFile(m_Object, fileIndex, fileName, fileNameSize); }
- #ifndef _UNICODE
- UINT QueryFile(UINT fileIndex, LPWSTR fileName, UINT fileNameSize)
- { return ::DragQueryFileW(m_Object, fileIndex, fileName, fileNameSize); }
- #endif
- UINT QueryCountOfFiles();
- UString QueryFileName(UINT fileIndex);
- void QueryFileNames(UStringVector &fileNames);
-};
-
-#endif
-
-/////////////////////////////
-// Functions
-
-bool GetPathFromIDList(LPCITEMIDLIST itemIDList, CSysString &path);
-bool BrowseForFolder(LPBROWSEINFO lpbi, CSysString &resultPath);
-bool BrowseForFolder(HWND owner, LPCTSTR title, LPCTSTR initialFolder, CSysString &resultPath);
-
-#ifndef _UNICODE
-bool GetPathFromIDList(LPCITEMIDLIST itemIDList, UString &path);
-bool BrowseForFolder(LPBROWSEINFO lpbi, UString &resultPath);
-bool BrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR initialFolder, UString &resultPath);
-#endif
-}}
-
-#endif
diff --git a/src/libs/7zip/win/CPP/Windows/Window.cpp b/src/libs/7zip/win/CPP/Windows/Window.cpp
deleted file mode 100644
index 3ad29e6d7..000000000
--- a/src/libs/7zip/win/CPP/Windows/Window.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// Windows/Window.cpp
-
-#include "StdAfx.h"
-
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-#include "Windows/Window.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-
-#ifndef _UNICODE
-ATOM MyRegisterClass(CONST WNDCLASSW *wndClass)
-{
- if (g_IsNT)
- return RegisterClassW(wndClass);
- WNDCLASSA wndClassA;
- wndClassA.style = wndClass->style;
- wndClassA.lpfnWndProc = wndClass->lpfnWndProc;
- wndClassA.cbClsExtra = wndClass->cbClsExtra;
- wndClassA.cbWndExtra = wndClass->cbWndExtra;
- wndClassA.hInstance = wndClass->hInstance;
- wndClassA.hIcon = wndClass->hIcon;
- wndClassA.hCursor = wndClass->hCursor;
- wndClassA.hbrBackground = wndClass->hbrBackground;
- AString menuName;
- AString className;
- if (IS_INTRESOURCE(wndClass->lpszMenuName))
- wndClassA.lpszMenuName = (LPCSTR)wndClass->lpszMenuName;
- else
- {
- menuName = GetSystemString(wndClass->lpszMenuName);
- wndClassA.lpszMenuName = menuName;
- }
- if (IS_INTRESOURCE(wndClass->lpszClassName))
- wndClassA.lpszClassName = (LPCSTR)wndClass->lpszClassName;
- else
- {
- className = GetSystemString(wndClass->lpszClassName);
- wndClassA.lpszClassName = className;
- }
- return RegisterClassA(&wndClassA);
-}
-
-bool CWindow::Create(LPCWSTR className,
- LPCWSTR windowName, DWORD style,
- int x, int y, int width, int height,
- HWND parentWindow, HMENU idOrHMenu,
- HINSTANCE instance, LPVOID createParam)
-{
- if (g_IsNT)
- {
- _window = ::CreateWindowW(className, windowName,
- style, x, y, width, height, parentWindow,
- idOrHMenu, instance, createParam);
- return (_window != NULL);
- }
- return Create(GetSystemString(className), GetSystemString(windowName),
- style, x, y, width, height, parentWindow,
- idOrHMenu, instance, createParam);
-}
-
-bool CWindow::CreateEx(DWORD exStyle, LPCWSTR className,
- LPCWSTR windowName, DWORD style,
- int x, int y, int width, int height,
- HWND parentWindow, HMENU idOrHMenu,
- HINSTANCE instance, LPVOID createParam)
-{
- if (g_IsNT)
- {
- _window = ::CreateWindowExW(exStyle, className, windowName,
- style, x, y, width, height, parentWindow,
- idOrHMenu, instance, createParam);
- return (_window != NULL);
- }
- AString classNameA;
- LPCSTR classNameP;
- if (IS_INTRESOURCE(className))
- classNameP = (LPCSTR)className;
- else
- {
- classNameA = GetSystemString(className);
- classNameP = classNameA;
- }
- AString windowNameA;
- LPCSTR windowNameP;
- if (IS_INTRESOURCE(windowName))
- windowNameP = (LPCSTR)windowName;
- else
- {
- windowNameA = GetSystemString(windowName);
- windowNameP = windowNameA;
- }
- return CreateEx(exStyle, classNameP, windowNameP,
- style, x, y, width, height, parentWindow,
- idOrHMenu, instance, createParam);
-}
-
-#endif
-
-#ifndef _UNICODE
-bool MySetWindowText(HWND wnd, LPCWSTR s)
-{
- if (g_IsNT)
- return BOOLToBool(::SetWindowTextW(wnd, s));
- return BOOLToBool(::SetWindowTextA(wnd, UnicodeStringToMultiByte(s)));
-}
-#endif
-
-bool CWindow::GetText(CSysString &s)
-{
- s.Empty();
- int length = GetTextLength();
- if (length == 0)
- return (::GetLastError() == ERROR_SUCCESS);
- length = GetText(s.GetBuffer(length), length + 1);
- s.ReleaseBuffer();
- if (length == 0)
- return (::GetLastError() != ERROR_SUCCESS);
- return true;
-}
-
-#ifndef _UNICODE
-bool CWindow::GetText(UString &s)
-{
- if (g_IsNT)
- {
- s.Empty();
- int length = GetWindowTextLengthW(_window);
- if (length == 0)
- return (::GetLastError() == ERROR_SUCCESS);
- length = GetWindowTextW(_window, s.GetBuffer(length), length + 1);
- s.ReleaseBuffer();
- if (length == 0)
- return (::GetLastError() == ERROR_SUCCESS);
- return true;
- }
- CSysString sysString;
- bool result = GetText(sysString);
- s = GetUnicodeString(sysString);
- return result;
-}
-#endif
-
-
-/*
-bool CWindow::ModifyStyleBase(int styleOffset,
- DWORD remove, DWORD add, UINT flags)
-{
- DWORD style = GetWindowLong(styleOffset);
- DWORD newStyle = (style & ~remove) | add;
- if (style == newStyle)
- return false; // it is not good
-
- SetWindowLong(styleOffset, newStyle);
- if (flags != 0)
- {
- ::SetWindowPos(_window, NULL, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | flags);
- }
- return TRUE;
-}
-*/
-
-}
diff --git a/src/libs/7zip/win/CPP/Windows/Window.h b/src/libs/7zip/win/CPP/Windows/Window.h
deleted file mode 100644
index 729b0f24b..000000000
--- a/src/libs/7zip/win/CPP/Windows/Window.h
+++ /dev/null
@@ -1,261 +0,0 @@
-// Windows/Window.h
-
-#ifndef __WINDOWS_WINDOW_H
-#define __WINDOWS_WINDOW_H
-
-#include "Defs.h"
-#include "Common/MyString.h"
-
-namespace NWindows {
-
-inline ATOM MyRegisterClass(CONST WNDCLASS *wndClass)
- { return ::RegisterClass(wndClass); }
-
-#ifndef _UNICODE
-ATOM MyRegisterClass(CONST WNDCLASSW *wndClass);
-#endif
-
-#ifdef _UNICODE
-inline bool MySetWindowText(HWND wnd, LPCWSTR s) { return BOOLToBool(::SetWindowText(wnd, s)); }
-#else
-bool MySetWindowText(HWND wnd, LPCWSTR s);
-#endif
-
-
-#ifdef UNDER_CE
-#define GWLP_USERDATA GWL_USERDATA
-#define GWLP_WNDPROC GWL_WNDPROC
-#define BTNS_BUTTON TBSTYLE_BUTTON
-#define WC_COMBOBOXW L"ComboBox"
-#define DWLP_MSGRESULT DWL_MSGRESULT
-#endif
-
-class CWindow
-{
-private:
- // bool ModifyStyleBase(int styleOffset, DWORD remove, DWORD add, UINT flags);
-protected:
- HWND _window;
-public:
- CWindow(HWND newWindow = NULL): _window(newWindow){};
- CWindow& operator=(HWND newWindow)
- {
- _window = newWindow;
- return *this;
- }
- operator HWND() const { return _window; }
- void Attach(HWND newWindow) { _window = newWindow; }
- HWND Detach()
- {
- HWND window = _window;
- _window = NULL;
- return window;
- }
-
- bool Foreground() { return BOOLToBool(::SetForegroundWindow(_window)); }
-
- HWND GetParent() const { return ::GetParent(_window); }
- bool GetWindowRect(LPRECT rect) const { return BOOLToBool(::GetWindowRect(_window,rect)); }
- #ifndef UNDER_CE
- bool IsZoomed() const { return BOOLToBool(::IsZoomed(_window)); }
- #endif
- bool ClientToScreen(LPPOINT point) const { return BOOLToBool(::ClientToScreen(_window, point)); }
- bool ScreenToClient(LPPOINT point) const { return BOOLToBool(::ScreenToClient(_window, point)); }
-
- bool CreateEx(DWORD exStyle, LPCTSTR className,
- LPCTSTR windowName, DWORD style,
- int x, int y, int width, int height,
- HWND parentWindow, HMENU idOrHMenu,
- HINSTANCE instance, LPVOID createParam)
- {
- _window = ::CreateWindowEx(exStyle, className, windowName,
- style, x, y, width, height, parentWindow,
- idOrHMenu, instance, createParam);
- return (_window != NULL);
- }
-
- bool Create(LPCTSTR className,
- LPCTSTR windowName, DWORD style,
- int x, int y, int width, int height,
- HWND parentWindow, HMENU idOrHMenu,
- HINSTANCE instance, LPVOID createParam)
- {
- _window = ::CreateWindow(className, windowName,
- style, x, y, width, height, parentWindow,
- idOrHMenu, instance, createParam);
- return (_window != NULL);
- }
-
- #ifndef _UNICODE
- bool Create(LPCWSTR className,
- LPCWSTR windowName, DWORD style,
- int x, int y, int width, int height,
- HWND parentWindow, HMENU idOrHMenu,
- HINSTANCE instance, LPVOID createParam);
- bool CreateEx(DWORD exStyle, LPCWSTR className,
- LPCWSTR windowName, DWORD style,
- int x, int y, int width, int height,
- HWND parentWindow, HMENU idOrHMenu,
- HINSTANCE instance, LPVOID createParam);
- #endif
-
-
- bool Destroy()
- {
- if (_window == NULL)
- return true;
- bool result = BOOLToBool(::DestroyWindow(_window));
- if (result)
- _window = NULL;
- return result;
- }
- bool IsWindow() { return BOOLToBool(::IsWindow(_window)); }
- bool Move(int x, int y, int width, int height, bool repaint = true)
- { return BOOLToBool(::MoveWindow(_window, x, y, width, height, BoolToBOOL(repaint))); }
-
- bool ChangeSubWindowSizeX(HWND hwnd, int xSize)
- {
- RECT rect;
- ::GetWindowRect(hwnd, &rect);
- POINT p1;
- p1.x = rect.left;
- p1.y = rect.top;
- ScreenToClient(&p1);
- return BOOLToBool(::MoveWindow(hwnd, p1.x, p1.y, xSize, rect.bottom - rect.top, TRUE));
- }
-
- void ScreenToClient(RECT *rect)
- {
- POINT p1, p2;
- p1.x = rect->left;
- p1.y = rect->top;
- p2.x = rect->right;
- p2.y = rect->bottom;
- ScreenToClient(&p1);
- ScreenToClient(&p2);
-
- rect->left = p1.x;
- rect->top = p1.y;
- rect->right = p2.x;
- rect->bottom = p2.y;
- }
-
- bool GetClientRect(LPRECT rect) { return BOOLToBool(::GetClientRect(_window, rect)); }
- bool Show(int cmdShow) { return BOOLToBool(::ShowWindow(_window, cmdShow)); }
- #ifndef UNDER_CE
- bool SetPlacement(CONST WINDOWPLACEMENT *placement) { return BOOLToBool(::SetWindowPlacement(_window, placement)); }
- bool GetPlacement(WINDOWPLACEMENT *placement) { return BOOLToBool(::GetWindowPlacement(_window, placement)); }
- #endif
- bool Update() { return BOOLToBool(::UpdateWindow(_window)); }
- bool InvalidateRect(LPCRECT rect, bool backgroundErase = true)
- { return BOOLToBool(::InvalidateRect(_window, rect, BoolToBOOL(backgroundErase))); }
- void SetRedraw(bool redraw = true) { SendMessage(WM_SETREDRAW, BoolToBOOL(redraw), 0); }
-
- LONG_PTR SetStyle(LONG_PTR style) { return SetLongPtr(GWL_STYLE, style); }
- LONG_PTR GetStyle() const { return GetLongPtr(GWL_STYLE); }
- // bool MyIsMaximized() const { return ((GetStyle() & WS_MAXIMIZE) != 0); }
-
- LONG_PTR SetLong(int index, LONG newLongPtr) { return ::SetWindowLong(_window, index, newLongPtr); }
- LONG_PTR GetLong(int index) const { return ::GetWindowLong(_window, index); }
- LONG_PTR SetUserDataLong(LONG newLongPtr) { return SetLong(GWLP_USERDATA, newLongPtr); }
- LONG_PTR GetUserDataLong() const { return GetLong(GWLP_USERDATA); }
-
-
- #ifdef UNDER_CE
-
- LONG_PTR SetLongPtr(int index, LONG_PTR newLongPtr) { return SetLong(index, newLongPtr); }
- LONG_PTR GetLongPtr(int index) const { return GetLong(index); }
-
- LONG_PTR SetUserDataLongPtr(LONG_PTR newLongPtr) { return SetUserDataLong(newLongPtr); }
- LONG_PTR GetUserDataLongPtr() const { return GetUserDataLong(); }
-
- #else
-
- LONG_PTR SetLongPtr(int index, LONG_PTR newLongPtr)
- { return ::SetWindowLongPtr(_window, index,
- #ifndef _WIN64
- (LONG)
- #endif
- newLongPtr); }
- #ifndef _UNICODE
- LONG_PTR SetLongPtrW(int index, LONG_PTR newLongPtr)
- { return ::SetWindowLongPtrW(_window, index,
- #ifndef _WIN64
- (LONG)
- #endif
- newLongPtr); }
- #endif
-
- LONG_PTR GetLongPtr(int index) const { return ::GetWindowLongPtr(_window, index); }
- LONG_PTR SetUserDataLongPtr(LONG_PTR newLongPtr) { return SetLongPtr(GWLP_USERDATA, newLongPtr); }
- LONG_PTR GetUserDataLongPtr() const { return GetLongPtr(GWLP_USERDATA); }
-
- #endif
-
- /*
- bool ModifyStyle(HWND hWnd, DWORD remove, DWORD add, UINT flags = 0)
- { return ModifyStyleBase(GWL_STYLE, remove, add, flags); }
- bool ModifyStyleEx(HWND hWnd, DWORD remove, DWORD add, UINT flags = 0)
- { return ModifyStyleBase(GWL_EXSTYLE, remove, add, flags); }
- */
-
- HWND SetFocus() { return ::SetFocus(_window); }
-
- LRESULT SendMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0)
- { return ::SendMessage(_window, message, wParam, lParam) ;}
- #ifndef _UNICODE
- LRESULT SendMessageW(UINT message, WPARAM wParam = 0, LPARAM lParam = 0)
- { return ::SendMessageW(_window, message, wParam, lParam) ;}
- #endif
-
- bool PostMessage(UINT message, WPARAM wParam = 0, LPARAM lParam = 0)
- { return BOOLToBool(::PostMessage(_window, message, wParam, lParam)) ;}
- #ifndef _UNICODE
- LRESULT PostMessageW(UINT message, WPARAM wParam = 0, LPARAM lParam = 0)
- { return ::PostMessageW(_window, message, wParam, lParam) ;}
- #endif
-
- bool SetText(LPCTSTR s) { return BOOLToBool(::SetWindowText(_window, s)); }
- #ifndef _UNICODE
- bool CWindow::SetText(LPCWSTR s) { return MySetWindowText(_window, s); }
- #endif
-
- int GetTextLength() const
- { return GetWindowTextLength(_window); }
- UINT GetText(LPTSTR string, int maxCount) const
- { return GetWindowText(_window, string, maxCount); }
- bool GetText(CSysString &s);
- #ifndef _UNICODE
- /*
- UINT GetText(LPWSTR string, int maxCount) const
- { return GetWindowTextW(_window, string, maxCount); }
- */
- bool GetText(UString &s);
- #endif
-
- bool Enable(bool enable)
- { return BOOLToBool(::EnableWindow(_window, BoolToBOOL(enable))); }
-
- bool IsEnabled()
- { return BOOLToBool(::IsWindowEnabled(_window)); }
-
- #ifndef UNDER_CE
- HMENU GetSystemMenu(bool revert)
- { return ::GetSystemMenu(_window, BoolToBOOL(revert)); }
- #endif
-
- UINT_PTR SetTimer(UINT_PTR idEvent, UINT elapse, TIMERPROC timerFunc = 0)
- { return ::SetTimer(_window, idEvent, elapse, timerFunc); }
- bool KillTimer(UINT_PTR idEvent)
- {return BOOLToBool(::KillTimer(_window, idEvent)); }
-
- HICON SetIcon(WPARAM sizeType, HICON icon) { return (HICON)SendMessage(WM_SETICON, sizeType, (LPARAM)icon); }
-};
-
-#define RECT_SIZE_X(r) ((r).right - (r).left)
-#define RECT_SIZE_Y(r) ((r).bottom - (r).top)
-
-}
-
-#endif
-