diff options
| author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2026-02-12 00:00:00 +0000 |
|---|---|---|
| committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2026-02-12 17:38:49 +0500 |
| commit | 839151eaaad24771892afaae6bac690e31e58384 (patch) | |
| tree | e292449d621f7a1d503b975984a2aca240dd2d8f /CPP/Windows | |
| parent | 5e96a8279489832924056b1fa82f29d5837c9469 (diff) | |
| download | 7zip-839151eaaad24771892afaae6bac690e31e58384.tar.gz 7zip-839151eaaad24771892afaae6bac690e31e58384.tar.bz2 7zip-839151eaaad24771892afaae6bac690e31e58384.zip | |
Diffstat (limited to 'CPP/Windows')
| -rw-r--r-- | CPP/Windows/Control/ComboBox.cpp | 9 | ||||
| -rw-r--r-- | CPP/Windows/Control/ComboBox.h | 2 | ||||
| -rw-r--r-- | CPP/Windows/FileFind.cpp | 13 | ||||
| -rw-r--r-- | CPP/Windows/FileFind.h | 6 | ||||
| -rw-r--r-- | CPP/Windows/SecurityUtils.h | 4 | ||||
| -rw-r--r-- | CPP/Windows/System.cpp | 10 | ||||
| -rw-r--r-- | CPP/Windows/System.h | 23 | ||||
| -rw-r--r-- | CPP/Windows/SystemInfo.cpp | 4 | ||||
| -rw-r--r-- | CPP/Windows/TimeUtils.h | 8 |
9 files changed, 66 insertions, 13 deletions
diff --git a/CPP/Windows/Control/ComboBox.cpp b/CPP/Windows/Control/ComboBox.cpp index 8da487d..2e9c8cb 100644 --- a/CPP/Windows/Control/ComboBox.cpp +++ b/CPP/Windows/Control/ComboBox.cpp | |||
| @@ -63,4 +63,13 @@ LRESULT CComboBox::GetLBText(int index, UString &s) | |||
| 63 | } | 63 | } |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | LRESULT CComboBox::AddString_SetItemData(LPCWSTR s, LPARAM lParam) | ||
| 67 | { | ||
| 68 | const LRESULT index = AddString(s); | ||
| 69 | // NOTE: SetItemData((int)-1, lParam) works as unexpected. | ||
| 70 | if (index >= 0) // optional check, because (index < 0) is not expected for normal inputs | ||
| 71 | SetItemData((int)index, lParam); | ||
| 72 | return index; | ||
| 73 | } | ||
| 74 | |||
| 66 | }} | 75 | }} |
diff --git a/CPP/Windows/Control/ComboBox.h b/CPP/Windows/Control/ComboBox.h index 2a60b8a..224efca 100644 --- a/CPP/Windows/Control/ComboBox.h +++ b/CPP/Windows/Control/ComboBox.h | |||
| @@ -21,6 +21,8 @@ public: | |||
| 21 | LRESULT AddString(LPCWSTR s); | 21 | LRESULT AddString(LPCWSTR s); |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | LRESULT AddString_SetItemData(LPCWSTR s, LPARAM lParam); | ||
| 25 | |||
| 24 | /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ | 26 | /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ |
| 25 | LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY_int_TO_WPARAM(index), 0); } | 27 | LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY_int_TO_WPARAM(index), 0); } |
| 26 | LRESULT SetCurSel(unsigned index) { return SendMsg(CB_SETCURSEL, index, 0); } | 28 | LRESULT SetCurSel(unsigned index) { return SendMsg(CB_SETCURSEL, index, 0); } |
diff --git a/CPP/Windows/FileFind.cpp b/CPP/Windows/FileFind.cpp index 64075ab..669541e 100644 --- a/CPP/Windows/FileFind.cpp +++ b/CPP/Windows/FileFind.cpp | |||
| @@ -1162,6 +1162,15 @@ void CFileInfoBase::SetFrom_stat(const struct stat &st) | |||
| 1162 | MTime = st.st_mtimespec; | 1162 | MTime = st.st_mtimespec; |
| 1163 | ATime = st.st_atimespec; | 1163 | ATime = st.st_atimespec; |
| 1164 | 1164 | ||
| 1165 | #elif defined(__QNXNTO__) && defined(__ARM__) && !defined(__aarch64__) | ||
| 1166 | |||
| 1167 | // CTime = ST_CTIME(st); | ||
| 1168 | // MTime = ST_MTIME(st); | ||
| 1169 | // ATime = ST_ATIME(st); | ||
| 1170 | CTime.tv_sec = st.st_ctime; CTime.tv_nsec = 0; | ||
| 1171 | MTime.tv_sec = st.st_mtime; MTime.tv_nsec = 0; | ||
| 1172 | ATime.tv_sec = st.st_atime; ATime.tv_nsec = 0; | ||
| 1173 | |||
| 1165 | #else | 1174 | #else |
| 1166 | // timespec_To_FILETIME(st.st_ctim, CTime, &CTime_ns100); | 1175 | // timespec_To_FILETIME(st.st_ctim, CTime, &CTime_ns100); |
| 1167 | // timespec_To_FILETIME(st.st_mtim, MTime, &MTime_ns100); | 1176 | // timespec_To_FILETIME(st.st_mtim, MTime, &MTime_ns100); |
| @@ -1312,7 +1321,7 @@ bool CDirEntry::IsDots() const throw() | |||
| 1312 | /* some systems (like CentOS 7.x on XFS) have (Type == DT_UNKNOWN) | 1321 | /* some systems (like CentOS 7.x on XFS) have (Type == DT_UNKNOWN) |
| 1313 | we can call fstatat() for that case, but we use only (Name) check here */ | 1322 | we can call fstatat() for that case, but we use only (Name) check here */ |
| 1314 | 1323 | ||
| 1315 | #if !defined(_AIX) && !defined(__sun) | 1324 | #if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) |
| 1316 | if (Type != DT_DIR && Type != DT_UNKNOWN) | 1325 | if (Type != DT_DIR && Type != DT_UNKNOWN) |
| 1317 | return false; | 1326 | return false; |
| 1318 | #endif | 1327 | #endif |
| @@ -1352,7 +1361,7 @@ bool CEnumerator::NextAny(CDirEntry &fi, bool &found) | |||
| 1352 | 1361 | ||
| 1353 | fi.iNode = de->d_ino; | 1362 | fi.iNode = de->d_ino; |
| 1354 | 1363 | ||
| 1355 | #if !defined(_AIX) && !defined(__sun) | 1364 | #if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) |
| 1356 | fi.Type = de->d_type; | 1365 | fi.Type = de->d_type; |
| 1357 | /* some systems (like CentOS 7.x on XFS) have (Type == DT_UNKNOWN) | 1366 | /* some systems (like CentOS 7.x on XFS) have (Type == DT_UNKNOWN) |
| 1358 | we can set (Type) from fstatat() in that case. | 1367 | we can set (Type) from fstatat() in that case. |
diff --git a/CPP/Windows/FileFind.h b/CPP/Windows/FileFind.h index f68673a..944bca2 100644 --- a/CPP/Windows/FileFind.h +++ b/CPP/Windows/FileFind.h | |||
| @@ -277,13 +277,13 @@ typedef CFileInfo CDirEntry; | |||
| 277 | struct CDirEntry | 277 | struct CDirEntry |
| 278 | { | 278 | { |
| 279 | ino_t iNode; | 279 | ino_t iNode; |
| 280 | #if !defined(_AIX) && !defined(__sun) | 280 | #if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) |
| 281 | Byte Type; | 281 | Byte Type; |
| 282 | #endif | 282 | #endif |
| 283 | FString Name; | 283 | FString Name; |
| 284 | 284 | ||
| 285 | /* | 285 | /* |
| 286 | #if !defined(_AIX) && !defined(__sun) | 286 | #if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) |
| 287 | bool IsDir() const | 287 | bool IsDir() const |
| 288 | { | 288 | { |
| 289 | // (Type == DT_UNKNOWN) on some systems | 289 | // (Type == DT_UNKNOWN) on some systems |
| @@ -310,7 +310,7 @@ public: | |||
| 310 | bool Fill_FileInfo(const CDirEntry &de, CFileInfo &fileInfo, bool followLink) const; | 310 | bool Fill_FileInfo(const CDirEntry &de, CFileInfo &fileInfo, bool followLink) const; |
| 311 | bool DirEntry_IsDir(const CDirEntry &de, bool followLink) const | 311 | bool DirEntry_IsDir(const CDirEntry &de, bool followLink) const |
| 312 | { | 312 | { |
| 313 | #if !defined(_AIX) && !defined(__sun) | 313 | #if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) |
| 314 | if (de.Type == DT_DIR) | 314 | if (de.Type == DT_DIR) |
| 315 | return true; | 315 | return true; |
| 316 | if (de.Type != DT_UNKNOWN) | 316 | if (de.Type != DT_UNKNOWN) |
diff --git a/CPP/Windows/SecurityUtils.h b/CPP/Windows/SecurityUtils.h index 7219f06..022a8f3 100644 --- a/CPP/Windows/SecurityUtils.h +++ b/CPP/Windows/SecurityUtils.h | |||
| @@ -3,7 +3,11 @@ | |||
| 3 | #ifndef ZIP7_INC_WINDOWS_SECURITY_UTILS_H | 3 | #ifndef ZIP7_INC_WINDOWS_SECURITY_UTILS_H |
| 4 | #define ZIP7_INC_WINDOWS_SECURITY_UTILS_H | 4 | #define ZIP7_INC_WINDOWS_SECURITY_UTILS_H |
| 5 | 5 | ||
| 6 | #if defined(__MINGW32__) || defined(__MINGW64__) | ||
| 7 | #include <ntsecapi.h> | ||
| 8 | #else | ||
| 6 | #include <NTSecAPI.h> | 9 | #include <NTSecAPI.h> |
| 10 | #endif | ||
| 7 | 11 | ||
| 8 | #include "Defs.h" | 12 | #include "Defs.h" |
| 9 | 13 | ||
diff --git a/CPP/Windows/System.cpp b/CPP/Windows/System.cpp index 4745785..6999ef9 100644 --- a/CPP/Windows/System.cpp +++ b/CPP/Windows/System.cpp | |||
| @@ -5,8 +5,9 @@ | |||
| 5 | #ifndef _WIN32 | 5 | #ifndef _WIN32 |
| 6 | #include <unistd.h> | 6 | #include <unistd.h> |
| 7 | #include <limits.h> | 7 | #include <limits.h> |
| 8 | #if defined(__APPLE__) || defined(__DragonFly__) || \ | 8 | #if defined(__APPLE__) || defined(__DragonFly__) \ |
| 9 | defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) | 9 | || defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \ |
| 10 | || defined(__QNXNTO__) | ||
| 10 | #include <sys/sysctl.h> | 11 | #include <sys/sysctl.h> |
| 11 | #else | 12 | #else |
| 12 | #include <sys/sysinfo.h> | 13 | #include <sys/sysinfo.h> |
| @@ -299,8 +300,9 @@ bool GetRamSize(size_t &size) | |||
| 299 | size = (size_t)sizeof(size_t) << 29; | 300 | size = (size_t)sizeof(size_t) << 29; |
| 300 | size64 = size; | 301 | size64 = size; |
| 301 | 302 | ||
| 302 | #if defined(__APPLE__) || defined(__DragonFly__) || \ | 303 | #if defined(__APPLE__) || defined(__DragonFly__) \ |
| 303 | defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) | 304 | || defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \ |
| 305 | || defined(__QNXNTO__) | ||
| 304 | 306 | ||
| 305 | uint64_t val = 0; | 307 | uint64_t val = 0; |
| 306 | int mib[2]; | 308 | int mib[2]; |
diff --git a/CPP/Windows/System.h b/CPP/Windows/System.h index 0c80373..041a44d 100644 --- a/CPP/Windows/System.h +++ b/CPP/Windows/System.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | namespace NWindows { | 15 | namespace NWindows { |
| 16 | namespace NSystem { | 16 | namespace NSystem { |
| 17 | 17 | ||
| 18 | UInt32 GetNumberOfProcessors(); | ||
| 19 | |||
| 18 | #ifdef _WIN32 | 20 | #ifdef _WIN32 |
| 19 | 21 | ||
| 20 | struct CCpuGroups | 22 | struct CCpuGroups |
| @@ -103,6 +105,25 @@ struct CProcessAffinity | |||
| 103 | return CountAffinity(systemAffinityMask); | 105 | return CountAffinity(systemAffinityMask); |
| 104 | } | 106 | } |
| 105 | 107 | ||
| 108 | // it returns normilized number of threads | ||
| 109 | void Get_and_return_NumProcessThreads_and_SysThreads(UInt32 &numProcessThreads, UInt32 &numSysThreads) | ||
| 110 | { | ||
| 111 | UInt32 num1 = 0, num2 = 0; | ||
| 112 | if (Get()) | ||
| 113 | { | ||
| 114 | num1 = GetNumProcessThreads(); | ||
| 115 | num2 = GetNumSystemThreads(); | ||
| 116 | } | ||
| 117 | if (num1 == 0) | ||
| 118 | num1 = NSystem::GetNumberOfProcessors(); | ||
| 119 | if (num1 == 0) | ||
| 120 | num1 = 1; | ||
| 121 | if (num2 < num1) | ||
| 122 | num2 = num1; | ||
| 123 | numProcessThreads = num1; | ||
| 124 | numSysThreads = num2; | ||
| 125 | } | ||
| 126 | |||
| 106 | BOOL Get(); | 127 | BOOL Get(); |
| 107 | 128 | ||
| 108 | BOOL SetProcAffinity() const | 129 | BOOL SetProcAffinity() const |
| @@ -177,8 +198,6 @@ struct CProcessAffinity | |||
| 177 | #endif // _WIN32 | 198 | #endif // _WIN32 |
| 178 | 199 | ||
| 179 | 200 | ||
| 180 | UInt32 GetNumberOfProcessors(); | ||
| 181 | |||
| 182 | bool GetRamSize(size_t &size); // returns false, if unknown ram size | 201 | bool GetRamSize(size_t &size); // returns false, if unknown ram size |
| 183 | 202 | ||
| 184 | unsigned long Get_File_OPEN_MAX(); | 203 | unsigned long Get_File_OPEN_MAX(); |
diff --git a/CPP/Windows/SystemInfo.cpp b/CPP/Windows/SystemInfo.cpp index 35846e0..2eced2a 100644 --- a/CPP/Windows/SystemInfo.cpp +++ b/CPP/Windows/SystemInfo.cpp | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #if defined(__GLIBC__) && (__GLIBC__ * 100 + __GLIBC_MINOR__ >= 216) | 23 | #if defined(__GLIBC__) && (__GLIBC__ * 100 + __GLIBC_MINOR__ >= 216) |
| 24 | #define Z7_GETAUXV_AVAILABLE | 24 | #define Z7_GETAUXV_AVAILABLE |
| 25 | #else | 25 | #elif !defined(__QNXNTO__) |
| 26 | // #pragma message("=== is not NEW GLIBC === ") | 26 | // #pragma message("=== is not NEW GLIBC === ") |
| 27 | #if defined __has_include | 27 | #if defined __has_include |
| 28 | #if __has_include (<sys/auxv.h>) | 28 | #if __has_include (<sys/auxv.h>) |
| @@ -58,7 +58,7 @@ | |||
| 58 | 58 | ||
| 59 | #ifdef USE_HWCAP | 59 | #ifdef USE_HWCAP |
| 60 | 60 | ||
| 61 | #if defined(__FreeBSD__) | 61 | #if defined(__FreeBSD__) || defined(__OpenBSD__) |
| 62 | 62 | ||
| 63 | // #if (__FreeBSD__ >= 13) // (FreeBSD 12.01 is required for elf_aux_info() ???) | 63 | // #if (__FreeBSD__ >= 13) // (FreeBSD 12.01 is required for elf_aux_info() ???) |
| 64 | static unsigned long MY_getauxval(int aux) | 64 | static unsigned long MY_getauxval(int aux) |
diff --git a/CPP/Windows/TimeUtils.h b/CPP/Windows/TimeUtils.h index 4a9d0f2..8e1e478 100644 --- a/CPP/Windows/TimeUtils.h +++ b/CPP/Windows/TimeUtils.h | |||
| @@ -65,6 +65,14 @@ inline bool FILETIME_IsZero(const FILETIME &ft) | |||
| 65 | #define ST_MTIME(st) st.st_mtimespec | 65 | #define ST_MTIME(st) st.st_mtimespec |
| 66 | #define ST_ATIME(st) st.st_atimespec | 66 | #define ST_ATIME(st) st.st_atimespec |
| 67 | #define ST_CTIME(st) st.st_ctimespec | 67 | #define ST_CTIME(st) st.st_ctimespec |
| 68 | #elif defined(__QNXNTO__) && defined(__ARM__) && !defined(__aarch64__) | ||
| 69 | // QNX armv7le (32-bit) for "struct stat" timestamps uses time_t instead of timespec | ||
| 70 | inline CFiTime ST_MTIME(const struct stat &st) | ||
| 71 | { timespec ts; ts.tv_sec = st.st_mtime; ts.tv_nsec = 0; return ts; } | ||
| 72 | inline CFiTime ST_ATIME(const struct stat &st) | ||
| 73 | { timespec ts; ts.tv_sec = st.st_atime; ts.tv_nsec = 0; return ts; } | ||
| 74 | inline CFiTime ST_CTIME(const struct stat &st) | ||
| 75 | { timespec ts; ts.tv_sec = st.st_ctime; ts.tv_nsec = 0; return ts; } | ||
| 68 | #else | 76 | #else |
| 69 | #define ST_MTIME(st) st.st_mtim | 77 | #define ST_MTIME(st) st.st_mtim |
| 70 | #define ST_ATIME(st) st.st_atim | 78 | #define ST_ATIME(st) st.st_atim |
