diff -Nru unrar-nonfree-6.1.4/consio.cpp unrar-nonfree-6.1.5/consio.cpp --- unrar-nonfree-6.1.4/consio.cpp 2022-01-24 07:33:17.000000000 +0000 +++ unrar-nonfree-6.1.5/consio.cpp 2022-02-22 11:55:52.000000000 +0000 @@ -171,18 +171,33 @@ { #ifdef _WIN_ALL HANDLE hConIn=GetStdHandle(STD_INPUT_HANDLE); - HANDLE hConOut=GetStdHandle(STD_OUTPUT_HANDLE); - DWORD ConInMode,ConOutMode; - DWORD Read=0; + DWORD ConInMode; GetConsoleMode(hConIn,&ConInMode); - GetConsoleMode(hConOut,&ConOutMode); - SetConsoleMode(hConIn,ENABLE_LINE_INPUT); - SetConsoleMode(hConOut,ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT); + SetConsoleMode(hConIn,ENABLE_LINE_INPUT); // Remove ENABLE_ECHO_INPUT. + // We prefer ReadConsole to ReadFile, so we can read Unicode input. + DWORD Read=0; ReadConsole(hConIn,Str,MaxLength-1,&Read,NULL); Str[Read]=0; SetConsoleMode(hConIn,ConInMode); - SetConsoleMode(hConOut,ConOutMode); + + // If entered password is longer than MAXPASSWORD and truncated, + // read its unread part anyway, so it isn't read later as the second + // password for -p switch. Low level FlushConsoleInputBuffer doesn't help + // for high level ReadConsole, which in line input mode seems to store + // the rest of string in its own internal buffer. + if (wcschr(Str,'\r')==NULL) // If '\r' is missing, the password was truncated. + while (true) + { + wchar Trail[64]; + DWORD TrailRead=0; + // Use ASIZE(Trail)-1 to reserve the space for trailing 0. + ReadConsole(hConIn,Trail,ASIZE(Trail)-1,&TrailRead,NULL); + Trail[TrailRead]=0; + if (TrailRead==0 || wcschr(Trail,'\r')!=NULL) + break; + } + #else char StrA[MAXPASSWORD*4]; // "*4" for multibyte UTF-8 characters. #if defined(_EMX) || defined (__VMS) diff -Nru unrar-nonfree-6.1.4/debian/changelog unrar-nonfree-6.1.5/debian/changelog --- unrar-nonfree-6.1.4/debian/changelog 2022-01-28 16:28:41.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/changelog 2022-02-22 14:22:19.000000000 +0000 @@ -1,3 +1,10 @@ +unrar-nonfree (1:6.1.5-1) unstable; urgency=medium + + * New upstream version 6.1.5 + * Rediff patches + + -- YOKOTA Hiroshi Tue, 22 Feb 2022 23:22:19 +0900 + unrar-nonfree (1:6.1.4-1) unstable; urgency=medium * New upstream version 6.1.4 diff -Nru unrar-nonfree-6.1.4/debian/patches/0001-fix-buildflags.patch unrar-nonfree-6.1.5/debian/patches/0001-fix-buildflags.patch --- unrar-nonfree-6.1.4/debian/patches/0001-fix-buildflags.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0001-fix-buildflags.patch 2022-02-22 14:19:08.000000000 +0000 @@ -14,7 +14,7 @@ 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile -index 214f87e..8eda2e4 100644 +index ace156c..ae76a60 100644 --- a/makefile +++ b/makefile @@ -3,12 +3,12 @@ diff -Nru unrar-nonfree-6.1.4/debian/patches/0002-Show-warnings.patch unrar-nonfree-6.1.5/debian/patches/0002-Show-warnings.patch --- unrar-nonfree-6.1.4/debian/patches/0002-Show-warnings.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0002-Show-warnings.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile -index 8eda2e4..360c39a 100644 +index ae76a60..6a230f1 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,7 @@ diff -Nru unrar-nonfree-6.1.4/debian/patches/0003-Don-t-strip-debug-symbols-Closes-866142.patch unrar-nonfree-6.1.5/debian/patches/0003-Don-t-strip-debug-symbols-Closes-866142.patch --- unrar-nonfree-6.1.4/debian/patches/0003-Don-t-strip-debug-symbols-Closes-866142.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0003-Don-t-strip-debug-symbols-Closes-866142.patch 2022-02-22 14:19:08.000000000 +0000 @@ -10,7 +10,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile -index 360c39a..92866d6 100644 +index 6a230f1..491bec0 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,7 @@ CXX=c++ diff -Nru unrar-nonfree-6.1.4/debian/patches/0004-Cosmetic-fix.patch unrar-nonfree-6.1.5/debian/patches/0004-Cosmetic-fix.patch --- unrar-nonfree-6.1.4/debian/patches/0004-Cosmetic-fix.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0004-Cosmetic-fix.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/makefile b/makefile -index 92866d6..1e29fec 100644 +index 491bec0..ab46dff 100644 --- a/makefile +++ b/makefile @@ -2,14 +2,14 @@ diff -Nru unrar-nonfree-6.1.4/debian/patches/0005-Import-variables-from-Debian-package-builder.patch unrar-nonfree-6.1.5/debian/patches/0005-Import-variables-from-Debian-package-builder.patch --- unrar-nonfree-6.1.4/debian/patches/0005-Import-variables-from-Debian-package-builder.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0005-Import-variables-from-Debian-package-builder.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile -index 1e29fec..bd5c0a7 100644 +index ab46dff..f982fad 100644 --- a/makefile +++ b/makefile @@ -3,9 +3,9 @@ diff -Nru unrar-nonfree-6.1.4/debian/patches/0006-Keep-output-files-from-clean-target.patch unrar-nonfree-6.1.5/debian/patches/0006-Keep-output-files-from-clean-target.patch --- unrar-nonfree-6.1.4/debian/patches/0006-Keep-output-files-from-clean-target.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0006-Keep-output-files-from-clean-target.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 2 insertions(+) diff --git a/makefile b/makefile -index bd5c0a7..2900c8f 100644 +index f982fad..4d8299c 100644 --- a/makefile +++ b/makefile @@ -140,6 +140,8 @@ uninstall: uninstall-unrar diff -Nru unrar-nonfree-6.1.4/debian/patches/0007-Use-proper-library-file-name.patch unrar-nonfree-6.1.5/debian/patches/0007-Use-proper-library-file-name.patch --- unrar-nonfree-6.1.4/debian/patches/0007-Use-proper-library-file-name.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0007-Use-proper-library-file-name.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile -index 2900c8f..9a54f4a 100644 +index 4d8299c..ffe78c7 100644 --- a/makefile +++ b/makefile @@ -159,7 +159,9 @@ lib: WHAT=RARDLL diff -Nru unrar-nonfree-6.1.4/debian/patches/0008-No-need-PIC-option-to-static-lib.patch unrar-nonfree-6.1.5/debian/patches/0008-No-need-PIC-option-to-static-lib.patch --- unrar-nonfree-6.1.4/debian/patches/0008-No-need-PIC-option-to-static-lib.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0008-No-need-PIC-option-to-static-lib.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile -index 9a54f4a..ccc0c0c 100644 +index ffe78c7..3e9599c 100644 --- a/makefile +++ b/makefile @@ -158,10 +158,14 @@ sfx: clean $(OBJECTS) diff -Nru unrar-nonfree-6.1.4/debian/patches/0009-Fix-link-target.patch unrar-nonfree-6.1.5/debian/patches/0009-Fix-link-target.patch --- unrar-nonfree-6.1.4/debian/patches/0009-Fix-link-target.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0009-Fix-link-target.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile -index ccc0c0c..9b1f3ad 100644 +index 3e9599c..466621c 100644 --- a/makefile +++ b/makefile @@ -161,7 +161,7 @@ lib: clean $(OBJECTS) $(LIB_OBJ) diff -Nru unrar-nonfree-6.1.4/debian/patches/0010-Display-build-commands.patch unrar-nonfree-6.1.5/debian/patches/0010-Display-build-commands.patch --- unrar-nonfree-6.1.4/debian/patches/0010-Display-build-commands.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0010-Display-build-commands.patch 2022-02-22 14:19:08.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/makefile b/makefile -index 9b1f3ad..f057518 100644 +index 466621c..1536199 100644 --- a/makefile +++ b/makefile @@ -138,34 +138,34 @@ install: install-unrar diff -Nru unrar-nonfree-6.1.4/debian/patches/0011-Add-visibility-attribute-to-reduce-export-table.patch unrar-nonfree-6.1.5/debian/patches/0011-Add-visibility-attribute-to-reduce-export-table.patch --- unrar-nonfree-6.1.4/debian/patches/0011-Add-visibility-attribute-to-reduce-export-table.patch 2022-01-28 16:23:13.000000000 +0000 +++ unrar-nonfree-6.1.5/debian/patches/0011-Add-visibility-attribute-to-reduce-export-table.patch 2022-02-22 14:19:08.000000000 +0000 @@ -143,7 +143,7 @@ #ifdef __cplusplus } diff --git a/makefile b/makefile -index f057518..d2c927f 100644 +index 1536199..18829e3 100644 --- a/makefile +++ b/makefile @@ -4,7 +4,7 @@ diff -Nru unrar-nonfree-6.1.4/dll.rc unrar-nonfree-6.1.5/dll.rc --- unrar-nonfree-6.1.4/dll.rc 2022-01-24 01:37:50.000000000 +0000 +++ unrar-nonfree-6.1.5/dll.rc 2022-02-22 10:30:31.000000000 +0000 @@ -2,8 +2,8 @@ #include VS_VERSION_INFO VERSIONINFO -FILEVERSION 6, 10, 100, 389 -PRODUCTVERSION 6, 10, 100, 389 +FILEVERSION 6, 11, 1, 418 +PRODUCTVERSION 6, 11, 1, 418 FILEOS VOS__WINDOWS32 FILETYPE VFT_APP { @@ -14,8 +14,8 @@ VALUE "CompanyName", "Alexander Roshal\0" VALUE "ProductName", "RAR decompression library\0" VALUE "FileDescription", "RAR decompression library\0" - VALUE "FileVersion", "6.10.0\0" - VALUE "ProductVersion", "6.10.0\0" + VALUE "FileVersion", "6.11.1\0" + VALUE "ProductVersion", "6.11.1\0" VALUE "LegalCopyright", "Copyright © Alexander Roshal 1993-2022\0" VALUE "OriginalFilename", "Unrar.dll\0" } diff -Nru unrar-nonfree-6.1.4/extract.cpp unrar-nonfree-6.1.5/extract.cpp --- unrar-nonfree-6.1.4/extract.cpp 2022-01-24 07:33:17.000000000 +0000 +++ unrar-nonfree-6.1.5/extract.cpp 2022-02-22 11:55:53.000000000 +0000 @@ -666,8 +666,11 @@ if (Type==FSREDIR_HARDLINK || Type==FSREDIR_FILECOPY) { + wchar RedirName[NM]; + ConvertPath(Arc.FileHead.RedirName,RedirName,ASIZE(RedirName)); + wchar NameExisting[NM]; - ExtrPrepareName(Arc,Arc.FileHead.RedirName,NameExisting,ASIZE(NameExisting)); + ExtrPrepareName(Arc,RedirName,NameExisting,ASIZE(NameExisting)); if (FileCreateMode && *NameExisting!=0) // *NameExisting can be 0 in case of excessive -ap switch. if (Type==FSREDIR_HARDLINK) LinkSuccess=ExtractHardlink(Cmd,DestFileName,NameExisting,ASIZE(NameExisting)); diff -Nru unrar-nonfree-6.1.4/isnt.cpp unrar-nonfree-6.1.5/isnt.cpp --- unrar-nonfree-6.1.4/isnt.cpp 2022-01-24 07:33:18.000000000 +0000 +++ unrar-nonfree-6.1.5/isnt.cpp 2022-02-22 11:55:53.000000000 +0000 @@ -1,6 +1,5 @@ #include "rar.hpp" -#ifdef _WIN_ALL DWORD WinNT() { static int dwPlatformId=-1; @@ -22,4 +21,94 @@ return Result; } -#endif + + +// Replace it with documented Windows 11 check when available. +#include +#include +#pragma comment(lib, "wbemuuid.lib") + +static bool WMI_IsWindows10() +{ + IWbemLocator *pLoc = NULL; + + HRESULT hres = CoCreateInstance(CLSID_WbemLocator,0,CLSCTX_INPROC_SERVER, + IID_IWbemLocator,(LPVOID *)&pLoc); + + if (FAILED(hres)) + return false; + + IWbemServices *pSvc = NULL; + + hres = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"),NULL,NULL,0,NULL,0,0,&pSvc); + + if (FAILED(hres)) + { + pLoc->Release(); + return false; + } + + hres = CoSetProxyBlanket(pSvc,RPC_C_AUTHN_WINNT,RPC_C_AUTHZ_NONE,NULL, + RPC_C_AUTHN_LEVEL_CALL,RPC_C_IMP_LEVEL_IMPERSONATE,NULL,EOAC_NONE); + + if (FAILED(hres)) + { + pSvc->Release(); + pLoc->Release(); + return false; + } + + IEnumWbemClassObject *pEnumerator = NULL; + hres = pSvc->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM Win32_OperatingSystem"), + WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); + + if (FAILED(hres)) + { + pSvc->Release(); + pLoc->Release(); + return false; + } + + IWbemClassObject *pclsObj = NULL; + ULONG uReturn = 0; + + bool Win10=false; + while (pEnumerator!=NULL) + { + HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); + + if (uReturn==0) + break; + + VARIANT vtProp; + + hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0); + Win10|=wcsstr(vtProp.bstrVal,L"Windows 10")!=NULL; + VariantClear(&vtProp); + + pclsObj->Release(); + } + + pSvc->Release(); + pLoc->Release(); + pEnumerator->Release(); + + return Win10; +} + + +// Replace it with actual check when available. +bool IsWindows11OrGreater() +{ + static bool IsSet=false,IsWin11=false; + if (!IsSet) + { + OSVERSIONINFO WinVer; + WinVer.dwOSVersionInfoSize=sizeof(WinVer); + GetVersionEx(&WinVer); + IsWin11=WinVer.dwMajorVersion>10 || + WinVer.dwMajorVersion==10 && WinVer.dwBuildNumber >= 22000 && !WMI_IsWindows10(); + IsSet=true; + } + return IsWin11; +} diff -Nru unrar-nonfree-6.1.4/isnt.hpp unrar-nonfree-6.1.5/isnt.hpp --- unrar-nonfree-6.1.4/isnt.hpp 2022-01-24 07:33:18.000000000 +0000 +++ unrar-nonfree-6.1.5/isnt.hpp 2022-02-22 11:55:53.000000000 +0000 @@ -10,4 +10,7 @@ DWORD WinNT(); +// Replace it with actual check when available. +bool IsWindows11OrGreater(); + #endif diff -Nru unrar-nonfree-6.1.4/makefile unrar-nonfree-6.1.5/makefile --- unrar-nonfree-6.1.4/makefile 2020-05-21 09:13:21.000000000 +0000 +++ unrar-nonfree-6.1.5/makefile 2022-02-22 10:43:06.000000000 +0000 @@ -123,7 +123,7 @@ LIB_OBJ=filestr.o scantree.o dll.o qopen.o OBJECTS=rar.o strlist.o strfn.o pathfn.o smallfn.o global.o file.o filefn.o filcreat.o \ - archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o rawread.o encname.o \ + archive.o arcread.o unicode.o system.o crypt.o crc.o rawread.o encname.o \ resource.o match.o timefn.o rdwrfn.o consio.o options.o errhnd.o rarvm.o secpassword.o \ rijndael.o getbits.o sha1.o sha256.o blake2s.o hash.o extinfo.o extract.o volume.o \ list.o find.o unpack.o headers.o threadpool.o rs16.o cmddata.o ui.o diff -Nru unrar-nonfree-6.1.4/pathfn.cpp unrar-nonfree-6.1.5/pathfn.cpp --- unrar-nonfree-6.1.4/pathfn.cpp 2022-01-24 07:33:18.000000000 +0000 +++ unrar-nonfree-6.1.5/pathfn.cpp 2022-02-22 11:55:53.000000000 +0000 @@ -1044,7 +1044,9 @@ else if (Devices[J][K]==0) { - MatchFound=s[K]==0 || s[K]=='.' || IsPathDiv(s[K]); + // Names like aux.txt are accessible without \\?\ prefix + // since Windows 11. Pure aux is still prohibited. + MatchFound=s[K]==0 || s[K]=='.' && !IsWindows11OrGreater() || IsPathDiv(s[K]); break; } else diff -Nru unrar-nonfree-6.1.4/version.hpp unrar-nonfree-6.1.5/version.hpp --- unrar-nonfree-6.1.4/version.hpp 2022-01-24 07:33:19.000000000 +0000 +++ unrar-nonfree-6.1.5/version.hpp 2022-02-22 11:55:54.000000000 +0000 @@ -1,6 +1,6 @@ #define RARVER_MAJOR 6 -#define RARVER_MINOR 10 -#define RARVER_BETA 0 -#define RARVER_DAY 24 -#define RARVER_MONTH 1 +#define RARVER_MINOR 11 +#define RARVER_BETA 1 +#define RARVER_DAY 22 +#define RARVER_MONTH 2 #define RARVER_YEAR 2022