summaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/7zip/unix/CPP/myWindows
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/3rdparty/7zip/unix/CPP/myWindows')
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/StdAfx.h205
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/config.h68
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/initguid.h4
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/myCommandLineParser.cpp45
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/myDateAndTime.cpp175
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/myPrivate.h17
-rw-r--r--src/libs/3rdparty/7zip/unix/CPP/myWindows/myWindows.pri7
7 files changed, 521 insertions, 0 deletions
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/StdAfx.h b/src/libs/3rdparty/7zip/unix/CPP/myWindows/StdAfx.h
new file mode 100644
index 000000000..86ce117a9
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/StdAfx.h
@@ -0,0 +1,205 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+
+#include "config.h"
+
+#define MAXIMUM_WAIT_OBJECTS 64
+
+#define NO_INLINE /* FIXME */
+
+#ifdef ENV_HAVE_PTHREAD
+#include <pthread.h>
+#endif
+
+#include "Common/Common.h"
+#include "Common/MyWindows.h"
+#include "Common/MyTypes.h"
+
+#include "../include_windows/tchar.h"
+#include "../include_windows/windows.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <wchar.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <errno.h>
+#include <math.h>
+
+#ifdef __NETWARE__
+#include <sys/types.h>
+#endif
+
+#undef CS /* fix for Solaris 10 x86 */
+
+
+#ifdef __cplusplus
+# define EXTERN_C extern "C"
+#else
+# define EXTERN_C extern
+#endif
+
+
+/***************************/
+
+#ifndef ENV_HAVE_WCHAR__H
+
+EXTERN_C_BEGIN
+
+size_t wcslen(const wchar_t *);
+wchar_t *wcscpy(wchar_t * , const wchar_t * );
+wchar_t *wcscat(wchar_t * , const wchar_t * );
+
+EXTERN_C_END
+
+#endif
+
+/***************************/
+
+#define CLASS_E_CLASSNOTAVAILABLE ((HRESULT)0x80040111L)
+
+/************************* LastError *************************/
+inline DWORD WINAPI GetLastError(void) { return errno; }
+inline void WINAPI SetLastError( DWORD err ) { errno = err; }
+
+#define AreFileApisANSI() (1)
+
+void Sleep(unsigned millisleep);
+
+typedef pid_t t_processID;
+
+t_processID GetCurrentProcess(void);
+
+#define NORMAL_PRIORITY_CLASS (0)
+#define IDLE_PRIORITY_CLASS (10)
+void SetPriorityClass(t_processID , int priority);
+
+#ifdef __cplusplus
+class wxWindow;
+typedef wxWindow *HWND;
+
+#define MB_ICONERROR (0x00000200) // wxICON_ERROR
+#define MB_YESNOCANCEL (0x00000002 | 0x00000008 | 0x00000010) // wxYES | wxNO | wxCANCEL
+#define MB_ICONQUESTION (0x00000400) // wxICON_QUESTION
+#define MB_TASKMODAL (0) // FIXME
+#define MB_SYSTEMMODAL (0) // FIXME
+
+#define MB_OK (0x00000004) // wxOK
+#define MB_ICONSTOP (0x00000200) // wxICON_STOP
+#define MB_OKCANCEL (0x00000004 | 0x00000010) // wxOK | wxCANCEL
+
+#define MessageBox MessageBoxW
+int MessageBoxW(wxWindow * parent, const TCHAR * mes, const TCHAR * title,int flag);
+
+
+// FIXME
+#define IDCLOSE (5001) // wxID_CLOSE
+#define IDEXIT (5006) // wxID_EXIT
+#define IDOK (5100) // wxID_OK
+#define IDCANCEL (5101) // wxID_CANCEL
+#define IDABORT (5115) // wxID_ABORT
+#define IDYES (5103) // wxID_YES
+#define IDNO (5104) // wxID_NO
+#define IDHELP (5009) // wxID_HELP
+
+// Show
+#define SW_HIDE 0
+#define SW_SHOW 5
+
+
+
+typedef void *HINSTANCE;
+
+typedef int INT_PTR; // FIXME 64 bits ?
+typedef unsigned int UINT_PTR; // FIXME 64 bits ?
+typedef long LONG_PTR; // FIXME 64 bits ?
+typedef long DWORD_PTR; // FIXME 64 bits ?
+typedef UINT_PTR WPARAM;
+
+/* WARNING
+ LPARAM shall be 'long' because of CListView::SortItems and wxListCtrl::SortItems :
+*/
+typedef LONG_PTR LPARAM;
+typedef LONG_PTR LRESULT;
+
+
+#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
+#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
+
+
+#define CALLBACK /* */
+
+#define ERROR_NEGATIVE_SEEK 0x100131 // FIXME
+#define FACILITY_WIN32 7 // FIXME
+#define __HRESULT_FROM_WIN32(x) ((HRESULT)(x) > 0 ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : (HRESULT)(x) ) // FIXME
+
+/************ Windows2.h ***********/
+
+typedef void * WNDPROC;
+typedef void * CREATESTRUCT;
+typedef struct
+{
+ HWND hwndFrom;
+
+ UINT code;
+#define NM_DBLCLK 1
+#define LVN_ITEMCHANGED 2
+#define LVN_COLUMNCLICK 3
+#define CBEN_BEGINEDIT 10
+#define CBEN_ENDEDITW 11
+
+
+} NMHDR;
+typedef NMHDR * LPNMHDR;
+
+typedef struct tagNMLISTVIEW
+{
+ NMHDR hdr;
+ INT iItem;
+ INT iSubItem;
+ UINT uNewState;
+ UINT uOldState;
+ // UINT uChanged;
+ // POINT ptAction;
+ LPARAM lParam;
+} NMLISTVIEW, *LPNMLISTVIEW;
+
+typedef void * LPNMITEMACTIVATE;
+
+#define NM_RCLICK 1234 /* FIXME */
+
+// FIXME
+#define WM_CREATE 1
+#define WM_COMMAND 2
+#define WM_NOTIFY 3
+#define WM_DESTROY 4
+#define WM_CLOSE 5
+
+#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
+#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
+
+
+/************ LANG ***********/
+typedef WORD LANGID;
+
+LANGID GetUserDefaultLangID(void);
+LANGID GetSystemDefaultLangID(void);
+
+#define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
+#define SUBLANGID(l) ((WORD)(l) >> 10)
+
+#if defined( __x86_64__ )
+
+#define _WIN64 1
+
+#endif
+
+#endif
+
+#endif
+
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/config.h b/src/libs/3rdparty/7zip/unix/CPP/myWindows/config.h
new file mode 100644
index 000000000..ee7d11882
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/config.h
@@ -0,0 +1,68 @@
+
+#if !defined(__DJGPP__)
+
+#ifndef __CYGWIN__
+ #define FILESYSTEM_IS_CASE_SENSITIVE 1
+#endif
+
+ #if !defined(ENV_MACOSX) && !defined(ENV_BEOS)
+
+ /* <wchar.h> */
+ /* ENV_HAVE_WCHAR__H and not ENV_HAVE_WCHAR_H to avoid warning with wxWidgets */
+ #define ENV_HAVE_WCHAR__H
+
+ /* <wctype.h> */
+ #define ENV_HAVE_WCTYPE_H
+
+ /* mbrtowc */
+/* #ifndef __hpux */
+/* #define ENV_HAVE_MBRTOWC */
+/* #endif */
+
+ /* towupper */
+ #define ENV_HAVE_TOWUPPER
+
+ #endif /* !ENV_MACOSX && !ENV_BEOS */
+
+ #if !defined(ENV_BEOS) && !defined(ANDROID_NDK)
+
+ #define ENV_HAVE_GETPASS
+
+ #if !defined(sun)
+ #define ENV_HAVE_TIMEGM
+ #endif
+
+ #endif
+
+ /* lstat, readlink and S_ISLNK */
+ #define ENV_HAVE_LSTAT
+
+ /* <locale.h> */
+ #define ENV_HAVE_LOCALE
+
+ /* mbstowcs */
+ #define ENV_HAVE_MBSTOWCS
+
+ /* wcstombs */
+ #define ENV_HAVE_WCSTOMBS
+
+#endif /* !__DJGPP__ */
+
+#ifndef ENV_BEOS
+#define ENV_HAVE_PTHREAD
+#endif
+
+/* ANDROID don't have wcstombs or mbstowcs ? */
+#if defined(ENV_MACOSX) || defined(ANDROID_NDK)
+#define LOCALE_IS_UTF8
+#endif
+
+#ifdef LOCALE_IS_UTF8
+#undef ENV_HAVE_LOCALE
+#undef ENV_HAVE_MBSTOWCS
+#undef ENV_HAVE_WCSTOMBS
+/* #undef ENV_HAVE_MBRTOWC */
+#endif
+
+#define MAX_PATHNAME_LEN 1024
+
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/initguid.h b/src/libs/3rdparty/7zip/unix/CPP/myWindows/initguid.h
new file mode 100644
index 000000000..f7580d571
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/initguid.h
@@ -0,0 +1,4 @@
+// initguid.h
+
+#include "Common/MyInitGuid.h"
+
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/myCommandLineParser.cpp b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myCommandLineParser.cpp
new file mode 100644
index 000000000..37f4fe991
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myCommandLineParser.cpp
@@ -0,0 +1,45 @@
+/**************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+#include "../CPP/Common/MyString.h"
+
+#include <QStringList>
+
+namespace NCommandLineParser {
+
+void SplitCommandLine(const UString &s, UStringVector &parts)
+{
+ parts.Clear();
+
+ const QString cmdLine = QString::fromStdWString(static_cast<const wchar_t*>(s));
+ const QStringList args = cmdLine.simplified().split(QLatin1Char(' '), QString::SkipEmptyParts);
+ foreach (const QString &arg, args)
+ parts.Add(arg.toStdWString().c_str());
+}
+
+} // namespace NCommandLineParser
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/myDateAndTime.cpp b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myDateAndTime.cpp
new file mode 100644
index 000000000..0c8deef18
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myDateAndTime.cpp
@@ -0,0 +1,175 @@
+/**************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+#include "windows.h"
+
+#include <QDateTime>
+
+#include <chrono>
+
+/*
+ MSDN description about FILETIME structure:
+
+ The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals
+ since January 1, 1601 (UTC).
+
+ The DeltaToEpochInMsec can be calculated like this:
+
+ \code
+ quint64 delta = quint64(QDateTime(QDate(1601, 1, 1)).msecsTo(QDateTime(QDate(1970, 1, 1))))
+ * 10000ULL;
+ \endcode
+
+ But since the value is static, we use a precalculated number here.
+*/
+static const ULONGLONG DeltaToEpochInMsec = 116444736000000000ULL;
+
+inline void LocalDateTimeToFileTime(const QDateTime &dt, ULONGLONG utcOffsetInMsec, FILETIME *ft)
+{
+ const ULONGLONG msec = dt.toMSecsSinceEpoch() + utcOffsetInMsec;
+ const ULONGLONG nano100 = (msec * 10000ULL) + DeltaToEpochInMsec;
+
+ ft->dwLowDateTime = nano100;
+ ft->dwHighDateTime = nano100 >> 32;
+
+}
+
+inline void UTCDateTimeToSystemTime(const QDateTime &dt, SYSTEMTIME *st)
+{
+ const QDate date = dt.date();
+ const QTime time = dt.time();
+
+ st->wYear = date.year();
+ st->wMonth = date.month();
+ st->wDayOfWeek = date.dayOfWeek();
+ st->wDay = date.day();
+ st->wHour = time.hour();
+ st->wMinute = time.minute();
+ st->wSecond = time.second();
+ st->wMilliseconds = time.msec();
+}
+
+
+// -- WINAPI
+
+BOOL WINAPI FileTimeToSystemTime(CONST FILETIME *source,SYSTEMTIME *target)
+{
+ const QDateTime dt = QDateTime(QDate(1601, 1, 1), QTime(0, 0, 0, 1), Qt::UTC).addMSecs
+ ((ULONGLONG(source->dwLowDateTime) + (ULONGLONG(source->dwHighDateTime) << 32)) / 10000ULL);
+ UTCDateTimeToSystemTime(dt.toUTC(), target);
+ return TRUE;
+}
+
+BOOL WINAPI FileTimeToLocalFileTime(CONST FILETIME *source,FILETIME *target)
+{
+ const QDateTime dt = QDateTime(QDate(1601, 1, 1), QTime(0, 0, 0, 1), Qt::UTC).addMSecs
+ ((ULONGLONG(source->dwLowDateTime) + (ULONGLONG(source->dwHighDateTime) << 32)) / 10000ULL);
+
+ LocalDateTimeToFileTime(dt.toLocalTime(), ULONGLONG(QDateTime::currentDateTime()
+ .offsetFromUtc()) * 1000ULL, target);
+ return TRUE;
+}
+
+BOOLEAN WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *Time, DWORD *Seconds)
+{
+ /*
+ MSDN suggests to implement the function like this:
+
+ 1. Call SystemTimeToFileTime to copy the system time to a FILETIME structure. Call
+ GetSystemTime to get the current system time to pass to SystemTimeToFileTime.
+ 2. Copy the contents of the FILETIME structure to a ULARGE_INTEGER structure.
+ 3. Initialize a SYSTEMTIME structure with the date and time of the first second of
+ January 1, 1970.
+ 4. Call SystemTimeToFileTime, passing the SYSTEMTIME structure initialized in Step 3
+ to the call.
+ 5. Copy the contents of the FILETIME structure returned by SystemTimeToFileTime in Step 4
+ to a second ULARGE_INTEGER. The copied value should be less than or equal to the value
+ copied in Step 2.
+ 6. Subtract the 64-bit value in the ULARGE_INTEGER structure initialized in Step 5
+ (January 1, 1970) from the 64-bit value of the ULARGE_INTEGER structure initialized
+ in Step 2 (the current system time). This produces a value in 100-nanosecond intervals
+ since January 1, 1970. To convert this value to seconds, divide by 10,000,000.
+
+ We can omit step 1 and 2, cause we get the LARGE_INTEGER passed as function argument.
+ */
+ SYSTEMTIME stFirstSecondOf1979;
+ stFirstSecondOf1979.wSecond = 1;
+ stFirstSecondOf1979.wMinute = 0;
+ stFirstSecondOf1979.wHour = 0;
+ stFirstSecondOf1979.wDay = 1;
+ stFirstSecondOf1979.wMonth = 1;
+ stFirstSecondOf1979.wYear = 1970;
+ stFirstSecondOf1979.wDayOfWeek = 4;
+
+ FILETIME ftFirstSecondOf1979;
+ SystemTimeToFileTime(&stFirstSecondOf1979, &ftFirstSecondOf1979);
+
+ LARGE_INTEGER liFirstSecondOf1979;
+ liFirstSecondOf1979.LowPart = ftFirstSecondOf1979.dwLowDateTime;
+ liFirstSecondOf1979.HighPart = ftFirstSecondOf1979.dwHighDateTime;
+
+ const ULONGLONG diffNano100 = Time->QuadPart - liFirstSecondOf1979.QuadPart;
+ *Seconds = diffNano100 / 10000000ULL;
+
+ return TRUE;
+}
+
+void WINAPI RtlSecondsSince1970ToFileTime(DWORD Seconds, FILETIME *ft)
+{
+ const ULONGLONG nano100 = (ULONGLONG(Seconds) * 10000000ULL) + DeltaToEpochInMsec;
+ ft->dwLowDateTime = nano100;
+ ft->dwHighDateTime = nano100 >> 32;
+}
+
+VOID WINAPI GetSystemTime(SYSTEMTIME *st)
+{
+ UTCDateTimeToSystemTime(QDateTime::currentDateTimeUtc(), st);
+}
+
+VOID WINAPI GetSystemTimeAsFileTime(FILETIME *time)
+{
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, time);
+}
+
+DWORD WINAPI GetTickCount()
+{
+ using namespace std::chrono;
+ return duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count();
+}
+
+BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME *lpSystemTime, FILETIME *lpFileTime)
+{
+ const QDateTime dt(QDate(lpSystemTime->wYear, lpSystemTime->wMonth, lpSystemTime->wDay),
+ QTime(lpSystemTime->wHour, lpSystemTime->wMinute, lpSystemTime->wSecond,
+ lpSystemTime->wMilliseconds), Qt::UTC);
+
+ LocalDateTimeToFileTime(dt.toLocalTime(), 0ULL, lpFileTime);
+ return TRUE;
+}
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/myPrivate.h b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myPrivate.h
new file mode 100644
index 000000000..73739d095
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myPrivate.h
@@ -0,0 +1,17 @@
+
+void WINAPI RtlSecondsSince1970ToFileTime( DWORD Seconds, FILETIME * ft );
+
+extern "C" int global_use_utf16_conversion;
+#ifdef ENV_HAVE_LSTAT
+extern "C" int global_use_lstat;
+#endif
+
+const char *my_getlocale(void);
+
+#ifdef NEED_NAME_WINDOWS_TO_UNIX
+static inline const char * nameWindowToUnix(const char * lpFileName) {
+ if ((lpFileName[0] == 'c') && (lpFileName[1] == ':')) return lpFileName+2;
+ return lpFileName;
+}
+#endif
+
diff --git a/src/libs/3rdparty/7zip/unix/CPP/myWindows/myWindows.pri b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myWindows.pri
new file mode 100644
index 000000000..0875fdb1f
--- /dev/null
+++ b/src/libs/3rdparty/7zip/unix/CPP/myWindows/myWindows.pri
@@ -0,0 +1,7 @@
+HEADERS += $$7ZIP_BASE/CPP/myWindows/StdAfx.h \
+ $$7ZIP_BASE/CPP/myWindows/config.h \
+ $$7ZIP_BASE/CPP/myWindows/initguid.h \
+ $$7ZIP_BASE/CPP/myWindows/myPrivate.h
+
+SOURCES += $$7ZIP_BASE/CPP/myWindows/myDateAndTime.cpp \
+ $$7ZIP_BASE/CPP/myWindows/myCommandLineParser.cpp